@docusaurus/theme-classic 2.0.0-beta.13 → 2.0.0-beta.15
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/README.md +1 -1
- package/lib/index.js +7 -16
- package/lib/theme-classic.d.ts +111 -188
- package/lib/translations.js +13 -4
- package/lib/validateThemeConfig.js +18 -4
- package/lib-next/theme/Admonition/index.js +101 -0
- package/lib-next/theme/BackToTopButton/styles.module.css +1 -1
- package/lib-next/theme/BlogListPaginator/index.js +12 -12
- package/lib-next/theme/BlogPostAuthor/index.js +1 -1
- package/lib-next/theme/BlogPostAuthors/index.js +12 -2
- package/lib-next/theme/BlogPostAuthors/styles.module.css +10 -0
- package/lib-next/theme/BlogPostItem/index.js +12 -15
- package/lib-next/theme/BlogPostPage/index.js +10 -7
- package/lib-next/theme/BlogPostPaginator/index.js +11 -15
- package/lib-next/theme/BlogSidebar/styles.module.css +2 -0
- package/lib-next/theme/CodeBlock/index.js +51 -10
- package/lib-next/theme/CodeBlock/styles.module.css +18 -7
- package/lib-next/theme/DocCard/styles.module.css +3 -3
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +6 -3
- package/lib-next/theme/DocItem/index.js +9 -6
- package/lib-next/theme/DocItem/styles.module.css +2 -2
- package/lib-next/theme/DocPage/index.js +7 -3
- package/lib-next/theme/DocPage/styles.module.css +1 -0
- package/lib-next/theme/DocPaginator/index.js +11 -13
- package/lib-next/theme/DocSidebar/index.js +2 -2
- package/lib-next/theme/DocSidebar/styles.module.css +1 -0
- package/lib-next/theme/DocSidebarItem/index.js +43 -21
- package/lib-next/theme/DocSidebarItem/styles.module.css +1 -0
- package/lib-next/theme/DocSidebarItems/index.js +28 -0
- package/{lib/theme/DocSidebarItem → lib-next/theme/DocSidebarItems}/styles.module.css +1 -0
- package/lib-next/theme/DocVersionBanner/index.js +4 -1
- package/lib-next/theme/Footer/index.js +73 -35
- package/lib-next/theme/Footer/styles.module.css +2 -1
- package/lib-next/theme/Heading/index.js +39 -43
- package/lib-next/theme/Heading/styles.css +1 -1
- package/lib-next/theme/Layout/index.js +1 -2
- package/lib-next/theme/LayoutHead/index.js +5 -9
- package/lib-next/theme/LayoutProviders/index.js +6 -6
- package/lib-next/theme/MDXComponents/index.js +18 -31
- package/lib-next/theme/MDXComponents/styles.css +4 -0
- package/lib-next/theme/MDXPage/index.js +3 -10
- 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 +73 -0
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -3
- package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +6 -7
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
- package/lib-next/theme/NavbarItem/index.js +1 -2
- package/lib-next/theme/{UserPreferencesContext.js → NavbarItem/utils.js} +3 -3
- package/lib-next/theme/PaginatorNavLink/index.js +20 -0
- package/lib-next/theme/SkipToContent/index.js +1 -1
- package/lib-next/theme/SkipToContent/styles.module.css +7 -0
- package/lib-next/theme/TOCCollapsible/styles.module.css +2 -2
- package/lib-next/theme/Tabs/__tests__/index.test.js +8 -6
- package/lib-next/theme/Tabs/index.js +20 -10
- package/lib-next/theme/Tag/styles.module.css +4 -4
- package/lib-next/theme/ThemedImage/index.js +2 -2
- package/lib-next/theme/Toggle/styles.module.css +16 -15
- package/lib-next/theme/prism-include-languages.js +10 -3
- package/package.json +17 -19
- package/src/index.ts +12 -26
- package/src/theme/Admonition/index.tsx +106 -0
- package/src/theme/BackToTopButton/styles.module.css +1 -1
- package/src/theme/BlogListPaginator/index.tsx +12 -12
- package/src/theme/BlogPostAuthor/index.tsx +1 -1
- package/src/theme/BlogPostAuthors/index.tsx +12 -2
- package/src/theme/BlogPostAuthors/styles.module.css +10 -0
- package/src/theme/BlogPostItem/index.tsx +13 -15
- package/src/theme/BlogPostPage/index.tsx +10 -7
- package/src/theme/BlogPostPaginator/index.tsx +11 -15
- package/src/theme/BlogSidebar/styles.module.css +2 -0
- package/src/theme/CodeBlock/index.tsx +52 -11
- package/src/theme/CodeBlock/styles.module.css +18 -7
- package/src/theme/DocCard/index.tsx +2 -2
- package/src/theme/DocCard/styles.module.css +3 -3
- package/src/theme/DocCardList/index.tsx +1 -1
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +7 -3
- package/src/theme/DocItem/index.tsx +9 -6
- package/src/theme/DocItem/styles.module.css +2 -2
- package/src/theme/DocItemFooter/index.tsx +1 -1
- package/src/theme/DocPage/index.tsx +8 -4
- package/src/theme/DocPage/styles.module.css +1 -0
- package/src/theme/DocPaginator/index.tsx +13 -15
- package/src/theme/DocSidebar/index.tsx +3 -3
- package/src/theme/DocSidebar/styles.module.css +1 -0
- package/src/theme/DocSidebarItem/index.tsx +34 -23
- package/src/theme/DocSidebarItem/styles.module.css +1 -0
- package/src/theme/DocSidebarItems/index.tsx +32 -0
- package/{lib/theme/DocItemFooter → src/theme/DocSidebarItems}/styles.module.css +10 -8
- package/src/theme/DocVersionBanner/index.tsx +3 -3
- package/src/theme/Footer/index.tsx +84 -38
- package/src/theme/Footer/styles.module.css +2 -1
- package/src/theme/Heading/index.tsx +39 -47
- package/src/theme/Heading/styles.css +1 -1
- package/src/theme/Layout/index.tsx +1 -2
- package/src/theme/LayoutHead/index.tsx +4 -8
- package/src/theme/LayoutProviders/index.tsx +6 -6
- package/src/theme/MDXComponents/index.tsx +26 -37
- package/src/theme/MDXComponents/styles.css +4 -0
- package/src/theme/MDXPage/index.tsx +3 -11
- package/src/theme/Navbar/index.tsx +7 -7
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
- package/src/theme/NavbarItem/DocNavbarItem.tsx +8 -5
- package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +84 -0
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +9 -6
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +6 -7
- package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
- package/src/theme/NavbarItem/index.tsx +3 -5
- package/{lib-next/theme/hooks/styles.css → src/theme/NavbarItem/utils.ts} +3 -3
- package/src/theme/PaginatorNavLink/index.tsx +22 -0
- package/src/theme/SkipToContent/index.tsx +1 -1
- package/src/theme/SkipToContent/styles.module.css +7 -0
- package/src/theme/TOCCollapsible/styles.module.css +2 -2
- package/src/theme/TOCItems/index.tsx +2 -2
- package/src/theme/Tabs/index.tsx +25 -10
- package/src/theme/Tag/styles.module.css +4 -4
- package/src/theme/TagsListByLetter/index.tsx +1 -1
- package/src/theme/ThemedImage/index.tsx +2 -2
- package/src/theme/Toggle/index.tsx +1 -1
- package/src/theme/Toggle/styles.module.css +16 -15
- package/src/theme/prism-include-languages.ts +10 -3
- package/src/theme-classic.d.ts +111 -188
- package/src/translations.ts +36 -16
- package/src/validateThemeConfig.ts +25 -4
- package/babel.config.js +0 -35
- package/lib/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib/__tests__/translations.test.js +0 -112
- package/lib/__tests__/validateThemeConfig.test.js +0 -607
- package/lib/theme/AnnouncementBar/index.js +0 -68
- package/lib/theme/AnnouncementBar/styles.module.css +0 -63
- package/lib/theme/BackToTopButton/index.js +0 -140
- package/lib/theme/BackToTopButton/styles.module.css +0 -42
- package/lib/theme/BlogArchivePage/index.js +0 -89
- package/lib/theme/BlogLayout/index.js +0 -51
- package/lib/theme/BlogListPage/index.js +0 -60
- package/lib/theme/BlogListPaginator/index.js +0 -63
- package/lib/theme/BlogPostAuthor/index.js +0 -51
- package/lib/theme/BlogPostAuthor/styles.module.css +0 -12
- package/lib/theme/BlogPostAuthors/index.js +0 -47
- package/lib/theme/BlogPostAuthors/styles.module.css +0 -11
- package/lib/theme/BlogPostItem/index.js +0 -152
- package/lib/theme/BlogPostItem/styles.module.css +0 -18
- package/lib/theme/BlogPostPage/index.js +0 -82
- package/lib/theme/BlogPostPaginator/index.js +0 -64
- package/lib/theme/BlogSidebar/index.js +0 -49
- package/lib/theme/BlogSidebar/styles.module.css +0 -44
- package/lib/theme/BlogTagsListPage/index.js +0 -40
- package/lib/theme/BlogTagsPostsPage/index.js +0 -86
- package/lib/theme/CodeBlock/index.js +0 -133
- package/lib/theme/CodeBlock/styles.module.css +0 -65
- package/lib/theme/Details/index.js +0 -30
- package/lib/theme/Details/styles.module.css +0 -13
- package/lib/theme/DocCard/index.js +0 -84
- package/lib/theme/DocCard/styles.module.css +0 -43
- package/lib/theme/DocCardList/index.js +0 -28
- package/lib/theme/DocCategoryGeneratedIndexPage/index.js +0 -57
- package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +0 -18
- package/lib/theme/DocItem/index.js +0 -112
- package/lib/theme/DocItem/styles.module.css +0 -22
- package/lib/theme/DocItemFooter/index.js +0 -79
- package/lib/theme/DocPage/index.js +0 -154
- package/lib/theme/DocPage/styles.module.css +0 -85
- package/lib/theme/DocPaginator/index.js +0 -62
- package/lib/theme/DocSidebar/index.js +0 -134
- package/lib/theme/DocSidebar/styles.module.css +0 -106
- package/lib/theme/DocSidebarItem/index.js +0 -209
- package/lib/theme/DocTagDocListPage/index.js +0 -89
- package/lib/theme/DocTagsListPage/index.js +0 -44
- package/lib/theme/DocVersionBadge/index.js +0 -34
- package/lib/theme/DocVersionBanner/index.js +0 -130
- package/lib/theme/EditThisPage/index.js +0 -33
- package/lib/theme/ErrorPageContent.js +0 -43
- package/lib/theme/Footer/index.js +0 -119
- package/lib/theme/Footer/styles.module.css +0 -15
- package/lib/theme/Heading/index.js +0 -71
- package/lib/theme/Heading/styles.css +0 -22
- package/lib/theme/Heading/styles.module.css +0 -19
- package/lib/theme/IconArrow/index.js +0 -28
- package/lib/theme/IconClose/index.js +0 -31
- package/lib/theme/IconEdit/index.js +0 -34
- package/lib/theme/IconEdit/styles.module.css +0 -11
- package/lib/theme/IconExternalLink/index.js +0 -30
- package/lib/theme/IconExternalLink/styles.module.css +0 -12
- package/lib/theme/IconLanguage/index.js +0 -29
- package/lib/theme/IconMenu/index.js +0 -30
- package/lib/theme/LastUpdated/index.js +0 -63
- package/lib/theme/Layout/index.js +0 -68
- package/lib/theme/Layout/styles.css +0 -27
- package/lib/theme/LayoutHead/index.js +0 -149
- package/lib/theme/LayoutProviders/index.js +0 -40
- package/lib/theme/Logo/index.js +0 -62
- package/lib/theme/MDXComponents/index.js +0 -106
- package/lib/theme/MDXComponents/styles.css +0 -11
- package/lib/theme/MDXPage/index.js +0 -67
- package/lib/theme/MDXPage/styles.module.css +0 -10
- package/lib/theme/Navbar/index.js +0 -267
- package/lib/theme/Navbar/styles.module.css +0 -27
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -113
- package/lib/theme/NavbarItem/DocNavbarItem.js +0 -62
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +0 -83
- package/lib/theme/NavbarItem/DocsVersionNavbarItem.js +0 -43
- package/lib/theme/NavbarItem/DropdownNavbarItem.js +0 -155
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +0 -68
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +0 -11
- package/lib/theme/NavbarItem/SearchNavbarItem.js +0 -28
- package/lib/theme/NavbarItem/index.js +0 -74
- package/lib/theme/NotFound.js +0 -57
- package/lib/theme/SearchBar.js +0 -15
- package/lib/theme/SearchMetadata/index.js +0 -33
- package/lib/theme/Seo/index.js +0 -52
- package/lib/theme/SkipToContent/index.js +0 -71
- package/lib/theme/SkipToContent/styles.module.css +0 -14
- package/lib/theme/TOC/index.js +0 -39
- package/lib/theme/TOC/styles.module.css +0 -23
- package/lib/theme/TOCCollapsible/index.js +0 -53
- package/lib/theme/TOCCollapsible/styles.module.css +0 -50
- package/lib/theme/TOCInline/index.js +0 -33
- package/lib/theme/TOCInline/styles.module.css +0 -12
- package/lib/theme/TOCItems/index.js +0 -78
- package/lib/theme/TabItem/index.js +0 -32
- package/lib/theme/Tabs/__tests__/index.test.js +0 -123
- package/lib/theme/Tabs/index.js +0 -173
- package/lib/theme/Tabs/styles.module.css +0 -10
- package/lib/theme/Tag/index.js +0 -40
- package/lib/theme/Tag/styles.module.css +0 -70
- package/lib/theme/TagsListByLetter/index.js +0 -48
- package/lib/theme/TagsListByLetter/styles.module.css +0 -11
- package/lib/theme/TagsListInline/index.js +0 -44
- package/lib/theme/TagsListInline/styles.module.css +0 -15
- package/lib/theme/ThemeContext.js +0 -21
- package/lib/theme/ThemeProvider/index.js +0 -43
- package/lib/theme/ThemedImage/index.js +0 -47
- package/lib/theme/ThemedImage/styles.module.css +0 -18
- package/lib/theme/Toggle/index.js +0 -91
- package/lib/theme/Toggle/styles.module.css +0 -105
- package/lib/theme/UserPreferencesContext.js +0 -18
- package/lib/theme/UserPreferencesProvider/index.js +0 -41
- package/lib/theme/hooks/styles.css +0 -10
- package/lib/theme/hooks/useDocs.js +0 -18
- package/lib/theme/hooks/useHideableNavbar.js +0 -74
- package/lib/theme/hooks/useKeyboardNavigation.js +0 -45
- package/lib/theme/hooks/useLocationHash.js +0 -28
- package/lib/theme/hooks/useLockBodyScroll.js +0 -26
- package/lib/theme/hooks/usePrismTheme.js +0 -36
- package/lib/theme/hooks/useTabGroupChoice.js +0 -51
- package/lib/theme/hooks/useTheme.js +0 -97
- package/lib/theme/hooks/useThemeContext.js +0 -31
- package/lib/theme/hooks/useUserPreferencesContext.js +0 -31
- package/lib/theme/hooks/useWindowSize.js +0 -68
- package/lib/theme/prism-include-languages.js +0 -40
- package/lib-next/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/lib-next/__tests__/translations.test.js +0 -128
- package/lib-next/__tests__/validateThemeConfig.test.js +0 -607
- package/lib-next/admonitions.css +0 -35
- package/lib-next/deps.d.ts +0 -13
- package/lib-next/index.js +0 -227
- package/lib-next/prism-include-languages.js +0 -9
- package/lib-next/theme/ThemeContext.js +0 -9
- package/lib-next/theme/ThemeProvider/index.js +0 -28
- 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/useLocationHash.js +0 -20
- 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/lib-next/theme-classic.d.ts +0 -806
- package/lib-next/translations.js +0 -141
- package/lib-next/types.d.ts +0 -11
- package/lib-next/validateThemeConfig.js +0 -344
- package/src/__tests__/__snapshots__/translations.test.ts.snap +0 -116
- package/src/__tests__/translations.test.ts +0 -116
- package/src/__tests__/validateThemeConfig.test.js +0 -607
- package/src/theme/Tabs/__tests__/index.test.tsx +0 -129
- package/src/theme/ThemeContext.ts +0 -15
- package/src/theme/ThemeProvider/index.tsx +0 -28
- package/src/theme/UserPreferencesContext.ts +0 -12
- package/src/theme/UserPreferencesProvider/index.tsx +0 -30
- package/src/theme/hooks/styles.css +0 -10
- 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/useLocationHash.ts +0 -25
- 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
- package/tsconfig.json +0 -11
|
@@ -9,11 +9,16 @@ import React from 'react';
|
|
|
9
9
|
import clsx from 'clsx';
|
|
10
10
|
|
|
11
11
|
import Link from '@docusaurus/Link';
|
|
12
|
-
import {
|
|
12
|
+
import {
|
|
13
|
+
type FooterLinkItem,
|
|
14
|
+
useThemeConfig,
|
|
15
|
+
type MultiColumnFooter,
|
|
16
|
+
type SimpleFooter,
|
|
17
|
+
} from '@docusaurus/theme-common';
|
|
13
18
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
14
19
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
15
20
|
import styles from './styles.module.css';
|
|
16
|
-
import ThemedImage, {Props as ThemedImageProps} from '@theme/ThemedImage';
|
|
21
|
+
import ThemedImage, {type Props as ThemedImageProps} from '@theme/ThemedImage';
|
|
17
22
|
import IconExternalLink from '@theme/IconExternalLink';
|
|
18
23
|
|
|
19
24
|
function FooterLink({
|
|
@@ -66,6 +71,70 @@ function FooterLogo({
|
|
|
66
71
|
);
|
|
67
72
|
}
|
|
68
73
|
|
|
74
|
+
function MultiColumnLinks({links}: {links: MultiColumnFooter['links']}) {
|
|
75
|
+
return (
|
|
76
|
+
<>
|
|
77
|
+
{links.map((linkItem, i) => (
|
|
78
|
+
<div key={i} className="col footer__col">
|
|
79
|
+
<div className="footer__title">{linkItem.title}</div>
|
|
80
|
+
<ul className="footer__items">
|
|
81
|
+
{linkItem.items.map((item, key) =>
|
|
82
|
+
item.html ? (
|
|
83
|
+
<li
|
|
84
|
+
key={key}
|
|
85
|
+
className="footer__item"
|
|
86
|
+
// Developer provided the HTML, so assume it's safe.
|
|
87
|
+
// eslint-disable-next-line react/no-danger
|
|
88
|
+
dangerouslySetInnerHTML={{
|
|
89
|
+
__html: item.html,
|
|
90
|
+
}}
|
|
91
|
+
/>
|
|
92
|
+
) : (
|
|
93
|
+
<li key={item.href || item.to} className="footer__item">
|
|
94
|
+
<FooterLink {...item} />
|
|
95
|
+
</li>
|
|
96
|
+
),
|
|
97
|
+
)}
|
|
98
|
+
</ul>
|
|
99
|
+
</div>
|
|
100
|
+
))}
|
|
101
|
+
</>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function SimpleLinks({links}: {links: SimpleFooter['links']}) {
|
|
106
|
+
return (
|
|
107
|
+
<div className="footer__links">
|
|
108
|
+
{links.map((item, key) => (
|
|
109
|
+
<>
|
|
110
|
+
{item.html ? (
|
|
111
|
+
<span
|
|
112
|
+
key={key}
|
|
113
|
+
className="footer__link-item"
|
|
114
|
+
// Developer provided the HTML, so assume it's safe.
|
|
115
|
+
// eslint-disable-next-line react/no-danger
|
|
116
|
+
dangerouslySetInnerHTML={{
|
|
117
|
+
__html: item.html,
|
|
118
|
+
}}
|
|
119
|
+
/>
|
|
120
|
+
) : (
|
|
121
|
+
<FooterLink {...item} />
|
|
122
|
+
)}
|
|
123
|
+
{links.length !== key + 1 && (
|
|
124
|
+
<span className="footer__link-separator">·</span>
|
|
125
|
+
)}
|
|
126
|
+
</>
|
|
127
|
+
))}
|
|
128
|
+
</div>
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
function isMultiColumnFooterLinks(
|
|
133
|
+
links: MultiColumnFooter['links'] | SimpleFooter['links'],
|
|
134
|
+
): links is MultiColumnFooter['links'] {
|
|
135
|
+
return 'title' in links[0];
|
|
136
|
+
}
|
|
137
|
+
|
|
69
138
|
function Footer(): JSX.Element | null {
|
|
70
139
|
const {footer} = useThemeConfig();
|
|
71
140
|
|
|
@@ -84,41 +153,18 @@ function Footer(): JSX.Element | null {
|
|
|
84
153
|
className={clsx('footer', {
|
|
85
154
|
'footer--dark': footer.style === 'dark',
|
|
86
155
|
})}>
|
|
87
|
-
<div className="container">
|
|
88
|
-
{links &&
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
{linkItem.items.map((item, key) =>
|
|
100
|
-
item.html ? (
|
|
101
|
-
<li
|
|
102
|
-
key={key}
|
|
103
|
-
className="footer__item"
|
|
104
|
-
// Developer provided the HTML, so assume it's safe.
|
|
105
|
-
// eslint-disable-next-line react/no-danger
|
|
106
|
-
dangerouslySetInnerHTML={{
|
|
107
|
-
__html: item.html,
|
|
108
|
-
}}
|
|
109
|
-
/>
|
|
110
|
-
) : (
|
|
111
|
-
<li key={item.href || item.to} className="footer__item">
|
|
112
|
-
<FooterLink {...item} />
|
|
113
|
-
</li>
|
|
114
|
-
),
|
|
115
|
-
)}
|
|
116
|
-
</ul>
|
|
117
|
-
) : null}
|
|
118
|
-
</div>
|
|
119
|
-
))}
|
|
120
|
-
</div>
|
|
121
|
-
)}
|
|
156
|
+
<div className="container container-fluid">
|
|
157
|
+
{links &&
|
|
158
|
+
links.length > 0 &&
|
|
159
|
+
(isMultiColumnFooterLinks(links) ? (
|
|
160
|
+
<div className="row footer__links">
|
|
161
|
+
<MultiColumnLinks links={links} />
|
|
162
|
+
</div>
|
|
163
|
+
) : (
|
|
164
|
+
<div className="footer__links text--center">
|
|
165
|
+
<SimpleLinks links={links} />
|
|
166
|
+
</div>
|
|
167
|
+
))}
|
|
122
168
|
{(logo || copyright) && (
|
|
123
169
|
<div className="footer__bottom text--center">
|
|
124
170
|
{logo && (logo.src || logo.srcDark) && (
|
|
@@ -154,4 +200,4 @@ function Footer(): JSX.Element | null {
|
|
|
154
200
|
);
|
|
155
201
|
}
|
|
156
202
|
|
|
157
|
-
export default Footer;
|
|
203
|
+
export default React.memo(Footer);
|
|
@@ -7,63 +7,55 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import type {
|
|
10
|
+
import type {Props} from '@theme/Heading';
|
|
11
11
|
import {translate} from '@docusaurus/Translate';
|
|
12
12
|
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
13
13
|
|
|
14
14
|
import './styles.css';
|
|
15
15
|
import styles from './styles.module.css';
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function AnchorHeading({as: As, id, ...props}: Props) {
|
|
18
|
+
const {
|
|
19
|
+
navbar: {hideOnScroll},
|
|
20
|
+
} = useThemeConfig();
|
|
18
21
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
22
|
+
if (!id) {
|
|
23
|
+
return <As {...props} />;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<As
|
|
23
28
|
{...props}
|
|
24
|
-
|
|
25
|
-
|
|
29
|
+
className={clsx('anchor', {
|
|
30
|
+
[styles.anchorWithHideOnScrollNavbar]: hideOnScroll,
|
|
31
|
+
[styles.anchorWithStickyNavbar]: !hideOnScroll,
|
|
32
|
+
})}
|
|
33
|
+
id={id}>
|
|
26
34
|
{props.children}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
35
|
+
<a
|
|
36
|
+
className="hash-link"
|
|
37
|
+
href={`#${id}`}
|
|
38
|
+
title={translate({
|
|
39
|
+
id: 'theme.common.headingLinkTitle',
|
|
40
|
+
message: 'Direct link to heading',
|
|
41
|
+
description: 'Title for link to heading',
|
|
42
|
+
})}>
|
|
43
|
+
​
|
|
44
|
+
</a>
|
|
45
|
+
</As>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default function Heading({as, ...props}: Props): JSX.Element {
|
|
50
|
+
if (as === 'h1') {
|
|
42
51
|
return (
|
|
43
|
-
<
|
|
52
|
+
<h1
|
|
44
53
|
{...props}
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
[styles.anchorWithStickyNavbar]: !hideOnScroll,
|
|
48
|
-
})}
|
|
49
|
-
id={id}>
|
|
54
|
+
id={undefined} // h1 headings do not need an id because they don't appear in the TOC
|
|
55
|
+
>
|
|
50
56
|
{props.children}
|
|
51
|
-
|
|
52
|
-
aria-hidden="true"
|
|
53
|
-
className="hash-link"
|
|
54
|
-
href={`#${id}`}
|
|
55
|
-
title={translate({
|
|
56
|
-
id: 'theme.common.headingLinkTitle',
|
|
57
|
-
message: 'Direct link to heading',
|
|
58
|
-
description: 'Title for link to heading',
|
|
59
|
-
})}>
|
|
60
|
-
​
|
|
61
|
-
</a>
|
|
62
|
-
</Tag>
|
|
57
|
+
</h1>
|
|
63
58
|
);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
|
68
|
-
|
|
69
|
-
export default Heading;
|
|
59
|
+
}
|
|
60
|
+
return <AnchorHeading as={as} {...props} />;
|
|
61
|
+
}
|
|
@@ -15,8 +15,7 @@ import Footer from '@theme/Footer';
|
|
|
15
15
|
import LayoutProviders from '@theme/LayoutProviders';
|
|
16
16
|
import LayoutHead from '@theme/LayoutHead';
|
|
17
17
|
import type {Props} from '@theme/Layout';
|
|
18
|
-
import useKeyboardNavigation from '@theme
|
|
19
|
-
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
18
|
+
import {ThemeClassNames, useKeyboardNavigation} from '@docusaurus/theme-common';
|
|
20
19
|
import ErrorPageContent from '@theme/ErrorPageContent';
|
|
21
20
|
import './styles.css';
|
|
22
21
|
|
|
@@ -25,7 +25,7 @@ import {useLocation} from '@docusaurus/router';
|
|
|
25
25
|
// See https://github.com/facebook/docusaurus/issues/3317
|
|
26
26
|
function AlternateLangHeaders(): JSX.Element {
|
|
27
27
|
const {
|
|
28
|
-
i18n: {defaultLocale,
|
|
28
|
+
i18n: {defaultLocale, localeConfigs},
|
|
29
29
|
} = useDocusaurusContext();
|
|
30
30
|
const alternatePageUtils = useAlternatePageUtils();
|
|
31
31
|
|
|
@@ -33,7 +33,7 @@ function AlternateLangHeaders(): JSX.Element {
|
|
|
33
33
|
// See https://www.searchviu.com/en/multiple-hreflang-tags-one-url/
|
|
34
34
|
return (
|
|
35
35
|
<Head>
|
|
36
|
-
{
|
|
36
|
+
{Object.entries(localeConfigs).map(([locale, {htmlLang}]) => (
|
|
37
37
|
<link
|
|
38
38
|
key={locale}
|
|
39
39
|
rel="alternate"
|
|
@@ -41,7 +41,7 @@ function AlternateLangHeaders(): JSX.Element {
|
|
|
41
41
|
locale,
|
|
42
42
|
fullyQualified: true,
|
|
43
43
|
})}
|
|
44
|
-
hrefLang={
|
|
44
|
+
hrefLang={htmlLang}
|
|
45
45
|
/>
|
|
46
46
|
))}
|
|
47
47
|
<link
|
|
@@ -91,11 +91,7 @@ export default function LayoutHead(props: Props): JSX.Element {
|
|
|
91
91
|
const {title, description, image, keywords, searchMetadata} = props;
|
|
92
92
|
const faviconUrl = useBaseUrl(favicon);
|
|
93
93
|
const pageTitle = useTitleFormatter(title);
|
|
94
|
-
|
|
95
|
-
// See https://github.com/facebook/docusaurus/issues/3317#issuecomment-754661855
|
|
96
|
-
// const htmlLang = currentLocale.split('-')[0];
|
|
97
|
-
const htmlLang = currentLocale; // should we allow the user to override htmlLang with localeConfig?
|
|
98
|
-
const htmlDir = localeConfigs[currentLocale].direction;
|
|
94
|
+
const {htmlLang, direction: htmlDir} = localeConfigs[currentLocale];
|
|
99
95
|
|
|
100
96
|
return (
|
|
101
97
|
<>
|
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import ThemeProvider from '@theme/ThemeProvider';
|
|
10
|
-
import UserPreferencesProvider from '@theme/UserPreferencesProvider';
|
|
11
9
|
import {
|
|
10
|
+
ColorModeProvider,
|
|
11
|
+
TabGroupChoiceProvider,
|
|
12
12
|
AnnouncementBarProvider,
|
|
13
13
|
DocsPreferredVersionContextProvider,
|
|
14
14
|
MobileSecondaryMenuProvider,
|
|
@@ -18,9 +18,9 @@ import type {Props} from '@theme/LayoutProviders';
|
|
|
18
18
|
|
|
19
19
|
export default function LayoutProviders({children}: Props): JSX.Element {
|
|
20
20
|
return (
|
|
21
|
-
<
|
|
21
|
+
<ColorModeProvider>
|
|
22
22
|
<AnnouncementBarProvider>
|
|
23
|
-
<
|
|
23
|
+
<TabGroupChoiceProvider>
|
|
24
24
|
<ScrollControllerProvider>
|
|
25
25
|
<DocsPreferredVersionContextProvider>
|
|
26
26
|
<MobileSecondaryMenuProvider>
|
|
@@ -28,8 +28,8 @@ export default function LayoutProviders({children}: Props): JSX.Element {
|
|
|
28
28
|
</MobileSecondaryMenuProvider>
|
|
29
29
|
</DocsPreferredVersionContextProvider>
|
|
30
30
|
</ScrollControllerProvider>
|
|
31
|
-
</
|
|
31
|
+
</TabGroupChoiceProvider>
|
|
32
32
|
</AnnouncementBarProvider>
|
|
33
|
-
</
|
|
33
|
+
</ColorModeProvider>
|
|
34
34
|
);
|
|
35
35
|
}
|
|
@@ -5,10 +5,14 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import React, {
|
|
8
|
+
import React, {
|
|
9
|
+
type ComponentProps,
|
|
10
|
+
isValidElement,
|
|
11
|
+
type ReactElement,
|
|
12
|
+
} from 'react';
|
|
9
13
|
import Head from '@docusaurus/Head';
|
|
10
14
|
import Link from '@docusaurus/Link';
|
|
11
|
-
import CodeBlock
|
|
15
|
+
import CodeBlock from '@theme/CodeBlock';
|
|
12
16
|
import Heading from '@theme/Heading';
|
|
13
17
|
import Details from '@theme/Details';
|
|
14
18
|
import type {MDXComponentsObject} from '@theme/MDXComponents';
|
|
@@ -33,40 +37,25 @@ const MDXComponents: MDXComponentsObject = {
|
|
|
33
37
|
return <Head {...props}>{unwrappedChildren}</Head>;
|
|
34
38
|
},
|
|
35
39
|
code: (props) => {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
// For retrocompatibility purposes (pretty rare use case)
|
|
39
|
-
// See https://github.com/facebook/docusaurus/pull/1584
|
|
40
|
-
if (isValidElement(children)) {
|
|
41
|
-
return children;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
return !children.includes('\n') ? (
|
|
45
|
-
<code {...props} />
|
|
46
|
-
) : (
|
|
47
|
-
<CodeBlock {...props} />
|
|
40
|
+
const shouldBeInline = React.Children.toArray(props.children).every(
|
|
41
|
+
(el) => typeof el === 'string' && !el.includes('\n'),
|
|
48
42
|
);
|
|
49
|
-
},
|
|
50
|
-
a: (props) => <Link {...props} />,
|
|
51
|
-
pre: (props) => {
|
|
52
|
-
const {children} = props;
|
|
53
43
|
|
|
54
|
-
|
|
55
|
-
if (isValidElement(children) && isValidElement(children?.props?.children)) {
|
|
56
|
-
return children.props.children;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<CodeBlock
|
|
61
|
-
{...((isValidElement(children)
|
|
62
|
-
? children?.props
|
|
63
|
-
: {...props}) as Props)}
|
|
64
|
-
/>
|
|
65
|
-
);
|
|
44
|
+
return shouldBeInline ? <code {...props} /> : <CodeBlock {...props} />;
|
|
66
45
|
},
|
|
46
|
+
a: (props) => <Link {...props} />,
|
|
47
|
+
pre: (props) => (
|
|
48
|
+
<CodeBlock
|
|
49
|
+
// If this pre is created by a ``` fenced codeblock, unwrap the children
|
|
50
|
+
{...(isValidElement(props.children) &&
|
|
51
|
+
props.children.props.originalType === 'code'
|
|
52
|
+
? props.children?.props
|
|
53
|
+
: {...props})}
|
|
54
|
+
/>
|
|
55
|
+
),
|
|
67
56
|
details: (props): JSX.Element => {
|
|
68
57
|
const items = React.Children.toArray(props.children) as ReactElement[];
|
|
69
|
-
// Split summary item from the rest to pass it as a separate prop to the
|
|
58
|
+
// Split summary item from the rest to pass it as a separate prop to the Details theme component
|
|
70
59
|
const summary: ReactElement<ComponentProps<'summary'>> = items.find(
|
|
71
60
|
(item) => item?.props?.mdxType === 'summary',
|
|
72
61
|
)!;
|
|
@@ -78,12 +67,12 @@ const MDXComponents: MDXComponentsObject = {
|
|
|
78
67
|
</Details>
|
|
79
68
|
);
|
|
80
69
|
},
|
|
81
|
-
h1: Heading
|
|
82
|
-
h2: Heading
|
|
83
|
-
h3: Heading
|
|
84
|
-
h4: Heading
|
|
85
|
-
h5: Heading
|
|
86
|
-
h6: Heading
|
|
70
|
+
h1: (props) => <Heading as="h1" {...props} />,
|
|
71
|
+
h2: (props) => <Heading as="h2" {...props} />,
|
|
72
|
+
h3: (props) => <Heading as="h3" {...props} />,
|
|
73
|
+
h4: (props) => <Heading as="h4" {...props} />,
|
|
74
|
+
h5: (props) => <Heading as="h5" {...props} />,
|
|
75
|
+
h6: (props) => <Heading as="h6" {...props} />,
|
|
87
76
|
};
|
|
88
77
|
|
|
89
78
|
export default MDXComponents;
|
|
@@ -19,18 +19,10 @@ import styles from './styles.module.css';
|
|
|
19
19
|
function MDXPage(props: Props): JSX.Element {
|
|
20
20
|
const {content: MDXPageContent} = props;
|
|
21
21
|
const {
|
|
22
|
-
|
|
23
|
-
frontMatter,
|
|
24
|
-
metadata,
|
|
22
|
+
metadata: {title, description, permalink, frontMatter},
|
|
25
23
|
} = MDXPageContent;
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
title,
|
|
29
|
-
description,
|
|
30
|
-
wrapperClassName,
|
|
31
|
-
hide_table_of_contents: hideTableOfContents,
|
|
32
|
-
} = frontMatter;
|
|
33
|
-
const {permalink} = metadata;
|
|
24
|
+
const {wrapperClassName, hide_table_of_contents: hideTableOfContents} =
|
|
25
|
+
frontMatter;
|
|
34
26
|
|
|
35
27
|
return (
|
|
36
28
|
<Layout
|
|
@@ -10,18 +10,18 @@ import clsx from 'clsx';
|
|
|
10
10
|
import Translate from '@docusaurus/Translate';
|
|
11
11
|
import SearchBar from '@theme/SearchBar';
|
|
12
12
|
import Toggle from '@theme/Toggle';
|
|
13
|
-
import useThemeContext from '@theme/hooks/useThemeContext';
|
|
14
13
|
import {
|
|
15
14
|
useThemeConfig,
|
|
16
15
|
useMobileSecondaryMenuRenderer,
|
|
17
16
|
usePrevious,
|
|
18
17
|
useHistoryPopHandler,
|
|
18
|
+
useHideableNavbar,
|
|
19
|
+
useLockBodyScroll,
|
|
20
|
+
useWindowSize,
|
|
21
|
+
useColorMode,
|
|
19
22
|
} from '@docusaurus/theme-common';
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import useWindowSize from '@theme/hooks/useWindowSize';
|
|
23
|
-
import {useActivePlugin} from '@theme/hooks/useDocs';
|
|
24
|
-
import NavbarItem, {Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
23
|
+
import {useActivePlugin} from '@docusaurus/plugin-content-docs/client';
|
|
24
|
+
import NavbarItem, {type Props as NavbarItemConfig} from '@theme/NavbarItem';
|
|
25
25
|
import Logo from '@theme/Logo';
|
|
26
26
|
import IconMenu from '@theme/IconMenu';
|
|
27
27
|
import IconClose from '@theme/IconClose';
|
|
@@ -88,7 +88,7 @@ function useColorModeToggle() {
|
|
|
88
88
|
const {
|
|
89
89
|
colorMode: {disableSwitch},
|
|
90
90
|
} = useThemeConfig();
|
|
91
|
-
const {isDarkTheme, setLightTheme, setDarkTheme} =
|
|
91
|
+
const {isDarkTheme, setLightTheme, setDarkTheme} = useColorMode();
|
|
92
92
|
const toggle = useCallback(
|
|
93
93
|
(e) => (e.target.checked ? setDarkTheme() : setLightTheme()),
|
|
94
94
|
[setLightTheme, setDarkTheme],
|
|
@@ -7,71 +7,15 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
|
|
11
|
-
import
|
|
10
|
+
|
|
11
|
+
import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
|
|
12
|
+
|
|
12
13
|
import type {
|
|
13
|
-
NavLinkProps,
|
|
14
14
|
DesktopOrMobileNavBarItemProps,
|
|
15
15
|
Props,
|
|
16
16
|
} from '@theme/NavbarItem/DefaultNavbarItem';
|
|
17
|
-
import IconExternalLink from '@theme/IconExternalLink';
|
|
18
|
-
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
19
|
-
import {isRegexpStringMatch} from '@docusaurus/theme-common';
|
|
20
|
-
import {getInfimaActiveClassName} from './index';
|
|
21
|
-
|
|
22
|
-
const dropdownLinkActiveClass = 'dropdown__link--active';
|
|
23
|
-
|
|
24
|
-
export function NavLink({
|
|
25
|
-
activeBasePath,
|
|
26
|
-
activeBaseRegex,
|
|
27
|
-
to,
|
|
28
|
-
href,
|
|
29
|
-
label,
|
|
30
|
-
activeClassName = '',
|
|
31
|
-
prependBaseUrlToHref,
|
|
32
|
-
...props
|
|
33
|
-
}: NavLinkProps): JSX.Element {
|
|
34
|
-
// TODO all this seems hacky
|
|
35
|
-
// {to: 'version'} should probably be forbidden, in favor of {to: '/version'}
|
|
36
|
-
const toUrl = useBaseUrl(to);
|
|
37
|
-
const activeBaseUrl = useBaseUrl(activeBasePath);
|
|
38
|
-
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});
|
|
39
|
-
const isExternalLink = label && href && !isInternalUrl(href);
|
|
40
|
-
const isDropdownLink = activeClassName === dropdownLinkActiveClass;
|
|
41
17
|
|
|
42
|
-
|
|
43
|
-
<Link
|
|
44
|
-
{...(href
|
|
45
|
-
? {
|
|
46
|
-
href: prependBaseUrlToHref ? normalizedHref : href,
|
|
47
|
-
}
|
|
48
|
-
: {
|
|
49
|
-
isNavLink: true,
|
|
50
|
-
activeClassName: !props.className?.includes(activeClassName)
|
|
51
|
-
? activeClassName
|
|
52
|
-
: '',
|
|
53
|
-
to: toUrl,
|
|
54
|
-
...(activeBasePath || activeBaseRegex
|
|
55
|
-
? {
|
|
56
|
-
isActive: (_match, location) =>
|
|
57
|
-
activeBaseRegex
|
|
58
|
-
? isRegexpStringMatch(activeBaseRegex, location.pathname)
|
|
59
|
-
: location.pathname.startsWith(activeBaseUrl),
|
|
60
|
-
}
|
|
61
|
-
: null),
|
|
62
|
-
})}
|
|
63
|
-
{...props}>
|
|
64
|
-
{isExternalLink ? (
|
|
65
|
-
<span>
|
|
66
|
-
{label}
|
|
67
|
-
<IconExternalLink {...(isDropdownLink && {width: 12, height: 12})} />
|
|
68
|
-
</span>
|
|
69
|
-
) : (
|
|
70
|
-
label
|
|
71
|
-
)}
|
|
72
|
-
</Link>
|
|
73
|
-
);
|
|
74
|
-
}
|
|
18
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
75
19
|
|
|
76
20
|
function DefaultNavbarItemDesktop({
|
|
77
21
|
className,
|
|
@@ -79,7 +23,7 @@ function DefaultNavbarItemDesktop({
|
|
|
79
23
|
...props
|
|
80
24
|
}: DesktopOrMobileNavBarItemProps) {
|
|
81
25
|
const element = (
|
|
82
|
-
<
|
|
26
|
+
<NavbarNavLink
|
|
83
27
|
className={clsx(
|
|
84
28
|
isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
|
|
85
29
|
className,
|
|
@@ -102,7 +46,7 @@ function DefaultNavbarItemMobile({
|
|
|
102
46
|
}: DesktopOrMobileNavBarItemProps) {
|
|
103
47
|
return (
|
|
104
48
|
<li className="menu__list-item">
|
|
105
|
-
<
|
|
49
|
+
<NavbarNavLink className={clsx('menu__link', className)} {...props} />
|
|
106
50
|
</li>
|
|
107
51
|
);
|
|
108
52
|
}
|
|
@@ -7,14 +7,17 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import DefaultNavbarItem from '@theme/NavbarItem/DefaultNavbarItem';
|
|
10
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
useLatestVersion,
|
|
12
|
+
useActiveDocContext,
|
|
13
|
+
} from '@docusaurus/plugin-content-docs/client';
|
|
11
14
|
import clsx from 'clsx';
|
|
12
|
-
import {getInfimaActiveClassName} from '
|
|
15
|
+
import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
|
|
13
16
|
import type {Props} from '@theme/NavbarItem/DocNavbarItem';
|
|
14
17
|
import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
|
|
15
|
-
import type {
|
|
18
|
+
import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client';
|
|
16
19
|
|
|
17
|
-
function getDocInVersions(versions:
|
|
20
|
+
function getDocInVersions(versions: GlobalVersion[], docId: string) {
|
|
18
21
|
const allDocs = versions.flatMap((version) => version.docs);
|
|
19
22
|
const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
|
|
20
23
|
if (!doc) {
|
|
@@ -43,7 +46,7 @@ export default function DocNavbarItem({
|
|
|
43
46
|
const versions = uniq(
|
|
44
47
|
[activeVersion, preferredVersion, latestVersion].filter(
|
|
45
48
|
Boolean,
|
|
46
|
-
) as
|
|
49
|
+
) as GlobalVersion[],
|
|
47
50
|
);
|
|
48
51
|
const doc = getDocInVersions(versions, docId);
|
|
49
52
|
const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
|