@docusaurus/theme-classic 3.1.0 → 3.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/theme/BlogArchivePage/index.js +9 -1
- package/lib/theme/BlogLayout/index.js +1 -3
- package/lib/theme/BlogListPage/StructuredData/index.d.ts +10 -0
- package/lib/theme/BlogListPage/StructuredData/index.js +19 -0
- package/lib/theme/BlogListPage/index.js +2 -0
- package/lib/theme/BlogPostItem/Container/index.js +1 -26
- package/lib/theme/BlogPostItem/Content/index.js +1 -2
- package/lib/theme/BlogPostItem/Footer/index.js +61 -31
- package/lib/theme/BlogPostItem/Header/Author/index.js +5 -18
- package/lib/theme/BlogPostItem/Header/Info/index.js +15 -9
- package/lib/theme/BlogPostItem/Header/Title/index.js +2 -8
- package/lib/theme/{BlogPostItem/Footer/styles.module.css → BlogPostPage/StructuredData/index.d.ts} +2 -4
- package/lib/theme/BlogPostPage/StructuredData/index.js +19 -0
- package/lib/theme/BlogPostPage/index.js +3 -0
- package/lib/theme/DocCard/index.js +19 -12
- package/lib/theme/DocItem/Footer/index.js +17 -42
- package/lib/theme/DocSidebarItem/Category/index.js +3 -1
- package/lib/theme/EditMetaRow/index.d.ts +3 -0
- package/lib/theme/EditMetaRow/index.js +31 -0
- package/lib/theme/LastUpdated/index.d.ts +1 -1
- package/lib/theme/LastUpdated/index.js +17 -16
- package/lib/theme/MDXComponents/Img/index.js +1 -0
- package/{src/theme/BlogPostItem/Footer/styles.module.css → lib/theme/MDXComponents/Li.d.ts} +3 -4
- package/lib/theme/MDXComponents/Li.js +13 -0
- package/lib/theme/MDXComponents/index.js +2 -0
- package/lib/theme/NavbarItem/DropdownNavbarItem/index.js +3 -0
- package/package.json +14 -15
- package/src/theme/BlogArchivePage/index.tsx +11 -1
- package/src/theme/BlogLayout/index.tsx +1 -3
- package/src/theme/BlogListPage/StructuredData/index.tsx +22 -0
- package/src/theme/BlogListPage/index.tsx +2 -0
- package/src/theme/BlogPostItem/Container/index.tsx +1 -26
- package/src/theme/BlogPostItem/Content/index.tsx +1 -2
- package/src/theme/BlogPostItem/Footer/index.tsx +62 -32
- package/src/theme/BlogPostItem/Header/Author/index.tsx +5 -18
- package/src/theme/BlogPostItem/Header/Info/index.tsx +24 -9
- package/src/theme/BlogPostItem/Header/Title/index.tsx +2 -8
- package/src/theme/BlogPostPage/StructuredData/index.tsx +21 -0
- package/src/theme/BlogPostPage/index.tsx +3 -0
- package/src/theme/DocCard/index.tsx +20 -12
- package/src/theme/DocItem/Footer/index.tsx +19 -52
- package/src/theme/DocSidebarItem/Category/index.tsx +3 -1
- package/src/theme/EditMetaRow/index.tsx +34 -0
- package/src/theme/LastUpdated/index.tsx +18 -13
- package/src/theme/MDXComponents/Img/index.tsx +1 -0
- package/src/theme/MDXComponents/Li.tsx +17 -0
- package/src/theme/MDXComponents/index.tsx +2 -0
- package/src/theme/NavbarItem/DropdownNavbarItem/index.tsx +3 -0
- package/src/theme-classic.d.ts +18 -1
- package/lib/theme/{DocItem/Footer → EditMetaRow}/styles.module.css +2 -2
- package/src/theme/{DocItem/Footer → EditMetaRow}/styles.module.css +2 -2
|
@@ -101,6 +101,7 @@ function CollapseButton({
|
|
|
101
101
|
{label: categoryLabel},
|
|
102
102
|
)
|
|
103
103
|
}
|
|
104
|
+
aria-expanded={!collapsed}
|
|
104
105
|
type="button"
|
|
105
106
|
className="clean-btn menu__caret"
|
|
106
107
|
onClick={onClick}
|
|
@@ -193,7 +194,8 @@ export default function DocSidebarItemCategory({
|
|
|
193
194
|
}
|
|
194
195
|
}
|
|
195
196
|
aria-current={isCurrentPage ? 'page' : undefined}
|
|
196
|
-
|
|
197
|
+
role={collapsible && !href ? 'button' : undefined}
|
|
198
|
+
aria-expanded={collapsible && !href ? !collapsed : undefined}
|
|
197
199
|
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
|
|
198
200
|
{...props}>
|
|
199
201
|
{label}
|
|
@@ -0,0 +1,34 @@
|
|
|
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 EditThisPage from '@theme/EditThisPage';
|
|
10
|
+
import type {Props} from '@theme/EditMetaRow';
|
|
11
|
+
|
|
12
|
+
import LastUpdated from '@theme/LastUpdated';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
|
|
15
|
+
export default function EditMetaRow({
|
|
16
|
+
className,
|
|
17
|
+
editUrl,
|
|
18
|
+
lastUpdatedAt,
|
|
19
|
+
lastUpdatedBy,
|
|
20
|
+
}: Props): JSX.Element {
|
|
21
|
+
return (
|
|
22
|
+
<div className={clsx('row', className)}>
|
|
23
|
+
<div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
24
|
+
<div className={clsx('col', styles.lastUpdated)}>
|
|
25
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
26
|
+
<LastUpdated
|
|
27
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
28
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
29
|
+
/>
|
|
30
|
+
)}
|
|
31
|
+
</div>
|
|
32
|
+
</div>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -8,15 +8,25 @@
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
10
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
+
import {useDateTimeFormat} from '@docusaurus/theme-common/internal';
|
|
11
12
|
import type {Props} from '@theme/LastUpdated';
|
|
12
13
|
|
|
13
14
|
function LastUpdatedAtDate({
|
|
14
15
|
lastUpdatedAt,
|
|
15
|
-
formattedLastUpdatedAt,
|
|
16
16
|
}: {
|
|
17
17
|
lastUpdatedAt: number;
|
|
18
|
-
formattedLastUpdatedAt: string;
|
|
19
18
|
}): JSX.Element {
|
|
19
|
+
const atDate = new Date(lastUpdatedAt);
|
|
20
|
+
|
|
21
|
+
const dateTimeFormat = useDateTimeFormat({
|
|
22
|
+
day: 'numeric',
|
|
23
|
+
month: 'short',
|
|
24
|
+
year: 'numeric',
|
|
25
|
+
timeZone: 'UTC',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const formattedLastUpdatedAt = dateTimeFormat.format(atDate);
|
|
29
|
+
|
|
20
30
|
return (
|
|
21
31
|
<Translate
|
|
22
32
|
id="theme.lastUpdated.atDate"
|
|
@@ -24,7 +34,7 @@ function LastUpdatedAtDate({
|
|
|
24
34
|
values={{
|
|
25
35
|
date: (
|
|
26
36
|
<b>
|
|
27
|
-
<time dateTime={
|
|
37
|
+
<time dateTime={atDate.toISOString()} itemProp="dateModified">
|
|
28
38
|
{formattedLastUpdatedAt}
|
|
29
39
|
</time>
|
|
30
40
|
</b>
|
|
@@ -54,7 +64,6 @@ function LastUpdatedByUser({
|
|
|
54
64
|
|
|
55
65
|
export default function LastUpdated({
|
|
56
66
|
lastUpdatedAt,
|
|
57
|
-
formattedLastUpdatedAt,
|
|
58
67
|
lastUpdatedBy,
|
|
59
68
|
}: Props): JSX.Element {
|
|
60
69
|
return (
|
|
@@ -63,15 +72,11 @@ export default function LastUpdated({
|
|
|
63
72
|
id="theme.lastUpdated.lastUpdatedAtBy"
|
|
64
73
|
description="The sentence used to display when a page has been last updated, and by who"
|
|
65
74
|
values={{
|
|
66
|
-
atDate:
|
|
67
|
-
lastUpdatedAt
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/>
|
|
72
|
-
) : (
|
|
73
|
-
''
|
|
74
|
-
),
|
|
75
|
+
atDate: lastUpdatedAt ? (
|
|
76
|
+
<LastUpdatedAtDate lastUpdatedAt={lastUpdatedAt} />
|
|
77
|
+
) : (
|
|
78
|
+
''
|
|
79
|
+
),
|
|
75
80
|
byUser: lastUpdatedBy ? (
|
|
76
81
|
<LastUpdatedByUser lastUpdatedBy={lastUpdatedBy} />
|
|
77
82
|
) : (
|
|
@@ -0,0 +1,17 @@
|
|
|
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 useBrokenLinks from '@docusaurus/useBrokenLinks';
|
|
10
|
+
import type {Props} from '@theme/MDXComponents/Li';
|
|
11
|
+
|
|
12
|
+
export default function MDXLi(props: Props): ReactNode | undefined {
|
|
13
|
+
// MDX Footnotes have ids such as <li id="user-content-fn-1-953011">
|
|
14
|
+
useBrokenLinks().collectAnchor(props.id);
|
|
15
|
+
|
|
16
|
+
return <li {...props} />;
|
|
17
|
+
}
|
|
@@ -13,6 +13,7 @@ import MDXPre from '@theme/MDXComponents/Pre';
|
|
|
13
13
|
import MDXDetails from '@theme/MDXComponents/Details';
|
|
14
14
|
import MDXHeading from '@theme/MDXComponents/Heading';
|
|
15
15
|
import MDXUl from '@theme/MDXComponents/Ul';
|
|
16
|
+
import MDXLi from '@theme/MDXComponents/Li';
|
|
16
17
|
import MDXImg from '@theme/MDXComponents/Img';
|
|
17
18
|
import Admonition from '@theme/Admonition';
|
|
18
19
|
import Mermaid from '@theme/Mermaid';
|
|
@@ -27,6 +28,7 @@ const MDXComponents: MDXComponentsObject = {
|
|
|
27
28
|
a: MDXA,
|
|
28
29
|
pre: MDXPre,
|
|
29
30
|
ul: MDXUl,
|
|
31
|
+
li: MDXLi,
|
|
30
32
|
img: MDXImg,
|
|
31
33
|
h1: (props: ComponentProps<'h1'>) => <MDXHeading as="h1" {...props} />,
|
|
32
34
|
h2: (props: ComponentProps<'h2'>) => <MDXHeading as="h2" {...props} />,
|
|
@@ -89,6 +89,9 @@ function DropdownNavbarItemDesktop({
|
|
|
89
89
|
aria-haspopup="true"
|
|
90
90
|
aria-expanded={showDropdown}
|
|
91
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...
|
|
92
95
|
href={props.to ? undefined : '#'}
|
|
93
96
|
className={clsx('navbar__link', className)}
|
|
94
97
|
{...props}
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -676,6 +676,16 @@ declare module '@theme/DocVersionSuggestions' {
|
|
|
676
676
|
export default function DocVersionSuggestions(): JSX.Element;
|
|
677
677
|
}
|
|
678
678
|
|
|
679
|
+
declare module '@theme/EditMetaRow' {
|
|
680
|
+
export interface Props {
|
|
681
|
+
readonly className: string;
|
|
682
|
+
readonly editUrl: string | null | undefined;
|
|
683
|
+
readonly lastUpdatedAt: number | undefined;
|
|
684
|
+
readonly lastUpdatedBy: string | undefined;
|
|
685
|
+
}
|
|
686
|
+
export default function EditMetaRow(props: Props): JSX.Element;
|
|
687
|
+
}
|
|
688
|
+
|
|
679
689
|
declare module '@theme/EditThisPage' {
|
|
680
690
|
export interface Props {
|
|
681
691
|
readonly editUrl: string;
|
|
@@ -824,7 +834,6 @@ declare module '@theme/SearchMetadata' {
|
|
|
824
834
|
declare module '@theme/LastUpdated' {
|
|
825
835
|
export interface Props {
|
|
826
836
|
readonly lastUpdatedAt?: number;
|
|
827
|
-
readonly formattedLastUpdatedAt?: string;
|
|
828
837
|
readonly lastUpdatedBy?: string;
|
|
829
838
|
}
|
|
830
839
|
|
|
@@ -867,6 +876,14 @@ declare module '@theme/MDXComponents/Ul' {
|
|
|
867
876
|
export default function MDXUl(props: Props): JSX.Element;
|
|
868
877
|
}
|
|
869
878
|
|
|
879
|
+
declare module '@theme/MDXComponents/Li' {
|
|
880
|
+
import type {ComponentProps} from 'react';
|
|
881
|
+
|
|
882
|
+
export interface Props extends ComponentProps<'li'> {}
|
|
883
|
+
|
|
884
|
+
export default function MDXLi(props: Props): JSX.Element;
|
|
885
|
+
}
|
|
886
|
+
|
|
870
887
|
declare module '@theme/MDXComponents/Img' {
|
|
871
888
|
import type {ComponentProps} from 'react';
|
|
872
889
|
|