@docusaurus/plugin-content-docs 3.6.3 → 3.7.0
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/client/doc.d.ts +1 -1
- package/lib/client/docSidebarItemsExpandedState.d.ts +1 -1
- package/lib/client/docsPreferredVersion.d.ts +1 -1
- package/lib/client/docsSidebar.d.ts +1 -1
- package/lib/client/docsUtils.d.ts +2 -1
- package/lib/client/docsUtils.js +1 -0
- package/lib/client/docsVersion.d.ts +1 -1
- package/package.json +13 -13
- package/src/client/doc.tsx +1 -1
- package/src/client/docSidebarItemsExpandedState.tsx +1 -1
- package/src/client/docsPreferredVersion.tsx +2 -2
- package/src/client/docsSidebar.tsx +1 -1
- package/src/client/docsUtils.tsx +3 -2
- package/src/client/docsVersion.tsx +1 -1
- package/src/plugin-content-docs.d.ts +18 -9
package/lib/client/doc.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export type DocContextValue = Pick<PropDocContent, 'metadata' | 'frontMatter' |
|
|
|
18
18
|
export declare function DocProvider({ children, content, }: {
|
|
19
19
|
children: ReactNode;
|
|
20
20
|
content: PropDocContent;
|
|
21
|
-
}):
|
|
21
|
+
}): ReactNode;
|
|
22
22
|
/**
|
|
23
23
|
* Returns the data of the currently browsed doc. Gives access to the doc's MDX
|
|
24
24
|
* Component, front matter, metadata, TOC, etc. When swizzling a low-level
|
|
@@ -12,7 +12,7 @@ import { type GlobalVersion } from '@docusaurus/plugin-content-docs/client';
|
|
|
12
12
|
*/
|
|
13
13
|
export declare function DocsPreferredVersionContextProvider({ children, }: {
|
|
14
14
|
children: ReactNode;
|
|
15
|
-
}):
|
|
15
|
+
}): ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Returns a read-write interface to a plugin's preferred version. The
|
|
18
18
|
* "preferred version" is defined as the last version that the user visited.
|
|
@@ -17,7 +17,7 @@ export declare function DocsSidebarProvider({ children, name, items, }: {
|
|
|
17
17
|
children: ReactNode;
|
|
18
18
|
name: string | undefined;
|
|
19
19
|
items: PropSidebar | undefined;
|
|
20
|
-
}):
|
|
20
|
+
}): ReactNode;
|
|
21
21
|
/**
|
|
22
22
|
* Gets the sidebar that's currently displayed, or `null` if there isn't one
|
|
23
23
|
*/
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* This source code is licensed under the MIT license found in the
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
|
+
import { type ReactNode } from 'react';
|
|
7
8
|
import { type GlobalVersion, type GlobalSidebar, type GlobalDoc } from '@docusaurus/plugin-content-docs/client';
|
|
8
9
|
import type { Props as DocRootProps } from '@theme/DocRoot';
|
|
9
10
|
import type { PropSidebar, PropSidebarItem, PropSidebarItemCategory, PropVersionDoc, PropSidebarBreadcrumbsItem } from '@docusaurus/plugin-content-docs';
|
|
@@ -90,7 +91,7 @@ export declare function useLayoutDoc(docId: string, docsPluginId?: string): Glob
|
|
|
90
91
|
*/
|
|
91
92
|
export declare function useDocRootMetadata({ route }: DocRootProps): null | {
|
|
92
93
|
/** The element that should be rendered at the current location. */
|
|
93
|
-
docElement:
|
|
94
|
+
docElement: ReactNode;
|
|
94
95
|
/**
|
|
95
96
|
* The name of the sidebar associated with the current doc. `sidebarName` and
|
|
96
97
|
* `sidebarItems` correspond to the value of {@link useDocsSidebar}.
|
package/lib/client/docsUtils.js
CHANGED
|
@@ -110,6 +110,7 @@ export function isVisibleSidebarItem(item, activePath) {
|
|
|
110
110
|
switch (item.type) {
|
|
111
111
|
case 'category':
|
|
112
112
|
return (isActiveSidebarItem(item, activePath) ||
|
|
113
|
+
(typeof item.href !== 'undefined' && !item.linkUnlisted) ||
|
|
113
114
|
item.items.some((subItem) => isVisibleSidebarItem(subItem, activePath)));
|
|
114
115
|
case 'link':
|
|
115
116
|
// An unlisted item remains visible if it is active
|
|
@@ -12,7 +12,7 @@ import type { PropVersionMetadata } from '@docusaurus/plugin-content-docs';
|
|
|
12
12
|
export declare function DocsVersionProvider({ children, version, }: {
|
|
13
13
|
children: ReactNode;
|
|
14
14
|
version: PropVersionMetadata | null;
|
|
15
|
-
}):
|
|
15
|
+
}): ReactNode;
|
|
16
16
|
/**
|
|
17
17
|
* Gets the version metadata of the current doc page.
|
|
18
18
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@docusaurus/plugin-content-docs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.7.0",
|
|
4
4
|
"description": "Docs plugin for Docusaurus.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
},
|
|
36
36
|
"license": "MIT",
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@docusaurus/core": "3.
|
|
39
|
-
"@docusaurus/logger": "3.
|
|
40
|
-
"@docusaurus/mdx-loader": "3.
|
|
41
|
-
"@docusaurus/module-type-aliases": "3.
|
|
42
|
-
"@docusaurus/theme-common": "3.
|
|
43
|
-
"@docusaurus/types": "3.
|
|
44
|
-
"@docusaurus/utils": "3.
|
|
45
|
-
"@docusaurus/utils-common": "3.
|
|
46
|
-
"@docusaurus/utils-validation": "3.
|
|
38
|
+
"@docusaurus/core": "3.7.0",
|
|
39
|
+
"@docusaurus/logger": "3.7.0",
|
|
40
|
+
"@docusaurus/mdx-loader": "3.7.0",
|
|
41
|
+
"@docusaurus/module-type-aliases": "3.7.0",
|
|
42
|
+
"@docusaurus/theme-common": "3.7.0",
|
|
43
|
+
"@docusaurus/types": "3.7.0",
|
|
44
|
+
"@docusaurus/utils": "3.7.0",
|
|
45
|
+
"@docusaurus/utils-common": "3.7.0",
|
|
46
|
+
"@docusaurus/utils-validation": "3.7.0",
|
|
47
47
|
"@types/react-router-config": "^5.0.7",
|
|
48
48
|
"combine-promises": "^1.1.0",
|
|
49
49
|
"fs-extra": "^11.1.1",
|
|
@@ -61,11 +61,11 @@
|
|
|
61
61
|
"shelljs": "^0.8.5"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
|
-
"react": "^18.0.0",
|
|
65
|
-
"react-dom": "^18.0.0"
|
|
64
|
+
"react": "^18.0.0 || ^19.0.0",
|
|
65
|
+
"react-dom": "^18.0.0 || ^19.0.0"
|
|
66
66
|
},
|
|
67
67
|
"engines": {
|
|
68
68
|
"node": ">=18.0"
|
|
69
69
|
},
|
|
70
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "dd59750c16fe6908a26f18806a54d4c3dbe6db43"
|
|
71
71
|
}
|
package/src/client/doc.tsx
CHANGED
|
@@ -50,7 +50,7 @@ export function DocProvider({
|
|
|
50
50
|
}: {
|
|
51
51
|
children: ReactNode;
|
|
52
52
|
content: PropDocContent;
|
|
53
|
-
}):
|
|
53
|
+
}): ReactNode {
|
|
54
54
|
const contextValue = useContextValue(content);
|
|
55
55
|
return <Context.Provider value={contextValue}>{children}</Context.Provider>;
|
|
56
56
|
}
|
|
@@ -36,7 +36,7 @@ export function DocSidebarItemsExpandedStateProvider({
|
|
|
36
36
|
children,
|
|
37
37
|
}: {
|
|
38
38
|
children: ReactNode;
|
|
39
|
-
}):
|
|
39
|
+
}): ReactNode {
|
|
40
40
|
const [expandedItem, setExpandedItem] = useState<number | null>(null);
|
|
41
41
|
const contextValue = useMemo(
|
|
42
42
|
() => ({expandedItem, setExpandedItem}),
|
|
@@ -163,7 +163,7 @@ function DocsPreferredVersionContextProviderUnsafe({
|
|
|
163
163
|
children,
|
|
164
164
|
}: {
|
|
165
165
|
children: ReactNode;
|
|
166
|
-
}):
|
|
166
|
+
}): ReactNode {
|
|
167
167
|
const value = useContextValue();
|
|
168
168
|
return <Context.Provider value={value}>{children}</Context.Provider>;
|
|
169
169
|
}
|
|
@@ -176,7 +176,7 @@ export function DocsPreferredVersionContextProvider({
|
|
|
176
176
|
children,
|
|
177
177
|
}: {
|
|
178
178
|
children: ReactNode;
|
|
179
|
-
}):
|
|
179
|
+
}): ReactNode {
|
|
180
180
|
return (
|
|
181
181
|
<DocsPreferredVersionContextProviderUnsafe>
|
|
182
182
|
{children}
|
|
@@ -30,7 +30,7 @@ export function DocsSidebarProvider({
|
|
|
30
30
|
children: ReactNode;
|
|
31
31
|
name: string | undefined;
|
|
32
32
|
items: PropSidebar | undefined;
|
|
33
|
-
}):
|
|
33
|
+
}): ReactNode {
|
|
34
34
|
const stableValue: ContextValue | null = useMemo(
|
|
35
35
|
() => (name && items ? {name, items} : null),
|
|
36
36
|
[name, items],
|
package/src/client/docsUtils.tsx
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* LICENSE file in the root directory of this source tree.
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import {useMemo} from 'react';
|
|
8
|
+
import {type ReactNode, useMemo} from 'react';
|
|
9
9
|
import {matchPath, useLocation} from '@docusaurus/router';
|
|
10
10
|
import renderRoutes from '@docusaurus/renderRoutes';
|
|
11
11
|
import {
|
|
@@ -168,6 +168,7 @@ export function isVisibleSidebarItem(
|
|
|
168
168
|
case 'category':
|
|
169
169
|
return (
|
|
170
170
|
isActiveSidebarItem(item, activePath) ||
|
|
171
|
+
(typeof item.href !== 'undefined' && !item.linkUnlisted) ||
|
|
171
172
|
item.items.some((subItem) => isVisibleSidebarItem(subItem, activePath))
|
|
172
173
|
);
|
|
173
174
|
case 'link':
|
|
@@ -363,7 +364,7 @@ Available doc ids are:
|
|
|
363
364
|
*/
|
|
364
365
|
export function useDocRootMetadata({route}: DocRootProps): null | {
|
|
365
366
|
/** The element that should be rendered at the current location. */
|
|
366
|
-
docElement:
|
|
367
|
+
docElement: ReactNode;
|
|
367
368
|
/**
|
|
368
369
|
* The name of the sidebar associated with the current doc. `sidebarName` and
|
|
369
370
|
* `sidebarItems` correspond to the value of {@link useDocsSidebar}.
|
|
@@ -562,10 +562,11 @@ declare module '@docusaurus/plugin-content-docs' {
|
|
|
562
562
|
}
|
|
563
563
|
|
|
564
564
|
declare module '@theme/DocItem' {
|
|
565
|
+
import type {ReactNode} from 'react';
|
|
565
566
|
import type {PropDocContent} from '@docusaurus/plugin-content-docs';
|
|
566
567
|
|
|
567
568
|
export type DocumentRoute = {
|
|
568
|
-
readonly component: () =>
|
|
569
|
+
readonly component: () => ReactNode;
|
|
569
570
|
readonly exact: boolean;
|
|
570
571
|
readonly path: string;
|
|
571
572
|
readonly sidebar?: string;
|
|
@@ -576,10 +577,11 @@ declare module '@theme/DocItem' {
|
|
|
576
577
|
readonly content: PropDocContent;
|
|
577
578
|
}
|
|
578
579
|
|
|
579
|
-
export default function DocItem(props: Props):
|
|
580
|
+
export default function DocItem(props: Props): ReactNode;
|
|
580
581
|
}
|
|
581
582
|
|
|
582
583
|
declare module '@theme/DocCategoryGeneratedIndexPage' {
|
|
584
|
+
import type {ReactNode} from 'react';
|
|
583
585
|
import type {PropCategoryGeneratedIndex} from '@docusaurus/plugin-content-docs';
|
|
584
586
|
|
|
585
587
|
export interface Props {
|
|
@@ -588,39 +590,45 @@ declare module '@theme/DocCategoryGeneratedIndexPage' {
|
|
|
588
590
|
|
|
589
591
|
export default function DocCategoryGeneratedIndexPage(
|
|
590
592
|
props: Props,
|
|
591
|
-
):
|
|
593
|
+
): ReactNode;
|
|
592
594
|
}
|
|
593
595
|
|
|
594
596
|
declare module '@theme/DocTagsListPage' {
|
|
597
|
+
import type {ReactNode} from 'react';
|
|
595
598
|
import type {PropTagsListPage} from '@docusaurus/plugin-content-docs';
|
|
596
599
|
|
|
597
600
|
export interface Props extends PropTagsListPage {}
|
|
598
|
-
export default function DocTagsListPage(props: Props):
|
|
601
|
+
export default function DocTagsListPage(props: Props): ReactNode;
|
|
599
602
|
}
|
|
600
603
|
|
|
601
604
|
declare module '@theme/DocTagDocListPage' {
|
|
605
|
+
import type {ReactNode} from 'react';
|
|
602
606
|
import type {PropTagDocList} from '@docusaurus/plugin-content-docs';
|
|
603
607
|
|
|
604
608
|
export interface Props {
|
|
605
609
|
readonly tag: PropTagDocList;
|
|
606
610
|
}
|
|
607
|
-
export default function DocTagDocListPage(props: Props):
|
|
611
|
+
export default function DocTagDocListPage(props: Props): ReactNode;
|
|
608
612
|
}
|
|
609
613
|
|
|
610
614
|
declare module '@theme/DocBreadcrumbs' {
|
|
611
|
-
|
|
615
|
+
import type {ReactNode} from 'react';
|
|
616
|
+
|
|
617
|
+
export default function DocBreadcrumbs(): ReactNode;
|
|
612
618
|
}
|
|
613
619
|
|
|
614
620
|
declare module '@theme/DocsRoot' {
|
|
621
|
+
import type {ReactNode} from 'react';
|
|
615
622
|
import type {RouteConfigComponentProps} from 'react-router-config';
|
|
616
623
|
import type {Required} from 'utility-types';
|
|
617
624
|
|
|
618
625
|
export interface Props extends Required<RouteConfigComponentProps, 'route'> {}
|
|
619
626
|
|
|
620
|
-
export default function DocsRoot(props: Props):
|
|
627
|
+
export default function DocsRoot(props: Props): ReactNode;
|
|
621
628
|
}
|
|
622
629
|
|
|
623
630
|
declare module '@theme/DocVersionRoot' {
|
|
631
|
+
import type {ReactNode} from 'react';
|
|
624
632
|
import type {PropVersionMetadata} from '@docusaurus/plugin-content-docs';
|
|
625
633
|
import type {RouteConfigComponentProps} from 'react-router-config';
|
|
626
634
|
import type {Required} from 'utility-types';
|
|
@@ -629,14 +637,15 @@ declare module '@theme/DocVersionRoot' {
|
|
|
629
637
|
readonly version: PropVersionMetadata;
|
|
630
638
|
}
|
|
631
639
|
|
|
632
|
-
export default function DocVersionRoot(props: Props):
|
|
640
|
+
export default function DocVersionRoot(props: Props): ReactNode;
|
|
633
641
|
}
|
|
634
642
|
|
|
635
643
|
declare module '@theme/DocRoot' {
|
|
644
|
+
import type {ReactNode} from 'react';
|
|
636
645
|
import type {RouteConfigComponentProps} from 'react-router-config';
|
|
637
646
|
import type {Required} from 'utility-types';
|
|
638
647
|
|
|
639
648
|
export interface Props extends Required<RouteConfigComponentProps, 'route'> {}
|
|
640
649
|
|
|
641
|
-
export default function DocRoot(props: Props):
|
|
650
|
+
export default function DocRoot(props: Props): ReactNode;
|
|
642
651
|
}
|