@docusaurus/theme-classic 0.0.0-4304 → 0.0.0-4305

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.
@@ -69,14 +69,14 @@ function translateNavbar(navbar, navbarTranslations) {
69
69
  }
70
70
 
71
71
  function isMultiColumnFooterLinks(links) {
72
- return 'title' in links[0];
72
+ return links.length > 0 && 'title' in links[0];
73
73
  }
74
74
 
75
75
  function getFooterTranslationFile(footer) {
76
- const footerLinkTitles = isMultiColumnFooterLinks(footer.links) ? (0, _lodash.chain)(footer.links.filter(link => !!link.title)).keyBy(link => `link.title.${link.title}`).mapValues(link => ({
76
+ const footerLinkTitles = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.filter(link => !!link.title) : []).keyBy(link => `link.title.${link.title}`).mapValues(link => ({
77
77
  message: link.title,
78
78
  description: `The title of the footer links column with title=${link.title} in the footer`
79
- })).value() : {};
79
+ })).value();
80
80
  const footerLinkLabels = (0, _lodash.chain)(isMultiColumnFooterLinks(footer.links) ? footer.links.flatMap(link => link.items).filter(link => !!link.label) : footer.links.filter(link => !!link.label)).keyBy(linkItem => `link.item.label.${linkItem.label}`).mapValues(linkItem => {
81
81
  var _linkItem$to;
82
82
 
@@ -263,9 +263,9 @@ const ThemeConfigSchema = _utilsValidation.Joi.object({
263
263
  links: _utilsValidation.Joi.alternatives(_utilsValidation.Joi.array().items(_utilsValidation.Joi.object({
264
264
  title: _utilsValidation.Joi.string().allow(null).default(null),
265
265
  items: _utilsValidation.Joi.array().items(FooterLinkItemSchema).default([])
266
- })).default([]), _utilsValidation.Joi.array().items(FooterLinkItemSchema).default([])).messages({
266
+ })), _utilsValidation.Joi.array().items(FooterLinkItemSchema)).messages({
267
267
  'alternatives.match': `The footer must be either simple or multi-column, and not a mix of the two. See: https://docusaurus.io/docs/api/themes/configuration#footer-links`
268
- })
268
+ }).default([])
269
269
  }).optional(),
