@docusaurus/theme-classic 2.4.1 → 3.0.0-beta.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.
Files changed (174) hide show
  1. package/lib/getSwizzleConfig.js +107 -8
  2. package/lib/index.js +20 -6
  3. package/lib/nprogress.d.ts +1 -1
  4. package/lib/options.js +6 -2
  5. package/lib/theme/Admonition/Icon/Danger.d.ts +9 -0
  6. package/lib/theme/Admonition/Icon/Danger.js +17 -0
  7. package/lib/theme/Admonition/Icon/Info.d.ts +9 -0
  8. package/lib/theme/Admonition/Icon/Info.js +17 -0
  9. package/lib/theme/Admonition/Icon/Note.d.ts +9 -0
  10. package/lib/theme/Admonition/Icon/Note.js +17 -0
  11. package/lib/theme/Admonition/Icon/Tip.d.ts +9 -0
  12. package/lib/theme/Admonition/Icon/Tip.js +17 -0
  13. package/lib/theme/Admonition/Icon/Warning.d.ts +9 -0
  14. package/lib/theme/Admonition/Icon/Warning.js +17 -0
  15. package/lib/theme/Admonition/Layout/index.d.ts +9 -0
  16. package/lib/theme/Admonition/Layout/index.js +45 -0
  17. package/lib/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
  18. package/lib/theme/Admonition/Type/Caution.d.ts +9 -0
  19. package/lib/theme/Admonition/Type/Caution.js +34 -0
  20. package/lib/theme/Admonition/Type/Danger.d.ts +9 -0
  21. package/lib/theme/Admonition/Type/Danger.js +32 -0
  22. package/lib/theme/Admonition/Type/Info.d.ts +9 -0
  23. package/lib/theme/Admonition/Type/Info.js +32 -0
  24. package/lib/theme/Admonition/Type/Note.d.ts +9 -0
  25. package/lib/theme/Admonition/Type/Note.js +32 -0
  26. package/lib/theme/Admonition/Type/Tip.d.ts +9 -0
  27. package/lib/theme/Admonition/Type/Tip.js +32 -0
  28. package/lib/theme/Admonition/Type/Warning.d.ts +9 -0
  29. package/lib/theme/Admonition/Type/Warning.js +32 -0
  30. package/lib/theme/Admonition/Types.d.ts +12 -0
  31. package/lib/theme/Admonition/Types.js +33 -0
  32. package/lib/theme/Admonition/index.d.ts +1 -1
  33. package/lib/theme/Admonition/index.js +12 -171
  34. package/lib/theme/BlogArchivePage/index.js +7 -2
  35. package/lib/theme/BlogLayout/index.js +1 -1
  36. package/lib/theme/BlogPostItem/Container/index.js +12 -3
  37. package/lib/theme/BlogPostItem/Header/Author/index.js +6 -1
  38. package/lib/theme/BlogPostPage/index.js +3 -1
  39. package/lib/theme/BlogSidebar/Desktop/index.js +3 -1
  40. package/lib/theme/BlogSidebar/Mobile/index.js +3 -1
  41. package/lib/theme/BlogTagsListPage/index.js +2 -1
  42. package/lib/theme/BlogTagsPostsPage/index.js +4 -2
  43. package/lib/theme/CodeBlock/Content/String.js +9 -2
  44. package/lib/theme/CodeBlock/CopyButton/index.js +0 -1
  45. package/lib/theme/DocBreadcrumbs/index.js +6 -2
  46. package/lib/theme/DocCard/index.js +8 -4
  47. package/lib/theme/DocItem/Layout/index.js +5 -0
  48. package/lib/theme/DocItem/index.js +1 -1
  49. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.d.ts +2 -2
  50. package/lib/theme/{DocPage → DocRoot}/Layout/Main/index.js +1 -1
  51. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.d.ts +2 -2
  52. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.js +1 -1
  53. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.d.ts +2 -2
  54. package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/index.js +2 -2
  55. package/lib/theme/{DocPage → DocRoot}/Layout/index.d.ts +2 -2
  56. package/lib/theme/{DocPage → DocRoot}/Layout/index.js +9 -10
  57. package/lib/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
  58. package/lib/theme/{DocPage → DocRoot}/index.d.ts +2 -2
  59. package/lib/theme/DocRoot/index.js +31 -0
  60. package/lib/theme/DocSidebar/Desktop/index.d.ts +1 -1
  61. package/lib/theme/DocSidebar/Mobile/index.d.ts +1 -1
  62. package/lib/theme/DocSidebarItem/Category/index.js +24 -13
  63. package/lib/theme/DocSidebarItems/index.js +6 -4
  64. package/lib/theme/DocTagDocListPage/index.d.ts +1 -1
  65. package/lib/theme/DocTagDocListPage/index.js +53 -39
  66. package/lib/theme/DocTagsListPage/index.d.ts +1 -1
  67. package/lib/theme/DocTagsListPage/index.js +26 -17
  68. package/lib/theme/DocVersionRoot/index.d.ts +10 -0
  69. package/lib/theme/DocVersionRoot/index.js +46 -0
  70. package/lib/theme/DocsRoot/index.d.ts +10 -0
  71. package/lib/theme/DocsRoot/index.js +18 -0
  72. package/lib/theme/EditThisPage/index.js +3 -6
  73. package/lib/theme/ErrorPageContent.js +3 -2
  74. package/lib/theme/MDXComponents/Code.js +2 -36
  75. package/lib/theme/MDXComponents/Details.js +1 -1
  76. package/lib/theme/MDXComponents/Pre.d.ts +2 -2
  77. package/lib/theme/MDXComponents/Pre.js +4 -11
  78. package/lib/theme/MDXComponents/Ul/index.js +4 -0
  79. package/lib/theme/MDXComponents/index.js +4 -3
  80. package/lib/theme/MDXPage/index.js +16 -4
  81. package/lib/theme/NavbarItem/DocNavbarItem.js +4 -3
  82. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.d.ts +1 -1
  83. package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/index.js +2 -1
  84. package/lib/theme/NotFound/Content/index.d.ts +9 -0
  85. package/lib/theme/NotFound/Content/index.js +42 -0
  86. package/lib/theme/{NotFound.d.ts → NotFound/index.d.ts} +1 -1
  87. package/lib/theme/NotFound/index.js +25 -0
  88. package/lib/theme/SiteMetadata/index.js +30 -3
  89. package/lib/theme/TOCItems/Tree.js +3 -4
  90. package/lib/theme/Tabs/index.js +4 -2
  91. package/lib/theme/TagsListByLetter/index.js +4 -1
  92. package/lib/theme/ThemedImage/index.js +8 -24
  93. package/lib/theme/{MDXComponents/Head.d.ts → Unlisted/index.d.ts} +2 -2
  94. package/lib/theme/Unlisted/index.js +38 -0
  95. package/package.json +26 -26
  96. package/src/getSwizzleConfig.ts +116 -9
  97. package/src/index.ts +21 -6
  98. package/src/nprogress.ts +2 -1
  99. package/src/options.ts +7 -2
  100. package/src/theme/Admonition/Icon/Danger.tsx +20 -0
  101. package/src/theme/Admonition/Icon/Info.tsx +20 -0
  102. package/src/theme/Admonition/Icon/Note.tsx +20 -0
  103. package/src/theme/Admonition/Icon/Tip.tsx +20 -0
  104. package/src/theme/Admonition/Icon/Warning.tsx +20 -0
  105. package/src/theme/Admonition/Layout/index.tsx +57 -0
  106. package/src/theme/Admonition/{styles.module.css → Layout/styles.module.css} +4 -0
  107. package/src/theme/Admonition/Type/Caution.tsx +39 -0
  108. package/src/theme/Admonition/Type/Danger.tsx +37 -0
  109. package/src/theme/Admonition/Type/Info.tsx +37 -0
  110. package/src/theme/Admonition/Type/Note.tsx +37 -0
  111. package/src/theme/Admonition/Type/Tip.tsx +37 -0
  112. package/src/theme/Admonition/Type/Warning.tsx +37 -0
  113. package/src/theme/Admonition/Types.tsx +38 -0
  114. package/src/theme/Admonition/index.tsx +13 -194
  115. package/src/theme/BlogArchivePage/index.tsx +7 -2
  116. package/src/theme/BlogLayout/index.tsx +1 -1
  117. package/src/theme/BlogPostItem/Container/index.tsx +12 -3
  118. package/src/theme/BlogPostItem/Header/Author/index.tsx +6 -1
  119. package/src/theme/BlogPostPage/index.tsx +3 -1
  120. package/src/theme/BlogSidebar/Desktop/index.tsx +3 -1
  121. package/src/theme/BlogSidebar/Mobile/index.tsx +3 -1
  122. package/src/theme/BlogTagsListPage/index.tsx +2 -1
  123. package/src/theme/BlogTagsPostsPage/index.tsx +4 -2
  124. package/src/theme/CodeBlock/Content/String.tsx +11 -2
  125. package/src/theme/CodeBlock/CopyButton/index.tsx +0 -1
  126. package/src/theme/DocBreadcrumbs/index.tsx +6 -2
  127. package/src/theme/DocCard/index.tsx +11 -6
  128. package/src/theme/DocItem/Layout/index.tsx +5 -0
  129. package/src/theme/DocItem/index.tsx +1 -1
  130. package/src/theme/{DocPage → DocRoot}/Layout/Main/index.tsx +2 -2
  131. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/index.tsx +2 -2
  132. package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/index.tsx +3 -3
  133. package/src/theme/{DocPage → DocRoot}/Layout/index.tsx +10 -11
  134. package/src/theme/{DocPage → DocRoot}/Layout/styles.module.css +1 -2
  135. package/src/theme/DocRoot/index.tsx +34 -0
  136. package/src/theme/DocSidebarItem/Category/index.tsx +25 -12
  137. package/src/theme/DocSidebarItems/index.tsx +6 -4
  138. package/src/theme/DocTagDocListPage/index.tsx +60 -39
  139. package/src/theme/DocTagsListPage/index.tsx +33 -17
  140. package/src/theme/DocVersionRoot/index.tsx +51 -0
  141. package/src/theme/DocsRoot/index.tsx +22 -0
  142. package/src/theme/EditThisPage/index.tsx +3 -6
  143. package/src/theme/ErrorPageContent.tsx +3 -2
  144. package/src/theme/MDXComponents/Code.tsx +2 -39
  145. package/src/theme/MDXComponents/Details.tsx +1 -2
  146. package/src/theme/MDXComponents/Pre.tsx +5 -13
  147. package/src/theme/MDXComponents/Ul/index.tsx +5 -1
  148. package/src/theme/MDXComponents/index.tsx +11 -10
  149. package/src/theme/MDXPage/index.tsx +16 -4
  150. package/src/theme/NavbarItem/DocNavbarItem.tsx +4 -3
  151. package/src/theme/NavbarItem/LocaleDropdownNavbarItem/index.tsx +2 -1
  152. package/src/theme/NotFound/Content/index.tsx +45 -0
  153. package/src/theme/NotFound/index.tsx +27 -0
  154. package/src/theme/SiteMetadata/index.tsx +36 -3
  155. package/src/theme/SkipToContent/index.tsx +0 -1
  156. package/src/theme/TOCItems/Tree.tsx +3 -4
  157. package/src/theme/Tabs/index.tsx +4 -2
  158. package/src/theme/TagsListByLetter/index.tsx +4 -2
  159. package/src/theme/ThemedImage/index.tsx +8 -31
  160. package/src/theme/Unlisted/index.tsx +42 -0
  161. package/src/theme/prism-include-languages.ts +2 -1
  162. package/src/theme-classic.d.ts +146 -21
  163. package/lib/theme/DocPage/index.js +0 -67
  164. package/lib/theme/MDXComponents/Head.js +0 -23
  165. package/lib/theme/NotFound.js +0 -52
  166. package/src/theme/DocPage/index.tsx +0 -71
  167. package/src/theme/MDXComponents/Head.tsx +0 -29
  168. package/src/theme/NotFound.tsx +0 -54
  169. /package/lib/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  170. /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  171. /package/lib/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
  172. /package/src/theme/{DocPage → DocRoot}/Layout/Main/styles.module.css +0 -0
  173. /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/ExpandButton/styles.module.css +0 -0
  174. /package/src/theme/{DocPage → DocRoot}/Layout/Sidebar/styles.module.css +0 -0
