docusaurus-theme-openapi-docs 1.0.4 → 1.1.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/theme/ApiDemoPanel/Body/index.js +11 -9
- package/lib/theme/ApiDemoPanel/Body/json2xml.js +43 -0
- package/lib/theme/ApiDemoPanel/CodeTabs/index.js +193 -0
- package/lib/theme/ApiDemoPanel/CodeTabs/styles.module.css +11 -0
- package/lib/theme/ApiDemoPanel/Curl/index.js +41 -110
- 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 +74 -0
- package/lib/theme/ApiDemoPanel/LiveEditor/styles.module.css +35 -0
- package/lib/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib/theme/ApiDemoPanel/Server/index.js +1 -1
- 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/Layout/icons/bash-original.svg +1 -0
- package/lib/theme/ApiItem/Layout/icons/go-original-wordmark.svg +1 -0
- package/lib/theme/ApiItem/Layout/icons/javascript-original.svg +1 -0
- package/lib/theme/ApiItem/Layout/icons/linux-original.svg +1 -0
- package/lib/theme/ApiItem/Layout/icons/python-original.svg +1 -0
- package/lib/theme/ApiItem/Layout/index.js +93 -0
- package/lib/theme/ApiItem/{styles.module.css → Layout/styles.module.css} +114 -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/Body/index.js +11 -15
- package/lib-next/theme/ApiDemoPanel/Body/json2xml.js +43 -0
- package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +215 -0
- package/lib-next/theme/ApiDemoPanel/CodeTabs/styles.module.css +11 -0
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +46 -135
- 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 +60 -0
- package/lib-next/theme/ApiDemoPanel/LiveEditor/styles.module.css +35 -0
- package/lib-next/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/lib-next/theme/ApiDemoPanel/Server/index.js +1 -0
- 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/Layout/icons/bash-original.svg +1 -0
- package/lib-next/theme/ApiItem/Layout/icons/go-original-wordmark.svg +1 -0
- package/lib-next/theme/ApiItem/Layout/icons/javascript-original.svg +1 -0
- package/lib-next/theme/ApiItem/Layout/icons/linux-original.svg +1 -0
- package/lib-next/theme/ApiItem/Layout/icons/python-original.svg +1 -0
- package/lib-next/theme/ApiItem/Layout/index.js +69 -0
- package/{src/theme/ApiItem → lib-next/theme/ApiItem/Layout}/styles.module.css +114 -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 +7 -9
- package/src/theme/ApiDemoPanel/Body/index.tsx +9 -13
- package/src/theme/ApiDemoPanel/Body/json2xml.js +43 -0
- package/src/theme/ApiDemoPanel/CodeTabs/index.tsx +238 -0
- package/src/theme/ApiDemoPanel/CodeTabs/styles.module.css +11 -0
- package/src/theme/ApiDemoPanel/Curl/index.tsx +45 -124
- 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 +71 -0
- package/src/theme/ApiDemoPanel/LiveEditor/styles.module.css +35 -0
- package/src/theme/ApiDemoPanel/ParamOptions/styles.module.css +0 -4
- package/src/theme/ApiDemoPanel/Server/index.tsx +1 -0
- 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/Layout/icons/bash-original.svg +1 -0
- package/src/theme/ApiItem/Layout/icons/go-original-wordmark.svg +1 -0
- package/src/theme/ApiItem/Layout/icons/javascript-original.svg +1 -0
- package/src/theme/ApiItem/Layout/icons/linux-original.svg +1 -0
- package/src/theme/ApiItem/Layout/icons/python-original.svg +1 -0
- package/src/theme/ApiItem/Layout/index.tsx +78 -0
- package/{lib-next/theme/ApiItem → src/theme/ApiItem/Layout}/styles.module.css +114 -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
- package/lib/theme/ApiDemoPanel/VSCode/index.js +0 -252
- package/lib/theme/ApiDemoPanel/VSCode/styles.module.css +0 -19
- package/lib-next/theme/ApiDemoPanel/VSCode/index.js +0 -265
- package/lib-next/theme/ApiDemoPanel/VSCode/styles.module.css +0 -19
- package/src/theme/ApiDemoPanel/VSCode/index.tsx +0 -205
- package/src/theme/ApiDemoPanel/VSCode/styles.module.css +0 -19
|
@@ -4,20 +4,21 @@
|
|
|
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 React, {
|
|
7
|
+
import React, { useState, useEffect } from "react";
|
|
8
8
|
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
9
9
|
import codegen from "@paloaltonetworks/postman-code-generators";
|
|
10
|
+
import CodeBlock from "@theme/CodeBlock";
|
|
10
11
|
import clsx from "clsx";
|
|
11
|
-
import
|
|
12
|
+
import CodeTabs from "../CodeTabs";
|
|
12
13
|
import { useTypedSelector } from "../hooks";
|
|
13
14
|
import buildPostmanRequest from "./../buildPostmanRequest";
|
|
14
|
-
import FloatingButton from "./../FloatingButton";
|
|
15
15
|
import styles from "./styles.module.css";
|
|
16
|
-
const languageSet = [
|
|
16
|
+
export const languageSet = [
|
|
17
17
|
{
|
|
18
18
|
tabName: "cURL",
|
|
19
19
|
highlight: "bash",
|
|
20
20
|
language: "curl",
|
|
21
|
+
codeLanguage: "bash",
|
|
21
22
|
variant: "curl",
|
|
22
23
|
options: {
|
|
23
24
|
longFormat: false,
|
|
@@ -26,12 +27,12 @@ const languageSet = [
|
|
|
26
27
|
},
|
|
27
28
|
},
|
|
28
29
|
{
|
|
29
|
-
tabName: "
|
|
30
|
-
highlight: "
|
|
31
|
-
language: "
|
|
32
|
-
|
|
30
|
+
tabName: "Python",
|
|
31
|
+
highlight: "python",
|
|
32
|
+
language: "python",
|
|
33
|
+
codeLanguage: "python",
|
|
34
|
+
variant: "requests",
|
|
33
35
|
options: {
|
|
34
|
-
ES6_enabled: true,
|
|
35
36
|
followRedirect: true,
|
|
36
37
|
trimRequestBody: true,
|
|
37
38
|
},
|
|
@@ -40,6 +41,7 @@ const languageSet = [
|
|
|
40
41
|
tabName: "Go",
|
|
41
42
|
highlight: "go",
|
|
42
43
|
language: "go",
|
|
44
|
+
codeLanguage: "go",
|
|
43
45
|
variant: "native",
|
|
44
46
|
options: {
|
|
45
47
|
followRedirect: true,
|
|
@@ -47,70 +49,36 @@ const languageSet = [
|
|
|
47
49
|
},
|
|
48
50
|
},
|
|
49
51
|
{
|
|
50
|
-
tabName: "
|
|
51
|
-
highlight: "
|
|
52
|
-
language: "
|
|
53
|
-
|
|
52
|
+
tabName: "Node",
|
|
53
|
+
highlight: "javascript",
|
|
54
|
+
language: "nodejs",
|
|
55
|
+
codeLanguage: "javascript",
|
|
56
|
+
variant: "axios",
|
|
54
57
|
options: {
|
|
58
|
+
ES6_enabled: true,
|
|
55
59
|
followRedirect: true,
|
|
56
60
|
trimRequestBody: true,
|
|
57
61
|
},
|
|
58
62
|
},
|
|
59
63
|
];
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
color: "var(--openapi-code-green)",
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
types: ["builtin", "char", "constant", "function"],
|
|
79
|
-
style: {
|
|
80
|
-
color: "var(--openapi-code-blue)",
|
|
81
|
-
},
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
types: ["punctuation", "operator"],
|
|
85
|
-
style: {
|
|
86
|
-
color: "var(--openapi-code-dim)",
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
{
|
|
90
|
-
types: ["class-name"],
|
|
91
|
-
style: {
|
|
92
|
-
color: "var(--openapi-code-orange)",
|
|
93
|
-
},
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
types: ["tag", "arrow", "keyword"],
|
|
97
|
-
style: {
|
|
98
|
-
color: "var(--openapi-code-purple)",
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
types: ["boolean"],
|
|
103
|
-
style: {
|
|
104
|
-
color: "var(--openapi-code-red)",
|
|
105
|
-
},
|
|
106
|
-
},
|
|
107
|
-
],
|
|
108
|
-
};
|
|
64
|
+
|
|
65
|
+
function CodeTab({ children, hidden, className, onClick }) {
|
|
66
|
+
return (
|
|
67
|
+
<div
|
|
68
|
+
role="tabpanel"
|
|
69
|
+
className={clsx(styles.tabItem, className)}
|
|
70
|
+
{...{
|
|
71
|
+
hidden,
|
|
72
|
+
}}
|
|
73
|
+
>
|
|
74
|
+
{children}
|
|
75
|
+
</div>
|
|
76
|
+
);
|
|
77
|
+
}
|
|
109
78
|
|
|
110
79
|
function Curl({ postman, codeSamples }) {
|
|
111
80
|
// TODO: match theme for vscode.
|
|
112
81
|
const { siteConfig } = useDocusaurusContext();
|
|
113
|
-
const [copyText, setCopyText] = useState("Copy");
|
|
114
82
|
const contentType = useTypedSelector((state) => state.contentType.value);
|
|
115
83
|
const accept = useTypedSelector((state) => state.accept.value);
|
|
116
84
|
const server = useTypedSelector((state) => state.server.value);
|
|
@@ -125,7 +93,11 @@ function Curl({ postman, codeSamples }) {
|
|
|
125
93
|
...(siteConfig?.themeConfig?.languageTabs ?? languageSet),
|
|
126
94
|
...codeSamples,
|
|
127
95
|
];
|
|
128
|
-
const
|
|
96
|
+
const defaultLang = languageSet.filter(
|
|
97
|
+
(lang) =>
|
|
98
|
+
lang.codeLanguage === localStorage.getItem("docusaurus.tab.code-samples")
|
|
99
|
+
);
|
|
100
|
+
const [language, setLanguage] = useState(defaultLang[0] ?? langs[0]);
|
|
129
101
|
const [codeText, setCodeText] = useState("");
|
|
130
102
|
useEffect(() => {
|
|
131
103
|
if (language && !!language.options) {
|
|
@@ -171,18 +143,6 @@ function Curl({ postman, codeSamples }) {
|
|
|
171
143
|
server,
|
|
172
144
|
auth,
|
|
173
145
|
]);
|
|
174
|
-
const ref = useRef(null);
|
|
175
|
-
|
|
176
|
-
const handleCurlCopy = () => {
|
|
177
|
-
setCopyText("Copied");
|
|
178
|
-
setTimeout(() => {
|
|
179
|
-
setCopyText("Copy");
|
|
180
|
-
}, 2000);
|
|
181
|
-
|
|
182
|
-
if (ref.current?.innerText) {
|
|
183
|
-
navigator.clipboard.writeText(ref.current.innerText);
|
|
184
|
-
}
|
|
185
|
-
};
|
|
186
146
|
|
|
187
147
|
if (language === undefined) {
|
|
188
148
|
return null;
|
|
@@ -190,71 +150,22 @@ function Curl({ postman, codeSamples }) {
|
|
|
190
150
|
|
|
191
151
|
return (
|
|
192
152
|
<>
|
|
193
|
-
<
|
|
153
|
+
<CodeTabs groupId="code-samples" action={setLanguage}>
|
|
194
154
|
{langs.map((lang) => {
|
|
195
155
|
return (
|
|
196
|
-
<
|
|
156
|
+
<CodeTab
|
|
157
|
+
value={lang.language}
|
|
158
|
+
label={""}
|
|
197
159
|
key={lang.tabName || lang.label}
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
"api-code-tab"
|
|
202
|
-
)}
|
|
203
|
-
onClick={() => setLanguage(lang)}
|
|
160
|
+
attributes={{
|
|
161
|
+
className: `code__tab--${lang.codeLanguage}`,
|
|
162
|
+
}}
|
|
204
163
|
>
|
|
205
|
-
{lang.
|
|
206
|
-
</
|
|
164
|
+
<CodeBlock language={lang.codeLanguage}>{codeText}</CodeBlock>
|
|
165
|
+
</CodeTab>
|
|
207
166
|
);
|
|
208
167
|
})}
|
|
209
|
-
</
|
|
210
|
-
|
|
211
|
-
<Highlight
|
|
212
|
-
{...defaultProps}
|
|
213
|
-
theme={languageTheme}
|
|
214
|
-
code={codeText}
|
|
215
|
-
language={language.highlight || language.lang}
|
|
216
|
-
>
|
|
217
|
-
{({ className, tokens, getLineProps, getTokenProps }) => (
|
|
218
|
-
<FloatingButton onClick={handleCurlCopy} label={copyText}>
|
|
219
|
-
<pre
|
|
220
|
-
className={className}
|
|
221
|
-
style={{
|
|
222
|
-
background: "var(--openapi-card-background-color)",
|
|
223
|
-
paddingRight: "60px",
|
|
224
|
-
borderRadius:
|
|
225
|
-
"2px 2px var(--openapi-card-border-radius) var(--openapi-card-border-radius)",
|
|
226
|
-
}}
|
|
227
|
-
>
|
|
228
|
-
<code ref={ref}>
|
|
229
|
-
{tokens.map((line, i) => (
|
|
230
|
-
<span
|
|
231
|
-
{...getLineProps({
|
|
232
|
-
line,
|
|
233
|
-
key: i,
|
|
234
|
-
})}
|
|
235
|
-
>
|
|
236
|
-
{line.map((token, key) => {
|
|
237
|
-
if (token.types.includes("arrow")) {
|
|
238
|
-
token.types = ["arrow"];
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
return (
|
|
242
|
-
<span
|
|
243
|
-
{...getTokenProps({
|
|
244
|
-
token,
|
|
245
|
-
key,
|
|
246
|
-
})}
|
|
247
|
-
/>
|
|
248
|
-
);
|
|
249
|
-
})}
|
|
250
|
-
{"\n"}
|
|
251
|
-
</span>
|
|
252
|
-
))}
|
|
253
|
-
</code>
|
|
254
|
-
</pre>
|
|
255
|
-
</FloatingButton>
|
|
256
|
-
)}
|
|
257
|
-
</Highlight>
|
|
168
|
+
</CodeTabs>
|
|
258
169
|
</>
|
|
259
170
|
);
|
|
260
171
|
}
|
|
@@ -9,8 +9,12 @@ import styles from "./styles.module.css";
|
|
|
9
9
|
|
|
10
10
|
function FloatingButton({ label, onClick, children }) {
|
|
11
11
|
return (
|
|
12
|
-
<div className={styles.floatingButton}>
|
|
13
|
-
{label &&
|
|
12
|
+
<div tabIndex={0} className={styles.floatingButton}>
|
|
13
|
+
{label && (
|
|
14
|
+
<button tabIndex={0} onClick={onClick}>
|
|
15
|
+
{label}
|
|
16
|
+
</button>
|
|
17
|
+
)}
|
|
14
18
|
{children}
|
|
15
19
|
</div>
|
|
16
20
|
);
|
|
@@ -9,7 +9,6 @@
|
|
|
9
9
|
border-radius: var(--ifm-global-radius);
|
|
10
10
|
color: var(--ifm-color-white);
|
|
11
11
|
cursor: pointer;
|
|
12
|
-
outline: none;
|
|
13
12
|
padding: 0.4rem 0.5rem;
|
|
14
13
|
opacity: 0;
|
|
15
14
|
visibility: hidden;
|
|
@@ -20,7 +19,9 @@
|
|
|
20
19
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
.floatingButton:hover button
|
|
22
|
+
.floatingButton:hover button,
|
|
23
|
+
.floatingButton:focus-visible button,
|
|
24
|
+
.floatingButton button:focus-visible {
|
|
24
25
|
visibility: visible;
|
|
25
26
|
opacity: 1;
|
|
26
27
|
}
|
|
@@ -0,0 +1,60 @@
|
|
|
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, { useState } from "react";
|
|
8
|
+
import { usePrismTheme } from "@docusaurus/theme-common";
|
|
9
|
+
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
10
|
+
import { LiveProvider, LiveEditor, withLive } from "react-live";
|
|
11
|
+
import { setStringRawBody } from "../Body/slice";
|
|
12
|
+
import styles from "./styles.module.css";
|
|
13
|
+
|
|
14
|
+
function Live({ onEdit }) {
|
|
15
|
+
const isBrowser = useIsBrowser();
|
|
16
|
+
const [editorDisabled, setEditorDisabled] = useState(false); // TODO: Temporary solution for disabling tab key
|
|
17
|
+
|
|
18
|
+
const handleKeydown = (event) => {
|
|
19
|
+
if (event.key === "Tab") {
|
|
20
|
+
event.preventDefault();
|
|
21
|
+
setEditorDisabled(true);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<div onClick={() => setEditorDisabled(false)}>
|
|
27
|
+
<LiveEditor
|
|
28
|
+
key={String(isBrowser)}
|
|
29
|
+
className={styles.playgroundEditor}
|
|
30
|
+
onChange={onEdit}
|
|
31
|
+
disabled={editorDisabled}
|
|
32
|
+
onKeyDown={handleKeydown}
|
|
33
|
+
/>
|
|
34
|
+
</div>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const LiveComponent = withLive(Live);
|
|
39
|
+
|
|
40
|
+
function App({ children, transformCode, value, language, action, ...props }) {
|
|
41
|
+
const prismTheme = usePrismTheme();
|
|
42
|
+
const [code, setCode] = React.useState(children);
|
|
43
|
+
action(setStringRawBody(code));
|
|
44
|
+
return (
|
|
45
|
+
<div className={styles.playgroundContainer}>
|
|
46
|
+
<LiveProvider
|
|
47
|
+
code={children.replace(/\n$/, "")}
|
|
48
|
+
transformCode={transformCode ?? ((code) => `${code};`)}
|
|
49
|
+
theme={prismTheme}
|
|
50
|
+
language={language}
|
|
51
|
+
{...props}
|
|
52
|
+
>
|
|
53
|
+
<LiveComponent onEdit={setCode} />
|
|
54
|
+
</LiveProvider>
|
|
55
|
+
</div>
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const LiveApp = withLive(App);
|
|
60
|
+
export default LiveApp;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
.playgroundContainer {
|
|
2
|
+
margin-top: 1rem;
|
|
3
|
+
margin-bottom: var(--ifm-leading);
|
|
4
|
+
border-radius: var(--ifm-global-radius);
|
|
5
|
+
box-shadow: var(--ifm-global-shadow-lw);
|
|
6
|
+
overflow: auto;
|
|
7
|
+
max-height: 500px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.playgroundHeader {
|
|
11
|
+
letter-spacing: 0.08rem;
|
|
12
|
+
padding: 0.75rem;
|
|
13
|
+
text-transform: uppercase;
|
|
14
|
+
font-weight: bold;
|
|
15
|
+
background: var(--ifm-color-emphasis-200);
|
|
16
|
+
color: var(--ifm-color-content);
|
|
17
|
+
font-size: var(--ifm-code-font-size);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.playgroundHeader:first-of-type {
|
|
21
|
+
background: var(--ifm-color-emphasis-600);
|
|
22
|
+
color: var(--ifm-color-content-inverse);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.playgroundEditor {
|
|
26
|
+
font: var(--ifm-code-font-size) / var(--ifm-pre-line-height)
|
|
27
|
+
var(--ifm-font-family-monospace) !important;
|
|
28
|
+
/* rtl:ignore */
|
|
29
|
+
direction: ltr;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.playgroundPreview {
|
|
33
|
+
padding: 1rem;
|
|
34
|
+
background-color: var(--ifm-pre-background);
|
|
35
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="none" d="M4.24 4.24h119.53v119.53H4.24z"/><path fill="#293138" d="M109.01 28.64L71.28 6.24c-2.25-1.33-4.77-2-7.28-2s-5.03.67-7.28 2.01l-37.74 22.4c-4.5 2.67-7.28 7.61-7.28 12.96v44.8c0 5.35 2.77 10.29 7.28 12.96l37.73 22.4c2.25 1.34 4.76 2 7.28 2 2.51 0 5.03-.67 7.28-2l37.74-22.4c4.5-2.67 7.28-7.62 7.28-12.96V41.6c0-5.34-2.77-10.29-7.28-12.96zM79.79 98.59l.06 3.22c0 .39-.25.83-.55.99l-1.91 1.1c-.3.15-.56-.03-.56-.42l-.03-3.17c-1.63.68-3.29.84-4.34.42-.2-.08-.29-.37-.21-.71l.69-2.91c.06-.23.18-.46.34-.6.06-.06.12-.1.18-.13.11-.06.22-.07.31-.03 1.14.38 2.59.2 3.99-.5 1.78-.9 2.97-2.72 2.95-4.52-.02-1.64-.9-2.31-3.05-2.33-2.74.01-5.3-.53-5.34-4.57-.03-3.32 1.69-6.78 4.43-8.96l-.03-3.25c0-.4.24-.84.55-1l1.85-1.18c.3-.15.56.04.56.43l.03 3.25c1.36-.54 2.54-.69 3.61-.44.23.06.34.38.24.75l-.72 2.88c-.06.22-.18.44-.33.58a.77.77 0 01-.19.14c-.1.05-.19.06-.28.05-.49-.11-1.65-.36-3.48.56-1.92.97-2.59 2.64-2.58 3.88.02 1.48.77 1.93 3.39 1.97 3.49.06 4.99 1.58 5.03 5.09.05 3.44-1.79 7.15-4.61 9.41zm26.34-60.5l-35.7 22.05c-4.45 2.6-7.73 5.52-7.74 10.89v43.99c0 3.21 1.3 5.29 3.29 5.9-.65.11-1.32.19-1.98.19-2.09 0-4.15-.57-5.96-1.64l-37.73-22.4c-3.69-2.19-5.98-6.28-5.98-10.67V41.6c0-4.39 2.29-8.48 5.98-10.67l37.74-22.4c1.81-1.07 3.87-1.64 5.96-1.64s4.15.57 5.96 1.64l37.74 22.4c3.11 1.85 5.21 5.04 5.8 8.63-1.27-2.67-4.09-3.39-7.38-1.47z"/><path fill="#4FA847" d="M99.12 90.73l-9.4 5.62c-.25.15-.43.31-.43.61v2.46c0 .3.2.43.45.28l9.54-5.8c.25-.15.29-.42.29-.72v-2.17c0-.3-.2-.42-.45-.28z"/></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><g fill="#00acd7" fill-rule="evenodd"><path d="M11.156 54.829c-.243 0-.303-.122-.182-.303l1.273-1.637c.12-.182.424-.303.666-.303H34.55c.243 0 .303.182.182.364l-1.03 1.576c-.121.181-.424.363-.606.363zM2.004 60.404c-.242 0-.303-.12-.182-.303l1.273-1.636c.121-.182.424-.303.667-.303h27.636c.242 0 .364.182.303.364l-.485 1.454c-.06.243-.303.364-.545.364zM16.67 65.98c-.242 0-.302-.182-.181-.364l.848-1.515c.122-.182.364-.363.607-.363h12.12c.243 0 .364.181.364.424l-.12 1.454c0 .243-.243.425-.425.425zM79.58 53.738c-3.819.97-6.425 1.697-10.182 2.666-.91.243-.97.303-1.758-.606-.909-1.03-1.576-1.697-2.848-2.303-3.819-1.878-7.516-1.333-10.97.91-4.121 2.666-6.242 6.605-6.182 11.514.06 4.849 3.394 8.849 8.182 9.516 4.121.545 7.576-.91 10.303-4 .545-.667 1.03-1.394 1.636-2.243H56.064c-1.272 0-1.575-.788-1.151-1.818.788-1.879 2.242-5.03 3.09-6.606.183-.364.607-.97 1.516-.97h22.06c-.12 1.637-.12 3.273-.363 4.91-.667 4.363-2.303 8.363-4.97 11.878-4.364 5.758-10.06 9.333-17.273 10.303-5.939.788-11.454-.364-16.302-4-4.485-3.394-7.03-7.879-7.697-13.454-.788-6.606 1.151-12.546 5.151-17.758 4.303-5.636 10-9.212 16.97-10.485 5.697-1.03 11.151-.363 16.06 2.97 3.212 2.121 5.515 5.03 7.03 8.545.364.546.122.849-.606 1.03z"/><path d="M99.64 87.253c-5.515-.122-10.546-1.697-14.788-5.334-3.576-3.09-5.818-7.03-6.545-11.697-1.091-6.848.787-12.909 4.909-18.302 4.424-5.819 9.757-8.849 16.97-10.122 6.181-1.09 12-.484 17.272 3.091 4.788 3.273 7.757 7.697 8.545 13.515 1.03 8.182-1.333 14.849-6.97 20.546-4 4.06-8.909 6.606-14.545 7.757-1.636.303-3.273.364-4.848.546zm14.424-24.485c-.06-.788-.06-1.394-.182-2-1.09-6-6.606-9.394-12.363-8.06-5.637 1.272-9.273 4.848-10.606 10.545-1.091 4.727 1.212 9.515 5.575 11.454 3.334 1.455 6.667 1.273 9.879-.363 4.788-2.485 7.394-6.364 7.697-11.576z" fill-rule="nonzero"/></g></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 128 128"><path fill="#F0DB4F" d="M1.408 1.408h125.184v125.185H1.408z"/><path fill="#323330" d="M116.347 96.736c-.917-5.711-4.641-10.508-15.672-14.981-3.832-1.761-8.104-3.022-9.377-5.926-.452-1.69-.512-2.642-.226-3.665.821-3.32 4.784-4.355 7.925-3.403 2.023.678 3.938 2.237 5.093 4.724 5.402-3.498 5.391-3.475 9.163-5.879-1.381-2.141-2.118-3.129-3.022-4.045-3.249-3.629-7.676-5.498-14.756-5.355l-3.688.477c-3.534.893-6.902 2.748-8.877 5.235-5.926 6.724-4.236 18.492 2.975 23.335 7.104 5.332 17.54 6.545 18.873 11.531 1.297 6.104-4.486 8.08-10.234 7.378-4.236-.881-6.592-3.034-9.139-6.949-4.688 2.713-4.688 2.713-9.508 5.485 1.143 2.499 2.344 3.63 4.26 5.795 9.068 9.198 31.76 8.746 35.83-5.176.165-.478 1.261-3.666.38-8.581zM69.462 58.943H57.753l-.048 30.272c0 6.438.333 12.34-.714 14.149-1.713 3.558-6.152 3.117-8.175 2.427-2.059-1.012-3.106-2.451-4.319-4.485-.333-.584-.583-1.036-.667-1.071l-9.52 5.83c1.583 3.249 3.915 6.069 6.902 7.901 4.462 2.678 10.459 3.499 16.731 2.059 4.082-1.189 7.604-3.652 9.448-7.401 2.666-4.915 2.094-10.864 2.07-17.444.06-10.735.001-21.468.001-32.237z"/></svg>
|