270
270
  prism: _utilsValidation.Joi.object({
271
271
  theme: _utilsValidation.Joi.object({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4304",
3
+ "version": "0.0.0-4305",
4
4
  "description": "Classic theme for Docusaurus",
5
5
  "main": "lib/index.js",
6
6
  "types": "src/theme-classic.d.ts",
@@ -23,14 +23,14 @@
23
23
  "update-code-translations": "node -e 'require(\"./update-code-translations.js\").run()'"
24
24
  },
25
25
  "dependencies": {
26
- "@docusaurus/core": "0.0.0-4304",
27
- "@docusaurus/plugin-content-blog": "0.0.0-4304",
28
- "@docusaurus/plugin-content-docs": "0.0.0-4304",
29
- "@docusaurus/plugin-content-pages": "0.0.0-4304",
30
- "@docusaurus/theme-common": "0.0.0-4304",
31
- "@docusaurus/theme-translations": "0.0.0-4304",
32
- "@docusaurus/utils": "0.0.0-4304",
33
- "@docusaurus/utils-validation": "0.0.0-4304",
26
+ "@docusaurus/core": "0.0.0-4305",
27
+ "@docusaurus/plugin-content-blog": "0.0.0-4305",
28
+ "@docusaurus/plugin-content-docs": "0.0.0-4305",
29
+ "@docusaurus/plugin-content-pages": "0.0.0-4305",
30
+ "@docusaurus/theme-common": "0.0.0-4305",
31
+ "@docusaurus/theme-translations": "0.0.0-4305",
32
+ "@docusaurus/utils": "0.0.0-4305",
33
+ "@docusaurus/utils-validation": "0.0.0-4305",
34
34
  "@mdx-js/mdx": "^1.6.21",
35
35
  "@mdx-js/react": "^1.6.21",
36
36
  "clsx": "^1.1.1",
@@ -45,8 +45,8 @@
45
45
  "rtlcss": "^3.3.0"
46
46
  },
47
47
  "devDependencies": {
48
- "@docusaurus/module-type-aliases": "0.0.0-4304",
49
- "@docusaurus/types": "0.0.0-4304",
48
+ "@docusaurus/module-type-aliases": "0.0.0-4305",
49
+ "@docusaurus/types": "0.0.0-4305",
50
50
  "@types/mdx-js__react": "^1.5.4",
51
51
  "@types/parse-numeric-range": "^0.0.1",
52
52
  "@types/rtlcss": "^3.1.1",
@@ -61,5 +61,5 @@
61
61
  "engines": {
62
62
  "node": ">=14"
63
63
  },
64
- "gitHead": "741cabdc2fdced32592aa340740e35a5b30de55e"
64
+ "gitHead": "4a85dc6ac221bf5771365cbb856daeb61fe24a33"
65
65
  }
@@ -74,21 +74,21 @@ function translateNavbar(
74
74
  function isMultiColumnFooterLinks(
75
75
  links: MultiColumnFooter['links'] | SimpleFooter['links'],
76
76
  ): links is MultiColumnFooter['links'] {
77
- return 'title' in links[0];
77
+ return links.length > 0 && 'title' in links[0];
78
78
  }
79
79
 
80
80
  function getFooterTranslationFile(footer: Footer): TranslationFileContent {
81
- const footerLinkTitles: TranslationFileContent = isMultiColumnFooterLinks(
82
- footer.links,
81
+ const footerLinkTitles: TranslationFileContent = chain(
82
+ isMultiColumnFooterLinks(footer.links)
83
+ ? footer.links.filter((link) => !!link.title)
84
+ : [],
83
85
  )
84
- ? chain(footer.links.filter((link) => !!link.title))
85
- .keyBy((link) => `link.title.${link.title}`)
86
- .mapValues((link) => ({
87
- message: link.title!,
88
- description: `The title of the footer links column with title=${link.title} in the footer`,
89
- }))
90
- .value()
91
- : {};
86
+ .keyBy((link) => `link.title.${link.title}`)
87
+ .mapValues((link) => ({
88
+ message: link.title!,
89
+ description: `The title of the footer links column with title=${link.title} in the footer`,
90
+ }))
91
+ .value();
92
92
 
93
93
  const footerLinkLabels: TranslationFileContent = chain(
94
94
  isMultiColumnFooterLinks(footer.links)
@@ -312,18 +312,18 @@ const ThemeConfigSchema = Joi.object({
312
312
  }),
313
313
  copyright: Joi.string(),
314
314
  links: Joi.alternatives(
315
- Joi.array()
316
- .items(
317
- Joi.object({
318
- title: Joi.string().allow(null).default(null),
319
- items: Joi.array().items(FooterLinkItemSchema).default([]),
320
- }),
321
- )
322
- .default([]),
323
- Joi.array().items(FooterLinkItemSchema).default([]),
324
- ).messages({
325
- 'alternatives.match': `The footer must be either simple or multi-column, and not a mix of the two. See: https://docusaurus.io/docs/api/themes/configuration#footer-links`,
326
- }),
315
+ Joi.array().items(
316
+ Joi.object({
317
+ title: Joi.string().allow(null).default(null),
318
+ items: Joi.array().items(FooterLinkItemSchema).default([]),
319
+ }),
320
+ ),
321
+ Joi.array().items(FooterLinkItemSchema),
322
+ )
323
+ .messages({
324
+ 'alternatives.match': `The footer must be either simple or multi-column, and not a mix of the two. See: https://docusaurus.io/docs/api/themes/configuration#footer-links`,
325
+ })
326
+ .default([]),
327
327
  }).optional(),
328
328
  prism: Joi.object({
329
329
  theme: Joi.object({