@docusaurus/theme-classic 2.0.0-beta.1ab8aa0af → 2.0.0-beta.2

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 (217) hide show
  1. package/codeTranslations/ar.json +2 -0
  2. package/codeTranslations/base.json +4 -0
  3. package/codeTranslations/bn.json +56 -0
  4. package/codeTranslations/da.json +2 -0
  5. package/codeTranslations/de.json +2 -0
  6. package/codeTranslations/es.json +2 -0
  7. package/codeTranslations/fa.json +2 -0
  8. package/codeTranslations/fil.json +2 -0
  9. package/codeTranslations/fr.json +2 -0
  10. package/codeTranslations/he.json +18 -16
  11. package/codeTranslations/hi.json +2 -0
  12. package/codeTranslations/ja.json +2 -0
  13. package/codeTranslations/ko.json +2 -0
  14. package/codeTranslations/pl.json +2 -0
  15. package/codeTranslations/pt-BR.json +2 -0
  16. package/codeTranslations/pt-PT.json +2 -0
  17. package/codeTranslations/ru.json +2 -0
  18. package/codeTranslations/tr.json +2 -0
  19. package/codeTranslations/vi.json +2 -0
  20. package/codeTranslations/zh-Hans.json +2 -0
  21. package/codeTranslations/zh-Hant.json +2 -0
  22. package/lib/index.js +28 -7
  23. package/lib/theme/AnnouncementBar/index.js +5 -7
  24. package/lib/theme/AnnouncementBar/styles.module.css +6 -6
  25. package/lib/theme/BlogListPage/index.js +2 -2
  26. package/lib/theme/BlogListPaginator/index.js +2 -2
  27. package/lib/theme/BlogPostItem/index.js +32 -23
  28. package/lib/theme/BlogPostItem/styles.module.css +5 -1
  29. package/lib/theme/BlogPostPage/index.js +4 -10
  30. package/lib/theme/BlogPostPaginator/index.js +3 -3
  31. package/lib/theme/BlogSidebar/index.js +11 -3
  32. package/lib/theme/BlogSidebar/styles.module.css +4 -6
  33. package/lib/theme/BlogTagsListPage/index.js +15 -20
  34. package/lib/theme/BlogTagsPostsPage/index.js +29 -33
  35. package/lib/theme/CodeBlock/index.js +11 -11
  36. package/lib/theme/CodeBlock/styles.module.css +4 -7
  37. package/lib/theme/DocItem/index.js +35 -26
  38. package/lib/theme/DocItem/styles.module.css +8 -10
  39. package/lib/theme/DocPage/index.js +43 -11
  40. package/lib/theme/DocPage/styles.module.css +7 -19
  41. package/lib/theme/DocPaginator/index.js +3 -3
  42. package/lib/theme/DocSidebar/index.js +23 -24
  43. package/lib/theme/DocSidebar/styles.module.css +0 -14
  44. package/lib/theme/DocVersionBanner/index.js +128 -0
  45. package/lib/theme/DocVersionSuggestions/index.js +4 -4
  46. package/lib/theme/Heading/index.js +18 -2
  47. package/lib/theme/Heading/styles.module.css +5 -0
  48. package/lib/theme/IconArrow/index.js +1 -1
  49. package/lib/theme/IconEdit/index.js +1 -1
  50. package/lib/theme/IconExternalLink/index.js +30 -0
  51. package/lib/theme/IconExternalLink/styles.module.css +12 -0
  52. package/lib/theme/IconLanguage/index.js +1 -1
  53. package/lib/theme/IconMenu/index.js +1 -2
  54. package/lib/theme/LastUpdated/index.js +17 -21
  55. package/lib/theme/Layout/styles.css +6 -0
  56. package/lib/theme/LayoutHead/index.js +3 -1
  57. package/lib/theme/LayoutProviders/index.js +7 -5
  58. package/lib/theme/Logo/index.js +13 -12
  59. package/lib/theme/MDXComponents/index.js +2 -2
  60. package/lib/theme/MDXPage/index.js +13 -15
  61. package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
  62. package/lib/theme/Navbar/index.js +4 -4
  63. package/lib/theme/Navbar/styles.module.css +1 -1
  64. package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
  65. package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
  66. package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
  67. package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
  68. package/lib/theme/NavbarItem/index.js +1 -1
  69. package/lib/theme/NotFound.js +9 -2
  70. package/lib/theme/SearchMetadatas/index.js +1 -1
  71. package/lib/theme/Seo/index.js +0 -1
  72. package/lib/theme/SkipToContent/index.js +6 -4
  73. package/lib/theme/SkipToContent/styles.module.css +1 -3
  74. package/lib/theme/TOC/styles.module.css +1 -1
  75. package/lib/theme/Tabs/index.js +2 -2
  76. package/lib/theme/ThemedImage/index.js +2 -1
  77. package/lib/theme/ThemedImage/styles.module.css +7 -0
  78. package/lib/theme/Toggle/index.js +12 -24
  79. package/lib/theme/Toggle/styles.css +103 -0
  80. package/lib/theme/Toggle/styles.module.css +0 -97
  81. package/lib/theme/UserPreferencesProvider/index.js +1 -9
  82. package/lib/theme/hooks/useHideableNavbar.js +2 -2
  83. package/lib/theme/hooks/useTabGroupChoice.js +2 -4
  84. package/lib/theme/hooks/useThemeContext.js +1 -1
  85. package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
  86. package/lib/types.d.ts +10 -12
  87. package/lib/validateThemeConfig.js +3 -3
  88. package/lib-next/index.js +31 -8
  89. package/lib-next/theme/AnnouncementBar/index.js +5 -9
  90. package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
  91. package/lib-next/theme/BlogListPage/index.js +2 -2
  92. package/lib-next/theme/BlogPostItem/index.js +41 -24
  93. package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
  94. package/lib-next/theme/BlogPostPage/index.js +4 -8
  95. package/lib-next/theme/BlogPostPaginator/index.js +1 -1
  96. package/lib-next/theme/BlogSidebar/index.js +12 -3
  97. package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
  98. package/lib-next/theme/BlogTagsListPage/index.js +17 -23
  99. package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
  100. package/lib-next/theme/CodeBlock/index.js +10 -9
  101. package/lib-next/theme/CodeBlock/styles.module.css +4 -7
  102. package/lib-next/theme/DocItem/index.js +41 -41
  103. package/lib-next/theme/DocItem/styles.module.css +8 -10
  104. package/lib-next/theme/DocPage/index.js +36 -9
  105. package/lib-next/theme/DocPage/styles.module.css +7 -19
  106. package/lib-next/theme/DocPaginator/index.js +1 -1
  107. package/lib-next/theme/DocSidebar/index.js +28 -21
  108. package/lib-next/theme/DocSidebar/styles.module.css +0 -14
  109. package/lib-next/theme/DocVersionBanner/index.js +127 -0
  110. package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
  111. package/lib-next/theme/Heading/index.js +17 -1
  112. package/lib-next/theme/Heading/styles.module.css +5 -0
  113. package/lib-next/theme/IconArrow/index.js +1 -1
  114. package/lib-next/theme/IconEdit/index.js +3 -5
  115. package/lib-next/theme/IconExternalLink/index.js +26 -0
  116. package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
  117. package/lib-next/theme/IconLanguage/index.js +1 -1
  118. package/lib-next/theme/IconMenu/index.js +1 -4
  119. package/lib-next/theme/LastUpdated/index.js +34 -39
  120. package/lib-next/theme/Layout/styles.css +6 -0
  121. package/lib-next/theme/LayoutHead/index.js +5 -1
  122. package/lib-next/theme/LayoutProviders/index.js +11 -6
  123. package/lib-next/theme/Logo/index.js +12 -8
  124. package/lib-next/theme/MDXPage/index.js +13 -17
  125. package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
  126. package/lib-next/theme/Navbar/index.js +2 -2
  127. package/lib-next/theme/Navbar/styles.module.css +1 -1
  128. package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
  129. package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
  130. package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
  131. package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
  132. package/lib-next/theme/NavbarItem/index.js +1 -1
  133. package/lib-next/theme/NotFound.js +6 -2
  134. package/lib-next/theme/SearchMetadatas/index.js +1 -1
  135. package/lib-next/theme/Seo/index.js +0 -1
  136. package/lib-next/theme/SkipToContent/index.js +3 -3
  137. package/lib-next/theme/SkipToContent/styles.module.css +1 -3
  138. package/lib-next/theme/TOC/styles.module.css +1 -1
  139. package/lib-next/theme/ThemedImage/index.js +2 -3
  140. package/lib-next/theme/ThemedImage/styles.module.css +7 -0
  141. package/lib-next/theme/Toggle/index.js +9 -24
  142. package/lib-next/theme/Toggle/styles.css +103 -0
  143. package/lib-next/theme/Toggle/styles.module.css +0 -97
  144. package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
  145. package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
  146. package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
  147. package/lib-next/theme/hooks/useThemeContext.js +1 -1
  148. package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
  149. package/lib-next/types.d.ts +10 -12
  150. package/lib-next/validateThemeConfig.js +3 -3
  151. package/package.json +18 -17
  152. package/src/index.ts +32 -8
  153. package/src/theme/AnnouncementBar/index.tsx +6 -9
  154. package/src/theme/AnnouncementBar/styles.module.css +6 -6
  155. package/src/theme/BlogListPage/index.tsx +2 -2
  156. package/src/theme/BlogPostItem/index.tsx +40 -24
  157. package/src/theme/BlogPostItem/styles.module.css +5 -1
  158. package/src/theme/BlogPostPage/index.tsx +4 -8
  159. package/src/theme/BlogPostPaginator/index.tsx +1 -1
  160. package/src/theme/BlogSidebar/index.tsx +12 -3
  161. package/src/theme/BlogSidebar/styles.module.css +4 -6
  162. package/src/theme/BlogTagsListPage/index.tsx +17 -22
  163. package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
  164. package/src/theme/CodeBlock/index.tsx +10 -9
  165. package/src/theme/CodeBlock/styles.module.css +4 -7
  166. package/src/theme/DocItem/index.tsx +40 -40
  167. package/src/theme/DocItem/styles.module.css +8 -10
  168. package/src/theme/DocPage/index.tsx +29 -9
  169. package/src/theme/DocPage/styles.module.css +7 -19
  170. package/src/theme/DocPaginator/index.tsx +1 -1
  171. package/src/theme/DocSidebar/index.tsx +28 -21
  172. package/src/theme/DocSidebar/styles.module.css +0 -14
  173. package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
  174. package/src/theme/Heading/index.tsx +22 -1
  175. package/src/theme/Heading/styles.module.css +5 -0
  176. package/src/theme/IconArrow/index.tsx +1 -1
  177. package/src/theme/IconEdit/index.tsx +3 -5
  178. package/src/theme/IconExternalLink/index.tsx +32 -0
  179. package/src/theme/IconExternalLink/styles.module.css +12 -0
  180. package/src/theme/IconLanguage/index.tsx +1 -1
  181. package/src/theme/IconMenu/index.tsx +1 -4
  182. package/src/theme/LastUpdated/index.tsx +34 -39
  183. package/src/theme/Layout/styles.css +6 -0
  184. package/src/theme/LayoutHead/index.tsx +5 -1
  185. package/src/theme/LayoutProviders/index.tsx +11 -6
  186. package/src/theme/Logo/index.tsx +10 -6
  187. package/src/theme/MDXPage/index.tsx +14 -17
  188. package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
  189. package/src/theme/Navbar/index.tsx +2 -2
  190. package/src/theme/Navbar/styles.module.css +1 -1
  191. package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
  192. package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
  193. package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
  194. package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
  195. package/src/theme/NavbarItem/index.tsx +1 -1
  196. package/src/theme/NotFound.tsx +6 -2
  197. package/src/theme/SearchMetadatas/index.tsx +1 -1
  198. package/src/theme/Seo/index.tsx +0 -1
  199. package/src/theme/SkipToContent/index.tsx +3 -3
  200. package/src/theme/SkipToContent/styles.module.css +1 -3
  201. package/src/theme/TOC/styles.module.css +1 -1
  202. package/src/theme/ThemedImage/index.tsx +3 -3
  203. package/src/theme/ThemedImage/styles.module.css +7 -0
  204. package/src/theme/Toggle/index.tsx +9 -22
  205. package/src/theme/Toggle/styles.css +103 -0
  206. package/src/theme/Toggle/styles.module.css +0 -97
  207. package/src/theme/UserPreferencesProvider/index.tsx +0 -5
  208. package/src/theme/hooks/useHideableNavbar.ts +3 -3
  209. package/src/theme/hooks/useTabGroupChoice.ts +2 -2
  210. package/src/theme/hooks/useThemeContext.ts +1 -1
  211. package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
  212. package/src/types.d.ts +10 -12
  213. package/src/validateThemeConfig.js +3 -3
  214. package/update-code-translations.js +1 -0
  215. package/lib-next/theme/NavbarItem/styles.module.css +0 -13
  216. package/src/theme/NavbarItem/styles.module.css +0 -13
  217. package/src/theme/hooks/useAnnouncementBar.ts +0 -58
