@docusaurus/theme-classic 0.0.0-4518 → 0.0.0-4524

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 (36) hide show
  1. package/lib/index.js +6 -4
  2. package/lib/validateThemeConfig.js +4 -4
  3. package/lib-next/theme/BackToTopButton/index.js +5 -3
  4. package/lib-next/theme/BlogPostAuthor/index.js +17 -20
  5. package/lib-next/theme/BlogPostPage/index.js +3 -2
  6. package/lib-next/theme/CodeBlock/index.js +2 -1
  7. package/lib-next/theme/Details/index.js +2 -1
  8. package/lib-next/theme/DocItem/index.js +3 -2
  9. package/lib-next/theme/DocPage/index.js +1 -1
  10. package/lib-next/theme/DocSidebarItem/index.js +11 -6
  11. package/lib-next/theme/Footer/index.js +8 -4
  12. package/lib-next/theme/MDXComponents/index.js +4 -3
  13. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +2 -2
  14. package/lib-next/theme/NavbarItem/index.js +2 -2
  15. package/lib-next/theme/SearchBar.js +1 -1
  16. package/lib-next/theme/TOC/index.js +1 -1
  17. package/lib-next/theme/Tabs/index.js +1 -1
  18. package/package.json +13 -13
  19. package/src/index.ts +6 -4
  20. package/src/theme/BackToTopButton/index.tsx +7 -4
  21. package/src/theme/BlogPostAuthor/index.tsx +17 -20
  22. package/src/theme/BlogPostPage/index.tsx +3 -2
  23. package/src/theme/CodeBlock/index.tsx +2 -1
  24. package/src/theme/Details/index.tsx +2 -1
  25. package/src/theme/DocItem/index.tsx +3 -2
  26. package/src/theme/DocPage/index.tsx +1 -1
  27. package/src/theme/DocSidebarItem/index.tsx +10 -6
  28. package/src/theme/Footer/index.tsx +8 -4
  29. package/src/theme/MDXComponents/index.tsx +4 -3
  30. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +2 -2
  31. package/src/theme/NavbarItem/index.tsx +2 -2
  32. package/src/theme/SearchBar.tsx +1 -1
  33. package/src/theme/TOC/index.tsx +1 -1
  34. package/src/theme/Tabs/index.tsx +1 -1
  35. package/src/translations.ts +1 -1
  36. package/src/validateThemeConfig.ts +4 -4
package/lib/index.js CHANGED
@@ -35,7 +35,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
35
35
  */
36
36
  const requireFromDocusaurusCore = (0, _module.createRequire)(require.resolve('@docusaurus/core/package.json'));
37
37
  const ContextReplacementPlugin = requireFromDocusaurusCore('webpack/lib/ContextReplacementPlugin'); // Need to be inlined to prevent dark mode FOUC
38
- // Make sure that the 'storageKey' is the same as the one in `/theme/hooks/useTheme.js`
38
+ // Make sure the key is the same as the one in `/theme/hooks/useTheme.js`
39
39
 
40
40
  const ThemeStorageKey = 'theme';
41
41
 
@@ -76,15 +76,17 @@ const noFlashColorMode = ({
76
76
  setDataThemeAttribute(defaultMode === 'dark' ? 'dark' : 'light');
77
77
  }
78
78
  }
79
- })();`; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
79
+ })();`; // Duplicated constant. Unfortunately we can't import it from theme-common, as
80
+ // we need to support older nodejs versions without ESM support
80
81
  // TODO: import from theme-common once we only support Node.js with ESM support
81
82
  // + move all those announcementBar stuff there too
82
83
 
83
84
 
84
85
  const AnnouncementBarDismissStorageKey = 'docusaurus.announcement.dismiss';
85
86
  exports.AnnouncementBarDismissStorageKey = AnnouncementBarDismissStorageKey;
86
- const AnnouncementBarDismissDataAttribute = 'data-announcement-bar-initially-dismissed'; // We always render the announcement bar html on the server, to prevent layout shifts on React hydration
87
- // The theme can use CSS + the data attribute to hide the announcement bar asap (before React hydration)
87
+ const AnnouncementBarDismissDataAttribute = 'data-announcement-bar-initially-dismissed'; // We always render the announcement bar html on the server, to prevent layout
88
+ // shifts on React hydration. The theme can use CSS + the data attribute to hide
89
+ // the announcement bar asap (before React hydration)
88
90
 
