@docusaurus/theme-classic 2.0.0-beta.8e9b829d9 → 2.0.0-beta.9
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/README.md +1 -1
- package/codeTranslations/ar.json +12 -6
- package/codeTranslations/base.json +12 -0
- package/codeTranslations/bn.json +6 -0
- package/codeTranslations/cs.json +62 -0
- package/codeTranslations/da.json +6 -0
- package/codeTranslations/de.json +8 -2
- package/codeTranslations/es.json +10 -4
- package/codeTranslations/fa.json +9 -3
- package/codeTranslations/fil.json +6 -0
- package/codeTranslations/fr.json +6 -0
- package/codeTranslations/he.json +6 -0
- package/codeTranslations/hi.json +6 -0
- package/codeTranslations/ja.json +6 -0
- package/codeTranslations/ko.json +6 -0
- package/codeTranslations/pl.json +6 -0
- package/codeTranslations/pt-BR.json +8 -2
- package/codeTranslations/pt-PT.json +6 -0
- package/codeTranslations/ru.json +6 -0
- package/codeTranslations/sr.json +62 -0
- package/codeTranslations/tr.json +9 -3
- package/codeTranslations/vi.json +10 -4
- package/codeTranslations/zh-Hans.json +6 -0
- package/codeTranslations/zh-Hant.json +6 -0
- package/lib/__tests__/validateThemeConfig.test.js +154 -4
- package/lib/index.js +2 -3
- package/lib/prism-include-languages.js +9 -5
- package/lib/theme/AnnouncementBar/index.js +8 -12
- package/lib/theme/AnnouncementBar/styles.module.css +23 -32
- package/lib/theme/BackToTopButton/index.js +27 -13
- package/lib/theme/BackToTopButton/styles.module.css +17 -14
- package/lib/theme/BlogArchivePage/index.js +89 -0
- package/lib/theme/BlogLayout/index.js +2 -6
- package/lib/theme/BlogListPage/index.js +1 -1
- package/lib/theme/BlogPostAuthor/index.js +51 -0
- package/lib/theme/BlogPostAuthor/styles.module.css +12 -0
- package/lib/theme/BlogPostAuthors/index.js +47 -0
- package/lib/theme/BlogPostAuthors/styles.module.css +11 -0
- package/lib/theme/BlogPostItem/index.js +58 -67
- package/lib/theme/BlogPostPage/index.js +33 -4
- package/lib/theme/BlogSidebar/styles.module.css +2 -2
- package/lib/theme/BlogTagsListPage/index.js +3 -28
- package/lib/theme/BlogTagsPostsPage/index.js +5 -8
- package/lib/theme/CodeBlock/index.js +44 -37
- package/lib/theme/CodeBlock/styles.module.css +1 -2
- package/lib/theme/DocItem/index.js +15 -40
- package/lib/theme/DocItem/styles.module.css +2 -12
- package/lib/theme/DocItemFooter/index.js +79 -0
- package/lib/theme/DocItemFooter/styles.module.css +18 -0
- package/lib/theme/DocPage/index.js +18 -13
- package/lib/theme/DocSidebar/index.js +11 -16
- package/lib/theme/DocSidebarItem/index.js +12 -10
- package/lib/theme/DocTagDocListPage/index.js +89 -0
- package/lib/theme/DocTagsListPage/index.js +44 -0
- package/lib/theme/DocVersionBanner/index.js +6 -4
- package/lib/theme/EditThisPage/index.js +3 -1
- package/lib/theme/Footer/index.js +5 -3
- package/lib/theme/Heading/index.js +7 -9
- package/lib/theme/Heading/styles.css +4 -6
- package/lib/theme/Heading/styles.module.css +9 -5
- package/lib/theme/IconClose/index.js +31 -0
- package/lib/theme/LastUpdated/index.js +4 -2
- package/lib/theme/LayoutHead/index.js +13 -11
- package/lib/theme/LayoutProviders/index.js +7 -5
- package/lib/theme/Logo/index.js +14 -12
- package/lib/theme/MDXComponents/index.js +27 -1
- package/lib/theme/MDXComponents/styles.css +11 -0
- package/lib/theme/MDXPage/index.js +2 -1
- package/lib/theme/Navbar/index.js +20 -3
- package/lib/theme/Navbar/styles.module.css +5 -1
- package/lib/theme/NavbarItem/DefaultNavbarItem.js +12 -4
- package/lib/theme/NavbarItem/DocNavbarItem.js +5 -3
- package/lib/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +7 -1
- package/lib/theme/NavbarItem/DropdownNavbarItem.js +3 -3
- package/lib/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +3 -4
- package/lib/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib/theme/NavbarItem/index.js +5 -0
- package/lib/theme/Seo/index.js +10 -7
- package/lib/theme/TOC/index.js +9 -30
- package/lib/theme/TOC/styles.module.css +1 -1
- package/lib/theme/TOCCollapsible/index.js +5 -3
- package/lib/theme/TOCInline/index.js +7 -27
- package/lib/theme/TOCItems/index.js +78 -0
- package/lib/theme/Tabs/__tests__/index.test.js +123 -0
- package/lib/theme/Tabs/index.js +73 -50
- package/lib/theme/Tabs/styles.module.css +0 -13
- package/lib/theme/Tag/index.js +40 -0
- package/lib/theme/Tag/styles.module.css +70 -0
- package/lib/theme/TagsListByLetter/index.js +48 -0
- package/lib/theme/TagsListByLetter/styles.module.css +11 -0
- package/lib/theme/TagsListInline/index.js +44 -0
- package/lib/theme/TagsListInline/styles.module.css +15 -0
- package/lib/theme/ThemedImage/index.js +3 -5
- package/lib/theme/Toggle/index.js +23 -18
- package/lib/theme/Toggle/styles.module.css +91 -0
- package/lib/theme/hooks/useHideableNavbar.js +14 -31
- package/lib/theme/hooks/useTheme.js +2 -2
- package/lib/theme/hooks/useWindowSize.js +2 -7
- package/lib/theme/prism-include-languages.js +4 -3
- package/lib/translations.js +4 -4
- package/lib/types.d.ts +216 -105
- package/lib/validateThemeConfig.js +215 -254
- package/lib-next/__tests__/validateThemeConfig.test.js +154 -4
- package/lib-next/index.js +1 -2
- package/lib-next/prism-include-languages.js +0 -2
- package/lib-next/theme/AnnouncementBar/index.js +7 -12
- package/lib-next/theme/AnnouncementBar/styles.module.css +23 -32
- package/lib-next/theme/BackToTopButton/index.js +37 -17
- package/lib-next/theme/BackToTopButton/styles.module.css +17 -14
- package/lib-next/theme/BlogArchivePage/index.js +80 -0
- package/lib-next/theme/BlogLayout/index.js +4 -7
- package/lib-next/theme/BlogListPage/index.js +1 -0
- package/lib-next/theme/BlogPostAuthor/index.js +46 -0
- package/lib-next/theme/BlogPostAuthor/styles.module.css +12 -0
- package/lib-next/theme/BlogPostAuthors/index.js +34 -0
- package/lib-next/theme/BlogPostAuthors/styles.module.css +11 -0
- package/lib-next/theme/BlogPostItem/index.js +79 -86
- package/lib-next/theme/BlogPostPage/index.js +55 -8
- package/lib-next/theme/BlogSidebar/styles.module.css +2 -2
- package/lib-next/theme/BlogTagsListPage/index.js +7 -39
- package/lib-next/theme/BlogTagsPostsPage/index.js +3 -4
- package/lib-next/theme/CodeBlock/index.js +53 -49
- package/lib-next/theme/CodeBlock/styles.module.css +1 -2
- package/lib-next/theme/DocItem/index.js +27 -45
- package/lib-next/theme/DocItem/styles.module.css +2 -12
- package/lib-next/theme/DocItemFooter/index.js +79 -0
- package/lib-next/theme/DocItemFooter/styles.module.css +18 -0
- package/lib-next/theme/DocPage/index.js +18 -14
- package/lib-next/theme/DocSidebar/index.js +18 -15
- package/lib-next/theme/DocSidebarItem/index.js +31 -11
- package/lib-next/theme/DocTagDocListPage/index.js +89 -0
- package/lib-next/theme/DocTagsListPage/index.js +38 -0
- package/lib-next/theme/DocVersionBanner/index.js +16 -9
- package/lib-next/theme/EditThisPage/index.js +6 -1
- package/lib-next/theme/Footer/index.js +14 -3
- package/lib-next/theme/Heading/index.js +10 -13
- package/lib-next/theme/Heading/styles.css +4 -6
- package/lib-next/theme/Heading/styles.module.css +9 -5
- package/lib-next/theme/IconClose/index.js +23 -0
- package/lib-next/theme/LastUpdated/index.js +3 -2
- package/lib-next/theme/LayoutHead/index.js +9 -15
- package/lib-next/theme/LayoutProviders/index.js +8 -5
- package/lib-next/theme/Logo/index.js +23 -19
- package/lib-next/theme/MDXComponents/index.js +20 -1
- package/lib-next/theme/MDXComponents/styles.css +11 -0
- package/lib-next/theme/MDXPage/index.js +10 -2
- package/lib-next/theme/Navbar/index.js +27 -3
- package/lib-next/theme/Navbar/styles.module.css +5 -1
- package/lib-next/theme/NavbarItem/DefaultNavbarItem.js +15 -4
- package/lib-next/theme/NavbarItem/DocNavbarItem.js +5 -3
- package/lib-next/theme/NavbarItem/DocsVersionDropdownNavbarItem.js +12 -4
- package/lib-next/theme/NavbarItem/DropdownNavbarItem.js +4 -6
- package/lib-next/theme/NavbarItem/{LocaleDropdownNavbarItem.js → LocaleDropdownNavbarItem/index.js} +2 -6
- package/lib-next/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/lib-next/theme/NavbarItem/index.js +2 -0
- package/lib-next/theme/Seo/index.js +11 -7
- package/lib-next/theme/TOC/index.js +12 -36
- package/lib-next/theme/TOC/styles.module.css +1 -1
- package/lib-next/theme/TOCCollapsible/index.js +12 -3
- package/lib-next/theme/TOCInline/index.js +10 -28
- package/lib-next/theme/TOCItems/index.js +85 -0
- package/lib-next/theme/Tabs/__tests__/index.test.js +142 -0
- package/lib-next/theme/Tabs/index.js +91 -43
- package/lib-next/theme/Tabs/styles.module.css +0 -13
- package/lib-next/theme/Tag/index.js +27 -0
- package/lib-next/theme/Tag/styles.module.css +70 -0
- package/lib-next/theme/TagsListByLetter/index.js +42 -0
- package/lib-next/theme/TagsListByLetter/styles.module.css +11 -0
- package/lib-next/theme/TagsListInline/index.js +31 -0
- package/lib-next/theme/TagsListInline/styles.module.css +15 -0
- package/lib-next/theme/ThemedImage/index.js +3 -3
- package/lib-next/theme/Toggle/index.js +20 -15
- package/lib-next/theme/Toggle/styles.module.css +91 -0
- package/lib-next/theme/hooks/useHideableNavbar.js +31 -47
- package/lib-next/theme/hooks/useTheme.js +2 -2
- package/lib-next/theme/hooks/useWindowSize.js +2 -6
- package/lib-next/theme/prism-include-languages.js +2 -1
- package/lib-next/translations.js +6 -10
- package/lib-next/types.d.ts +216 -105
- package/lib-next/validateThemeConfig.js +40 -36
- package/package.json +23 -19
- package/src/__tests__/validateThemeConfig.test.js +154 -4
- package/src/index.ts +11 -9
- package/src/{prism-include-languages.js → prism-include-languages.ts} +0 -0
- package/src/theme/AnnouncementBar/index.tsx +8 -12
- package/src/theme/AnnouncementBar/styles.module.css +23 -32
- package/src/theme/BackToTopButton/index.tsx +39 -17
- package/src/theme/BackToTopButton/styles.module.css +17 -14
- package/src/theme/BlogArchivePage/index.tsx +91 -0
- package/src/theme/BlogLayout/index.tsx +4 -8
- package/src/theme/BlogListPage/index.tsx +1 -0
- package/src/theme/BlogPostAuthor/index.tsx +49 -0
- package/src/theme/BlogPostAuthor/styles.module.css +12 -0
- package/src/theme/BlogPostAuthors/index.tsx +36 -0
- package/src/theme/BlogPostAuthors/styles.module.css +11 -0
- package/src/theme/BlogPostItem/index.tsx +70 -80
- package/src/theme/BlogPostPage/index.tsx +57 -8
- package/src/theme/BlogSidebar/styles.module.css +2 -2
- package/src/theme/BlogTagsListPage/index.tsx +7 -41
- package/src/theme/BlogTagsPostsPage/index.tsx +3 -4
- package/src/theme/CodeBlock/index.tsx +63 -47
- package/src/theme/CodeBlock/styles.module.css +1 -2
- package/src/theme/DocItem/index.tsx +27 -46
- package/src/theme/DocItem/styles.module.css +2 -12
- package/src/theme/DocItemFooter/index.tsx +91 -0
- package/src/theme/DocItemFooter/styles.module.css +18 -0
- package/src/theme/DocPage/index.tsx +16 -12
- package/src/theme/DocSidebar/index.tsx +20 -16
- package/src/theme/DocSidebarItem/index.tsx +29 -10
- package/src/theme/DocTagDocListPage/index.tsx +89 -0
- package/src/theme/DocTagsListPage/index.tsx +41 -0
- package/src/theme/DocVersionBanner/index.tsx +26 -15
- package/src/theme/EditThisPage/index.tsx +6 -1
- package/src/theme/Footer/index.tsx +16 -3
- package/src/theme/Heading/index.tsx +10 -13
- package/src/theme/Heading/styles.css +4 -6
- package/src/theme/Heading/styles.module.css +9 -5
- package/src/theme/IconClose/index.tsx +26 -0
- package/src/theme/LastUpdated/index.tsx +3 -2
- package/src/theme/LayoutHead/index.tsx +9 -9
- package/src/theme/LayoutProviders/index.tsx +8 -5
- package/src/theme/Logo/index.tsx +19 -15
- package/src/theme/MDXComponents/index.tsx +20 -1
- package/src/theme/MDXComponents/styles.css +11 -0
- package/src/theme/MDXPage/index.tsx +10 -2
- package/src/theme/Navbar/index.tsx +26 -2
- package/src/theme/Navbar/styles.module.css +5 -1
- package/src/theme/NavbarItem/DefaultNavbarItem.tsx +15 -4
- package/src/theme/NavbarItem/DocNavbarItem.tsx +9 -5
- package/src/theme/NavbarItem/DocsVersionDropdownNavbarItem.tsx +15 -6
- package/src/theme/NavbarItem/DocsVersionNavbarItem.tsx +7 -3
- package/src/theme/NavbarItem/DropdownNavbarItem.tsx +4 -6
- package/src/theme/NavbarItem/{LocaleDropdownNavbarItem.tsx → LocaleDropdownNavbarItem/index.tsx} +6 -5
- package/src/theme/NavbarItem/LocaleDropdownNavbarItem/styles.module.css +11 -0
- package/src/theme/NavbarItem/index.tsx +6 -1
- package/src/theme/Seo/index.tsx +7 -4
- package/src/theme/TOC/index.tsx +13 -38
- package/src/theme/TOC/styles.module.css +1 -1
- package/src/theme/TOCCollapsible/index.tsx +8 -2
- package/src/theme/TOCInline/index.tsx +13 -32
- package/src/theme/TOCItems/index.tsx +96 -0
- package/src/theme/Tabs/__tests__/index.test.tsx +129 -0
- package/src/theme/Tabs/index.tsx +93 -49
- package/src/theme/Tabs/styles.module.css +0 -13
- package/src/theme/Tag/index.tsx +31 -0
- package/src/theme/Tag/styles.module.css +70 -0
- package/src/theme/TagsListByLetter/index.tsx +45 -0
- package/src/theme/TagsListByLetter/styles.module.css +11 -0
- package/src/theme/TagsListInline/index.tsx +35 -0
- package/src/theme/TagsListInline/styles.module.css +15 -0
- package/src/theme/ThemedImage/index.tsx +3 -3
- package/src/theme/Toggle/index.tsx +20 -15
- package/src/theme/Toggle/styles.module.css +91 -0
- package/src/theme/hooks/useContextualSearchFilters.ts +1 -1
- package/src/theme/hooks/useHideableNavbar.ts +32 -47
- package/src/theme/hooks/useTabGroupChoice.ts +2 -2
- package/src/theme/hooks/useTheme.ts +2 -2
- package/src/theme/hooks/useWindowSize.ts +2 -7
- package/src/theme/prism-include-languages.ts +3 -2
- package/src/translations.ts +6 -10
- package/src/types.d.ts +216 -105
- package/src/{validateThemeConfig.js → validateThemeConfig.ts} +46 -12
- package/tsconfig.json +0 -1
- package/update-code-translations.js +5 -4
- package/update-code-translations.test.js +1 -1
- package/update.js +151 -0
- package/lib/theme/Toggle/styles.css +0 -103
- package/lib/theme/hooks/useScrollPosition.js +0 -51
- package/lib/theme/hooks/useTOCHighlight.js +0 -87
- package/lib-next/theme/Toggle/styles.css +0 -103
- package/lib-next/theme/hooks/useScrollPosition.js +0 -42
- package/lib-next/theme/hooks/useTOCHighlight.js +0 -84
- package/src/theme/Toggle/styles.css +0 -103
- package/src/theme/hooks/useScrollPosition.ts +0 -52
- package/src/theme/hooks/useTOCHighlight.ts +0 -98
|
@@ -1,19 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.validateThemeConfig = validateThemeConfig;
|
|
7
|
+
exports.ThemeConfigSchema = void 0;
|
|
8
|
+
|
|
9
|
+
var _utilsValidation = require("@docusaurus/utils-validation");
|
|
10
|
+
|
|
1
11
|
/**
|
|
2
12
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
13
|
*
|
|
4
14
|
* This source code is licensed under the MIT license found in the
|
|
5
15
|
* LICENSE file in the root directory of this source tree.
|
|
6
16
|
*/
|
|
7
|
-
|
|
8
|
-
const {Joi, URISchema} = require('@docusaurus/utils-validation');
|
|
9
|
-
|
|
10
17
|
const DEFAULT_DOCS_CONFIG = {
|
|
11
|
-
versionPersistence: 'localStorage'
|
|
18
|
+
versionPersistence: 'localStorage'
|
|
12
19
|
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
.default(DEFAULT_DOCS_CONFIG.versionPersistence),
|
|
20
|
+
|
|
21
|
+
const DocsSchema = _utilsValidation.Joi.object({
|
|
22
|
+
versionPersistence: _utilsValidation.Joi.string().equal('localStorage', 'none').default(DEFAULT_DOCS_CONFIG.versionPersistence)
|
|
17
23
|
}).default(DEFAULT_DOCS_CONFIG);
|
|
18
24
|
|
|
19
25
|
const DEFAULT_COLOR_MODE_CONFIG = {
|
|
@@ -24,314 +30,269 @@ const DEFAULT_COLOR_MODE_CONFIG = {
|
|
|
24
30
|
darkIcon: '🌜',
|
|
25
31
|
darkIconStyle: {},
|
|
26
32
|
lightIcon: '🌞',
|
|
27
|
-
lightIconStyle: {}
|
|
28
|
-
}
|
|
33
|
+
lightIconStyle: {}
|
|
34
|
+
}
|
|
29
35
|
};
|
|
30
|
-
|
|
31
36
|
const DEFAULT_CONFIG = {
|
|
32
37
|
colorMode: DEFAULT_COLOR_MODE_CONFIG,
|
|
33
38
|
docs: DEFAULT_DOCS_CONFIG,
|
|
34
39
|
metadatas: [],
|
|
35
40
|
prism: {
|
|
36
|
-
additionalLanguages: []
|
|
41
|
+
additionalLanguages: []
|
|
37
42
|
},
|
|
38
43
|
navbar: {
|
|
39
44
|
hideOnScroll: false,
|
|
40
|
-
items: []
|
|
45
|
+
items: []
|
|
41
46
|
},
|
|
42
47
|
hideableSidebar: false,
|
|
48
|
+
tableOfContents: {
|
|
49
|
+
minHeadingLevel: 2,
|
|
50
|
+
maxHeadingLevel: 3
|
|
51
|
+
}
|
|
43
52
|
};
|
|
44
53
|
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
|
45
54
|
|
|
46
|
-
const NavbarItemPosition = Joi.string().equal('left', 'right').default('left');
|
|
55
|
+
const NavbarItemPosition = _utilsValidation.Joi.string().equal('left', 'right').default('left');
|
|
47
56
|
|
|
48
|
-
const NavbarItemBaseSchema = Joi.object({
|
|
49
|
-
label: Joi.string(),
|
|
50
|
-
className: Joi.string()
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
.unknown();
|
|
57
|
+
const NavbarItemBaseSchema = _utilsValidation.Joi.object({
|
|
58
|
+
label: _utilsValidation.Joi.string(),
|
|
59
|
+
className: _utilsValidation.Joi.string()
|
|
60
|
+
}) // We allow any unknown attributes on the links
|
|
61
|
+
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
|
62
|
+
.unknown();
|
|
55
63
|
|
|
56
64
|
const DefaultNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
57
|
-
to: Joi.string(),
|
|
58
|
-
href: URISchema,
|
|
59
|
-
activeBasePath: Joi.string(),
|
|
60
|
-
activeBaseRegex: Joi.string(),
|
|
61
|
-
prependBaseUrlToHref: Joi.bool(),
|
|
65
|
+
to: _utilsValidation.Joi.string(),
|
|
66
|
+
href: _utilsValidation.URISchema,
|
|
67
|
+
activeBasePath: _utilsValidation.Joi.string(),
|
|
68
|
+
activeBaseRegex: _utilsValidation.Joi.string(),
|
|
69
|
+
prependBaseUrlToHref: _utilsValidation.Joi.bool(),
|
|
62
70
|
// This is only triggered in case of a nested dropdown
|
|
63
|
-
items: Joi.forbidden().messages({
|
|
64
|
-
'any.unknown': 'Nested dropdowns are not allowed'
|
|
65
|
-
})
|
|
66
|
-
})
|
|
67
|
-
.xor
|
|
68
|
-
|
|
69
|
-
'object.xor': 'One and only one between "to" and "href" should be provided',
|
|
70
|
-
});
|
|
71
|
-
|
|
71
|
+
items: _utilsValidation.Joi.forbidden().messages({
|
|
72
|
+
'any.unknown': 'Nested dropdowns are not allowed'
|
|
73
|
+
})
|
|
74
|
+
}).xor('href', 'to').messages({
|
|
75
|
+
'object.xor': 'One and only one between "to" and "href" should be provided'
|
|
76
|
+
});
|
|
72
77
|
const DocsVersionNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
73
|
-
type: Joi.string().equal('docsVersion').required(),
|
|
74
|
-
to: Joi.string(),
|
|
75
|
-
docsPluginId: Joi.string()
|
|
78
|
+
type: _utilsValidation.Joi.string().equal('docsVersion').required(),
|
|
79
|
+
to: _utilsValidation.Joi.string(),
|
|
80
|
+
docsPluginId: _utilsValidation.Joi.string()
|
|
76
81
|
});
|
|
77
|
-
|
|
78
82
|
const DocItemSchema = NavbarItemBaseSchema.append({
|
|
79
|
-
type: Joi.string().equal('doc').required(),
|
|
80
|
-
docId: Joi.string().required(),
|
|
81
|
-
docsPluginId: Joi.string()
|
|
82
|
-
activeSidebarClassName: Joi.string().default('navbar__link--active'),
|
|
83
|
+
type: _utilsValidation.Joi.string().equal('doc').required(),
|
|
84
|
+
docId: _utilsValidation.Joi.string().required(),
|
|
85
|
+
docsPluginId: _utilsValidation.Joi.string()
|
|
83
86
|
});
|
|
84
87
|
|
|
85
|
-
const itemWithType =
|
|
88
|
+
const itemWithType = type => {
|
|
86
89
|
// because equal(undefined) is not supported :/
|
|
87
|
-
const typeSchema = type
|
|
88
|
-
|
|
89
|
-
:
|
|
90
|
-
|
|
91
|
-
type: typeSchema,
|
|
92
|
-
})
|
|
93
|
-
.unknown()
|
|
94
|
-
.required();
|
|
90
|
+
const typeSchema = type ? _utilsValidation.Joi.string().required().equal(type) : _utilsValidation.Joi.string().forbidden();
|
|
91
|
+
return _utilsValidation.Joi.object({
|
|
92
|
+
type: typeSchema
|
|
93
|
+
}).unknown().required();
|
|
95
94
|
};
|
|
96
95
|
|
|
97
|
-
const DropdownSubitemSchema = Joi.object({
|
|
98
|
-
position: Joi.forbidden()
|
|
99
|
-
}).when({
|
|
100
|
-
switch: [
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
itemWithType('search'),
|
|
119
|
-
),
|
|
120
|
-
then: Joi.forbidden().messages({
|
|
121
|
-
'any.unknown': 'Nested dropdowns are not allowed',
|
|
122
|
-
}),
|
|
123
|
-
},
|
|
124
|
-
],
|
|
125
|
-
otherwise: Joi.forbidden().messages({
|
|
126
|
-
'any.unknown': 'Bad navbar item type {.type}',
|
|
127
|
-
}),
|
|
96
|
+
const DropdownSubitemSchema = _utilsValidation.Joi.object({
|
|
97
|
+
position: _utilsValidation.Joi.forbidden()
|
|
98
|
+
}).when('.', {
|
|
99
|
+
switch: [{
|
|
100
|
+
is: itemWithType('docsVersion'),
|
|
101
|
+
then: DocsVersionNavbarItemSchema
|
|
102
|
+
}, {
|
|
103
|
+
is: itemWithType('doc'),
|
|
104
|
+
then: DocItemSchema
|
|
105
|
+
}, {
|
|
106
|
+
is: itemWithType(undefined),
|
|
107
|
+
then: DefaultNavbarItemSchema
|
|
108
|
+
}, {
|
|
109
|
+
is: _utilsValidation.Joi.alternatives().try(itemWithType('dropdown'), itemWithType('docsVersionDropdown'), itemWithType('localeDropdown'), itemWithType('search')),
|
|
110
|
+
then: _utilsValidation.Joi.forbidden().messages({
|
|
111
|
+
'any.unknown': 'Nested dropdowns are not allowed'
|
|
112
|
+
})
|
|
113
|
+
}],
|
|
114
|
+
otherwise: _utilsValidation.Joi.forbidden().messages({
|
|
115
|
+
'any.unknown': 'Bad navbar item type {.type}'
|
|
116
|
+
})
|
|
128
117
|
});
|
|
129
118
|
|
|
130
119
|
const DropdownNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
131
|
-
items: Joi.array().items(DropdownSubitemSchema).required()
|
|
120
|
+
items: _utilsValidation.Joi.array().items(DropdownSubitemSchema).required()
|
|
132
121
|
});
|
|
133
|
-
|
|
134
122
|
const DocsVersionDropdownNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
135
|
-
type: Joi.string().equal('docsVersionDropdown').required(),
|
|
136
|
-
docsPluginId: Joi.string(),
|
|
137
|
-
dropdownActiveClassDisabled: Joi.boolean(),
|
|
138
|
-
dropdownItemsBefore: Joi.array().items(DropdownSubitemSchema).default([]),
|
|
139
|
-
dropdownItemsAfter: Joi.array().items(DropdownSubitemSchema).default([])
|
|
123
|
+
type: _utilsValidation.Joi.string().equal('docsVersionDropdown').required(),
|
|
124
|
+
docsPluginId: _utilsValidation.Joi.string(),
|
|
125
|
+
dropdownActiveClassDisabled: _utilsValidation.Joi.boolean(),
|
|
126
|
+
dropdownItemsBefore: _utilsValidation.Joi.array().items(DropdownSubitemSchema).default([]),
|
|
127
|
+
dropdownItemsAfter: _utilsValidation.Joi.array().items(DropdownSubitemSchema).default([])
|
|
140
128
|
});
|
|
141
|
-
|
|
142
129
|
const LocaleDropdownNavbarItemSchema = NavbarItemBaseSchema.append({
|
|
143
|
-
type: Joi.string().equal('localeDropdown').required(),
|
|
144
|
-
dropdownItemsBefore: Joi.array().items(DropdownSubitemSchema).default([]),
|
|
145
|
-
dropdownItemsAfter: Joi.array().items(DropdownSubitemSchema).default([])
|
|
130
|
+
type: _utilsValidation.Joi.string().equal('localeDropdown').required(),
|
|
131
|
+
dropdownItemsBefore: _utilsValidation.Joi.array().items(DropdownSubitemSchema).default([]),
|
|
132
|
+
dropdownItemsAfter: _utilsValidation.Joi.array().items(DropdownSubitemSchema).default([])
|
|
146
133
|
});
|
|
147
134
|
|
|
148
|
-
const SearchItemSchema = Joi.object({
|
|
149
|
-
type: Joi.string().equal('search').required()
|
|
135
|
+
const SearchItemSchema = _utilsValidation.Joi.object({
|
|
136
|
+
type: _utilsValidation.Joi.string().equal('search').required()
|
|
150
137
|
});
|
|
151
138
|
|
|
152
|
-
const NavbarItemSchema = Joi.object({
|
|
153
|
-
position: NavbarItemPosition
|
|
154
|
-
}).when({
|
|
155
|
-
switch: [
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
139
|
+
const NavbarItemSchema = _utilsValidation.Joi.object({
|
|
140
|
+
position: NavbarItemPosition
|
|
141
|
+
}).when('.', {
|
|
142
|
+
switch: [{
|
|
143
|
+
is: itemWithType('docsVersion'),
|
|
144
|
+
then: DocsVersionNavbarItemSchema
|
|
145
|
+
}, {
|
|
146
|
+
is: itemWithType('dropdown'),
|
|
147
|
+
then: DropdownNavbarItemSchema
|
|
148
|
+
}, {
|
|
149
|
+
is: itemWithType('docsVersionDropdown'),
|
|
150
|
+
then: DocsVersionDropdownNavbarItemSchema
|
|
151
|
+
}, {
|
|
152
|
+
is: itemWithType('doc'),
|
|
153
|
+
then: DocItemSchema
|
|
154
|
+
}, {
|
|
155
|
+
is: itemWithType('localeDropdown'),
|
|
156
|
+
then: LocaleDropdownNavbarItemSchema
|
|
157
|
+
}, {
|
|
158
|
+
is: itemWithType('search'),
|
|
159
|
+
then: SearchItemSchema
|
|
160
|
+
}, {
|
|
161
|
+
is: itemWithType(undefined),
|
|
162
|
+
then: _utilsValidation.Joi.object().when('.', {
|
|
163
|
+
// Dropdown item can be specified without type field
|
|
164
|
+
is: _utilsValidation.Joi.object({
|
|
165
|
+
items: _utilsValidation.Joi.array().required()
|
|
166
|
+
}).unknown(),
|
|
162
167
|
then: DropdownNavbarItemSchema,
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
is: itemWithType('doc'),
|
|
170
|
-
then: DocItemSchema,
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
is: itemWithType('localeDropdown'),
|
|
174
|
-
then: LocaleDropdownNavbarItemSchema,
|
|
175
|
-
},
|
|
176
|
-
{
|
|
177
|
-
is: itemWithType('search'),
|
|
178
|
-
then: SearchItemSchema,
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
is: itemWithType(undefined),
|
|
182
|
-
then: Joi.object().when({
|
|
183
|
-
// Dropdown item can be specified without type field
|
|
184
|
-
is: Joi.object({
|
|
185
|
-
items: Joi.array().required(),
|
|
186
|
-
}).unknown(),
|
|
187
|
-
then: DropdownNavbarItemSchema,
|
|
188
|
-
otherwise: DefaultNavbarItemSchema,
|
|
189
|
-
}),
|
|
190
|
-
},
|
|
191
|
-
],
|
|
192
|
-
otherwise: Joi.forbidden().messages({
|
|
193
|
-
'any.unknown': 'Bad navbar item type {.type}',
|
|
194
|
-
}),
|
|
168
|
+
otherwise: DefaultNavbarItemSchema
|
|
169
|
+
})
|
|
170
|
+
}],
|
|
171
|
+
otherwise: _utilsValidation.Joi.forbidden().messages({
|
|
172
|
+
'any.unknown': 'Bad navbar item type {.type}'
|
|
173
|
+
})
|
|
195
174
|
});
|
|
196
175
|
|
|
197
|
-
const ColorModeSchema = Joi.object({
|
|
198
|
-
defaultMode: Joi.string()
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
DEFAULT_COLOR_MODE_CONFIG.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
),
|
|
209
|
-
darkIconStyle: Joi.object().default(
|
|
210
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIconStyle,
|
|
211
|
-
),
|
|
212
|
-
lightIcon: Joi.string().default(
|
|
213
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIcon,
|
|
214
|
-
),
|
|
215
|
-
lightIconStyle: Joi.object().default(
|
|
216
|
-
DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIconStyle,
|
|
217
|
-
),
|
|
218
|
-
}).default(DEFAULT_COLOR_MODE_CONFIG.switchConfig),
|
|
219
|
-
}).default(DEFAULT_COLOR_MODE_CONFIG);
|
|
176
|
+
const ColorModeSchema = _utilsValidation.Joi.object({
|
|
177
|
+
defaultMode: _utilsValidation.Joi.string().equal('dark', 'light').default(DEFAULT_COLOR_MODE_CONFIG.defaultMode),
|
|
178
|
+
disableSwitch: _utilsValidation.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.disableSwitch),
|
|
179
|
+
respectPrefersColorScheme: _utilsValidation.Joi.bool().default(DEFAULT_COLOR_MODE_CONFIG.respectPrefersColorScheme),
|
|
180
|
+
switchConfig: _utilsValidation.Joi.object({
|
|
181
|
+
darkIcon: _utilsValidation.Joi.string().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIcon),
|
|
182
|
+
darkIconStyle: _utilsValidation.Joi.object().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.darkIconStyle),
|
|
183
|
+
lightIcon: _utilsValidation.Joi.string().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIcon),
|
|
184
|
+
lightIconStyle: _utilsValidation.Joi.object().default(DEFAULT_COLOR_MODE_CONFIG.switchConfig.lightIconStyle)
|
|
185
|
+
}).default(DEFAULT_COLOR_MODE_CONFIG.switchConfig)
|
|
186
|
+
}).default(DEFAULT_COLOR_MODE_CONFIG); // schema can probably be improved
|
|
220
187
|
|
|
221
|
-
|
|
222
|
-
const HtmlMetadataSchema = Joi.object({
|
|
223
|
-
id: Joi.string(),
|
|
224
|
-
name: Joi.string(),
|
|
225
|
-
property: Joi.string(),
|
|
226
|
-
content: Joi.string(),
|
|
227
|
-
itemprop: Joi.string()
|
|
188
|
+
|
|
189
|
+
const HtmlMetadataSchema = _utilsValidation.Joi.object({
|
|
190
|
+
id: _utilsValidation.Joi.string(),
|
|
191
|
+
name: _utilsValidation.Joi.string(),
|
|
192
|
+
property: _utilsValidation.Joi.string(),
|
|
193
|
+
content: _utilsValidation.Joi.string(),
|
|
194
|
+
itemprop: _utilsValidation.Joi.string()
|
|
228
195
|
}).unknown();
|
|
229
196
|
|
|
230
|
-
const FooterLinkItemSchema = Joi.object({
|
|
231
|
-
to: Joi.string(),
|
|
232
|
-
href: URISchema,
|
|
233
|
-
html: Joi.string(),
|
|
234
|
-
label: Joi.string()
|
|
235
|
-
})
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
.with('href', 'label')
|
|
239
|
-
.nand('html', 'label')
|
|
240
|
-
// We allow any unknown attributes on the links
|
|
241
|
-
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
|
242
|
-
.unknown();
|
|
197
|
+
const FooterLinkItemSchema = _utilsValidation.Joi.object({
|
|
198
|
+
to: _utilsValidation.Joi.string(),
|
|
199
|
+
href: _utilsValidation.URISchema,
|
|
200
|
+
html: _utilsValidation.Joi.string(),
|
|
201
|
+
label: _utilsValidation.Joi.string()
|
|
202
|
+
}).xor('to', 'href', 'html').with('to', 'label').with('href', 'label').nand('html', 'label') // We allow any unknown attributes on the links
|
|
203
|
+
// (users may need additional attributes like target, aria-role, data-customAttribute...)
|
|
204
|
+
.unknown();
|
|
243
205
|
|
|
244
|
-
const CustomCssSchema = Joi.alternatives()
|
|
245
|
-
.try(Joi.array().items(Joi.string().required()), Joi.string().required())
|
|
246
|
-
.optional();
|
|
206
|
+
const CustomCssSchema = _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array().items(_utilsValidation.Joi.string().required()), _utilsValidation.Joi.string().required()).optional();
|
|
247
207
|
|
|
248
|
-
const ThemeConfigSchema = Joi.object({
|
|
208
|
+
const ThemeConfigSchema = _utilsValidation.Joi.object({
|
|
249
209
|
// TODO temporary (@alpha-58)
|
|
250
|
-
disableDarkMode: Joi.any().forbidden(
|
|
251
|
-
'any.unknown':
|
|
252
|
-
'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true',
|
|
210
|
+
disableDarkMode: _utilsValidation.Joi.any().forbidden().messages({
|
|
211
|
+
'any.unknown': 'disableDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.disableSwitch = true'
|
|
253
212
|
}),
|
|
254
213
|
// TODO temporary (@alpha-58)
|
|
255
|
-
defaultDarkMode: Joi.any().forbidden(
|
|
256
|
-
'any.unknown':
|
|
257
|
-
'defaultDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.defaultMode = "dark"',
|
|
214
|
+
defaultDarkMode: _utilsValidation.Joi.any().forbidden().messages({
|
|
215
|
+
'any.unknown': 'defaultDarkMode theme config is deprecated. Please use the new colorMode attribute. You likely want: config.themeConfig.colorMode.defaultMode = "dark"'
|
|
258
216
|
}),
|
|
259
217
|
customCss: CustomCssSchema,
|
|
260
218
|
colorMode: ColorModeSchema,
|
|
261
|
-
image: Joi.string(),
|
|
219
|
+
image: _utilsValidation.Joi.string(),
|
|
262
220
|
docs: DocsSchema,
|
|
263
|
-
metadatas: Joi.array()
|
|
264
|
-
|
|
265
|
-
.default(
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
textColor: Joi.string(),
|
|
271
|
-
isCloseable: Joi.bool().default(true),
|
|
221
|
+
metadatas: _utilsValidation.Joi.array().items(HtmlMetadataSchema).default(DEFAULT_CONFIG.metadatas),
|
|
222
|
+
announcementBar: _utilsValidation.Joi.object({
|
|
223
|
+
id: _utilsValidation.Joi.string().default('announcement-bar'),
|
|
224
|
+
content: _utilsValidation.Joi.string().required(),
|
|
225
|
+
backgroundColor: _utilsValidation.Joi.string(),
|
|
226
|
+
textColor: _utilsValidation.Joi.string(),
|
|
227
|
+
isCloseable: _utilsValidation.Joi.bool().default(true)
|
|
272
228
|
}).optional(),
|
|
273
|
-
navbar: Joi.object({
|
|
274
|
-
style: Joi.string().equal('dark', 'primary'),
|
|
275
|
-
hideOnScroll: Joi.bool().default(DEFAULT_CONFIG.navbar.hideOnScroll),
|
|
229
|
+
navbar: _utilsValidation.Joi.object({
|
|
230
|
+
style: _utilsValidation.Joi.string().equal('dark', 'primary'),
|
|
231
|
+
hideOnScroll: _utilsValidation.Joi.bool().default(DEFAULT_CONFIG.navbar.hideOnScroll),
|
|
276
232
|
// TODO temporary (@alpha-58)
|
|
277
|
-
links: Joi.any().forbidden().messages({
|
|
278
|
-
'any.unknown':
|
|
279
|
-
'themeConfig.navbar.links has been renamed as themeConfig.navbar.items',
|
|
280
|
-
}),
|
|
281
|
-
items: Joi.array()
|
|
282
|
-
.items(NavbarItemSchema)
|
|
283
|
-
.default(DEFAULT_CONFIG.navbar.items),
|
|
284
|
-
title: Joi.string().allow('', null),
|
|
285
|
-
logo: Joi.object({
|
|
286
|
-
alt: Joi.string().allow(''),
|
|
287
|
-
src: Joi.string().required(),
|
|
288
|
-
srcDark: Joi.string(),
|
|
289
|
-
href: Joi.string(),
|
|
290
|
-
target: Joi.string(),
|
|
233
|
+
links: _utilsValidation.Joi.any().forbidden().messages({
|
|
234
|
+
'any.unknown': 'themeConfig.navbar.links has been renamed as themeConfig.navbar.items'
|
|
291
235
|
}),
|
|
236
|
+
items: _utilsValidation.Joi.array().items(NavbarItemSchema).default(DEFAULT_CONFIG.navbar.items),
|
|
237
|
+
title: _utilsValidation.Joi.string().allow('', null),
|
|
238
|
+
logo: _utilsValidation.Joi.object({
|
|
239
|
+
alt: _utilsValidation.Joi.string().allow(''),
|
|
240
|
+
src: _utilsValidation.Joi.string().required(),
|
|
241
|
+
srcDark: _utilsValidation.Joi.string(),
|
|
242
|
+
width: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.string(), _utilsValidation.Joi.number()),
|
|
243
|
+
height: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.string(), _utilsValidation.Joi.number()),
|
|
244
|
+
href: _utilsValidation.Joi.string(),
|
|
245
|
+
target: _utilsValidation.Joi.string()
|
|
246
|
+
})
|
|
292
247
|
}).default(DEFAULT_CONFIG.navbar),
|
|
293
|
-
footer: Joi.object({
|
|
294
|
-
style: Joi.string().equal('dark', 'light').default('light'),
|
|
295
|
-
logo: Joi.object({
|
|
296
|
-
alt: Joi.string().allow(''),
|
|
297
|
-
src: Joi.string(),
|
|
298
|
-
srcDark: Joi.string(),
|
|
299
|
-
|
|
248
|
+
footer: _utilsValidation.Joi.object({
|
|
249
|
+
style: _utilsValidation.Joi.string().equal('dark', 'light').default('light'),
|
|
250
|
+
logo: _utilsValidation.Joi.object({
|
|
251
|
+
alt: _utilsValidation.Joi.string().allow(''),
|
|
252
|
+
src: _utilsValidation.Joi.string(),
|
|
253
|
+
srcDark: _utilsValidation.Joi.string(),
|
|
254
|
+
// TODO infer this from reading the image
|
|
255
|
+
width: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.string(), _utilsValidation.Joi.number()),
|
|
256
|
+
height: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.string(), _utilsValidation.Joi.number()),
|
|
257
|
+
href: _utilsValidation.Joi.string()
|
|
300
258
|
}),
|
|
301
|
-
copyright: Joi.string(),
|
|
302
|
-
links: Joi.array()
|
|
303
|
-
.
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
items: Joi.array().items(FooterLinkItemSchema).default([]),
|
|
307
|
-
}),
|
|
308
|
-
)
|
|
309
|
-
.default([]),
|
|
259
|
+
copyright: _utilsValidation.Joi.string(),
|
|
260
|
+
links: _utilsValidation.Joi.array().items(_utilsValidation.Joi.object({
|
|
261
|
+
title: _utilsValidation.Joi.string().allow(null),
|
|
262
|
+
items: _utilsValidation.Joi.array().items(FooterLinkItemSchema).default([])
|
|
263
|
+
})).default([])
|
|
310
264
|
}).optional(),
|
|
311
|
-
prism: Joi.object({
|
|
312
|
-
theme: Joi.object({
|
|
313
|
-
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
314
|
-
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required()
|
|
265
|
+
prism: _utilsValidation.Joi.object({
|
|
266
|
+
theme: _utilsValidation.Joi.object({
|
|
267
|
+
plain: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array(), _utilsValidation.Joi.object()).required(),
|
|
268
|
+
styles: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array(), _utilsValidation.Joi.object()).required()
|
|
315
269
|
}),
|
|
316
|
-
darkTheme: Joi.object({
|
|
317
|
-
plain: Joi.alternatives().try(Joi.array(), Joi.object()).required(),
|
|
318
|
-
styles: Joi.alternatives().try(Joi.array(), Joi.object()).required()
|
|
270
|
+
darkTheme: _utilsValidation.Joi.object({
|
|
271
|
+
plain: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array(), _utilsValidation.Joi.object()).required(),
|
|
272
|
+
styles: _utilsValidation.Joi.alternatives().try(_utilsValidation.Joi.array(), _utilsValidation.Joi.object()).required()
|
|
319
273
|
}),
|
|
320
|
-
defaultLanguage: Joi.string(),
|
|
321
|
-
additionalLanguages: Joi.array()
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
.
|
|
326
|
-
.unknown(),
|
|
327
|
-
hideableSidebar: Joi.bool().default(DEFAULT_CONFIG.hideableSidebar),
|
|
328
|
-
sidebarCollapsible: Joi.forbidden().messages({
|
|
329
|
-
'any.unknown':
|
|
330
|
-
'The themeConfig.sidebarCollapsible has been moved to docs plugin options. See: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs',
|
|
274
|
+
defaultLanguage: _utilsValidation.Joi.string(),
|
|
275
|
+
additionalLanguages: _utilsValidation.Joi.array().items(_utilsValidation.Joi.string()).default(DEFAULT_CONFIG.prism.additionalLanguages)
|
|
276
|
+
}).default(DEFAULT_CONFIG.prism).unknown(),
|
|
277
|
+
hideableSidebar: _utilsValidation.Joi.bool().default(DEFAULT_CONFIG.hideableSidebar),
|
|
278
|
+
sidebarCollapsible: _utilsValidation.Joi.forbidden().messages({
|
|
279
|
+
'any.unknown': 'The themeConfig.sidebarCollapsible has been moved to docs plugin options. See: https://docusaurus.io/docs/api/plugins/@docusaurus/plugin-content-docs'
|
|
331
280
|
}),
|
|
281
|
+
tableOfContents: _utilsValidation.Joi.object({
|
|
282
|
+
minHeadingLevel: _utilsValidation.Joi.number().default(DEFAULT_CONFIG.tableOfContents.minHeadingLevel).when('maxHeadingLevel', {
|
|
283
|
+
is: _utilsValidation.Joi.exist(),
|
|
284
|
+
then: _utilsValidation.Joi.number().integer().min(2).max(6).max(_utilsValidation.Joi.ref('maxHeadingLevel')),
|
|
285
|
+
otherwise: _utilsValidation.Joi.number().integer().min(2).max(6)
|
|
286
|
+
}),
|
|
287
|
+
maxHeadingLevel: _utilsValidation.Joi.number().integer().min(2).max(6).default(DEFAULT_CONFIG.tableOfContents.maxHeadingLevel)
|
|
288
|
+
}).default(DEFAULT_CONFIG.tableOfContents)
|
|
332
289
|
});
|
|
290
|
+
|
|
333
291
|
exports.ThemeConfigSchema = ThemeConfigSchema;
|
|
334
292
|
|
|
335
|
-
|
|
293
|
+
function validateThemeConfig({
|
|
294
|
+
validate,
|
|
295
|
+
themeConfig
|
|
296
|
+
}) {
|
|
336
297
|
return validate(ThemeConfigSchema, themeConfig);
|
|
337
|
-
}
|
|
298
|
+
}
|