@@ -10,6 +10,112 @@ Object.defineProperty(exports, "__esModule", { value: true });
10
10
  function getSwizzleConfig() {
11
11
  return {
12
12
  components: {
13
+ 'Admonition/Icon': {
14
+ actions: {
15
+ eject: 'safe',
16
+ wrap: 'forbidden', // Can't wrap a folder
17
+ },
18
+ description: 'The folder containing all admonition icons',
19
+ },
20
+ 'Admonition/Icon/Danger': {
21
+ actions: {
22
+ eject: 'safe',
23
+ wrap: 'safe',
24
+ },
25
+ description: 'The admonition danger icon',
26
+ },
27
+ 'Admonition/Icon/Info': {
28
+ actions: {
29
+ eject: 'safe',
30
+ wrap: 'safe',
31
+ },
32
+ description: 'The admonition info icon',
33
+ },
34
+ 'Admonition/Icon/Note': {
35
+ actions: {
36
+ eject: 'safe',
37
+ wrap: 'safe',
38
+ },
39
+ description: 'The admonition note icon',
40
+ },
41
+ 'Admonition/Icon/Tip': {
42
+ actions: {
43
+ eject: 'safe',
44
+ wrap: 'safe',
45
+ },
46
+ description: 'The admonition tip icon',
47
+ },
48
+ 'Admonition/Icon/Warning': {
49
+ actions: {
50
+ eject: 'safe',
51
+ wrap: 'safe',
52
+ },
53
+ description: 'The admonition warning icon',
54
+ },
55
+ 'Admonition/Layout': {
56
+ actions: {
57
+ eject: 'safe',
58
+ wrap: 'safe',
59
+ },
60
+ description: 'The standard admonition layout applied to all default admonition types',
61
+ },
62
+ 'Admonition/Type': {
63
+ actions: {
64
+ eject: 'safe',
65
+ wrap: 'forbidden',
66
+ },
67
+ description: 'The folder containing all the admonition type components.',
68
+ },
69
+ 'Admonition/Type/Caution': {
70
+ actions: {
71
+ eject: 'safe',
72
+ wrap: 'safe',
73
+ },
74
+ description: 'The component responsible for rendering a :::caution admonition type',
75
+ },
76
+ 'Admonition/Type/Danger': {
77
+ actions: {
78
+ eject: 'safe',
79
+ wrap: 'safe',
80
+ },
81
+ description: 'The component responsible for rendering a :::danger admonition type',
82
+ },
83
+ 'Admonition/Type/Info': {
84
+ actions: {
85
+ eject: 'safe',
86
+ wrap: 'safe',
87
+ },
88
+ description: 'The component responsible for rendering a :::info admonition type',
89
+ },
90
+ 'Admonition/Type/Note': {
91
+ actions: {
92
+ eject: 'safe',
93
+ wrap: 'safe',
94
+ },
95
+ description: 'The component responsible for rendering a :::note admonition type',
96
+ },
97
+ 'Admonition/Type/Tip': {
98
+ actions: {
99
+ eject: 'safe',
100
+ wrap: 'safe',
101
+ },
102
+ description: 'The component responsible for rendering a :::tip admonition type',
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
+ },
111
+ 'Admonition/Types': {
112
+ actions: {
113
+ eject: 'safe',
114
+ // TODO the swizzle CLI should provide a way to wrap such objects
115
+ wrap: 'forbidden',
116
+ },
117
+ description: '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).',
118
+ },
13
119
  CodeBlock: {
14
120
  actions: {
15
121
  eject: 'safe',
@@ -67,7 +173,7 @@ function getSwizzleConfig() {
67
173
  eject: 'safe',
68
174
  wrap: 'safe',
69
175
  },
70
- description: "The footer component of you site's layout",
176
+ description: "The footer component of your site's layout",
71
177
  },
72
178
  'Footer/Copyright': {
73
179
  actions: {
@@ -191,13 +297,6 @@ function getSwizzleConfig() {
191
297
  },
192
298
  description: 'The component used to render <details> tags in MDX',
193
299
  },
194
- 'MDXComponents/Head': {
195
- actions: {
196
- eject: 'forbidden',
197
- wrap: 'forbidden',
198
- },
199
- description: 'Technical component used to assign metadata (generally for SEO purpose) to the current MDX document',
200
- },
201
300
  'MDXComponents/Heading': {
202
301
  actions: {
203
302
  eject: 'safe',
package/lib/index.js CHANGED
@@ -18,7 +18,10 @@ const ContextReplacementPlugin = requireFromDocusaurusCore('webpack/lib/ContextR
18
18
  // Need to be inlined to prevent dark mode FOUC
19
19
  // Make sure the key is the same as the one in `/theme/hooks/useTheme.js`
20
20
  const ThemeStorageKey = 'theme';
21
+ // Support for ?docusaurus-theme=dark
21
22
  const ThemeQueryStringKey = 'docusaurus-theme';
23
+ // Support for ?docusaurus-data-mode=embed&docusaurus-data-myAttr=42
24
+ const DataQueryStringPrefixKey = 'docusaurus-data-';
22
25
  const noFlashColorMode = ({ defaultMode, respectPrefersColorScheme, }) =>
23
26
  /* language=js */
24
27
  `(function() {
@@ -30,19 +33,15 @@ const noFlashColorMode = ({ defaultMode, respectPrefersColorScheme, }) =>
30
33
  }
31
34
 
32
35
  function getQueryStringTheme() {
33
- var theme = null;
34
36
  try {
35
- theme = new URLSearchParams(window.location.search).get('${ThemeQueryStringKey}')
37
+ return new URLSearchParams(window.location.search).get('${ThemeQueryStringKey}')
36
38
  } catch(e) {}
37
- return theme;
38
39
  }
39
40
 
40
41
  function getStoredTheme() {
41
- var theme = null;
42
42
  try {
43
- theme = localStorage.getItem('${ThemeStorageKey}');
43
+ return localStorage.getItem('${ThemeStorageKey}');
44
44
  } catch (err) {}
45
- return theme;
46
45
  }
47
46
 
48
47
  var initialTheme = getQueryStringTheme() || getStoredTheme();
@@ -64,6 +63,20 @@ const noFlashColorMode = ({ defaultMode, respectPrefersColorScheme, }) =>
64
63
  }
65
64
  }
66
65
  })();`;
66
+ /* language=js */
67
+ const DataAttributeQueryStringInlineJavaScript = `
68
+ (function() {
69
+ try {
70
+ const entries = new URLSearchParams(window.location.search).entries();
71
+ for (var [searchKey, value] of entries) {
72
+ if (searchKey.startsWith('${DataQueryStringPrefixKey}')) {
73
+ var key = searchKey.replace('${DataQueryStringPrefixKey}',"data-")
74
+ document.documentElement.setAttribute(key, value);
75
+ }
76
+ }
77
+ } catch(e) {}
78
+ })();
79
+ `;
67
80
  // Duplicated constant. Unfortunately we can't import it from theme-common, as
68
81
  // we need to support older nodejs versions without ESM support
69
82
  // TODO: import from theme-common once we only support Node.js with ESM support
@@ -159,6 +172,7 @@ function themeClassic(context, options) {
159
172
  tagName: 'script',
160
173
  innerHTML: `
161
174
  ${noFlashColorMode(colorMode)}
175
+ ${DataAttributeQueryStringInlineJavaScript}
162
176
  ${announcementBar ? AnnouncementBarInlineJavaScript : ''}
163
177
  `,
164
178
  },
@@ -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 './nprogress.css';
8
7
  import type { ClientModule } from '@docusaurus/types';
8
+ import './nprogress.css';
9
9
  declare const clientModule: ClientModule;
10
10
  export default clientModule;
package/lib/options.js CHANGED
@@ -174,6 +174,7 @@ const LocaleDropdownNavbarItemSchema = NavbarItemBaseSchema.append({
174
174
  type: utils_validation_1.Joi.string().equal('localeDropdown').required(),
175
175
  dropdownItemsBefore: utils_validation_1.Joi.array().items(DropdownSubitemSchema).default([]),
176
176
  dropdownItemsAfter: utils_validation_1.Joi.array().items(DropdownSubitemSchema).default([]),
177
+ queryString: utils_validation_1.Joi.string(),
177
178
  });
178
179
  const SearchItemSchema = utils_validation_1.Joi.object({
179
180
  type: utils_validation_1.Joi.string().equal('search').required(),
@@ -276,6 +277,9 @@ const LogoSchema = utils_validation_1.Joi.object({
276
277
  style: utils_validation_1.Joi.object(),
277
278
  className: utils_validation_1.Joi.string(),
278
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());
279
283
  exports.ThemeConfigSchema = utils_validation_1.Joi.object({
280
284
  // TODO temporary (@alpha-58)
281
285
  // @ts-expect-error: forbidden
@@ -340,9 +344,9 @@ exports.ThemeConfigSchema = utils_validation_1.Joi.object({
340
344
  plain: utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.array(), utils_validation_1.Joi.object()).required(),
341
345
  styles: utils_validation_1.Joi.alternatives().try(utils_validation_1.Joi.array(), utils_validation_1.Joi.object()).required(),
342
346
  }),
343
- defaultLanguage: utils_validation_1.Joi.string(),
347
+ defaultLanguage: PrismLanguage,
344
348
  additionalLanguages: utils_validation_1.Joi.array()
345
- .items(utils_validation_1.Joi.string())
349
+ .items(PrismLanguage)
346
350
  .default(exports.DEFAULT_CONFIG.prism.additionalLanguages),
347
351
  magicComments: utils_validation_1.Joi.array()
348
352
  .items(utils_validation_1.Joi.object({
@@ -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/Icon/Danger';
9
+ export default function AdmonitionIconDanger(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ export default function AdmonitionIconDanger(props) {
9
+ return (
10
+ <svg viewBox="0 0 12 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -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/Icon/Info';
9
+ export default function AdmonitionIconInfo(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ export default function AdmonitionIconInfo(props) {
9
+ return (
10
+ <svg viewBox="0 0 14 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -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/Icon/Note';
9
+ export default function AdmonitionIconNote(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ export default function AdmonitionIconNote(props) {
9
+ return (
10
+ <svg viewBox="0 0 14 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -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/Icon/Tip';
9
+ export default function AdmonitionIconTip(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ export default function AdmonitionIconTip(props) {
9
+ return (
10
+ <svg viewBox="0 0 12 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -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/Icon/Warning';
9
+ export default function AdmonitionIconCaution(props: Props): JSX.Element;
@@ -0,0 +1,17 @@
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
+ export default function AdmonitionIconCaution(props) {
9
+ return (
10
+ <svg viewBox="0 0 16 16" {...props}>
11
+ <path
12
+ fillRule="evenodd"
13
+ 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"
14
+ />
15
+ </svg>
16
+ );
17
+ }
@@ -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/Layout';
9
+ export default function AdmonitionLayout(props: Props): JSX.Element;
@@ -0,0 +1,45 @@
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 {ThemeClassNames} from '@docusaurus/theme-common';
10
+ import styles from './styles.module.css';
11
+ function AdmonitionContainer({type, className, children}) {
12
+ return (
13
+ <div
14
+ className={clsx(
15
+ ThemeClassNames.common.admonition,
16
+ ThemeClassNames.common.admonitionType(type),
17
+ styles.admonition,
18
+ className,
19
+ )}>
20
+ {children}
21
+ </div>
22
+ );
23
+ }
24
+ function AdmonitionHeading({icon, title}) {
25
+ return (
26
+ <div className={styles.admonitionHeading}>
27
+ <span className={styles.admonitionIcon}>{icon}</span>
28
+ {title}
29
+ </div>
30
+ );
31
+ }
32
+ function AdmonitionContent({children}) {
33
+ return children ? (
34
+ <div className={styles.admonitionContent}>{children}</div>
35
+ ) : null;
36
+ }
37
+ export default function AdmonitionLayout(props) {
38
+ const {type, icon, title, children, className} = props;
39
+ return (
40
+ <AdmonitionContainer type={type} className={className}>
41
+ <AdmonitionHeading title={title} icon={icon} />
42
+ <AdmonitionContent>{children}</AdmonitionContent>
43
+ </AdmonitionContainer>
44
+ );
45
+ }
@@ -13,6 +13,10 @@
13
13
  font: var(--ifm-heading-font-weight) var(--ifm-h5-font-size) /
14
14
  var(--ifm-heading-line-height) var(--ifm-heading-font-family);
15
15
  text-transform: uppercase;
16
+ }
17
+
18
+ /* Heading alone without content (does not handle fragment content) */
19
+ .admonitionHeading:not(:last-child) {
16
20
  margin-bottom: 0.3rem;
17
21
  }
18
22
 
@@ -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/Caution';
9
+ export default function AdmonitionTypeCaution(props: Props): JSX.Element;
@@ -0,0 +1,34 @@
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.caution"
18
+ description="The default label used for the Caution admonition (:::caution)">
19
+ caution
20
+ </Translate>
21
+ ),
22
+ };
23
+ // TODO remove before v4: Caution replaced by Warning
24
+ // see https://github.com/facebook/docusaurus/issues/7558
25
+ export default function AdmonitionTypeCaution(props) {
26
+ return (
27
+ <AdmonitionLayout
28
+ {...defaultProps}
29
+ {...props}
30
+ className={clsx(infimaClassName, props.className)}>
31
+ {props.children}
32
+ </AdmonitionLayout>
33
+ );
34
+ }
@@ -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/Danger';
9
+ export default function AdmonitionTypeDanger(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 IconDanger from '@theme/Admonition/Icon/Danger';
12
+ const infimaClassName = 'alert alert--danger';
13
+ const defaultProps = {
14
+ icon: <IconDanger />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.danger"
18
+ description="The default label used for the Danger admonition (:::danger)">
19
+ danger
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeDanger(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -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/Info';
9
+ export default function AdmonitionTypeInfo(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 IconInfo from '@theme/Admonition/Icon/Info';
12
+ const infimaClassName = 'alert alert--info';
13
+ const defaultProps = {
14
+ icon: <IconInfo />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.info"
18
+ description="The default label used for the Info admonition (:::info)">
19
+ info
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeInfo(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -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/Note';
9
+ export default function AdmonitionTypeNote(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 IconNote from '@theme/Admonition/Icon/Note';
12
+ const infimaClassName = 'alert alert--secondary';
13
+ const defaultProps = {
14
+ icon: <IconNote />,
15
+ title: (
16
+ <Translate
17
+ id="theme.admonition.note"
18
+ description="The default label used for the Note admonition (:::note)">
19
+ note
20
+ </Translate>
21
+ ),
22
+ };
23
+ export default function AdmonitionTypeNote(props) {
24
+ return (
25
+ <AdmonitionLayout
26
+ {...defaultProps}
27
+ {...props}
28
+ className={clsx(infimaClassName, props.className)}>
29
+ {props.children}
30
+ </AdmonitionLayout>
31
+ );
32
+ }
@@ -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/Tip';
9
+ export default function AdmonitionTypeTip(props: Props): JSX.Element;