@docusaurus/theme-classic 0.0.0-4299 → 0.0.0-4308
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-classic.d.ts +13 -4
- package/lib/translations.js +3 -3
- package/lib/validateThemeConfig.js +2 -2
- package/lib-next/theme/DocPaginator/index.js +4 -28
- package/lib-next/theme/DocPaginatorNavLink/index.js +36 -0
- package/package.json +13 -13
- package/src/theme/DocPaginator/index.tsx +6 -30
- package/src/theme/DocPaginatorNavLink/index.tsx +38 -0
- package/src/theme-classic.d.ts +13 -4
- package/src/translations.ts +11 -11
- package/src/validateThemeConfig.ts +12 -12
package/lib/theme-classic.d.ts
CHANGED
|
@@ -123,13 +123,22 @@ declare module '@theme/CodeBlock' {
|
|
|
123
123
|
declare module '@theme/DocPaginator' {
|
|
124
124
|
import type {PropNavigation} from '@docusaurus/plugin-content-docs';
|
|
125
125
|
|
|
126
|
-
type PageInfo = {readonly permalink: string; readonly title: string};
|
|
127
|
-
|
|
128
126
|
// May be simpler to provide a {navigation: PropNavigation} prop?
|
|
129
127
|
export interface Props extends PropNavigation {}
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
export default function DocPaginator(props: Props): JSX.Element;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare module '@theme/DocPaginatorNavLink' {
|
|
133
|
+
import type {PropNavigationLink} from '@docusaurus/plugin-content-docs';
|
|
134
|
+
|
|
135
|
+
// May be simpler to provide a {navigation: PropNavigation} prop?
|
|
136
|
+
export interface Props {
|
|
137
|
+
navLink: PropNavigationLink;
|
|
138
|
+
next?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default function DocPaginatorNavLink(props: Props): JSX.Element;
|
|
133
142
|
}
|
|
134
143
|
|
|
135
144
|
declare module '@theme/DocSidebar' {
|
package/lib/translations.js
CHANGED
|
@@ -69,14 +69,14 @@ function translateNavbar(navbar, navbarTranslations) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
function isMultiColumnFooterLinks(links) {
|
|
72
|
-
return 'title' in links[0];
|
|
72
|
+
return links.length > 0 && 'title' in links[0];
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function getFooterTranslationFile(footer) {
|
|
76
|
-
const footerLinkTitles =
|
|
76
|
+
const footerLinkTitles = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.filter(link => !!link.title) : []).keyBy(link => `link.title.${link.title}`).mapValues(link => ({
|
|
77
77
|
message: link.title,
|
|
78
78
|
description: `The title of the footer links column with title=${link.title} in the footer`
|
|
79
|
-
})).value()
|
|
79
|
+
})).value();
|
|
80
80
|
const footerLinkLabels = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => !!link.label) : footer.links.filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => {
|
|
81
81
|
var _linkItem$to;
|
|
82
82
|
|
|
@@ -263,9 +263,9 @@ const ThemeConfigSchema = _utilsValidation.Joi.object({
|
|
|
263
263
|
links: _utilsValidation.Joi.alternatives(_utilsValidation.Joi.array().items(_utilsValidation.Joi.object({
|
|
264
264
|
title: _utilsValidation.Joi.string().allow(null).default(null),
|
|
265
265
|
items: _utilsValidation.Joi.array().items(FooterLinkItemSchema).default([])
|
|
266
|
-
}))
|
|
266
|
+
})), _utilsValidation.Joi.array().items(FooterLinkItemSchema)).messages({
|
|
267
267
|
'alternatives.match': `The footer must be either simple or multi-column, and not a mix of the two. See: https://docusaurus.io/docs/api/themes/configuration#footer-links`
|
|
268
|
-
})
|
|
268
|
+
}).default([])
|
|
269
269
|
}).optional(),
|
|
270
270
|
prism: _utilsValidation.Joi.object({
|
|
271
271
|
theme: _utilsValidation.Joi.object({
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import {translate} from '@docusaurus/Translate';
|
|
9
|
+
import DocPaginatorNavLink from '@theme/DocPaginatorNavLink';
|
|
10
10
|
|
|
11
11
|
function DocPaginator(props) {
|
|
12
12
|
const {previous, next} = props;
|
|
@@ -19,34 +19,10 @@ function DocPaginator(props) {
|
|
|
19
19
|
description: 'The ARIA label for the docs pagination',
|
|
20
20
|
})}>
|
|
21
21
|
<div className="pagination-nav__item">
|
|
22
|
-
{previous &&
|
|
23
|
-
<Link className="pagination-nav__link" to={previous.permalink}>
|
|
24
|
-
<div className="pagination-nav__sublabel">
|
|
25
|
-
<Translate
|
|
26
|
-
id="theme.docs.paginator.previous"
|
|
27
|
-
description="The label used to navigate to the previous doc">
|
|
28
|
-
Previous
|
|
29
|
-
</Translate>
|
|
30
|
-
</div>
|
|
31
|
-
<div className="pagination-nav__label">
|
|
32
|
-
« {previous.title}
|
|
33
|
-
</div>
|
|
34
|
-
</Link>
|
|
35
|
-
)}
|
|
22
|
+
{previous && <DocPaginatorNavLink navLink={previous} />}
|
|
36
23
|
</div>
|
|
37
24
|
<div className="pagination-nav__item pagination-nav__item--next">
|
|
38
|
-
{next &&
|
|
39
|
-
<Link className="pagination-nav__link" to={next.permalink}>
|
|
40
|
-
<div className="pagination-nav__sublabel">
|
|
41
|
-
<Translate
|
|
42
|
-
id="theme.docs.paginator.next"
|
|
43
|
-
description="The label used to navigate to the next doc">
|
|
44
|
-
Next
|
|
45
|
-
</Translate>
|
|
46
|
-
</div>
|
|
47
|
-
<div className="pagination-nav__label">{next.title} »</div>
|
|
48
|
-
</Link>
|
|
49
|
-
)}
|
|
25
|
+
{next && <DocPaginatorNavLink navLink={next} next />}
|
|
50
26
|
</div>
|
|
51
27
|
</nav>
|
|
52
28
|
);
|
|
@@ -0,0 +1,36 @@
|
|
|
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 Link from '@docusaurus/Link';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
|
|
12
|
+
function DocPaginatorNavLink(props) {
|
|
13
|
+
const {navLink, next} = props;
|
|
14
|
+
return (
|
|
15
|
+
<Link className={clsx('pagination-nav__link')} to={navLink.permalink}>
|
|
16
|
+
<div className="pagination-nav__sublabel">
|
|
17
|
+
{next ? (
|
|
18
|
+
<Translate
|
|
19
|
+
id="theme.docs.paginator.next"
|
|
20
|
+
description="The label used to navigate to the next doc">
|
|
21
|
+
Next
|
|
22
|
+
</Translate>
|
|
23
|
+
) : (
|
|
24
|
+
<Translate
|
|
25
|
+
id="theme.docs.paginator.previous"
|
|
26
|
+
description="The label used to navigate to the previous doc">
|
|
27
|
+
Previous
|
|
28
|
+
</Translate>
|
|
29
|
+
)}
|
|
30
|
+
</div>
|
|
31
|
+
<div className="pagination-nav__label">{navLink.title}</div>
|
|
32
|
+
</Link>
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export default DocPaginatorNavLink;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-4308",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -23,20 +23,20 @@
|
|
|
23
23
|
"update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@docusaurus/core": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
29
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
31
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4308",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4308",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4308",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4308",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4308",
|
|
31
|
+
"@docusaurus/theme-translations": "0.0.0-4308",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4308",
|
|
33
|
+
"@docusaurus/utils-validation": "0.0.0-4308",
|
|
34
34
|
"@mdx-js/mdx": "^1.6.21",
|
|
35
35
|
"@mdx-js/react": "^1.6.21",
|
|
36
36
|
"clsx": "^1.1.1",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
38
38
|
"globby": "^11.0.2",
|
|
39
|
-
"infima": "0.2.0-alpha.
|
|
39
|
+
"infima": "0.2.0-alpha.37",
|
|
40
40
|
"lodash": "^4.17.20",
|
|
41
41
|
"postcss": "^8.3.7",
|
|
42
42
|
"prism-react-renderer": "^1.2.1",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"rtlcss": "^3.3.0"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
49
|
-
"@docusaurus/types": "0.0.0-
|
|
48
|
+
"@docusaurus/module-type-aliases": "0.0.0-4308",
|
|
49
|
+
"@docusaurus/types": "0.0.0-4308",
|
|
50
50
|
"@types/mdx-js__react": "^1.5.4",
|
|
51
51
|
"@types/parse-numeric-range": "^0.0.1",
|
|
52
52
|
"@types/rtlcss": "^3.1.1",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"engines": {
|
|
62
62
|
"node": ">=14"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "83ade5a0b1bd84548b0761ce8c2ea2aa929968ac"
|
|
65
65
|
}
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import type {
|
|
9
|
+
import {translate} from '@docusaurus/Translate';
|
|
10
|
+
import DocPaginatorNavLink from '@theme/DocPaginatorNavLink';
|
|
11
|
+
import type {Props} from '@theme/DocPaginator';
|
|
12
12
|
|
|
13
|
-
function DocPaginator(props:
|
|
13
|
+
function DocPaginator(props: Props): JSX.Element {
|
|
14
14
|
const {previous, next} = props;
|
|
15
15
|
|
|
16
16
|
return (
|
|
@@ -22,34 +22,10 @@ function DocPaginator(props: PropNavigation): JSX.Element {
|
|
|
22
22
|
description: 'The ARIA label for the docs pagination',
|
|
23
23
|
})}>
|
|
24
24
|
<div className="pagination-nav__item">
|
|
25
|
-
{previous &&
|
|
26
|
-
<Link className="pagination-nav__link" to={previous.permalink}>
|
|
27
|
-
<div className="pagination-nav__sublabel">
|
|
28
|
-
<Translate
|
|
29
|
-
id="theme.docs.paginator.previous"
|
|
30
|
-
description="The label used to navigate to the previous doc">
|
|
31
|
-
Previous
|
|
32
|
-
</Translate>
|
|
33
|
-
</div>
|
|
34
|
-
<div className="pagination-nav__label">
|
|
35
|
-
« {previous.title}
|
|
36
|
-
</div>
|
|
37
|
-
</Link>
|
|
38
|
-
)}
|
|
25
|
+
{previous && <DocPaginatorNavLink navLink={previous} />}
|
|
39
26
|
</div>
|
|
40
27
|
<div className="pagination-nav__item pagination-nav__item--next">
|
|
41
|
-
{next &&
|
|
42
|
-
<Link className="pagination-nav__link" to={next.permalink}>
|
|
43
|
-
<div className="pagination-nav__sublabel">
|
|
44
|
-
<Translate
|
|
45
|
-
id="theme.docs.paginator.next"
|
|
46
|
-
description="The label used to navigate to the next doc">
|
|
47
|
-
Next
|
|
48
|
-
</Translate>
|
|
49
|
-
</div>
|
|
50
|
-
<div className="pagination-nav__label">{next.title} »</div>
|
|
51
|
-
</Link>
|
|
52
|
-
)}
|
|
28
|
+
{next && <DocPaginatorNavLink navLink={next} next />}
|
|
53
29
|
</div>
|
|
54
30
|
</nav>
|
|
55
31
|
);
|
|
@@ -0,0 +1,38 @@
|
|
|
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 from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Link from '@docusaurus/Link';
|
|
11
|
+
import Translate from '@docusaurus/Translate';
|
|
12
|
+
import type {Props} from '@theme/DocPaginatorNavLink';
|
|
13
|
+
|
|
14
|
+
function DocPaginatorNavLink(props: Props): JSX.Element {
|
|
15
|
+
const {navLink, next} = props;
|
|
16
|
+
return (
|
|
17
|
+
<Link className={clsx('pagination-nav__link')} to={navLink.permalink}>
|
|
18
|
+
<div className="pagination-nav__sublabel">
|
|
19
|
+
{next ? (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.docs.paginator.next"
|
|
22
|
+
description="The label used to navigate to the next doc">
|
|
23
|
+
Next
|
|
24
|
+
</Translate>
|
|
25
|
+
) : (
|
|
26
|
+
<Translate
|
|
27
|
+
id="theme.docs.paginator.previous"
|
|
28
|
+
description="The label used to navigate to the previous doc">
|
|
29
|
+
Previous
|
|
30
|
+
</Translate>
|
|
31
|
+
)}
|
|
32
|
+
</div>
|
|
33
|
+
<div className="pagination-nav__label">{navLink.title}</div>
|
|
34
|
+
</Link>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default DocPaginatorNavLink;
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -123,13 +123,22 @@ declare module '@theme/CodeBlock' {
|
|
|
123
123
|
declare module '@theme/DocPaginator' {
|
|
124
124
|
import type {PropNavigation} from '@docusaurus/plugin-content-docs';
|
|
125
125
|
|
|
126
|
-
type PageInfo = {readonly permalink: string; readonly title: string};
|
|
127
|
-
|
|
128
126
|
// May be simpler to provide a {navigation: PropNavigation} prop?
|
|
129
127
|
export interface Props extends PropNavigation {}
|
|
130
128
|
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
export default function DocPaginator(props: Props): JSX.Element;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
declare module '@theme/DocPaginatorNavLink' {
|
|
133
|
+
import type {PropNavigationLink} from '@docusaurus/plugin-content-docs';
|
|
134
|
+
|
|
135
|
+
// May be simpler to provide a {navigation: PropNavigation} prop?
|
|
136
|
+
export interface Props {
|
|
137
|
+
navLink: PropNavigationLink;
|
|
138
|
+
next?: boolean;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default function DocPaginatorNavLink(props: Props): JSX.Element;
|
|
133
142
|
}
|
|
134
143
|
|
|
135
144
|
declare module '@theme/DocSidebar' {
|
package/src/translations.ts
CHANGED
|
@@ -74,21 +74,21 @@ function translateNavbar(
|
|
|
74
74
|
function isMultiColumnFooterLinks(
|
|
75
75
|
links: MultiColumnFooter['links'] | SimpleFooter['links'],
|
|
76
76
|
): links is MultiColumnFooter['links'] {
|
|
77
|
-
return 'title' in links[0];
|
|
77
|
+
return links.length > 0 && 'title' in links[0];
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
function getFooterTranslationFile(footer: Footer): TranslationFileContent {
|
|
81
|
-
const footerLinkTitles: TranslationFileContent =
|
|
82
|
-
footer.links
|
|
81
|
+
const footerLinkTitles: TranslationFileContent = chain(
|
|
82
|
+
isMultiColumnFooterLinks(footer.links)
|
|
83
|
+
? footer.links.filter((link) => !!link.title)
|
|
84
|
+
: [],
|
|
83
85
|
)
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
.value()
|
|
91
|
-
: {};
|
|
86
|
+
.keyBy((link) => `link.title.${link.title}`)
|
|
87
|
+
.mapValues((link) => ({
|
|
88
|
+
message: link.title!,
|
|
89
|
+
description: `The title of the footer links column with title=${link.title} in the footer`,
|
|
90
|
+
}))
|
|
91
|
+
.value();
|
|
92
92
|
|
|
93
93
|
const footerLinkLabels: TranslationFileContent = chain(
|
|
94
94
|
isMultiColumnFooterLinks(footer.links)
|
|
@@ -312,18 +312,18 @@ const ThemeConfigSchema = Joi.object({
|
|
|
312
312
|
}),
|
|
313
313
|
copyright: Joi.string(),
|
|
314
314
|
links: Joi.alternatives(
|
|
315
|
-
Joi.array()
|
|
316
|
-
.
|
|
317
|
-
Joi.
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
315
|
+
Joi.array().items(
|
|
316
|
+
Joi.object({
|
|
317
|
+
title: Joi.string().allow(null).default(null),
|
|
318
|
+
items: Joi.array().items(FooterLinkItemSchema).default([]),
|
|
319
|
+
}),
|
|
320
|
+
),
|
|
321
|
+
Joi.array().items(FooterLinkItemSchema),
|
|
322
|
+
)
|
|
323
|
+
.messages({
|
|
324
|
+
'alternatives.match': `The footer must be either simple or multi-column, and not a mix of the two. See: https://docusaurus.io/docs/api/themes/configuration#footer-links`,
|
|
325
|
+
})
|
|
326
|
+
.default([]),
|
|
327
327
|
}).optional(),
|
|
328
328
|
prism: Joi.object({
|
|
329
329
|
theme: Joi.object({
|