@@ -0,0 +1,103 @@
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
+ /**
9
+ * Styles for React Toggle
10
+ * copied over because we want to allow user to swizzle it and modify the css
11
+ * and also to make sure its compatible with our dark mode
12
+ * https://github.com/aaronshaf/react-toggle/blob/master/style.css
13
+ */
14
+ .react-toggle {
15
+ touch-action: pan-x;
16
+ position: relative;
17
+ cursor: pointer;
18
+ user-select: none;
19
+ -webkit-tap-highlight-color: transparent;
20
+ }
21
+
22
+ .react-toggle-screenreader-only {
23
+ border: 0;
24
+ clip: rect(0 0 0 0);
25
+ height: 1px;
26
+ margin: -1px;
27
+ overflow: hidden;
28
+ position: absolute;
29
+ width: 1px;
30
+ }
31
+
32
+ .react-toggle--disabled {
33
+ cursor: not-allowed;
34
+ }
35
+
36
+ .react-toggle-track {
37
+ width: 50px;
38
+ height: 24px;
39
+ border-radius: 30px;
40
+ background-color: #4d4d4d;
41
+ transition: all 0.2s ease;
42
+ }
43
+
44
+ .react-toggle-track-check {
45
+ position: absolute;
46
+ width: 14px;
47
+ height: 10px;
48
+ top: 0px;
49
+ bottom: 0px;
50
+ margin: auto 0;
51
+ left: 8px;
52
+ opacity: 0;
53
+ transition: opacity 0.25s ease;
54
+ }
55
+
56
+ [data-theme='dark'] .react-toggle .react-toggle-track-check,
57
+ .react-toggle--checked .react-toggle-track-check {
58
+ opacity: 1;
59
+ transition: opacity 0.25s ease;
60
+ }
61
+
62
+ .react-toggle-track-x {
63
+ position: absolute;
64
+ width: 10px;
65
+ height: 10px;
66
+ top: 0px;
67
+ bottom: 0px;
68
+ margin: auto 0;
69
+ right: 10px;
70
+ opacity: 1;
71
+ transition: opacity 0.25s ease;
72
+ }
73
+
74
+ [data-theme='dark'] .react-toggle .react-toggle-track-x,
75
+ .react-toggle--checked .react-toggle-track-x {
76
+ opacity: 0;
77
+ }
78
+
79
+ .react-toggle-thumb {
80
+ position: absolute;
81
+ top: 1px;
82
+ left: 1px;
83
+ width: 22px;
84
+ height: 22px;
85
+ border: 1px solid #4d4d4d;
86
+ border-radius: 50%;
87
+ background-color: #fafafa;
88
+ transition: all 0.25s ease;
89
+ }
90
+
91
+ [data-theme='dark'] .react-toggle .react-toggle-thumb,
92
+ .react-toggle--checked .react-toggle-thumb {
93
+ left: 27px;
94
+ }
95
+
96
+ .react-toggle--focus .react-toggle-thumb,
97
+ .react-toggle:hover .react-toggle-thumb {
98
+ box-shadow: 0px 0px 2px 3px var(--ifm-color-primary);
99
+ }
100
+
101
+ .react-toggle:active:not(.react-toggle--disabled) .react-toggle-thumb {
102
+ box-shadow: 0px 0px 5px 5px var(--ifm-color-primary);
103
+ }
@@ -15,100 +15,3 @@
15
15
  .toggle::before {
16
16
  position: absolute;
17
17
  }
