@docusaurus/theme-classic 3.7.0 → 3.8.0

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 (136) hide show
  1. package/lib/getSwizzleConfig.js +1 -1
  2. package/lib/index.js +9 -0
  3. package/lib/inlineScripts.js +6 -27
  4. package/lib/inlineSvgSprites.d.ts +7 -0
  5. package/lib/inlineSvgSprites.js +14 -0
  6. package/lib/options.js +5 -0
  7. package/lib/theme/AnnouncementBar/index.js +6 -2
  8. package/lib/theme/CodeBlock/{WordWrapButton → Buttons/Button}/index.d.ts +2 -2
  9. package/lib/theme/CodeBlock/Buttons/Button/index.js +13 -0
  10. package/lib/theme/CodeBlock/Buttons/CopyButton/index.d.ts +9 -0
  11. package/lib/theme/CodeBlock/{CopyButton → Buttons/CopyButton}/index.js +36 -25
  12. package/lib/theme/CodeBlock/Buttons/WordWrapButton/index.d.ts +9 -0
  13. package/lib/theme/CodeBlock/{WordWrapButton → Buttons/WordWrapButton}/index.js +12 -7
  14. package/lib/theme/CodeBlock/{CopyButton → Buttons}/index.d.ts +2 -2
  15. package/lib/theme/CodeBlock/Buttons/index.js +27 -0
  16. package/lib/theme/CodeBlock/Buttons/styles.module.css +37 -0
  17. package/lib/theme/CodeBlock/Content/Element.js +4 -2
  18. package/lib/theme/CodeBlock/Content/String.d.ts +1 -1
  19. package/lib/theme/CodeBlock/Content/String.js +22 -92
  20. package/lib/theme/CodeBlock/Content/index.d.ts +9 -0
  21. package/lib/theme/CodeBlock/Content/index.js +74 -0
  22. package/lib/theme/CodeBlock/Content/styles.module.css +0 -52
  23. package/lib/theme/CodeBlock/Layout/index.d.ts +9 -0
  24. package/lib/theme/CodeBlock/Layout/index.js +30 -0
  25. package/lib/theme/CodeBlock/Layout/styles.module.css +27 -0
  26. package/lib/theme/CodeBlock/Line/Token/index.d.ts +9 -0
  27. package/lib/theme/CodeBlock/Line/Token/index.js +11 -0
  28. package/lib/theme/CodeBlock/Line/index.d.ts +1 -1
  29. package/lib/theme/CodeBlock/Line/index.js +21 -7
  30. package/lib/theme/CodeBlock/Title/index.d.ts +9 -0
  31. package/lib/theme/CodeBlock/Title/index.js +10 -0
  32. package/lib/theme/ColorModeToggle/index.d.ts +1 -1
  33. package/lib/theme/ColorModeToggle/index.js +85 -27
  34. package/lib/theme/ColorModeToggle/styles.module.css +7 -2
  35. package/lib/theme/DocBreadcrumbs/StructuredData/index.d.ts +9 -0
  36. package/lib/theme/DocBreadcrumbs/StructuredData/index.js +21 -0
  37. package/lib/theme/DocBreadcrumbs/index.js +36 -54
  38. package/lib/theme/DocCard/index.js +6 -4
  39. package/lib/theme/DocCardList/index.js +12 -6
  40. package/lib/theme/DocCardList/styles.module.css +14 -0
  41. package/lib/theme/DocCategoryGeneratedIndexPage/index.js +1 -1
  42. package/lib/theme/DocCategoryGeneratedIndexPage/styles.module.css +0 -8
  43. package/lib/theme/DocItem/Paginator/index.js +7 -1
  44. package/lib/theme/DocPaginator/index.js +3 -2
  45. package/lib/theme/DocSidebarItem/Category/index.js +8 -1
  46. package/lib/theme/Footer/Layout/index.js +2 -1
  47. package/lib/theme/Footer/Links/MultiColumn/index.js +7 -1
  48. package/lib/theme/Icon/ExternalLink/index.js +4 -5
  49. package/lib/theme/Icon/SystemColorMode/index.d.ts +9 -0
  50. package/lib/theme/Icon/SystemColorMode/index.js +16 -0
  51. package/lib/theme/Layout/index.js +1 -0
  52. package/lib/theme/Navbar/ColorModeToggle/index.js +5 -4
  53. package/lib/theme/Navbar/Content/index.js +20 -3
  54. package/lib/theme/Navbar/Content/styles.module.css +8 -0
  55. package/lib/theme/Navbar/Layout/index.js +2 -1
  56. package/lib/theme/Navbar/MobileSidebar/Layout/index.js +35 -4
  57. package/lib/theme/NavbarItem/DefaultNavbarItem/Desktop/index.d.ts +9 -0
  58. package/lib/theme/NavbarItem/DefaultNavbarItem/Desktop/index.js +29 -0
  59. package/lib/theme/NavbarItem/DefaultNavbarItem/Mobile/index.d.ts +9 -0
  60. package/lib/theme/NavbarItem/DefaultNavbarItem/Mobile/index.js +20 -0
  61. package/lib/theme/NavbarItem/DefaultNavbarItem/index.js +25 -0
  62. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.d.ts +1 -1
  63. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +50 -7
  64. package/lib/theme/NavbarItem/DropdownNavbarItem/Desktop/index.d.ts +9 -0
  65. package/lib/theme/NavbarItem/DropdownNavbarItem/Desktop/index.js +74 -0
  66. package/lib/theme/NavbarItem/DropdownNavbarItem/Mobile/index.d.ts +10 -0
  67. package/lib/theme/NavbarItem/DropdownNavbarItem/Mobile/index.js +142 -0
  68. package/lib/theme/NavbarItem/DropdownNavbarItem/index.js +3 -142
  69. package/lib/theme/Tag/index.js +1 -0
  70. package/lib/theme/ThemeProvider/TitleFormatter/index.d.ts +9 -0
  71. package/lib/theme/ThemeProvider/TitleFormatter/index.js +19 -0
  72. package/lib/theme/ThemeProvider/index.d.ts +9 -0
  73. package/lib/theme/ThemeProvider/index.js +11 -0
  74. package/package.json +15 -15
  75. package/src/getSwizzleConfig.ts +1 -1
  76. package/src/index.ts +9 -0
  77. package/src/inlineScripts.ts +6 -27
  78. package/src/inlineSvgSprites.ts +12 -0
  79. package/src/options.ts +15 -0
  80. package/src/theme/AnnouncementBar/index.tsx +6 -2
  81. package/src/theme/CodeBlock/Buttons/Button/index.tsx +19 -0
  82. package/src/theme/CodeBlock/{CopyButton → Buttons/CopyButton}/index.tsx +42 -26
  83. package/src/theme/CodeBlock/{WordWrapButton → Buttons/WordWrapButton}/index.tsx +15 -12
  84. package/src/theme/CodeBlock/Buttons/index.tsx +32 -0
  85. package/src/theme/CodeBlock/Buttons/styles.module.css +37 -0
  86. package/src/theme/CodeBlock/Content/Element.tsx +4 -2
  87. package/src/theme/CodeBlock/Content/String.tsx +24 -101
  88. package/src/theme/CodeBlock/Content/index.tsx +84 -0
  89. package/src/theme/CodeBlock/Content/styles.module.css +0 -52
  90. package/src/theme/CodeBlock/Layout/index.tsx +34 -0
  91. package/src/theme/CodeBlock/Layout/styles.module.css +27 -0
  92. package/src/theme/CodeBlock/Line/Token/index.tsx +18 -0
  93. package/src/theme/CodeBlock/Line/index.tsx +26 -7
  94. package/src/theme/CodeBlock/Title/index.tsx +15 -0
  95. package/src/theme/ColorModeToggle/index.tsx +102 -32
  96. package/src/theme/ColorModeToggle/styles.module.css +7 -2
  97. package/src/theme/DocBreadcrumbs/StructuredData/index.tsx +24 -0
  98. package/src/theme/DocBreadcrumbs/index.tsx +35 -57
  99. package/src/theme/DocCard/index.tsx +8 -2
  100. package/src/theme/DocCardList/index.tsx +18 -7
  101. package/src/theme/DocCardList/styles.module.css +14 -0
  102. package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +1 -1
  103. package/src/theme/DocCategoryGeneratedIndexPage/styles.module.css +0 -8
  104. package/src/theme/DocItem/Paginator/index.tsx +7 -1
  105. package/src/theme/DocPaginator/index.tsx +3 -2
  106. package/src/theme/DocSidebarItem/Category/index.tsx +8 -1
  107. package/src/theme/Footer/Layout/index.tsx +2 -1
  108. package/src/theme/Footer/Links/MultiColumn/index.tsx +7 -1
  109. package/src/theme/Icon/ExternalLink/index.tsx +5 -5
  110. package/src/theme/Icon/SystemColorMode/index.tsx +20 -0
  111. package/src/theme/Layout/index.tsx +1 -0
  112. package/src/theme/Navbar/ColorModeToggle/index.tsx +5 -4
  113. package/src/theme/Navbar/Content/index.tsx +20 -3
  114. package/src/theme/Navbar/Content/styles.module.css +8 -0
  115. package/src/theme/Navbar/Layout/index.tsx +2 -1
  116. package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +43 -4
  117. package/src/theme/NavbarItem/DefaultNavbarItem/Desktop/index.tsx +34 -0
  118. package/src/theme/NavbarItem/DefaultNavbarItem/Mobile/index.tsx +23 -0
  119. package/src/theme/NavbarItem/DefaultNavbarItem/index.tsx +28 -0
  120. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +87 -9
  121. package/src/theme/NavbarItem/DropdownNavbarItem/Desktop/index.tsx +86 -0
  122. package/src/theme/NavbarItem/DropdownNavbarItem/Mobile/index.tsx +166 -0
  123. package/src/theme/NavbarItem/DropdownNavbarItem/index.tsx +4 -168
  124. package/src/theme/Tag/index.tsx +1 -0
  125. package/src/theme/ThemeProvider/TitleFormatter/index.tsx +27 -0
  126. package/src/theme/ThemeProvider/index.tsx +14 -0
  127. package/src/theme-classic.d.ts +175 -20
  128. package/lib/theme/NavbarItem/DefaultNavbarItem.js +0 -52
  129. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +0 -66
  130. /package/lib/theme/CodeBlock/{CopyButton → Buttons/CopyButton}/styles.module.css +0 -0
  131. /package/lib/theme/CodeBlock/{WordWrapButton → Buttons/WordWrapButton}/styles.module.css +0 -0
  132. /package/lib/theme/NavbarItem/{DefaultNavbarItem.d.ts → DefaultNavbarItem/index.d.ts} +0 -0
  133. /package/lib/theme/NavbarItem/DropdownNavbarItem/{styles.module.css → Mobile/styles.module.css} +0 -0
  134. /package/src/theme/CodeBlock/{CopyButton → Buttons/CopyButton}/styles.module.css +0 -0
  135. /package/src/theme/CodeBlock/{WordWrapButton → Buttons/WordWrapButton}/styles.module.css +0 -0
  136. /package/src/theme/NavbarItem/DropdownNavbarItem/{styles.module.css → Mobile/styles.module.css} +0 -0
