@docusaurus/theme-classic 0.0.0-4114 → 0.0.0-4120
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/DocPage/index.js +1 -1
- package/lib/theme/hooks/useWindowSize.js +2 -3
- package/lib/translations.js +4 -4
- package/lib/types.d.ts +1 -1
- package/lib-next/theme/DocPage/index.js +1 -1
- package/lib-next/theme/hooks/useWindowSize.js +2 -2
- package/lib-next/translations.js +6 -10
- package/lib-next/types.d.ts +1 -1
- package/package.json +12 -12
- package/src/theme/DocPage/index.tsx +1 -1
- package/src/theme/hooks/useWindowSize.ts +2 -3
- package/src/translations.ts +6 -10
- package/src/types.d.ts +1 -1
|
@@ -125,7 +125,7 @@ function DocPage(props) {
|
|
|
125
125
|
const currentDocRoute = docRoutes.find(docRoute => (0, _router.matchPath)(location.pathname, docRoute));
|
|
126
126
|
|
|
127
127
|
if (!currentDocRoute) {
|
|
128
|
-
return <_NotFound.default
|
|
128
|
+
return <_NotFound.default />;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
131
|
return <>
|
|
@@ -52,10 +52,9 @@ function useWindowSize() {
|
|
|
52
52
|
(0, _react.useEffect)(() => {
|
|
53
53
|
function updateWindowSize() {
|
|
54
54
|
setWindowSize(getWindowSize());
|
|
55
|
-
}
|
|
56
|
-
|
|
55
|
+
}
|
|
57
56
|
|
|
58
|
-
const timeout = DevSimulateSSR ? setTimeout(updateWindowSize, 1000) : undefined;
|
|
57
|
+
const timeout = DevSimulateSSR ? window.setTimeout(updateWindowSize, 1000) : undefined;
|
|
59
58
|
window.addEventListener('resize', updateWindowSize);
|
|
60
59
|
return () => {
|
|
61
60
|
window.removeEventListener('resize', updateWindowSize);
|
package/lib/translations.js
CHANGED
|
@@ -19,12 +19,12 @@ var _utils = require("@docusaurus/utils");
|
|
|
19
19
|
function getNavbarTranslationFile(navbar) {
|
|
20
20
|
// TODO handle properly all the navbar item types here!
|
|
21
21
|
function flattenNavbarItems(items) {
|
|
22
|
-
const subItems =
|
|
22
|
+
const subItems = items.flatMap(item => {
|
|
23
23
|
var _item$items;
|
|
24
24
|
|
|
25
|
-
const allSubItems =
|
|
25
|
+
const allSubItems = [(_item$items = item.items) !== null && _item$items !== void 0 ? _item$items : []].flat();
|
|
26
26
|
return flattenNavbarItems(allSubItems);
|
|
27
|
-
})
|
|
27
|
+
});
|
|
28
28
|
return [...items, ...subItems];
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -74,7 +74,7 @@ function getFooterTranslationFile(footer) {
|
|
|
74
74
|
message: link.title,
|
|
75
75
|
description: `The title of the footer links column with title=${link.title} in the footer`
|
|
76
76
|
})).value();
|
|
77
|
-
const footerLinkLabels = (0, _lodash.chain)(
|
|
77
|
+
const footerLinkLabels = (0, _lodash.chain)(footer.links.flatMap(link => link.items).filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => {
|
|
78
78
|
var _linkItem$to;
|
|
79
79
|
|
|
80
80
|
return {
|
package/lib/types.d.ts
CHANGED
|
@@ -778,7 +778,7 @@ declare module '@theme/TagsListByLetter' {
|
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
declare module '@theme/TagsListInline' {
|
|
781
|
-
export type Tag = Readonly<{label: string; permalink}>;
|
|
781
|
+
export type Tag = Readonly<{label: string; permalink: string}>;
|
|
782
782
|
export interface Props {
|
|
783
783
|
readonly tags: readonly Tag[];
|
|
784
784
|
}
|
|
@@ -42,10 +42,10 @@ function useWindowSize() {
|
|
|
42
42
|
useEffect(() => {
|
|
43
43
|
function updateWindowSize() {
|
|
44
44
|
setWindowSize(getWindowSize());
|
|
45
|
-
}
|
|
45
|
+
}
|
|
46
46
|
|
|
47
47
|
const timeout = DevSimulateSSR
|
|
48
|
-
? setTimeout(updateWindowSize, 1000)
|
|
48
|
+
? window.setTimeout(updateWindowSize, 1000)
|
|
49
49
|
: undefined;
|
|
50
50
|
window.addEventListener('resize', updateWindowSize);
|
|
51
51
|
return () => {
|
package/lib-next/translations.js
CHANGED
|
@@ -4,18 +4,16 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
-
import {keyBy, chain
|
|
7
|
+
import {keyBy, chain} from 'lodash';
|
|
8
8
|
import {mergeTranslations} from '@docusaurus/utils';
|
|
9
9
|
|
|
10
10
|
function getNavbarTranslationFile(navbar) {
|
|
11
11
|
// TODO handle properly all the navbar item types here!
|
|
12
12
|
function flattenNavbarItems(items) {
|
|
13
|
-
const subItems =
|
|
14
|
-
items.
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}),
|
|
18
|
-
);
|
|
13
|
+
const subItems = items.flatMap((item) => {
|
|
14
|
+
const allSubItems = [item.items ?? []].flat();
|
|
15
|
+
return flattenNavbarItems(allSubItems);
|
|
16
|
+
});
|
|
19
17
|
return [...items, ...subItems];
|
|
20
18
|
}
|
|
21
19
|
|
|
@@ -76,9 +74,7 @@ function getFooterTranslationFile(footer) {
|
|
|
76
74
|
}))
|
|
77
75
|
.value();
|
|
78
76
|
const footerLinkLabels = chain(
|
|
79
|
-
|
|
80
|
-
(link) => !!link.label,
|
|
81
|
-
),
|
|
77
|
+
footer.links.flatMap((link) => link.items).filter((link) => !!link.label),
|
|
82
78
|
)
|
|
83
79
|
.keyBy((linkItem) => `link.item.label.${linkItem.label}`)
|
|
84
80
|
.mapValues((linkItem) => ({
|
package/lib-next/types.d.ts
CHANGED
|
@@ -778,7 +778,7 @@ declare module '@theme/TagsListByLetter' {
|
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
declare module '@theme/TagsListInline' {
|
|
781
|
-
export type Tag = Readonly<{label: string; permalink}>;
|
|
781
|
+
export type Tag = Readonly<{label: string; permalink: string}>;
|
|
782
782
|
export interface Props {
|
|
783
783
|
readonly tags: readonly Tag[];
|
|
784
784
|
}
|
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-4120",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/types.d.ts",
|
|
@@ -23,15 +23,15 @@
|
|
|
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/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
26
|
+
"@docusaurus/core": "0.0.0-4120",
|
|
27
|
+
"@docusaurus/plugin-content-blog": "0.0.0-4120",
|
|
28
|
+
"@docusaurus/plugin-content-docs": "0.0.0-4120",
|
|
29
|
+
"@docusaurus/plugin-content-pages": "0.0.0-4120",
|
|
30
|
+
"@docusaurus/theme-common": "0.0.0-4120",
|
|
31
|
+
"@docusaurus/types": "0.0.0-4120",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-4120",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-4120",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-4120",
|
|
35
35
|
"@mdx-js/mdx": "^1.6.21",
|
|
36
36
|
"@mdx-js/react": "^1.6.21",
|
|
37
37
|
"chalk": "^4.1.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"rtlcss": "^3.3.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
53
|
+
"@docusaurus/module-type-aliases": "0.0.0-4120",
|
|
54
54
|
"@types/mdx-js__react": "^1.5.4",
|
|
55
55
|
"@types/parse-numeric-range": "^0.0.1",
|
|
56
56
|
"@types/rtlcss": "^3.1.1",
|
|
@@ -64,5 +64,5 @@
|
|
|
64
64
|
"engines": {
|
|
65
65
|
"node": ">=12.13.0"
|
|
66
66
|
},
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "a940930d58733425dea30637c233659c10731a73"
|
|
68
68
|
}
|
|
@@ -51,9 +51,8 @@ function useWindowSize(): WindowSize {
|
|
|
51
51
|
setWindowSize(getWindowSize());
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
? setTimeout(updateWindowSize, 1000)
|
|
54
|
+
const timeout = DevSimulateSSR
|
|
55
|
+
? window.setTimeout(updateWindowSize, 1000)
|
|
57
56
|
: undefined;
|
|
58
57
|
|
|
59
58
|
window.addEventListener('resize', updateWindowSize);
|
package/src/translations.ts
CHANGED
|
@@ -13,18 +13,16 @@ import {
|
|
|
13
13
|
Footer,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
15
|
|
|
16
|
-
import {keyBy, chain
|
|
16
|
+
import {keyBy, chain} from 'lodash';
|
|
17
17
|
import {mergeTranslations} from '@docusaurus/utils';
|
|
18
18
|
|
|
19
19
|
function getNavbarTranslationFile(navbar: Navbar): TranslationFileContent {
|
|
20
20
|
// TODO handle properly all the navbar item types here!
|
|
21
21
|
function flattenNavbarItems(items: NavbarItem[]): NavbarItem[] {
|
|
22
|
-
const subItems =
|
|
23
|
-
items.
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}),
|
|
27
|
-
);
|
|
22
|
+
const subItems = items.flatMap((item) => {
|
|
23
|
+
const allSubItems = [item.items ?? []].flat();
|
|
24
|
+
return flattenNavbarItems(allSubItems);
|
|
25
|
+
});
|
|
28
26
|
return [...items, ...subItems];
|
|
29
27
|
}
|
|
30
28
|
|
|
@@ -84,9 +82,7 @@ function getFooterTranslationFile(footer: Footer): TranslationFileContent {
|
|
|
84
82
|
.value();
|
|
85
83
|
|
|
86
84
|
const footerLinkLabels: TranslationFileContent = chain(
|
|
87
|
-
|
|
88
|
-
(link) => !!link.label,
|
|
89
|
-
),
|
|
85
|
+
footer.links.flatMap((link) => link.items).filter((link) => !!link.label),
|
|
90
86
|
)
|
|
91
87
|
.keyBy((linkItem) => `link.item.label.${linkItem.label}`)
|
|
92
88
|
.mapValues((linkItem) => ({
|
package/src/types.d.ts
CHANGED
|
@@ -778,7 +778,7 @@ declare module '@theme/TagsListByLetter' {
|
|
|
778
778
|
}
|
|
779
779
|
|
|
780
780
|
declare module '@theme/TagsListInline' {
|
|
781
|
-
export type Tag = Readonly<{label: string; permalink}>;
|
|
781
|
+
export type Tag = Readonly<{label: string; permalink: string}>;
|
|
782
782
|
export interface Props {
|
|
783
783
|
readonly tags: readonly Tag[];
|
|
784
784
|
}
|