18
-
19
- /**
20
- * styles for React Toggle
21
- * copied over because we want to allow user to swizzle it and modify the css
22
- * and also to make sure its compatible with our dark mode
23
- * https://github.com/aaronshaf/react-toggle/blob/master/style.css
24
- */
25
- :global(.react-toggle) {
26
- touch-action: pan-x;
27
- position: relative;
28
- cursor: pointer;
29
- user-select: none;
30
- -webkit-tap-highlight-color: transparent;
31
- }
32
-
33
- :global(.react-toggle-screenreader-only) {
34
- border: 0;
35
- clip: rect(0 0 0 0);
36
- height: 1px;
37
- margin: -1px;
38
- overflow: hidden;
39
- position: absolute;
40
- width: 1px;
41
- }
42
-
43
- :global(.react-toggle--disabled) {
44
- cursor: not-allowed;
45
- }
46
-
47
- :global(.react-toggle-track) {
48
- width: 50px;
49
- height: 24px;
50
- border-radius: 30px;
51
- background-color: #4d4d4d;
52
- transition: all 0.2s ease;
53
- }
54
-
55
- :global(.react-toggle-track-check) {
56
- position: absolute;
57
- width: 14px;
58
- height: 10px;
59
- top: 0px;
60
- bottom: 0px;
61
- margin: auto 0;
62
- left: 8px;
63
- opacity: 0;
64
- transition: opacity 0.25s ease;
65
- }
66
-
67
- :global([data-theme='dark'] .react-toggle .react-toggle-track-check),
68
- :global(.react-toggle--checked .react-toggle-track-check) {
69
- opacity: 1;
70
- transition: opacity 0.25s ease;
71
- }
72
-
73
- :global(.react-toggle-track-x) {
74
- position: absolute;
75
- width: 10px;
76
- height: 10px;
77
- top: 0px;
78
- bottom: 0px;
79
- margin: auto 0;
80
- right: 10px;
81
- opacity: 1;
82
- transition: opacity 0.25s ease;
83
- }
84
-
85
- :global([data-theme='dark'] .react-toggle .react-toggle-track-x),
86
- :global(.react-toggle--checked .react-toggle-track-x) {
87
- opacity: 0;
88
- }
89
-
90
- :global(.react-toggle-thumb) {
91
- position: absolute;
92
- top: 1px;
93
- left: 1px;
94
- width: 22px;
95
- height: 22px;
96
- border: 1px solid #4d4d4d;
97
- border-radius: 50%;
98
- background-color: #fafafa;
99
- transition: all 0.25s ease;
100
- }
101
-
102
- :global([data-theme='dark'] .react-toggle .react-toggle-thumb),
103
- :global(.react-toggle--checked .react-toggle-thumb) {
104
- left: 27px;
105
- }
106
-
107
- :global(.react-toggle--focus .react-toggle-thumb),
108
- :global(.react-toggle:hover .react-toggle-thumb) {
109
- box-shadow: 0px 0px 2px 3px var(--ifm-color-primary);
110
- }
111
-
112
- :global(.react-toggle:active:not(.react-toggle--disabled) .react-toggle-thumb) {
113
- box-shadow: 0px 0px 5px 5px var(--ifm-color-primary);
114
- }
@@ -8,21 +8,16 @@
8
8
  import React from 'react';
