@docusaurus/theme-classic 0.0.0-5284 → 0.0.0-5294
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 +127 -1
- package/lib/theme/Admonition/Icon/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Caution.js +17 -0
- package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Danger.js +17 -0
- package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Info.js +17 -0
- package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Note.js +17 -0
- package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Icon/Tip.js +17 -0
- package/lib/theme/Admonition/Layout/index.d.ts +9 -0
- package/lib/theme/Admonition/Layout/index.js +43 -0
- package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
- package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
- package/lib/theme/Admonition/Type/Caution.js +32 -0
- package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
- package/lib/theme/Admonition/Type/Danger.js +32 -0
- package/lib/theme/Admonition/Type/Info.d.ts +9 -0
- package/lib/theme/Admonition/Type/Info.js +32 -0
- package/lib/theme/Admonition/Type/Note.d.ts +9 -0
- package/lib/theme/Admonition/Type/Note.js +32 -0
- package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
- package/lib/theme/Admonition/Type/Tip.js +32 -0
- package/lib/theme/Admonition/Types.d.ts +12 -0
- package/lib/theme/Admonition/Types.js +33 -0
- package/lib/theme/Admonition/index.d.ts +1 -1
- package/lib/theme/Admonition/index.js +12 -171
- package/package.json +14 -14
- package/src/getSwizzleConfig.ts +138 -1
- package/src/theme/Admonition/Icon/Caution.tsx +20 -0
- package/src/theme/Admonition/Icon/Danger.tsx +20 -0
- package/src/theme/Admonition/Icon/Info.tsx +20 -0
- package/src/theme/Admonition/Icon/Note.tsx +20 -0
- package/src/theme/Admonition/Icon/Tip.tsx +20 -0
- package/src/theme/Admonition/Layout/index.tsx +55 -0
- package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +0 -0
- package/src/theme/Admonition/Type/Caution.tsx +37 -0
- package/src/theme/Admonition/Type/Danger.tsx +37 -0
- package/src/theme/Admonition/Type/Info.tsx +37 -0
- package/src/theme/Admonition/Type/Note.tsx +37 -0
- package/src/theme/Admonition/Type/Tip.tsx +37 -0
- package/src/theme/Admonition/Types.tsx +38 -0
- package/src/theme/Admonition/index.tsx +13 -194
- package/src/theme-classic.d.ts +102 -1
|
@@ -5,179 +5,20 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
<svg viewBox="0 0 14 16">
|
|
15
|
-
<path
|
|
16
|
-
fillRule="evenodd"
|
|
17
|
-
d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"
|
|
18
|
-
/>
|
|
19
|
-
</svg>
|
|
20
|
-
);
|
|
21
|
-
}
|
|
22
|
-
function TipIcon() {
|
|
23
|
-
return (
|
|
24
|
-
<svg viewBox="0 0 12 16">
|
|
25
|
-
<path
|
|
26
|
-
fillRule="evenodd"
|
|
27
|
-
d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"
|
|
28
|
-
/>
|
|
29
|
-
</svg>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
function DangerIcon() {
|
|
33
|
-
return (
|
|
34
|
-
<svg viewBox="0 0 12 16">
|
|
35
|
-
<path
|
|
36
|
-
fillRule="evenodd"
|
|
37
|
-
d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"
|
|
38
|
-
/>
|
|
39
|
-
</svg>
|
|
40
|
-
);
|
|
41
|
-
}
|
|
42
|
-
function InfoIcon() {
|
|
43
|
-
return (
|
|
44
|
-
<svg viewBox="0 0 14 16">
|
|
45
|
-
<path
|
|
46
|
-
fillRule="evenodd"
|
|
47
|
-
d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"
|
|
48
|
-
/>
|
|
49
|
-
</svg>
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
function CautionIcon() {
|
|
53
|
-
return (
|
|
54
|
-
<svg viewBox="0 0 16 16">
|
|
55
|
-
<path
|
|
56
|
-
fillRule="evenodd"
|
|
57
|
-
d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"
|
|
58
|
-
/>
|
|
59
|
-
</svg>
|
|
60
|
-
);
|
|
61
|
-
}
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style
|
|
63
|
-
const AdmonitionConfigs = {
|
|
64
|
-
note: {
|
|
65
|
-
infimaClassName: 'secondary',
|
|
66
|
-
iconComponent: NoteIcon,
|
|
67
|
-
label: (
|
|
68
|
-
<Translate
|
|
69
|
-
id="theme.admonition.note"
|
|
70
|
-
description="The default label used for the Note admonition (:::note)">
|
|
71
|
-
note
|
|
72
|
-
</Translate>
|
|
73
|
-
),
|
|
74
|
-
},
|
|
75
|
-
tip: {
|
|
76
|
-
infimaClassName: 'success',
|
|
77
|
-
iconComponent: TipIcon,
|
|
78
|
-
label: (
|
|
79
|
-
<Translate
|
|
80
|
-
id="theme.admonition.tip"
|
|
81
|
-
description="The default label used for the Tip admonition (:::tip)">
|
|
82
|
-
tip
|
|
83
|
-
</Translate>
|
|
84
|
-
),
|
|
85
|
-
},
|
|
86
|
-
danger: {
|
|
87
|
-
infimaClassName: 'danger',
|
|
88
|
-
iconComponent: DangerIcon,
|
|
89
|
-
label: (
|
|
90
|
-
<Translate
|
|
91
|
-
id="theme.admonition.danger"
|
|
92
|
-
description="The default label used for the Danger admonition (:::danger)">
|
|
93
|
-
danger
|
|
94
|
-
</Translate>
|
|
95
|
-
),
|
|
96
|
-
},
|
|
97
|
-
info: {
|
|
98
|
-
infimaClassName: 'info',
|
|
99
|
-
iconComponent: InfoIcon,
|
|
100
|
-
label: (
|
|
101
|
-
<Translate
|
|
102
|
-
id="theme.admonition.info"
|
|
103
|
-
description="The default label used for the Info admonition (:::info)">
|
|
104
|
-
info
|
|
105
|
-
</Translate>
|
|
106
|
-
),
|
|
107
|
-
},
|
|
108
|
-
caution: {
|
|
109
|
-
infimaClassName: 'warning',
|
|
110
|
-
iconComponent: CautionIcon,
|
|
111
|
-
label: (
|
|
112
|
-
<Translate
|
|
113
|
-
id="theme.admonition.caution"
|
|
114
|
-
description="The default label used for the Caution admonition (:::caution)">
|
|
115
|
-
caution
|
|
116
|
-
</Translate>
|
|
117
|
-
),
|
|
118
|
-
},
|
|
119
|
-
};
|
|
120
|
-
// Legacy aliases, undocumented but kept for retro-compatibility
|
|
121
|
-
const aliases = {
|
|
122
|
-
secondary: 'note',
|
|
123
|
-
important: 'info',
|
|
124
|
-
success: 'tip',
|
|
125
|
-
warning: 'danger',
|
|
126
|
-
};
|
|
127
|
-
function getAdmonitionConfig(unsafeType) {
|
|
128
|
-
const type = aliases[unsafeType] ?? unsafeType;
|
|
129
|
-
const config = AdmonitionConfigs[type];
|
|
130
|
-
if (config) {
|
|
131
|
-
return config;
|
|
8
|
+
import {processAdmonitionProps} from '@docusaurus/theme-common';
|
|
9
|
+
import AdmonitionTypes from '@theme/Admonition/Types';
|
|
10
|
+
function getAdmonitionTypeComponent(type) {
|
|
11
|
+
const component = AdmonitionTypes[type];
|
|
12
|
+
if (component) {
|
|
13
|
+
return component;
|
|
132
14
|
}
|
|
133
15
|
console.warn(
|
|
134
|
-
`No admonition
|
|
16
|
+
`No admonition component found for admonition type "${type}". Using Info as fallback.`,
|
|
135
17
|
);
|
|
136
|
-
return
|
|
18
|
+
return AdmonitionTypes.info;
|
|
137
19
|
}
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
const mdxAdmonitionTitle = items.find(
|
|
143
|
-
(item) =>
|
|
144
|
-
React.isValidElement(item) &&
|
|
145
|
-
item.props?.mdxType === 'mdxAdmonitionTitle',
|
|
146
|
-
);
|
|
147
|
-
const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}</>;
|
|
148
|
-
return {
|
|
149
|
-
mdxAdmonitionTitle,
|
|
150
|
-
rest,
|
|
151
|
-
};
|
|
152
|
-
}
|
|
153
|
-
function processAdmonitionProps(props) {
|
|
154
|
-
const {mdxAdmonitionTitle, rest} = extractMDXAdmonitionTitle(props.children);
|
|
155
|
-
return {
|
|
156
|
-
...props,
|
|
157
|
-
title: props.title ?? mdxAdmonitionTitle,
|
|
158
|
-
children: rest,
|
|
159
|
-
};
|
|
160
|
-
}
|
|
161
|
-
export default function Admonition(props) {
|
|
162
|
-
const {children, type, title, icon: iconProp} = processAdmonitionProps(props);
|
|
163
|
-
const typeConfig = getAdmonitionConfig(type);
|
|
164
|
-
const titleLabel = title ?? typeConfig.label;
|
|
165
|
-
const {iconComponent: IconComponent} = typeConfig;
|
|
166
|
-
const icon = iconProp ?? <IconComponent />;
|
|
167
|
-
return (
|
|
168
|
-
<div
|
|
169
|
-
className={clsx(
|
|
170
|
-
ThemeClassNames.common.admonition,
|
|
171
|
-
ThemeClassNames.common.admonitionType(props.type),
|
|
172
|
-
'alert',
|
|
173
|
-
`alert--${typeConfig.infimaClassName}`,
|
|
174
|
-
styles.admonition,
|
|
175
|
-
)}>
|
|
176
|
-
<div className={styles.admonitionHeading}>
|
|
177
|
-
<span className={styles.admonitionIcon}>{icon}</span>
|
|
178
|
-
{titleLabel}
|
|
179
|
-
</div>
|
|
180
|
-
<div className={styles.admonitionContent}>{children}</div>
|
|
181
|
-
</div>
|
|
182
|
-
);
|
|
20
|
+
export default function Admonition(unprocessedProps) {
|
|
21
|
+
const props = processAdmonitionProps(unprocessedProps);
|
|
22
|
+
const AdmonitionTypeComponent = getAdmonitionTypeComponent(props.type);
|
|
23
|
+
return <AdmonitionTypeComponent {...props} />;
|
|
183
24
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/theme-classic",
|
|
3
|
-
"version": "0.0.0-
|
|
3
|
+
"version": "0.0.0-5294",
|
|
4
4
|
"description": "Classic theme for Docusaurus",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "src/theme-classic.d.ts",
|
|
@@ -20,18 +20,18 @@
|
|
|
20
20
|
"copy:watch": "node ../../admin/scripts/copyUntypedFiles.js --watch"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@docusaurus/core": "0.0.0-
|
|
24
|
-
"@docusaurus/mdx-loader": "0.0.0-
|
|
25
|
-
"@docusaurus/module-type-aliases": "0.0.0-
|
|
26
|
-
"@docusaurus/plugin-content-blog": "0.0.0-
|
|
27
|
-
"@docusaurus/plugin-content-docs": "0.0.0-
|
|
28
|
-
"@docusaurus/plugin-content-pages": "0.0.0-
|
|
29
|
-
"@docusaurus/theme-common": "0.0.0-
|
|
30
|
-
"@docusaurus/theme-translations": "0.0.0-
|
|
31
|
-
"@docusaurus/types": "0.0.0-
|
|
32
|
-
"@docusaurus/utils": "0.0.0-
|
|
33
|
-
"@docusaurus/utils-common": "0.0.0-
|
|
34
|
-
"@docusaurus/utils-validation": "0.0.0-
|
|
23
|
+
"@docusaurus/core": "0.0.0-5294",
|
|
24
|
+
"@docusaurus/mdx-loader": "0.0.0-5294",
|
|
25
|
+
"@docusaurus/module-type-aliases": "0.0.0-5294",
|
|
26
|
+
"@docusaurus/plugin-content-blog": "0.0.0-5294",
|
|
27
|
+
"@docusaurus/plugin-content-docs": "0.0.0-5294",
|
|
28
|
+
"@docusaurus/plugin-content-pages": "0.0.0-5294",
|
|
29
|
+
"@docusaurus/theme-common": "0.0.0-5294",
|
|
30
|
+
"@docusaurus/theme-translations": "0.0.0-5294",
|
|
31
|
+
"@docusaurus/types": "0.0.0-5294",
|
|
32
|
+
"@docusaurus/utils": "0.0.0-5294",
|
|
33
|
+
"@docusaurus/utils-common": "0.0.0-5294",
|
|
34
|
+
"@docusaurus/utils-validation": "0.0.0-5294",
|
|
35
35
|
"@mdx-js/react": "^1.6.22",
|
|
36
36
|
"clsx": "^1.2.1",
|
|
37
37
|
"copy-text-to-clipboard": "^3.0.1",
|
|
@@ -62,5 +62,5 @@
|
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=16.14"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "861e02b4ccbdf0729b71d5ede9b2c41c2712a20b"
|
|
66
66
|
}
|
package/src/getSwizzleConfig.ts
CHANGED
|
@@ -12,6 +12,113 @@ import type {SwizzleConfig} from '@docusaurus/types';
|
|
|
12
12
|
export default function getSwizzleConfig(): SwizzleConfig {
|
|
13
13
|
return {
|
|
14
14
|
components: {
|
|
15
|
+
'Admonition/Icon': {
|
|
16
|
+
actions: {
|
|
17
|
+
eject: 'safe',
|
|
18
|
+
wrap: 'forbidden', // Can't wrap a folder
|
|
19
|
+
},
|
|
20
|
+
description: 'The folder containing all admonition icons',
|
|
21
|
+
},
|
|
22
|
+
'Admonition/Icon/Caution': {
|
|
23
|
+
actions: {
|
|
24
|
+
eject: 'safe',
|
|
25
|
+
wrap: 'safe',
|
|
26
|
+
},
|
|
27
|
+
description: 'The admonition caution icon',
|
|
28
|
+
},
|
|
29
|
+
'Admonition/Icon/Danger': {
|
|
30
|
+
actions: {
|
|
31
|
+
eject: 'safe',
|
|
32
|
+
wrap: 'safe',
|
|
33
|
+
},
|
|
34
|
+
description: 'The admonition danger icon',
|
|
35
|
+
},
|
|
36
|
+
'Admonition/Icon/Info': {
|
|
37
|
+
actions: {
|
|
38
|
+
eject: 'safe',
|
|
39
|
+
wrap: 'safe',
|
|
40
|
+
},
|
|
41
|
+
description: 'The admonition info icon',
|
|
42
|
+
},
|
|
43
|
+
'Admonition/Icon/Note': {
|
|
44
|
+
actions: {
|
|
45
|
+
eject: 'safe',
|
|
46
|
+
wrap: 'safe',
|
|
47
|
+
},
|
|
48
|
+
description: 'The admonition note icon',
|
|
49
|
+
},
|
|
50
|
+
'Admonition/Icon/Tip': {
|
|
51
|
+
actions: {
|
|
52
|
+
eject: 'safe',
|
|
53
|
+
wrap: 'safe',
|
|
54
|
+
},
|
|
55
|
+
description: 'The admonition tip icon',
|
|
56
|
+
},
|
|
57
|
+
'Admonition/Layout': {
|
|
58
|
+
actions: {
|
|
59
|
+
eject: 'safe',
|
|
60
|
+
wrap: 'safe',
|
|
61
|
+
},
|
|
62
|
+
description:
|
|
63
|
+
'The standard admonition layout applied to all default admonition types',
|
|
64
|
+
},
|
|
65
|
+
'Admonition/Type': {
|
|
66
|
+
actions: {
|
|
67
|
+
eject: 'safe',
|
|
68
|
+
wrap: 'forbidden',
|
|
69
|
+
},
|
|
70
|
+
description:
|
|
71
|
+
'The folder containing all the admonition type components.',
|
|
72
|
+
},
|
|
73
|
+
'Admonition/Type/Caution': {
|
|
74
|
+
actions: {
|
|
75
|
+
eject: 'safe',
|
|
76
|
+
wrap: 'safe',
|
|
77
|
+
},
|
|
78
|
+
description:
|
|
79
|
+
'The component responsible for rendering a :::caution admonition type',
|
|
80
|
+
},
|
|
81
|
+
'Admonition/Type/Danger': {
|
|
82
|
+
actions: {
|
|
83
|
+
eject: 'safe',
|
|
84
|
+
wrap: 'safe',
|
|
85
|
+
},
|
|
86
|
+
description:
|
|
87
|
+
'The component responsible for rendering a :::danger admonition type',
|
|
88
|
+
},
|
|
89
|
+
'Admonition/Type/Info': {
|
|
90
|
+
actions: {
|
|
91
|
+
eject: 'safe',
|
|
92
|
+
wrap: 'safe',
|
|
93
|
+
},
|
|
94
|
+
description:
|
|
95
|
+
'The component responsible for rendering a :::info admonition type',
|
|
96
|
+
},
|
|
97
|
+
'Admonition/Type/Note': {
|
|
98
|
+
actions: {
|
|
99
|
+
eject: 'safe',
|
|
100
|
+
wrap: 'safe',
|
|
101
|
+
},
|
|
102
|
+
description:
|
|
103
|
+
'The component responsible for rendering a :::note admonition type',
|
|
104
|
+
},
|
|
105
|
+
'Admonition/Type/Tip': {
|
|
106
|
+
actions: {
|
|
107
|
+
eject: 'safe',
|
|
108
|
+
wrap: 'safe',
|
|
109
|
+
},
|
|
110
|
+
description:
|
|
111
|
+
'The component responsible for rendering a :::tip admonition type',
|
|
112
|
+
},
|
|
113
|
+
'Admonition/Types': {
|
|
114
|
+
actions: {
|
|
115
|
+
eject: 'safe',
|
|
116
|
+
// TODO the swizzle CLI should provide a way to wrap such objects
|
|
117
|
+
wrap: 'forbidden',
|
|
118
|
+
},
|
|
119
|
+
description:
|
|
120
|
+
'The object mapping admonition type to a React component.\nUse it to add custom admonition type components, or replace existing ones.\nCan be ejected or wrapped (only manually, see our documentation).',
|
|
121
|
+
},
|
|
15
122
|
CodeBlock: {
|
|
16
123
|
actions: {
|
|
17
124
|
eject: 'safe',
|
|
@@ -20,6 +127,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
20
127
|
description:
|
|
21
128
|
'The component used to render multi-line code blocks, generally used in Markdown files.',
|
|
22
129
|
},
|
|
130
|
+
'CodeBlock/Content': {
|
|
131
|
+
actions: {
|
|
132
|
+
eject: 'unsafe',
|
|
133
|
+
wrap: 'forbidden',
|
|
134
|
+
},
|
|
135
|
+
description:
|
|
136
|
+
'The folder containing components responsible for rendering different types of CodeBlock content.',
|
|
137
|
+
},
|
|
23
138
|
ColorModeToggle: {
|
|
24
139
|
actions: {
|
|
25
140
|
eject: 'safe',
|
|
@@ -36,6 +151,17 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
36
151
|
description:
|
|
37
152
|
'The component responsible for rendering a list of sidebar items cards.\nNotable used on the category generated-index pages.',
|
|
38
153
|
},
|
|
154
|
+
'DocItem/TOC': {
|
|
155
|
+
actions: {
|
|
156
|
+
// Forbidden because it's a parent folder, makes the CLI crash atm
|
|
157
|
+
// TODO the CLI should rather support --eject
|
|
158
|
+
// Subfolders can be swizzled
|
|
159
|
+
eject: 'forbidden',
|
|
160
|
+
wrap: 'forbidden',
|
|
161
|
+
},
|
|
162
|
+
description:
|
|
163
|
+
'The DocItem TOC is not directly swizzle-able, but you can swizzle its sub-components.',
|
|
164
|
+
},
|
|
39
165
|
DocSidebar: {
|
|
40
166
|
actions: {
|
|
41
167
|
eject: 'unsafe', // Too much technical code in sidebar, not very safe atm
|
|
@@ -101,6 +227,17 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
101
227
|
},
|
|
102
228
|
description: 'The footer logo',
|
|
103
229
|
},
|
|
230
|
+
Icon: {
|
|
231
|
+
actions: {
|
|
232
|
+
// Forbidden because it's a parent folder, makes the CLI crash atm
|
|
233
|
+
// TODO the CLI should rather support --eject
|
|
234
|
+
// Subfolders can be swizzled
|
|
235
|
+
eject: 'forbidden',
|
|
236
|
+
wrap: 'forbidden',
|
|
237
|
+
},
|
|
238
|
+
description:
|
|
239
|
+
'The Icon folder is not directly swizzle-able, but you can swizzle its sub-components.',
|
|
240
|
+
},
|
|
104
241
|
'Icon/Arrow': {
|
|
105
242
|
actions: {
|
|
106
243
|
eject: 'safe',
|
|
@@ -220,7 +357,7 @@ export default function getSwizzleConfig(): SwizzleConfig {
|
|
|
220
357
|
wrap: 'forbidden',
|
|
221
358
|
},
|
|
222
359
|
description:
|
|
223
|
-
'The Navbar item components mapping. Can be ejected to add custom navbar item types
|
|
360
|
+
'The Navbar item components mapping. Can be ejected to add custom navbar item types.\nSee https://github.com/facebook/docusaurus/issues/7227.',
|
|
224
361
|
},
|
|
225
362
|
NotFound: {
|
|
226
363
|
actions: {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Admonition/Icon/Caution';
|
|
10
|
+
|
|
11
|
+
export default function AdmonitionIconCaution(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 16 16" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
d="M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Admonition/Icon/Danger';
|
|
10
|
+
|
|
11
|
+
export default function AdmonitionIconDanger(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 12 16" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
d="M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Admonition/Icon/Info';
|
|
10
|
+
|
|
11
|
+
export default function AdmonitionIconInfo(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 14 16" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Admonition/Icon/Note';
|
|
10
|
+
|
|
11
|
+
export default function AdmonitionIconNote(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 14 16" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
d="M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import type {Props} from '@theme/Admonition/Icon/Tip';
|
|
10
|
+
|
|
11
|
+
export default function AdmonitionIconTip(props: Props): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<svg viewBox="0 0 12 16" {...props}>
|
|
14
|
+
<path
|
|
15
|
+
fillRule="evenodd"
|
|
16
|
+
d="M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"
|
|
17
|
+
/>
|
|
18
|
+
</svg>
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React, {type ReactNode} from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import {ThemeClassNames} from '@docusaurus/theme-common';
|
|
11
|
+
|
|
12
|
+
import type {Props} from '@theme/Admonition/Layout';
|
|
13
|
+
|
|
14
|
+
import styles from './styles.module.css';
|
|
15
|
+
|
|
16
|
+
function AdmonitionContainer({
|
|
17
|
+
type,
|
|
18
|
+
className,
|
|
19
|
+
children,
|
|
20
|
+
}: Pick<Props, 'type' | 'className'> & {children: ReactNode}) {
|
|
21
|
+
return (
|
|
22
|
+
<div
|
|
23
|
+
className={clsx(
|
|
24
|
+
ThemeClassNames.common.admonition,
|
|
25
|
+
ThemeClassNames.common.admonitionType(type),
|
|
26
|
+
styles.admonition,
|
|
27
|
+
className,
|
|
28
|
+
)}>
|
|
29
|
+
{children}
|
|
30
|
+
</div>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function AdmonitionHeading({icon, title}: Pick<Props, 'icon' | 'title'>) {
|
|
35
|
+
return (
|
|
36
|
+
<div className={styles.admonitionHeading}>
|
|
37
|
+
<span className={styles.admonitionIcon}>{icon}</span>
|
|
38
|
+
{title}
|
|
39
|
+
</div>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
function AdmonitionContent({children}: Pick<Props, 'children'>) {
|
|
44
|
+
return <div className={styles.admonitionContent}>{children}</div>;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export default function AdmonitionLayout(props: Props): JSX.Element {
|
|
48
|
+
const {type, icon, title, children, className} = props;
|
|
49
|
+
return (
|
|
50
|
+
<AdmonitionContainer type={type} className={className}>
|
|
51
|
+
<AdmonitionHeading title={title} icon={icon} />
|
|
52
|
+
<AdmonitionContent>{children}</AdmonitionContent>
|
|
53
|
+
</AdmonitionContainer>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
File without changes
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import type {Props} from '@theme/Admonition/Type/Caution';
|
|
12
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
13
|
+
import IconCaution from '@theme/Admonition/Icon/Caution';
|
|
14
|
+
|
|
15
|
+
const infimaClassName = 'alert alert--warning';
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
icon: <IconCaution />,
|
|
19
|
+
title: (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.admonition.caution"
|
|
22
|
+
description="The default label used for the Caution admonition (:::caution)">
|
|
23
|
+
caution
|
|
24
|
+
</Translate>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function AdmonitionTypeCaution(props: Props): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<AdmonitionLayout
|
|
31
|
+
{...defaultProps}
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(infimaClassName, props.className)}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</AdmonitionLayout>
|
|
36
|
+
);
|
|
37
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import clsx from 'clsx';
|
|
10
|
+
import Translate from '@docusaurus/Translate';
|
|
11
|
+
import type {Props} from '@theme/Admonition/Type/Danger';
|
|
12
|
+
import AdmonitionLayout from '@theme/Admonition/Layout';
|
|
13
|
+
import IconDanger from '@theme/Admonition/Icon/Danger';
|
|
14
|
+
|
|
15
|
+
const infimaClassName = 'alert alert--danger';
|
|
16
|
+
|
|
17
|
+
const defaultProps = {
|
|
18
|
+
icon: <IconDanger />,
|
|
19
|
+
title: (
|
|
20
|
+
<Translate
|
|
21
|
+
id="theme.admonition.danger"
|
|
22
|
+
description="The default label used for the Danger admonition (:::danger)">
|
|
23
|
+
danger
|
|
24
|
+
</Translate>
|
|
25
|
+
),
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export default function AdmonitionTypeDanger(props: Props): JSX.Element {
|
|
29
|
+
return (
|
|
30
|
+
<AdmonitionLayout
|
|
31
|
+
{...defaultProps}
|
|
32
|
+
{...props}
|
|
33
|
+
className={clsx(infimaClassName, props.className)}>
|
|
34
|
+
{props.children}
|
|
35
|
+
</AdmonitionLayout>
|
|
36
|
+
);
|
|
37
|
+
}
|