@docusaurus/theme-classic 0.0.0-4206 → 0.0.0-4210
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/lib/index.js +7 -11
- package/lib/theme/BlogPostAuthors/index.js +1 -1
- package/lib/theme/BlogSidebar/index.js +5 -7
- package/lib/theme/DocItemFooter/index.js +1 -1
- package/lib/theme/DocSidebar/index.js +5 -6
- package/lib/theme/DocSidebarItem/index.js +5 -7
- package/lib/theme/DocVersionBanner/index.js +1 -1
- package/lib/theme/Footer/index.js +4 -2
- package/lib/theme/Heading/index.js +11 -14
- package/lib/theme/IconArrow/index.js +2 -2
- package/lib/theme/IconEdit/index.js +3 -3
- package/lib/theme/IconExternalLink/index.js +3 -3
- package/lib/theme/IconLanguage/index.js +3 -3
- package/lib/theme/IconMenu/index.js +3 -3
- package/lib/theme/LayoutHead/index.js +1 -1
- package/lib/theme/Logo/index.js +3 -3
- package/lib/theme/Navbar/index.js +4 -6
- package/lib/theme/ThemeProvider/index.js +8 -3
- package/lib/theme/ThemedImage/index.js +2 -2
- package/lib/theme/Toggle/index.js +12 -8
- package/lib/theme/UserPreferencesProvider/index.js +8 -3
- package/lib/theme/hooks/useTheme.js +1 -3
- package/lib/validateThemeConfig.js +1 -1
- package/lib-next/index.js +8 -8
- package/lib-next/theme/BlogPostAuthors/index.js +1 -1
- package/lib-next/theme/BlogSidebar/index.js +11 -13
- package/lib-next/theme/DocItemFooter/index.js +1 -1
- package/lib-next/theme/DocSidebar/index.js +11 -13
- package/lib-next/theme/DocSidebarItem/index.js +11 -16
- package/lib-next/theme/DocVersionBanner/index.js +1 -1
- package/lib-next/theme/Footer/index.js +11 -9
- package/lib-next/theme/Heading/index.js +16 -17
- package/lib-next/theme/IconArrow/index.js +2 -2
- package/lib-next/theme/IconEdit/index.js +2 -2
- package/lib-next/theme/IconExternalLink/index.js +2 -2
- package/lib-next/theme/IconLanguage/index.js +2 -2
- package/lib-next/theme/IconMenu/index.js +2 -2
- package/lib-next/theme/LayoutHead/index.js +1 -1
- package/lib-next/theme/Logo/index.js +3 -3
- package/lib-next/theme/Navbar/index.js +7 -6
- package/lib-next/theme/ThemeProvider/index.js +10 -7
- package/lib-next/theme/ThemedImage/index.js +2 -2
- package/lib-next/theme/Toggle/index.js +14 -10
- package/lib-next/theme/UserPreferencesProvider/index.js +9 -6
- package/lib-next/theme/hooks/useTheme.js +2 -3
- package/package.json +11 -11
- package/src/index.ts +4 -7
- package/src/theme/BlogPostAuthors/index.tsx +5 -2
- package/src/theme/BlogSidebar/index.tsx +11 -13
- package/src/theme/DocItemFooter/index.tsx +2 -2
- package/src/theme/DocSidebar/index.tsx +11 -12
- package/src/theme/DocSidebarItem/index.tsx +4 -7
- package/src/theme/DocVersionBanner/index.tsx +2 -2
- package/src/theme/Footer/index.tsx +12 -10
- package/src/theme/Heading/index.tsx +16 -19
- package/src/theme/IconArrow/index.tsx +2 -2
- package/src/theme/IconEdit/index.tsx +2 -2
- package/src/theme/IconExternalLink/index.tsx +2 -5
- package/src/theme/IconLanguage/index.tsx +2 -6
- package/src/theme/IconMenu/index.tsx +3 -3
- package/src/theme/LayoutHead/index.tsx +1 -1
- package/src/theme/Logo/index.tsx +3 -3
- package/src/theme/Navbar/index.tsx +7 -6
- package/src/theme/ThemeProvider/index.tsx +6 -2
- package/src/theme/ThemedImage/index.tsx +2 -2
- package/src/theme/Toggle/index.tsx +14 -10
- package/src/theme/UserPreferencesProvider/index.tsx +9 -6
- package/src/theme/hooks/useTheme.ts +2 -3
- package/update-code-translations.js +5 -6
package/lib/index.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.AnnouncementBarDismissStorageKey = void 0;
|
|
6
7
|
exports.default = docusaurusThemeClassic;
|
|
7
8
|
exports.getSwizzleComponentList = getSwizzleComponentList;
|
|
8
9
|
Object.defineProperty(exports, "validateThemeConfig", {
|
|
@@ -11,7 +12,6 @@ Object.defineProperty(exports, "validateThemeConfig", {
|
|
|
11
12
|
return _validateThemeConfig.validateThemeConfig;
|
|
12
13
|
}
|
|
13
14
|
});
|
|
14
|
-
exports.AnnouncementBarDismissStorageKey = void 0;
|
|
15
15
|
|
|
16
16
|
var _translations = require("./translations");
|
|
17
17
|
|
|
@@ -42,8 +42,7 @@ const ThemeStorageKey = 'theme';
|
|
|
42
42
|
const noFlashColorMode = ({
|
|
43
43
|
defaultMode,
|
|
44
44
|
respectPrefersColorScheme
|
|
45
|
-
}) => {
|
|
46
|
-
return `(function() {
|
|
45
|
+
}) => `(function() {
|
|
47
46
|
var defaultMode = '${defaultMode}';
|
|
48
47
|
var respectPrefersColorScheme = ${respectPrefersColorScheme};
|
|
49
48
|
|
|
@@ -77,8 +76,7 @@ const noFlashColorMode = ({
|
|
|
77
76
|
setDataThemeAttribute(defaultMode === 'dark' ? 'dark' : 'light');
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
|
-
})();`;
|
|
81
|
-
}; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
79
|
+
})();`; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
82
80
|
// TODO: import from theme-common once we only support Node.js with ESM support
|
|
83
81
|
// + move all those announcementBar stuff there too
|
|
84
82
|
|
|
@@ -152,12 +150,10 @@ options) {
|
|
|
152
150
|
themeConfig
|
|
153
151
|
}),
|
|
154
152
|
translateThemeConfig: _translations.translateThemeConfig,
|
|
155
|
-
getDefaultCodeTranslationMessages: () => {
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
});
|
|
160
|
-
},
|
|
153
|
+
getDefaultCodeTranslationMessages: () => (0, _utils.readDefaultCodeTranslationMessages)({
|
|
154
|
+
dirPath: _path.default.resolve(__dirname, '..', 'codeTranslations'),
|
|
155
|
+
locale: currentLocale
|
|
156
|
+
}),
|
|
161
157
|
|
|
162
158
|
getClientModules() {
|
|
163
159
|
const modules = [require.resolve(getInfimaCSSFile(direction)), _path.default.resolve(__dirname, './prism-include-languages'), _path.default.resolve(__dirname, './admonitions.css')];
|
|
@@ -39,13 +39,11 @@ function BlogSidebar({
|
|
|
39
39
|
{sidebar.title}
|
|
40
40
|
</div>
|
|
41
41
|
<ul className={_stylesModule.default.sidebarItemList}>
|
|
42
|
-
{sidebar.items.map(item => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
</li>;
|
|
48
|
-
})}
|
|
42
|
+
{sidebar.items.map(item => <li key={item.permalink} className={_stylesModule.default.sidebarItem}>
|
|
43
|
+
<_Link.default isNavLink to={item.permalink} className={_stylesModule.default.sidebarItemLink} activeClassName={_stylesModule.default.sidebarItemLinkActive}>
|
|
44
|
+
{item.title}
|
|
45
|
+
</_Link.default>
|
|
46
|
+
</li>)}
|
|
49
47
|
</ul>
|
|
50
48
|
</nav>;
|
|
51
49
|
}
|
|
@@ -69,7 +69,7 @@ function DocItemFooter(props) {
|
|
|
69
69
|
const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow;
|
|
70
70
|
|
|
71
71
|
if (!canDisplayFooter) {
|
|
72
|
-
return
|
|
72
|
+
return null;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
75
|
return <footer className={(0, _clsx.default)(_themeCommon.ThemeClassNames.docs.docFooter, 'docusaurus-mt-lg')}>
|
|
@@ -93,17 +93,16 @@ function DocSidebarDesktop({
|
|
|
93
93
|
</nav>
|
|
94
94
|
{hideableSidebar && <HideableSidebarButton onClick={onCollapse} />}
|
|
95
95
|
</div>;
|
|
96
|
-
}
|
|
96
|
+
} // eslint-disable-next-line react/function-component-definition
|
|
97
|
+
|
|
97
98
|
|
|
98
99
|
const DocSidebarMobileSecondaryMenu = ({
|
|
99
100
|
toggleSidebar,
|
|
100
101
|
sidebar,
|
|
101
102
|
path
|
|
102
|
-
}) => {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
</ul>;
|
|
106
|
-
};
|
|
103
|
+
}) => <ul className={(0, _clsx.default)(_themeCommon.ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
104
|
+
<_DocSidebarItem.DocSidebarItems items={sidebar} activePath={path} onItemClick={() => toggleSidebar()} level={1} />
|
|
105
|
+
</ul>;
|
|
107
106
|
|
|
108
107
|
function DocSidebarMobile(props) {
|
|
109
108
|
return <_themeCommon.MobileSecondaryMenuFiller component={DocSidebarMobileSecondaryMenu} props={props} />;
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.default = DocSidebarItem;
|
|
7
6
|
exports.DocSidebarItems = void 0;
|
|
7
|
+
exports.default = DocSidebarItem;
|
|
8
8
|
|
|
9
9
|
var _react = _interopRequireWildcard(require("react"));
|
|
10
10
|
|
|
@@ -47,15 +47,13 @@ const isActiveSidebarItem = (item, activePath) => {
|
|
|
47
47
|
// TODO this triggers whole sidebar re-renders on navigation
|
|
48
48
|
|
|
49
49
|
|
|
50
|
-
const DocSidebarItems = (0, _react.memo)(
|
|
50
|
+
const DocSidebarItems = (0, _react.memo)(({
|
|
51
51
|
items,
|
|
52
52
|
...props
|
|
53
|
-
})
|
|
54
|
-
return <>
|
|
53
|
+
}) => <>
|
|
55
54
|
{items.map((item, index) => <DocSidebarItem key={index} // sidebar is static, the index does not change
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
});
|
|
55
|
+
item={item} {...props} />)}
|
|
56
|
+
</>);
|
|
59
57
|
exports.DocSidebarItems = DocSidebarItems;
|
|
60
58
|
|
|
61
59
|
function DocSidebarItem({
|
|
@@ -54,12 +54,14 @@ function FooterLink({
|
|
|
54
54
|
</_Link.default>;
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
function FooterLogo({
|
|
58
58
|
sources,
|
|
59
59
|
alt,
|
|
60
60
|
width,
|
|
61
61
|
height
|
|
62
|
-
})
|
|
62
|
+
}) {
|
|
63
|
+
return <_ThemedImage.default className="footer__logo" alt={alt} sources={sources} width={width} height={height} />;
|
|
64
|
+
}
|
|
63
65
|
|
|
64
66
|
function Footer() {
|
|
65
67
|
const {
|
|
@@ -25,22 +25,21 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
* This source code is licensed under the MIT license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
27
27
|
*/
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
};
|
|
28
|
+
// eslint-disable-next-line react/function-component-definition
|
|
29
|
+
const MainHeading = ({ ...props
|
|
30
|
+
}) => <header>
|
|
31
|
+
<h1 {...props} id={undefined} // h1 headings do not need an id because they don't appear in the TOC
|
|
32
|
+
>
|
|
33
|
+
{props.children}
|
|
34
|
+
</h1>
|
|
35
|
+
</header>;
|
|
37
36
|
|
|
38
37
|
exports.MainHeading = MainHeading;
|
|
39
38
|
|
|
40
|
-
const createAnchorHeading = Tag =>
|
|
39
|
+
const createAnchorHeading = Tag => ({
|
|
41
40
|
id,
|
|
42
41
|
...props
|
|
43
|
-
}) {
|
|
42
|
+
}) => {
|
|
44
43
|
const {
|
|
45
44
|
navbar: {
|
|
46
45
|
hideOnScroll
|
|
@@ -66,9 +65,7 @@ const createAnchorHeading = Tag => function TargetComponent({
|
|
|
66
65
|
</Tag>;
|
|
67
66
|
};
|
|
68
67
|
|
|
69
|
-
const Heading = headingType =>
|
|
70
|
-
return headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
|
71
|
-
};
|
|
68
|
+
const Heading = headingType => headingType === 'h1' ? MainHeading : createAnchorHeading(headingType);
|
|
72
69
|
|
|
73
70
|
var _default = Heading;
|
|
74
71
|
exports.default = _default;
|
|
@@ -15,14 +15,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
function IconArrow(props) {
|
|
19
19
|
return <svg width="20" height="20" aria-hidden="true" {...props}>
|
|
20
20
|
<g fill="#7a7a7a">
|
|
21
21
|
<path d="M9.992 10.023c0 .2-.062.399-.172.547l-4.996 7.492a.982.982 0 01-.828.454H1c-.55 0-1-.453-1-1 0-.2.059-.403.168-.551l4.629-6.942L.168 3.078A.939.939 0 010 2.528c0-.548.45-.997 1-.997h2.996c.352 0 .649.18.828.45L9.82 9.472c.11.148.172.347.172.55zm0 0" />
|
|
22
22
|
<path d="M19.98 10.023c0 .2-.058.399-.168.547l-4.996 7.492a.987.987 0 01-.828.454h-3c-.547 0-.996-.453-.996-1 0-.2.059-.403.168-.551l4.625-6.942-4.625-6.945a.939.939 0 01-.168-.55 1 1 0 01.996-.997h3c.348 0 .649.18.828.45l4.996 7.492c.11.148.168.347.168.55zm0 0" />
|
|
23
23
|
</g>
|
|
24
24
|
</svg>;
|
|
25
|
-
}
|
|
25
|
+
}
|
|
26
26
|
|
|
27
27
|
var _default = IconArrow;
|
|
28
28
|
exports.default = _default;
|
|
@@ -19,16 +19,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
19
19
|
* This source code is licensed under the MIT license found in the
|
|
20
20
|
* LICENSE file in the root directory of this source tree.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
function IconEdit({
|
|
23
23
|
className,
|
|
24
24
|
...restProps
|
|
25
|
-
})
|
|
25
|
+
}) {
|
|
26
26
|
return <svg fill="currentColor" height="20" width="20" viewBox="0 0 40 40" className={(0, _clsx.default)(_stylesModule.default.iconEdit, className)} aria-hidden="true" {...restProps}>
|
|
27
27
|
<g>
|
|
28
28
|
<path d="m34.5 11.7l-3 3.1-6.3-6.3 3.1-3q0.5-0.5 1.2-0.5t1.1 0.5l3.9 3.9q0.5 0.4 0.5 1.1t-0.5 1.2z m-29.5 17.1l18.4-18.5 6.3 6.3-18.4 18.4h-6.3v-6.2z" />
|
|
29
29
|
</g>
|
|
30
30
|
</svg>;
|
|
31
|
-
}
|
|
31
|
+
}
|
|
32
32
|
|
|
33
33
|
var _default = IconEdit;
|
|
34
34
|
exports.default = _default;
|
|
@@ -17,14 +17,14 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
17
17
|
* This source code is licensed under the MIT license found in the
|
|
18
18
|
* LICENSE file in the root directory of this source tree.
|
|
19
19
|
*/
|
|
20
|
-
|
|
20
|
+
function IconExternalLink({
|
|
21
21
|
width = 13.5,
|
|
22
22
|
height = 13.5
|
|
23
|
-
})
|
|
23
|
+
}) {
|
|
24
24
|
return <svg width={width} height={height} aria-hidden="true" viewBox="0 0 24 24" className={_stylesModule.default.iconExternalLink}>
|
|
25
25
|
<path fill="currentColor" d="M21 13v10h-21v-19h12v2h-10v15h17v-8h2zm3-12h-10.988l4.035 4-6.977 7.07 2.828 2.828 6.977-7.07 4.125 4.172v-11z" />
|
|
26
26
|
</svg>;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
var _default = IconExternalLink;
|
|
30
30
|
exports.default = _default;
|
|
@@ -15,15 +15,15 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
function IconLanguage({
|
|
19
19
|
width = 20,
|
|
20
20
|
height = 20,
|
|
21
21
|
...props
|
|
22
|
-
})
|
|
22
|
+
}) {
|
|
23
23
|
return <svg viewBox="0 0 20 20" width={width} height={height} aria-hidden="true" {...props}>
|
|
24
24
|
<path fill="currentColor" d="M19.753 10.909c-.624-1.707-2.366-2.726-4.661-2.726-.09 0-.176.002-.262.006l-.016-2.063 3.525-.607c.115-.019.133-.119.109-.231-.023-.111-.167-.883-.188-.976-.027-.131-.102-.127-.207-.109-.104.018-3.25.461-3.25.461l-.013-2.078c-.001-.125-.069-.158-.194-.156l-1.025.016c-.105.002-.164.049-.162.148l.033 2.307s-3.061.527-3.144.543c-.084.014-.17.053-.151.143.019.09.19 1.094.208 1.172.018.08.072.129.188.107l2.924-.504.035 2.018c-1.077.281-1.801.824-2.256 1.303-.768.807-1.207 1.887-1.207 2.963 0 1.586.971 2.529 2.328 2.695 3.162.387 5.119-3.06 5.769-4.715 1.097 1.506.256 4.354-2.094 5.98-.043.029-.098.129-.033.207l.619.756c.08.096.206.059.256.023 2.51-1.73 3.661-4.515 2.869-6.683zm-7.386 3.188c-.966-.121-.944-.914-.944-1.453 0-.773.327-1.58.876-2.156a3.21 3.21 0 011.229-.799l.082 4.277a2.773 2.773 0 01-1.243.131zm2.427-.553l.046-4.109c.084-.004.166-.01.252-.01.773 0 1.494.145 1.885.361.391.217-1.023 2.713-2.183 3.758zm-8.95-7.668a.196.196 0 00-.196-.145h-1.95a.194.194 0 00-.194.144L.008 16.916c-.017.051-.011.076.062.076h1.733c.075 0 .099-.023.114-.072l1.008-3.318h3.496l1.008 3.318c.016.049.039.072.113.072h1.734c.072 0 .078-.025.062-.076-.014-.05-3.083-9.741-3.494-11.04zm-2.618 6.318l1.447-5.25 1.447 5.25H3.226z" />
|
|
25
25
|
</svg>;
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
27
|
|
|
28
28
|
var _default = IconLanguage;
|
|
29
29
|
exports.default = _default;
|
|
@@ -15,16 +15,16 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
function IconMenu({
|
|
19
19
|
width = 30,
|
|
20
20
|
height = 30,
|
|
21
21
|
className,
|
|
22
22
|
...restProps
|
|
23
|
-
})
|
|
23
|
+
}) {
|
|
24
24
|
return <svg className={className} width={width} height={height} viewBox="0 0 30 30" aria-hidden="true" {...restProps}>
|
|
25
25
|
<path stroke="currentColor" strokeLinecap="round" strokeMiterlimit="10" strokeWidth="2" d="M4 7h22M4 15h22M4 23h22" />
|
|
26
26
|
</svg>;
|
|
27
|
-
}
|
|
27
|
+
}
|
|
28
28
|
|
|
29
29
|
var _default = IconMenu;
|
|
30
30
|
exports.default = _default;
|
|
@@ -114,7 +114,7 @@ function LayoutHead(props) {
|
|
|
114
114
|
return <>
|
|
115
115
|
<_Head.default>
|
|
116
116
|
<html lang={htmlLang} dir={htmlDir} />
|
|
117
|
-
{favicon && <link rel="
|
|
117
|
+
{favicon && <link rel="icon" href={faviconUrl} />}
|
|
118
118
|
<title>{pageTitle}</title>
|
|
119
119
|
<meta property="og:title" content={pageTitle} />
|
|
120
120
|
<meta name="twitter:card" content="summary_large_image" />
|
package/lib/theme/Logo/index.js
CHANGED
|
@@ -25,7 +25,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
25
25
|
* This source code is licensed under the MIT license found in the
|
|
26
26
|
* LICENSE file in the root directory of this source tree.
|
|
27
27
|
*/
|
|
28
|
-
|
|
28
|
+
function Logo(props) {
|
|
29
29
|
const {
|
|
30
30
|
siteConfig: {
|
|
31
31
|
title
|
|
@@ -53,10 +53,10 @@ const Logo = props => {
|
|
|
53
53
|
return <_Link.default to={logoLink} {...propsRest} {...logo.target && {
|
|
54
54
|
target: logo.target
|
|
55
55
|
}}>
|
|
56
|
-
{logo.src && (imageClassName ? <div className={imageClassName}>{themedImage}</div> :
|
|
56
|
+
{logo.src && (imageClassName ? <div className={imageClassName}>{themedImage}</div> : themedImage)}
|
|
57
57
|
{navbarTitle != null && <b className={titleClassName}>{navbarTitle}</b>}
|
|
58
58
|
</_Link.default>;
|
|
59
|
-
}
|
|
59
|
+
}
|
|
60
60
|
|
|
61
61
|
var _default = Logo;
|
|
62
62
|
exports.default = _default;
|
|
@@ -138,12 +138,10 @@ function useSecondaryMenu({
|
|
|
138
138
|
toggleSidebar
|
|
139
139
|
});
|
|
140
140
|
const previousContent = (0, _themeCommon.usePrevious)(content);
|
|
141
|
-
const [shown, setShown] = (0, _react.useState)(() =>
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
return false;
|
|
146
|
-
}); // When content is become available for the first time (set in useEffect)
|
|
141
|
+
const [shown, setShown] = (0, _react.useState)(() => // /!\ content is set with useEffect,
|
|
142
|
+
// so it's not available on mount anyway
|
|
143
|
+
// "return !!content" => always returns false
|
|
144
|
+
false); // When content is become available for the first time (set in useEffect)
|
|
147
145
|
// we set this content to be shown!
|
|
148
146
|
|
|
149
147
|
(0, _react.useEffect)(() => {
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _useTheme = _interopRequireDefault(require("@theme/hooks/useTheme"));
|
|
11
11
|
|
|
@@ -13,6 +13,10 @@ var _ThemeContext = _interopRequireDefault(require("@theme/ThemeContext"));
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
18
22
|
*
|
|
@@ -25,11 +29,12 @@ function ThemeProvider(props) {
|
|
|
25
29
|
setLightTheme,
|
|
26
30
|
setDarkTheme
|
|
27
31
|
} = (0, _useTheme.default)();
|
|
28
|
-
|
|
32
|
+
const contextValue = (0, _react.useMemo)(() => ({
|
|
29
33
|
isDarkTheme,
|
|
30
34
|
setLightTheme,
|
|
31
35
|
setDarkTheme
|
|
32
|
-
}
|
|
36
|
+
}), [isDarkTheme, setLightTheme, setDarkTheme]);
|
|
37
|
+
return <_ThemeContext.default.Provider value={contextValue}>
|
|
33
38
|
{props.children}
|
|
34
39
|
</_ThemeContext.default.Provider>;
|
|
35
40
|
}
|
|
@@ -23,7 +23,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
|
23
23
|
* This source code is licensed under the MIT license found in the
|
|
24
24
|
* LICENSE file in the root directory of this source tree.
|
|
25
25
|
*/
|
|
26
|
-
|
|
26
|
+
function ThemedImage(props) {
|
|
27
27
|
const isBrowser = (0, _useIsBrowser.default)();
|
|
28
28
|
const {
|
|
29
29
|
isDarkTheme
|
|
@@ -41,7 +41,7 @@ const ThemedImage = props => {
|
|
|
41
41
|
return <>
|
|
42
42
|
{renderedSourceNames.map(sourceName => <img key={sourceName} src={sources[sourceName]} alt={alt} className={(0, _clsx.default)(_stylesModule.default.themedImage, _stylesModule.default[`themedImage--${sourceName}`], className)} {...propsRest} />)}
|
|
43
43
|
</>;
|
|
44
|
-
}
|
|
44
|
+
}
|
|
45
45
|
|
|
46
46
|
var _default = ThemedImage;
|
|
47
47
|
exports.default = _default;
|
|
@@ -27,19 +27,23 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
27
27
|
* This source code is licensed under the MIT license found in the
|
|
28
28
|
* LICENSE file in the root directory of this source tree.
|
|
29
29
|
*/
|
|
30
|
-
|
|
30
|
+
function Dark({
|
|
31
31
|
icon,
|
|
32
32
|
style
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
}) {
|
|
34
|
+
return <span className={(0, _clsx.default)(_stylesModule.default.toggleIcon, _stylesModule.default.dark)} style={style}>
|
|
35
|
+
{icon}
|
|
36
|
+
</span>;
|
|
37
|
+
}
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
function Light({
|
|
38
40
|
icon,
|
|
39
41
|
style
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
}) {
|
|
43
|
+
return <span className={(0, _clsx.default)(_stylesModule.default.toggleIcon, _stylesModule.default.light)} style={style}>
|
|
44
|
+
{icon}
|
|
45
|
+
</span>;
|
|
46
|
+
} // Based on react-toggle (https://github.com/aaronshaf/react-toggle/).
|
|
43
47
|
|
|
44
48
|
|
|
45
49
|
const Toggle = (0, _react.memo)(({
|
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
|
|
8
|
-
var _react =
|
|
8
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
9
9
|
|
|
10
10
|
var _useTabGroupChoice = _interopRequireDefault(require("@theme/hooks/useTabGroupChoice"));
|
|
11
11
|
|
|
@@ -13,6 +13,10 @@ var _UserPreferencesContext = _interopRequireDefault(require("@theme/UserPrefere
|
|
|
13
13
|
|
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
15
15
|
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
16
20
|
/**
|
|
17
21
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
18
22
|
*
|
|
@@ -24,10 +28,11 @@ function UserPreferencesProvider(props) {
|
|
|
24
28
|
tabGroupChoices,
|
|
25
29
|
setTabGroupChoices
|
|
26
30
|
} = (0, _useTabGroupChoice.default)();
|
|
27
|
-
|
|
31
|
+
const contextValue = (0, _react.useMemo)(() => ({
|
|
28
32
|
tabGroupChoices,
|
|
29
33
|
setTabGroupChoices
|
|
30
|
-
}
|
|
34
|
+
}), [tabGroupChoices, setTabGroupChoices]);
|
|
35
|
+
return <_UserPreferencesContext.default.Provider value={contextValue}>
|
|
31
36
|
{props.children}
|
|
32
37
|
</_UserPreferencesContext.default.Provider>;
|
|
33
38
|
}
|
|
@@ -26,9 +26,7 @@ const themes = {
|
|
|
26
26
|
};
|
|
27
27
|
|
|
28
28
|
// Ensure to always return a valid theme even if input is invalid
|
|
29
|
-
const coerceToTheme = theme =>
|
|
30
|
-
return theme === themes.dark ? themes.dark : themes.light;
|
|
31
|
-
};
|
|
29
|
+
const coerceToTheme = theme => theme === themes.dark ? themes.dark : themes.light;
|
|
32
30
|
|
|
33
31
|
const getInitialTheme = defaultMode => {
|
|
34
32
|
if (!_ExecutionEnvironment.default.canUseDOM) {
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.validateThemeConfig = validateThemeConfig;
|
|
7
6
|
exports.ThemeConfigSchema = exports.DEFAULT_CONFIG = void 0;
|
|
7
|
+
exports.validateThemeConfig = validateThemeConfig;
|
|
8
8
|
|
|
9
9
|
var _utilsValidation = require("@docusaurus/utils-validation");
|
|
10
10
|
|
package/lib-next/index.js
CHANGED
|
@@ -19,8 +19,10 @@ const ContextReplacementPlugin = requireFromDocusaurusCore(
|
|
|
19
19
|
|
|
20
20
|
const ThemeStorageKey = 'theme';
|
|
21
21
|
|
|
22
|
-
const noFlashColorMode = ({
|
|
23
|
-
|
|
22
|
+
const noFlashColorMode = ({
|
|
23
|
+
defaultMode,
|
|
24
|
+
respectPrefersColorScheme,
|
|
25
|
+
}) => `(function() {
|
|
24
26
|
var defaultMode = '${defaultMode}';
|
|
25
27
|
var respectPrefersColorScheme = ${respectPrefersColorScheme};
|
|
26
28
|
|
|
@@ -54,8 +56,7 @@ const noFlashColorMode = ({defaultMode, respectPrefersColorScheme}) => {
|
|
|
54
56
|
setDataThemeAttribute(defaultMode === 'dark' ? 'dark' : 'light');
|
|
55
57
|
}
|
|
56
58
|
}
|
|
57
|
-
})();`;
|
|
58
|
-
}; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
59
|
+
})();`; // Duplicated constant. Unfortunately we can't import it from theme-common, as we need to support older nodejs versions without ESM support
|
|
59
60
|
// TODO: import from theme-common once we only support Node.js with ESM support
|
|
60
61
|
// + move all those announcementBar stuff there too
|
|
61
62
|
|
|
@@ -123,12 +124,11 @@ export default function docusaurusThemeClassic(
|
|
|
123
124
|
themeConfig,
|
|
124
125
|
}),
|
|
125
126
|
translateThemeConfig,
|
|
126
|
-
getDefaultCodeTranslationMessages: () =>
|
|
127
|
-
|
|
127
|
+
getDefaultCodeTranslationMessages: () =>
|
|
128
|
+
readDefaultCodeTranslationMessages({
|
|
128
129
|
dirPath: path.resolve(__dirname, '..', 'codeTranslations'),
|
|
129
130
|
locale: currentLocale,
|
|
130
|
-
})
|
|
131
|
-
},
|
|
131
|
+
}),
|
|
132
132
|
|
|
133
133
|
getClientModules() {
|
|
134
134
|
const modules = [
|
|
@@ -26,19 +26,17 @@ export default function BlogSidebar({sidebar}) {
|
|
|
26
26
|
{sidebar.title}
|
|
27
27
|
</div>
|
|
28
28
|
<ul className={styles.sidebarItemList}>
|
|
29
|
-
{sidebar.items.map((item) =>
|
|
30
|
-
|
|
31
|
-
<
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
);
|
|
41
|
-
})}
|
|
29
|
+
{sidebar.items.map((item) => (
|
|
30
|
+
<li key={item.permalink} className={styles.sidebarItem}>
|
|
31
|
+
<Link
|
|
32
|
+
isNavLink
|
|
33
|
+
to={item.permalink}
|
|
34
|
+
className={styles.sidebarItemLink}
|
|
35
|
+
activeClassName={styles.sidebarItemLinkActive}>
|
|
36
|
+
{item.title}
|
|
37
|
+
</Link>
|
|
38
|
+
</li>
|
|
39
|
+
))}
|
|
42
40
|
</ul>
|
|
43
41
|
</nav>
|
|
44
42
|
);
|
|
@@ -82,20 +82,18 @@ function DocSidebarDesktop({path, sidebar, onCollapse, isHidden}) {
|
|
|
82
82
|
{hideableSidebar && <HideableSidebarButton onClick={onCollapse} />}
|
|
83
83
|
</div>
|
|
84
84
|
);
|
|
85
|
-
}
|
|
85
|
+
} // eslint-disable-next-line react/function-component-definition
|
|
86
86
|
|
|
87
|
-
const DocSidebarMobileSecondaryMenu = ({toggleSidebar, sidebar, path}) =>
|
|
88
|
-
|
|
89
|
-
<
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
);
|
|
98
|
-
};
|
|
87
|
+
const DocSidebarMobileSecondaryMenu = ({toggleSidebar, sidebar, path}) => (
|
|
88
|
+
<ul className={clsx(ThemeClassNames.docs.docSidebarMenu, 'menu__list')}>
|
|
89
|
+
<DocSidebarItems
|
|
90
|
+
items={sidebar}
|
|
91
|
+
activePath={path}
|
|
92
|
+
onItemClick={() => toggleSidebar()}
|
|
93
|
+
level={1}
|
|
94
|
+
/>
|
|
95
|
+
</ul>
|
|
96
|
+
);
|
|
99
97
|
|
|
100
98
|
function DocSidebarMobile(props) {
|
|
101
99
|
return (
|