@docusaurus/theme-classic 2.0.0-beta.17 → 2.0.0-beta.18
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 +113 -2
- package/lib/index.js +7 -12
- package/lib/theme-classic.d.ts +286 -60
- package/lib/translations.js +12 -2
- package/lib/validateThemeConfig.js +1 -1
- package/lib-next/theme/BackToTopButton/index.js +1 -3
- package/lib-next/theme/BlogArchivePage/index.js +14 -10
- package/lib-next/theme/BlogListPage/index.js +34 -13
- package/lib-next/theme/BlogPostItem/index.js +6 -6
- package/lib-next/theme/BlogPostPage/index.js +56 -45
- package/lib-next/theme/BlogTagsListPage/index.js +16 -12
- package/lib-next/theme/BlogTagsPostsPage/index.js +40 -33
- package/lib-next/theme/CodeBlock/CopyButton/index.js +60 -0
- package/lib-next/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/lib-next/theme/CodeBlock/index.js +4 -36
- package/lib-next/theme/CodeBlock/styles.module.css +2 -22
- package/lib-next/theme/ColorModeToggle/index.js +36 -57
- package/lib-next/theme/ColorModeToggle/styles.module.css +8 -24
- package/lib-next/theme/DocBreadcrumbs/index.js +28 -11
- package/lib-next/theme/DocBreadcrumbs/styles.module.css +2 -17
- package/lib-next/theme/DocCard/index.js +17 -15
- package/lib-next/theme/DocCard/styles.module.css +8 -17
- package/lib-next/theme/DocCardList/index.js +15 -3
- package/lib-next/theme/DocCategoryGeneratedIndexPage/index.js +27 -6
- package/lib-next/theme/DocItem/index.js +84 -66
- package/lib-next/theme/DocPage/index.js +88 -89
- package/lib-next/theme/DocPage/styles.module.css +0 -4
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/index.js +46 -0
- package/lib-next/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/lib-next/theme/DocSidebar/Desktop/index.js +34 -0
- package/lib-next/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/lib-next/theme/DocSidebar/Mobile/index.js +49 -0
- package/lib-next/theme/DocSidebar/index.js +6 -113
- package/lib-next/theme/DocSidebarItem/index.js +14 -13
- package/lib-next/theme/DocSidebarItem/styles.module.css +4 -0
- package/lib-next/theme/DocTagDocListPage/index.js +38 -31
- package/lib-next/theme/DocTagsListPage/index.js +21 -16
- package/lib-next/theme/Footer/Copyright/index.js +18 -0
- package/lib-next/theme/Footer/Layout/index.js +26 -0
- package/lib-next/theme/Footer/LinkItem/index.js +33 -0
- package/lib-next/theme/Footer/Links/MultiColumn/index.js +47 -0
- package/lib-next/theme/Footer/Links/Simple/index.js +41 -0
- package/lib-next/theme/Footer/Links/index.js +17 -0
- package/lib-next/theme/Footer/Logo/index.js +38 -0
- package/lib-next/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/lib-next/theme/Footer/index.js +11 -163
- package/lib-next/theme/Heading/index.js +6 -4
- package/lib-next/theme/IconExternalLink/styles.module.css +0 -2
- package/lib-next/theme/Layout/index.js +15 -10
- package/lib-next/theme/LayoutProviders/index.js +5 -4
- package/lib-next/theme/MDXComponents/A.js +11 -0
- package/lib-next/theme/MDXComponents/Code.js +28 -0
- package/lib-next/theme/MDXComponents/Details.js +20 -0
- package/lib-next/theme/MDXComponents/Head.js +26 -0
- package/lib-next/theme/MDXComponents/Heading.js +11 -0
- package/lib-next/theme/MDXComponents/Img.js +24 -0
- package/lib-next/theme/MDXComponents/Img.module.css +10 -0
- package/lib-next/theme/MDXComponents/Pre.js +18 -0
- package/lib-next/theme/MDXComponents/Ul.js +23 -0
- package/{src/theme/MDXComponents/styles.css → lib-next/theme/MDXComponents/Ul.module.css} +1 -5
- package/lib-next/theme/MDXComponents/index.js +22 -71
- package/lib-next/theme/MDXContent/index.js +12 -0
- package/lib-next/theme/MDXPage/index.js +33 -28
- package/lib-next/theme/Navbar/ColorModeToggle/index.js +25 -0
- package/lib-next/theme/Navbar/Content/index.js +70 -0
- package/lib-next/theme/Navbar/Content/styles.module.css +15 -0
- package/lib-next/theme/Navbar/Layout/index.js +54 -0
- package/{src/theme/Navbar → lib-next/theme/Navbar/Layout}/styles.module.css +0 -13
- package/lib-next/theme/Navbar/Logo/index.js +17 -0
- package/lib-next/theme/Navbar/MobileSidebar/Header/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/Layout/index.js +28 -0
- package/lib-next/theme/Navbar/MobileSidebar/PrimaryMenu/index.js +33 -0
- package/lib-next/theme/Navbar/MobileSidebar/SecondaryMenu/index.js +36 -0
- package/lib-next/theme/Navbar/MobileSidebar/Toggle/index.js +23 -0
- package/lib-next/theme/Navbar/MobileSidebar/index.js +31 -0
- package/lib-next/theme/Navbar/index.js +6 -271
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +2 -6
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +10 -2
- package/lib-next/theme/NavbarItem/NavbarNavLink.js +8 -12
- package/lib-next/theme/NotFound.js +38 -33
- package/lib-next/theme/{LayoutHead → SiteMetadata}/index.js +11 -26
- package/lib-next/theme/TOCCollapsible/index.js +1 -3
- package/lib-next/theme/Tabs/__tests__/index.test.js +5 -5
- package/lib-next/theme/Tabs/index.js +2 -2
- package/lib-next/theme/Tag/index.js +4 -4
- package/lib-next/theme/ThemedImage/index.js +3 -3
- package/package.json +17 -17
- package/src/getSwizzleConfig.ts +122 -1
- package/src/index.ts +10 -12
- package/src/theme/BackToTopButton/index.tsx +1 -3
- package/src/theme/BlogArchivePage/index.tsx +18 -17
- package/src/theme/BlogLayout/index.tsx +1 -1
- package/src/theme/BlogListPage/index.tsx +32 -13
- package/src/theme/BlogPostItem/index.tsx +6 -6
- package/src/theme/BlogPostPage/index.tsx +55 -48
- package/src/theme/BlogTagsListPage/index.tsx +16 -12
- package/src/theme/BlogTagsPostsPage/index.tsx +39 -32
- package/src/theme/CodeBlock/CopyButton/index.tsx +66 -0
- package/src/theme/CodeBlock/CopyButton/styles.module.css +66 -0
- package/src/theme/CodeBlock/index.tsx +6 -38
- package/src/theme/CodeBlock/styles.module.css +2 -22
- package/src/theme/ColorModeToggle/index.tsx +36 -61
- package/src/theme/ColorModeToggle/styles.module.css +8 -24
- package/src/theme/DocBreadcrumbs/index.tsx +29 -10
- package/src/theme/DocBreadcrumbs/styles.module.css +2 -17
- package/src/theme/DocCard/index.tsx +24 -17
- package/src/theme/DocCard/styles.module.css +8 -17
- package/src/theme/DocCardList/index.tsx +14 -3
- package/src/theme/DocCategoryGeneratedIndexPage/index.tsx +31 -4
- package/src/theme/DocItem/index.tsx +71 -55
- package/src/theme/DocPage/index.tsx +89 -90
- package/src/theme/DocPage/styles.module.css +0 -4
- package/src/theme/DocSidebar/Desktop/CollapseButton/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/CollapseButton/styles.module.css +44 -0
- package/src/theme/DocSidebar/Desktop/Content/index.tsx +55 -0
- package/src/theme/DocSidebar/Desktop/Content/styles.module.css +17 -0
- package/src/theme/DocSidebar/Desktop/index.tsx +38 -0
- package/src/theme/DocSidebar/Desktop/styles.module.css +50 -0
- package/src/theme/DocSidebar/Mobile/index.tsx +54 -0
- package/src/theme/DocSidebar/index.tsx +6 -121
- package/src/theme/DocSidebarItem/index.tsx +15 -16
- package/src/theme/DocSidebarItem/styles.module.css +4 -0
- package/src/theme/DocTagDocListPage/index.tsx +38 -30
- package/src/theme/DocTagsListPage/index.tsx +21 -16
- package/src/theme/DocVersionBanner/index.tsx +3 -4
- package/src/theme/Footer/Copyright/index.tsx +20 -0
- package/src/theme/Footer/Layout/index.tsx +34 -0
- package/src/theme/Footer/LinkItem/index.tsx +36 -0
- package/src/theme/Footer/Links/MultiColumn/index.tsx +51 -0
- package/src/theme/Footer/Links/Simple/index.tsx +42 -0
- package/src/theme/Footer/Links/index.tsx +21 -0
- package/src/theme/Footer/Logo/index.tsx +41 -0
- package/src/theme/Footer/{styles.module.css → Logo/styles.module.css} +0 -0
- package/src/theme/Footer/index.tsx +12 -186
- package/src/theme/Heading/index.tsx +6 -4
- package/src/theme/IconExternalLink/styles.module.css +0 -2
- package/src/theme/Layout/index.tsx +15 -10
- package/src/theme/LayoutProviders/index.tsx +5 -4
- package/src/theme/MDXComponents/A.tsx +14 -0
- package/src/theme/MDXComponents/Code.tsx +37 -0
- package/src/theme/MDXComponents/Details.tsx +26 -0
- package/src/theme/MDXComponents/Head.tsx +29 -0
- package/src/theme/MDXComponents/Heading.tsx +14 -0
- package/src/theme/MDXComponents/Img.module.css +10 -0
- package/src/theme/MDXComponents/Img.tsx +26 -0
- package/src/theme/MDXComponents/Pre.tsx +22 -0
- package/{lib-next/theme/MDXComponents/styles.css → src/theme/MDXComponents/Ul.module.css} +1 -5
- package/src/theme/MDXComponents/Ul.tsx +28 -0
- package/src/theme/MDXComponents/index.tsx +23 -80
- package/src/theme/MDXContent/index.tsx +15 -0
- package/src/theme/MDXPage/index.tsx +33 -28
- package/src/theme/Navbar/ColorModeToggle/index.tsx +30 -0
- package/src/theme/Navbar/Content/index.tsx +81 -0
- package/src/theme/Navbar/Content/styles.module.css +15 -0
- package/src/theme/Navbar/Layout/index.tsx +57 -0
- package/{lib-next/theme/Navbar → src/theme/Navbar/Layout}/styles.module.css +0 -13
- package/src/theme/Navbar/Logo/index.tsx +19 -0
- package/src/theme/Navbar/MobileSidebar/Header/index.tsx +34 -0
- package/src/theme/Navbar/MobileSidebar/Layout/index.tsx +31 -0
- package/src/theme/Navbar/MobileSidebar/PrimaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/SecondaryMenu/index.tsx +38 -0
- package/src/theme/Navbar/MobileSidebar/Toggle/index.tsx +25 -0
- package/src/theme/Navbar/MobileSidebar/index.tsx +33 -0
- package/src/theme/Navbar/index.tsx +6 -286
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +2 -2
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +11 -2
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +1 -1
- package/src/theme/NavbarItem/NavbarNavLink.tsx +3 -7
- package/src/theme/NavbarItem/index.tsx +3 -4
- package/src/theme/NotFound.tsx +38 -33
- package/src/theme/{LayoutHead → SiteMetadata}/index.tsx +11 -25
- package/src/theme/TOCCollapsible/index.tsx +1 -3
- package/src/theme/Tabs/index.tsx +5 -6
- package/src/theme/Tag/index.tsx +4 -4
- package/src/theme/ThemedImage/index.tsx +4 -3
- package/src/theme-classic.d.ts +286 -60
- package/src/translations.ts +12 -6
- package/src/validateThemeConfig.ts +6 -6
- package/lib-next/theme/DocSidebar/styles.module.css +0 -107
- package/lib-next/theme/Seo/index.js +0 -40
- package/src/theme/DocSidebar/styles.module.css +0 -107
- package/src/theme/Seo/index.tsx +0 -49
|
@@ -9,15 +9,15 @@ import Head from '@docusaurus/Head';
|
|
|
9
9
|
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
|
|
10
10
|
import useBaseUrl from '@docusaurus/useBaseUrl';
|
|
11
11
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
12
|
-
import Seo from '@theme/Seo';
|
|
13
12
|
import {
|
|
13
|
+
PageMetadata,
|
|
14
14
|
DEFAULT_SEARCH_TAG,
|
|
15
|
-
useTitleFormatter,
|
|
16
15
|
useAlternatePageUtils,
|
|
17
16
|
useThemeConfig,
|
|
18
17
|
keyboardFocusedClassName,
|
|
19
18
|
} from '@docusaurus/theme-common';
|
|
20
|
-
import {useLocation} from '@docusaurus/router'; //
|
|
19
|
+
import {useLocation} from '@docusaurus/router'; // TODO move to SiteMetadataDefaults or theme-common ?
|
|
20
|
+
// Useful for i18n/SEO
|
|
21
21
|
// See https://developers.google.com/search/docs/advanced/crawling/localized-versions
|
|
22
22
|
// See https://github.com/facebook/docusaurus/issues/3317
|
|
23
23
|
|
|
@@ -59,7 +59,7 @@ function useDefaultCanonicalUrl() {
|
|
|
59
59
|
} = useDocusaurusContext();
|
|
60
60
|
const {pathname} = useLocation();
|
|
61
61
|
return siteUrl + useBaseUrl(pathname);
|
|
62
|
-
}
|
|
62
|
+
} // TODO move to SiteMetadataDefaults or theme-common ?
|
|
63
63
|
|
|
64
64
|
function CanonicalUrlHeaders({permalink}) {
|
|
65
65
|
const {
|
|
@@ -77,44 +77,29 @@ function CanonicalUrlHeaders({permalink}) {
|
|
|
77
77
|
);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
export default function
|
|
80
|
+
export default function SiteMetadata() {
|
|
81
81
|
const {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
i18n: {currentLocale},
|
|
83
|
+
} = useDocusaurusContext(); // TODO maybe move these 2 themeConfig to siteConfig?
|
|
84
|
+
// These seems useful for other themes as well
|
|
85
|
+
|
|
85
86
|
const {metadata, image: defaultImage} = useThemeConfig();
|
|
86
|
-
const {title, description, image, keywords, searchMetadata} = props;
|
|
87
|
-
const faviconUrl = useBaseUrl(favicon);
|
|
88
|
-
const pageTitle = useTitleFormatter(title);
|
|
89
|
-
const {htmlLang, direction: htmlDir} = localeConfigs[currentLocale];
|
|
90
87
|
return (
|
|
91
88
|
<>
|
|
92
89
|
<Head>
|
|
93
|
-
<html lang={htmlLang} dir={htmlDir} />
|
|
94
|
-
{favicon && <link rel="icon" href={faviconUrl} />}
|
|
95
|
-
<title>{pageTitle}</title>
|
|
96
|
-
<meta property="og:title" content={pageTitle} />
|
|
97
90
|
<meta name="twitter:card" content="summary_large_image" />
|
|
98
91
|
{/* The keyboard focus class name need to be applied when SSR so links
|
|
99
92
|
are outlined when JS is disabled */}
|
|
100
93
|
<body className={keyboardFocusedClassName} />
|
|
101
94
|
</Head>
|
|
102
95
|
|
|
103
|
-
{
|
|
104
|
-
{defaultImage && <Seo image={defaultImage} />}
|
|
105
|
-
{image && <Seo image={image} />}
|
|
106
|
-
|
|
107
|
-
<Seo description={description} keywords={keywords} />
|
|
96
|
+
{defaultImage && <PageMetadata image={defaultImage} />}
|
|
108
97
|
|
|
109
98
|
<CanonicalUrlHeaders />
|
|
110
99
|
|
|
111
100
|
<AlternateLangHeaders />
|
|
112
101
|
|
|
113
|
-
<SearchMetadata
|
|
114
|
-
tag={DEFAULT_SEARCH_TAG}
|
|
115
|
-
locale={currentLocale}
|
|
116
|
-
{...searchMetadata}
|
|
117
|
-
/>
|
|
102
|
+
<SearchMetadata tag={DEFAULT_SEARCH_TAG} locale={currentLocale} />
|
|
118
103
|
|
|
119
104
|
<Head // it's important to have an additional <Head> element here,
|
|
120
105
|
// as it allows react-helmet to override values set in previous <Head>
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
ScrollControllerProvider,
|
|
14
14
|
} from '@docusaurus/theme-common';
|
|
15
15
|
describe('Tabs', () => {
|
|
16
|
-
|
|
16
|
+
it('rejects bad Tabs child', () => {
|
|
17
17
|
expect(() => {
|
|
18
18
|
renderer.create(
|
|
19
19
|
<Tabs>
|
|
@@ -25,7 +25,7 @@ describe('Tabs', () => {
|
|
|
25
25
|
`"Docusaurus error: Bad <Tabs> child <div>: all children of the <Tabs> component should be <TabItem>, and every <TabItem> should have a unique \\"value\\" prop."`,
|
|
26
26
|
);
|
|
27
27
|
});
|
|
28
|
-
|
|
28
|
+
it('rejects bad Tabs defaultValue', () => {
|
|
29
29
|
expect(() => {
|
|
30
30
|
renderer.create(
|
|
31
31
|
<Tabs defaultValue="bad">
|
|
@@ -37,7 +37,7 @@ describe('Tabs', () => {
|
|
|
37
37
|
`"Docusaurus error: The <Tabs> has a defaultValue \\"bad\\" but none of its children has the corresponding value. Available values are: v1, v2. If you intend to show no default tab, use defaultValue={null} instead."`,
|
|
38
38
|
);
|
|
39
39
|
});
|
|
40
|
-
|
|
40
|
+
it('rejects duplicate values', () => {
|
|
41
41
|
expect(() => {
|
|
42
42
|
renderer.create(
|
|
43
43
|
<Tabs>
|
|
@@ -53,7 +53,7 @@ describe('Tabs', () => {
|
|
|
53
53
|
`"Docusaurus error: Duplicate values \\"v1, v2\\" found in <Tabs>. Every value needs to be unique."`,
|
|
54
54
|
);
|
|
55
55
|
});
|
|
56
|
-
|
|
56
|
+
it('accepts valid Tabs config', () => {
|
|
57
57
|
expect(() => {
|
|
58
58
|
renderer.create(
|
|
59
59
|
<ScrollControllerProvider>
|
|
@@ -120,7 +120,7 @@ describe('Tabs', () => {
|
|
|
120
120
|
}).not.toThrow(); // TODO Better Jest infrastructure to mock the Layout
|
|
121
121
|
}); // https://github.com/facebook/docusaurus/issues/5729
|
|
122
122
|
|
|
123
|
-
|
|
123
|
+
it('accepts dynamic Tabs with number values', () => {
|
|
124
124
|
expect(() => {
|
|
125
125
|
const tabs = ['Apple', 'Banana', 'Carrot'];
|
|
126
126
|
renderer.create(
|
|
@@ -4,7 +4,7 @@
|
|
|
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 React, {useState, cloneElement,
|
|
7
|
+
import React, {useState, cloneElement, isValidElement} from 'react';
|
|
8
8
|
import useIsBrowser from '@docusaurus/useIsBrowser';
|
|
9
9
|
import {
|
|
10
10
|
useScrollPositionBlocker,
|
|
@@ -28,7 +28,7 @@ function TabsComponent(props) {
|
|
|
28
28
|
groupId,
|
|
29
29
|
className,
|
|
30
30
|
} = props;
|
|
31
|
-
const children = Children.map(props.children, (child) => {
|
|
31
|
+
const children = React.Children.map(props.children, (child) => {
|
|
32
32
|
if (isValidElement(child) && isTabItem(child)) {
|
|
33
33
|
return child;
|
|
34
34
|
} // child.type.name will give non-sensical values in prod because of
|
|
@@ -13,10 +13,10 @@ export default function Tag(props) {
|
|
|
13
13
|
return (
|
|
14
14
|
<Link
|
|
15
15
|
href={permalink}
|
|
16
|
-
className={clsx(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
className={clsx(
|
|
17
|
+
styles.tag,
|
|
18
|
+
count ? styles.tagWithCount : styles.tagRegular,
|
|
19
|
+
)}>
|
|
20
20
|
{name}
|
|
21
21
|
{count && <span>{count}</span>}
|
|
22
22
|
</Link>
|
|
@@ -11,9 +11,9 @@ import {useColorMode} from '@docusaurus/theme-common';
|
|
|
11
11
|
import styles from './styles.module.css';
|
|
12
12
|
export default function ThemedImage(props) {
|
|
13
13
|
const isBrowser = useIsBrowser();
|
|
14
|
-
const {
|
|
15
|
-
const {sources, className, alt
|
|
16
|
-
const clientThemes =
|
|
14
|
+
const {colorMode} = useColorMode();
|
|
15
|
+
const {sources, className, alt, ...propsRest} = props;
|
|
16
|
+
const clientThemes = colorMode === 'dark' ? ['dark'] : ['light'];
|
|
17
17
|
const renderedSourceNames = isBrowser
|
|
18
18
|
? clientThemes // We need to render both images on the server to avoid flash
|
|
19
19
|
: // See https://github.com/facebook/docusaurus/pull/3730
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.18",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -21,29 +21,29 @@
|
|
|
21
21
|
"format:lib-next": "prettier --config ../../.prettierrc --write \"lib-next/**/*.{js,ts,jsx,tsc}\""
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@docusaurus/core": "2.0.0-beta.
|
|
25
|
-
"@docusaurus/plugin-content-blog": "2.0.0-beta.
|
|
26
|
-
"@docusaurus/plugin-content-docs": "2.0.0-beta.
|
|
27
|
-
"@docusaurus/plugin-content-pages": "2.0.0-beta.
|
|
28
|
-
"@docusaurus/theme-common": "2.0.0-beta.
|
|
29
|
-
"@docusaurus/theme-translations": "2.0.0-beta.
|
|
30
|
-
"@docusaurus/utils": "2.0.0-beta.
|
|
31
|
-
"@docusaurus/utils-common": "2.0.0-beta.
|
|
32
|
-
"@docusaurus/utils-validation": "2.0.0-beta.
|
|
24
|
+
"@docusaurus/core": "2.0.0-beta.18",
|
|
25
|
+
"@docusaurus/plugin-content-blog": "2.0.0-beta.18",
|
|
26
|
+
"@docusaurus/plugin-content-docs": "2.0.0-beta.18",
|
|
27
|
+
"@docusaurus/plugin-content-pages": "2.0.0-beta.18",
|
|
28
|
+
"@docusaurus/theme-common": "2.0.0-beta.18",
|
|
29
|
+
"@docusaurus/theme-translations": "2.0.0-beta.18",
|
|
30
|
+
"@docusaurus/utils": "2.0.0-beta.18",
|
|
31
|
+
"@docusaurus/utils-common": "2.0.0-beta.18",
|
|
32
|
+
"@docusaurus/utils-validation": "2.0.0-beta.18",
|
|
33
33
|
"@mdx-js/react": "^1.6.22",
|
|
34
34
|
"clsx": "^1.1.1",
|
|
35
35
|
"copy-text-to-clipboard": "^3.0.1",
|
|
36
|
-
"infima": "0.2.0-alpha.
|
|
36
|
+
"infima": "0.2.0-alpha.38",
|
|
37
37
|
"lodash": "^4.17.21",
|
|
38
|
-
"postcss": "^8.4.
|
|
39
|
-
"prism-react-renderer": "^1.
|
|
38
|
+
"postcss": "^8.4.12",
|
|
39
|
+
"prism-react-renderer": "^1.3.1",
|
|
40
40
|
"prismjs": "^1.27.0",
|
|
41
41
|
"react-router-dom": "^5.2.0",
|
|
42
|
-
"rtlcss": "^3.
|
|
42
|
+
"rtlcss": "^3.5.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@docusaurus/module-type-aliases": "2.0.0-beta.
|
|
46
|
-
"@docusaurus/types": "2.0.0-beta.
|
|
45
|
+
"@docusaurus/module-type-aliases": "2.0.0-beta.18",
|
|
46
|
+
"@docusaurus/types": "2.0.0-beta.18",
|
|
47
47
|
"@types/mdx-js__react": "^1.5.5",
|
|
48
48
|
"@types/prismjs": "^1.26.0",
|
|
49
49
|
"@types/rtlcss": "^3.1.2",
|
|
@@ -59,5 +59,5 @@
|
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
61
61
|
},
|
|
62
|
-
"gitHead": "
|
|
62
|
+
"gitHead": "1a945d06993d53376e61bed2c942799fe07dc336"
|
|
63
63
|
}
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -37,11 +37,62 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
37
37
|
},
|
|
38
38
|
Footer: {
|
|
39
39
|
actions: {
|
|
40
|
-
eject: '
|
|
40
|
+
eject: 'safe',
|
|
41
41
|
wrap: 'safe',
|
|
42
42
|
},
|
|
43
43
|
description: "The footer component of you site's layout",
|
|
44
44
|
},
|
|
45
|
+
'Footer/Copyright': {
|
|
46
|
+
actions: {
|
|
47
|
+
eject: 'safe',
|
|
48
|
+
wrap: 'safe',
|
|
49
|
+
},
|
|
50
|
+
description: 'The footer copyright',
|
|
51
|
+
},
|
|
52
|
+
'Footer/Layout': {
|
|
53
|
+
actions: {
|
|
54
|
+
eject: 'safe',
|
|
55
|
+
wrap: 'safe',
|
|
56
|
+
},
|
|
57
|
+
description: 'The footer main layout component',
|
|
58
|
+
},
|
|
59
|
+
'Footer/LinkItem': {
|
|
60
|
+
actions: {
|
|
61
|
+
eject: 'safe',
|
|
62
|
+
wrap: 'safe',
|
|
63
|
+
},
|
|
64
|
+
description: 'The footer link item component',
|
|
65
|
+
},
|
|
66
|
+
'Footer/Links': {
|
|
67
|
+
actions: {
|
|
68
|
+
eject: 'safe',
|
|
69
|
+
wrap: 'safe',
|
|
70
|
+
},
|
|
71
|
+
description: 'The footer component rendering the footer links',
|
|
72
|
+
},
|
|
73
|
+
'Footer/Links/MultiColumn': {
|
|
74
|
+
actions: {
|
|
75
|
+
eject: 'safe',
|
|
76
|
+
wrap: 'safe',
|
|
77
|
+
},
|
|
78
|
+
description:
|
|
79
|
+
'The footer component rendering the footer links with a multi-column layout',
|
|
80
|
+
},
|
|
81
|
+
'Footer/Links/Simple': {
|
|
82
|
+
actions: {
|
|
83
|
+
eject: 'safe',
|
|
84
|
+
wrap: 'safe',
|
|
85
|
+
},
|
|
86
|
+
description:
|
|
87
|
+
'The footer component rendering the footer links with a simple layout (single row)',
|
|
88
|
+
},
|
|
89
|
+
'Footer/Logo': {
|
|
90
|
+
actions: {
|
|
91
|
+
eject: 'safe',
|
|
92
|
+
wrap: 'safe',
|
|
93
|
+
},
|
|
94
|
+
description: 'The footer logo',
|
|
95
|
+
},
|
|
45
96
|
IconArrow: {
|
|
46
97
|
actions: {
|
|
47
98
|
eject: 'safe',
|
|
@@ -85,6 +136,76 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
85
136
|
description:
|
|
86
137
|
'The MDX components to use for rendering MDX files. Meant to be ejected.',
|
|
87
138
|
},
|
|
139
|
+
'MDXComponents/A': {
|
|
140
|
+
actions: {
|
|
141
|
+
eject: 'safe',
|
|
142
|
+
wrap: 'safe',
|
|
143
|
+
},
|
|
144
|
+
description:
|
|
145
|
+
'The component used to render <a> tags and Markdown links in MDX',
|
|
146
|
+
},
|
|
147
|
+
'MDXComponents/Code': {
|
|
148
|
+
actions: {
|
|
149
|
+
eject: 'safe',
|
|
150
|
+
wrap: 'safe',
|
|
151
|
+
},
|
|
152
|
+
description:
|
|
153
|
+
'The component used to render <code> tags and Markdown code blocks in MDX',
|
|
154
|
+
},
|
|
155
|
+
'MDXComponents/Details': {
|
|
156
|
+
actions: {
|
|
157
|
+
eject: 'safe',
|
|
158
|
+
wrap: 'safe',
|
|
159
|
+
},
|
|
160
|
+
description: 'The component used to render <details> tags in MDX',
|
|
161
|
+
},
|
|
162
|
+
'MDXComponents/Head': {
|
|
163
|
+
actions: {
|
|
164
|
+
eject: 'forbidden',
|
|
165
|
+
wrap: 'forbidden',
|
|
166
|
+
},
|
|
167
|
+
description:
|
|
168
|
+
'Technical component used to assign metadata (generally for SEO purpose) to the current MDX document',
|
|
169
|
+
},
|
|
170
|
+
'MDXComponents/Heading': {
|
|
171
|
+
actions: {
|
|
172
|
+
eject: 'safe',
|
|
173
|
+
wrap: 'safe',
|
|
174
|
+
},
|
|
175
|
+
description:
|
|
176
|
+
'The component used to render heading tags (<h1>, <h2>...) and Markdown headings in MDX',
|
|
177
|
+
},
|
|
178
|
+
'MDXComponents/Img': {
|
|
179
|
+
actions: {
|
|
180
|
+
eject: 'safe',
|
|
181
|
+
wrap: 'safe',
|
|
182
|
+
},
|
|
183
|
+
description:
|
|
184
|
+
'The component used to render <img> tags and Markdown images in MDX',
|
|
185
|
+
},
|
|
186
|
+
'MDXComponents/Pre': {
|
|
187
|
+
actions: {
|
|
188
|
+
eject: 'safe',
|
|
189
|
+
wrap: 'safe',
|
|
190
|
+
},
|
|
191
|
+
description: 'The component used to render <pre> tags in MDX',
|
|
192
|
+
},
|
|
193
|
+
'MDXComponents/Ul': {
|
|
194
|
+
actions: {
|
|
195
|
+
eject: 'safe',
|
|
196
|
+
wrap: 'safe',
|
|
197
|
+
},
|
|
198
|
+
description:
|
|
199
|
+
'The component used to render <ul> tags and Markdown unordered lists in MDX',
|
|
200
|
+
},
|
|
201
|
+
MDXContent: {
|
|
202
|
+
actions: {
|
|
203
|
+
eject: 'safe',
|
|
204
|
+
wrap: 'safe',
|
|
205
|
+
},
|
|
206
|
+
description:
|
|
207
|
+
'A component wrapping all MDX content and providing the MDXComponents to the MDX context',
|
|
208
|
+
},
|
|
88
209
|
// TODO should probably not even appear here
|
|
89
210
|
'NavbarItem/utils': {
|
|
90
211
|
actions: {
|
package/src/index.ts
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import type {LoadContext, Plugin
|
|
8
|
+
import type {LoadContext, Plugin} from '@docusaurus/types';
|
|
9
9
|
import type {ThemeConfig} from '@docusaurus/theme-common';
|
|
10
10
|
import {getTranslationFiles, translateThemeConfig} from './translations';
|
|
11
|
-
import path from 'path';
|
|
12
11
|
import {createRequire} from 'module';
|
|
13
12
|
import type {Plugin as PostCssPlugin} from 'postcss';
|
|
14
13
|
import rtlcss from 'rtlcss';
|
|
@@ -97,27 +96,26 @@ export default function docusaurusThemeClassic(
|
|
|
97
96
|
options: Options,
|
|
98
97
|
): Plugin<void> {
|
|
99
98
|
const {
|
|
100
|
-
siteConfig: {themeConfig: roughlyTypedThemeConfig},
|
|
101
99
|
i18n: {currentLocale, localeConfigs},
|
|
102
100
|
} = context;
|
|
103
|
-
const themeConfig =
|
|
101
|
+
const themeConfig = context.siteConfig.themeConfig as ThemeConfig;
|
|
104
102
|
const {
|
|
105
103
|
announcementBar,
|
|
106
104
|
colorMode,
|
|
107
|
-
prism: {additionalLanguages
|
|
105
|
+
prism: {additionalLanguages},
|
|
108
106
|
} = themeConfig;
|
|
109
|
-
const {customCss} = options
|
|
110
|
-
const {direction} = localeConfigs[currentLocale]
|
|
107
|
+
const {customCss} = options ?? {};
|
|
108
|
+
const {direction} = localeConfigs[currentLocale]!;
|
|
111
109
|
|
|
112
110
|
return {
|
|
113
111
|
name: 'docusaurus-theme-classic',
|
|
114
112
|
|
|
115
113
|
getThemePath() {
|
|
116
|
-
return
|
|
114
|
+
return '../lib-next/theme';
|
|
117
115
|
},
|
|
118
116
|
|
|
119
117
|
getTypeScriptThemePath() {
|
|
120
|
-
return
|
|
118
|
+
return '../src/theme';
|
|
121
119
|
},
|
|
122
120
|
|
|
123
121
|
getTranslationFiles: async () => getTranslationFiles({themeConfig}),
|
|
@@ -138,8 +136,8 @@ export default function docusaurusThemeClassic(
|
|
|
138
136
|
getClientModules() {
|
|
139
137
|
const modules = [
|
|
140
138
|
require.resolve(getInfimaCSSFile(direction)),
|
|
141
|
-
|
|
142
|
-
|
|
139
|
+
'./prism-include-languages',
|
|
140
|
+
'./admonitions.css',
|
|
143
141
|
];
|
|
144
142
|
|
|
145
143
|
if (customCss) {
|
|
@@ -171,7 +169,7 @@ export default function docusaurusThemeClassic(
|
|
|
171
169
|
};
|
|
172
170
|
},
|
|
173
171
|
|
|
174
|
-
configurePostCss(postCssOptions
|
|
172
|
+
configurePostCss(postCssOptions) {
|
|
175
173
|
if (direction === 'rtl') {
|
|
176
174
|
const resolvedInfimaFile = require.resolve(getInfimaCSSFile(direction));
|
|
177
175
|
const plugin: PostCssPlugin = {
|
|
@@ -132,9 +132,7 @@ export default function BackToTopButton(): JSX.Element {
|
|
|
132
132
|
'clean-btn',
|
|
133
133
|
ThemeClassNames.common.backToTopButton,
|
|
134
134
|
styles.backToTopButton,
|
|
135
|
-
|
|
136
|
-
[styles.backToTopButtonShow]: show,
|
|
137
|
-
},
|
|
135
|
+
show && styles.backToTopButtonShow,
|
|
138
136
|
)}
|
|
139
137
|
type="button"
|
|
140
138
|
onClick={() => smoothScrollTop()}
|
|
@@ -10,6 +10,7 @@ import Layout from '@theme/Layout';
|
|
|
10
10
|
import Link from '@docusaurus/Link';
|
|
11
11
|
import type {ArchiveBlogPost, Props} from '@theme/BlogArchivePage';
|
|
12
12
|
import {translate} from '@docusaurus/Translate';
|
|
13
|
+
import {PageMetadata} from '@docusaurus/theme-common';
|
|
13
14
|
|
|
14
15
|
type YearProp = {
|
|
15
16
|
year: string;
|
|
@@ -50,14 +51,11 @@ function YearsSection({years}: {years: YearProp[]}) {
|
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
function listPostsByYears(blogPosts: readonly ArchiveBlogPost[]): YearProp[] {
|
|
53
|
-
const postsByYear
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
},
|
|
59
|
-
new Map(),
|
|
60
|
-
);
|
|
54
|
+
const postsByYear = blogPosts.reduceRight((posts, post) => {
|
|
55
|
+
const year = post.metadata.date.split('-')[0]!;
|
|
56
|
+
const yearPosts = posts.get(year) ?? [];
|
|
57
|
+
return posts.set(year, [post, ...yearPosts]);
|
|
58
|
+
}, new Map<string, ArchiveBlogPost[]>());
|
|
61
59
|
|
|
62
60
|
return Array.from(postsByYear, ([year, posts]) => ({
|
|
63
61
|
year,
|
|
@@ -78,14 +76,17 @@ export default function BlogArchive({archive}: Props): JSX.Element {
|
|
|
78
76
|
});
|
|
79
77
|
const years = listPostsByYears(archive.blogPosts);
|
|
80
78
|
return (
|
|
81
|
-
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
<
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
79
|
+
<>
|
|
80
|
+
<PageMetadata title={title} description={description} />
|
|
81
|
+
<Layout>
|
|
82
|
+
<header className="hero hero--primary">
|
|
83
|
+
<div className="container">
|
|
84
|
+
<h1 className="hero__title">{title}</h1>
|
|
85
|
+
<p className="hero__subtitle">{description}</p>
|
|
86
|
+
</div>
|
|
87
|
+
</header>
|
|
88
|
+
<main>{years.length > 0 && <YearsSection years={years} />}</main>
|
|
89
|
+
</Layout>
|
|
90
|
+
</>
|
|
90
91
|
);
|
|
91
92
|
}
|
|
@@ -12,28 +12,34 @@ import BlogLayout from '@theme/BlogLayout';
|
|
|
12
12
|
import BlogPostItem from '@theme/BlogPostItem';
|
|
13
13
|
import BlogListPaginator from '@theme/BlogListPaginator';
|
|
14
14
|
import type {Props} from '@theme/BlogListPage';
|
|
15
|
-
import {
|
|
15
|
+
import {
|
|
16
|
+
PageMetadata,
|
|
17
|
+
HtmlClassNameProvider,
|
|
18
|
+
ThemeClassNames,
|
|
19
|
+
} from '@docusaurus/theme-common';
|
|
20
|
+
import SearchMetadata from '@theme/SearchMetadata';
|
|
21
|
+
import clsx from 'clsx';
|
|
16
22
|
|
|
17
|
-
|
|
18
|
-
const {metadata
|
|
23
|
+
function BlogListPageMetadata(props: Props): JSX.Element {
|
|
24
|
+
const {metadata} = props;
|
|
19
25
|
const {
|
|
20
26
|
siteConfig: {title: siteTitle},
|
|
21
27
|
} = useDocusaurusContext();
|
|
22
28
|
const {blogDescription, blogTitle, permalink} = metadata;
|
|
23
29
|
const isBlogOnlyMode = permalink === '/';
|
|
24
30
|
const title = isBlogOnlyMode ? siteTitle : blogTitle;
|
|
31
|
+
return (
|
|
32
|
+
<>
|
|
33
|
+
<PageMetadata title={title} description={blogDescription} />
|
|
34
|
+
<SearchMetadata tag="blog_posts_list" />
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
25
38
|
|
|
39
|
+
function BlogListPageContent(props: Props): JSX.Element {
|
|
40
|
+
const {metadata, items, sidebar} = props;
|
|
26
41
|
return (
|
|
27
|
-
<BlogLayout
|
|
28
|
-
title={title}
|
|
29
|
-
description={blogDescription}
|
|
30
|
-
wrapperClassName={ThemeClassNames.wrapper.blogPages}
|
|
31
|
-
pageClassName={ThemeClassNames.page.blogListPage}
|
|
32
|
-
searchMetadata={{
|
|
33
|
-
// assign unique search tag to exclude this page from search results!
|
|
34
|
-
tag: 'blog_posts_list',
|
|
35
|
-
}}
|
|
36
|
-
sidebar={sidebar}>
|
|
42
|
+
<BlogLayout sidebar={sidebar}>
|
|
37
43
|
{items.map(({content: BlogPostContent}) => (
|
|
38
44
|
<BlogPostItem
|
|
39
45
|
key={BlogPostContent.metadata.permalink}
|
|
@@ -48,3 +54,16 @@ export default function BlogListPage(props: Props): JSX.Element {
|
|
|
48
54
|
</BlogLayout>
|
|
49
55
|
);
|
|
50
56
|
}
|
|
57
|
+
|
|
58
|
+
export default function BlogListPage(props: Props): JSX.Element {
|
|
59
|
+
return (
|
|
60
|
+
<HtmlClassNameProvider
|
|
61
|
+
className={clsx(
|
|
62
|
+
ThemeClassNames.wrapper.blogPages,
|
|
63
|
+
ThemeClassNames.page.blogListPage,
|
|
64
|
+
)}>
|
|
65
|
+
<BlogListPageMetadata {...props} />
|
|
66
|
+
<BlogListPageContent {...props} />
|
|
67
|
+
</HtmlClassNameProvider>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -7,13 +7,12 @@
|
|
|
7
7
|
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import clsx from 'clsx';
|
|
10
|
-
import {MDXProvider} from '@mdx-js/react';
|
|
11
10
|
import Translate, {translate} from '@docusaurus/Translate';
|
|
12
11
|
import Link from '@docusaurus/Link';
|
|
13
12
|
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
14
13
|
import {usePluralForm} from '@docusaurus/theme-common';
|
|
15
14
|
import {blogPostContainerID} from '@docusaurus/utils-common';
|
|
16
|
-
import
|
|
15
|
+
import MDXContent from '@theme/MDXContent';
|
|
17
16
|
import EditThisPage from '@theme/EditThisPage';
|
|
18
17
|
import type {Props} from '@theme/BlogPostItem';
|
|
19
18
|
|
|
@@ -108,14 +107,15 @@ export default function BlogPostItem(props: Props): JSX.Element {
|
|
|
108
107
|
id={isBlogPostPage ? blogPostContainerID : undefined}
|
|
109
108
|
className="markdown"
|
|
110
109
|
itemProp="articleBody">
|
|
111
|
-
<
|
|
110
|
+
<MDXContent>{children}</MDXContent>
|
|
112
111
|
</div>
|
|
113
112
|
|
|
114
113
|
{(tagsExists || truncated) && (
|
|
115
114
|
<footer
|
|
116
|
-
className={clsx(
|
|
117
|
-
|
|
118
|
-
|
|
115
|
+
className={clsx(
|
|
116
|
+
'row docusaurus-mt-lg',
|
|
117
|
+
isBlogPostPage && styles.blogPostDetailsFull,
|
|
118
|
+
)}>
|
|
119
119
|
{tagsExists && (
|
|
120
120
|
<div className={clsx('col', {'col--9': truncatedPost})}>
|
|
121
121
|
<TagsListInline tags={tags} />
|