docusaurus-theme-openapi-docs 0.0.0-860 → 0.0.0-934

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.
Files changed (37) hide show
  1. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
  2. package/lib/theme/ApiItem/index.js +3 -3
  3. package/lib/theme/ArrayBrackets/index.d.ts +3 -0
  4. package/lib/theme/ArrayBrackets/index.js +50 -0
  5. package/lib/theme/ParamsDetails/index.d.ts +6 -0
  6. package/lib/theme/ParamsDetails/index.js +134 -0
  7. package/lib/theme/ParamsItem/index.d.ts +1 -0
  8. package/lib/theme/ParamsItem/index.js +10 -6
  9. package/lib/theme/RequestSchema/index.d.ts +15 -0
  10. package/lib/theme/RequestSchema/index.js +235 -0
  11. package/lib/theme/ResponseExamples/index.d.ts +48 -0
  12. package/lib/theme/ResponseExamples/index.js +290 -0
  13. package/lib/theme/ResponseSchema/index.d.ts +15 -0
  14. package/lib/theme/ResponseSchema/index.js +206 -0
  15. package/lib/theme/Schema/index.d.ts +8 -0
  16. package/lib/theme/Schema/index.js +777 -0
  17. package/lib/theme/SchemaItem/index.d.ts +8 -8
  18. package/lib/theme/SchemaItem/index.js +9 -5
  19. package/lib/theme/SkeletonLoader/index.d.ts +6 -0
  20. package/lib/theme/SkeletonLoader/index.js +20 -0
  21. package/lib/theme/StatusCodes/index.d.ts +9 -0
  22. package/lib/theme/StatusCodes/index.js +78 -0
  23. package/lib/theme/styles.scss +41 -0
  24. package/package.json +4 -3
  25. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +50 -0
  26. package/src/theme/ApiItem/index.tsx +2 -1
  27. package/src/theme/ArrayBrackets/index.tsx +37 -0
  28. package/src/theme/ParamsDetails/index.tsx +88 -0
  29. package/src/theme/ParamsItem/index.tsx +10 -7
  30. package/src/theme/RequestSchema/index.tsx +164 -0
  31. package/src/theme/ResponseExamples/index.tsx +290 -0
  32. package/src/theme/ResponseSchema/index.tsx +151 -0
  33. package/src/theme/Schema/index.tsx +808 -0
  34. package/src/theme/SchemaItem/index.tsx +15 -13
  35. package/src/theme/SkeletonLoader/index.tsx +18 -0
  36. package/src/theme/StatusCodes/index.tsx +72 -0
  37. package/src/theme/styles.scss +41 -0
@@ -17,15 +17,15 @@ import { createDescription } from "../../markdown/createDescription";
17
17
  import { guard } from "../../markdown/utils";
18
18
 
19
19
  export interface Props {
20
- children: ReactNode;
21
- collapsible: boolean;
22
- name: string;
23
- qualifierMessage: string | undefined;
24
- required: boolean;
25
- schemaName: string;
20
+ children?: ReactNode;
21
+ collapsible?: boolean;
22
+ name?: string;
23
+ qualifierMessage?: string | undefined;
24
+ required?: boolean;
25
+ schemaName?: string;
26
26
  // TODO should probably be typed
27
- schema: any;
28
- discriminator: boolean;
27
+ schema?: any;
28
+ discriminator?: boolean;
29
29
  }
30
30
 