89
91
  const AnnouncementBarInlineJavaScript = `
90
92
  (function() {
@@ -58,8 +58,8 @@ const NavbarItemPosition = _utilsValidation.Joi.string().equal('left', 'right').
58
58
  const NavbarItemBaseSchema = _utilsValidation.Joi.object({
59
59
  label: _utilsValidation.Joi.string(),
60
60
  className: _utilsValidation.Joi.string()
61
- }) // We allow any unknown attributes on the links
62
- // (users may need additional attributes like target, aria-role, data-customAttribute...)
61
+ }) // We allow any unknown attributes on the links (users may need additional
62
+ // attributes like target, aria-role, data-customAttribute...)
63
63
  .unknown();
64
64
 
65
65
  const DefaultNavbarItemSchema = NavbarItemBaseSchema.append({
@@ -208,8 +208,8 @@ const FooterLinkItemSchema = _utilsValidation.Joi.object({
208
208
  href: _utilsValidation.URISchema,
209
209
  html: _utilsValidation.Joi.string(),
210
210
  label: _utilsValidation.Joi.string()
211
- }).xor('to', 'href', 'html').with('to', 'label').with('href', 'label').nand('html', 'label') // We allow any unknown attributes on the links
212
- // (users may need additional attributes like target, aria-role, data-customAttribute...)
211
+ }).xor('to', 'href', 'html').with('to', 'label').with('href', 'label').nand('html', 'label') // We allow any unknown attributes on the links (users may need additional
212
+ // attributes like target, aria-role, data-customAttribute...)
213
213
  .unknown();
214
214
 
215
215
  const CustomCssSchema = _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array().items(_utilsValidation.Joi.string().required()), _utilsValidation.Joi.string().required()).optional();
@@ -17,7 +17,9 @@ const threshold = 300; // Not all have support for smooth scrolling (particularl
17
17
  // TODO proper detection is currently unreliable!
18
18
  // see https://github.com/wessberg/scroll-behavior-polyfill/issues/16
19
19
 
20
- const SupportsNativeSmoothScrolling = false; // const SupportsNativeSmoothScrolling = ExecutionEnvironment.canUseDOM && 'scrollBehavior' in document.documentElement.style;
20
+ const SupportsNativeSmoothScrolling = false; // const SupportsNativeSmoothScrolling =
21
+ // ExecutionEnvironment.canUseDOM &&
22
+ // 'scrollBehavior' in document.documentElement.style;
21
23
 
22
24
  function smoothScrollTopNative() {
23
25
  window.scrollTo({
@@ -41,8 +43,8 @@ function smoothScrollTopPolyfill() {
41
43
  }
42
44
  }
43
45
 
44
- rafRecursion(); // Break the recursion
45
- // Prevents the user from "fighting" against that recursion producing a weird UX
46
+ rafRecursion(); // Break the recursion. Prevents the user from "fighting" against that
47
+ // recursion producing a weird UX
46
48
 
47
49
  return () => raf && cancelAnimationFrame(raf);
48
50
  }
@@ -18,27 +18,24 @@ function BlogPostAuthor({author}) {
18
18
  </Link>
19
19
  )}
20
20
 
21
- {
22
- // Note: only legacy author front matter allow empty name (not frontMatter.authors)
23
- name && (
24
- <div
25
- className="avatar__intro"
26
- itemProp="author"
27
- itemScope
28
- itemType="https://schema.org/Person">
29
- <div className="avatar__name">
30
- <Link href={url} itemProp="url">
31
- <span itemProp="name">{name}</span>
32
- </Link>
33
- </div>
34
- {title && (
35
- <small className="avatar__subtitle" itemProp="description">
36
- {title}
37
- </small>
38
- )}
21
+ {name && (
22
+ <div
23
+ className="avatar__intro"
24
+ itemProp="author"
25
+ itemScope
26
+ itemType="https://schema.org/Person">
27
+ <div className="avatar__name">
28
+ <Link href={url} itemProp="url">
29
+ <span itemProp="name">{name}</span>
30
+ </Link>
39
31
  </div>
40
- )
41
- }
32
+ {title && (
33
+ <small className="avatar__subtitle" itemProp="description">
34
+ {title}
35
+ </small>
36
+ )}
37
+ </div>
38
+ )}
42
39
  </div>
43
40
  );
44
41
  }
@@ -48,8 +48,9 @@ function BlogPostPage(props) {
48
48
  />
49
49
  ) : undefined
50
50
  }>
51
- <Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside BlogLayout
52
- // otherwise default image (set by BlogLayout) would shadow the custom blog post image
51
+ <Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside
52
+ // BlogLayout, otherwise default image (set by BlogLayout) would shadow
53
+ // the custom blog post image
53
54
  title={title}
54
55
  description={description}
55
56
  keywords={keywords}
@@ -43,7 +43,8 @@ export default function CodeBlock({
43
43
 
44
44
  const codeBlockTitle = parseCodeBlockTitle(metastring) || title;
45
45
  const prismTheme = usePrismTheme(); // <pre> tags in markdown map to CodeBlocks and they may contain JSX children.
46
- // When the children is not a simple string, we just return a styled block without actually highlighting.
46
+ // When the children is not a simple string, we just return a styled block
47
+ // without actually highlighting.
47
48
 
48
49
  if (React.Children.toArray(children).some((el) => isValidElement(el))) {
49
50
  return (
@@ -7,7 +7,8 @@
7
7
  import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import {Details as DetailsGeneric} from '@docusaurus/theme-common';
10
- import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing alert classes?
10
+ import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing
11
+ // alert classes?
11
12
 
12
13
  const InfimaClasses = 'alert alert--info';
13
14
  export default function Details({...props}) {
@@ -74,8 +74,9 @@ export default function DocItem(props) {
74
74
  <div
75
75
  className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
76
76
  {/*
77
- Title can be declared inside md content or declared through front matter and added manually
78
- To make both cases consistent, the added title is added under the same div.markdown block
77
+ Title can be declared inside md content or declared through
78
+ front matter and added manually. To make both cases consistent,
79
+ the added title is added under the same div.markdown block
79
80
  See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
80
81
  */}
81
82
  {shouldAddTitle && (
@@ -152,7 +152,7 @@ function DocPage(props) {
152
152
  return (
153
153
  <>
154
154
  <Head>
155
- {/* TODO we should add a core addRoute({htmlClassName}) generic plugin option */}
155
+ {/* TODO we should add a core addRoute({htmlClassName}) action */}
156
156
  <html className={versionMetadata.className} />
157
157
  </Head>
158
158
  <DocsVersionProvider version={versionMetadata}>
@@ -36,7 +36,8 @@ export default function DocSidebarItem({item, ...props}) {
36
36
  default:
37
37
  return <DocSidebarItemLink item={item} {...props} />;
38
38
  }
39
- } // If we navigate to a category and it becomes active, it should automatically expand itself
39
+ } // If we navigate to a category and it becomes active, it should automatically
40
+ // expand itself
40
41
 
41
42
  function useAutoExpandActiveCategory({isActive, collapsed, setCollapsed}) {
42
43
  const wasActive = usePrevious(isActive);
@@ -47,11 +48,15 @@ function useAutoExpandActiveCategory({isActive, collapsed, setCollapsed}) {
47
48
  setCollapsed(false);
48
49
  }
49
50
  }, [isActive, wasActive, collapsed, setCollapsed]);
50
- } // When a collapsible category has no link, we still link it to its first child during SSR as a temporary fallback
51
- // This allows to be able to navigate inside the category even when JS fails to load, is delayed or simply disabled
52
- // React hydration becomes an optional progressive enhancement
53
- // see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
54
- // see https://github.com/facebook/docusaurus/issues/3030
51
+ }
52
+ /**
53
+ * When a collapsible category has no link, we still link it to its first child
54
+ * during SSR as a temporary fallback. This allows to be able to navigate inside
55
+ * the category even when JS fails to load, is delayed or simply disabled
56
+ * React hydration becomes an optional progressive enhancement
57
+ * see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
58
+ * see https://github.com/facebook/docusaurus/issues/3030
59
+ */
55
60
 
56
61
  function useCategoryHrefWithSSRFallback(item) {
57
62
  const isBrowser = useIsBrowser();
@@ -88,10 +88,9 @@ function SimpleLinks({links}) {
88
88
  return (
89
89
  <div className="footer__links">
90
90
  {links.map((item, key) => (
91
- <>
91
+ <React.Fragment key={key}>
92
92
  {item.html ? (
93
93
  <span
94
- key={key}
95
94
  className="footer__link-item" // Developer provided the HTML, so assume it's safe.
96
95
  // eslint-disable-next-line react/no-danger
97
96
  dangerouslySetInnerHTML={{
@@ -104,7 +103,7 @@ function SimpleLinks({links}) {
104
103
  {links.length !== key + 1 && (
105
104
  <span className="footer__link-separator">·</span>
106
105
  )}
107
- </>
106
+ </React.Fragment>
108
107
  ))}
109
108
  </div>
110
109
  );
@@ -157,7 +156,12 @@ function Footer() {
157
156
  />
158
157
  </Link>
159
158
  ) : (
160
- <FooterLogo alt={logo.alt} sources={sources} />
159
+ <FooterLogo
160
+ alt={logo.alt}
161
+ sources={sources}
162
+ width={logo.width}
163
+ height={logo.height}
164
+ />
161
165
  )}
162
166
  </div>
163
167
  )}
@@ -10,8 +10,8 @@ import Link from '@docusaurus/Link';
10
10
  import CodeBlock from '@theme/CodeBlock';
11
11
  import Heading from '@theme/Heading';
12
12
  import Details from '@theme/Details';
13
- import './styles.css'; // MDX elements are wrapped through the MDX pragma
14
- // In some cases (notably usage with Head/Helmet) we need to unwrap those elements.
13
+ import './styles.css'; // MDX elements are wrapped through the MDX pragma. In some cases (notably usage
14
+ // with Head/Helmet) we need to unwrap those elements.
15
15
 
16
16
  function unwrapMDXElement(element) {
17
17
  if (element?.props?.mdxType && element?.props?.originalType) {
@@ -45,7 +45,8 @@ const MDXComponents = {
45
45
  />
46
46
  ),
47
47
  details: (props) => {
48
- const items = React.Children.toArray(props.children); // Split summary item from the rest to pass it as a separate prop to the Details theme component
48
+ const items = React.Children.toArray(props.children); // Split summary item from the rest to pass it as a separate prop to the
49
+ // Details theme component
49
50
 
50
51
  const summary = items.find((item) => item?.props?.mdxType === 'summary');
51
52
  const children = <>{items.filter((item) => item !== summary)}</>;
@@ -68,8 +68,8 @@ export default function DocsVersionDropdownNavbarItem({
68
68
  const dropdownTo =
69
69
  mobile && items.length > 1
70
70
  ? undefined
71
- : getVersionMainDoc(dropdownVersion).path; // We don't want to render a version dropdown with 0 or 1 item
72
- // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
71
+ : getVersionMainDoc(dropdownVersion).path; // We don't want to render a version dropdown with 0 or 1 item. If we build
72
+ // the site with a single docs version (onlyIncludeVersions: ['1.0.0']),
73
73
  // We'd rather render a button instead of a dropdown
74
74
 
75
75
  if (items.length <= 1) {
@@ -14,8 +14,8 @@ const NavbarItemComponents = {
14
14
  localeDropdown: () => LocaleDropdownNavbarItem,
15
15
  search: () => SearchNavbarItem,
16
16
  dropdown: () => DropdownNavbarItem,
17
- // Need to lazy load these items as we don't know for sure the docs plugin is loaded
18
- // See https://github.com/facebook/docusaurus/issues/3360
17
+ // Need to lazy load these items as we don't know for sure the docs plugin is
18
+ // loaded. See https://github.com/facebook/docusaurus/issues/3360
19
19
 
20
20
  /* eslint-disable @typescript-eslint/no-var-requires, global-require */
21
21
  docsVersion: () => require('@theme/NavbarItem/DocsVersionNavbarItem').default,
@@ -5,7 +5,7 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
  // By default, the classic theme does not provide any SearchBar implementation
8
- // If you swizzled this file, it is your responsibility to provide an implementation
8
+ // If you swizzled this, it is your responsibility to provide an implementation
9
9
  // Tip: swizzle the SearchBar from the Algolia theme for inspiration:
10
10
  // npm run swizzle @docusaurus/theme-search-algolia SearchBar
11
11
  export {default} from '@docusaurus/Noop';
@@ -8,7 +8,7 @@ import React from 'react';
8
8
  import clsx from 'clsx';
9
9
  import TOCItems from '@theme/TOCItems';
10
10
  import styles from './styles.module.css'; // Using a custom className
11
- // This prevents TOC highlighting to highlight TOCInline/TOCCollapsible by mistake
11
+ // This prevents TOCInline/TOCCollapsible getting highlighted by mistake
12
12
 
13
13
  const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight';
14
14
  const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active';
@@ -42,7 +42,7 @@ function TabsComponent(props) {
42
42
  );
43
43
  });
44
44
  const values =
45
- valuesProp ?? // We only pick keys that we recognize. MDX would inject some keys by default
45
+ valuesProp ?? // Only pick keys that we recognize. MDX would inject some keys by default
46
46
  children.map(({props: {value, label, attributes}}) => ({
47
47
  value,
48
48
  label,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4518",
3
+ "version": "0.0.0-4524",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -21,15 +21,15 @@
21
21
  "format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
22
22
  },
23
23
  "dependencies": {
24
- "@docusaurus/core": "0.0.0-4518",
25
- "@docusaurus/plugin-content-blog": "0.0.0-4518",
26
- "@docusaurus/plugin-content-docs": "0.0.0-4518",
27
- "@docusaurus/plugin-content-pages": "0.0.0-4518",
28
- "@docusaurus/theme-common": "0.0.0-4518",
29
- "@docusaurus/theme-translations": "0.0.0-4518",
30
- "@docusaurus/utils": "0.0.0-4518",
31
- "@docusaurus/utils-common": "0.0.0-4518",
32
- "@docusaurus/utils-validation": "0.0.0-4518",
24
+ "@docusaurus/core": "0.0.0-4524",
25
+ "@docusaurus/plugin-content-blog": "0.0.0-4524",
26
+ "@docusaurus/plugin-content-docs": "0.0.0-4524",
27
+ "@docusaurus/plugin-content-pages": "0.0.0-4524",
28
+ "@docusaurus/theme-common": "0.0.0-4524",
29
+ "@docusaurus/theme-translations": "0.0.0-4524",
30
+ "@docusaurus/utils": "0.0.0-4524",
31
+ "@docusaurus/utils-common": "0.0.0-4524",
32
+ "@docusaurus/utils-validation": "0.0.0-4524",
33
33
  "@mdx-js/react": "^1.6.21",
34
34
  "clsx": "^1.1.1",
35
35
  "copy-text-to-clipboard": "^3.0.1",
@@ -42,8 +42,8 @@
42
42
  "rtlcss": "^3.3.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@docusaurus/module-type-aliases": "0.0.0-4518",
46
- "@docusaurus/types": "0.0.0-4518",
45
+ "@docusaurus/module-type-aliases": "0.0.0-4524",
46
+ "@docusaurus/types": "0.0.0-4524",
47
47
  "@types/mdx-js__react": "^1.5.4",
48
48
  "@types/parse-numeric-range": "^0.0.1",
49
49
  "@types/prismjs": "^1.16.2",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=14"
64
64
  },
65
- "gitHead": "734bca0f3ea8d04fa3b908d56ea0fb159ab47ab3"
65
+ "gitHead": "41a6bff3a67446f7d2a2972cbe4d05fec7378a15"
66
66
  }
package/src/index.ts CHANGED
@@ -23,7 +23,7 @@ const ContextReplacementPlugin: typeof webpack.ContextReplacementPlugin =
23
23
  requireFromDocusaurusCore('webpack/lib/ContextReplacementPlugin');
24
24
 
25
25
  // Need to be inlined to prevent dark mode FOUC
26
- // Make sure that the 'storageKey' is the same as the one in `/theme/hooks/useTheme.js`
26
+ // Make sure the key is the same as the one in `/theme/hooks/useTheme.js`
27
27
  const ThemeStorageKey = 'theme';
28
28
  const noFlashColorMode = ({
29
29
  defaultMode,
@@ -64,15 +64,17 @@ const noFlashColorMode = ({
64
64
  }
65
65
  })();`;
