@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.
- package/codeTranslations/ar.json +2 -0
- package/codeTranslations/base.json +4 -0
- package/codeTranslations/bn.json +56 -0
- package/codeTranslations/da.json +2 -0
- package/codeTranslations/de.json +2 -0
- package/codeTranslations/es.json +2 -0
- package/codeTranslations/fa.json +2 -0
- package/codeTranslations/fil.json +2 -0
- package/codeTranslations/fr.json +2 -0
- package/codeTranslations/he.json +18 -16
- package/codeTranslations/hi.json +2 -0
- package/codeTranslations/ja.json +2 -0
- package/codeTranslations/ko.json +2 -0
- package/codeTranslations/pl.json +2 -0
- package/codeTranslations/pt-BR.json +2 -0
- package/codeTranslations/pt-PT.json +2 -0
- package/codeTranslations/ru.json +2 -0
- package/codeTranslations/tr.json +2 -0
- package/codeTranslations/vi.json +2 -0
- package/codeTranslations/zh-Hans.json +2 -0
- package/codeTranslations/zh-Hant.json +2 -0
- package/lib/index.js +28 -7
- package/lib/theme/AnnouncementBar/index.js +5 -7
- package/lib/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib/theme/BlogListPage/index.js +2 -2
- package/lib/theme/BlogListPaginator/index.js +2 -2
- package/lib/theme/BlogPostItem/index.js +32 -23
- package/lib/theme/BlogPostItem/styles.module.css +5 -1
- package/lib/theme/BlogPostPage/index.js +4 -10
- package/lib/theme/BlogPostPaginator/index.js +3 -3
- package/lib/theme/BlogSidebar/index.js +11 -3
- package/lib/theme/BlogSidebar/styles.module.css +4 -6
- package/lib/theme/BlogTagsListPage/index.js +15 -20
- package/lib/theme/BlogTagsPostsPage/index.js +29 -33
- package/lib/theme/CodeBlock/index.js +11 -11
- package/lib/theme/CodeBlock/styles.module.css +4 -7
- package/lib/theme/DocItem/index.js +35 -26
- package/lib/theme/DocItem/styles.module.css +8 -10
- package/lib/theme/DocPage/index.js +43 -11
- package/lib/theme/DocPage/styles.module.css +7 -19
- package/lib/theme/DocPaginator/index.js +3 -3
- package/lib/theme/DocSidebar/index.js +23 -24
- package/lib/theme/DocSidebar/styles.module.css +0 -14
- package/lib/theme/DocVersionBanner/index.js +128 -0
- package/lib/theme/DocVersionSuggestions/index.js +4 -4
- package/lib/theme/Heading/index.js +18 -2
- package/lib/theme/Heading/styles.module.css +5 -0
- package/lib/theme/IconArrow/index.js +1 -1
- package/lib/theme/IconEdit/index.js +1 -1
- package/lib/theme/IconExternalLink/index.js +30 -0
- package/lib/theme/IconExternalLink/styles.module.css +12 -0
- package/lib/theme/IconLanguage/index.js +1 -1
- package/lib/theme/IconMenu/index.js +1 -2
- package/lib/theme/LastUpdated/index.js +17 -21
- package/lib/theme/Layout/styles.css +6 -0
- package/lib/theme/LayoutHead/index.js +3 -1
- package/lib/theme/LayoutProviders/index.js +7 -5
- package/lib/theme/Logo/index.js +13 -12
- package/lib/theme/MDXComponents/index.js +2 -2
- package/lib/theme/MDXPage/index.js +13 -15
- package/{src/theme/LastUpdated → lib/theme/MDXPage}/styles.module.css +2 -2
- package/lib/theme/Navbar/index.js +4 -4
- package/lib/theme/Navbar/styles.module.css +1 -1
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +18 -4
- package/lib/theme/NavbarItem/DocNavbarItem.js +19 -11
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +5 -4
- package/lib/theme/NavbarItem/SearchNavbarItem.js +1 -5
- package/lib/theme/NavbarItem/index.js +1 -1
- package/lib/theme/NotFound.js +9 -2
- package/lib/theme/SearchMetadatas/index.js +1 -1
- package/lib/theme/Seo/index.js +0 -1
- package/lib/theme/SkipToContent/index.js +6 -4
- package/lib/theme/SkipToContent/styles.module.css +1 -3
- package/lib/theme/TOC/styles.module.css +1 -1
- package/lib/theme/Tabs/index.js +2 -2
- package/lib/theme/ThemedImage/index.js +2 -1
- package/lib/theme/ThemedImage/styles.module.css +7 -0
- package/lib/theme/Toggle/index.js +12 -24
- package/lib/theme/Toggle/styles.css +103 -0
- package/lib/theme/Toggle/styles.module.css +0 -97
- package/lib/theme/UserPreferencesProvider/index.js +1 -9
- package/lib/theme/hooks/useHideableNavbar.js +2 -2
- package/lib/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib/theme/hooks/useThemeContext.js +1 -1
- package/lib/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib/types.d.ts +10 -12
- package/lib/validateThemeConfig.js +3 -3
- package/lib-next/index.js +31 -8
- package/lib-next/theme/AnnouncementBar/index.js +5 -9
- package/lib-next/theme/AnnouncementBar/styles.module.css +6 -6
- package/lib-next/theme/BlogListPage/index.js +2 -2
- package/lib-next/theme/BlogPostItem/index.js +41 -24
- package/lib-next/theme/BlogPostItem/styles.module.css +5 -1
- package/lib-next/theme/BlogPostPage/index.js +4 -8
- package/lib-next/theme/BlogPostPaginator/index.js +1 -1
- package/lib-next/theme/BlogSidebar/index.js +12 -3
- package/lib-next/theme/BlogSidebar/styles.module.css +4 -6
- package/lib-next/theme/BlogTagsListPage/index.js +17 -23
- package/lib-next/theme/BlogTagsPostsPage/index.js +36 -40
- package/lib-next/theme/CodeBlock/index.js +10 -9
- package/lib-next/theme/CodeBlock/styles.module.css +4 -7
- package/lib-next/theme/DocItem/index.js +41 -41
- package/lib-next/theme/DocItem/styles.module.css +8 -10
- package/lib-next/theme/DocPage/index.js +36 -9
- package/lib-next/theme/DocPage/styles.module.css +7 -19
- package/lib-next/theme/DocPaginator/index.js +1 -1
- package/lib-next/theme/DocSidebar/index.js +28 -21
- package/lib-next/theme/DocSidebar/styles.module.css +0 -14
- package/lib-next/theme/DocVersionBanner/index.js +127 -0
- package/lib-next/theme/DocVersionSuggestions/index.js +4 -4
- package/lib-next/theme/Heading/index.js +17 -1
- package/lib-next/theme/Heading/styles.module.css +5 -0
- package/lib-next/theme/IconArrow/index.js +1 -1
- package/lib-next/theme/IconEdit/index.js +3 -5
- package/lib-next/theme/IconExternalLink/index.js +26 -0
- package/{lib/theme/NavbarItem → lib-next/theme/IconExternalLink}/styles.module.css +4 -5
- package/lib-next/theme/IconLanguage/index.js +1 -1
- package/lib-next/theme/IconMenu/index.js +1 -4
- package/lib-next/theme/LastUpdated/index.js +34 -39
- package/lib-next/theme/Layout/styles.css +6 -0
- package/lib-next/theme/LayoutHead/index.js +5 -1
- package/lib-next/theme/LayoutProviders/index.js +11 -6
- package/lib-next/theme/Logo/index.js +12 -8
- package/lib-next/theme/MDXPage/index.js +13 -17
- package/lib-next/theme/{LastUpdated → MDXPage}/styles.module.css +2 -2
- package/lib-next/theme/Navbar/index.js +2 -2
- package/lib-next/theme/Navbar/styles.module.css +1 -1
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +19 -2
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +23 -9
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +6 -6
- package/lib-next/theme/NavbarItem/SearchNavbarItem.js +1 -6
- package/lib-next/theme/NavbarItem/index.js +1 -1
- package/lib-next/theme/NotFound.js +6 -2
- package/lib-next/theme/SearchMetadatas/index.js +1 -1
- package/lib-next/theme/Seo/index.js +0 -1
- package/lib-next/theme/SkipToContent/index.js +3 -3
- package/lib-next/theme/SkipToContent/styles.module.css +1 -3
- package/lib-next/theme/TOC/styles.module.css +1 -1
- package/lib-next/theme/ThemedImage/index.js +2 -3
- package/lib-next/theme/ThemedImage/styles.module.css +7 -0
- package/lib-next/theme/Toggle/index.js +9 -24
- package/lib-next/theme/Toggle/styles.css +103 -0
- package/lib-next/theme/Toggle/styles.module.css +0 -97
- package/lib-next/theme/UserPreferencesProvider/index.js +0 -4
- package/lib-next/theme/hooks/useHideableNavbar.js +3 -3
- package/lib-next/theme/hooks/useTabGroupChoice.js +2 -4
- package/lib-next/theme/hooks/useThemeContext.js +1 -1
- package/lib-next/theme/hooks/useUserPreferencesContext.js +1 -1
- package/lib-next/types.d.ts +10 -12
- package/lib-next/validateThemeConfig.js +3 -3
- package/package.json +18 -17
- package/src/index.ts +32 -8
- package/src/theme/AnnouncementBar/index.tsx +6 -9
- package/src/theme/AnnouncementBar/styles.module.css +6 -6
- package/src/theme/BlogListPage/index.tsx +2 -2
- package/src/theme/BlogPostItem/index.tsx +40 -24
- package/src/theme/BlogPostItem/styles.module.css +5 -1
- package/src/theme/BlogPostPage/index.tsx +4 -8
- package/src/theme/BlogPostPaginator/index.tsx +1 -1
- package/src/theme/BlogSidebar/index.tsx +12 -3
- package/src/theme/BlogSidebar/styles.module.css +4 -6
- package/src/theme/BlogTagsListPage/index.tsx +17 -22
- package/src/theme/BlogTagsPostsPage/index.tsx +33 -43
- package/src/theme/CodeBlock/index.tsx +10 -9
- package/src/theme/CodeBlock/styles.module.css +4 -7
- package/src/theme/DocItem/index.tsx +40 -40
- package/src/theme/DocItem/styles.module.css +8 -10
- package/src/theme/DocPage/index.tsx +29 -9
- package/src/theme/DocPage/styles.module.css +7 -19
- package/src/theme/DocPaginator/index.tsx +1 -1
- package/src/theme/DocSidebar/index.tsx +28 -21
- package/src/theme/DocSidebar/styles.module.css +0 -14
- package/src/theme/{DocVersionSuggestions → DocVersionBanner}/index.tsx +46 -43
- package/src/theme/Heading/index.tsx +22 -1
- package/src/theme/Heading/styles.module.css +5 -0
- package/src/theme/IconArrow/index.tsx +1 -1
- package/src/theme/IconEdit/index.tsx +3 -5
- package/src/theme/IconExternalLink/index.tsx +32 -0
- package/src/theme/IconExternalLink/styles.module.css +12 -0
- package/src/theme/IconLanguage/index.tsx +1 -1
- package/src/theme/IconMenu/index.tsx +1 -4
- package/src/theme/LastUpdated/index.tsx +34 -39
- package/src/theme/Layout/styles.css +6 -0
- package/src/theme/LayoutHead/index.tsx +5 -1
- package/src/theme/LayoutProviders/index.tsx +11 -6
- package/src/theme/Logo/index.tsx +10 -6
- package/src/theme/MDXPage/index.tsx +14 -17
- package/{lib/theme/LastUpdated → src/theme/MDXPage}/styles.module.css +2 -2
- package/src/theme/Navbar/index.tsx +2 -2
- package/src/theme/Navbar/styles.module.css +1 -1
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -2
- package/src/theme/NavbarItem/DocNavbarItem.tsx +29 -10
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +7 -6
- package/src/theme/NavbarItem/SearchNavbarItem.tsx +1 -6
- package/src/theme/NavbarItem/index.tsx +1 -1
- package/src/theme/NotFound.tsx +6 -2
- package/src/theme/SearchMetadatas/index.tsx +1 -1
- package/src/theme/Seo/index.tsx +0 -1
- package/src/theme/SkipToContent/index.tsx +3 -3
- package/src/theme/SkipToContent/styles.module.css +1 -3
- package/src/theme/TOC/styles.module.css +1 -1
- package/src/theme/ThemedImage/index.tsx +3 -3
- package/src/theme/ThemedImage/styles.module.css +7 -0
- package/src/theme/Toggle/index.tsx +9 -22
- package/src/theme/Toggle/styles.css +103 -0
- package/src/theme/Toggle/styles.module.css +0 -97
- package/src/theme/UserPreferencesProvider/index.tsx +0 -5
- package/src/theme/hooks/useHideableNavbar.ts +3 -3
- package/src/theme/hooks/useTabGroupChoice.ts +2 -2
- package/src/theme/hooks/useThemeContext.ts +1 -1
- package/src/theme/hooks/useUserPreferencesContext.ts +1 -1
- package/src/types.d.ts +10 -12
- package/src/validateThemeConfig.js +3 -3
- package/update-code-translations.js +1 -0
- package/lib-next/theme/NavbarItem/styles.module.css +0 -13
- package/src/theme/NavbarItem/styles.module.css +0 -13
- 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 {
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
'
|
|
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
|
-
'
|
|
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.
|
|
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()
|
|
254
|
-
textColor: Joi.string()
|
|
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;
|