31
31
  const transformEnumDescriptions = (
@@ -96,11 +96,13 @@ export default function SchemaItem(props: Props) {
96
96
  getEnumDescriptionMarkdown(enumDescriptions),
97
97
  (value) => {
98
98
  return (
99
- <ReactMarkdown
100
- remarkPlugins={[remarkGfm]}
101
- rehypePlugins={[rehypeRaw]}
102
- children={value}
103
- />
99
+ <div style={{ marginTop: ".5rem" }}>
100
+ <ReactMarkdown
101
+ remarkPlugins={[remarkGfm]}
102
+ rehypePlugins={[rehypeRaw]}
103
+ children={value}
104
+ />
105
+ </div>
104
106
  );
105
107
  }
106
108
  );
@@ -0,0 +1,18 @@
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
+ interface Props {
11
+ size?: "sm" | "md" | "lg";
12
+ }
13
+
14
+ const SkeletonLoader: React.FC<Props> = (props) => {
15
+ return <div className={`openapi-skeleton ${props.size ?? "md"}`}></div>;
16
+ };
17
+
18
+ export default SkeletonLoader;
@@ -0,0 +1,72 @@
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 ApiTabs from "@theme/ApiTabs";
11
+ import Details from "@theme/Details";
12
+ import { ResponseHeaders } from "@theme/ResponseExamples";
13
+ import ResponseSchema from "@theme/ResponseSchema";
14
+ import TabItem from "@theme/TabItem";
15
+ import { createDescription } from "docusaurus-plugin-openapi-docs/lib/markdown/createDescription";
16
+ import { ApiItem } from "docusaurus-plugin-openapi-docs/lib/types";
17
+
18
+ interface Props {
19
+ id?: string;
20
+ label?: string;
21
+ responses: ApiItem["responses"];
22
+ }
23
+
24
+ const StatusCodes: React.FC<Props> = ({ label, id, responses }: any) => {
25
+ if (!responses) return null;
26
+
27
+ const codes = Object.keys(responses);
28
+ if (codes.length === 0) return null;
29
+
30
+ return (
31
+ <ApiTabs label={label} id={id}>
32
+ {codes.map((code) => {
33
+ const response = responses[code];
34
+ const responseHeaders = response.headers;
35
+
36
+ return (
37
+ // @ts-ignore
38
+ <TabItem key={code} label={code} value={code}>
39
+ <div>
40
+ {response.description && (
41
+ <div style={{ marginTop: ".5rem", marginBottom: ".5rem" }}>
42
+ {createDescription(response.description)}
43
+ </div>
44
+ )}
45
+ </div>
46
+ {responseHeaders && (
47
+ <Details
48
+ className="openapi-markdown__details"
49
+ data-collapsed={true}
50
+ open={false}
51
+ style={{ textAlign: "left", marginBottom: "1rem" }}
52
+ summary={
53
+ <summary>
54
+ <strong>Response Headers</strong>
55
+ </summary>
56
+ }
57
+ >
58
+ <ResponseHeaders responseHeaders={responseHeaders} />
59
+ </Details>
60
+ )}
61
+ <ResponseSchema
62
+ title="Schema"
63
+ body={{ content: response.content }}
64
+ />
65
+ </TabItem>
66
+ );
67
+ })}
68
+ </ApiTabs>
69
+ );
70
+ };
71
+
72
+ export default StatusCodes;
@@ -81,6 +81,7 @@
81
81
  --openapi-explorer-padding-input: 0.5rem;
82
82
  --openapi-explorer-border-color: var(--ifm-toc-border-color);
83
83
  --openapi-explorer-caret-bg: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="16px" height="16px" viewBox="0 0 24 24"><path d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path></svg>');
84
+ --openapi-skeleton-background: var(--ifm-color-emphasis-100);
84
85
  }
85
86
 
86
87
  [data-theme="dark"] {
@@ -163,3 +164,43 @@
163
164
  .openapi-tabs__heading {
164
165
  margin-bottom: 1rem;
165
166
  }
167
+
168
+ /* Loading Skeleton */
169
+ @keyframes pulsing {
170
+ 0% {
171
+ opacity: 1;
172
+ background-color: var(--ifm-color-emphasis-100);
173
+ }
174
+ 50% {
175
+ opacity: 0.6;
176
+ background-color: var(--ifm-toc-border-color);
177
+ }
178
+ 100% {
179
+ opacity: 1;
180
+ background-color: var(--ifm-color-emphasis-100);
181
+ }
182
+ }
183
+
184
+ .openapi-skeleton {
185
+ animation: pulsing 2s infinite ease-in-out;
186
+ }
187
+
188
+ /* Loading Skeleton */
189
+ .openapi-skeleton {
190
+ border-radius: var(--ifm-pre-border-radius);
191
+ background-color: var(--openapi-skeleton-background);
192
+ max-width: 100%;
193
+ margin: 1rem auto;
194
+ }
195
+
196
+ .openapi-skeleton.sm {
197
+ height: 100px;
198
+ }
199
+
200
+ .openapi-skeleton.md {
201
+ height: 350px;
202
+ }
203
+
204
+ .openapi-skeleton.lg {
205
+ height: 96.5%;
206
+ }