@docusaurus/theme-classic 2.0.0-beta.15 → 2.0.0-beta.16
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 +102 -0
- package/lib/index.js +14 -11
- package/lib/theme-classic.d.ts +123 -97
- package/lib/translations.js +29 -32
- package/lib/validateThemeConfig.js +7 -4
- package/lib-next/theme/AnnouncementBar/index.js +1 -4
- package/lib-next/theme/BackToTopButton/index.js +6 -6
- package/lib-next/theme/BackToTopButton/styles.module.css +3 -1
- package/lib-next/theme/BlogLayout/index.js +1 -4
- package/lib-next/theme/BlogListPage/index.js +1 -4
- package/lib-next/theme/BlogListPaginator/index.js +1 -4
- package/lib-next/theme/BlogPostAuthor/index.js +18 -24
- package/lib-next/theme/BlogPostItem/index.js +12 -4
- package/lib-next/theme/BlogPostPage/index.js +4 -6
- package/lib-next/theme/BlogPostPaginator/index.js +1 -4
- package/lib-next/theme/BlogTagsListPage/index.js +1 -4
- package/lib-next/theme/BlogTagsPostsPage/index.js +4 -2
- package/lib-next/theme/CodeBlock/index.js +2 -1
- package/lib-next/theme/Details/index.js +2 -1
- package/lib-next/theme/DocBreadcrumbs/index.js +76 -0
- package/lib-next/theme/DocBreadcrumbs/styles.module.css +26 -0
- package/lib-next/theme/DocCard/index.js +12 -1
- package/lib-next/theme/DocCard/styles.module.css +1 -1
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +2 -0
- package/lib-next/theme/DocItem/index.js +8 -5
- package/lib-next/theme/DocPage/index.js +2 -4
- package/lib-next/theme/DocPage/styles.module.css +3 -3
- package/lib-next/theme/DocPaginator/index.js +1 -4
- package/lib-next/theme/DocSidebar/styles.module.css +4 -4
- package/lib-next/theme/DocSidebarItem/index.js +39 -14
- package/lib-next/theme/DocSidebarItem/styles.module.css +3 -10
- package/lib-next/theme/DocTagsListPage/index.js +1 -4
- package/lib-next/theme/DocVersionBadge/index.js +8 -1
- package/lib-next/theme/Footer/index.js +8 -4
- package/lib-next/theme/Heading/index.js +0 -1
- package/lib-next/theme/Heading/styles.module.css +16 -0
- package/lib-next/theme/IconArrow/index.js +1 -4
- package/lib-next/theme/IconEdit/index.js +1 -4
- package/lib-next/theme/IconExternalLink/index.js +1 -4
- package/lib-next/theme/IconLanguage/index.js +1 -4
- package/lib-next/theme/IconMenu/index.js +6 -4
- package/lib-next/theme/Layout/index.js +1 -4
- package/lib-next/theme/LayoutHead/index.js +4 -0
- package/lib-next/theme/Logo/index.js +1 -4
- package/lib-next/theme/MDXComponents/index.js +4 -3
- package/lib-next/theme/MDXPage/index.js +1 -4
- package/lib-next/theme/Navbar/index.js +1 -3
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +1 -3
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +2 -2
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +1 -3
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +8 -1
- package/lib-next/theme/NavbarItem/index.js +2 -2
- package/lib-next/theme/NotFound.js +1 -4
- package/lib-next/theme/PaginatorNavLink/index.js +1 -4
- package/lib-next/theme/SearchBar.js +1 -1
- package/lib-next/theme/SearchMetadata/index.js +11 -6
- package/lib-next/theme/SkipToContent/index.js +1 -3
- package/lib-next/theme/TOC/index.js +2 -5
- package/lib-next/theme/TOCInline/index.js +1 -4
- package/lib-next/theme/TOCItems/index.js +3 -3
- package/lib-next/theme/TabItem/index.js +1 -4
- package/lib-next/theme/Tabs/__tests__/index.test.js +3 -1
- package/lib-next/theme/Tabs/index.js +1 -1
- package/lib-next/theme/Tag/index.js +1 -4
- package/lib-next/theme/TagsListByLetter/index.js +1 -3
- package/lib-next/theme/ThemedImage/index.js +1 -4
- package/lib-next/theme/ThemedImage/styles.module.css +2 -2
- package/lib-next/theme/Toggle/index.js +25 -2
- package/lib-next/theme/prism-include-languages.js +17 -23
- package/package.json +21 -22
- package/src/getSwizzleConfig.ts +101 -0
- package/src/index.ts +7 -21
- package/src/theme/AnnouncementBar/index.tsx +1 -3
- package/src/theme/BackToTopButton/index.tsx +8 -7
- package/src/theme/BackToTopButton/styles.module.css +3 -1
- package/src/theme/BlogLayout/index.tsx +1 -3
- package/src/theme/BlogListPage/index.tsx +1 -3
- package/src/theme/BlogListPaginator/index.tsx +1 -3
- package/src/theme/BlogPostAuthor/index.tsx +18 -23
- package/src/theme/BlogPostItem/index.tsx +10 -4
- package/src/theme/BlogPostPage/index.tsx +4 -5
- package/src/theme/BlogPostPaginator/index.tsx +1 -3
- package/src/theme/BlogTagsListPage/index.tsx +1 -3
- package/src/theme/BlogTagsPostsPage/index.tsx +3 -1
- package/src/theme/CodeBlock/index.tsx +2 -1
- package/src/theme/Details/index.tsx +2 -1
- package/src/theme/DocBreadcrumbs/index.tsx +91 -0
- package/src/theme/DocBreadcrumbs/styles.module.css +26 -0
- package/src/theme/DocCard/index.tsx +10 -1
- package/src/theme/DocCard/styles.module.css +1 -1
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +2 -0
- package/src/theme/DocItem/index.tsx +7 -4
- package/src/theme/DocPage/index.tsx +2 -4
- package/src/theme/DocPage/styles.module.css +3 -3
- package/src/theme/DocPaginator/index.tsx +1 -3
- package/src/theme/DocSidebar/styles.module.css +4 -4
- package/src/theme/DocSidebarItem/index.tsx +43 -13
- package/src/theme/DocSidebarItem/styles.module.css +3 -10
- package/src/theme/DocTagsListPage/index.tsx +1 -3
- package/src/theme/DocVersionBadge/index.tsx +6 -1
- package/src/theme/Footer/index.tsx +8 -4
- package/src/theme/Heading/index.tsx +0 -1
- package/src/theme/Heading/styles.module.css +16 -0
- package/src/theme/IconArrow/index.tsx +1 -3
- package/src/theme/IconEdit/index.tsx +4 -3
- package/src/theme/IconExternalLink/index.tsx +4 -3
- package/src/theme/IconLanguage/index.tsx +5 -3
- package/src/theme/IconMenu/index.tsx +1 -3
- package/src/theme/Layout/index.tsx +1 -3
- package/src/theme/LayoutHead/index.tsx +4 -0
- package/src/theme/Logo/index.tsx +1 -3
- package/src/theme/MDXComponents/index.tsx +4 -3
- package/src/theme/MDXPage/index.tsx +1 -3
- package/src/theme/Navbar/index.tsx +1 -3
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +1 -3
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +4 -3
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +8 -1
- package/src/theme/NavbarItem/index.tsx +2 -2
- package/src/theme/NotFound.tsx +1 -3
- package/src/theme/PaginatorNavLink/index.tsx +1 -3
- package/src/theme/SearchBar.tsx +2 -1
- package/src/theme/SearchMetadata/index.tsx +12 -6
- package/src/theme/SkipToContent/index.tsx +1 -3
- package/src/theme/TOC/index.tsx +3 -5
- package/src/theme/TOCCollapsible/index.tsx +2 -2
- package/src/theme/TOCInline/index.tsx +3 -5
- package/src/theme/TOCItems/index.tsx +11 -7
- package/src/theme/TabItem/index.tsx +5 -3
- package/src/theme/Tabs/index.tsx +1 -1
- package/src/theme/Tag/index.tsx +1 -3
- package/src/theme/TagsListByLetter/index.tsx +1 -3
- package/src/theme/ThemedImage/index.tsx +1 -3
- package/src/theme/ThemedImage/styles.module.css +2 -2
- package/src/theme/Toggle/index.tsx +26 -2
- package/src/theme/prism-include-languages.ts +20 -23
- package/src/theme-classic.d.ts +123 -97
- package/src/translations.ts +41 -39
- package/src/validateThemeConfig.ts +10 -8
- package/lib-next/theme/DocSidebarItems/styles.module.css +0 -20
- package/lib-next/theme/Heading/styles.css +0 -22
- package/src/theme/DocSidebarItems/styles.module.css +0 -20
- package/src/theme/Heading/styles.css +0 -22
package/lib/translations.js
CHANGED
|
@@ -6,10 +6,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.getTranslationFiles = getTranslationFiles;
|
|
7
7
|
exports.translateThemeConfig = translateThemeConfig;
|
|
8
8
|
|
|
9
|
-
var _lodash = require("lodash");
|
|
9
|
+
var _lodash = _interopRequireDefault(require("lodash"));
|
|
10
10
|
|
|
11
11
|
var _utils = require("@docusaurus/utils");
|
|
12
12
|
|
|
13
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
14
|
+
|
|
13
15
|
/**
|
|
14
16
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
15
17
|
*
|
|
@@ -20,19 +22,17 @@ function getNavbarTranslationFile(navbar) {
|
|
|
20
22
|
// TODO handle properly all the navbar item types here!
|
|
21
23
|
function flattenNavbarItems(items) {
|
|
22
24
|
const subItems = items.flatMap(item => {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
const allSubItems = [(_item$items = item.items) !== null && _item$items !== void 0 ? _item$items : []].flat();
|
|
25
|
+
const allSubItems = [item.items ?? []].flat();
|
|
26
26
|
return flattenNavbarItems(allSubItems);
|
|
27
27
|
});
|
|
28
28
|
return [...items, ...subItems];
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
const allNavbarItems = flattenNavbarItems(navbar.items);
|
|
32
|
-
const navbarItemsTranslations =
|
|
32
|
+
const navbarItemsTranslations = Object.fromEntries(allNavbarItems.filter(navbarItem => navbarItem.label).map(navbarItem => [`item.label.${navbarItem.label}`, {
|
|
33
33
|
message: navbarItem.label,
|
|
34
34
|
description: `Navbar item with label ${navbarItem.label}`
|
|
35
|
-
}))
|
|
35
|
+
}]));
|
|
36
36
|
const titleTranslations = navbar.title ? {
|
|
37
37
|
title: {
|
|
38
38
|
message: navbar.title,
|
|
@@ -43,23 +43,23 @@ function getNavbarTranslationFile(navbar) {
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
function translateNavbar(navbar, navbarTranslations) {
|
|
46
|
-
var _navbarTranslations$t
|
|
46
|
+
var _navbarTranslations$t;
|
|
47
47
|
|
|
48
48
|
return { ...navbar,
|
|
49
|
-
title: (_navbarTranslations$t =
|
|
49
|
+
title: ((_navbarTranslations$t = navbarTranslations.title) === null || _navbarTranslations$t === void 0 ? void 0 : _navbarTranslations$t.message) ?? navbar.title,
|
|
50
50
|
// TODO handle properly all the navbar item types here!
|
|
51
51
|
items: navbar.items.map(item => {
|
|
52
|
-
var _item$
|
|
52
|
+
var _item$items, _navbarTranslations$2;
|
|
53
53
|
|
|
54
|
-
const subItems = (_item$
|
|
55
|
-
var _navbarTranslations
|
|
54
|
+
const subItems = (_item$items = item.items) === null || _item$items === void 0 ? void 0 : _item$items.map(subItem => {
|
|
55
|
+
var _navbarTranslations$;
|
|
56
56
|
|
|
57
57
|
return { ...subItem,
|
|
58
|
-
label: (
|
|
58
|
+
label: ((_navbarTranslations$ = navbarTranslations[`item.label.${subItem.label}`]) === null || _navbarTranslations$ === void 0 ? void 0 : _navbarTranslations$.message) ?? subItem.label
|
|
59
59
|
};
|
|
60
60
|
});
|
|
61
61
|
return { ...item,
|
|
62
|
-
label: (
|
|
62
|
+
label: ((_navbarTranslations$2 = navbarTranslations[`item.label.${item.label}`]) === null || _navbarTranslations$2 === void 0 ? void 0 : _navbarTranslations$2.message) ?? item.label,
|
|
63
63
|
...(subItems ? {
|
|
64
64
|
items: subItems
|
|
65
65
|
} : undefined)
|
|
@@ -73,18 +73,14 @@ function isMultiColumnFooterLinks(links) {
|
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
function getFooterTranslationFile(footer) {
|
|
76
|
-
const footerLinkTitles =
|
|
76
|
+
const footerLinkTitles = Object.fromEntries((isMultiColumnFooterLinks(footer.links) ? footer.links.filter(link => link.title) : []).map(link => [`link.title.${link.title}`, {
|
|
77
77
|
message: link.title,
|
|
78
78
|
description: `The title of the footer links column with title=${link.title} in the footer`
|
|
79
|
-
}))
|
|
80
|
-
const footerLinkLabels =
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
message: linkItem.label,
|
|
85
|
-
description: `The label of footer link with label=${linkItem.label} linking to ${(_linkItem$to = linkItem.to) !== null && _linkItem$to !== void 0 ? _linkItem$to : linkItem.href}`
|
|
86
|
-
};
|
|
87
|
-
}).value();
|
|
79
|
+
}]));
|
|
80
|
+
const footerLinkLabels = Object.fromEntries((isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => link.label) : footer.links.filter(link => link.label)).map(link => [`link.item.label.${link.label}`, {
|
|
81
|
+
message: link.label,
|
|
82
|
+
description: `The label of footer link with label=${link.label} linking to ${link.to ?? link.href}`
|
|
83
|
+
}]));
|
|
88
84
|
const copyright = footer.copyright ? {
|
|
89
85
|
copyright: {
|
|
90
86
|
message: footer.copyright,
|
|
@@ -95,29 +91,29 @@ function getFooterTranslationFile(footer) {
|
|
|
95
91
|
}
|
|
96
92
|
|
|
97
93
|
function translateFooter(footer, footerTranslations) {
|
|
98
|
-
var _footerTranslations$c
|
|
94
|
+
var _footerTranslations$c;
|
|
99
95
|
|
|
100
96
|
const links = isMultiColumnFooterLinks(footer.links) ? footer.links.map(link => {
|
|
101
|
-
var _footerTranslations
|
|
97
|
+
var _footerTranslations$;
|
|
102
98
|
|
|
103
99
|
return { ...link,
|
|
104
|
-
title: (
|
|
100
|
+
title: ((_footerTranslations$ = footerTranslations[`link.title.${link.title}`]) === null || _footerTranslations$ === void 0 ? void 0 : _footerTranslations$.message) ?? link.title,
|
|
105
101
|
items: link.items.map(linkItem => {
|
|
106
|
-
var _footerTranslations
|
|
102
|
+
var _footerTranslations$2;
|
|
107
103
|
|
|
108
104
|
return { ...linkItem,
|
|
109
|
-
label: (
|
|
105
|
+
label: ((_footerTranslations$2 = footerTranslations[`link.item.label.${linkItem.label}`]) === null || _footerTranslations$2 === void 0 ? void 0 : _footerTranslations$2.message) ?? linkItem.label
|
|
110
106
|
};
|
|
111
107
|
})
|
|
112
108
|
};
|
|
113
109
|
}) : footer.links.map(link => {
|
|
114
|
-
var _footerTranslations
|
|
110
|
+
var _footerTranslations$3;
|
|
115
111
|
|
|
116
112
|
return { ...link,
|
|
117
|
-
label: (
|
|
113
|
+
label: ((_footerTranslations$3 = footerTranslations[`link.item.label.${link.label}`]) === null || _footerTranslations$3 === void 0 ? void 0 : _footerTranslations$3.message) ?? link.label
|
|
118
114
|
};
|
|
119
115
|
});
|
|
120
|
-
const copyright = (_footerTranslations$c =
|
|
116
|
+
const copyright = ((_footerTranslations$c = footerTranslations.copyright) === null || _footerTranslations$c === void 0 ? void 0 : _footerTranslations$c.message) ?? footer.copyright;
|
|
121
117
|
return { ...footer,
|
|
122
118
|
links,
|
|
123
119
|
copyright
|
|
@@ -141,7 +137,8 @@ function translateThemeConfig({
|
|
|
141
137
|
themeConfig,
|
|
142
138
|
translationFiles
|
|
143
139
|
}) {
|
|
144
|
-
const translationFilesMap =
|
|
140
|
+
const translationFilesMap = _lodash.default.keyBy(translationFiles, f => f.path);
|
|
141
|
+
|
|
145
142
|
return { ...themeConfig,
|
|
146
143
|
navbar: translateNavbar(themeConfig.navbar, translationFilesMap.navbar.content),
|
|
147
144
|
footer: themeConfig.footer ? translateFooter(themeConfig.footer, translationFilesMap.footer.content) : undefined
|
|
@@ -58,8 +58,8 @@ const NavbarItemPosition = _utilsValidation.Joi.string().equal('left', 'right').
|
|
|
58
58
|
const NavbarItemBaseSchema = _utilsValidation.Joi.object({
|
|
59
59
|
label: _utilsValidation.Joi.string(),
|
|
60
60
|
className: _utilsValidation.Joi.string()
|
|
61
|
-
}) // We allow any unknown attributes on the links
|
|
62
|
-
//
|
|
61
|
+
}) // We allow any unknown attributes on the links (users may need additional
|
|
62
|
+
// attributes like target, aria-role, data-customAttribute...)
|
|
63
63
|
.unknown();
|
|
64
64
|
|
|
65
65
|
const DefaultNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
@@ -108,6 +108,9 @@ const DropdownSubitemSchema = _utilsValidation.Joi.object({
|
|
|
108
108
|
}, {
|
|
109
109
|
is: itemWithType('doc'),
|
|
110
110
|
then: DocItemSchema
|
|
111
|
+
}, {
|
|
112
|
+
is: itemWithType('docSidebar'),
|
|
113
|
+
then: DocSidebarItemSchema
|
|
111
114
|
}, {
|
|
112
115
|
is: itemWithType(undefined),
|
|
113
116
|
then: DefaultNavbarItemSchema
|
|
@@ -208,8 +211,8 @@ const FooterLinkItemSchema = _utilsValidation.Joi.object({
|
|
|
208
211
|
href: _utilsValidation.URISchema,
|
|
209
212
|
html: _utilsValidation.Joi.string(),
|
|
210
213
|
label: _utilsValidation.Joi.string()
|
|
211
|
-
}).xor('to', 'href', 'html').with('to', 'label').with('href', 'label').nand('html', 'label') // We allow any unknown attributes on the links
|
|
212
|
-
//
|
|
214
|
+
}).xor('to', 'href', 'html').with('to', 'label').with('href', 'label').nand('html', 'label') // We allow any unknown attributes on the links (users may need additional
|
|
215
|
+
// attributes like target, aria-role, data-customAttribute...)
|
|
213
216
|
.unknown();
|
|
214
217
|
|
|
215
218
|
const CustomCssSchema = _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array().items(_utilsValidation.Joi.string().required()), _utilsValidation.Joi.string().required()).optional();
|
|
@@ -10,8 +10,7 @@ import {useThemeConfig, useAnnouncementBar} from '@docusaurus/theme-common';
|
|
|
10
10
|
import {translate} from '@docusaurus/Translate';
|
|
11
11
|
import IconClose from '@theme/IconClose';
|
|
12
12
|
import styles from './styles.module.css';
|
|
13
|
-
|
|
14
|
-
function AnnouncementBar() {
|
|
13
|
+
export default function AnnouncementBar() {
|
|
15
14
|
const {isActive, close} = useAnnouncementBar();
|
|
16
15
|
const {announcementBar} = useThemeConfig();
|
|
17
16
|
|
|
@@ -52,5 +51,3 @@ function AnnouncementBar() {
|
|
|
52
51
|
</div>
|
|
53
52
|
);
|
|
54
53
|
}
|
|
55
|
-
|
|
56
|
-
export default AnnouncementBar;
|
|
@@ -17,7 +17,9 @@ const threshold = 300; // Not all have support for smooth scrolling (particularl
|
|
|
17
17
|
// TODO proper detection is currently unreliable!
|
|
18
18
|
// see https://github.com/wessberg/scroll-behavior-polyfill/issues/16
|
|
19
19
|
|
|
20
|
-
const SupportsNativeSmoothScrolling = false; // const SupportsNativeSmoothScrolling =
|
|
20
|
+
const SupportsNativeSmoothScrolling = false; // const SupportsNativeSmoothScrolling =
|
|
21
|
+
// ExecutionEnvironment.canUseDOM &&
|
|
22
|
+
// 'scrollBehavior' in document.documentElement.style;
|
|
21
23
|
|
|
22
24
|
function smoothScrollTopNative() {
|
|
23
25
|
window.scrollTo({
|
|
@@ -41,8 +43,8 @@ function smoothScrollTopPolyfill() {
|
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
45
|
|
|
44
|
-
rafRecursion(); // Break the recursion
|
|
45
|
-
//
|
|
46
|
+
rafRecursion(); // Break the recursion. Prevents the user from "fighting" against that
|
|
47
|
+
// recursion producing a weird UX
|
|
46
48
|
|
|
47
49
|
return () => raf && cancelAnimationFrame(raf);
|
|
48
50
|
}
|
|
@@ -62,7 +64,7 @@ function useSmoothScrollToTop() {
|
|
|
62
64
|
};
|
|
63
65
|
}
|
|
64
66
|
|
|
65
|
-
function BackToTopButton() {
|
|
67
|
+
export default function BackToTopButton() {
|
|
66
68
|
const [show, setShow] = useState(false);
|
|
67
69
|
const isFocusedAnchor = useRef(false);
|
|
68
70
|
const {smoothScrollTop, cancelScrollToTop} = useSmoothScrollToTop();
|
|
@@ -127,5 +129,3 @@ function BackToTopButton() {
|
|
|
127
129
|
/>
|
|
128
130
|
);
|
|
129
131
|
}
|
|
130
|
-
|
|
131
|
-
export default BackToTopButton;
|
|
@@ -13,12 +13,13 @@
|
|
|
13
13
|
background-color: var(--ifm-color-emphasis-200);
|
|
14
14
|
width: 3rem;
|
|
15
15
|
height: 3rem;
|
|
16
|
-
z-index: var(--ifm-z-index-fixed);
|
|
16
|
+
z-index: calc(var(--ifm-z-index-fixed) - 1);
|
|
17
17
|
box-shadow: var(--ifm-global-shadow-lw);
|
|
18
18
|
transition: all var(--ifm-transition-fast)
|
|
19
19
|
var(--ifm-transition-timing-default);
|
|
20
20
|
opacity: 0;
|
|
21
21
|
transform: scale(0);
|
|
22
|
+
visibility: hidden;
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
.backToTopButton::after {
|
|
@@ -39,4 +40,5 @@
|
|
|
39
40
|
.backToTopButtonShow {
|
|
40
41
|
opacity: 1;
|
|
41
42
|
transform: scale(1);
|
|
43
|
+
visibility: visible;
|
|
42
44
|
}
|
|
@@ -8,8 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Layout from '@theme/Layout';
|
|
10
10
|
import BlogSidebar from '@theme/BlogSidebar';
|
|
11
|
-
|
|
12
|
-
function BlogLayout(props) {
|
|
11
|
+
export default function BlogLayout(props) {
|
|
13
12
|
const {sidebar, toc, children, ...layoutProps} = props;
|
|
14
13
|
const hasSidebar = sidebar && sidebar.items.length > 0;
|
|
15
14
|
return (
|
|
@@ -36,5 +35,3 @@ function BlogLayout(props) {
|
|
|
36
35
|
</Layout>
|
|
37
36
|
);
|
|
38
37
|
}
|
|
39
|
-
|
|
40
|
-
export default BlogLayout;
|
|
@@ -10,8 +10,7 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
10
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
11
11
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
12
12
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
13
|
-
|
|
14
|
-
function BlogListPage(props) {
|
|
13
|
+
export default function BlogListPage(props) {
|
|
15
14
|
const {metadata, items, sidebar} = props;
|
|
16
15
|
const {
|
|
17
16
|
siteConfig: {title: siteTitle},
|
|
@@ -44,5 +43,3 @@ function BlogListPage(props) {
|
|
|
44
43
|
</BlogLayout>
|
|
45
44
|
);
|
|
46
45
|
}
|
|
47
|
-
|
|
48
|
-
export default BlogListPage;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
9
9
|
import PaginatorNavLink from '@theme/PaginatorNavLink';
|
|
10
|
-
|
|
11
|
-
function BlogListPaginator(props) {
|
|
10
|
+
export default function BlogListPaginator(props) {
|
|
12
11
|
const {metadata} = props;
|
|
13
12
|
const {previousPage, nextPage} = metadata;
|
|
14
13
|
return (
|
|
@@ -50,5 +49,3 @@ function BlogListPaginator(props) {
|
|
|
50
49
|
</nav>
|
|
51
50
|
);
|
|
52
51
|
}
|
|
53
|
-
|
|
54
|
-
export default BlogListPaginator;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Link from '@docusaurus/Link';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
|
-
|
|
11
|
-
function BlogPostAuthor({author}) {
|
|
10
|
+
export default function BlogPostAuthor({author}) {
|
|
12
11
|
const {name, title, url, imageURL} = author;
|
|
13
12
|
return (
|
|
14
13
|
<div className="avatar margin-bottom--sm">
|
|
@@ -18,29 +17,24 @@ function BlogPostAuthor({author}) {
|
|
|
18
17
|
</Link>
|
|
19
18
|
)}
|
|
20
19
|
|
|
21
|
-
{
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
<span itemProp="name">{name}</span>
|
|
32
|
-
</Link>
|
|
33
|
-
</div>
|
|
34
|
-
{title && (
|
|
35
|
-
<small className="avatar__subtitle" itemProp="description">
|
|
36
|
-
{title}
|
|
37
|
-
</small>
|
|
38
|
-
)}
|
|
20
|
+
{name && (
|
|
21
|
+
<div
|
|
22
|
+
className="avatar__intro"
|
|
23
|
+
itemProp="author"
|
|
24
|
+
itemScope
|
|
25
|
+
itemType="https://schema.org/Person">
|
|
26
|
+
<div className="avatar__name">
|
|
27
|
+
<Link href={url} itemProp="url">
|
|
28
|
+
<span itemProp="name">{name}</span>
|
|
29
|
+
</Link>
|
|
39
30
|
</div>
|
|
40
|
-
|
|
41
|
-
|
|
31
|
+
{title && (
|
|
32
|
+
<small className="avatar__subtitle" itemProp="description">
|
|
33
|
+
{title}
|
|
34
|
+
</small>
|
|
35
|
+
)}
|
|
36
|
+
</div>
|
|
37
|
+
)}
|
|
42
38
|
</div>
|
|
43
39
|
);
|
|
44
40
|
}
|
|
45
|
-
|
|
46
|
-
export default BlogPostAuthor;
|
|
@@ -39,7 +39,7 @@ function useReadingTimePlural() {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
|
|
42
|
-
function BlogPostItem(props) {
|
|
42
|
+
export default function BlogPostItem(props) {
|
|
43
43
|
const readingTimePlural = useReadingTimePlural();
|
|
44
44
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
45
45
|
const {
|
|
@@ -138,7 +138,17 @@ function BlogPostItem(props) {
|
|
|
138
138
|
})}>
|
|
139
139
|
<Link
|
|
140
140
|
to={metadata.permalink}
|
|
141
|
-
aria-label={
|
|
141
|
+
aria-label={translate(
|
|
142
|
+
{
|
|
143
|
+
message: 'Read more about {title}',
|
|
144
|
+
id: 'theme.blog.post.readMoreLabel',
|
|
145
|
+
description:
|
|
146
|
+
'The ARIA label for the link to full blog posts from excerpts',
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
title,
|
|
150
|
+
},
|
|
151
|
+
)}>
|
|
142
152
|
<b>
|
|
143
153
|
<Translate
|
|
144
154
|
id="theme.blog.post.readMore"
|
|
@@ -154,5 +164,3 @@ function BlogPostItem(props) {
|
|
|
154
164
|
</article>
|
|
155
165
|
);
|
|
156
166
|
}
|
|
157
|
-
|
|
158
|
-
export default BlogPostItem;
|
|
@@ -11,8 +11,7 @@ import BlogPostItem from '@theme/BlogPostItem';
|
|
|
11
11
|
import BlogPostPaginator from '@theme/BlogPostPaginator';
|
|
12
12
|
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
13
13
|
import TOC from '@theme/TOC';
|
|
14
|
-
|
|
15
|
-
function BlogPostPage(props) {
|
|
14
|
+
export default function BlogPostPage(props) {
|
|
16
15
|
const {content: BlogPostContents, sidebar} = props;
|
|
17
16
|
const {assets, metadata} = BlogPostContents;
|
|
18
17
|
const {
|
|
@@ -48,8 +47,9 @@ function BlogPostPage(props) {
|
|
|
48
47
|
/>
|
|
49
48
|
) : undefined
|
|
50
49
|
}>
|
|
51
|
-
<Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
52
|
-
// otherwise
|
|
50
|
+
<Seo // TODO refactor needed: it's a bit annoying but Seo MUST be inside
|
|
51
|
+
// BlogLayout, otherwise default image (set by BlogLayout) would shadow
|
|
52
|
+
// the custom blog post image
|
|
53
53
|
title={title}
|
|
54
54
|
description={description}
|
|
55
55
|
keywords={keywords}
|
|
@@ -89,5 +89,3 @@ function BlogPostPage(props) {
|
|
|
89
89
|
</BlogLayout>
|
|
90
90
|
);
|
|
91
91
|
}
|
|
92
|
-
|
|
93
|
-
export default BlogPostPage;
|
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
9
9
|
import PaginatorNavLink from '@theme/PaginatorNavLink';
|
|
10
|
-
|
|
11
|
-
function BlogPostPaginator(props) {
|
|
10
|
+
export default function BlogPostPaginator(props) {
|
|
12
11
|
const {nextItem, prevItem} = props;
|
|
13
12
|
return (
|
|
14
13
|
<nav
|
|
@@ -49,5 +48,3 @@ function BlogPostPaginator(props) {
|
|
|
49
48
|
</nav>
|
|
50
49
|
);
|
|
51
50
|
}
|
|
52
|
-
|
|
53
|
-
export default BlogPostPaginator;
|
|
@@ -11,8 +11,7 @@ import {
|
|
|
11
11
|
ThemeClassNames,
|
|
12
12
|
translateTagsPageTitle,
|
|
13
13
|
} from '@docusaurus/theme-common';
|
|
14
|
-
|
|
15
|
-
function BlogTagsListPage(props) {
|
|
14
|
+
export default function BlogTagsListPage(props) {
|
|
16
15
|
const {tags, sidebar} = props;
|
|
17
16
|
const title = translateTagsPageTitle();
|
|
18
17
|
return (
|
|
@@ -30,5 +29,3 @@ function BlogTagsListPage(props) {
|
|
|
30
29
|
</BlogLayout>
|
|
31
30
|
);
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
export default BlogTagsListPage;
|
|
@@ -9,7 +9,8 @@ import Link from '@docusaurus/Link';
|
|
|
9
9
|
import BlogLayout from '@theme/BlogLayout';
|
|
10
10
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
11
11
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
12
|
-
import {ThemeClassNames, usePluralForm} from '@docusaurus/theme-common';
|
|
12
|
+
import {ThemeClassNames, usePluralForm} from '@docusaurus/theme-common';
|
|
13
|
+
import BlogListPaginator from '@theme/BlogListPaginator'; // Very simple pluralization: probably good enough for now
|
|
13
14
|
|
|
14
15
|
function useBlogPostsPlural() {
|
|
15
16
|
const {selectMessage} = usePluralForm();
|
|
@@ -31,7 +32,7 @@ function useBlogPostsPlural() {
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
export default function BlogTagsPostsPage(props) {
|
|
34
|
-
const {metadata, items, sidebar} = props;
|
|
35
|
+
const {metadata, items, sidebar, listMetadata} = props;
|
|
35
36
|
const {allTagsPath, name: tagName, count} = metadata;
|
|
36
37
|
const blogPostsPlural = useBlogPostsPlural();
|
|
37
38
|
const title = translate(
|
|
@@ -77,6 +78,7 @@ export default function BlogTagsPostsPage(props) {
|
|
|
77
78
|
<BlogPostContent />
|
|
78
79
|
</BlogPostItem>
|
|
79
80
|
))}
|
|
81
|
+
<BlogListPaginator metadata={listMetadata} />
|
|
80
82
|
</BlogLayout>
|
|
81
83
|
);
|
|
82
84
|
}
|
|
@@ -43,7 +43,8 @@ export default function CodeBlock({
|
|
|
43
43
|
|
|
44
44
|
const codeBlockTitle = parseCodeBlockTitle(metastring) || title;
|
|
45
45
|
const prismTheme = usePrismTheme(); // <pre> tags in markdown map to CodeBlocks and they may contain JSX children.
|
|
46
|
-
// When the children is not a simple string, we just return a styled block
|
|
46
|
+
// When the children is not a simple string, we just return a styled block
|
|
47
|
+
// without actually highlighting.
|
|
47
48
|
|
|
48
49
|
if (React.Children.toArray(children).some((el) => isValidElement(el))) {
|
|
49
50
|
return (
|
|
@@ -7,7 +7,8 @@
|
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import {Details as DetailsGeneric} from '@docusaurus/theme-common';
|
|
10
|
-
import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing
|
|
10
|
+
import styles from './styles.module.css'; // Should we have a custom details/summary comp in Infima instead of reusing
|
|
11
|
+
// alert classes?
|
|
11
12
|
|
|
12
13
|
const InfimaClasses = 'alert alert--info';
|
|
13
14
|
export default function Details({...props}) {
|
|
@@ -0,0 +1,76 @@
|
|
|
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 {
|
|
9
|
+
ThemeClassNames,
|
|
10
|
+
useSidebarBreadcrumbs,
|
|
11
|
+
useHomePageRoute,
|
|
12
|
+
} from '@docusaurus/theme-common';
|
|
13
|
+
import styles from './styles.module.css';
|
|
14
|
+
import clsx from 'clsx';
|
|
15
|
+
import Link from '@docusaurus/Link';
|
|
16
|
+
import useBaseUrl from '@docusaurus/useBaseUrl'; // TODO move to design system folder
|
|
17
|
+
|
|
18
|
+
function BreadcrumbsItemLink({children, href}) {
|
|
19
|
+
const className = clsx('breadcrumbs__link', styles.breadcrumbsItemLink);
|
|
20
|
+
return href ? (
|
|
21
|
+
<Link className={className} href={href}>
|
|
22
|
+
{children}
|
|
23
|
+
</Link>
|
|
24
|
+
) : (
|
|
25
|
+
<span className={className}>{children}</span>
|
|
26
|
+
);
|
|
27
|
+
} // TODO move to design system folder
|
|
28
|
+
|
|
29
|
+
function BreadcrumbsItem({children, active}) {
|
|
30
|
+
return (
|
|
31
|
+
<li
|
|
32
|
+
className={clsx('breadcrumbs__item', {
|
|
33
|
+
'breadcrumbs__item--active': active,
|
|
34
|
+
})}>
|
|
35
|
+
{children}
|
|
36
|
+
</li>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function HomeBreadcrumbItem() {
|
|
41
|
+
const homeHref = useBaseUrl('/');
|
|
42
|
+
return (
|
|
43
|
+
<BreadcrumbsItem>
|
|
44
|
+
<BreadcrumbsItemLink href={homeHref}>🏠</BreadcrumbsItemLink>
|
|
45
|
+
</BreadcrumbsItem>
|
|
46
|
+
);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export default function DocBreadcrumbs() {
|
|
50
|
+
const breadcrumbs = useSidebarBreadcrumbs();
|
|
51
|
+
const homePageRoute = useHomePageRoute();
|
|
52
|
+
|
|
53
|
+
if (!breadcrumbs) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return (
|
|
58
|
+
<nav
|
|
59
|
+
className={clsx(
|
|
60
|
+
ThemeClassNames.docs.docBreadcrumbs,
|
|
61
|
+
styles.breadcrumbsContainer,
|
|
62
|
+
)}
|
|
63
|
+
aria-label="breadcrumbs">
|
|
64
|
+
<ul className="breadcrumbs">
|
|
65
|
+
{homePageRoute && <HomeBreadcrumbItem />}
|
|
66
|
+
{breadcrumbs.map((item, idx) => (
|
|
67
|
+
<BreadcrumbsItem key={idx} active={idx === breadcrumbs.length - 1}>
|
|
68
|
+
<BreadcrumbsItemLink href={item.href}>
|
|
69
|
+
{item.label}
|
|
70
|
+
</BreadcrumbsItemLink>
|
|
71
|
+
</BreadcrumbsItem>
|
|
72
|
+
))}
|
|
73
|
+
</ul>
|
|
74
|
+
</nav>
|
|
75
|
+
);
|
|
76
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
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
|
+
.breadcrumbsContainer {
|
|
9
|
+
margin-bottom: 0.4rem;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.breadcrumbsItemLink {
|
|
13
|
+
--ifm-breadcrumb-size-multiplier: 0.7 !important;
|
|
14
|
+
margin-bottom: 0.4rem;
|
|
15
|
+
background: var(--ifm-color-gray-100);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
html[data-theme='dark'] .breadcrumbsItemLink {
|
|
19
|
+
background-color: var(--ifm-color-gray-900);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
@media (min-width: 997px) {
|
|
23
|
+
.breadcrumbsItemLink {
|
|
24
|
+
--ifm-breadcrumb-size-multiplier: 0.8;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -10,6 +10,7 @@ import {findFirstCategoryLink, useDocById} from '@docusaurus/theme-common';
|
|
|
10
10
|
import clsx from 'clsx';
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
import isInternalUrl from '@docusaurus/isInternalUrl';
|
|
13
|
+
import {translate} from '@docusaurus/Translate';
|
|
13
14
|
|
|
14
15
|
function CardContainer({href, children}) {
|
|
15
16
|
const className = clsx(
|
|
@@ -48,7 +49,17 @@ function CardCategory({item}) {
|
|
|
48
49
|
href={href}
|
|
49
50
|
icon="🗃️"
|
|
50
51
|
title={item.label}
|
|
51
|
-
description={
|
|
52
|
+
description={translate(
|
|
53
|
+
{
|
|
54
|
+
message: '{count} items',
|
|
55
|
+
id: 'theme.docs.DocCard.categoryDescription',
|
|
56
|
+
description:
|
|
57
|
+
'The default description for a category card in the generated index about how many items this category includes',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
count: item.items.length,
|
|
61
|
+
},
|
|
62
|
+
)}
|
|
52
63
|
/>
|
|
53
64
|
);
|
|
54
65
|
}
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
box-shadow: 0 4px 8px 0 rgb(0 0 0 / 20%);
|
|
25
25
|
}
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
[data-theme='dark'] .cardContainer.cardContainerLink:hover {
|
|
28
28
|
--ifm-card-background-color: #2d2d2d; /* original, non-hovered color is #242526 */
|
|
29
29
|
}
|
|
30
30
|
|
|
@@ -11,6 +11,7 @@ import DocPaginator from '@theme/DocPaginator';
|
|
|
11
11
|
import Seo from '@theme/Seo';
|
|
12
12
|
import DocVersionBanner from '@theme/DocVersionBanner';
|
|
13
13
|
import DocVersionBadge from '@theme/DocVersionBadge';
|
|
14
|
+
import DocBreadcrumbs from '@theme/DocBreadcrumbs';
|
|
14
15
|
import Heading from '@theme/Heading';
|
|
15
16
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
16
17
|
import styles from './styles.module.css';
|
|
@@ -28,6 +29,7 @@ export default function DocCategoryGeneratedIndexPage({
|
|
|
28
29
|
/>
|
|
29
30
|
<div className={styles.generatedIndexPage}>
|
|
30
31
|
<DocVersionBanner />
|
|
32
|
+
<DocBreadcrumbs />
|
|
31
33
|
<DocVersionBadge />
|
|
32
34
|
<header>
|
|
33
35
|
<Heading as="h1" className={styles.title}>
|