docusaurus-theme-openapi-docs 1.0.6 → 1.1.2
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/theme/ApiDemoPanel/CodeTabs/index.js +8 -3
- package/lib/theme/ApiDemoPanel/FloatingButton/index.js +4 -2
- package/lib/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/lib/theme/ApiDemoPanel/LiveEditor/index.js +17 -4
- package/lib/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib/theme/ApiDemoPanel/Server/index.js +3 -3
- package/lib/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/lib/theme/ApiItem/Content/index.js +65 -0
- package/lib/theme/ApiItem/Footer/index.js +78 -0
- package/lib/theme/ApiItem/Footer/styles.module.css +18 -0
- package/lib/theme/ApiItem/{icons → Layout/icons}/bash-original.svg +0 -0
- package/lib/theme/ApiItem/{icons → Layout/icons}/go-original-wordmark.svg +0 -0
- package/lib/theme/ApiItem/{icons → Layout/icons}/javascript-original.svg +0 -0
- package/lib/theme/ApiItem/{icons → Layout/icons}/linux-original.svg +0 -0
- package/lib/theme/ApiItem/{icons → Layout/icons}/python-original.svg +0 -0
- package/lib/theme/ApiItem/Layout/index.js +93 -0
- package/lib/theme/ApiItem/{styles.module.css → Layout/styles.module.css} +42 -4
- package/lib/theme/ApiItem/Metadata/index.js +32 -0
- package/lib/theme/ApiItem/Paginator/index.js +33 -0
- package/lib/theme/ApiItem/TOC/Desktop/index.js +31 -0
- package/lib/theme/ApiItem/TOC/Mobile/index.js +35 -0
- package/lib/theme/ApiItem/TOC/Mobile/styles.module.css +19 -0
- package/lib/theme/ApiItem/index.js +37 -126
- package/lib/theme/ApiTabs/index.js +17 -6
- package/lib/theme/ApiTabs/styles.module.css +0 -1
- package/lib/theme/SchemaTabs/index.js +258 -0
- package/lib/theme/SchemaTabs/styles.module.css +110 -0
- package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +7 -6
- package/lib-next/theme/ApiDemoPanel/FloatingButton/index.js +6 -2
- package/lib-next/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +14 -3
- package/lib-next/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib-next/theme/ApiDemoPanel/Server/index.js +3 -2
- package/lib-next/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/lib-next/theme/ApiItem/Content/index.js +55 -0
- package/lib-next/theme/ApiItem/Footer/index.js +88 -0
- package/lib-next/theme/ApiItem/Footer/styles.module.css +18 -0
- package/lib-next/theme/ApiItem/{icons → Layout/icons}/bash-original.svg +0 -0
- package/lib-next/theme/ApiItem/{icons → Layout/icons}/go-original-wordmark.svg +0 -0
- package/lib-next/theme/ApiItem/{icons → Layout/icons}/javascript-original.svg +0 -0
- package/lib-next/theme/ApiItem/{icons → Layout/icons}/linux-original.svg +0 -0
- package/lib-next/theme/ApiItem/{icons → Layout/icons}/python-original.svg +0 -0
- package/lib-next/theme/ApiItem/Layout/index.js +69 -0
- package/lib-next/theme/ApiItem/{styles.module.css → Layout/styles.module.css} +42 -4
- package/lib-next/theme/ApiItem/Metadata/index.js +21 -0
- package/lib-next/theme/ApiItem/Paginator/index.js +19 -0
- package/lib-next/theme/ApiItem/TOC/Desktop/index.js +22 -0
- package/lib-next/theme/ApiItem/TOC/Mobile/index.js +24 -0
- package/lib-next/theme/ApiItem/TOC/Mobile/styles.module.css +19 -0
- package/lib-next/theme/ApiItem/index.js +31 -133
- package/lib-next/theme/ApiTabs/index.js +17 -6
- package/lib-next/theme/ApiTabs/styles.module.css +0 -1
- package/lib-next/theme/SchemaTabs/index.js +258 -0
- package/lib-next/theme/SchemaTabs/styles.module.css +110 -0
- package/package.json +6 -6
- package/src/theme/ApiDemoPanel/CodeTabs/index.tsx +6 -5
- package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +6 -2
- package/src/theme/ApiDemoPanel/FloatingButton/styles.module.css +3 -2
- package/src/theme/ApiDemoPanel/LiveEditor/index.tsx +15 -3
- package/src/theme/ApiDemoPanel/LiveEditor/styles.module.css +2 -1
- package/src/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/src/theme/ApiDemoPanel/Server/index.tsx +3 -2
- package/src/theme/ApiDemoPanel/Server/styles.module.css +0 -4
- package/src/theme/ApiItem/Content/index.tsx +57 -0
- package/src/theme/ApiItem/Footer/index.tsx +101 -0
- package/src/theme/ApiItem/Footer/styles.module.css +18 -0
- package/src/theme/ApiItem/{icons → Layout/icons}/bash-original.svg +0 -0
- package/src/theme/ApiItem/{icons → Layout/icons}/go-original-wordmark.svg +0 -0
- package/src/theme/ApiItem/{icons → Layout/icons}/javascript-original.svg +0 -0
- package/src/theme/ApiItem/{icons → Layout/icons}/linux-original.svg +0 -0
- package/src/theme/ApiItem/{icons → Layout/icons}/python-original.svg +0 -0
- package/src/theme/ApiItem/Layout/index.tsx +78 -0
- package/src/theme/ApiItem/{styles.module.css → Layout/styles.module.css} +42 -4
- package/src/theme/ApiItem/Metadata/index.tsx +24 -0
- package/src/theme/ApiItem/Paginator/index.tsx +21 -0
- package/src/theme/ApiItem/TOC/Desktop/index.tsx +25 -0
- package/src/theme/ApiItem/TOC/Mobile/index.tsx +28 -0
- package/src/theme/ApiItem/TOC/Mobile/styles.module.css +19 -0
- package/src/theme/ApiItem/index.tsx +31 -130
- package/src/theme/ApiTabs/index.js +17 -6
- package/src/theme/ApiTabs/styles.module.css +0 -1
- package/src/theme/SchemaTabs/index.js +258 -0
- package/src/theme/SchemaTabs/styles.module.css +110 -0
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { ThemeClassNames } from "@docusaurus/theme-common";
|
|
11
|
+
import {
|
|
12
|
+
useDoc,
|
|
13
|
+
type DocContextValue,
|
|
14
|
+
// @ts-ignore
|
|
15
|
+
} from "@docusaurus/theme-common/internal";
|
|
16
|
+
import EditThisPage from "@theme/EditThisPage";
|
|
17
|
+
import LastUpdated from "@theme/LastUpdated";
|
|
18
|
+
import TagsListInline, {
|
|
19
|
+
type Props as TagsListInlineProps,
|
|
20
|
+
} from "@theme/TagsListInline";
|
|
21
|
+
import clsx from "clsx";
|
|
22
|
+
|
|
23
|
+
import styles from "./styles.module.css";
|
|
24
|
+
|
|
25
|
+
function TagsRow(props: TagsListInlineProps) {
|
|
26
|
+
return (
|
|
27
|
+
<div
|
|
28
|
+
className={clsx(
|
|
29
|
+
ThemeClassNames.docs.docFooterTagsRow,
|
|
30
|
+
"row margin-bottom--sm"
|
|
31
|
+
)}
|
|
32
|
+
>
|
|
33
|
+
<div className="col">
|
|
34
|
+
<TagsListInline {...props} />
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type EditMetaRowProps = Pick<
|
|
41
|
+
DocContextValue["metadata"],
|
|
42
|
+
"editUrl" | "lastUpdatedAt" | "lastUpdatedBy" | "formattedLastUpdatedAt"
|
|
43
|
+
>;
|
|
44
|
+
function EditMetaRow({
|
|
45
|
+
editUrl,
|
|
46
|
+
lastUpdatedAt,
|
|
47
|
+
lastUpdatedBy,
|
|
48
|
+
formattedLastUpdatedAt,
|
|
49
|
+
}: EditMetaRowProps) {
|
|
50
|
+
return (
|
|
51
|
+
<div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, "row")}>
|
|
52
|
+
<div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
53
|
+
|
|
54
|
+
<div className={clsx("col", styles.lastUpdated)}>
|
|
55
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
56
|
+
<LastUpdated
|
|
57
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
58
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
59
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
60
|
+
/>
|
|
61
|
+
)}
|
|
62
|
+
</div>
|
|
63
|
+
</div>
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export default function DocItemFooter(): JSX.Element | null {
|
|
68
|
+
const { metadata } = useDoc();
|
|
69
|
+
const {
|
|
70
|
+
editUrl,
|
|
71
|
+
lastUpdatedAt,
|
|
72
|
+
formattedLastUpdatedAt,
|
|
73
|
+
lastUpdatedBy,
|
|
74
|
+
tags,
|
|
75
|
+
} = metadata;
|
|
76
|
+
|
|
77
|
+
const canDisplayTagsRow = tags.length > 0;
|
|
78
|
+
const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);
|
|
79
|
+
|
|
80
|
+
const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow;
|
|
81
|
+
|
|
82
|
+
if (!canDisplayFooter) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return (
|
|
87
|
+
<footer
|
|
88
|
+
className={clsx(ThemeClassNames.docs.docFooter, "docusaurus-mt-lg")}
|
|
89
|
+
>
|
|
90
|
+
{canDisplayTagsRow && <TagsRow tags={tags} />}
|
|
91
|
+
{canDisplayEditMetaRow && (
|
|
92
|
+
<EditMetaRow
|
|
93
|
+
editUrl={editUrl}
|
|
94
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
95
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
96
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
97
|
+
/>
|
|
98
|
+
)}
|
|
99
|
+
</footer>
|
|
100
|
+
);
|
|
101
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
.lastUpdated {
|
|
9
|
+
margin-top: 0.2rem;
|
|
10
|
+
font-style: italic;
|
|
11
|
+
font-size: smaller;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
@media (min-width: 997px) {
|
|
15
|
+
.lastUpdated {
|
|
16
|
+
text-align: right;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { useWindowSize } from "@docusaurus/theme-common";
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
13
|
+
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
14
|
+
import type { Props } from "@theme/DocItem/Layout";
|
|
15
|
+
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
16
|
+
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
17
|
+
import clsx from "clsx";
|
|
18
|
+
|
|
19
|
+
import DocItemContent from "../Content";
|
|
20
|
+
import DocItemFooter from "../Footer";
|
|
21
|
+
import DocItemPaginator from "../Paginator";
|
|
22
|
+
import DocItemTOCDesktop from "../TOC/Desktop";
|
|
23
|
+
import DocItemTOCMobile from "../TOC/Mobile";
|
|
24
|
+
import styles from "./styles.module.css";
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
28
|
+
*/
|
|
29
|
+
function useDocTOC() {
|
|
30
|
+
const { frontMatter, toc } = useDoc();
|
|
31
|
+
const windowSize = useWindowSize();
|
|
32
|
+
|
|
33
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
34
|
+
const canRender = !hidden && toc.length > 0;
|
|
35
|
+
|
|
36
|
+
const mobile = canRender ? <DocItemTOCMobile /> : undefined;
|
|
37
|
+
|
|
38
|
+
const desktop =
|
|
39
|
+
canRender && (windowSize === "desktop" || windowSize === "ssr") ? (
|
|
40
|
+
<DocItemTOCDesktop />
|
|
41
|
+
) : undefined;
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
hidden,
|
|
45
|
+
mobile,
|
|
46
|
+
desktop,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export default function DocItemLayout({ children }: Props): JSX.Element {
|
|
51
|
+
const docTOC = useDocTOC();
|
|
52
|
+
const {
|
|
53
|
+
frontMatter: { api },
|
|
54
|
+
} = useDoc();
|
|
55
|
+
|
|
56
|
+
return (
|
|
57
|
+
<div className="row">
|
|
58
|
+
<div className={clsx("col", !docTOC.hidden && styles.docItemCol)}>
|
|
59
|
+
<DocVersionBanner />
|
|
60
|
+
<div className={styles.docItemContainer}>
|
|
61
|
+
<article>
|
|
62
|
+
<DocBreadcrumbs />
|
|
63
|
+
<DocVersionBadge />
|
|
64
|
+
{docTOC.mobile}
|
|
65
|
+
<DocItemContent>{children}</DocItemContent>
|
|
66
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
67
|
+
<DocItemFooter />
|
|
68
|
+
</div>
|
|
69
|
+
</article>
|
|
70
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
71
|
+
<DocItemPaginator />
|
|
72
|
+
</div>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
|
|
76
|
+
</div>
|
|
77
|
+
);
|
|
78
|
+
}
|
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
1
8
|
:root {
|
|
2
9
|
--openapi-required: var(--ifm-color-danger);
|
|
3
10
|
--openapi-code-blue: var(--ifm-color-info);
|
|
@@ -6,6 +13,21 @@
|
|
|
6
13
|
--openapi-code-green: var(--ifm-color-success);
|
|
7
14
|
}
|
|
8
15
|
|
|
16
|
+
:global(.docs-wrapper) {
|
|
17
|
+
height: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.docItemContainer header + *,
|
|
21
|
+
.docItemContainer article > *:first-child {
|
|
22
|
+
margin-top: 0;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@media (min-width: 997px) {
|
|
26
|
+
.docItemCol {
|
|
27
|
+
max-width: 75% !important;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
9
31
|
.apiItemContainer article > *:first-child,
|
|
10
32
|
.apiItemContainer header + * {
|
|
11
33
|
margin-top: 0;
|
|
@@ -70,10 +92,6 @@
|
|
|
70
92
|
padding-top: 5px;
|
|
71
93
|
}
|
|
72
94
|
|
|
73
|
-
:global(.theme-api-markdown details li:last-child) {
|
|
74
|
-
border-left: none;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
95
|
:global(.theme-api-markdown details p) {
|
|
78
96
|
margin-bottom: 0;
|
|
79
97
|
}
|
|
@@ -147,6 +165,11 @@
|
|
|
147
165
|
border-bottom-color: var(--ifm-color-success);
|
|
148
166
|
}
|
|
149
167
|
|
|
168
|
+
:global(.language-python) {
|
|
169
|
+
max-height: 500px;
|
|
170
|
+
overflow: auto;
|
|
171
|
+
}
|
|
172
|
+
|
|
150
173
|
:global(.code__tab--go::after) {
|
|
151
174
|
content: "";
|
|
152
175
|
width: 32px;
|
|
@@ -165,6 +188,11 @@
|
|
|
165
188
|
border-bottom-color: var(--ifm-color-info);
|
|
166
189
|
}
|
|
167
190
|
|
|
191
|
+
:global(.language-go) {
|
|
192
|
+
max-height: 500px;
|
|
193
|
+
overflow: auto;
|
|
194
|
+
}
|
|
195
|
+
|
|
168
196
|
:global(.code__tab--javascript::after) {
|
|
169
197
|
content: "";
|
|
170
198
|
width: 32px;
|
|
@@ -183,6 +211,11 @@
|
|
|
183
211
|
border-bottom-color: var(--ifm-color-warning);
|
|
184
212
|
}
|
|
185
213
|
|
|
214
|
+
:global(.language-javascript) {
|
|
215
|
+
max-height: 500px;
|
|
216
|
+
overflow: auto;
|
|
217
|
+
}
|
|
218
|
+
|
|
186
219
|
:global(.code__tab--bash::after) {
|
|
187
220
|
content: "";
|
|
188
221
|
width: 32px;
|
|
@@ -200,3 +233,8 @@
|
|
|
200
233
|
:global(.code__tab--bash.tabs__item--active) {
|
|
201
234
|
border-bottom-color: var(--ifm-color-danger);
|
|
202
235
|
}
|
|
236
|
+
|
|
237
|
+
:global(.language-bash) {
|
|
238
|
+
max-height: 500px;
|
|
239
|
+
overflow: auto;
|
|
240
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { PageMetadata } from "@docusaurus/theme-common";
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
13
|
+
|
|
14
|
+
export default function DocItemMetadata(): JSX.Element {
|
|
15
|
+
const { metadata, frontMatter, assets } = useDoc();
|
|
16
|
+
return (
|
|
17
|
+
<PageMetadata
|
|
18
|
+
title={metadata.title}
|
|
19
|
+
description={metadata.description}
|
|
20
|
+
keywords={frontMatter.keywords}
|
|
21
|
+
image={assets.image ?? frontMatter.image}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
12
|
+
import DocPaginator from "@theme/DocPaginator";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* This extra component is needed, because <DocPaginator> should remain generic.
|
|
16
|
+
* DocPaginator is used in non-docs contexts too: generated-index pages...
|
|
17
|
+
*/
|
|
18
|
+
export default function DocItemPaginator(): JSX.Element {
|
|
19
|
+
const { metadata } = useDoc();
|
|
20
|
+
return <DocPaginator previous={metadata.previous} next={metadata.next} />;
|
|
21
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { ThemeClassNames } from "@docusaurus/theme-common";
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
13
|
+
import TOC from "@theme/TOC";
|
|
14
|
+
|
|
15
|
+
export default function DocItemTOCDesktop(): JSX.Element {
|
|
16
|
+
const { toc, frontMatter } = useDoc();
|
|
17
|
+
return (
|
|
18
|
+
<TOC
|
|
19
|
+
toc={toc}
|
|
20
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
21
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
22
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/* ============================================================================
|
|
2
|
+
* Copyright (c) Palo Alto Networks
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
* ========================================================================== */
|
|
7
|
+
|
|
8
|
+
import React from "react";
|
|
9
|
+
|
|
10
|
+
import { ThemeClassNames } from "@docusaurus/theme-common";
|
|
11
|
+
// @ts-ignore
|
|
12
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
13
|
+
import TOCCollapsible from "@theme/TOCCollapsible";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
|
|
16
|
+
import styles from "./styles.module.css";
|
|
17
|
+
|
|
18
|
+
export default function DocItemTOCMobile(): JSX.Element {
|
|
19
|
+
const { toc, frontMatter } = useDoc();
|
|
20
|
+
return (
|
|
21
|
+
<TOCCollapsible
|
|
22
|
+
toc={toc}
|
|
23
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
24
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
25
|
+
className={clsx(ThemeClassNames.docs.docTocMobile, styles.tocMobile)}
|
|
26
|
+
/>
|
|
27
|
+
);
|
|
28
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
@media (min-width: 997px) {
|
|
9
|
+
/* Prevent hydration FOUC, as the mobile TOC needs to be server-rendered */
|
|
10
|
+
.tocMobile {
|
|
11
|
+
display: none;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
@media print {
|
|
16
|
+
.tocMobile {
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -8,27 +8,16 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
|
|
11
|
-
import {
|
|
12
|
-
PageMetadata,
|
|
13
|
-
HtmlClassNameProvider,
|
|
14
|
-
ThemeClassNames,
|
|
15
|
-
useWindowSize,
|
|
16
|
-
} from "@docusaurus/theme-common";
|
|
17
|
-
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
11
|
+
import { HtmlClassNameProvider } from "@docusaurus/theme-common";
|
|
18
12
|
import type { Props } from "@theme/DocItem";
|
|
19
|
-
import DocItemFooter from "@theme/DocItemFooter";
|
|
20
|
-
import DocPaginator from "@theme/DocPaginator";
|
|
21
|
-
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
22
|
-
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
23
|
-
import Heading from "@theme/Heading";
|
|
24
|
-
import MDXContent from "@theme/MDXContent";
|
|
25
|
-
import TOC from "@theme/TOC";
|
|
26
|
-
import TOCCollapsible from "@theme/TOCCollapsible";
|
|
27
13
|
import clsx from "clsx";
|
|
28
14
|
import type { ApiItem as ApiItemType } from "docusaurus-plugin-openapi-docs/lib/types";
|
|
29
15
|
|
|
30
16
|
import { DocFrontMatter } from "../../types";
|
|
31
|
-
import
|
|
17
|
+
import DocItemLayout from "./Layout";
|
|
18
|
+
import DocItemMetadata from "./Metadata";
|
|
19
|
+
|
|
20
|
+
const { DocProvider } = require("@docusaurus/theme-common/internal");
|
|
32
21
|
|
|
33
22
|
let ApiDemoPanel = (_: { item: any; infoPath: any }) => (
|
|
34
23
|
<div style={{ marginTop: "3.5em" }} />
|
|
@@ -41,125 +30,37 @@ interface ApiFrontMatter extends DocFrontMatter {
|
|
|
41
30
|
readonly api?: ApiItemType;
|
|
42
31
|
}
|
|
43
32
|
|
|
44
|
-
function
|
|
45
|
-
const
|
|
46
|
-
const { metadata, frontMatter, assets } = DocContent;
|
|
47
|
-
const { keywords } = frontMatter;
|
|
48
|
-
const { description, title } = metadata;
|
|
49
|
-
const image = assets.image ?? frontMatter.image;
|
|
50
|
-
|
|
51
|
-
return <PageMetadata {...{ title, description, keywords, image }} />;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
function DocItemContent(props: Props): JSX.Element {
|
|
55
|
-
const { content: DocContent } = props;
|
|
56
|
-
const { metadata, frontMatter } = DocContent;
|
|
57
|
-
const {
|
|
58
|
-
info_path: infoPath,
|
|
59
|
-
hide_title: hideTitle,
|
|
60
|
-
hide_table_of_contents: hideTableOfContents,
|
|
61
|
-
toc_min_heading_level: tocMinHeadingLevel,
|
|
62
|
-
toc_max_heading_level: tocMaxHeadingLevel,
|
|
63
|
-
} = frontMatter as DocFrontMatter;
|
|
64
|
-
const { title } = metadata;
|
|
65
|
-
|
|
66
|
-
const { api } = frontMatter as ApiFrontMatter;
|
|
67
|
-
|
|
68
|
-
// We only add a title if:
|
|
69
|
-
// - user doesn't ask to hide it with front matter
|
|
70
|
-
// - the markdown content does not already contain a top-level h1 heading
|
|
71
|
-
const shouldAddTitle =
|
|
72
|
-
!hideTitle && typeof DocContent.contentTitle === "undefined";
|
|
73
|
-
|
|
74
|
-
const windowSize = useWindowSize();
|
|
75
|
-
|
|
76
|
-
const canRenderTOC =
|
|
77
|
-
!hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
|
|
78
|
-
|
|
79
|
-
const renderTocDesktop =
|
|
80
|
-
canRenderTOC && (windowSize === "desktop" || windowSize === "ssr");
|
|
81
|
-
|
|
82
|
-
return (
|
|
83
|
-
<div className="row">
|
|
84
|
-
<div className={clsx("col", !hideTableOfContents && styles.docItemCol)}>
|
|
85
|
-
<DocVersionBanner />
|
|
86
|
-
<div className={styles.docItemContainer}>
|
|
87
|
-
<article>
|
|
88
|
-
<DocBreadcrumbs />
|
|
89
|
-
<DocVersionBadge />
|
|
33
|
+
export default function DocItem(props: Props): JSX.Element {
|
|
34
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
90
35
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
className={clsx(
|
|
97
|
-
ThemeClassNames.docs.docTocMobile,
|
|
98
|
-
styles.tocMobile
|
|
99
|
-
)}
|
|
100
|
-
/>
|
|
101
|
-
)}
|
|
36
|
+
const DocContent = () => {
|
|
37
|
+
const MDXComponent = props.content;
|
|
38
|
+
const { frontMatter } = MDXComponent;
|
|
39
|
+
const { info_path: infoPath } = frontMatter as DocFrontMatter;
|
|
40
|
+
const { api } = frontMatter as ApiFrontMatter;
|
|
102
41
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"markdown"
|
|
108
|
-
)}
|
|
109
|
-
>
|
|
110
|
-
{/*
|
|
111
|
-
Title can be declared inside md content or declared through
|
|
112
|
-
front matter and added manually. To make both cases consistent,
|
|
113
|
-
the added title is added under the same div.markdown block
|
|
114
|
-
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
115
|
-
*/}
|
|
116
|
-
{shouldAddTitle && (
|
|
117
|
-
<header>
|
|
118
|
-
<Heading as="h1">{title}</Heading>
|
|
119
|
-
</header>
|
|
120
|
-
)}
|
|
121
|
-
<MDXContent>
|
|
122
|
-
<div className="row">
|
|
123
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
124
|
-
<DocContent />
|
|
125
|
-
</div>
|
|
126
|
-
{api && (
|
|
127
|
-
<div className="col col--5">
|
|
128
|
-
<ApiDemoPanel item={api} infoPath={infoPath} />
|
|
129
|
-
</div>
|
|
130
|
-
)}
|
|
131
|
-
</div>
|
|
132
|
-
</MDXContent>
|
|
133
|
-
</div>
|
|
134
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
135
|
-
<DocItemFooter {...props} />
|
|
136
|
-
</div>
|
|
137
|
-
</article>
|
|
138
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
139
|
-
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
140
|
-
</div>
|
|
42
|
+
return (
|
|
43
|
+
<div className="row">
|
|
44
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
45
|
+
<MDXComponent />
|
|
141
46
|
</div>
|
|
47
|
+
{api && (
|
|
48
|
+
<div className="col col--5">
|
|
49
|
+
<ApiDemoPanel item={api} infoPath={infoPath} />
|
|
50
|
+
</div>
|
|
51
|
+
)}
|
|
142
52
|
</div>
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
<TOC
|
|
146
|
-
toc={DocContent.toc}
|
|
147
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
148
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
149
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
150
|
-
/>
|
|
151
|
-
</div>
|
|
152
|
-
)}
|
|
153
|
-
</div>
|
|
154
|
-
);
|
|
155
|
-
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
156
55
|
|
|
157
|
-
export default function DocItem(props: Props): JSX.Element {
|
|
158
|
-
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
159
56
|
return (
|
|
160
|
-
<
|
|
161
|
-
<
|
|
162
|
-
|
|
163
|
-
|
|
57
|
+
<DocProvider content={props.content}>
|
|
58
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
59
|
+
<DocItemMetadata />
|
|
60
|
+
<DocItemLayout>
|
|
61
|
+
<DocContent />
|
|
62
|
+
</DocItemLayout>
|
|
63
|
+
</HtmlClassNameProvider>
|
|
64
|
+
</DocProvider>
|
|
164
65
|
);
|
|
165
66
|
}
|
|
@@ -9,20 +9,22 @@ import React, {
|
|
|
9
9
|
Children,
|
|
10
10
|
cloneElement,
|
|
11
11
|
isValidElement,
|
|
12
|
+
useEffect,
|
|
12
13
|
useRef,
|
|
13
14
|
useState,
|
|
14
15
|
} from "react";
|
|
15
16
|
|
|
16
|
-
import {
|
|
17
|
-
duplicates,
|
|
18
|
-
useScrollPositionBlocker,
|
|
19
|
-
useTabGroupChoice,
|
|
20
|
-
} from "@docusaurus/theme-common";
|
|
17
|
+
import { duplicates } from "@docusaurus/theme-common";
|
|
21
18
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
22
19
|
import clsx from "clsx";
|
|
23
20
|
|
|
24
21
|
import styles from "./styles.module.css"; // A very rough duck type, but good enough to guard against mistakes while
|
|
25
22
|
|
|
23
|
+
const {
|
|
24
|
+
useScrollPositionBlocker,
|
|
25
|
+
useTabGroupChoice,
|
|
26
|
+
} = require("@docusaurus/theme-common/internal");
|
|
27
|
+
|
|
26
28
|
// allowing customization
|
|
27
29
|
|
|
28
30
|
function isTabItem(comp) {
|
|
@@ -142,7 +144,16 @@ function ApiTabsComponent(props) {
|
|
|
142
144
|
};
|
|
143
145
|
|
|
144
146
|
const tabItemListContainerRef = useRef(null);
|
|
145
|
-
const showTabArrows =
|
|
147
|
+
const [showTabArrows, setShowTabArrows] = useState(false);
|
|
148
|
+
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
const tabOffsetWidth = tabItemListContainerRef.current.offsetWidth;
|
|
151
|
+
const tabScrollWidth = tabItemListContainerRef.current.scrollWidth;
|
|
152
|
+
|
|
153
|
+
if (tabOffsetWidth < tabScrollWidth) {
|
|
154
|
+
setShowTabArrows(true);
|
|
155
|
+
}
|
|
156
|
+
}, []);
|
|
146
157
|
|
|
147
158
|
const handleRightClick = () => {
|
|
148
159
|
tabItemListContainerRef.current.scrollLeft += 90;
|