@docusaurus/theme-classic 2.0.0-beta.14 → 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.
Files changed (152) hide show
  1. package/README.md +1 -1
  2. package/lib/index.js +7 -16
  3. package/lib/theme-classic.d.ts +89 -182
  4. package/lib/validateThemeConfig.js +13 -1
  5. package/lib-next/theme/BackToTopButton/styles.module.css +1 -1
  6. package/lib-next/theme/BlogListPaginator/index.js +12 -12
  7. package/lib-next/theme/BlogPostAuthor/index.js +1 -1
  8. package/lib-next/theme/BlogPostAuthors/index.js +12 -2
  9. package/lib-next/theme/BlogPostAuthors/styles.module.css +10 -0
  10. package/lib-next/theme/BlogPostItem/index.js +12 -15
  11. package/lib-next/theme/BlogPostPage/index.js +10 -7
  12. package/lib-next/theme/BlogPostPaginator/index.js +11 -15
  13. package/lib-next/theme/BlogSidebar/styles.module.css +2 -0
  14. package/lib-next/theme/CodeBlock/index.js +44 -9
  15. package/lib-next/theme/CodeBlock/styles.module.css +12 -7
  16. package/lib-next/theme/DocCard/styles.module.css +3 -3
  17. package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +6 -3
  18. package/lib-next/theme/DocItem/index.js +9 -6
  19. package/lib-next/theme/DocItem/styles.module.css +2 -2
  20. package/lib-next/theme/DocPage/index.js +7 -3
  21. package/lib-next/theme/DocPage/styles.module.css +1 -0
  22. package/lib-next/theme/DocPaginator/index.js +26 -4
  23. package/lib-next/theme/DocSidebar/index.js +2 -2
  24. package/lib-next/theme/DocSidebar/styles.module.css +1 -0
  25. package/lib-next/theme/DocSidebarItem/index.js +43 -21
  26. package/lib-next/theme/DocSidebarItem/styles.module.css +1 -0
  27. package/lib-next/theme/DocSidebarItems/index.js +28 -0
  28. package/{src/theme/hooks/styles.css → lib-next/theme/DocSidebarItems/styles.module.css} +12 -2
  29. package/lib-next/theme/DocVersionBanner/index.js +4 -1
  30. package/lib-next/theme/Footer/styles.module.css +2 -1
  31. package/lib-next/theme/Heading/index.js +39 -42
  32. package/lib-next/theme/Heading/styles.css +1 -1
  33. package/lib-next/theme/Layout/index.js +1 -2
  34. package/lib-next/theme/LayoutHead/index.js +5 -9
  35. package/lib-next/theme/LayoutProviders/index.js +6 -6
  36. package/lib-next/theme/MDXComponents/index.js +18 -31
  37. package/lib-next/theme/MDXComponents/styles.css +4 -0
  38. package/lib-next/theme/MDXPage/index.js +3 -10
  39. package/lib-next/theme/Navbar/index.js +6 -6
  40. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +4 -66
  41. package/lib-next/theme/NavbarItem/DocNavbarItem.js +5 -2
  42. package/lib-next/theme/NavbarItem/DocSidebarNavbarItem.js +73 -0
  43. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -3
  44. package/lib-next/theme/NavbarItem/DocsVersionNavbarItem.js +4 -1
  45. package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +5 -5
  46. package/lib-next/theme/NavbarItem/NavbarNavLink.js +70 -0
  47. package/lib-next/theme/NavbarItem/index.js +1 -2
  48. package/lib-next/theme/{hooks/styles.css → NavbarItem/utils.js} +3 -4
  49. package/lib-next/theme/PaginatorNavLink/index.js +20 -0
  50. package/lib-next/theme/SkipToContent/index.js +1 -1
  51. package/lib-next/theme/SkipToContent/styles.module.css +7 -0
  52. package/lib-next/theme/TOCCollapsible/styles.module.css +2 -2
  53. package/lib-next/theme/Tabs/__tests__/index.test.js +8 -6
  54. package/lib-next/theme/Tabs/index.js +6 -3
  55. package/lib-next/theme/Tag/styles.module.css +4 -4
  56. package/lib-next/theme/ThemedImage/index.js +2 -2
  57. package/lib-next/theme/Toggle/styles.module.css +16 -15
  58. package/lib-next/theme/prism-include-languages.js +10 -3
  59. package/package.json +16 -17
  60. package/src/index.ts +10 -21
  61. package/src/theme/Admonition/index.tsx +1 -1
  62. package/src/theme/BackToTopButton/styles.module.css +1 -1
  63. package/src/theme/BlogListPaginator/index.tsx +12 -12
  64. package/src/theme/BlogPostAuthor/index.tsx +1 -1
  65. package/src/theme/BlogPostAuthors/index.tsx +12 -2
  66. package/src/theme/BlogPostAuthors/styles.module.css +10 -0
  67. package/src/theme/BlogPostItem/index.tsx +13 -15
  68. package/src/theme/BlogPostPage/index.tsx +10 -7
  69. package/src/theme/BlogPostPaginator/index.tsx +11 -15
  70. package/src/theme/BlogSidebar/styles.module.css +2 -0
  71. package/src/theme/CodeBlock/index.tsx +45 -10
  72. package/src/theme/CodeBlock/styles.module.css +12 -7
  73. package/src/theme/DocCard/index.tsx +2 -2
  74. package/src/theme/DocCard/styles.module.css +3 -3
  75. package/src/theme/DocCardList/index.tsx +1 -1
  76. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +7 -3
  77. package/src/theme/DocItem/index.tsx +9 -6
  78. package/src/theme/DocItem/styles.module.css +2 -2
  79. package/src/theme/DocItemFooter/index.tsx +1 -1
  80. package/src/theme/DocPage/index.tsx +8 -4
  81. package/src/theme/DocPage/styles.module.css +1 -0
  82. package/src/theme/DocPaginator/index.tsx +26 -4
  83. package/src/theme/DocSidebar/index.tsx +3 -3
  84. package/src/theme/DocSidebar/styles.module.css +1 -0
  85. package/src/theme/DocSidebarItem/index.tsx +34 -23
  86. package/src/theme/DocSidebarItem/styles.module.css +1 -0
  87. package/src/theme/DocSidebarItems/index.tsx +32 -0
  88. package/src/theme/{UserPreferencesContext.ts → DocSidebarItems/styles.module.css} +11 -3
  89. package/src/theme/DocVersionBanner/index.tsx +3 -3
  90. package/src/theme/Footer/index.tsx +4 -4
  91. package/src/theme/Footer/styles.module.css +2 -1
  92. package/src/theme/Heading/index.tsx +39 -46
  93. package/src/theme/Heading/styles.css +1 -1
  94. package/src/theme/Layout/index.tsx +1 -2
  95. package/src/theme/LayoutHead/index.tsx +4 -8
  96. package/src/theme/LayoutProviders/index.tsx +6 -6
  97. package/src/theme/MDXComponents/index.tsx +26 -37
  98. package/src/theme/MDXComponents/styles.css +4 -0
  99. package/src/theme/MDXPage/index.tsx +3 -11
  100. package/src/theme/Navbar/index.tsx +7 -7
  101. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +6 -62
  102. package/src/theme/NavbarItem/DocNavbarItem.tsx +8 -5
  103. package/src/theme/NavbarItem/DocSidebarNavbarItem.tsx +84 -0
  104. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +9 -6
  105. package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +2 -2
  106. package/src/theme/NavbarItem/DropdownNavbarItem.tsx +5 -5
  107. package/src/theme/NavbarItem/NavbarNavLink.tsx +68 -0
  108. package/src/theme/NavbarItem/index.tsx +3 -5
  109. package/{lib-next/theme/UserPreferencesContext.js → src/theme/NavbarItem/utils.ts} +4 -3
  110. package/src/theme/PaginatorNavLink/index.tsx +22 -0
  111. package/src/theme/SkipToContent/index.tsx +1 -1
  112. package/src/theme/SkipToContent/styles.module.css +7 -0
  113. package/src/theme/TOCCollapsible/styles.module.css +2 -2
  114. package/src/theme/TOCItems/index.tsx +2 -2
  115. package/src/theme/Tabs/index.tsx +7 -4
  116. package/src/theme/Tag/styles.module.css +4 -4
  117. package/src/theme/TagsListByLetter/index.tsx +1 -1
  118. package/src/theme/ThemedImage/index.tsx +2 -2
  119. package/src/theme/Toggle/index.tsx +1 -1
  120. package/src/theme/Toggle/styles.module.css +16 -15
  121. package/src/theme/prism-include-languages.ts +10 -3
  122. package/src/theme-classic.d.ts +89 -182
  123. package/src/translations.ts +2 -2
  124. package/src/validateThemeConfig.ts +16 -0
  125. package/lib-next/theme/DocPaginatorNavLink/index.js +0 -36
  126. package/lib-next/theme/ThemeContext.js +0 -9
  127. package/lib-next/theme/ThemeProvider/index.js +0 -28
  128. package/lib-next/theme/UserPreferencesProvider/index.js +0 -27
  129. package/lib-next/theme/hooks/useDocs.js +0 -10
  130. package/lib-next/theme/hooks/useHideableNavbar.js +0 -66
  131. package/lib-next/theme/hooks/useKeyboardNavigation.js +0 -35
  132. package/lib-next/theme/hooks/useLockBodyScroll.js +0 -18
  133. package/lib-next/theme/hooks/usePrismTheme.js +0 -20
  134. package/lib-next/theme/hooks/useTabGroupChoice.js +0 -39
  135. package/lib-next/theme/hooks/useTheme.js +0 -81
  136. package/lib-next/theme/hooks/useThemeContext.js +0 -22
  137. package/lib-next/theme/hooks/useUserPreferencesContext.js +0 -22
  138. package/lib-next/theme/hooks/useWindowSize.js +0 -59
  139. package/src/theme/DocPaginatorNavLink/index.tsx +0 -38
  140. package/src/theme/ThemeContext.ts +0 -15
  141. package/src/theme/ThemeProvider/index.tsx +0 -28
  142. package/src/theme/UserPreferencesProvider/index.tsx +0 -30
  143. package/src/theme/hooks/useDocs.ts +0 -11
  144. package/src/theme/hooks/useHideableNavbar.ts +0 -72
  145. package/src/theme/hooks/useKeyboardNavigation.ts +0 -39
  146. package/src/theme/hooks/useLockBodyScroll.ts +0 -20
  147. package/src/theme/hooks/usePrismTheme.ts +0 -22
  148. package/src/theme/hooks/useTabGroupChoice.ts +0 -46
  149. package/src/theme/hooks/useTheme.ts +0 -91
  150. package/src/theme/hooks/useThemeContext.ts +0 -23
  151. package/src/theme/hooks/useUserPreferencesContext.ts +0 -25
  152. package/src/theme/hooks/useWindowSize.ts +0 -69
