@docusaurus/theme-classic 0.0.0-4379 → 0.0.0-4391

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.
@@ -44,7 +44,8 @@ declare module '@theme/BlogListPaginator' {
44
44
  }
45
45
 
46
46
  declare module '@theme/BlogPostItem' {
47
- import type {FrontMatter, Assets, Metadata} from '@theme/BlogPostPage';
47
+ import type {FrontMatter, Metadata} from '@theme/BlogPostPage';
48
+ import type {Assets} from '@docusaurus/plugin-content-blog';
48
49
 
49
50
  export interface Props {
50
51
  readonly frontMatter: FrontMatter;
@@ -70,7 +71,8 @@ declare module '@theme/BlogPostAuthor' {
70
71
  }
71
72
 
72
73
  declare module '@theme/BlogPostAuthors' {
73
- import type {Metadata, Assets} from '@theme/BlogPostPage';
74
+ import type {Metadata} from '@theme/BlogPostPage';
75
+ import type {Assets} from '@docusaurus/plugin-content-blog';
74
76
 
75
77
  export interface Props {
76
78
  readonly authors: Metadata['authors'];
@@ -57,7 +57,7 @@ export default function DocsVersionDropdownNavbarItem({
57
57
  activeDocContext.activeVersion ?? preferredVersion ?? latestVersion; // Mobile dropdown is handled a bit differently
58
58
 
59
59
  const dropdownLabel =
60
- mobile && items
60
+ mobile && items.length > 1
61
61
  ? translate({
62
62
  id: 'theme.navbar.mobileVersionsDropdown.label',
63
63
  message: 'Versions',
@@ -66,7 +66,9 @@ export default function DocsVersionDropdownNavbarItem({
66
66
  })
67
67
  : dropdownVersion.label;
68
68
  const dropdownTo =
69
- mobile && items ? undefined : getVersionMainDoc(dropdownVersion).path; // We don't want to render a version dropdown with 0 or 1 item
69
+ mobile && items.length > 1
70
+ ? undefined
71
+ : getVersionMainDoc(dropdownVersion).path; // We don't want to render a version dropdown with 0 or 1 item
70
72
  // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
71
73
  // We'd rather render a button instead of a dropdown
72
74
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docusaurus/theme-classic",
3
- "version": "0.0.0-4379",
3
+ "version": "0.0.0-4391",
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-4379",
27
- "@docusaurus/plugin-content-blog": "0.0.0-4379",
28
- "@docusaurus/plugin-content-docs": "0.0.0-4379",
29
- "@docusaurus/plugin-content-pages": "0.0.0-4379",
30
- "@docusaurus/theme-common": "0.0.0-4379",
31
- "@docusaurus/theme-translations": "0.0.0-4379",
32
- "@docusaurus/utils": "0.0.0-4379",
33
- "@docusaurus/utils-validation": "0.0.0-4379",
26
+ "@docusaurus/core": "0.0.0-4391",
27
+ "@docusaurus/plugin-content-blog": "0.0.0-4391",
28
+ "@docusaurus/plugin-content-docs": "0.0.0-4391",
29
+ "@docusaurus/plugin-content-pages": "0.0.0-4391",
30
+ "@docusaurus/theme-common": "0.0.0-4391",
31
+ "@docusaurus/theme-translations": "0.0.0-4391",
32
+ "@docusaurus/utils": "0.0.0-4391",
33
+ "@docusaurus/utils-validation": "0.0.0-4391",
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-4379",
49
- "@docusaurus/types": "0.0.0-4379",
48
+ "@docusaurus/module-type-aliases": "0.0.0-4391",
49
+ "@docusaurus/types": "0.0.0-4391",
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": "92aba1ab0bda5fe2b1f6cc8cdd50677051187dcb"
64
+ "gitHead": "16a313077f39acf0b712f20b277d92a94d7393ac"
65
65
  }
@@ -15,9 +15,9 @@ import clsx from 'clsx';
15
15
  import {getInfimaActiveClassName} from '@theme/NavbarItem/utils';
16
16
  import type {Props} from '@theme/NavbarItem/DocNavbarItem';
17
17
  import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
18
- import type {GlobalDataVersion} from '@docusaurus/plugin-content-docs';
18
+ import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client';
19
19
 
20
- function getDocInVersions(versions: GlobalDataVersion[], docId: string) {
20
+ function getDocInVersions(versions: GlobalVersion[], docId: string) {
21
21
  const allDocs = versions.flatMap((version) => version.docs);
22
22
  const doc = allDocs.find((versionDoc) => versionDoc.id === docId);
23
23
  if (!doc) {
@@ -46,7 +46,7 @@ export default function DocNavbarItem({
46
46
  const versions = uniq(
47
47
  [activeVersion, preferredVersion, latestVersion].filter(
48
48
  Boolean,
49
- ) as GlobalDataVersion[],
49
+ ) as GlobalVersion[],
50
50
  );
51
51
  const doc = getDocInVersions(versions, docId);
52
52
  const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
@@ -17,11 +17,11 @@ import {useDocsPreferredVersion, uniq} from '@docusaurus/theme-common';
17
17
 
18
18
  import type {Props} from '@theme/NavbarItem/DocSidebarNavbarItem';
19
19
  import type {
20
- GlobalDataVersion,
21
- GlobalDataSidebar,
22
- } from '@docusaurus/plugin-content-docs';
20
+ GlobalVersion,
21
+ GlobalSidebar,
22
+ } from '@docusaurus/plugin-content-docs/client';
23
23
 
24
- function getSidebarLink(versions: GlobalDataVersion[], sidebarId: string) {
24
+ function getSidebarLink(versions: GlobalVersion[], sidebarId: string) {
25
25
  const allSidebars = versions
26
26
  .flatMap((version) => {
27
27
  if (version.sidebars) {
@@ -30,8 +30,7 @@ function getSidebarLink(versions: GlobalDataVersion[], sidebarId: string) {
30
30
  return undefined;
31
31
  })
32
32
  .filter(
33
- (sidebarItem): sidebarItem is [string, GlobalDataSidebar] =>
34
- !!sidebarItem,
33
+ (sidebarItem): sidebarItem is [string, GlobalSidebar] => !!sidebarItem,
35
34
  );
36
35
  const sidebarEntry = allSidebars.find((sidebar) => sidebar[0] === sidebarId);
37
36
  if (!sidebarEntry) {
@@ -65,7 +64,7 @@ export default function DocSidebarNavbarItem({
65
64
  const versions = uniq(
66
65
  [activeVersion, preferredVersion, latestVersion].filter(
67
66
  Boolean,
68
- ) as GlobalDataVersion[],
67
+ ) as GlobalVersion[],
69
68
  );
70
69
  const sidebarLink = getSidebarLink(versions, sidebarId);
71
70
  const activeDocInfimaClassName = getInfimaActiveClassName(props.mobile);
@@ -16,9 +16,10 @@ import {
16
16
  import type {Props} from '@theme/NavbarItem/DocsVersionDropdownNavbarItem';
17
17
  import {useDocsPreferredVersion} from '@docusaurus/theme-common';
18
18
  import {translate} from '@docusaurus/Translate';
19
- import type {GlobalDataVersion} from '@docusaurus/plugin-content-docs';
19
+ import type {GlobalVersion} from '@docusaurus/plugin-content-docs/client';
20
+ import type {LinkLikeNavbarItemProps} from '@theme/NavbarItem';
20
21
 
21
- const getVersionMainDoc = (version: GlobalDataVersion) =>
22
+ const getVersionMainDoc = (version: GlobalVersion) =>
22
23
  version.docs.find((doc) => doc.id === version.mainDocId)!;
23
24
 
24
25
  export default function DocsVersionDropdownNavbarItem({
@@ -36,7 +37,7 @@ export default function DocsVersionDropdownNavbarItem({
36
37
  const {preferredVersion, savePreferredVersionName} =
37
38
  useDocsPreferredVersion(docsPluginId);
38
39
 
39
- function getItems() {
40
+ function getItems(): LinkLikeNavbarItemProps[] {
40
41
  const versionLinks = versions.map((version) => {
41
42
  // We try to link to the same doc, in another version
42
43
  // When not possible, fallback to the "main doc" of the version
@@ -64,7 +65,7 @@ export default function DocsVersionDropdownNavbarItem({
64
65
 
65
66
  // Mobile dropdown is handled a bit differently
66
67
  const dropdownLabel =
67
- mobile && items
68
+ mobile && items.length > 1
68
69
  ? translate({
69
70
  id: 'theme.navbar.mobileVersionsDropdown.label',
70
71
  message: 'Versions',
@@ -73,7 +74,9 @@ export default function DocsVersionDropdownNavbarItem({
73
74
  })
74
75
  : dropdownVersion.label;
75
76
  const dropdownTo =
76
- mobile && items ? undefined : getVersionMainDoc(dropdownVersion).path;
77
+ mobile && items.length > 1
78
+ ? undefined
79
+ : getVersionMainDoc(dropdownVersion).path;
77
80
 
78
81
  // We don't want to render a version dropdown with 0 or 1 item
79
82
  // If we build the site with a single docs version (onlyIncludeVersions: ['1.0.0'])
@@ -44,7 +44,8 @@ declare module '@theme/BlogListPaginator' {
44
44
  }
45
45
 
46
46
  declare module '@theme/BlogPostItem' {
47
- import type {FrontMatter, Assets, Metadata} from '@theme/BlogPostPage';
47
+ import type {FrontMatter, Metadata} from '@theme/BlogPostPage';
48
+ import type {Assets} from '@docusaurus/plugin-content-blog';
48
49
 
49
50
  export interface Props {
50
51
  readonly frontMatter: FrontMatter;
@@ -70,7 +71,8 @@ declare module '@theme/BlogPostAuthor' {
70
71
  }
71
72
 
72
73
  declare module '@theme/BlogPostAuthors' {
73
- import type {Metadata, Assets} from '@theme/BlogPostPage';
74
+ import type {Metadata} from '@theme/BlogPostPage';
75
+ import type {Assets} from '@docusaurus/plugin-content-blog';
74
76
 
75
77
  export interface Props {
76
78
  readonly authors: Metadata['authors'];