@@ -5,174 +5,10 @@
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
7
 
8
- import React, {useState, useRef, useEffect, type ReactNode} from 'react';
9
- import clsx from 'clsx';
10
- import {
11
- isRegexpStringMatch,
12
- useCollapsible,
13
- Collapsible,
14
- } from '@docusaurus/theme-common';
15
- import {isSamePath, useLocalPathname} from '@docusaurus/theme-common/internal';
16
- import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
17
- import NavbarItem, {type LinkLikeNavbarItemProps} from '@theme/NavbarItem';
18
- import type {
19
- DesktopOrMobileNavBarItemProps,
20
- Props,
21
- } from '@theme/NavbarItem/DropdownNavbarItem';
22
- import styles from './styles.module.css';
23
-
24
- function isItemActive(
25
- item: LinkLikeNavbarItemProps,
26
- localPathname: string,
27
- ): boolean {
28
- if (isSamePath(item.to, localPathname)) {
29
- return true;
30
- }
31
- if (isRegexpStringMatch(item.activeBaseRegex, localPathname)) {
32
- return true;
33
- }
34
- if (item.activeBasePath && localPathname.startsWith(item.activeBasePath)) {
35
- return true;
36
- }
37
- return false;
38
- }
39
-
40
- function containsActiveItems(
41
- items: readonly LinkLikeNavbarItemProps[],
42
- localPathname: string,
43
- ): boolean {
44
- return items.some((item) => isItemActive(item, localPathname));
45
- }
46
-
47
- function DropdownNavbarItemDesktop({
48
- items,
49
- position,
50
- className,
51
- onClick,
52
- ...props
53
- }: DesktopOrMobileNavBarItemProps) {
54
- const dropdownRef = useRef<HTMLDivElement>(null);
55
- const [showDropdown, setShowDropdown] = useState(false);
56
-
57
- useEffect(() => {
58
- const handleClickOutside = (
59
- event: MouseEvent | TouchEvent | FocusEvent,
60
- ) => {
61
- if (
62
- !dropdownRef.current ||
63
- dropdownRef.current.contains(event.target as Node)
64
- ) {
65
- return;
66
- }
67
- setShowDropdown(false);
68
- };
69
-
70
- document.addEventListener('mousedown', handleClickOutside);
71
- document.addEventListener('touchstart', handleClickOutside);
72
- document.addEventListener('focusin', handleClickOutside);
73
-
74
- return () => {
75
- document.removeEventListener('mousedown', handleClickOutside);
76
- document.removeEventListener('touchstart', handleClickOutside);
77
- document.removeEventListener('focusin', handleClickOutside);
78
- };
79
- }, [dropdownRef]);
80
-
81
- return (
82
- <div
83
- ref={dropdownRef}
84
- className={clsx('navbar__item', 'dropdown', 'dropdown--hoverable', {
85
- 'dropdown--right': position === 'right',
86
- 'dropdown--show': showDropdown,
87
- })}>
88
- <NavbarNavLink
89
- aria-haspopup="true"
90
- aria-expanded={showDropdown}
91
- role="button"
92
- // # hash permits to make the <a> tag focusable in case no link target
93
- // See https://github.com/facebook/docusaurus/pull/6003
94
- // There's probably a better solution though...
95
- href={props.to ? undefined : '#'}
96
- className={clsx('navbar__link', className)}
97
- {...props}
98
- onClick={props.to ? undefined : (e) => e.preventDefault()}
99
- onKeyDown={(e) => {
100
- if (e.key === 'Enter') {
101
- e.preventDefault();
102
- setShowDropdown(!showDropdown);
103
- }
104
- }}>
105
- {props.children ?? props.label}
106
- </NavbarNavLink>
107
- <ul className="dropdown__menu">
108
- {items.map((childItemProps, i) => (
109
- <NavbarItem
110
- isDropdownItem
111
- activeClassName="dropdown__link--active"
112
- {...childItemProps}
113
- key={i}
114
- />
115
- ))}
116
- </ul>
117
- </div>
118
- );
119
- }
120
-
121
- function DropdownNavbarItemMobile({
122
- items,
123
- className,
124
- position, // Need to destructure position from props so that it doesn't get passed on.
125
- onClick,
126
- ...props
127
- }: DesktopOrMobileNavBarItemProps) {
128
- const localPathname = useLocalPathname();
129
- const containsActive = containsActiveItems(items, localPathname);
130
-
131
- const {collapsed, toggleCollapsed, setCollapsed} = useCollapsible({
132
- initialState: () => !containsActive,
133
- });
134
-
135
- // Expand/collapse if any item active after a navigation
136
- useEffect(() => {
137
- if (containsActive) {
138
- setCollapsed(!containsActive);
139
- }
140
- }, [localPathname, containsActive, setCollapsed]);
141
-
142
- return (
143
- <li
144
- className={clsx('menu__list-item', {
145
- 'menu__list-item--collapsed': collapsed,
146
- })}>
147
- <NavbarNavLink
148
- role="button"
149
- className={clsx(
150
- styles.dropdownNavbarItemMobile,
151
- 'menu__link menu__link--sublist menu__link--sublist-caret',
152
- className,
153
- )}
154
- {...props}
155
- onClick={(e) => {
156
- e.preventDefault();
157
- toggleCollapsed();
158
- }}>
159
- {props.children ?? props.label}
160
- </NavbarNavLink>
161
- <Collapsible lazy as="ul" className="menu__list" collapsed={collapsed}>
162
- {items.map((childItemProps, i) => (
163
- <NavbarItem
164
- mobile
165
- isDropdownItem
166
- onClick={onClick}
167
- activeClassName="menu__link--active"
168
- {...childItemProps}
169
- key={i}
170
- />
171
- ))}
172
- </Collapsible>
173
- </li>
174
- );
175
- }
8
+ import React, {type ReactNode} from 'react';
9
+ import DropdownNavbarItemMobile from '@theme/NavbarItem/DropdownNavbarItem/Mobile';
10
+ import DropdownNavbarItemDesktop from '@theme/NavbarItem/DropdownNavbarItem/Desktop';
11
+ import type {Props} from '@theme/NavbarItem/DropdownNavbarItem';
176
12
 