@@ -12,6 +12,7 @@ import Translate, {translate} from '@docusaurus/Translate';
12
12
  import Link from '@docusaurus/Link';
13
13
  import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
14
14
  import {usePluralForm} from '@docusaurus/theme-common';
15
+ import {blogPostContainerID} from '@docusaurus/utils-common';
15
16
  import MDXComponents from '@theme/MDXComponents';
16
17
  import EditThisPage from '@theme/EditThisPage';
17
18
  import type {Props} from '@theme/BlogPostItem';
@@ -65,11 +66,14 @@ function BlogPostItem(props: Props): JSX.Element {
65
66
  const image = assets.image ?? frontMatter.image;
66
67
  const truncatedPost = !isBlogPostPage && truncated;
67
68
  const tagsExists = tags.length > 0;
69
+ const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
68
70
 
69
- const renderPostHeader = () => {
70
- const TitleHeading = isBlogPostPage ? 'h1' : 'h2';
71
-
72
- return (
71
+ return (
72
+ <article
73
+ className={!isBlogPostPage ? 'margin-bottom--xl' : undefined}
74
+ itemProp="blogPost"
75
+ itemScope
76
+ itemType="http://schema.org/BlogPosting">
73
77
  <header>
74
78
  <TitleHeading className={styles.blogPostTitle} itemProp="headline">
75
79
  {isBlogPostPage ? (
@@ -94,22 +98,16 @@ function BlogPostItem(props: Props): JSX.Element {
94
98
  </div>
95
99
  <BlogPostAuthors authors={authors} assets={assets} />
96
100
  </header>
97
- );
98
- };
99
-
100
- return (
101
- <article
102
- className={!isBlogPostPage ? 'margin-bottom--xl' : undefined}
103
- itemProp="blogPost"
104
- itemScope
105
- itemType="http://schema.org/BlogPosting">
106
- {renderPostHeader()}
107
101
 
108
102
  {image && (
109
103
  <meta itemProp="image" content={withBaseUrl(image, {absolute: true})} />
110
104
  )}
111
105
 
112
- <div className="markdown" itemProp="articleBody">
106
+ <div
107
+ // This ID is used for the feed generation to locate the main content
108
+ id={isBlogPostPage ? blogPostContainerID : undefined}
109
+ className="markdown"
110
+ itemProp="articleBody">
113
111
  <MDXProvider components={MDXComponents}>{children}</MDXProvider>
114
112
  </div>
115
113
 
@@ -16,14 +16,17 @@ import TOC from '@theme/TOC';
16
16
 
17
17
  function BlogPostPage(props: Props): JSX.Element {
18
18
  const {content: BlogPostContents, sidebar} = props;
19
+ const {assets, metadata} = BlogPostContents;
19
20
  const {
20
- // TODO this frontmatter is not validated/normalized, it's the raw user-provided one. We should expose normalized one too!
21
+ title,
22
+ description,
23
+ nextItem,
24
+ prevItem,
25
+ date,
26
+ tags,
27
+ authors,
21
28
  frontMatter,
22
- assets,
23
- metadata,
24
- } = BlogPostContents;
25
- const {title, description, nextItem, prevItem, date, tags, authors} =
26
- metadata;
29
+ } = metadata;
27
30
  const {
28
31
  hide_table_of_contents: hideTableOfContents,
29
32
  keywords,
@@ -59,7 +62,7 @@ function BlogPostPage(props: Props): JSX.Element {
59
62
  <meta property="og:type" content="article" />
60
63
  <meta property="article:published_time" content={date} />
61
64
 
62
- {/* TODO double check those article metas array syntaxes, see https://ogp.me/#array */}
65
+ {/* TODO double check those article meta array syntaxes, see https://ogp.me/#array */}
63
66
  {authors.some((author) => author.url) && (
64
67
  <meta
65
68
  property="article:author"
@@ -7,7 +7,7 @@
7
7
 
8
8
  import React from 'react';
9
9
  import Translate, {translate} from '@docusaurus/Translate';
10
- import Link from '@docusaurus/Link';
10
+ import PaginatorNavLink from '@theme/PaginatorNavLink';
11
11
  import type {Props} from '@theme/BlogPostPaginator';
12
12
 
13
13
  function BlogPostPaginator(props: Props): JSX.Element {
@@ -23,34 +23,30 @@ function BlogPostPaginator(props: Props): JSX.Element {
23
23
  })}>
24
24
  <div className="pagination-nav__item">
25
25
  {prevItem && (
26
- <Link className="pagination-nav__link" to={prevItem.permalink}>
27
- <div className="pagination-nav__sublabel">
26
+ <PaginatorNavLink
27
+ {...prevItem}
28
+ subLabel={
28
29
  <Translate
29
30
  id="theme.blog.post.paginator.newerPost"
30
31
  description="The blog post button label to navigate to the newer/previous post">
31
32
  Newer Post
32
33
  </Translate>
33
- </div>
34
- <div className="pagination-nav__label">
35
- &laquo; {prevItem.title}
36
- </div>
37
- </Link>
34
+ }
35
+ />
38
36
  )}
39
37
  </div>
40
38
  <div className="pagination-nav__item pagination-nav__item--next">
41
39
  {nextItem && (
42
- <Link className="pagination-nav__link" to={nextItem.permalink}>
43
- <div className="pagination-nav__sublabel">
40
+ <PaginatorNavLink
41
+ {...nextItem}
42
+ subLabel={
44
43
  <Translate
45
44
  id="theme.blog.post.paginator.olderPost"
46
45
  description="The blog post button label to navigate to the older/next post">
47
46
  Older Post
48
47
  </Translate>
49
- </div>
50
- <div className="pagination-nav__label">
51
- {nextItem.title} &raquo;
52
- </div>
53
- </Link>
48
+ }
49
+ />
54
50
  )}
55
51
  </div>
56
52
  </nav>
@@ -30,9 +30,11 @@
30
30
  .sidebarItemLink {
31
31
  color: var(--ifm-font-color-base);
32
32
  }
33
+
33
34
  .sidebarItemLink:hover {
34
35
  text-decoration: none;
35
36
  }
37
+
36
38
  .sidebarItemLinkActive {
37
39
  color: var(--ifm-color-primary) !important;
38
40
  }
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {useEffect, useState} from 'react';
8
+ import React, {isValidElement, useEffect, useState} from 'react';
9
9
  import clsx from 'clsx';
10
- import Highlight, {defaultProps, Language} from 'prism-react-renderer';
10
+ import Highlight, {defaultProps, type Language} from 'prism-react-renderer';
11
11
  import copy from 'copy-text-to-clipboard';
12
12
  import Translate, {translate} from '@docusaurus/Translate';
13
13
  import {
@@ -16,17 +16,18 @@ 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';
24
24
 
25
25
  export default function CodeBlock({
26
26
  children,
27
- className: blockClassName,
27
+ className: blockClassName = '',
28
28
  metastring,
29
29
  title,
30
+ language: languageProp,
30
31
  }: Props): JSX.Element {
31
32
  const {prism} = useThemeConfig();
32
33
 
@@ -43,19 +44,49 @@ export default function CodeBlock({
43
44
  setMounted(true);
44
45
  }, []);
45
46
 
46
- // TODO: the title is provided by MDX as props automatically
47
- // so we probably don't need to parse the metastring
48
- // (note: title="xyz" => title prop still has the quotes)
47
+ // We still parse the metastring in case we want to support more syntax in the
48
+ // future. Note that MDX doesn't strip quotes when parsing metastring:
49
+ // "title=\"xyz\"" => title: "\"xyz\""
49
50
  const codeBlockTitle = parseCodeBlockTitle(metastring) || title;
50
51
  const prismTheme = usePrismTheme();
51
52
 
52
- // In case interleaved Markdown (e.g. when using CodeBlock as standalone component).
53
+ // <pre> tags in markdown map to CodeBlocks and they may contain JSX children.
54
+ // When the children is not a simple string, we just return a styled block without actually highlighting.
55
+ if (React.Children.toArray(children).some((el) => isValidElement(el))) {
56
+ return (
57
+ <Highlight
58
+ {...defaultProps}
59
+ key={String(mounted)}
60
+ theme={prismTheme}
61
+ code=""
62
+ language={'text' as Language}>
63
+ {({className, style}) => (
64
+ <pre
65
+ /* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
66
+ tabIndex={0}
67
+ className={clsx(
68
+ className,
69
+ styles.codeBlockStandalone,
70
+ 'thin-scrollbar',
71
+ styles.codeBlockContainer,
72
+ blockClassName,
73
+ ThemeClassNames.common.codeBlock,
74
+ )}
75
+ style={style}>
76
+ <code className={styles.codeBlockLines}>{children}</code>
77
+ </pre>
78
+ )}
79
+ </Highlight>
80
+ );
81
+ }
82
+
83
+ // The children is now guaranteed to be one/more plain strings
53
84
  const content = Array.isArray(children)
54
85
  ? children.join('')
55
86
  : (children as string);
56
87
 
57
88
  const language =
58
- parseLanguage(blockClassName) ?? (prism.defaultLanguage as Language);
89
+ languageProp ?? parseLanguage(blockClassName) ?? prism.defaultLanguage;
59
90
  const {highlightLines, code} = parseLines(content, metastring, language);
60
91
 
61
92
  const handleCopyCode = () => {
@@ -71,12 +102,16 @@ export default function CodeBlock({
71
102
  key={String(mounted)}
72
103
  theme={prismTheme}
73
104
  code={code}
74
- language={language}>
105
+ language={(language ?? 'text') as Language}>
75
106
  {({className, style, tokens, getLineProps, getTokenProps}) => (
76
107
  <div
77
108
  className={clsx(
78
109
  styles.codeBlockContainer,
79
110
  blockClassName,
111
+ {
112
+ [`language-${language}`]:
113
+ language && !blockClassName.includes(`language-${language}`),
114
+ },
80
115
  ThemeClassNames.common.codeBlock,
81
116
  )}>
82
117
  {codeBlockTitle && (
@@ -13,7 +13,7 @@
13
13
 
14
14
  .codeBlockContent {
15
15
  position: relative;
16
- /*rtl:ignore*/
16
+ /* rtl:ignore */
17
17
  direction: ltr;
18
18
  }
19
19
 
@@ -26,19 +26,24 @@
26
26
  border-top-right-radius: var(--ifm-global-radius);
27
27
  }
28
28
 
29
+ .codeBlock {
30
+ margin: 0;
31
+ padding: 0;
32
+ border-radius: var(--ifm-global-radius);
33
+ }
34
+
29
35
  .codeBlockTitle + .codeBlockContent .codeBlock {
30
36
  border-top-left-radius: 0;
31
37
  border-top-right-radius: 0;
32
38
  }
33
39
 
34
- .codeBlock {
35
- margin: 0;
40
+ .codeBlockStandalone {
36
41
  padding: 0;
37
42
  border-radius: var(--ifm-global-radius);
38
43
  }
39
44
 
40
45
  .copyButton {
41
- background: rgba(0, 0, 0, 0.3);
46
+ background: rgb(0 0 0 / 30%);
42
47
  border-radius: var(--ifm-global-radius);
43
48
  color: var(--ifm-color-white);
44
49
  opacity: 0;
@@ -50,15 +55,15 @@
50
55
  transition: opacity 200ms ease-in-out;
51
56
  }
52
57
 
53
- .codeBlockTitle:hover + .codeBlockContent .copyButton,
58
+ .copyButton:focus,
54
59
  .codeBlockContent:hover > .copyButton,
55
- .copyButton:focus {
60
+ .codeBlockTitle:hover + .codeBlockContent .copyButton {
56
61
  opacity: 1;
57
62
  }
58
63
 
59
64
  .codeBlockLines {
60
65
  font: inherit;
61
- /*rtl:ignore*/
66
+ /* rtl:ignore */
62
67
  float: left;
63
68
  min-width: 100%;
64
69
  padding: var(--ifm-pre-padding);
@@ -5,9 +5,9 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {ReactNode} from 'react';
8
+ import React, {type ReactNode} from 'react';
9
9
  import Link from '@docusaurus/Link';
10
- import {
10
+ import type {
11
11
  PropSidebarItemCategory,
12
12
  PropSidebarItemLink,
13
13
  } from '@docusaurus/plugin-content-docs';
@@ -7,14 +7,13 @@
7
7
 
8
8
  .cardContainer {
9
9
  height: 8rem;
10
-
11
10
  color: var(--ifm-color-emphasis-800);
12
11
  --ifm-link-color: var(--ifm-color-emphasis-800);
13
12
  --ifm-link-hover-color: var(--ifm-color-emphasis-800);
14
13
  --ifm-link-hover-decoration: none;
15
14
 
16
15
  /* box-shadow: var(--ifm-global-shadow-lw); */
17
- box-shadow: 0 1.5px 3px 0 rgba(0, 0, 0, 0.15);
16
+ box-shadow: 0 1.5px 3px 0 rgb(0 0 0 / 15%);
18
17
  border: 1px solid var(--ifm-color-emphasis-200);
19
18
  transition: box-shadow var(--ifm-transition-fast) ease,
20
19
  background-color var(--ifm-transition-fast) ease;
@@ -22,8 +21,9 @@
22
21
 
23
22
  .cardContainer.cardContainerLink:hover {
24
23
  /* box-shadow: var(--ifm-global-shadow-md); */
25
- box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2);
24
+ box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%);
26
25
  }
26
+
27
27
  html[data-theme='dark'] .cardContainer.cardContainerLink:hover {
28
28
  --ifm-card-background-color: #2d2d2d; /* original, non-hovered color is #242526 */
29
29
  }
@@ -8,7 +8,7 @@
8
8
  import React from 'react';
9
9
 
10
10
  import DocCard from '@theme/DocCard';
11
- import {PropSidebarItem} from '@docusaurus/plugin-content-docs';
11
+ import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
12
12
 
13
13
  export default function DocCardList({
14
14
  items,
@@ -13,7 +13,8 @@ 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 {MainHeading} from '@theme/Heading';
16
+ import Heading from '@theme/Heading';
17
+ import useBaseUrl from '@docusaurus/useBaseUrl';
17
18
 
18
19
  import styles from './styles.module.css';
19
20
 
@@ -26,14 +27,17 @@ export default function DocCategoryGeneratedIndexPage({
26
27
  <Seo
27
28
  title={categoryGeneratedIndex.title}
28
29
  description={categoryGeneratedIndex.description}
30
+ keywords={categoryGeneratedIndex.keywords}
31
+ // TODO `require` this?
32
+ image={useBaseUrl(categoryGeneratedIndex.image)}
29
33
  />
30
34
  <div className={styles.generatedIndexPage}>
31
35
  <DocVersionBanner />
32
36
  <DocVersionBadge />
33
37
  <header>
34
- <MainHeading className={styles.title}>
38
+ <Heading as="h1" className={styles.title}>
35
39
  {categoryGeneratedIndex.title}
36
- </MainHeading>
40
+ </Heading>
37
41
  {categoryGeneratedIndex.description && (
38
42
  <p>{categoryGeneratedIndex.description}</p>
39
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 {MainHeading} from '@theme/Heading';
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;
@@ -34,7 +33,7 @@ export default function DocItem(props: Props): JSX.Element {
34
33
  const {description, title} = metadata;
35
34
 
36
35
  // We only add a title if:
37
- // - user asks to hide it with frontmatter
36
+ // - user asks to hide it with front matter
38
37
  // - the markdown content does not already contain a top-level h1 heading
39
38
  const shouldAddTitle =
40
39
  !hideTitle && typeof DocContent.contentTitle === 'undefined';
@@ -76,11 +75,15 @@ export default function DocItem(props: Props): JSX.Element {
76
75
  <div
77
76
  className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
78
77
  {/*
79
- Title can be declared inside md content or declared through frontmatter and added manually
78
+ Title can be declared inside md content or declared through front matter and added manually
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 && <MainHeading>{title}</MainHeading>}
82
+ {shouldAddTitle && (
83
+ <header>
84
+ <Heading as="h1">{title}</Heading>
85
+ </header>
86
+ )}
84
87
 
85
88
  <DocContent />
86
89
  </div>
@@ -5,8 +5,8 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- .docItemContainer article > *:first-child,
9
- .docItemContainer header + * {
8
+ .docItemContainer header + *,
9
+ .docItemContainer article > *:first-child {
10
10
  margin-top: 0;
11
11
  }
12
12
 
@@ -12,7 +12,7 @@ import LastUpdated from '@theme/LastUpdated';
12
12
  import type {Props} from '@theme/DocItem';
13
13
  import EditThisPage from '@theme/EditThisPage';
14
14
  import TagsListInline, {
15
- Props as TagsListInlineProps,
15
+ type Props as TagsListInlineProps,
16
16
  } from '@theme/TagsListInline';
17
17
 
18
18
  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, {ReactNode, useState, useCallback} from 'react';
8
+ import React, {type ReactNode, useState, useCallback} from 'react';
9
9
  import {MDXProvider} from '@mdx-js/react';
10
10
 
11
11
  import renderRoutes from '@docusaurus/renderRoutes';
@@ -70,9 +70,13 @@ function DocPageContent({
70
70
 
71
71
  {sidebar && (
72
72
  <aside
73
- className={clsx(styles.docSidebarContainer, {
74
- [styles.docSidebarContainerHidden]: hiddenSidebarContainer,
75
- })}
73
+ className={clsx(
74
+ ThemeClassNames.docs.docSidebarContainer,
75
+ styles.docSidebarContainer,
76
+ {
77
+ [styles.docSidebarContainerHidden]: hiddenSidebarContainer,
78
+ },
79
+ )}
76
80
  onTransitionEnd={(e) => {
77
81
  if (
78
82
  !e.currentTarget.classList.contains(styles.docSidebarContainer)
@@ -68,6 +68,7 @@
68
68
  .expandSidebarButtonIcon {
69
69
  transform: rotate(0);
70
70
  }
71
+
71
72
  html[dir='rtl'] .expandSidebarButtonIcon {
72
73
  transform: rotate(180deg);
73
74
  }
@@ -6,8 +6,8 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import {translate} from '@docusaurus/Translate';
10
- import DocPaginatorNavLink from '@theme/DocPaginatorNavLink';
9
+ import Translate, {translate} from '@docusaurus/Translate';
10
+ import PaginatorNavLink from '@theme/PaginatorNavLink';
11
11
  import type {Props} from '@theme/DocPaginator';
12
12
 
13
13
  function DocPaginator(props: Props): JSX.Element {
@@ -22,10 +22,32 @@ function DocPaginator(props: Props): JSX.Element {
22
22
  description: 'The ARIA label for the docs pagination',
23
23
  })}>
24
24
  <div className="pagination-nav__item">
25
- {previous && <DocPaginatorNavLink navLink={previous} />}
25
+ {previous && (
26
+ <PaginatorNavLink
27
+ {...previous}
28
+ subLabel={
29
+ <Translate
30
+ id="theme.docs.paginator.previous"
31
+ description="The label used to navigate to the previous doc">
32
+ Previous
33
+ </Translate>
34
+ }
35
+ />
36
+ )}
26
37
  </div>
27
38
  <div className="pagination-nav__item pagination-nav__item--next">
28
- {next && <DocPaginatorNavLink navLink={next} next />}
39
+ {next && (
40
+ <PaginatorNavLink
41
+ {...next}
42
+ subLabel={
43
+ <Translate
44
+ id="theme.docs.paginator.next"
45
+ description="The label used to navigate to the next doc">
46
+ Next
47
+ </Translate>
48
+ }
49
+ />
50
+ )}
29
51
  </div>
30
52
  </nav>
31
53
  );
@@ -11,15 +11,15 @@ import {
11
11
  useThemeConfig,
12
12
  useAnnouncementBar,
13
13
  MobileSecondaryMenuFiller,
14
- MobileSecondaryMenuComponent,
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 {DocSidebarItems} from '@theme/DocSidebarItem';
22
+ import DocSidebarItems from '@theme/DocSidebarItems';
23
23
  import type {Props} from '@theme/DocSidebar';
24
24
 
25
25
  import styles from './styles.module.css';
@@ -71,6 +71,7 @@
71
71
  transform: rotate(180deg);
72
72
  margin-top: 4px;
73
73
  }
74
+
74
75
  html[dir='rtl'] .collapseSidebarButtonIcon {
75
76
  transform: rotate(0);
76
77
  }