66
66
 
67
- // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
67
+ // Duplicated constant. Unfortunately we can't import it from theme-common, as
68
+ // we need to support older nodejs versions without ESM support
68
69
  // TODO: import from theme-common once we only support Node.js with ESM support
69
70
  // + move all those announcementBar stuff there too
70
71
  export const AnnouncementBarDismissStorageKey =
71
72
  'docusaurus.announcement.dismiss';
72
73
  const AnnouncementBarDismissDataAttribute =
73
74
  'data-announcement-bar-initially-dismissed';
74
- // We always render the announcement bar html on the server, to prevent layout shifts on React hydration
75
- // The theme can use CSS + the data attribute to hide the announcement bar asap (before React hydration)
75
+ // We always render the announcement bar html on the server, to prevent layout
76
+ // shifts on React hydration. The theme can use CSS + the data attribute to hide
77
+ // the announcement bar asap (before React hydration)
76
78
  const AnnouncementBarInlineJavaScript = `
77
79
  (function() {
78
80
  function isDismissed() {
@@ -22,7 +22,9 @@ const threshold = 300;
22
22
  // TODO proper detection is currently unreliable!
23
23
  // see https://github.com/wessberg/scroll-behavior-polyfill/issues/16
24
24
  const SupportsNativeSmoothScrolling = false;
25
- // const SupportsNativeSmoothScrolling = ExecutionEnvironment.canUseDOM && 'scrollBehavior' in document.documentElement.style;
25
+ // const SupportsNativeSmoothScrolling =
26
+ // ExecutionEnvironment.canUseDOM &&
27
+ // 'scrollBehavior' in document.documentElement.style;
26
28
 
27
29
  type CancelScrollTop = () => void;
28
30
 
@@ -44,13 +46,14 @@ function smoothScrollTopPolyfill(): CancelScrollTop {
44
46
  }
45
47
  rafRecursion();
46
48
 
47
- // Break the recursion
48
- // Prevents the user from "fighting" against that recursion producing a weird UX
49
+ // Break the recursion. Prevents the user from "fighting" against that
50
+ // recursion producing a weird UX
49
51
  return () => raf && cancelAnimationFrame(raf);
50
52
  }
51
53
 
52
54
  type UseSmoothScrollTopReturn = {
53
- // We use a cancel function because the non-native smooth scroll-top implementation must be interrupted if user scroll down
55
+ // We use a cancel function because the non-native smooth scroll-top
56
+ // implementation must be interrupted if user scroll down
54
57
  smoothScrollTop: () => void;
55
58
  cancelScrollToTop: CancelScrollTop;
56
59
  };
@@ -21,27 +21,24 @@ function BlogPostAuthor({author}: Props): JSX.Element {
21
21
  </Link>
22
22
  )}
23
23
 
24
- {
25
- // Note: only legacy author front matter allow empty name (not frontMatter.authors)
26
- name && (
27
- <div
28
- className="avatar__intro"
29
- itemProp="author"
30
- itemScope
31
- itemType="https://schema.org/Person">
32
- <div className="avatar__name">
33
- <Link href={url} itemProp="url">
34
- <span itemProp="name">{name}</span>
35
- </Link>
36
- </div>
37
- {title && (
38
- <small className="avatar__subtitle" itemProp="description">
39
- {title}
40
- </small>
41
- )}
24
+ {name && (
25
+ <div
26
+ className="avatar__intro"
27
+ itemProp="author"
28
+ itemScope
29
+ itemType="https://schema.org/Person">
30
+ <div className="avatar__name">
31
+ <Link href={url} itemProp="url">
32
+ <span itemProp="name">{name}</span>
33
+ </Link>
42
34
  </div>
43
- )
44
- }
35
+ {title && (
36
+ <small className="avatar__subtitle" itemProp="description">
37
+ {title}
38
+ </small>
39
+ )}
40
+ </div>
41
+ )}
45
42
  </div>
46
43
  );
47
44
  }
@@ -53,8 +53,9 @@ function BlogPostPage(props: Props): JSX.Element {
53
53
  ) : undefined
54
54
  }>
55
55
  <Seo
56
- // TODO refactor needed: it's a bit annoying but Seo MUST be inside BlogLayout
57
- // otherwise default image (set by BlogLayout) would shadow the custom blog post image
56
+ // TODO refactor needed: it's a bit annoying but Seo MUST be inside
57
+ // BlogLayout, otherwise default image (set by BlogLayout) would shadow
58
+ // the custom blog post image
58
59
  title={title}
59
60
  description={description}
60
61
  keywords={keywords}
@@ -51,7 +51,8 @@ export default function CodeBlock({
51
51
  const prismTheme = usePrismTheme();
52
52
 
53
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.
54
+ // When the children is not a simple string, we just return a styled block
55
+ // without actually highlighting.
55
56
  if (React.Children.toArray(children).some((el) => isValidElement(el))) {
56
57
  return (
57
58
  <Highlight
@@ -11,7 +11,8 @@ import {Details as DetailsGeneric} from '@docusaurus/theme-common';
11
11
  import type {Props} from '@theme/Details';
12
12
  import styles from './styles.module.css';
13
13
 
14
- // Should we have a custom details/summary comp in Infima instead of reusing alert classes?
14
+ // Should we have a custom details/summary comp in Infima instead of reusing
15
+ // alert classes?
15
16
  const InfimaClasses = 'alert alert--info';
16
17
 
17
18
  export default function Details({...props}: Props): JSX.Element {
@@ -75,8 +75,9 @@ export default function DocItem(props: Props): JSX.Element {
75
75
  <div
76
76
  className={clsx(ThemeClassNames.docs.docMarkdown, 'markdown')}>
77
77
  {/*
78
- Title can be declared inside md content or declared through front matter and added manually
79
- To make both cases consistent, the added title is added under the same div.markdown block
78
+ Title can be declared inside md content or declared through
79
+ front matter and added manually. To make both cases consistent,
80
+ the added title is added under the same div.markdown block
80
81
  See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
81
82
  */}
82
83
  {shouldAddTitle && (
@@ -168,7 +168,7 @@ function DocPage(props: Props): JSX.Element {
168
168
  return (
169
169
  <>
170
170
  <Head>
171
- {/* TODO we should add a core addRoute({htmlClassName}) generic plugin option */}
171
+ {/* TODO we should add a core addRoute({htmlClassName}) action */}
172
172
  <html className={versionMetadata.className} />
173
173
  </Head>
174
174
  <DocsVersionProvider version={versionMetadata}>
@@ -48,7 +48,8 @@ export default function DocSidebarItem({
48
48
  }
49
49
  }
50
50
 
51
- // If we navigate to a category and it becomes active, it should automatically expand itself
51
+ // If we navigate to a category and it becomes active, it should automatically
52
+ // expand itself
52
53
  function useAutoExpandActiveCategory({
53
54
  isActive,
54
55
  collapsed,
@@ -67,11 +68,14 @@ function useAutoExpandActiveCategory({
67
68
  }, [isActive, wasActive, collapsed, setCollapsed]);
68
69
  }
69
70
 
70
- // When a collapsible category has no link, we still link it to its first child during SSR as a temporary fallback
71
- // This allows to be able to navigate inside the category even when JS fails to load, is delayed or simply disabled
72
- // React hydration becomes an optional progressive enhancement
73
- // see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
74
- // see https://github.com/facebook/docusaurus/issues/3030
71
+ /**
72
+ * When a collapsible category has no link, we still link it to its first child
73
+ * during SSR as a temporary fallback. This allows to be able to navigate inside
74
+ * the category even when JS fails to load, is delayed or simply disabled
75
+ * React hydration becomes an optional progressive enhancement
76
+ * see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
77
+ * see https://github.com/facebook/docusaurus/issues/3030
78
+ */
75
79
  function useCategoryHrefWithSSRFallback(
76
80
  item: PropSidebarItemCategory,
77
81
  ): string | undefined {
@@ -106,10 +106,9 @@ function SimpleLinks({links}: {links: SimpleFooter['links']}) {
106
106
  return (
107
107
  <div className="footer__links">
108
108
  {links.map((item, key) => (
109
- <>
109
+ <React.Fragment key={key}>
110
110
  {item.html ? (
111
111
  <span
112
- key={key}
113
112
  className="footer__link-item"
114
113
  // Developer provided the HTML, so assume it's safe.
115
114
  // eslint-disable-next-line react/no-danger
@@ -123,7 +122,7 @@ function SimpleLinks({links}: {links: SimpleFooter['links']}) {
123
122
  {links.length !== key + 1 && (
124
123
  <span className="footer__link-separator">·</span>
125
124
  )}
126
- </>
125
+ </React.Fragment>
127
126
  ))}
128
127
  </div>
129
128
  );
@@ -179,7 +178,12 @@ function Footer(): JSX.Element | null {
179
178
  />
180
179
  </Link>
181
180
  ) : (
182
- <FooterLogo alt={logo.alt} sources={sources} />
181
+ <FooterLogo
182
+ alt={logo.alt}
183
+ sources={sources}
184
+ width={logo.width}
185
+ height={logo.height}
186
+ />
183
187
  )}
184
188
  </div>
185
189
  )}
@@ -19,8 +19,8 @@ import type {MDXComponentsObject} from '@theme/MDXComponents';
19
19
 
20
20
  import './styles.css';
21
21
 
22
- // MDX elements are wrapped through the MDX pragma
23
- // In some cases (notably usage with Head/Helmet) we need to unwrap those elements.
22
+ // MDX elements are wrapped through the MDX pragma. In some cases (notably usage
23
+ // with Head/Helmet) we need to unwrap those elements.
24
24
  function unwrapMDXElement(element: ReactElement) {
25
25
  if (element?.props?.mdxType && element?.props?.originalType) {
26
26
  const {mdxType, originalType, ...newProps} = element.props;
@@ -55,7 +55,8 @@ const MDXComponents: MDXComponentsObject = {
55
55
  ),
56
56
  details: (props): JSX.Element => {
57
57
  const items = React.Children.toArray(props.children) as ReactElement[];
58
- // Split summary item from the rest to pass it as a separate prop to the Details theme component
58
+ // Split summary item from the rest to pass it as a separate prop to the
59
+ // Details theme component
59
60
  const summary: ReactElement<ComponentProps<'summary'>> = items.find(
60
61
  (item) => item?.props?.mdxType === 'summary',
61
62
  )!;
@@ -78,8 +78,8 @@ export default function DocsVersionDropdownNavbarItem({
78
78
  ? undefined
79
79
  : getVersionMainDoc(dropdownVersion).path;
80
80
 
81
- // We don't want to render a version dropdown with 0 or 1 item
82
- // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
81
+ // We don't want to render a version dropdown with 0 or 1 item. If we build
82
+ // the site with a single docs version (onlyIncludeVersions: ['1.0.0']),
83
83
  // We'd rather render a button instead of a dropdown
84
84
  if (items.length <= 1) {
85
85
  return (
@@ -25,8 +25,8 @@ const NavbarItemComponents: Record<
25
25
  search: () => SearchNavbarItem,
26
26
  dropdown: () => DropdownNavbarItem,
27
27
 
28
- // Need to lazy load these items as we don't know for sure the docs plugin is loaded
29
- // See https://github.com/facebook/docusaurus/issues/3360
28
+ // Need to lazy load these items as we don't know for sure the docs plugin is
29
+ // loaded. See https://github.com/facebook/docusaurus/issues/3360
30
30
  /* eslint-disable @typescript-eslint/no-var-requires, global-require */
31
31
  docsVersion: () => require('@theme/NavbarItem/DocsVersionNavbarItem').default,
32
32
  docsVersionDropdown: () =>
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  // By default, the classic theme does not provide any SearchBar implementation
9
- // If you swizzled this file, it is your responsibility to provide an implementation
9
+ // If you swizzled this, it is your responsibility to provide an implementation
10
10
  // Tip: swizzle the SearchBar from the Algolia theme for inspiration:
11
11
  // npm run swizzle @docusaurus/theme-search-algolia SearchBar
12
12
  export {default} from '@docusaurus/Noop';
@@ -12,7 +12,7 @@ import TOCItems from '@theme/TOCItems';
12
12
  import styles from './styles.module.css';
13
13
 
14
14
  // Using a custom className
15
- // This prevents TOC highlighting to highlight TOCInline/TOCCollapsible by mistake
15
+ // This prevents TOCInline/TOCCollapsible getting highlighted by mistake
16
16
  const LINK_CLASS_NAME = 'table-of-contents__link toc-highlight';
17
17
  const LINK_ACTIVE_CLASS_NAME = 'table-of-contents__link--active';
18
18
 
@@ -55,7 +55,7 @@ function TabsComponent(props: Props): JSX.Element {
55
55
  });
56
56
  const values =
57
57
  valuesProp ??
58
- // We only pick keys that we recognize. MDX would inject some keys by default
58
+ // Only pick keys that we recognize. MDX would inject some keys by default
59
59
  children.map(({props: {value, label, attributes}}) => ({
60
60
  value,
61
61
  label,
@@ -171,7 +171,7 @@ export function translateThemeConfig({
171
171
  themeConfig,
172
172
  translationFiles,
173
173
  }: {
174
- // Why partial? To make TS correctly figure out the contravariance in parameter.
174
+ // To make TS correctly figure out the contravariance in parameter.
175
175
  // In practice it's always normalized
176
176
  themeConfig: ThemeConfig;
177
177
  translationFiles: TranslationFile[];
@@ -54,8 +54,8 @@ const NavbarItemBaseSchema = Joi.object({
54
54
  label: Joi.string(),
55
55
  className: Joi.string(),
56
56
  })
57
- // We allow any unknown attributes on the links
58
- // (users may need additional attributes like target, aria-role, data-customAttribute...)
57
+ // We allow any unknown attributes on the links (users may need additional
58
+ // attributes like target, aria-role, data-customAttribute...)
59
59
  .unknown();
60
60
 
61
61
  const DefaultNavbarItemSchema = NavbarItemBaseSchema.append({
@@ -251,8 +251,8 @@ const FooterLinkItemSchema = Joi.object({
251
251
  .with('to', 'label')
252
252
  .with('href', 'label')
253
253
  .nand('html', 'label')
254
- // We allow any unknown attributes on the links
255
- // (users may need additional attributes like target, aria-role, data-customAttribute...)
254
+ // We allow any unknown attributes on the links (users may need additional
255
+ // attributes like target, aria-role, data-customAttribute...)
256
256
  .unknown();
257
257
 
258
258
  const CustomCssSchema = Joi.alternatives()