177
13
  export default function DropdownNavbarItem({
178
14
  mobile = false,
@@ -20,6 +20,7 @@ export default function Tag({
20
20
  }: Props): ReactNode {
21
21
  return (
22
22
  <Link
23
+ rel="tag"
23
24
  href={permalink}
24
25
  title={description}
25
26
  className={clsx(
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React, {type ComponentProps, type ReactNode} from 'react';
9
+ import {TitleFormatterProvider} from '@docusaurus/theme-common/internal';
10
+ import type {Props} from '@theme/ThemeProvider/TitleFormatter';
11
+
12
+ type FormatterProp = ComponentProps<typeof TitleFormatterProvider>['formatter'];
13
+
14
+ const formatter: FormatterProp = (params) => {
15
+ // Add your own title formatting logic here!
16
+ return params.defaultFormatter(params);
17
+ };
18
+
19
+ export default function ThemeProviderTitleFormatter({
20
+ children,
21
+ }: Props): ReactNode {
22
+ return (
23
+ <TitleFormatterProvider formatter={formatter}>
24
+ {children}
25
+ </TitleFormatterProvider>
26
+ );
27
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Copyright (c) Facebook, Inc. and its affiliates.
3
+ *
4
+ * This source code is licensed under the MIT license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import React, {type ReactNode} from 'react';
9
+ import TitleFormatterProvider from '@theme/ThemeProvider/TitleFormatter';
10
+ import type {Props} from '@theme/ThemeProvider';
11
+
12
+ export default function ThemeProvider({children}: Props): ReactNode {
13
+ return <TitleFormatterProvider>{children}</TitleFormatterProvider>;
14
+ }
@@ -410,9 +410,9 @@ declare module '@theme/CodeBlock' {
410
410
  readonly children: ReactNode;
411
411
  readonly className?: string;
412
412
  readonly metastring?: string;
413
- readonly title?: string;
413
+ readonly title?: ReactNode;
414
414
  readonly language?: string;
415
- readonly showLineNumbers?: boolean;
415
+ readonly showLineNumbers?: boolean | number;
416
416
  }
417
417
 
418
418
  export default function CodeBlock(props: Props): ReactNode;
@@ -426,17 +426,76 @@ declare module '@theme/CodeInline' {
426
426
  export default function CodeInline(props: Props): ReactNode;
427
427
  }
428
428
 
429
- declare module '@theme/CodeBlock/CopyButton' {
429
+ declare module '@theme/CodeBlock/Provider' {
430
+ import type {ReactNode} from 'react';
431
+
432
+ export interface Props {
433
+ readonly children: ReactNode;
434
+ }
435
+
436
+ export default function CodeBlockProvider(props: Props): ReactNode;
437
+ }
438
+
439
+ declare module '@theme/CodeBlock/Title' {
440
+ import type {ReactNode} from 'react';
441
+
442
+ export interface Props {
443
+ readonly children: ReactNode;
444
+ }
445
+
446
+ export default function CodeBlockTitle(props: Props): ReactNode;
447
+ }
448
+
449
+ declare module '@theme/CodeBlock/Layout' {
450
+ import type {ReactNode} from 'react';
451
+
452
+ export interface Props {
453
+ readonly className?: string;
454
+ }
455
+
456
+ export default function CodeBlockLayout(props: Props): ReactNode;
457
+ }
458
+
459
+ declare module '@theme/CodeBlock/Buttons' {
430
460
  import type {ReactNode} from 'react';
431
461
 
432
462
  export interface Props {
433
- readonly code: string;
463
+ readonly className?: string;
464
+ }
465
+
466
+ export default function CodeBlockButtons(props: Props): ReactNode;
467
+ }
468
+
469
+ declare module '@theme/CodeBlock/Buttons/Button' {
470
+ import type {ComponentProps, ReactNode} from 'react';
471
+
472
+ export interface Props extends ComponentProps<'button'> {
434
473
  readonly className?: string;
435
474
  }
436
475
 
437
476
  export default function CopyButton(props: Props): ReactNode;
438
477
  }
439
478
 
479
+ declare module '@theme/CodeBlock/Buttons/CopyButton' {
480
+ import type {ReactNode} from 'react';
481
+
482
+ export interface Props {
483
+ readonly className?: string;
484
+ }
485
+
486
+ export default function CodeBlockButtonCopy(props: Props): ReactNode;
487
+ }
488
+
489
+ declare module '@theme/CodeBlock/Buttons/WordWrapButton' {
490
+ import type {ReactNode} from 'react';
491
+
492
+ export interface Props {
493
+ readonly className?: string;
494
+ }
495
+
496
+ export default function CodeBlockButtonWordWrap(props: Props): ReactNode;
497
+ }
498
+
440
499
  declare module '@theme/CodeBlock/Container' {
441
500
  import type {ReactNode} from 'react';
442
501
  import type {ComponentProps} from 'react';
@@ -447,13 +506,23 @@ declare module '@theme/CodeBlock/Container' {
447
506
  }: {as: T} & ComponentProps<T>): ReactNode;
448
507
  }
449
508
 
509
+ declare module '@theme/CodeBlock/Content' {
510
+ import type {ReactNode} from 'react';
511
+
512
+ export interface Props {
513
+ className?: string;
514
+ }
515
+
516
+ export default function CodeBlockContent(props: Props): ReactNode;
517
+ }
518
+
450
519
  declare module '@theme/CodeBlock/Content/Element' {
451
520
  import type {ReactNode} from 'react';
452
521
  import type {Props} from '@theme/CodeBlock';
453
522
 
454
523
  export type {Props};
455
524
 
456
- export default function CodeBlockElementContent(props: Props): ReactNode;
525
+ export default function CodeBlockContentElement(props: Props): ReactNode;
457
526
  }
458
527
 
459
528
  declare module '@theme/CodeBlock/Content/String' {
@@ -464,7 +533,7 @@ declare module '@theme/CodeBlock/Content/String' {
464
533
  readonly children: string;
465
534
  }
466
535
 
467
- export default function CodeBlockStringContent(props: Props): ReactNode;
536
+ export default function CodeBlockContentString(props: Props): ReactNode;
468
537
  }
469
538
 
470
539
  declare module '@theme/CodeBlock/Line' {
@@ -488,16 +557,16 @@ declare module '@theme/CodeBlock/Line' {
488
557
  export default function CodeBlockLine(props: Props): ReactNode;
489
558
  }
490
559
 
491
- declare module '@theme/CodeBlock/WordWrapButton' {
560
+ declare module '@theme/CodeBlock/Line/Token' {
492
561
  import type {ReactNode} from 'react';
562
+ import type {Token, TokenOutputProps} from 'prism-react-renderer';
493
563
 
494
- export interface Props {
495
- readonly className?: string;
496
- readonly onClick: React.MouseEventHandler;
497
- readonly isEnabled: boolean;
564
+ export interface Props extends TokenOutputProps {
565
+ readonly token: Token;
566
+ readonly line: Token[];
498
567
  }
499
568
 
500
- export default function WordWrapButton(props: Props): ReactNode;
569
+ export default function CodeBlockLine(props: Props): ReactNode;
501
570
  }
502
571
 
503
572
  declare module '@theme/DocCard' {
@@ -624,7 +693,9 @@ declare module '@theme/DocPaginator' {
624
693
  import type {PropNavigation} from '@docusaurus/plugin-content-docs';
625
694
 
626
695
  // May be simpler to provide a {navigation: PropNavigation} prop?
627
- export interface Props extends PropNavigation {}
696
+ export interface Props extends PropNavigation {
697
+ className?: string;
698
+ }
628
699
 
629
700
  export default function DocPaginator(props: Props): ReactNode;
630
701
  }
@@ -1179,19 +1250,40 @@ declare module '@theme/NavbarItem/DefaultNavbarItem' {
1179
1250
  import type {ReactNode} from 'react';
1180
1251
  import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
1181
1252
 
1182
- export type DesktopOrMobileNavBarItemProps = NavbarNavLinkProps & {
1253
+ export type DefaultNavbarItemProps = NavbarNavLinkProps & {
1183
1254
  readonly isDropdownItem?: boolean;
1184
1255
  readonly className?: string;
1185
1256
  readonly position?: 'left' | 'right';
1186
1257
  };
1187
1258
 
1188
- export interface Props extends DesktopOrMobileNavBarItemProps {
1259
+ // TODO Docusaurus v4, remove old type name
1260
+ export type DesktopOrMobileNavBarItemProps = DefaultNavbarItemProps;
1261
+
1262
+ export interface Props extends DefaultNavbarItemProps {
1189
1263
  readonly mobile?: boolean;
1190
1264
  }
1191
1265
 
1192
1266
  export default function DefaultNavbarItem(props: Props): ReactNode;
1193
1267
  }
1194
1268
 
1269
+ declare module '@theme/NavbarItem/DefaultNavbarItem/Mobile' {
1270
+ import type {ReactNode} from 'react';
1271
+ import type {DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
1272
+
1273
+ export interface Props extends DefaultNavbarItemProps {}
1274
+
1275
+ export default function DefaultNavbarItemMobile(props: Props): ReactNode;
1276
+ }
1277
+
1278
+ declare module '@theme/NavbarItem/DefaultNavbarItem/Desktop' {
1279
+ import type {ReactNode} from 'react';
1280
+ import type {DefaultNavbarItemProps} from '@theme/NavbarItem/DefaultNavbarItem';
1281
+
1282
+ export interface Props extends DefaultNavbarItemProps {}
1283
+
1284
+ export default function DefaultNavbarItemDesktop(props: Props): ReactNode;
1285
+ }
1286
+
1195
1287
  declare module '@theme/NavbarItem/NavbarNavLink' {
1196
1288
  import type {ReactNode} from 'react';
1197
1289
  import type {Props as LinkProps} from '@docusaurus/Link';
@@ -1214,19 +1306,40 @@ declare module '@theme/NavbarItem/DropdownNavbarItem' {
1214
1306
  import type {Props as NavbarNavLinkProps} from '@theme/NavbarItem/NavbarNavLink';
1215
1307
  import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
1216
1308
 
1217
- export type DesktopOrMobileNavBarItemProps = NavbarNavLinkProps & {
1309
+ export type DropdownNavbarItemProps = NavbarNavLinkProps & {
1218
1310
  readonly position?: 'left' | 'right';
1219
1311
  readonly items: readonly LinkLikeNavbarItemProps[];
1220
1312
  readonly className?: string;
1221
1313
  };
1222
1314
 
1223
- export interface Props extends DesktopOrMobileNavBarItemProps {
1315
+ // TODO Docusaurus v4, remove old type name
1316
+ export type DesktopOrMobileNavBarItemProps = DropdownNavbarItemProps;
1317
+
1318
+ export interface Props extends DropdownNavbarItemProps {
1224
1319
  readonly mobile?: boolean;
1225
1320
  }
1226
1321
 
1227
1322
  export default function DropdownNavbarItem(props: Props): ReactNode;
1228
1323
  }
1229
1324
 
1325
+ declare module '@theme/NavbarItem/DropdownNavbarItem/Mobile' {
1326
+ import type {ReactNode} from 'react';
1327
+ import type {DropdownNavbarItemProps} from '@theme/NavbarItem/DropdownNavbarItem';
1328
+
1329
+ export interface Props extends DropdownNavbarItemProps {}
1330
+
1331
+ export default function DropdownNavbarItemMobile(props: Props): ReactNode;
1332
+ }
1333
+
1334
+ declare module '@theme/NavbarItem/DropdownNavbarItem/Desktop' {
1335
+ import type {ReactNode} from 'react';
1336
+ import type {DropdownNavbarItemProps} from '@theme/NavbarItem/DropdownNavbarItem';
1337
+
1338
+ export interface Props extends DropdownNavbarItemProps {}
1339
+
1340
+ export default function DropdownNavbarItemDesktop(props: Props): ReactNode;
1341
+ }
1342
+
1230
1343
  declare module '@theme/NavbarItem/SearchNavbarItem' {
1231
1344
  import type {ReactNode} from 'react';
1232
1345
 
@@ -1257,11 +1370,22 @@ declare module '@theme/NavbarItem/DocsVersionDropdownNavbarItem' {
1257
1370
  import type {Props as DropdownNavbarItemProps} from '@theme/NavbarItem/DropdownNavbarItem';
1258
1371
  import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
1259
1372
 
1373
+ type PropVersionItem = {
1374
+ readonly label?: string;
1375
+ };
1376
+
1377
+ type PropVersionItems = {
1378
+ readonly [version: string]: PropVersionItem;
1379
+ };
1380
+
1381
+ type PropVersions = string[] | PropVersionItems;
1382
+
1260
1383
  export interface Props extends DropdownNavbarItemProps {
1261
1384
  readonly docsPluginId?: string;
1262
1385
  readonly dropdownActiveClassDisabled?: boolean;
1263
1386
  readonly dropdownItemsBefore: LinkLikeNavbarItemProps[];
1264
1387
  readonly dropdownItemsAfter: LinkLikeNavbarItemProps[];
1388
+ readonly versions?: PropVersions;
1265
1389
  }
1266
1390
 
1267
1391
  export default function DocsVersionDropdownNavbarItem(
@@ -1445,6 +1569,17 @@ declare module '@theme/ThemedImage' {
1445
1569
  export default function ThemedImage(props: Props): ReactNode;
1446
1570
  }
1447
1571
 
1572
+ declare module '@theme/ThemeProvider/TitleFormatter' {
1573
+ import type {ReactNode} from 'react';
1574
+
1575
+ export interface Props {
1576
+ readonly children: ReactNode;
1577
+ }
1578
+ export default function ThemeProviderTitleFormatter({
1579
+ children,
1580
+ }: Props): ReactNode;
1581
+ }
1582
+
1448
1583
  declare module '@theme/Details' {
1449
1584
  import {Details, type DetailsProps} from '@docusaurus/theme-common/Details';
1450
1585
 
@@ -1542,12 +1677,13 @@ declare module '@theme/ColorModeToggle' {
1542
1677
  export interface Props {
1543
1678
  readonly className?: string;
1544
1679
  readonly buttonClassName?: string;
1545
- readonly value: ColorMode;
1680
+ readonly respectPrefersColorScheme: boolean;
1681
+ readonly value: ColorMode | null;
1546
1682
  /**
1547
1683
  * The parameter represents the "to-be" value. For example, if currently in
1548
- * dark mode, clicking the button should call `onChange("light")`
1684
+ * light mode, clicking the button should call `onChange("dark")`
1549
1685
  */
1550
- readonly onChange: (colorMode: ColorMode) => void;
1686
+ readonly onChange: (colorMode: ColorMode | null) => void;
1551
1687
  }
1552
1688
 
1553
1689
  export default function ColorModeToggle(props: Props): ReactNode;
@@ -1604,6 +1740,14 @@ declare module '@theme/Icon/LightMode' {
1604
1740
  export default function IconLightMode(props: Props): ReactNode;
1605
1741
  }
1606
1742
 
1743
+ declare module '@theme/Icon/SystemColorMode' {
1744
+ import type {ComponentProps} from 'react';
1745
+
1746
+ export interface Props extends ComponentProps<'svg'> {}
1747
+
1748
+ export default function IconSystemColorMode(props: Props): JSX.Element;
1749
+ }
1750
+
1607
1751
  declare module '@theme/Icon/Menu' {
1608
1752
  import type {ComponentProps, ReactNode} from 'react';
1609
1753
 
@@ -1833,3 +1977,14 @@ declare module '@theme/DocBreadcrumbs/Items/Home' {
1833
1977
 
1834
1978
  export default function HomeBreadcrumbItem(): ReactNode;
1835
1979
  }
1980
+
1981
+ declare module '@theme/DocBreadcrumbs/StructuredData' {
1982
+ import type {ReactNode} from 'react';
1983
+ import type {PropSidebarBreadcrumbsItem} from '@docusaurus/plugin-content-docs';
1984
+
1985
+ export interface Props {
1986
+ readonly breadcrumbs: PropSidebarBreadcrumbsItem[];
1987
+ }
1988
+
1989
+ export default function DocBreadcrumbsStructuredData(props: Props): ReactNode;
1990
+ }
@@ -1,52 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
- import React from 'react';
8
- import clsx from 'clsx';
9
- import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
10
- function DefaultNavbarItemDesktop({
11
- className,
12
- isDropdownItem = false,
13
- ...props
14
- }) {
15
- const element = (
16
- <NavbarNavLink
17
- className={clsx(
18
- isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
19
- className,
20
- )}
21
- isDropdownLink={isDropdownItem}
22
- {...props}
23
- />
24
- );
25
- if (isDropdownItem) {
26
- return <li>{element}</li>;
27
- }
28
- return element;
29
- }
30
- function DefaultNavbarItemMobile({className, isDropdownItem, ...props}) {
31
- return (
32
- <li className="menu__list-item">
33
- <NavbarNavLink className={clsx('menu__link', className)} {...props} />
34
- </li>
35
- );
36
- }
37
- export default function DefaultNavbarItem({
38
- mobile = false,
39
- position, // Need to destructure position from props so that it doesn't get passed on.
40
- ...props
41
- }) {
42
- const Comp = mobile ? DefaultNavbarItemMobile : DefaultNavbarItemDesktop;
43
- return (
44
- <Comp
45
- {...props}
46
- activeClassName={
47
- props.activeClassName ??
48
- (mobile ? 'menu__link--active' : 'navbar__link--active')
49
- }
50
- />
51
- );
52
- }
@@ -1,66 +0,0 @@
1
- /**
2
- * Copyright (c) Facebook, Inc. and its affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- import React, {type ReactNode} from 'react';
9
- import clsx from 'clsx';
10
- import NavbarNavLink from '@theme/NavbarItem/NavbarNavLink';
11
- import type {
12
- DesktopOrMobileNavBarItemProps,
13
- Props,
14
- } from '@theme/NavbarItem/DefaultNavbarItem';
15
-
16
- function DefaultNavbarItemDesktop({
17
- className,
18
- isDropdownItem = false,
19
- ...props
20
- }: DesktopOrMobileNavBarItemProps) {
21
- const element = (
22
- <NavbarNavLink
23
- className={clsx(
24
- isDropdownItem ? 'dropdown__link' : 'navbar__item navbar__link',
25
- className,
26
- )}
27
- isDropdownLink={isDropdownItem}
28
- {...props}
29
- />
30
- );
31
-
32
- if (isDropdownItem) {
33
- return <li>{element}</li>;
34
- }
35
-
36
- return element;
37
- }
38
-
39
- function DefaultNavbarItemMobile({
40
- className,
41
- isDropdownItem,
42
- ...props
43
- }: DesktopOrMobileNavBarItemProps) {
44
- return (
45
- <li className="menu__list-item">
46
- <NavbarNavLink className={clsx('menu__link', className)} {...props} />
47
- </li>
48
- );
49
- }
50
-
51
- export default function DefaultNavbarItem({
52
- mobile = false,
53
- position, // Need to destructure position from props so that it doesn't get passed on.
54
- ...props
55
- }: Props): ReactNode {
56
- const Comp = mobile ? DefaultNavbarItemMobile : DefaultNavbarItemDesktop;
57
- return (
58
- <Comp
59
- {...props}
60
- activeClassName={
61
- props.activeClassName ??
62
- (mobile ? 'menu__link--active' : 'navbar__link--active')
63
- }
64
- />
65
- );
66
- }