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
|
@@ -23,7 +23,7 @@ function Server() {
|
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
if (options.length
|
|
26
|
+
if (options.length < 1 && value?.variables === undefined) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
29
|
|
|
@@ -62,10 +62,11 @@ function Server() {
|
|
|
62
62
|
<button
|
|
63
63
|
className={styles.showMoreButton}
|
|
64
64
|
onClick={() => setIsEditing(false)}
|
|
65
|
+
tabIndex={0}
|
|
65
66
|
>
|
|
66
67
|
Hide
|
|
67
68
|
</button>
|
|
68
|
-
<FormItem label="
|
|
69
|
+
<FormItem label="Base URL">
|
|
69
70
|
<FormSelect
|
|
70
71
|
options={options.map((s) => s.url)}
|
|
71
72
|
onChange={(e) => dispatch(setServer(e.target.value))}
|
|
@@ -0,0 +1,55 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import { ThemeClassNames } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
|
+
|
|
10
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
|
+
import Heading from "@theme/Heading";
|
|
12
|
+
import MDXContent from "@theme/MDXContent";
|
|
13
|
+
import clsx from "clsx";
|
|
14
|
+
/**
|
|
15
|
+
Title can be declared inside md content or declared through
|
|
16
|
+
front matter and added manually. To make both cases consistent,
|
|
17
|
+
the added title is added under the same div.markdown block
|
|
18
|
+
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
19
|
+
|
|
20
|
+
We render a "synthetic title" if:
|
|
21
|
+
- user doesn't ask to hide it with front matter
|
|
22
|
+
- the markdown content does not already contain a top-level h1 heading
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function useSyntheticTitle() {
|
|
26
|
+
const { metadata, frontMatter, contentTitle } = useDoc();
|
|
27
|
+
const shouldRender =
|
|
28
|
+
!frontMatter.hide_title && typeof contentTitle === "undefined";
|
|
29
|
+
|
|
30
|
+
if (!shouldRender) {
|
|
31
|
+
return null;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return metadata.title;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default function DocItemContent({ children }) {
|
|
38
|
+
const syntheticTitle = useSyntheticTitle();
|
|
39
|
+
return (
|
|
40
|
+
<div
|
|
41
|
+
className={clsx(
|
|
42
|
+
ThemeClassNames.docs.docMarkdown,
|
|
43
|
+
"theme-api-markdown",
|
|
44
|
+
"markdown"
|
|
45
|
+
)}
|
|
46
|
+
>
|
|
47
|
+
{syntheticTitle && (
|
|
48
|
+
<header>
|
|
49
|
+
<Heading as="h1">{syntheticTitle}</Heading>
|
|
50
|
+
</header>
|
|
51
|
+
)}
|
|
52
|
+
<MDXContent>{children}</MDXContent>
|
|
53
|
+
</div>
|
|
54
|
+
);
|
|
55
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import { ThemeClassNames } from "@docusaurus/theme-common";
|
|
9
|
+
import {
|
|
10
|
+
useDoc, // @ts-ignore
|
|
11
|
+
} from "@docusaurus/theme-common/internal";
|
|
12
|
+
import EditThisPage from "@theme/EditThisPage";
|
|
13
|
+
import LastUpdated from "@theme/LastUpdated";
|
|
14
|
+
import TagsListInline from "@theme/TagsListInline";
|
|
15
|
+
import clsx from "clsx";
|
|
16
|
+
import styles from "./styles.module.css";
|
|
17
|
+
|
|
18
|
+
function TagsRow(props) {
|
|
19
|
+
return (
|
|
20
|
+
<div
|
|
21
|
+
className={clsx(
|
|
22
|
+
ThemeClassNames.docs.docFooterTagsRow,
|
|
23
|
+
"row margin-bottom--sm"
|
|
24
|
+
)}
|
|
25
|
+
>
|
|
26
|
+
<div className="col">
|
|
27
|
+
<TagsListInline {...props} />
|
|
28
|
+
</div>
|
|
29
|
+
</div>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function EditMetaRow({
|
|
34
|
+
editUrl,
|
|
35
|
+
lastUpdatedAt,
|
|
36
|
+
lastUpdatedBy,
|
|
37
|
+
formattedLastUpdatedAt,
|
|
38
|
+
}) {
|
|
39
|
+
return (
|
|
40
|
+
<div className={clsx(ThemeClassNames.docs.docFooterEditMetaRow, "row")}>
|
|
41
|
+
<div className="col">{editUrl && <EditThisPage editUrl={editUrl} />}</div>
|
|
42
|
+
|
|
43
|
+
<div className={clsx("col", styles.lastUpdated)}>
|
|
44
|
+
{(lastUpdatedAt || lastUpdatedBy) && (
|
|
45
|
+
<LastUpdated
|
|
46
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
47
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
48
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
49
|
+
/>
|
|
50
|
+
)}
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export default function DocItemFooter() {
|
|
57
|
+
const { metadata } = useDoc();
|
|
58
|
+
const {
|
|
59
|
+
editUrl,
|
|
60
|
+
lastUpdatedAt,
|
|
61
|
+
formattedLastUpdatedAt,
|
|
62
|
+
lastUpdatedBy,
|
|
63
|
+
tags,
|
|
64
|
+
} = metadata;
|
|
65
|
+
const canDisplayTagsRow = tags.length > 0;
|
|
66
|
+
const canDisplayEditMetaRow = !!(editUrl || lastUpdatedAt || lastUpdatedBy);
|
|
67
|
+
const canDisplayFooter = canDisplayTagsRow || canDisplayEditMetaRow;
|
|
68
|
+
|
|
69
|
+
if (!canDisplayFooter) {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return (
|
|
74
|
+
<footer
|
|
75
|
+
className={clsx(ThemeClassNames.docs.docFooter, "docusaurus-mt-lg")}
|
|
76
|
+
>
|
|
77
|
+
{canDisplayTagsRow && <TagsRow tags={tags} />}
|
|
78
|
+
{canDisplayEditMetaRow && (
|
|
79
|
+
<EditMetaRow
|
|
80
|
+
editUrl={editUrl}
|
|
81
|
+
lastUpdatedAt={lastUpdatedAt}
|
|
82
|
+
lastUpdatedBy={lastUpdatedBy}
|
|
83
|
+
formattedLastUpdatedAt={formattedLastUpdatedAt}
|
|
84
|
+
/>
|
|
85
|
+
)}
|
|
86
|
+
</footer>
|
|
87
|
+
);
|
|
88
|
+
}
|
|
@@ -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,69 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import { useWindowSize } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
|
+
|
|
10
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
|
+
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
12
|
+
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
13
|
+
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
14
|
+
import clsx from "clsx";
|
|
15
|
+
import DocItemContent from "../Content";
|
|
16
|
+
import DocItemFooter from "../Footer";
|
|
17
|
+
import DocItemPaginator from "../Paginator";
|
|
18
|
+
import DocItemTOCDesktop from "../TOC/Desktop";
|
|
19
|
+
import DocItemTOCMobile from "../TOC/Mobile";
|
|
20
|
+
import styles from "./styles.module.css";
|
|
21
|
+
/**
|
|
22
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
function useDocTOC() {
|
|
26
|
+
const { frontMatter, toc } = useDoc();
|
|
27
|
+
const windowSize = useWindowSize();
|
|
28
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
29
|
+
const canRender = !hidden && toc.length > 0;
|
|
30
|
+
const mobile = canRender ? <DocItemTOCMobile /> : undefined;
|
|
31
|
+
const desktop =
|
|
32
|
+
canRender && (windowSize === "desktop" || windowSize === "ssr") ? (
|
|
33
|
+
<DocItemTOCDesktop />
|
|
34
|
+
) : undefined;
|
|
35
|
+
return {
|
|
36
|
+
hidden,
|
|
37
|
+
mobile,
|
|
38
|
+
desktop,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default function DocItemLayout({ children }) {
|
|
43
|
+
const docTOC = useDocTOC();
|
|
44
|
+
const {
|
|
45
|
+
frontMatter: { api },
|
|
46
|
+
} = useDoc();
|
|
47
|
+
return (
|
|
48
|
+
<div className="row">
|
|
49
|
+
<div className={clsx("col", !docTOC.hidden && styles.docItemCol)}>
|
|
50
|
+
<DocVersionBanner />
|
|
51
|
+
<div className={styles.docItemContainer}>
|
|
52
|
+
<article>
|
|
53
|
+
<DocBreadcrumbs />
|
|
54
|
+
<DocVersionBadge />
|
|
55
|
+
{docTOC.mobile}
|
|
56
|
+
<DocItemContent>{children}</DocItemContent>
|
|
57
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
58
|
+
<DocItemFooter />
|
|
59
|
+
</div>
|
|
60
|
+
</article>
|
|
61
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
62
|
+
<DocItemPaginator />
|
|
63
|
+
</div>
|
|
64
|
+
</div>
|
|
65
|
+
</div>
|
|
66
|
+
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
|
|
67
|
+
</div>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
@@ -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,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
|
+
import React from "react";
|
|
8
|
+
import { PageMetadata } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
|
+
|
|
10
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
|
+
export default function DocItemMetadata() {
|
|
12
|
+
const { metadata, frontMatter, assets } = useDoc();
|
|
13
|
+
return (
|
|
14
|
+
<PageMetadata
|
|
15
|
+
title={metadata.title}
|
|
16
|
+
description={metadata.description}
|
|
17
|
+
keywords={frontMatter.keywords}
|
|
18
|
+
image={assets.image ?? frontMatter.image}
|
|
19
|
+
/>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
import React from "react"; // @ts-ignore
|
|
8
|
+
|
|
9
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
10
|
+
import DocPaginator from "@theme/DocPaginator";
|
|
11
|
+
/**
|
|
12
|
+
* This extra component is needed, because <DocPaginator> should remain generic.
|
|
13
|
+
* DocPaginator is used in non-docs contexts too: generated-index pages...
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export default function DocItemPaginator() {
|
|
17
|
+
const { metadata } = useDoc();
|
|
18
|
+
return <DocPaginator previous={metadata.previous} next={metadata.next} />;
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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
|
+
import React from "react";
|
|
8
|
+
import { ThemeClassNames } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
|
+
|
|
10
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
|
+
import TOC from "@theme/TOC";
|
|
12
|
+
export default function DocItemTOCDesktop() {
|
|
13
|
+
const { toc, frontMatter } = useDoc();
|
|
14
|
+
return (
|
|
15
|
+
<TOC
|
|
16
|
+
toc={toc}
|
|
17
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
18
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
19
|
+
className={ThemeClassNames.docs.docTocDesktop}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
}
|
|
@@ -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
|
+
import React from "react";
|
|
8
|
+
import { ThemeClassNames } from "@docusaurus/theme-common"; // @ts-ignore
|
|
9
|
+
|
|
10
|
+
import { useDoc } from "@docusaurus/theme-common/internal";
|
|
11
|
+
import TOCCollapsible from "@theme/TOCCollapsible";
|
|
12
|
+
import clsx from "clsx";
|
|
13
|
+
import styles from "./styles.module.css";
|
|
14
|
+
export default function DocItemTOCMobile() {
|
|
15
|
+
const { toc, frontMatter } = useDoc();
|
|
16
|
+
return (
|
|
17
|
+
<TOCCollapsible
|
|
18
|
+
toc={toc}
|
|
19
|
+
minHeadingLevel={frontMatter.toc_min_heading_level}
|
|
20
|
+
maxHeadingLevel={frontMatter.toc_max_heading_level}
|
|
21
|
+
className={clsx(ThemeClassNames.docs.docTocMobile, styles.tocMobile)}
|
|
22
|
+
/>
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -6,23 +6,12 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
import React from "react";
|
|
8
8
|
import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
|
|
9
|
-
import {
|
|
10
|
-
PageMetadata,
|
|
11
|
-
HtmlClassNameProvider,
|
|
12
|
-
ThemeClassNames,
|
|
13
|
-
useWindowSize,
|
|
14
|
-
} from "@docusaurus/theme-common";
|
|
15
|
-
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
16
|
-
import DocItemFooter from "@theme/DocItemFooter";
|
|
17
|
-
import DocPaginator from "@theme/DocPaginator";
|
|
18
|
-
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
19
|
-
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
20
|
-
import Heading from "@theme/Heading";
|
|
21
|
-
import MDXContent from "@theme/MDXContent";
|
|
22
|
-
import TOC from "@theme/TOC";
|
|
23
|
-
import TOCCollapsible from "@theme/TOCCollapsible";
|
|
9
|
+
import { HtmlClassNameProvider } from "@docusaurus/theme-common";
|
|
24
10
|
import clsx from "clsx";
|
|
25
|
-
import
|
|
11
|
+
import DocItemLayout from "./Layout";
|
|
12
|
+
import DocItemMetadata from "./Metadata";
|
|
13
|
+
|
|
14
|
+
const { DocProvider } = require("@docusaurus/theme-common/internal");
|
|
26
15
|
|
|
27
16
|
let ApiDemoPanel = (_) => (
|
|
28
17
|
<div
|
|
@@ -36,127 +25,36 @@ if (ExecutionEnvironment.canUseDOM) {
|
|
|
36
25
|
ApiDemoPanel = require("@theme/ApiDemoPanel").default;
|
|
37
26
|
}
|
|
38
27
|
|
|
39
|
-
function
|
|
40
|
-
const
|
|
41
|
-
const { metadata, frontMatter, assets } = DocContent;
|
|
42
|
-
const { keywords } = frontMatter;
|
|
43
|
-
const { description, title } = metadata;
|
|
44
|
-
const image = assets.image ?? frontMatter.image;
|
|
45
|
-
return (
|
|
46
|
-
<PageMetadata
|
|
47
|
-
{...{
|
|
48
|
-
title,
|
|
49
|
-
description,
|
|
50
|
-
keywords,
|
|
51
|
-
image,
|
|
52
|
-
}}
|
|
53
|
-
/>
|
|
54
|
-
);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function DocItemContent(props) {
|
|
58
|
-
const { content: DocContent } = props;
|
|
59
|
-
const { metadata, frontMatter } = DocContent;
|
|
60
|
-
const {
|
|
61
|
-
info_path: infoPath,
|
|
62
|
-
hide_title: hideTitle,
|
|
63
|
-
hide_table_of_contents: hideTableOfContents,
|
|
64
|
-
toc_min_heading_level: tocMinHeadingLevel,
|
|
65
|
-
toc_max_heading_level: tocMaxHeadingLevel,
|
|
66
|
-
} = frontMatter;
|
|
67
|
-
const { title } = metadata;
|
|
68
|
-
const { api } = frontMatter; // 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
|
-
|
|
72
|
-
const shouldAddTitle =
|
|
73
|
-
!hideTitle && typeof DocContent.contentTitle === "undefined";
|
|
74
|
-
const windowSize = useWindowSize();
|
|
75
|
-
const canRenderTOC =
|
|
76
|
-
!hideTableOfContents && DocContent.toc && DocContent.toc.length > 0;
|
|
77
|
-
const renderTocDesktop =
|
|
78
|
-
canRenderTOC && (windowSize === "desktop" || windowSize === "ssr");
|
|
79
|
-
return (
|
|
80
|
-
<div className="row">
|
|
81
|
-
<div className={clsx("col", !hideTableOfContents && styles.docItemCol)}>
|
|
82
|
-
<DocVersionBanner />
|
|
83
|
-
<div className={styles.docItemContainer}>
|
|
84
|
-
<article>
|
|
85
|
-
<DocBreadcrumbs />
|
|
86
|
-
<DocVersionBadge />
|
|
87
|
-
|
|
88
|
-
{canRenderTOC && (
|
|
89
|
-
<TOCCollapsible
|
|
90
|
-
toc={DocContent.toc}
|
|
91
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
92
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
93
|
-
className={clsx(
|
|
94
|
-
ThemeClassNames.docs.docTocMobile,
|
|
95
|
-
styles.tocMobile
|
|
96
|
-
)}
|
|
97
|
-
/>
|
|
98
|
-
)}
|
|
28
|
+
export default function DocItem(props) {
|
|
29
|
+
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
99
30
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
front matter and added manually. To make both cases consistent,
|
|
110
|
-
the added title is added under the same div.markdown block
|
|
111
|
-
See https://github.com/facebook/docusaurus/pull/4882#issuecomment-853021120
|
|
112
|
-
*/}
|
|
113
|
-
{shouldAddTitle && (
|
|
114
|
-
<header>
|
|
115
|
-
<Heading as="h1">{title}</Heading>
|
|
116
|
-
</header>
|
|
117
|
-
)}
|
|
118
|
-
<MDXContent>
|
|
119
|
-
<div className="row">
|
|
120
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
121
|
-
<DocContent />
|
|
122
|
-
</div>
|
|
123
|
-
{api && (
|
|
124
|
-
<div className="col col--5">
|
|
125
|
-
<ApiDemoPanel item={api} infoPath={infoPath} />
|
|
126
|
-
</div>
|
|
127
|
-
)}
|
|
128
|
-
</div>
|
|
129
|
-
</MDXContent>
|
|
130
|
-
</div>
|
|
131
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
132
|
-
<DocItemFooter {...props} />
|
|
133
|
-
</div>
|
|
134
|
-
</article>
|
|
135
|
-
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
136
|
-
<DocPaginator previous={metadata.previous} next={metadata.next} />
|
|
137
|
-
</div>
|
|
31
|
+
const DocContent = () => {
|
|
32
|
+
const MDXComponent = props.content;
|
|
33
|
+
const { frontMatter } = MDXComponent;
|
|
34
|
+
const { info_path: infoPath } = frontMatter;
|
|
35
|
+
const { api } = frontMatter;
|
|
36
|
+
return (
|
|
37
|
+
<div className="row">
|
|
38
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
39
|
+
<MDXComponent />
|
|
138
40
|
</div>
|
|
41
|
+
{api && (
|
|
42
|
+
<div className="col col--5">
|
|
43
|
+
<ApiDemoPanel item={api} infoPath={infoPath} />
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
139
46
|
</div>
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
<TOC
|
|
143
|
-
toc={DocContent.toc}
|
|
144
|
-
minHeadingLevel={tocMinHeadingLevel}
|
|
145
|
-
maxHeadingLevel={tocMaxHeadingLevel}
|
|
146
|
-
className={ThemeClassNames.docs.docTocDesktop}
|
|
147
|
-
/>
|
|
148
|
-
</div>
|
|
149
|
-
)}
|
|
150
|
-
</div>
|
|
151
|
-
);
|
|
152
|
-
}
|
|
47
|
+
);
|
|
48
|
+
};
|
|
153
49
|
|
|
154
|
-
export default function DocItem(props) {
|
|
155
|
-
const docHtmlClassName = `docs-doc-id-${props.content.metadata.unversionedId}`;
|
|
156
50
|
return (
|
|
157
|
-
<
|
|
158
|
-
<
|
|
159
|
-
|
|
160
|
-
|
|
51
|
+
<DocProvider content={props.content}>
|
|
52
|
+
<HtmlClassNameProvider className={docHtmlClassName}>
|
|
53
|
+
<DocItemMetadata />
|
|
54
|
+
<DocItemLayout>
|
|
55
|
+
<DocContent />
|
|
56
|
+
</DocItemLayout>
|
|
57
|
+
</HtmlClassNameProvider>
|
|
58
|
+
</DocProvider>
|
|
161
59
|
);
|
|
162
60
|
}
|