9
9
 
10
10
  import useTabGroupChoice from '@theme/hooks/useTabGroupChoice';
11
- import useAnnouncementBar from '@theme/hooks/useAnnouncementBar';
12
11
  import UserPreferencesContext from '@theme/UserPreferencesContext';
13
12
  import type {Props} from '@theme/UserPreferencesProvider';
14
13
 
15
14
  function UserPreferencesProvider(props: Props): JSX.Element {
16
15
  const {tabGroupChoices, setTabGroupChoices} = useTabGroupChoice();
17
- const {isAnnouncementBarClosed, closeAnnouncementBar} = useAnnouncementBar();
18
-
19
16
  return (
20
17
  <UserPreferencesContext.Provider
21
18
  value={{
22
19
  tabGroupChoices,
23
20
  setTabGroupChoices,
24
- isAnnouncementBarClosed,
25
- closeAnnouncementBar,
26
21
  }}>
27
22
  {props.children}
28
23
  </UserPreferencesContext.Provider>
@@ -8,7 +8,7 @@
8
8
  import {useState, useCallback, useEffect, useRef} from 'react';
9
9
  import {useLocation} from '@docusaurus/router';
10
10
  import useScrollPosition from '@theme/hooks/useScrollPosition';
11
- import {useChangeRoute} from '@docusaurus/theme-common';
11
+ import {useLocationChange} from '@docusaurus/theme-common';
12
12
  import type {useHideableNavbarReturns} from '@theme/hooks/useHideableNavbar';
13
13
 
14
14
  const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
@@ -56,8 +56,8 @@ const useHideableNavbar = (hideOnScroll: boolean): useHideableNavbarReturns => {
56
56
  [navbarHeight, isFocusedAnchor],
57
57
  );
58
58
 
59
- useChangeRoute(() => {
60
- if (!hideOnScroll) {
59
+ useLocationChange((locationChangeEvent) => {
60
+ if (!hideOnScroll || locationChangeEvent.location.hash) {
61
61
  return;
62
62
  }
63
63
 
@@ -22,12 +22,12 @@ const useTabGroupChoice = (): useTabGroupChoiceReturns => {
22
22
  useEffect(() => {
23
23
  try {
24
24
  const localStorageChoices = {};
25
- for (const storageKey of listStorageKeys()) {
25
+ listStorageKeys().forEach((storageKey) => {
26
26
  if (storageKey.startsWith(TAB_CHOICE_PREFIX)) {
27
27
  const groupId = storageKey.substring(TAB_CHOICE_PREFIX.length);
28
28
  localStorageChoices[groupId] = createStorageSlot(storageKey).get();
29
29
  }
30
- }
30
+ });
31
31
  setChoices(localStorageChoices);
32
32
  } catch (err) {
33
33
  console.error(err);
@@ -14,7 +14,7 @@ function useThemeContext(): ThemeContextProps {
14
14
  const context = useContext<ThemeContextProps | undefined>(ThemeContext);
15
15
  if (context == null) {
16
16
  throw new Error(
17
- '`useThemeContext` is used outside of `Layout` Component. See https://docusaurus.io/docs/api/themes/configuration#usethemecontext.',
17
+ '"useThemeContext" is used outside of "Layout" component. Please see https://docusaurus.io/docs/api/themes/configuration#usethemecontext.',
18
18
  );
19
19
  }
20
20
  return context;
@@ -16,7 +16,7 @@ function useUserPreferencesContext(): UserPreferencesContextProps {
16
16
  );
17
17
  if (context == null) {
18
18
  throw new Error(
19
- '`useUserPreferencesContext` is used outside of `Layout` Component.',
19
+ '"useUserPreferencesContext" is used outside of "Layout" component.',
20
20
  );
21
21
  }
22
22
  return context;
package/src/types.d.ts CHANGED
@@ -114,16 +114,7 @@ declare module '@theme/Heading' {
114
114
 
115
115
  const Heading: (Tag: HeadingType) => (props: Props) => JSX.Element;
116
116
  export default Heading;
117
- }
118
-
119
- declare module '@theme/hooks/useAnnouncementBar' {
120
- export type useAnnouncementBarReturns = {
121
- readonly isAnnouncementBarClosed: boolean;
122
- readonly closeAnnouncementBar: () => void;
123
- };
124
-
125
- const useAnnouncementBar: () => useAnnouncementBarReturns;
126
- export default useAnnouncementBar;
117
+ export const MainHeading: (props: Props) => JSX.Element;
127
118
  }
128
119
 
129
120
  declare module '@theme/hooks/useHideableNavbar' {
@@ -213,8 +204,6 @@ declare module '@theme/hooks/useUserPreferencesContext' {
213
204
  export type UserPreferencesContextProps = {
214
205
  tabGroupChoices: {readonly [groupId: string]: string};
215
206
  setTabGroupChoices: (groupId: string, newChoice: string) => void;
216
- isAnnouncementBarClosed: boolean;
217
- closeAnnouncementBar: () => void;
218
207
  };
219
208
 
220
209
  export default function useUserPreferencesContext(): UserPreferencesContextProps;
@@ -598,3 +587,12 @@ declare module '@theme/IconLanguage' {
598
587
  const IconLanguage: (props: Props) => JSX.Element;
599
588
  export default IconLanguage;
600
589
  }
590
+
591
+ declare module '@theme/IconExternalLink' {
592
+ import type {ComponentProps} from 'react';
593
+
594
+ export type Props = ComponentProps<'svg'>;
595
+
596
+ const IconExternalLink: (props: Props) => JSX.Element;
597
+ export default IconExternalLink;
598
+ }
@@ -50,7 +50,7 @@ const BaseNavbarItemSchema = Joi.object({
50
50
  href: URISchema,
51
51
  label: Joi.string(),
52
52
  className: Joi.string(),
53
- prependBaseUrlToHref: Joi.string(),
53
+ prependBaseUrlToHref: Joi.bool(),
54
54
  })
55
55
  // We allow any unknown attributes on the links
56
56
  // (users may need additional attributes like target, aria-role, data-customAttribute...)
@@ -250,8 +250,8 @@ const ThemeConfigSchema = Joi.object({
250
250
  announcementBar: Joi.object({
251
251
  id: Joi.string().default('announcement-bar'),
252
252
  content: Joi.string(),
253
- backgroundColor: Joi.string().default('#fff'),
254
- textColor: Joi.string().default('#000'),
253
+ backgroundColor: Joi.string(),
254
+ textColor: Joi.string(),
255
255
  isCloseable: Joi.bool().default(true),
256
256
  }).optional(),
257
257
  navbar: Joi.object({
@@ -53,6 +53,7 @@ async function extractThemeCodeMessages() {
53
53
  const {
54
54
  globSourceCodeFilePaths,
55
55
  extractAllSourceCodeFileTranslations,
56
+ // eslint-disable-next-line global-require
56
57
  } = require('@docusaurus/core/lib/server/translations/translationsExtractor');
57
58
 
58
59
  const filePaths = (
@@ -1,13 +0,0 @@
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
- @media (max-width: 996px) {
9
- .searchWrapper {
10
- position: absolute;
11
- right: var(--ifm-navbar-padding-horizontal);
12
- }
13
- }
@@ -1,13 +0,0 @@
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
- @media (max-width: 996px) {
9
- .searchWrapper {
10
- position: absolute;
11
- right: var(--ifm-navbar-padding-horizontal);
12
- }
13
- }
@@ -1,58 +0,0 @@
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 {useState, useEffect, useCallback} from 'react';
9
- import {useThemeConfig, createStorageSlot} from '@docusaurus/theme-common';
10
- import type {useAnnouncementBarReturns} from '@theme/hooks/useAnnouncementBar';
11
-
12
- const DismissStorage = createStorageSlot('docusaurus.announcement.dismiss');
13
- const IdStorage = createStorageSlot('docusaurus.announcement.id');
14
-
15
- const useAnnouncementBar = (): useAnnouncementBarReturns => {
16
- const {announcementBar} = useThemeConfig();
17
-
18
- const [isClosed, setClosed] = useState(true);
19
-
20
- const handleClose = useCallback(() => {
21
- DismissStorage.set('true');
22
- setClosed(true);
23
- }, []);
24
-
25
- useEffect(() => {
26
- if (!announcementBar) {
27
- return;
28
- }
29
- const {id} = announcementBar;
30
-
31
- let viewedId = IdStorage.get();
32
-
33
- // retrocompatibility due to spelling mistake of default id
34
- // see https://github.com/facebook/docusaurus/issues/3338
35
- if (viewedId === 'annoucement-bar') {
36
- viewedId = 'announcement-bar';
37
- }
38
-
39
- const isNewAnnouncement = id !== viewedId;
40
-
41
- IdStorage.set(id);
42
-
43
- if (isNewAnnouncement) {
44
- DismissStorage.set('false');
45
- }
46
-
47
- if (isNewAnnouncement || DismissStorage.get() === 'false') {
48
- setClosed(false);
49
- }
50
- }, []);
51
-
52
- return {
53
- isAnnouncementBarClosed: isClosed,
54
- closeAnnouncementBar: handleClose,
55
- };
56
- };
57
-
58
- export default useAnnouncementBar;