@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
|
@@ -13,13 +13,15 @@ var _useDocusaurusContext = _interopRequireDefault(require("@docusaurus/useDocus
|
|
|
13
13
|
|
|
14
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
15
|
|
|
16
|
+
require("./styles.css");
|
|
17
|
+
|
|
16
18
|
var _stylesModule = _interopRequireDefault(require("./styles.module.css"));
|
|
17
19
|
|
|
18
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
19
21
|
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var
|
|
22
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
21
23
|
|
|
22
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
24
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
23
25
|
|
|
24
26
|
/**
|
|
25
27
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
@@ -52,36 +54,22 @@ const Toggle = (0, _react.memo)(({
|
|
|
52
54
|
const [checked, setChecked] = (0, _react.useState)(defaultChecked);
|
|
53
55
|
const [focused, setFocused] = (0, _react.useState)(false);
|
|
54
56
|
const inputRef = (0, _react.useRef)(null);
|
|
55
|
-
|
|
56
|
-
const handleToggle = e => {
|
|
57
|
-
const checkbox = inputRef.current;
|
|
58
|
-
|
|
59
|
-
if (!checkbox) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
if (e.target !== checkbox) {
|
|
64
|
-
e.preventDefault();
|
|
65
|
-
checkbox.focus();
|
|
66
|
-
checkbox.click();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
setChecked(checkbox === null || checkbox === void 0 ? void 0 : checkbox.checked);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
57
|
return <div className={(0, _clsx.default)('react-toggle', className, {
|
|
74
58
|
'react-toggle--checked': checked,
|
|
75
59
|
'react-toggle--focus': focused,
|
|
76
60
|
'react-toggle--disabled': disabled
|
|
77
|
-
})}
|
|
78
|
-
<div className="react-toggle-track"
|
|
61
|
+
})}>
|
|
62
|
+
<div className="react-toggle-track" role="button" tabIndex={-1} onClick={() => {
|
|
63
|
+
var _inputRef$current;
|
|
64
|
+
|
|
65
|
+
return (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.click();
|
|
66
|
+
}}>
|
|
79
67
|
<div className="react-toggle-track-check">{icons.checked}</div>
|
|
80
68
|
<div className="react-toggle-track-x">{icons.unchecked}</div>
|
|
69
|
+
<div className="react-toggle-thumb" />
|
|
81
70
|
</div>
|
|
82
|
-
<div className="react-toggle-thumb" />
|
|
83
71
|
|
|
84
|
-
<input ref={inputRef} checked={checked} type="checkbox" className="react-toggle-screenreader-only" aria-label="Switch between dark and light mode" onChange={onChange} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} />
|
|
72
|
+
<input ref={inputRef} checked={checked} type="checkbox" className="react-toggle-screenreader-only" aria-label="Switch between dark and light mode" onChange={onChange} onClick={() => setChecked(!checked)} onFocus={() => setFocused(true)} onBlur={() => setFocused(false)} />
|
|
85
73
|
</div>;
|
|
86
74
|
});
|
|
87
75
|
|
|
@@ -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
|
-
}
|
|
@@ -9,8 +9,6 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
9
9
|
|
|
10
10
|
var _useTabGroupChoice = _interopRequireDefault(require("@theme/hooks/useTabGroupChoice"));
|
|
11
11
|
|
|
12
|
-
var _useAnnouncementBar = _interopRequireDefault(require("@theme/hooks/useAnnouncementBar"));
|
|
13
|
-
|
|
14
12
|
var _UserPreferencesContext = _interopRequireDefault(require("@theme/UserPreferencesContext"));
|
|
15
13
|
|
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
@@ -26,15 +24,9 @@ function UserPreferencesProvider(props) {
|
|
|
26
24
|
tabGroupChoices,
|
|
27
25
|
setTabGroupChoices
|
|
28
26
|
} = (0, _useTabGroupChoice.default)();
|
|
29
|
-
const {
|
|
30
|
-
isAnnouncementBarClosed,
|
|
31
|
-
closeAnnouncementBar
|
|
32
|
-
} = (0, _useAnnouncementBar.default)();
|
|
33
27
|
return <_UserPreferencesContext.default.Provider value={{
|
|
34
28
|
tabGroupChoices,
|
|
35
|
-
setTabGroupChoices
|
|
36
|
-
isAnnouncementBarClosed,
|
|
37
|
-
closeAnnouncementBar
|
|
29
|
+
setTabGroupChoices
|
|
38
30
|
}}>
|
|
39
31
|
{props.children}
|
|
40
32
|
</_UserPreferencesContext.default.Provider>;
|
|
@@ -64,8 +64,8 @@ const useHideableNavbar = hideOnScroll => {
|
|
|
64
64
|
setIsNavbarVisible(true);
|
|
65
65
|
}
|
|
66
66
|
}, [navbarHeight, isFocusedAnchor]);
|
|
67
|
-
(0, _themeCommon.
|
|
68
|
-
if (!hideOnScroll) {
|
|
67
|
+
(0, _themeCommon.useLocationChange)(locationChangeEvent => {
|
|
68
|
+
if (!hideOnScroll || locationChangeEvent.location.hash) {
|
|
69
69
|
return;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -25,14 +25,12 @@ const useTabGroupChoice = () => {
|
|
|
25
25
|
(0, _react.useEffect)(() => {
|
|
26
26
|
try {
|
|
27
27
|
const localStorageChoices = {};
|
|
28
|
-
|
|
29
|
-
for (const storageKey of (0, _themeCommon.listStorageKeys)()) {
|
|
28
|
+
(0, _themeCommon.listStorageKeys)().forEach(storageKey => {
|
|
30
29
|
if (storageKey.startsWith(TAB_CHOICE_PREFIX)) {
|
|
31
30
|
const groupId = storageKey.substring(TAB_CHOICE_PREFIX.length);
|
|
32
31
|
localStorageChoices[groupId] = (0, _themeCommon.createStorageSlot)(storageKey).get();
|
|
33
32
|
}
|
|
34
|
-
}
|
|
35
|
-
|
|
33
|
+
});
|
|
36
34
|
setChoices(localStorageChoices);
|
|
37
35
|
} catch (err) {
|
|
38
36
|
console.error(err);
|
|
@@ -21,7 +21,7 @@ function useThemeContext() {
|
|
|
21
21
|
const context = (0, _react.useContext)(_ThemeContext.default);
|
|
22
22
|
|
|
23
23
|
if (context == null) {
|
|
24
|
-
throw new Error('
|
|
24
|
+
throw new Error('"useThemeContext" is used outside of "Layout" component. Please see https://docusaurus.io/docs/api/themes/configuration#usethemecontext.');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return context;
|
|
@@ -21,7 +21,7 @@ function useUserPreferencesContext() {
|
|
|
21
21
|
const context = (0, _react.useContext)(_UserPreferencesContext.default);
|
|
22
22
|
|
|
23
23
|
if (context == null) {
|
|
24
|
-
throw new Error('
|
|
24
|
+
throw new Error('"useUserPreferencesContext" is used outside of "Layout" component.');
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
return context;
|
package/lib/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({
|
package/lib-next/index.js
CHANGED
|
@@ -18,7 +18,7 @@ const ContextReplacementPlugin = requireFromDocusaurusCore(
|
|
|
18
18
|
); // Need to be inlined to prevent dark mode FOUC
|
|
19
19
|
// Make sure that the 'storageKey' is the same as the one in `/theme/hooks/useTheme.js`
|
|
20
20
|
|
|
21
|
-
const
|
|
21
|
+
const ThemeStorageKey = 'theme';
|
|
22
22
|
|
|
23
23
|
const noFlashColorMode = ({defaultMode, respectPrefersColorScheme}) => {
|
|
24
24
|
return `(function() {
|
|
@@ -32,7 +32,7 @@ const noFlashColorMode = ({defaultMode, respectPrefersColorScheme}) => {
|
|
|
32
32
|
function getStoredTheme() {
|
|
33
33
|
var theme = null;
|
|
34
34
|
try {
|
|
35
|
-
theme = localStorage.getItem('${
|
|
35
|
+
theme = localStorage.getItem('${ThemeStorageKey}');
|
|
36
36
|
} catch (err) {}
|
|
37
37
|
return theme;
|
|
38
38
|
}
|
|
@@ -56,7 +56,26 @@ const noFlashColorMode = ({defaultMode, respectPrefersColorScheme}) => {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
})();`;
|
|
59
|
-
};
|
|
59
|
+
}; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
60
|
+
// TODO: import from theme-common once we only support Node.js with ESM support
|
|
61
|
+
// + move all those announcementBar stuff there too
|
|
62
|
+
|
|
63
|
+
export const AnnouncementBarDismissStorageKey =
|
|
64
|
+
'docusaurus.announcement.dismiss';
|
|
65
|
+
const AnnouncementBarDismissDataAttribute =
|
|
66
|
+
'data-announcement-bar-initially-dismissed'; // We always render the announcement bar html on the server, to prevent layout shifts on React hydration
|
|
67
|
+
// The theme can use CSS + the data attribute to hide the announcement bar asap (before React hydration)
|
|
68
|
+
|
|
69
|
+
const AnnouncementBarInlineJavaScript = `
|
|
70
|
+
(function() {
|
|
71
|
+
function isDismissed() {
|
|
72
|
+
try {
|
|
73
|
+
return localStorage.getItem('${AnnouncementBarDismissStorageKey}') === 'true';
|
|
74
|
+
} catch (err) {}
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
document.documentElement.setAttribute('${AnnouncementBarDismissDataAttribute}', isDismissed());
|
|
78
|
+
})();`;
|
|
60
79
|
|
|
61
80
|
function getInfimaCSSFile(direction) {
|
|
62
81
|
return `infima/dist/css/default/default${
|
|
@@ -73,7 +92,11 @@ export default function docusaurusThemeClassic(
|
|
|
73
92
|
i18n: {currentLocale, localeConfigs},
|
|
74
93
|
} = context;
|
|
75
94
|
const themeConfig = roughlyTypedThemeConfig || {};
|
|
76
|
-
const {
|
|
95
|
+
const {
|
|
96
|
+
announcementBar,
|
|
97
|
+
colorMode,
|
|
98
|
+
prism: {additionalLanguages = []} = {},
|
|
99
|
+
} = themeConfig;
|
|
77
100
|
const {customCss} = options || {};
|
|
78
101
|
const {direction} = localeConfigs[currentLocale];
|
|
79
102
|
return {
|
|
@@ -170,10 +193,10 @@ export default function docusaurusThemeClassic(
|
|
|
170
193
|
preBodyTags: [
|
|
171
194
|
{
|
|
172
195
|
tagName: 'script',
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
196
|
+
innerHTML: `
|
|
197
|
+
${noFlashColorMode(colorMode)}
|
|
198
|
+
${announcementBar ? AnnouncementBarInlineJavaScript : ''}
|
|
199
|
+
`,
|
|
177
200
|
},
|
|
178
201
|
],
|
|
179
202
|
};
|
|
@@ -6,16 +6,12 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import React from 'react';
|
|
8
8
|
import clsx from 'clsx';
|
|
9
|
-
import {useThemeConfig} from '@docusaurus/theme-common';
|
|
10
|
-
import useUserPreferencesContext from '@theme/hooks/useUserPreferencesContext';
|
|
9
|
+
import {useThemeConfig, useAnnouncementBar} from '@docusaurus/theme-common';
|
|
11
10
|
import {translate} from '@docusaurus/Translate';
|
|
12
11
|
import styles from './styles.module.css';
|
|
13
12
|
|
|
14
13
|
function AnnouncementBar() {
|
|
15
|
-
const {
|
|
16
|
-
isAnnouncementBarClosed,
|
|
17
|
-
closeAnnouncementBar,
|
|
18
|
-
} = useUserPreferencesContext();
|
|
14
|
+
const {isClosed, close} = useAnnouncementBar();
|
|
19
15
|
const {announcementBar} = useThemeConfig();
|
|
20
16
|
|
|
21
17
|
if (!announcementBar) {
|
|
@@ -24,7 +20,7 @@ function AnnouncementBar() {
|
|
|
24
20
|
|
|
25
21
|
const {content, backgroundColor, textColor, isCloseable} = announcementBar;
|
|
26
22
|
|
|
27
|
-
if (!content || (isCloseable &&
|
|
23
|
+
if (!content || (isCloseable && isClosed)) {
|
|
28
24
|
return null;
|
|
29
25
|
}
|
|
30
26
|
|
|
@@ -48,8 +44,8 @@ function AnnouncementBar() {
|
|
|
48
44
|
{isCloseable ? (
|
|
49
45
|
<button
|
|
50
46
|
type="button"
|
|
51
|
-
className={styles.announcementBarClose}
|
|
52
|
-
onClick={
|
|
47
|
+
className={clsx(styles.announcementBarClose, 'clean-btn')}
|
|
48
|
+
onClick={close}
|
|
53
49
|
aria-label={translate({
|
|
54
50
|
id: 'theme.AnnouncementBar.closeButtonAriaLabel',
|
|
55
51
|
message: 'Close',
|
|
@@ -13,8 +13,13 @@
|
|
|
13
13
|
position: relative;
|
|
14
14
|
width: 100%;
|
|
15
15
|
height: var(--docusaurus-announcement-bar-height);
|
|
16
|
-
background-color: var(--ifm-color-
|
|
16
|
+
background-color: var(--ifm-color-white);
|
|
17
17
|
color: var(--ifm-color-black);
|
|
18
|
+
border-bottom: 1px solid var(--ifm-color-emphasis-100);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
html[data-announcement-bar-initially-dismissed='true'] .announcementBar {
|
|
22
|
+
display: none;
|
|
18
23
|
}
|
|
19
24
|
|
|
20
25
|
@media print {
|
|
@@ -35,11 +40,6 @@
|
|
|
35
40
|
top: 0;
|
|
36
41
|
width: 55px;
|
|
37
42
|
font-size: 1.25rem;
|
|
38
|
-
padding: 0;
|
|
39
|
-
border: none;
|
|
40
|
-
cursor: pointer;
|
|
41
|
-
background: none;
|
|
42
|
-
color: inherit;
|
|
43
43
|
height: 100%;
|
|
44
44
|
}
|
|
45
45
|
|
|
@@ -32,9 +32,9 @@ function BlogListPage(props) {
|
|
|
32
32
|
}}>
|
|
33
33
|
<div className="container margin-vert--lg">
|
|
34
34
|
<div className="row">
|
|
35
|
-
<
|
|
35
|
+
<aside className="col col--3">
|
|
36
36
|
<BlogSidebar sidebar={sidebar} />
|
|
37
|
-
</
|
|
37
|
+
</aside>
|
|
38
38
|
<main className="col col--7">
|
|
39
39
|
{items.map(({content: BlogPostContent}) => (
|
|
40
40
|
<BlogPostItem
|