docusaurus-theme-openapi-docs 0.0.0-773 → 0.0.0-775
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/ApiItem/Layout/index.d.ts +3 -0
- package/lib/theme/ApiItem/Layout/index.js +117 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
- package/lib/theme/ApiItem/index.js +1 -1
- package/package.json +3 -3
- package/src/plugin-content-docs.d.ts +2 -0
- package/src/theme/ApiItem/Layout/index.tsx +82 -0
- package/src/theme/ApiItem/Layout/styles.module.css +17 -0
- package/src/theme/ApiItem/index.tsx +1 -1
- package/src/theme-classic.d.ts +0 -2
- package/src/theme-openapi.d.ts +4 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault =
|
|
9
|
+
(this && this.__importDefault) ||
|
|
10
|
+
function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const client_1 = require("@docusaurus/plugin-content-docs/client");
|
|
16
|
+
const theme_common_1 = require("@docusaurus/theme-common");
|
|
17
|
+
const ContentVisibility_1 = __importDefault(
|
|
18
|
+
require("@theme/ContentVisibility")
|
|
19
|
+
);
|
|
20
|
+
const DocBreadcrumbs_1 = __importDefault(require("@theme/DocBreadcrumbs"));
|
|
21
|
+
const Content_1 = __importDefault(require("@theme/DocItem/Content"));
|
|
22
|
+
const Footer_1 = __importDefault(require("@theme/DocItem/Footer"));
|
|
23
|
+
const Paginator_1 = __importDefault(require("@theme/DocItem/Paginator"));
|
|
24
|
+
const Desktop_1 = __importDefault(require("@theme/DocItem/TOC/Desktop"));
|
|
25
|
+
const Mobile_1 = __importDefault(require("@theme/DocItem/TOC/Mobile"));
|
|
26
|
+
const DocVersionBadge_1 = __importDefault(require("@theme/DocVersionBadge"));
|
|
27
|
+
const DocVersionBanner_1 = __importDefault(require("@theme/DocVersionBanner"));
|
|
28
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
29
|
+
const styles_module_css_1 = __importDefault(require("./styles.module.css"));
|
|
30
|
+
/**
|
|
31
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
32
|
+
*/
|
|
33
|
+
function useDocTOC() {
|
|
34
|
+
const { frontMatter, toc } = (0, client_1.useDoc)();
|
|
35
|
+
const windowSize = (0, theme_common_1.useWindowSize)();
|
|
36
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
37
|
+
const canRender = !hidden && toc.length > 0;
|
|
38
|
+
const mobile = canRender
|
|
39
|
+
? react_1.default.createElement(Mobile_1.default, null)
|
|
40
|
+
: undefined;
|
|
41
|
+
const desktop =
|
|
42
|
+
canRender && (windowSize === "desktop" || windowSize === "ssr")
|
|
43
|
+
? react_1.default.createElement(Desktop_1.default, null)
|
|
44
|
+
: undefined;
|
|
45
|
+
return {
|
|
46
|
+
hidden,
|
|
47
|
+
mobile,
|
|
48
|
+
desktop,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function DocItemLayout({ children }) {
|
|
52
|
+
const docTOC = useDocTOC();
|
|
53
|
+
const { metadata } = (0, client_1.useDoc)();
|
|
54
|
+
const { frontMatter } = (0, client_1.useDoc)();
|
|
55
|
+
const api = frontMatter.api;
|
|
56
|
+
return react_1.default.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
{ className: "row" },
|
|
59
|
+
react_1.default.createElement(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: (0, clsx_1.default)(
|
|
63
|
+
"col",
|
|
64
|
+
!docTOC.hidden && styles_module_css_1.default.docItemCol
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
react_1.default.createElement(ContentVisibility_1.default, {
|
|
68
|
+
metadata: metadata,
|
|
69
|
+
}),
|
|
70
|
+
react_1.default.createElement(DocVersionBanner_1.default, null),
|
|
71
|
+
react_1.default.createElement(
|
|
72
|
+
"div",
|
|
73
|
+
{ className: styles_module_css_1.default.docItemContainer },
|
|
74
|
+
react_1.default.createElement(
|
|
75
|
+
"article",
|
|
76
|
+
null,
|
|
77
|
+
react_1.default.createElement(DocBreadcrumbs_1.default, null),
|
|
78
|
+
react_1.default.createElement(DocVersionBadge_1.default, null),
|
|
79
|
+
docTOC.mobile,
|
|
80
|
+
react_1.default.createElement(Content_1.default, null, children),
|
|
81
|
+
react_1.default.createElement(
|
|
82
|
+
"div",
|
|
83
|
+
{ className: "row" },
|
|
84
|
+
react_1.default.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: (0, clsx_1.default)(
|
|
88
|
+
"col",
|
|
89
|
+
api ? "col--7" : "col--12"
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
react_1.default.createElement(Footer_1.default, null)
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
),
|
|
96
|
+
react_1.default.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{ className: "row" },
|
|
99
|
+
react_1.default.createElement(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
className: (0, clsx_1.default)("col", api ? "col--7" : "col--12"),
|
|
103
|
+
},
|
|
104
|
+
react_1.default.createElement(Paginator_1.default, null)
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
),
|
|
109
|
+
docTOC.desktop &&
|
|
110
|
+
react_1.default.createElement(
|
|
111
|
+
"div",
|
|
112
|
+
{ className: "col col--3" },
|
|
113
|
+
docTOC.desktop
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
exports.default = DocItemLayout;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
.docItemContainer header + *,
|
|
9
|
+
.docItemContainer article > *:first-child {
|
|
10
|
+
margin-top: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docItemCol {
|
|
15
|
+
max-width: 75% !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -25,7 +25,7 @@ const useDocusaurusContext_1 = __importDefault(
|
|
|
25
25
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
26
26
|
const slice_1 = require("@theme/ApiExplorer/Authorization/slice");
|
|
27
27
|
const persistanceMiddleware_1 = require("@theme/ApiExplorer/persistanceMiddleware");
|
|
28
|
-
const Layout_1 = __importDefault(require("@theme/
|
|
28
|
+
const Layout_1 = __importDefault(require("@theme/ApiItem/Layout"));
|
|
29
29
|
const Metadata_1 = __importDefault(require("@theme/DocItem/Metadata"));
|
|
30
30
|
const clsx_1 = __importDefault(require("clsx"));
|
|
31
31
|
const react_redux_1 = require("react-redux");
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-
|
|
4
|
+
"version": "0.0.0-775",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"clsx": "^1.1.1",
|
|
43
43
|
"copy-text-to-clipboard": "^3.1.0",
|
|
44
44
|
"crypto-js": "^4.1.1",
|
|
45
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-
|
|
45
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-775",
|
|
46
46
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
47
47
|
"file-saver": "^2.0.5",
|
|
48
48
|
"lodash": "^4.17.20",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=14"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "fe758c269a82b21258400a773d0fcff3bd312c3e"
|
|
73
73
|
}
|
|
@@ -0,0 +1,82 @@
|
|
|
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 { useDoc } from "@docusaurus/plugin-content-docs/client";
|
|
11
|
+
import { useWindowSize } from "@docusaurus/theme-common";
|
|
12
|
+
import type { Props } from "@theme/ApiItem/Layout";
|
|
13
|
+
import ContentVisibility from "@theme/ContentVisibility";
|
|
14
|
+
import DocBreadcrumbs from "@theme/DocBreadcrumbs";
|
|
15
|
+
import DocItemContent from "@theme/DocItem/Content";
|
|
16
|
+
import DocItemFooter from "@theme/DocItem/Footer";
|
|
17
|
+
import DocItemPaginator from "@theme/DocItem/Paginator";
|
|
18
|
+
import DocItemTOCDesktop from "@theme/DocItem/TOC/Desktop";
|
|
19
|
+
import DocItemTOCMobile from "@theme/DocItem/TOC/Mobile";
|
|
20
|
+
import DocVersionBadge from "@theme/DocVersionBadge";
|
|
21
|
+
import DocVersionBanner from "@theme/DocVersionBanner";
|
|
22
|
+
import clsx from "clsx";
|
|
23
|
+
|
|
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 { metadata } = useDoc();
|
|
53
|
+
const { frontMatter } = useDoc();
|
|
54
|
+
const api = frontMatter.api;
|
|
55
|
+
return (
|
|
56
|
+
<div className="row">
|
|
57
|
+
<div className={clsx("col", !docTOC.hidden && styles.docItemCol)}>
|
|
58
|
+
<ContentVisibility metadata={metadata} />
|
|
59
|
+
<DocVersionBanner />
|
|
60
|
+
<div className={styles.docItemContainer}>
|
|
61
|
+
<article>
|
|
62
|
+
<DocBreadcrumbs />
|
|
63
|
+
<DocVersionBadge />
|
|
64
|
+
{docTOC.mobile}
|
|
65
|
+
<DocItemContent>{children}</DocItemContent>
|
|
66
|
+
<div className="row">
|
|
67
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
68
|
+
<DocItemFooter />
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
</article>
|
|
72
|
+
<div className="row">
|
|
73
|
+
<div className={clsx("col", api ? "col--7" : "col--12")}>
|
|
74
|
+
<DocItemPaginator />
|
|
75
|
+
</div>
|
|
76
|
+
</div>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
{docTOC.desktop && <div className="col col--3">{docTOC.desktop}</div>}
|
|
80
|
+
</div>
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
.docItemContainer header + *,
|
|
9
|
+
.docItemContainer article > *:first-child {
|
|
10
|
+
margin-top: 0;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
@media (min-width: 997px) {
|
|
14
|
+
.docItemCol {
|
|
15
|
+
max-width: 75% !important;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -17,8 +17,8 @@ import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
|
17
17
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
18
18
|
import { createAuth } from "@theme/ApiExplorer/Authorization/slice";
|
|
19
19
|
import { createPersistanceMiddleware } from "@theme/ApiExplorer/persistanceMiddleware";
|
|
20
|
+
import DocItemLayout from "@theme/ApiItem/Layout";
|
|
20
21
|
import type { Props } from "@theme/DocItem";
|
|
21
|
-
import DocItemLayout from "@theme/DocItem/Layout";
|
|
22
22
|
import DocItemMetadata from "@theme/DocItem/Metadata";
|
|
23
23
|
import clsx from "clsx";
|
|
24
24
|
import { ServerObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
package/src/theme-classic.d.ts
CHANGED
|
@@ -27,8 +27,6 @@ declare module "@docusaurus/theme-common/internal" {
|
|
|
27
27
|
export interface LineProps extends ILineProps {}
|
|
28
28
|
export interface CodeBlockProps extends ICodeBlockProps {}
|
|
29
29
|
|
|
30
|
-
export function useDoc();
|
|
31
|
-
|
|
32
30
|
export function usePrismTheme(): PrismTheme;
|
|
33
31
|
|
|
34
32
|
export function sanitizeTabsChildren(children: TabProps["children"]);
|
package/src/theme-openapi.d.ts
CHANGED