@docusaurus/theme-classic 0.0.0-4366 → 0.0.0-4377
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/index.js +0 -2
- package/lib/theme-classic.d.ts +57 -161
- package/lib-next/theme/CodeBlock/index.js +1 -1
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +3 -3
- package/lib-next/theme/DocItem/index.js +7 -4
- package/lib-next/theme/DocSidebar/index.js +2 -2
- package/lib-next/theme/DocSidebarItem/index.js +3 -16
- package/lib-next/theme/DocSidebarItems/index.js +26 -0
- package/{src/theme/hooks/styles.css → lib-next/theme/DocSidebarItems/styles.module.css} +11 -2
- package/lib-next/theme/DocVersionBanner/index.js +4 -1
- package/lib-next/theme/Heading/index.js +39 -42
- package/lib-next/theme/Layout/index.js +1 -2
- package/lib-next/theme/LayoutProviders/index.js +6 -6
- package/lib-next/theme/MDXComponents/index.js +6 -6
- package/lib-next/theme/Navbar/index.js +6 -6
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +4 -66
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +5 -2
- package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +5 -2
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +1 -1
- package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +5 -5
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
- package/lib-next/theme/NavbarItem/index.js +0 -2
- package/lib-next/theme/{ThemeContext.js → NavbarItem/utils.js} +3 -3
- package/lib-next/theme/Tabs/__tests__/index.test.js +8 -6
- package/lib-next/theme/Tabs/index.js +6 -3
- package/lib-next/theme/ThemedImage/index.js +2 -2
- package/package.json +12 -12
- package/src/index.ts +0 -4
- package/src/theme/CodeBlock/index.tsx +1 -1
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +3 -3
- package/src/theme/DocItem/index.tsx +7 -4
- package/src/theme/DocSidebar/index.tsx +2 -2
- package/src/theme/DocSidebarItem/index.tsx +3 -19
- package/src/theme/DocSidebarItems/index.tsx +31 -0
- package/{lib-next/theme/hooks/styles.css → src/theme/DocSidebarItems/styles.module.css} +11 -2
- package/src/theme/DocVersionBanner/index.tsx +1 -1
- package/src/theme/Heading/index.tsx +39 -46
- package/src/theme/Layout/index.tsx +1 -2
- package/src/theme/LayoutProviders/index.tsx +6 -6
- package/src/theme/MDXComponents/index.tsx +6 -6
- package/src/theme/Navbar/index.tsx +6 -6
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
- package/src/theme/NavbarItem/DocNavbarItem.tsx +5 -2
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +7 -3
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +1 -1
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +1 -1
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +5 -5
- package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
- package/src/theme/NavbarItem/index.tsx +0 -3
- package/src/theme/{UserPreferencesContext.ts → NavbarItem/utils.ts} +3 -5
- package/src/theme/Tabs/index.tsx +6 -3
- package/src/theme/ThemedImage/index.tsx +2 -2
- package/src/theme-classic.d.ts +57 -161
- package/lib-next/theme/ThemeProvider/index.js +0 -28
- package/lib-next/theme/UserPreferencesContext.js +0 -9
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -27
- package/lib-next/theme/hooks/useDocs.js +0 -10
- package/lib-next/theme/hooks/useHideableNavbar.js +0 -66
- package/lib-next/theme/hooks/useKeyboardNavigation.js +0 -35
- package/lib-next/theme/hooks/useLockBodyScroll.js +0 -18
- package/lib-next/theme/hooks/usePrismTheme.js +0 -20
- package/lib-next/theme/hooks/useTabGroupChoice.js +0 -39
- package/lib-next/theme/hooks/useTheme.js +0 -81
- package/lib-next/theme/hooks/useThemeContext.js +0 -22
- package/lib-next/theme/hooks/useUserPreferencesContext.js +0 -22
- package/lib-next/theme/hooks/useWindowSize.js +0 -59
- package/src/theme/ThemeContext.ts +0 -15
- package/src/theme/ThemeProvider/index.tsx +0 -28
- package/src/theme/UserPreferencesProvider/index.tsx +0 -30
- package/src/theme/hooks/useDocs.ts +0 -11
- package/src/theme/hooks/useHideableNavbar.ts +0 -72
- package/src/theme/hooks/useKeyboardNavigation.ts +0 -39
- package/src/theme/hooks/useLockBodyScroll.ts +0 -20
- package/src/theme/hooks/usePrismTheme.ts +0 -22
- package/src/theme/hooks/useTabGroupChoice.ts +0 -46
- package/src/theme/hooks/useTheme.ts +0 -91
- package/src/theme/hooks/useThemeContext.ts +0 -23
- package/src/theme/hooks/useUserPreferencesContext.ts +0 -25
- package/src/theme/hooks/useWindowSize.ts +0 -69
|
@@ -6,70 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import IconExternalLink from '@theme/IconExternalLink';
|
|
12
|
-
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
|
-
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
14
|
-
import {getInfimaActiveClassName} from './index';
|
|
15
|
-
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
16
|
-
export function NavLink({
|
|
17
|
-
activeBasePath,
|
|
18
|
-
activeBaseRegex,
|
|
19
|
-
to,
|
|
20
|
-
href,
|
|
21
|
-
label,
|
|
22
|
-
activeClassName = '',
|
|
23
|
-
prependBaseUrlToHref,
|
|
24
|
-
...props
|
|
25
|
-
}) {
|
|
26
|
-
// TODO all this seems hacky
|
|
27
|
-
// {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
|
|
28
|
-
const toUrl = useBaseUrl(to);
|
|
29
|
-
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
30
|
-
const normalizedHref = useBaseUrl(href, {
|
|
31
|
-
forcePrependBaseUrl: true,
|
|
32
|
-
});
|
|
33
|
-
const isExternalLink = label && href && !isInternalUrl(href);
|
|
34
|
-
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
35
|
-
return (
|
|
36
|
-
<Link
|
|
37
|
-
{...(href
|
|
38
|
-
? {
|
|
39
|
-
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
40
|
-
}
|
|
41
|
-
: {
|
|
42
|
-
isNavLink: true,
|
|
43
|
-
activeClassName: !props.className?.includes(activeClassName)
|
|
44
|
-
? activeClassName
|
|
45
|
-
: '',
|
|
46
|
-
to: toUrl,
|
|
47
|
-
...(activeBasePath || activeBaseRegex
|
|
48
|
-
? {
|
|
49
|
-
isActive: (_match, location) =>
|
|
50
|
-
activeBaseRegex
|
|
51
|
-
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
52
|
-
: location.pathname.startsWith(activeBaseUrl),
|
|
53
|
-
}
|
|
54
|
-
: null),
|
|
55
|
-
})}
|
|
56
|
-
{...props}>
|
|
57
|
-
{isExternalLink ? (
|
|
58
|
-
<span>
|
|
59
|
-
{label}
|
|
60
|
-
<IconExternalLink
|
|
61
|
-
{...(isDropdownLink && {
|
|
62
|
-
width: 12,
|
|
63
|
-
height: 12,
|
|
64
|
-
})}
|
|
65
|
-
/>
|
|
66
|
-
</span>
|
|
67
|
-
) : (
|
|
68
|
-
label
|
|
69
|
-
)}
|
|
70
|
-
</Link>
|
|
71
|
-
);
|
|
72
|
-
}
|
|
9
|
+
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
10
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
73
11
|
|
|
74
12
|
function DefaultNavbarItemDesktop({
|
|
75
13
|
className,
|
|
@@ -77,7 +15,7 @@ function DefaultNavbarItemDesktop({
|
|
|
77
15
|
...props
|
|
78
16
|
}) {
|
|
79
17
|
const element = (
|
|
80
|
-
<
|
|
18
|
+
<NavbarNavLink
|
|
81
19
|
className={clsx(
|
|
82
20
|
isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
|
|
83
21
|
className,
|
|
@@ -100,7 +38,7 @@ function DefaultNavbarItemMobile({
|
|
|
100
38
|
}) {
|
|
101
39
|
return (
|
|
102
40
|
<li className="menu__list-item">
|
|
103
|
-
<
|
|
41
|
+
<NavbarNavLink className={clsx('menu__link', className)} {...props} />
|
|
104
42
|
</li>
|
|
105
43
|
);
|
|
106
44
|
}
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useLatestVersion,
|
|
11
|
+
useActiveDocContext,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
10
13
|
import clsx from 'clsx';
|
|
11
|
-
import {getInfimaActiveClassName} from '
|
|
14
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
12
15
|
import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
|
|
13
16
|
|
|
14
17
|
function getDocInVersions(versions, docId) {
|
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useLatestVersion,
|
|
11
|
+
useActiveDocContext,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
10
13
|
import clsx from 'clsx';
|
|
11
|
-
import {getInfimaActiveClassName} from '
|
|
14
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
12
15
|
import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
|
|
13
16
|
|
|
14
17
|
function getSidebarLink(versions, sidebarId) {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
useVersions,
|
|
12
12
|
useLatestVersion,
|
|
13
13
|
useActiveDocContext,
|
|
14
|
-
} from '@
|
|
14
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
15
15
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
16
16
|
import {translate} from '@docusaurus/Translate';
|
|
17
17
|
|
|
@@ -6,7 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
useActiveVersion,
|
|
11
|
+
useLatestVersion,
|
|
12
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
10
13
|
import {useDocsPreferredVersion} from '@docusaurus/theme-common';
|
|
11
14
|
|
|
12
15
|
const getVersionMainDoc = (version) =>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
isRegexpStringMatch,
|
|
14
14
|
useLocalPathname,
|
|
15
15
|
} from '@docusaurus/theme-common';
|
|
16
|
-
import
|
|
16
|
+
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
17
17
|
import NavbarItem from '@theme/NavbarItem';
|
|
18
18
|
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
19
19
|
|
|
@@ -63,7 +63,7 @@ function DropdownNavbarItemDesktop({items, position, className, ...props}) {
|
|
|
63
63
|
'dropdown--right': position === 'right',
|
|
64
64
|
'dropdown--show': showDropdown,
|
|
65
65
|
})}>
|
|
66
|
-
<
|
|
66
|
+
<NavbarNavLink
|
|
67
67
|
href={props.to ? undefined : '#'}
|
|
68
68
|
className={clsx('navbar__link', className)}
|
|
69
69
|
{...props}
|
|
@@ -75,7 +75,7 @@ function DropdownNavbarItemDesktop({items, position, className, ...props}) {
|
|
|
75
75
|
}
|
|
76
76
|
}}>
|
|
77
77
|
{props.children ?? props.label}
|
|
78
|
-
</
|
|
78
|
+
</NavbarNavLink>
|
|
79
79
|
<ul className="dropdown__menu">
|
|
80
80
|
{items.map((childItemProps, i) => (
|
|
81
81
|
<NavbarItem
|
|
@@ -124,7 +124,7 @@ function DropdownNavbarItemMobile({
|
|
|
124
124
|
className={clsx('menu__list-item', {
|
|
125
125
|
'menu__list-item--collapsed': collapsed,
|
|
126
126
|
})}>
|
|
127
|
-
<
|
|
127
|
+
<NavbarNavLink
|
|
128
128
|
role="button"
|
|
129
129
|
className={clsx('menu__link menu__link--sublist', className)}
|
|
130
130
|
{...props}
|
|
@@ -133,7 +133,7 @@ function DropdownNavbarItemMobile({
|
|
|
133
133
|
toggleCollapsed();
|
|
134
134
|
}}>
|
|
135
135
|
{props.children ?? props.label}
|
|
136
|
-
</
|
|
136
|
+
</NavbarNavLink>
|
|
137
137
|
<Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
|
|
138
138
|
{items.map((childItemProps, i) => (
|
|
139
139
|
<NavbarItem
|
|
@@ -0,0 +1,70 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
9
|
+
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
10
|
+
import IconExternalLink from '@theme/IconExternalLink';
|
|
11
|
+
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
12
|
+
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
13
|
+
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
14
|
+
export default function NavbarNavLink({
|
|
15
|
+
activeBasePath,
|
|
16
|
+
activeBaseRegex,
|
|
17
|
+
to,
|
|
18
|
+
href,
|
|
19
|
+
label,
|
|
20
|
+
activeClassName = '',
|
|
21
|
+
prependBaseUrlToHref,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
// TODO all this seems hacky
|
|
25
|
+
// {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
|
|
26
|
+
const toUrl = useBaseUrl(to);
|
|
27
|
+
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
28
|
+
const normalizedHref = useBaseUrl(href, {
|
|
29
|
+
forcePrependBaseUrl: true,
|
|
30
|
+
});
|
|
31
|
+
const isExternalLink = label && href && !isInternalUrl(href);
|
|
32
|
+
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
33
|
+
return (
|
|
34
|
+
<Link
|
|
35
|
+
{...(href
|
|
36
|
+
? {
|
|
37
|
+
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
38
|
+
}
|
|
39
|
+
: {
|
|
40
|
+
isNavLink: true,
|
|
41
|
+
activeClassName: !props.className?.includes(activeClassName)
|
|
42
|
+
? activeClassName
|
|
43
|
+
: '',
|
|
44
|
+
to: toUrl,
|
|
45
|
+
...(activeBasePath || activeBaseRegex
|
|
46
|
+
? {
|
|
47
|
+
isActive: (_match, location) =>
|
|
48
|
+
activeBaseRegex
|
|
49
|
+
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
50
|
+
: location.pathname.startsWith(activeBaseUrl),
|
|
51
|
+
}
|
|
52
|
+
: null),
|
|
53
|
+
})}
|
|
54
|
+
{...props}>
|
|
55
|
+
{isExternalLink ? (
|
|
56
|
+
<span>
|
|
57
|
+
{label}
|
|
58
|
+
<IconExternalLink
|
|
59
|
+
{...(isDropdownLink && {
|
|
60
|
+
width: 12,
|
|
61
|
+
height: 12,
|
|
62
|
+
})}
|
|
63
|
+
/>
|
|
64
|
+
</span>
|
|
65
|
+
) : (
|
|
66
|
+
label
|
|
67
|
+
)}
|
|
68
|
+
</Link>
|
|
69
|
+
);
|
|
70
|
+
}
|
|
@@ -46,8 +46,6 @@ function getComponentType(type, isDropdown) {
|
|
|
46
46
|
return type;
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export const getInfimaActiveClassName = (mobile) =>
|
|
50
|
-
mobile ? 'menu__link--active' : 'navbar__link--active';
|
|
51
49
|
export default function NavbarItem({type, ...props}) {
|
|
52
50
|
const componentType = getComponentType(type, props.items !== undefined);
|
|
53
51
|
const NavbarItemComponent = getNavbarItemComponent(componentType);
|
|
@@ -4,6 +4,6 @@
|
|
|
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
|
-
|
|
8
|
-
const
|
|
9
|
-
|
|
7
|
+
// eslint-disable-next-line import/no-named-export
|
|
8
|
+
export const getInfimaActiveClassName = (mobile) =>
|
|
9
|
+
mobile ? 'menu__link--active' : 'navbar__link--active';
|
|
@@ -8,8 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import renderer from 'react-test-renderer';
|
|
9
9
|
import Tabs from '../index';
|
|
10
10
|
import TabItem from '../../TabItem';
|
|
11
|
-
import
|
|
12
|
-
|
|
11
|
+
import {
|
|
12
|
+
TabGroupChoiceProvider,
|
|
13
|
+
ScrollControllerProvider,
|
|
14
|
+
} from '@docusaurus/theme-common';
|
|
13
15
|
describe('Tabs', () => {
|
|
14
16
|
test('Should reject bad Tabs child', () => {
|
|
15
17
|
expect(() => {
|
|
@@ -55,7 +57,7 @@ describe('Tabs', () => {
|
|
|
55
57
|
expect(() => {
|
|
56
58
|
renderer.create(
|
|
57
59
|
<ScrollControllerProvider>
|
|
58
|
-
<
|
|
60
|
+
<TabGroupChoiceProvider>
|
|
59
61
|
<Tabs>
|
|
60
62
|
<TabItem value="v1">Tab 1</TabItem>
|
|
61
63
|
<TabItem value="v2">Tab 2</TabItem>
|
|
@@ -112,7 +114,7 @@ describe('Tabs', () => {
|
|
|
112
114
|
Tab 2
|
|
113
115
|
</TabItem>
|
|
114
116
|
</Tabs>
|
|
115
|
-
</
|
|
117
|
+
</TabGroupChoiceProvider>
|
|
116
118
|
</ScrollControllerProvider>,
|
|
117
119
|
);
|
|
118
120
|
}).not.toThrow(); // TODO Better Jest infrastructure to mock the Layout
|
|
@@ -123,7 +125,7 @@ describe('Tabs', () => {
|
|
|
123
125
|
const tabs = ['Apple', 'Banana', 'Carrot'];
|
|
124
126
|
renderer.create(
|
|
125
127
|
<ScrollControllerProvider>
|
|
126
|
-
<
|
|
128
|
+
<TabGroupChoiceProvider>
|
|
127
129
|
<Tabs
|
|
128
130
|
values={tabs.map((t, idx) => ({
|
|
129
131
|
label: t,
|
|
@@ -134,7 +136,7 @@ describe('Tabs', () => {
|
|
|
134
136
|
<TabItem value={idx}>{t}</TabItem>
|
|
135
137
|
))}
|
|
136
138
|
</Tabs>
|
|
137
|
-
</
|
|
139
|
+
</TabGroupChoiceProvider>
|
|
138
140
|
</ScrollControllerProvider>,
|
|
139
141
|
);
|
|
140
142
|
}).not.toThrow();
|
|
@@ -6,8 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useState, cloneElement, Children, isValidElement} from 'react';
|
|
8
8
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
|
-
import
|
|
10
|
-
|
|
9
|
+
import {
|
|
10
|
+
useScrollPositionBlocker,
|
|
11
|
+
duplicates,
|
|
12
|
+
useTabGroupChoice,
|
|
13
|
+
} from '@docusaurus/theme-common';
|
|
11
14
|
import clsx from 'clsx';
|
|
12
15
|
import styles from './styles.module.css'; // A very rough duck type, but good enough to guard against mistakes while
|
|
13
16
|
// allowing customization
|
|
@@ -72,7 +75,7 @@ function TabsComponent(props) {
|
|
|
72
75
|
);
|
|
73
76
|
}
|
|
74
77
|
|
|
75
|
-
const {tabGroupChoices, setTabGroupChoices} =
|
|
78
|
+
const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
|
|
76
79
|
const [selectedValue, setSelectedValue] = useState(defaultValue);
|
|
77
80
|
const tabRefs = [];
|
|
78
81
|
const {blockElementScrollPositionUntilNextRender} =
|
|
@@ -7,12 +7,12 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
10
|
-
import
|
|
10
|
+
import {useColorMode} from '@docusaurus/theme-common';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
|
|
13
13
|
function ThemedImage(props) {
|
|
14
14
|
const isBrowser = useIsBrowser();
|
|
15
|
-
const {isDarkTheme} =
|
|
15
|
+
const {isDarkTheme} = useColorMode();
|
|
16
16
|
const {sources, className, alt = '', ...propsRest} = props;
|
|
17
17
|
const clientThemes = isDarkTheme ? ['dark'] : ['light'];
|
|
18
18
|
const renderedSourceNames = isBrowser
|
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-4377",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
31
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4377",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4377",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4377",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4377",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4377",
|
|
31
|
+
"@docusaurus/theme-translations": "0.0.0-4377",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4377",
|
|
33
|
+
"@docusaurus/utils-validation": "0.0.0-4377",
|
|
34
34
|
"@mdx-js/mdx": "^1.6.21",
|
|
35
35
|
"@mdx-js/react": "^1.6.21",
|
|
36
36
|
"clsx": "^1.1.1",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"rtlcss": "^3.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
49
|
-
"@docusaurus/types": "0.0.0-
|
|
48
|
+
"@docusaurus/module-type-aliases": "0.0.0-4377",
|
|
49
|
+
"@docusaurus/types": "0.0.0-4377",
|
|
50
50
|
"@types/mdx-js__react": "^1.5.4",
|
|
51
51
|
"@types/parse-numeric-range": "^0.0.1",
|
|
52
52
|
"@types/rtlcss": "^3.1.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=14"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "5dea134d7853ad86c969384e51bc51c1e7b9fc8a"
|
|
65
65
|
}
|
package/src/index.ts
CHANGED
|
@@ -171,10 +171,6 @@ export default function docusaurusThemeClassic(
|
|
|
171
171
|
.join('|');
|
|
172
172
|
|
|
173
173
|
return {
|
|
174
|
-
ignoreWarnings: [
|
|
175
|
-
// See https://github.com/facebook/docusaurus/pull/3382
|
|
176
|
-
(e) => e.message.includes("Can't resolve '@theme-init/hooks/useDocs"),
|
|
177
|
-
],
|
|
178
174
|
plugins: [
|
|
179
175
|
new ContextReplacementPlugin(
|
|
180
176
|
/prismjs[\\/]components$/,
|
|
@@ -16,8 +16,8 @@ import {
|
|
|
16
16
|
parseLanguage,
|
|
17
17
|
parseLines,
|
|
18
18
|
ThemeClassNames,
|
|
19
|
+
usePrismTheme,
|
|
19
20
|
} from '@docusaurus/theme-common';
|
|
20
|
-
import usePrismTheme from '@theme/hooks/usePrismTheme';
|
|
21
21
|
import type {Props} from '@theme/CodeBlock';
|
|
22
22
|
|
|
23
23
|
import styles from './styles.module.css';
|
|
@@ -13,7 +13,7 @@ import DocPaginator from '@theme/DocPaginator';
|
|
|
13
13
|
import Seo from '@theme/Seo';
|
|
14
14
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
15
15
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
16
|
-
import
|
|
16
|
+
import Heading from '@theme/Heading';
|
|
17
17
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
18
18
|
|
|
19
19
|
import styles from './styles.module.css';
|
|
@@ -35,9 +35,9 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
35
35
|
<DocVersionBanner />
|
|
36
36
|
<DocVersionBadge />
|
|
37
37
|
<header>
|
|
38
|
-
<
|
|
38
|
+
<Heading as="h1" className={styles.title}>
|
|
39
39
|
{categoryGeneratedIndex.title}
|
|
40
|
-
</
|
|
40
|
+
</Heading>
|
|
41
41
|
{categoryGeneratedIndex.description && (
|
|
42
42
|
<p>{categoryGeneratedIndex.description}</p>
|
|
43
43
|
)}
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import useWindowSize from '@theme/hooks/useWindowSize';
|
|
11
10
|
import DocPaginator from '@theme/DocPaginator';
|
|
12
11
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
13
12
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
@@ -16,9 +15,9 @@ import type {Props} from '@theme/DocItem';
|
|
|
16
15
|
import DocItemFooter from '@theme/DocItemFooter';
|
|
17
16
|
import TOC from '@theme/TOC';
|
|
18
17
|
import TOCCollapsible from '@theme/TOCCollapsible';
|
|
19
|
-
import
|
|
18
|
+
import Heading from '@theme/Heading';
|
|
20
19
|
import styles from './styles.module.css';
|
|
21
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
20
|
+
import {ThemeClassNames, useWindowSize} from '@docusaurus/theme-common';
|
|
22
21
|
|
|
23
22
|
export default function DocItem(props: Props): JSX.Element {
|
|
24
23
|
const {content: DocContent} = props;
|
|
@@ -80,7 +79,11 @@ export default function DocItem(props: Props): JSX.Element {
|
|
|
80
79
|
To make both cases consistent, the added title is added under the same div.markdown block
|
|
81
80
|
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
82
81
|
*/}
|
|
83
|
-
{shouldAddTitle &&
|
|
82
|
+
{shouldAddTitle && (
|
|
83
|
+
<header>
|
|
84
|
+
<Heading as="h1">{title}</Heading>
|
|
85
|
+
</header>
|
|
86
|
+
)}
|
|
84
87
|
|
|
85
88
|
<DocContent />
|
|
86
89
|
</div>
|
|
@@ -14,12 +14,12 @@ import {
|
|
|
14
14
|
type MobileSecondaryMenuComponent,
|
|
15
15
|
ThemeClassNames,
|
|
16
16
|
useScrollPosition,
|
|
17
|
+
useWindowSize,
|
|
17
18
|
} from '@docusaurus/theme-common';
|
|
18
|
-
import useWindowSize from '@theme/hooks/useWindowSize';
|
|
19
19
|
import Logo from '@theme/Logo';
|
|
20
20
|
import IconArrow from '@theme/IconArrow';
|
|
21
21
|
import {translate} from '@docusaurus/Translate';
|
|
22
|
-
import
|
|
22
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
23
23
|
import type {Props} from '@theme/DocSidebar';
|
|
24
24
|
|
|
25
25
|
import styles from './styles.module.css';
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, {useEffect,
|
|
8
|
+
import React, {useEffect, useMemo} from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
import {
|
|
11
11
|
isActiveSidebarItem,
|
|
@@ -20,7 +20,8 @@ import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
|
20
20
|
import {translate} from '@docusaurus/Translate';
|
|
21
21
|
import IconExternalLink from '@theme/IconExternalLink';
|
|
22
22
|
|
|
23
|
-
import
|
|
23
|
+
import DocSidebarItems from '@theme/DocSidebarItems';
|
|
24
|
+
import type {Props} from '@theme/DocSidebarItem';
|
|
24
25
|
import type {
|
|
25
26
|
PropSidebarItemCategory,
|
|
26
27
|
PropSidebarItemLink,
|
|
@@ -29,23 +30,6 @@ import type {
|
|
|
29
30
|
import styles from './styles.module.css';
|
|
30
31
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
31
32
|
|
|
32
|
-
// Optimize sidebar at each "level"
|
|
33
|
-
// TODO this item should probably not receive the "activePath" props
|
|
34
|
-
// TODO this triggers whole sidebar re-renders on navigation
|
|
35
|
-
export const DocSidebarItems = memo(
|
|
36
|
-
({items, ...props}: DocSidebarItemsProps): JSX.Element => (
|
|
37
|
-
<>
|
|
38
|
-
{items.map((item, index) => (
|
|
39
|
-
<DocSidebarItem
|
|
40
|
-
key={index} // sidebar is static, the index does not change
|
|
41
|
-
item={item}
|
|
42
|
-
{...props}
|
|
43
|
-
/>
|
|
44
|
-
))}
|
|
45
|
-
</>
|
|
46
|
-
),
|
|
47
|
-
);
|
|
48
|
-
|
|
49
33
|
export default function DocSidebarItem({
|
|
50
34
|
item,
|
|
51
35
|
...props
|
|
@@ -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
|
+
import React, {memo} from 'react';
|
|
9
|
+
|
|
10
|
+
import DocSidebarItem from '@theme/DocSidebarItem';
|
|
11
|
+
|
|
12
|
+
import type {Props} from '@theme/DocSidebarItems';
|
|
13
|
+
|
|
14
|
+
// TODO this item should probably not receive the "activePath" props
|
|
15
|
+
// TODO this triggers whole sidebar re-renders on navigation
|
|
16
|
+
function DocSidebarItems({items, ...props}: Props): JSX.Element {
|
|
17
|
+
return (
|
|
18
|
+
<>
|
|
19
|
+
{items.map((item, index) => (
|
|
20
|
+
<DocSidebarItem
|
|
21
|
+
key={index} // sidebar is static, the index does not change
|
|
22
|
+
item={item}
|
|
23
|
+
{...props}
|
|
24
|
+
/>
|
|
25
|
+
))}
|
|
26
|
+
</>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Optimize sidebar at each "level"
|
|
31
|
+
export default memo(DocSidebarItems);
|
|
@@ -5,6 +5,15 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
@media (min-width: 997px) {
|
|
9
|
+
.menuLinkText {
|
|
10
|
+
cursor: initial;
|
|
11
|
+
}
|
|
12
|
+
.menuLinkText:hover {
|
|
13
|
+
background: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.menuLinkText.hasHref {
|
|
17
|
+
cursor: pointer;
|
|
18
|
+
}
|
|
10
19
|
}
|