@docusaurus/theme-classic 3.0.0-alpha.0 → 3.0.0-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/getSwizzleConfig.js +15 -8
- package/lib/options.js +8 -5
- package/lib/prism-include-languages.js +1 -1
- package/lib/theme/Admonition/Icon/{Caution.d.ts → Warning.d.ts} +1 -1
- package/lib/theme/Admonition/Type/Caution.js +4 -2
- package/{src/deps.d.ts → lib/theme/Admonition/Type/Warning.d.ts} +3 -7
- package/lib/theme/Admonition/Type/Warning.js +32 -0
- package/lib/theme/Admonition/Types.js +4 -4
- package/lib/theme/BlogLayout/index.js +1 -1
- package/lib/theme/BlogPostItem/Container/index.js +12 -3
- package/lib/theme/BlogPostItem/Header/Author/index.js +6 -1
- package/lib/theme/CodeBlock/Content/String.js +14 -10
- package/lib/theme/CodeBlock/CopyButton/index.js +0 -1
- package/lib/theme/DocItem/index.js +1 -1
- package/lib/theme/DocSidebar/Desktop/index.d.ts +1 -1
- package/lib/theme/DocSidebar/Mobile/index.d.ts +1 -1
- package/lib/theme/DocSidebarItem/Category/index.js +21 -10
- package/lib/theme/MDXComponents/Ul/index.js +4 -0
- package/lib/theme/MDXComponents/index.js +1 -0
- package/lib/theme/MDXContent/index.js +0 -1
- package/lib/theme/Navbar/Search/index.js +5 -1
- package/lib/theme/Navbar/Search/styles.module.css +10 -2
- package/lib/theme/SiteMetadata/index.js +30 -3
- package/lib/theme/prism-include-languages.js +4 -0
- package/package.json +22 -22
- package/src/getSwizzleConfig.ts +16 -8
- package/src/options.ts +8 -3
- package/src/prism-include-languages.ts +1 -1
- package/src/theme/Admonition/Icon/{Caution.tsx → Warning.tsx} +1 -1
- package/src/theme/Admonition/Type/Caution.tsx +4 -2
- package/src/theme/Admonition/Type/Warning.tsx +37 -0
- package/src/theme/Admonition/Types.tsx +4 -4
- package/src/theme/BlogLayout/index.tsx +1 -1
- package/src/theme/BlogPostItem/Container/index.tsx +12 -3
- package/src/theme/BlogPostItem/Header/Author/index.tsx +6 -1
- package/src/theme/CodeBlock/Content/String.tsx +15 -6
- package/src/theme/CodeBlock/CopyButton/index.tsx +0 -1
- package/src/theme/DocItem/index.tsx +1 -1
- package/src/theme/DocSidebarItem/Category/index.tsx +22 -9
- package/src/theme/MDXComponents/Ul/index.tsx +5 -1
- package/src/theme/MDXComponents/index.tsx +8 -7
- package/src/theme/MDXContent/index.tsx +0 -1
- package/src/theme/Navbar/Search/index.tsx +5 -1
- package/src/theme/Navbar/Search/styles.module.css +10 -2
- package/src/theme/SiteMetadata/index.tsx +36 -3
- package/src/theme/prism-include-languages.ts +4 -0
- package/src/theme-classic.d.ts +27 -15
- /package/lib/theme/Admonition/Icon/{Caution.js → Warning.js} +0 -0
package/lib/getSwizzleConfig.js
CHANGED
|
@@ -17,13 +17,6 @@ function getSwizzleConfig() {
|
|
|
17
17
|
},
|
|
18
18
|
description: 'The folder containing all admonition icons',
|
|
19
19
|
},
|
|
20
|
-
'Admonition/Icon/Caution': {
|
|
21
|
-
actions: {
|
|
22
|
-
eject: 'safe',
|
|
23
|
-
wrap: 'safe',
|
|
24
|
-
},
|
|
25
|
-
description: 'The admonition caution icon',
|
|
26
|
-
},
|
|
27
20
|
'Admonition/Icon/Danger': {
|
|
28
21
|
actions: {
|
|
29
22
|
eject: 'safe',
|
|
@@ -52,6 +45,13 @@ function getSwizzleConfig() {
|
|
|
52
45
|
},
|
|
53
46
|
description: 'The admonition tip icon',
|
|
54
47
|
},
|
|
48
|
+
'Admonition/Icon/Warning': {
|
|
49
|
+
actions: {
|
|
50
|
+
eject: 'safe',
|
|
51
|
+
wrap: 'safe',
|
|
52
|
+
},
|
|
53
|
+
description: 'The admonition warning icon',
|
|
54
|
+
},
|
|
55
55
|
'Admonition/Layout': {
|
|
56
56
|
actions: {
|
|
57
57
|
eject: 'safe',
|
|
@@ -101,6 +101,13 @@ function getSwizzleConfig() {
|
|
|
101
101
|
},
|
|
102
102
|
description: 'The component responsible for rendering a :::tip admonition type',
|
|
103
103
|
},
|
|
104
|
+
'Admonition/Type/Warning': {
|
|
105
|
+
actions: {
|
|
106
|
+
eject: 'safe',
|
|
107
|
+
wrap: 'safe',
|
|
108
|
+
},
|
|
109
|
+
description: 'The component responsible for rendering a :::warning admonition type',
|
|
110
|
+
},
|
|
104
111
|
'Admonition/Types': {
|
|
105
112
|
actions: {
|
|
106
113
|
eject: 'safe',
|
|
@@ -166,7 +173,7 @@ function getSwizzleConfig() {
|
|
|
166
173
|
eject: 'safe',
|
|
167
174
|
wrap: 'safe',
|
|
168
175
|
},
|
|
169
|
-
description: "The footer component of
|
|
176
|
+
description: "The footer component of your site's layout",
|
|
170
177
|
},
|
|
171
178
|
'Footer/Copyright': {
|
|
172
179
|
actions: {
|
package/lib/options.js
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.validateOptions = exports.validateThemeConfig = exports.ThemeConfigSchema = exports.DEFAULT_CONFIG = void 0;
|
|
10
|
-
const
|
|
11
|
-
const palenight_1 = tslib_1.__importDefault(require("prism-react-renderer/themes/palenight"));
|
|
10
|
+
const prism_react_renderer_1 = require("prism-react-renderer");
|
|
12
11
|
const utils_validation_1 = require("@docusaurus/utils-validation");
|
|
12
|
+
const defaultPrismTheme = prism_react_renderer_1.themes.palenight;
|
|
13
13
|
const DEFAULT_DOCS_CONFIG = {
|
|
14
14
|
versionPersistence: 'localStorage',
|
|
15
15
|
sidebar: {
|
|
@@ -37,7 +37,7 @@ exports.DEFAULT_CONFIG = {
|
|
|
37
37
|
metadata: [],
|
|
38
38
|
prism: {
|
|
39
39
|
additionalLanguages: [],
|
|
40
|
-
theme:
|
|
40
|
+
theme: defaultPrismTheme,
|
|
41
41
|
magicComments: [
|
|
42
42
|
{
|
|
43
43
|
className: 'theme-code-block-highlighted-line',
|
|
@@ -277,6 +277,9 @@ const LogoSchema = utils_validation_1.Joi.object({
|
|
|
277
277
|
style: utils_validation_1.Joi.object(),
|
|
278
278
|
className: utils_validation_1.Joi.string(),
|
|
279
279
|
});
|
|
280
|
+
// Normalize prism language to lowercase
|
|
281
|
+
// See https://github.com/facebook/docusaurus/issues/9012
|
|
282
|
+
const PrismLanguage = utils_validation_1.Joi.string().custom((val) => val.toLowerCase());
|
|
280
283
|
exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
281
284
|
// TODO temporary (@alpha-58)
|
|
282
285
|
// @ts-expect-error: forbidden
|
|
@@ -341,9 +344,9 @@ exports.ThemeConfigSchema = utils_validation_1.Joi.object({
|
|
|
341
344
|
plain: utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.array(), utils_validation_1.Joi.object()).required(),
|
|
342
345
|
styles: utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.array(), utils_validation_1.Joi.object()).required(),
|
|
343
346
|
}),
|
|
344
|
-
defaultLanguage:
|
|
347
|
+
defaultLanguage: PrismLanguage,
|
|
345
348
|
additionalLanguages: utils_validation_1.Joi.array()
|
|
346
|
-
.items(
|
|
349
|
+
.items(PrismLanguage)
|
|
347
350
|
.default(exports.DEFAULT_CONFIG.prism.additionalLanguages),
|
|
348
351
|
magicComments: utils_validation_1.Joi.array()
|
|
349
352
|
.items(utils_validation_1.Joi.object({
|
|
@@ -4,6 +4,6 @@
|
|
|
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 Prism from 'prism-react-renderer
|
|
7
|
+
import { Prism } from 'prism-react-renderer';
|
|
8
8
|
import prismIncludeLanguages from '@theme/prism-include-languages';
|
|
9
9
|
prismIncludeLanguages(Prism);
|
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
/// <reference types="react" />
|
|
8
|
-
import type { Props } from '@theme/Admonition/Icon/
|
|
8
|
+
import type { Props } from '@theme/Admonition/Icon/Warning';
|
|
9
9
|
export default function AdmonitionIconCaution(props: Props): JSX.Element;
|
|
@@ -8,10 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import Translate from '@docusaurus/Translate';
|
|
10
10
|
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
11
|
-
import
|
|
11
|
+
import IconWarning from '@theme/Admonition/Icon/Warning';
|
|
12
12
|
const infimaClassName = 'alert alert--warning';
|
|
13
13
|
const defaultProps = {
|
|
14
|
-
icon: <
|
|
14
|
+
icon: <IconWarning />,
|
|
15
15
|
title: (
|
|
16
16
|
<Translate
|
|
17
17
|
id="theme.admonition.caution"
|
|
@@ -20,6 +20,8 @@ const defaultProps = {
|
|
|
20
20
|
</Translate>
|
|
21
21
|
),
|
|
22
22
|
};
|
|
23
|
+
// TODO remove before v4: Caution replaced by Warning
|
|
24
|
+
// see https://github.com/facebook/docusaurus/issues/7558
|
|
23
25
|
export default function AdmonitionTypeCaution(props) {
|
|
24
26
|
return (
|
|
25
27
|
<AdmonitionLayout
|
|
@@ -4,10 +4,6 @@
|
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
const Prism: typeof PrismNamespace;
|
|
12
|
-
export default Prism;
|
|
13
|
-
}
|
|
7
|
+
/// <reference types="react" />
|
|
8
|
+
import type { Props } from '@theme/Admonition/Type/Warning';
|
|
9
|
+
export default function AdmonitionTypeWarning(props: Props): JSX.Element;
|
|
@@ -0,0 +1,32 @@
|
|
|
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 Translate from '@docusaurus/Translate';
|
|
10
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
11
|
+
import IconWarning from '@theme/Admonition/Icon/Warning';
|
|
12
|
+
const infimaClassName = 'alert alert--warning';
|
|
13
|
+
const defaultProps = {
|
|
14
|
+
icon: <IconWarning />,
|
|
15
|
+
title: (
|
|
16
|
+
<Translate
|
|
17
|
+
id="theme.admonition.warning"
|
|
18
|
+
description="The default label used for the Warning admonition (:::warning)">
|
|
19
|
+
warning
|
|
20
|
+
</Translate>
|
|
21
|
+
),
|
|
22
|
+
};
|
|
23
|
+
export default function AdmonitionTypeWarning(props) {
|
|
24
|
+
return (
|
|
25
|
+
<AdmonitionLayout
|
|
26
|
+
{...defaultProps}
|
|
27
|
+
{...props}
|
|
28
|
+
className={clsx(infimaClassName, props.className)}>
|
|
29
|
+
{props.children}
|
|
30
|
+
</AdmonitionLayout>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -8,13 +8,14 @@ import React from 'react';
|
|
|
8
8
|
import AdmonitionTypeNote from '@theme/Admonition/Type/Note';
|
|
9
9
|
import AdmonitionTypeTip from '@theme/Admonition/Type/Tip';
|
|
10
10
|
import AdmonitionTypeInfo from '@theme/Admonition/Type/Info';
|
|
11
|
-
import
|
|
11
|
+
import AdmonitionTypeWarning from '@theme/Admonition/Type/Warning';
|
|
12
12
|
import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger';
|
|
13
|
+
import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
|
|
13
14
|
const admonitionTypes = {
|
|
14
15
|
note: AdmonitionTypeNote,
|
|
15
16
|
tip: AdmonitionTypeTip,
|
|
16
17
|
info: AdmonitionTypeInfo,
|
|
17
|
-
|
|
18
|
+
warning: AdmonitionTypeWarning,
|
|
18
19
|
danger: AdmonitionTypeDanger,
|
|
19
20
|
};
|
|
20
21
|
// Undocumented legacy admonition type aliases
|
|
@@ -24,8 +25,7 @@ const admonitionAliases = {
|
|
|
24
25
|
secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />,
|
|
25
26
|
important: (props) => <AdmonitionTypeInfo title="important" {...props} />,
|
|
26
27
|
success: (props) => <AdmonitionTypeTip title="success" {...props} />,
|
|
27
|
-
|
|
28
|
-
warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
|
|
28
|
+
caution: AdmonitionTypeCaution,
|
|
29
29
|
};
|
|
30
30
|
export default {
|
|
31
31
|
...admonitionTypes,
|
|
@@ -8,17 +8,26 @@ import React from 'react';
|
|
|
8
8
|
import {useBaseUrlUtils} from '@docusaurus/useBaseUrl';
|
|
9
9
|
import {useBlogPost} from '@docusaurus/theme-common/internal';
|
|
10
10
|
export default function BlogPostItemContainer({children, className}) {
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
frontMatter,
|
|
13
|
+
assets,
|
|
14
|
+
metadata: {description},
|
|
15
|
+
} = useBlogPost();
|
|
12
16
|
const {withBaseUrl} = useBaseUrlUtils();
|
|
13
17
|
const image = assets.image ?? frontMatter.image;
|
|
18
|
+
const keywords = frontMatter.keywords ?? [];
|
|
14
19
|
return (
|
|
15
20
|
<article
|
|
16
21
|
className={className}
|
|
17
22
|
itemProp="blogPost"
|
|
18
23
|
itemScope
|
|
19
|
-
itemType="
|
|
24
|
+
itemType="https://schema.org/BlogPosting">
|
|
25
|
+
{description && <meta itemProp="description" content={description} />}
|
|
20
26
|
{image && (
|
|
21
|
-
<
|
|
27
|
+
<link itemProp="image" href={withBaseUrl(image, {absolute: true})} />
|
|
28
|
+
)}
|
|
29
|
+
{keywords.length > 0 && (
|
|
30
|
+
<meta itemProp="keywords" content={keywords.join(',')} />
|
|
22
31
|
)}
|
|
23
32
|
{children}
|
|
24
33
|
</article>
|
|
@@ -20,7 +20,12 @@ export default function BlogPostItemHeaderAuthor({author, className}) {
|
|
|
20
20
|
<div className={clsx('avatar margin-bottom--sm', className)}>
|
|
21
21
|
{imageURL && (
|
|
22
22
|
<MaybeLink href={link} className="avatar__photo-link">
|
|
23
|
-
<img
|
|
23
|
+
<img
|
|
24
|
+
className="avatar__photo"
|
|
25
|
+
src={imageURL}
|
|
26
|
+
alt={name}
|
|
27
|
+
itemProp="image"
|
|
28
|
+
/>
|
|
24
29
|
</MaybeLink>
|
|
25
30
|
)}
|
|
26
31
|
|
|
@@ -14,12 +14,18 @@ import {
|
|
|
14
14
|
containsLineNumbers,
|
|
15
15
|
useCodeWordWrap,
|
|
16
16
|
} from '@docusaurus/theme-common/internal';
|
|
17
|
-
import Highlight
|
|
17
|
+
import {Highlight} from 'prism-react-renderer';
|
|
18
18
|
import Line from '@theme/CodeBlock/Line';
|
|
19
19
|
import CopyButton from '@theme/CodeBlock/CopyButton';
|
|
20
20
|
import WordWrapButton from '@theme/CodeBlock/WordWrapButton';
|
|
21
21
|
import Container from '@theme/CodeBlock/Container';
|
|
22
22
|
import styles from './styles.module.css';
|
|
23
|
+
// Prism languages are always lowercase
|
|
24
|
+
// We want to fail-safe and allow both "php" and "PHP"
|
|
25
|
+
// See https://github.com/facebook/docusaurus/issues/9012
|
|
26
|
+
function normalizeLanguage(language) {
|
|
27
|
+
return language?.toLowerCase();
|
|
28
|
+
}
|
|
23
29
|
export default function CodeBlockString({
|
|
24
30
|
children,
|
|
25
31
|
className: blockClassName = '',
|
|
@@ -31,8 +37,9 @@ export default function CodeBlockString({
|
|
|
31
37
|
const {
|
|
32
38
|
prism: {defaultLanguage, magicComments},
|
|
33
39
|
} = useThemeConfig();
|
|
34
|
-
const language =
|
|
35
|
-
languageProp ?? parseLanguage(blockClassName) ?? defaultLanguage
|
|
40
|
+
const language = normalizeLanguage(
|
|
41
|
+
languageProp ?? parseLanguage(blockClassName) ?? defaultLanguage,
|
|
42
|
+
);
|
|
36
43
|
const prismTheme = usePrismTheme();
|
|
37
44
|
const wordWrap = useCodeWordWrap();
|
|
38
45
|
// We still parse the metastring in case we want to support more syntax in the
|
|
@@ -57,17 +64,14 @@ export default function CodeBlockString({
|
|
|
57
64
|
)}>
|
|
58
65
|
{title && <div className={styles.codeBlockTitle}>{title}</div>}
|
|
59
66
|
<div className={styles.codeBlockContent}>
|
|
60
|
-
<Highlight
|
|
61
|
-
{
|
|
62
|
-
theme={prismTheme}
|
|
63
|
-
code={code}
|
|
64
|
-
language={language ?? 'text'}>
|
|
65
|
-
{({className, tokens, getLineProps, getTokenProps}) => (
|
|
67
|
+
<Highlight theme={prismTheme} code={code} language={language ?? 'text'}>
|
|
68
|
+
{({className, style, tokens, getLineProps, getTokenProps}) => (
|
|
66
69
|
<pre
|
|
67
70
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
68
71
|
tabIndex={0}
|
|
69
72
|
ref={wordWrap.codeBlockRef}
|
|
70
|
-
className={clsx(className, styles.codeBlock, 'thin-scrollbar')}
|
|
73
|
+
className={clsx(className, styles.codeBlock, 'thin-scrollbar')}
|
|
74
|
+
style={style}>
|
|
71
75
|
<code
|
|
72
76
|
className={clsx(
|
|
73
77
|
styles.codeBlockLines,
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React, {useCallback, useState, useRef, useEffect} from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
// @ts-expect-error: TODO, we need to make theme-classic have type: module
|
|
10
9
|
import copy from 'copy-text-to-clipboard';
|
|
11
10
|
import {translate} from '@docusaurus/Translate';
|
|
12
11
|
import IconCopy from '@theme/Icon/Copy';
|
|
@@ -10,7 +10,7 @@ import {DocProvider} from '@docusaurus/theme-common/internal';
|
|
|
10
10
|
import DocItemMetadata from '@theme/DocItem/Metadata';
|
|
11
11
|
import DocItemLayout from '@theme/DocItem/Layout';
|
|
12
12
|
export default function DocItem(props) {
|
|
13
|
-
const docHtmlClassName = `docs-doc-id-${props.content.metadata.
|
|
13
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
|
|
14
14
|
const MDXComponent = props.content;
|
|
15
15
|
return (
|
|
16
16
|
<DocProvider content={props.content}>
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { Props } from '@theme/DocSidebar/Desktop';
|
|
9
|
-
declare function DocSidebarDesktop({ path, sidebar, onCollapse, isHidden }: Props): JSX.Element;
|
|
9
|
+
declare function DocSidebarDesktop({ path, sidebar, onCollapse, isHidden }: Props): React.JSX.Element;
|
|
10
10
|
declare const _default: React.MemoExoticComponent<typeof DocSidebarDesktop>;
|
|
11
11
|
export default _default;
|
|
@@ -6,6 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import type { Props } from '@theme/DocSidebar/Mobile';
|
|
9
|
-
declare function DocSidebarMobile(props: Props): JSX.Element;
|
|
9
|
+
declare function DocSidebarMobile(props: Props): React.JSX.Element;
|
|
10
10
|
declare const _default: React.MemoExoticComponent<typeof DocSidebarMobile>;
|
|
11
11
|
export default _default;
|
|
@@ -56,18 +56,28 @@ function useCategoryHrefWithSSRFallback(item) {
|
|
|
56
56
|
return findFirstSidebarItemLink(item);
|
|
57
57
|
}, [item, isBrowser]);
|
|
58
58
|
}
|
|
59
|
-
function CollapseButton({categoryLabel, onClick}) {
|
|
59
|
+
function CollapseButton({collapsed, categoryLabel, onClick}) {
|
|
60
60
|
return (
|
|
61
61
|
<button
|
|
62
|
-
aria-label={
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
62
|
+
aria-label={
|
|
63
|
+
collapsed
|
|
64
|
+
? translate(
|
|
65
|
+
{
|
|
66
|
+
id: 'theme.DocSidebarItem.expandCategoryAriaLabel',
|
|
67
|
+
message: "Expand sidebar category '{label}'",
|
|
68
|
+
description: 'The ARIA label to expand the sidebar category',
|
|
69
|
+
},
|
|
70
|
+
{label: categoryLabel},
|
|
71
|
+
)
|
|
72
|
+
: translate(
|
|
73
|
+
{
|
|
74
|
+
id: 'theme.DocSidebarItem.collapseCategoryAriaLabel',
|
|
75
|
+
message: "Collapse sidebar category '{label}'",
|
|
76
|
+
description: 'The ARIA label to collapse the sidebar category',
|
|
77
|
+
},
|
|
78
|
+
{label: categoryLabel},
|
|
79
|
+
)
|
|
80
|
+
}
|
|
71
81
|
type="button"
|
|
72
82
|
className="clean-btn menu__caret"
|
|
73
83
|
onClick={onClick}
|
|
@@ -162,6 +172,7 @@ export default function DocSidebarItemCategory({
|
|
|
162
172
|
</Link>
|
|
163
173
|
{href && collapsible && (
|
|
164
174
|
<CollapseButton
|
|
175
|
+
collapsed={collapsed}
|
|
165
176
|
categoryLabel={label}
|
|
166
177
|
onClick={(e) => {
|
|
167
178
|
e.preventDefault();
|
|
@@ -8,6 +8,10 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
10
|
function transformUlClassName(className) {
|
|
11
|
+
// Fix https://github.com/facebook/docusaurus/issues/9098
|
|
12
|
+
if (typeof className === 'undefined') {
|
|
13
|
+
return undefined;
|
|
14
|
+
}
|
|
11
15
|
return clsx(
|
|
12
16
|
className,
|
|
13
17
|
// This class is set globally by GitHub/MDX. We keep the global class, and
|
|
@@ -5,7 +5,6 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
// @ts-expect-error: TODO see https://github.com/microsoft/TypeScript/issues/49721
|
|
9
8
|
import {MDXProvider} from '@mdx-js/react';
|
|
10
9
|
import MDXComponents from '@theme/MDXComponents';
|
|
11
10
|
export default function MDXContent({children}) {
|
|
@@ -8,5 +8,9 @@ import React from 'react';
|
|
|
8
8
|
import clsx from 'clsx';
|
|
9
9
|
import styles from './styles.module.css';
|
|
10
10
|
export default function NavbarSearch({children, className}) {
|
|
11
|
-
return
|
|
11
|
+
return (
|
|
12
|
+
<div className={clsx(className, styles.navbarSearchContainer)}>
|
|
13
|
+
{children}
|
|
14
|
+
</div>
|
|
15
|
+
);
|
|
12
16
|
}
|
|
@@ -5,15 +5,23 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
/*
|
|
9
|
+
Workaround to avoid rendering empty search container
|
|
10
|
+
See https://github.com/facebook/docusaurus/pull/9385
|
|
11
|
+
*/
|
|
12
|
+
.navbarSearchContainer:not(:has(> *)) {
|
|
13
|
+
display: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
8
16
|
@media (max-width: 996px) {
|
|
9
|
-
.
|
|
17
|
+
.navbarSearchContainer {
|
|
10
18
|
position: absolute;
|
|
11
19
|
right: var(--ifm-navbar-padding-horizontal);
|
|
12
20
|
}
|
|
13
21
|
}
|
|
14
22
|
|
|
15
23
|
@media (min-width: 997px) {
|
|
16
|
-
.
|
|
24
|
+
.navbarSearchContainer {
|
|
17
25
|
padding: var(--ifm-navbar-item-padding-vertical)
|
|
18
26
|
var(--ifm-navbar-item-padding-horizontal);
|
|
19
27
|
}
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
keyboardFocusedClassName,
|
|
16
16
|
} from '@docusaurus/theme-common/internal';
|
|
17
17
|
import {useLocation} from '@docusaurus/router';
|
|
18
|
+
import {applyTrailingSlash} from '@docusaurus/utils-common';
|
|
18
19
|
import SearchMetadata from '@theme/SearchMetadata';
|
|
19
20
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
20
21
|
// Useful for i18n/SEO
|
|
@@ -22,9 +23,15 @@ import SearchMetadata from '@theme/SearchMetadata';
|
|
|
22
23
|
// See https://github.com/facebook/docusaurus/issues/3317
|
|
23
24
|
function AlternateLangHeaders() {
|
|
24
25
|
const {
|
|
25
|
-
i18n: {defaultLocale, localeConfigs},
|
|
26
|
+
i18n: {currentLocale, defaultLocale, localeConfigs},
|
|
26
27
|
} = useDocusaurusContext();
|
|
27
28
|
const alternatePageUtils = useAlternatePageUtils();
|
|
29
|
+
const currentHtmlLang = localeConfigs[currentLocale].htmlLang;
|
|
30
|
+
// HTML lang is a BCP 47 tag, but the Open Graph protocol requires
|
|
31
|
+
// using underscores instead of dashes.
|
|
32
|
+
// See https://ogp.me/#optional
|
|
33
|
+
// See https://en.wikipedia.org/wiki/IETF_language_tag)
|
|
34
|
+
const bcp47ToOpenGraphLocale = (code) => code.replace('-', '_');
|
|
28
35
|
// Note: it is fine to use both "x-default" and "en" to target the same url
|
|
29
36
|
// See https://www.searchviu.com/en/multiple-hreflang-tags-one-url/
|
|
30
37
|
return (
|
|
@@ -48,16 +55,36 @@ function AlternateLangHeaders() {
|
|
|
48
55
|
})}
|
|
49
56
|
hrefLang="x-default"
|
|
50
57
|
/>
|
|
58
|
+
|
|
59
|
+
<meta
|
|
60
|
+
property="og:locale"
|
|
61
|
+
content={bcp47ToOpenGraphLocale(currentHtmlLang)}
|
|
62
|
+
/>
|
|
63
|
+
{Object.values(localeConfigs)
|
|
64
|
+
.filter((config) => currentHtmlLang !== config.htmlLang)
|
|
65
|
+
.map((config) => (
|
|
66
|
+
<meta
|
|
67
|
+
key={`meta-og-${config.htmlLang}`}
|
|
68
|
+
property="og:locale:alternate"
|
|
69
|
+
content={bcp47ToOpenGraphLocale(config.htmlLang)}
|
|
70
|
+
/>
|
|
71
|
+
))}
|
|
51
72
|
</Head>
|
|
52
73
|
);
|
|
53
74
|
}
|
|
54
75
|
// Default canonical url inferred from current page location pathname
|
|
55
76
|
function useDefaultCanonicalUrl() {
|
|
56
77
|
const {
|
|
57
|
-
siteConfig: {url: siteUrl},
|
|
78
|
+
siteConfig: {url: siteUrl, baseUrl, trailingSlash},
|
|
58
79
|
} = useDocusaurusContext();
|
|
80
|
+
// TODO using useLocation().pathname is not a super idea
|
|
81
|
+
// See https://github.com/facebook/docusaurus/issues/9170
|
|
59
82
|
const {pathname} = useLocation();
|
|
60
|
-
|
|
83
|
+
const canonicalPathname = applyTrailingSlash(useBaseUrl(pathname), {
|
|
84
|
+
trailingSlash,
|
|
85
|
+
baseUrl,
|
|
86
|
+
});
|
|
87
|
+
return siteUrl + canonicalPathname;
|
|
61
88
|
}
|
|
62
89
|
// TODO move to SiteMetadataDefaults or theme-common ?
|
|
63
90
|
function CanonicalUrlHeaders({permalink}) {
|
|
@@ -18,6 +18,10 @@ export default function prismIncludeLanguages(PrismObject) {
|
|
|
18
18
|
// long as you don't re-assign it
|
|
19
19
|
globalThis.Prism = PrismObject;
|
|
20
20
|
additionalLanguages.forEach((lang) => {
|
|
21
|
+
if (lang === 'php') {
|
|
22
|
+
// eslint-disable-next-line global-require
|
|
23
|
+
require('prismjs/components/prism-markup-templating.js');
|
|
24
|
+
}
|
|
21
25
|
// eslint-disable-next-line global-require, import/no-dynamic-require
|
|
22
26
|
require(`prismjs/components/prism-${lang}`);
|
|
23
27
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "3.0.0-
|
|
3
|
+
"version": "3.0.0-rc.0",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,38 +20,38 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "3.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "3.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "3.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "3.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "3.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "3.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "3.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "3.0.0-
|
|
31
|
-
"@docusaurus/types": "3.0.0-
|
|
32
|
-
"@docusaurus/utils": "3.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "3.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "3.0.0-
|
|
23
|
+
"@docusaurus/core": "3.0.0-rc.0",
|
|
24
|
+
"@docusaurus/mdx-loader": "3.0.0-rc.0",
|
|
25
|
+
"@docusaurus/module-type-aliases": "3.0.0-rc.0",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "3.0.0-rc.0",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "3.0.0-rc.0",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "3.0.0-rc.0",
|
|
29
|
+
"@docusaurus/theme-common": "3.0.0-rc.0",
|
|
30
|
+
"@docusaurus/theme-translations": "3.0.0-rc.0",
|
|
31
|
+
"@docusaurus/types": "3.0.0-rc.0",
|
|
32
|
+
"@docusaurus/utils": "3.0.0-rc.0",
|
|
33
|
+
"@docusaurus/utils-common": "3.0.0-rc.0",
|
|
34
|
+
"@docusaurus/utils-validation": "3.0.0-rc.0",
|
|
35
35
|
"@mdx-js/react": "^2.1.5",
|
|
36
36
|
"clsx": "^1.2.1",
|
|
37
|
-
"copy-text-to-clipboard": "^3.0
|
|
37
|
+
"copy-text-to-clipboard": "^3.2.0",
|
|
38
38
|
"infima": "0.2.0-alpha.43",
|
|
39
39
|
"lodash": "^4.17.21",
|
|
40
40
|
"nprogress": "^0.2.0",
|
|
41
|
-
"postcss": "^8.4.
|
|
42
|
-
"prism-react-renderer": "^1.
|
|
41
|
+
"postcss": "^8.4.26",
|
|
42
|
+
"prism-react-renderer": "^2.1.0",
|
|
43
43
|
"prismjs": "^1.29.0",
|
|
44
44
|
"react-router-dom": "^5.3.4",
|
|
45
|
-
"rtlcss": "^4.
|
|
46
|
-
"tslib": "^2.
|
|
45
|
+
"rtlcss": "^4.1.0",
|
|
46
|
+
"tslib": "^2.6.0",
|
|
47
47
|
"utility-types": "^3.10.0"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@types/mdx-js__react": "^1.5.5",
|
|
51
51
|
"@types/nprogress": "^0.2.0",
|
|
52
52
|
"@types/prismjs": "^1.26.0",
|
|
53
|
-
"@types/rtlcss": "^3.5.
|
|
54
|
-
"fs-extra": "^11.1.
|
|
53
|
+
"@types/rtlcss": "^3.5.1",
|
|
54
|
+
"fs-extra": "^11.1.1",
|
|
55
55
|
"react-test-renderer": "^18.0.0",
|
|
56
56
|
"utility-types": "^3.10.0"
|
|
57
57
|
},
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"react-dom": "^18.0.0"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
|
-
"node": ">=
|
|
63
|
+
"node": ">=18.0"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "e66dfe04d2972edce66f431908470c61340f8ffc"
|
|
66
66
|
}
|