@docusaurus/theme-classic 2.0.1 → 2.2.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.
- package/lib/getSwizzleConfig.js +14 -0
- package/lib/theme/AnnouncementBar/CloseButton/index.d.ts +9 -0
- package/lib/theme/AnnouncementBar/CloseButton/index.js +26 -0
- package/lib/theme/AnnouncementBar/CloseButton/styles.module.css +11 -0
- package/lib/theme/AnnouncementBar/Content/index.d.ts +9 -0
- package/lib/theme/AnnouncementBar/Content/index.js +23 -0
- package/lib/theme/AnnouncementBar/Content/styles.module.css +17 -0
- package/lib/theme/AnnouncementBar/index.js +10 -23
- package/lib/theme/AnnouncementBar/styles.module.css +9 -10
- package/lib/theme/CodeBlock/Line/index.js +2 -4
- package/lib/theme/CodeBlock/Line/styles.module.css +1 -0
- package/lib/theme/ColorModeToggle/index.js +2 -1
- package/lib/theme/DocCardList/index.d.ts +1 -1
- package/lib/theme/DocCardList/index.js +14 -11
- package/lib/theme/DocPage/index.js +24 -7
- package/lib/theme/DocSidebarItem/Category/index.js +1 -1
- package/lib/theme/DocSidebarItem/Link/index.js +2 -1
- package/lib/theme/Layout/index.js +6 -1
- package/lib/theme/MDXComponents/Code.js +24 -4
- package/lib/theme/MDXComponents/index.js +2 -0
- package/lib/theme/Mermaid.d.ts +7 -0
- package/lib/theme/Mermaid.js +13 -0
- package/lib/theme/Navbar/MobileSidebar/Header/index.js +6 -0
- package/lib/theme/Navbar/MobileSidebar/Toggle/index.js +11 -6
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +4 -1
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +6 -1
- package/lib/theme/SkipToContent/index.js +2 -15
- package/lib/theme/Tabs/index.js +4 -1
- package/lib/theme/Tag/styles.module.css +2 -2
- package/package.json +14 -16
- package/src/getSwizzleConfig.ts +16 -0
- package/src/theme/AnnouncementBar/CloseButton/index.tsx +31 -0
- package/src/theme/AnnouncementBar/CloseButton/styles.module.css +11 -0
- package/src/theme/AnnouncementBar/Content/index.tsx +28 -0
- package/src/theme/AnnouncementBar/Content/styles.module.css +17 -0
- package/src/theme/AnnouncementBar/index.tsx +10 -26
- package/src/theme/AnnouncementBar/styles.module.css +9 -10
- package/src/theme/CodeBlock/Line/index.tsx +2 -4
- package/src/theme/CodeBlock/Line/styles.module.css +1 -0
- package/src/theme/ColorModeToggle/index.tsx +2 -1
- package/src/theme/DocCardList/index.tsx +14 -12
- package/src/theme/DocPage/index.tsx +25 -7
- package/src/theme/DocSidebarItem/Category/index.tsx +1 -1
- package/src/theme/DocSidebarItem/Link/index.tsx +2 -1
- package/src/theme/Layout/index.tsx +6 -1
- package/src/theme/MDXComponents/Code.tsx +24 -4
- package/src/theme/MDXComponents/index.tsx +2 -0
- package/src/theme/Mermaid.tsx +16 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +6 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +11 -6
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +4 -1
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +6 -1
- package/src/theme/SkipToContent/index.tsx +2 -15
- package/src/theme/Tabs/index.tsx +8 -2
- package/src/theme/Tag/styles.module.css +2 -2
- package/src/theme-classic.d.ts +27 -1
|
@@ -6,23 +6,10 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import
|
|
10
|
-
import {useSkipToContent} from '@docusaurus/theme-common/internal';
|
|
9
|
+
import {SkipToContentLink} from '@docusaurus/theme-common';
|
|
11
10
|
|
|
12
11
|
import styles from './styles.module.css';
|
|
13
12
|
|
|
14
13
|
export default function SkipToContent(): JSX.Element {
|
|
15
|
-
|
|
16
|
-
return (
|
|
17
|
-
<div ref={containerRef} role="region">
|
|
18
|
-
{/* eslint-disable-next-line jsx-a11y/anchor-is-valid */}
|
|
19
|
-
<a href="#" className={styles.skipToContent} onClick={handleSkip}>
|
|
20
|
-
<Translate
|
|
21
|
-
id="theme.common.skipToMainContent"
|
|
22
|
-
description="The skip to content label used for accessibility, allowing to rapidly navigate to main content with keyboard tab/enter navigation">
|
|
23
|
-
Skip to main content
|
|
24
|
-
</Translate>
|
|
25
|
-
</a>
|
|
26
|
-
</div>
|
|
27
|
-
);
|
|
14
|
+
return <SkipToContentLink className={styles.skipToContent} />;
|
|
28
15
|
}
|
package/src/theme/Tabs/index.tsx
CHANGED
|
@@ -104,7 +104,10 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
104
104
|
}
|
|
105
105
|
|
|
106
106
|
const handleTabChange = (
|
|
107
|
-
event:
|
|
107
|
+
event:
|
|
108
|
+
| React.FocusEvent<HTMLLIElement>
|
|
109
|
+
| React.MouseEvent<HTMLLIElement>
|
|
110
|
+
| React.KeyboardEvent<HTMLLIElement>,
|
|
108
111
|
) => {
|
|
109
112
|
const newTab = event.currentTarget;
|
|
110
113
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -124,6 +127,10 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
124
127
|
let focusElement: HTMLLIElement | null = null;
|
|
125
128
|
|
|
126
129
|
switch (event.key) {
|
|
130
|
+
case 'Enter': {
|
|
131
|
+
handleTabChange(event);
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
127
134
|
case 'ArrowRight': {
|
|
128
135
|
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
129
136
|
focusElement = tabRefs[nextTab] ?? tabRefs[0]!;
|
|
@@ -161,7 +168,6 @@ function TabsComponent(props: Props): JSX.Element {
|
|
|
161
168
|
key={value}
|
|
162
169
|
ref={(tabControl) => tabRefs.push(tabControl)}
|
|
163
170
|
onKeyDown={handleKeydown}
|
|
164
|
-
onFocus={handleTabChange}
|
|
165
171
|
onClick={handleTabChange}
|
|
166
172
|
{...attributes}
|
|
167
173
|
className={clsx(
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -55,6 +55,22 @@ declare module '@theme/AnnouncementBar' {
|
|
|
55
55
|
export default function AnnouncementBar(): JSX.Element | null;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
declare module '@theme/AnnouncementBar/Content' {
|
|
59
|
+
import type {ComponentProps} from 'react';
|
|
60
|
+
|
|
61
|
+
export interface Props extends ComponentProps<'div'> {}
|
|
62
|
+
|
|
63
|
+
export default function AnnouncementBarContent(props: Props): JSX.Element;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
declare module '@theme/AnnouncementBar/CloseButton' {
|
|
67
|
+
import type {ComponentProps} from 'react';
|
|
68
|
+
|
|
69
|
+
export interface Props extends ComponentProps<'button'> {}
|
|
70
|
+
|
|
71
|
+
export default function AnnouncementBarCloseButton(props: Props): JSX.Element;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
declare module '@theme/BackToTopButton' {
|
|
59
75
|
export default function BackToTopButton(): JSX.Element;
|
|
60
76
|
}
|
|
@@ -320,7 +336,7 @@ declare module '@theme/DocCardList' {
|
|
|
320
336
|
import type {PropSidebarItem} from '@docusaurus/plugin-content-docs';
|
|
321
337
|
|
|
322
338
|
export interface Props {
|
|
323
|
-
readonly items
|
|
339
|
+
readonly items?: PropSidebarItem[];
|
|
324
340
|
readonly className?: string;
|
|
325
341
|
}
|
|
326
342
|
|
|
@@ -772,6 +788,7 @@ declare module '@theme/MDXComponents' {
|
|
|
772
788
|
import type MDXUl from '@theme/MDXComponents/Ul';
|
|
773
789
|
import type MDXImg from '@theme/MDXComponents/Img';
|
|
774
790
|
import type Admonition from '@theme/Admonition';
|
|
791
|
+
import type Mermaid from '@theme/Mermaid';
|
|
775
792
|
|
|
776
793
|
export type MDXComponentsObject = {
|
|
777
794
|
readonly head: typeof MDXHead;
|
|
@@ -788,6 +805,7 @@ declare module '@theme/MDXComponents' {
|
|
|
788
805
|
readonly h5: (props: ComponentProps<'h5'>) => JSX.Element;
|
|
789
806
|
readonly h6: (props: ComponentProps<'h6'>) => JSX.Element;
|
|
790
807
|
readonly admonition: typeof Admonition;
|
|
808
|
+
readonly mermaid: typeof Mermaid;
|
|
791
809
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
792
810
|
[tagName: string]: ComponentType<any>;
|
|
793
811
|
};
|
|
@@ -1096,6 +1114,14 @@ declare module '@theme/SearchBar' {
|
|
|
1096
1114
|
export default function SearchBar(): JSX.Element;
|
|
1097
1115
|
}
|
|
1098
1116
|
|
|
1117
|
+
declare module '@theme/Mermaid' {
|
|
1118
|
+
export interface Props {
|
|
1119
|
+
value: string;
|
|
1120
|
+
}
|
|
1121
|
+
|
|
1122
|
+
export default function Mermaid(props: Props): JSX.Element;
|
|
1123
|
+
}
|
|
1124
|
+
|
|
1099
1125
|
declare module '@theme/TabItem' {
|
|
1100
1126
|
import type {ReactNode} from 'react';
|
|
1101
1127
|
|