@docusaurus/theme-classic 0.0.0-5672 → 0.0.0-5674

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.
@@ -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',
@@ -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/Caution';
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 IconCaution from '@theme/Admonition/Icon/Caution';
11
+ import IconWarning from '@theme/Admonition/Icon/Warning';
12
12
  const infimaClassName = 'alert alert--warning';
13
13
  const defaultProps = {
14
- icon: <IconCaution />,
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
@@ -0,0 +1,9 @@
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
+ /// <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 AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
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
- caution: AdmonitionTypeCaution,
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
- // TODO bad legacy mapping, warning is usually yellow, not red...
28
- warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
28
+ caution: AdmonitionTypeCaution,
29
29
  };
30
30
  export default {
31
31
  ...admonitionTypes,
@@ -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.unversionedId}`;
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}>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-5672",
3
+ "version": "0.0.0-5674",
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-5672",
24
- "@docusaurus/mdx-loader": "0.0.0-5672",
25
- "@docusaurus/module-type-aliases": "0.0.0-5672",
26
- "@docusaurus/plugin-content-blog": "0.0.0-5672",
27
- "@docusaurus/plugin-content-docs": "0.0.0-5672",
28
- "@docusaurus/plugin-content-pages": "0.0.0-5672",
29
- "@docusaurus/theme-common": "0.0.0-5672",
30
- "@docusaurus/theme-translations": "0.0.0-5672",
31
- "@docusaurus/types": "0.0.0-5672",
32
- "@docusaurus/utils": "0.0.0-5672",
33
- "@docusaurus/utils-common": "0.0.0-5672",
34
- "@docusaurus/utils-validation": "0.0.0-5672",
23
+ "@docusaurus/core": "0.0.0-5674",
24
+ "@docusaurus/mdx-loader": "0.0.0-5674",
25
+ "@docusaurus/module-type-aliases": "0.0.0-5674",
26
+ "@docusaurus/plugin-content-blog": "0.0.0-5674",
27
+ "@docusaurus/plugin-content-docs": "0.0.0-5674",
28
+ "@docusaurus/plugin-content-pages": "0.0.0-5674",
29
+ "@docusaurus/theme-common": "0.0.0-5674",
30
+ "@docusaurus/theme-translations": "0.0.0-5674",
31
+ "@docusaurus/types": "0.0.0-5674",
32
+ "@docusaurus/utils": "0.0.0-5674",
33
+ "@docusaurus/utils-common": "0.0.0-5674",
34
+ "@docusaurus/utils-validation": "0.0.0-5674",
35
35
  "@mdx-js/react": "^2.1.5",
36
36
  "clsx": "^1.2.1",
37
37
  "copy-text-to-clipboard": "^3.2.0",
@@ -62,5 +62,5 @@
62
62
  "engines": {
63
63
  "node": ">=16.14"
64
64
  },
65
- "gitHead": "3726adfbc29ac19b70f66caaaa070c778477ed07"
65
+ "gitHead": "4e0c8bb939a109eea6e299c14421f80f283cad13"
66
66
  }
@@ -19,13 +19,6 @@ export default function getSwizzleConfig(): SwizzleConfig {
19
19
  },
20
20
  description: 'The folder containing all admonition icons',
21
21
  },
22
- 'Admonition/Icon/Caution': {
23
- actions: {
24
- eject: 'safe',
25
- wrap: 'safe',
26
- },
27
- description: 'The admonition caution icon',
28
- },
29
22
  'Admonition/Icon/Danger': {
30
23
  actions: {
31
24
  eject: 'safe',
@@ -54,6 +47,13 @@ export default function getSwizzleConfig(): SwizzleConfig {
54
47
  },
55
48
  description: 'The admonition tip icon',
56
49
  },
50
+ 'Admonition/Icon/Warning': {
51
+ actions: {
52
+ eject: 'safe',
53
+ wrap: 'safe',
54
+ },
55
+ description: 'The admonition warning icon',
56
+ },
57
57
  'Admonition/Layout': {
58
58
  actions: {
59
59
  eject: 'safe',
@@ -110,6 +110,14 @@ export default function getSwizzleConfig(): SwizzleConfig {
110
110
  description:
111
111
  'The component responsible for rendering a :::tip admonition type',
112
112
  },
113
+ 'Admonition/Type/Warning': {
114
+ actions: {
115
+ eject: 'safe',
116
+ wrap: 'safe',
117
+ },
118
+ description:
119
+ 'The component responsible for rendering a :::warning admonition type',
120
+ },
113
121
  'Admonition/Types': {
114
122
  actions: {
115
123
  eject: 'safe',
@@ -6,7 +6,7 @@
6
6
  */
7
7
 
8
8
  import React from 'react';
9
- import type {Props} from '@theme/Admonition/Icon/Caution';
9
+ import type {Props} from '@theme/Admonition/Icon/Warning';
10
10
 
11
11
  export default function AdmonitionIconCaution(props: Props): JSX.Element {
12
12
  return (
@@ -10,12 +10,12 @@ import clsx from 'clsx';
10
10
  import Translate from '@docusaurus/Translate';
11
11
  import type {Props} from '@theme/Admonition/Type/Caution';
12
12
  import AdmonitionLayout from '@theme/Admonition/Layout';
13
- import IconCaution from '@theme/Admonition/Icon/Caution';
13
+ import IconWarning from '@theme/Admonition/Icon/Warning';
14
14
 
15
15
  const infimaClassName = 'alert alert--warning';
16
16
 
17
17
  const defaultProps = {
18
- icon: <IconCaution />,
18
+ icon: <IconWarning />,
19
19
  title: (
20
20
  <Translate
21
21
  id="theme.admonition.caution"
@@ -25,6 +25,8 @@ const defaultProps = {
25
25
  ),
26
26
  };
27
27
 
28
+ // TODO remove before v4: Caution replaced by Warning
29
+ // see https://github.com/facebook/docusaurus/issues/7558
28
30
  export default function AdmonitionTypeCaution(props: Props): JSX.Element {
29
31
  return (
30
32
  <AdmonitionLayout
@@ -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/Warning';
12
+ import AdmonitionLayout from '@theme/Admonition/Layout';
13
+ import IconWarning from '@theme/Admonition/Icon/Warning';
14
+
15
+ const infimaClassName = 'alert alert--warning';
16
+
17
+ const defaultProps = {
18
+ icon: <IconWarning />,
19
+ title: (
20
+ <Translate
21
+ id="theme.admonition.warning"
22
+ description="The default label used for the Warning admonition (:::warning)">
23
+ warning
24
+ </Translate>
25
+ ),
26
+ };
27
+
28
+ export default function AdmonitionTypeWarning(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
+ }
@@ -9,15 +9,16 @@ import React from 'react';
9
9
  import AdmonitionTypeNote from '@theme/Admonition/Type/Note';
10
10
  import AdmonitionTypeTip from '@theme/Admonition/Type/Tip';
11
11
  import AdmonitionTypeInfo from '@theme/Admonition/Type/Info';
12
- import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
12
+ import AdmonitionTypeWarning from '@theme/Admonition/Type/Warning';
13
13
  import AdmonitionTypeDanger from '@theme/Admonition/Type/Danger';
14
+ import AdmonitionTypeCaution from '@theme/Admonition/Type/Caution';
14
15
  import type AdmonitionTypes from '@theme/Admonition/Types';
15
16
 
16
17
  const admonitionTypes: typeof AdmonitionTypes = {
17
18
  note: AdmonitionTypeNote,
18
19
  tip: AdmonitionTypeTip,
19
20
  info: AdmonitionTypeInfo,
20
- caution: AdmonitionTypeCaution,
21
+ warning: AdmonitionTypeWarning,
21
22
  danger: AdmonitionTypeDanger,
22
23
  };
23
24
 
@@ -28,8 +29,7 @@ const admonitionAliases: typeof AdmonitionTypes = {
28
29
  secondary: (props) => <AdmonitionTypeNote title="secondary" {...props} />,
29
30
  important: (props) => <AdmonitionTypeInfo title="important" {...props} />,
30
31
  success: (props) => <AdmonitionTypeTip title="success" {...props} />,
31
- // TODO bad legacy mapping, warning is usually yellow, not red...
32
- warning: (props) => <AdmonitionTypeDanger title="warning" {...props} />,
32
+ caution: AdmonitionTypeCaution,
33
33
  };
34
34
 
35
35
  export default {
@@ -13,7 +13,7 @@ import DocItemLayout from '@theme/DocItem/Layout';
13
13
  import type {Props} from '@theme/DocItem';
14
14
 
15
15
  export default function DocItem(props: Props): JSX.Element {
16
- const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
16
+ const docHtmlClassName = `docs-doc-id-${props.content.metadata.id}`;
17
17
  const MDXComponent = props.content;
18
18
  return (
19
19
  <DocProvider content={props.content}>
@@ -74,6 +74,8 @@ declare module '@theme/Admonition/Type/Tip' {
74
74
  export default function AdmonitionTypeTip(props: Props): JSX.Element;
75
75
  }
76
76
 
77
+ // TODO remove before v4: Caution replaced by Warning
78
+ // see https://github.com/facebook/docusaurus/issues/7558
77
79
  declare module '@theme/Admonition/Type/Caution' {
78
80
  import type {Props as AdmonitionProps} from '@theme/Admonition';
79
81
 
@@ -81,6 +83,13 @@ declare module '@theme/Admonition/Type/Caution' {
81
83
  export default function AdmonitionTypeCaution(props: Props): JSX.Element;
82
84
  }
83
85
 
86
+ declare module '@theme/Admonition/Type/Warning' {
87
+ import type {Props as AdmonitionProps} from '@theme/Admonition';
88
+
89
+ export interface Props extends AdmonitionProps {}
90
+ export default function AdmonitionTypeWarning(props: Props): JSX.Element;
91
+ }
92
+
84
93
  declare module '@theme/Admonition/Type/Danger' {
85
94
  import type {Props as AdmonitionProps} from '@theme/Admonition';
86
95
 
@@ -128,12 +137,12 @@ declare module '@theme/Admonition/Icon/Tip' {
128
137
  export default function AdmonitionIconTip(props: Props): JSX.Element;
129
138
  }
130
139
 
131
- declare module '@theme/Admonition/Icon/Caution' {
140
+ declare module '@theme/Admonition/Icon/Warning' {
132
141
  import type {ComponentProps} from 'react';
133
142
 
134
143
  export interface Props extends ComponentProps<'svg'> {}
135
144
 
136
- export default function AdmonitionIconCaution(props: Props): JSX.Element;
145
+ export default function AdmonitionIconWarning(props: Props): JSX.Element;
137
146
  }
138
147
 
139
148
  declare module '@theme/Admonition/Icon/Danger' {