docusaurus-theme-openapi-docs 2.0.0-beta.4 → 2.0.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.
@@ -202,7 +202,10 @@ function Body({
202
202
  let defaultBody = ""; //"body content";
203
203
  let exampleBody;
204
204
  let examplesBodies = [];
205
- if (contentType === "application/json" || contentType.endsWith("+json")) {
205
+ if (
206
+ contentType.includes("application/json") ||
207
+ contentType.endsWith("+json")
208
+ ) {
206
209
  if (jsonRequestBodyExample) {
207
210
  defaultBody = JSON.stringify(jsonRequestBodyExample, null, 2);
208
211
  }
@@ -66,15 +66,16 @@ function MethodEndpoint({ method, path }) {
66
66
  react_1.default.createElement(
67
67
  "span",
68
68
  { className: "badge badge--" + colorForMethod(method) },
69
- method.toUpperCase()
69
+ method === "event" ? "Webhook" : method.toUpperCase()
70
70
  ),
71
71
  " ",
72
- react_1.default.createElement(
73
- "h2",
74
- { className: "openapi__method-endpoint-path" },
75
- renderServerUrl(),
76
- `${path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}`
77
- )
72
+ method !== "event" &&
73
+ react_1.default.createElement(
74
+ "h2",
75
+ { className: "openapi__method-endpoint-path" },
76
+ renderServerUrl(),
77
+ `${path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}`
78
+ )
78
79
  ),
79
80
  react_1.default.createElement("div", { className: "openapi__divider" })
80
81
  );
@@ -235,6 +235,7 @@ function Request({ item }) {
235
235
  "div",
236
236
  { className: "openapi-explorer__details-outer-container" },
237
237
  showServerOptions &&
238
+ item.method !== "event" &&
238
239
  react_1.default.createElement(
239
240
  "details",
240
241
  {
@@ -351,6 +352,7 @@ function Request({ item }) {
351
352
  react_1.default.createElement(Accept_1.default, null)
352
353
  ),
353
354
  showRequestButton &&
355
+ item.method !== "event" &&
354
356
  react_1.default.createElement(
355
357
  "button",
356
358
  { className: "openapi-explorer__request-btn", type: "submit" },
@@ -79,3 +79,41 @@
79
79
  .openapi-response__status-headers {
80
80
  margin-left: -1rem;
81
81
  }
82
+
83
+ /* loading spinner */
84
+ .openapi-response__lds-ring {
85
+ display: inline-block;
86
+ position: relative;
87
+ width: 80px;
88
+ height: 80px;
89
+ }
90
+ .openapi-response__lds-ring div {
91
+ box-sizing: border-box;
92
+ display: block;
93
+ position: absolute;
94
+ width: 64px;
95
+ height: 64px;
96
+ margin: 8px;
97
+ border: 5px solid #dfc;
98
+ border-radius: 50%;
99
+ animation: openapi-response__lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1)
100
+ infinite;
101
+ border-color: var(--ifm-color-primary) transparent transparent transparent;
102
+ }
103
+ .openapi-response__lds-ring div:nth-child(1) {
104
+ animation-delay: -0.45s;
105
+ }
106
+ .openapi-response__lds-ring div:nth-child(2) {
107
+ animation-delay: -0.3s;
108
+ }
109
+ .openapi-response__lds-ring div:nth-child(3) {
110
+ animation-delay: -0.15s;
111
+ }
112
+ @keyframes openapi-response__lds-ring {
113
+ 0% {
114
+ transform: rotate(0deg);
115
+ }
116
+ 100% {
117
+ transform: rotate(360deg);
118
+ }
119
+ }
@@ -14,7 +14,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
14
14
  const react_1 = __importDefault(require("react"));
15
15
  const theme_common_1 = require("@docusaurus/theme-common");
16
16
  const internal_1 = require("@docusaurus/theme-common/internal");
17
- const react_2 = require("@nextui-org/react");
18
17
  const ApiCodeBlock_1 = __importDefault(
19
18
  require("@theme/ApiExplorer/ApiCodeBlock")
20
19
  );
@@ -169,7 +168,14 @@ function Response({ item }) {
169
168
  ? react_1.default.createElement(
170
169
  "div",
171
170
  { className: "openapi-explorer__loading-container" },
172
- react_1.default.createElement(react_2.Loading, { color: "success" })
171
+ react_1.default.createElement(
172
+ "div",
173
+ { className: "openapi-response__lds-ring" },
174
+ react_1.default.createElement("div", null),
175
+ react_1.default.createElement("div", null),
176
+ react_1.default.createElement("div", null),
177
+ react_1.default.createElement("div", null)
178
+ )
173
179
  )
174
180
  : react_1.default.createElement(
175
181
  "p",
@@ -25,10 +25,11 @@ function ApiExplorer({ item, infoPath }) {
25
25
  return react_1.default.createElement(
26
26
  react_1.default.Fragment,
27
27
  null,
28
- react_1.default.createElement(CodeSnippets_1.default, {
29
- postman: postman,
30
- codeSamples: item["x-code-samples"] ?? [],
31
- }),
28
+ item.method !== "event" &&
29
+ react_1.default.createElement(CodeSnippets_1.default, {
30
+ postman: postman,
31
+ codeSamples: item["x-code-samples"] ?? [],
32
+ }),
32
33
  react_1.default.createElement(Request_1.default, { item: item }),
33
34
  react_1.default.createElement(Response_1.default, { item: item })
34
35
  );
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": "2.0.0-beta.4",
4
+ "version": "2.0.0",
5
5
  "license": "MIT",
6
6
  "keywords": [
7
7
  "openapi",
@@ -28,23 +28,22 @@
28
28
  "watch": "concurrently --names \"lib,lib-next,tsc\" --kill-others \"yarn babel:lib --watch\" \"yarn babel:lib-next --watch\" \"yarn tsc --watch\""
29
29
  },
30
30
  "devDependencies": {
31
- "@docusaurus/types": ">=2.3.0 <2.5.0",
31
+ "@docusaurus/types": ">=2.4.1 <=2.4.3",
32
32
  "@types/crypto-js": "^4.1.0",
33
33
  "@types/file-saver": "^2.0.5",
34
34
  "@types/lodash": "^4.14.176",
35
35
  "concurrently": "^5.2.0"
36
36
  },
37
37
  "dependencies": {
38
- "@docusaurus/theme-common": ">=2.3.0 <2.5.0",
38
+ "@docusaurus/theme-common": ">=2.4.1 <=2.4.3",
39
39
  "@hookform/error-message": "^2.0.1",
40
- "@nextui-org/react": "^1.0.0-beta.12",
41
40
  "@paloaltonetworks/postman-code-generators": "1.1.15-patch.2",
42
41
  "@paloaltonetworks/postman-collection": "^4.1.0",
43
42
  "@reduxjs/toolkit": "^1.7.1",
44
43
  "clsx": "^1.1.1",
45
44
  "copy-text-to-clipboard": "^3.1.0",
46
45
  "crypto-js": "^4.1.1",
47
- "docusaurus-plugin-openapi-docs": "^2.0.0-beta.4",
46
+ "docusaurus-plugin-openapi-docs": "^2.0.0",
48
47
  "docusaurus-plugin-sass": "^0.2.3",
49
48
  "file-saver": "^2.0.5",
50
49
  "lodash": "^4.17.20",
@@ -58,15 +57,16 @@
58
57
  "react-redux": "^7.2.0",
59
58
  "rehype-raw": "^6.1.1",
60
59
  "sass": "^1.58.1",
60
+ "sass-loader": "^13.3.2",
61
61
  "webpack": "^5.61.0",
62
62
  "xml-formatter": "^2.6.1"
63
63
  },
64
64
  "peerDependencies": {
65
- "react": "^16.8.4 || ^17.0.0",
66
- "react-dom": "^16.8.4 || ^17.0.0"
65
+ "react": "^16.8.4 || ^17.0.0 || ^18.0.0",
66
+ "react-dom": "^16.8.4 || ^17.0.0 || ^18.0.0"
67
67
  },
68
68
  "engines": {
69
69
  "node": ">=14"
70
70
  },
71
- "gitHead": "d7c1319c7977c3e7c54827b3950e5c9b66106e30"
71
+ "gitHead": "ec57fe9cac964cff00f5433fb829ce2d6219da7e"
72
72
  }
@@ -114,7 +114,6 @@ function Body({
114
114
  </FormItem>
115
115
  );
116
116
  }
117
-
118
117
  if (
119
118
  (contentType === "multipart/form-data" ||
120
119
  contentType === "application/x-www-form-urlencoded") &&
@@ -221,7 +220,10 @@ function Body({
221
220
  let exampleBody;
222
221
  let examplesBodies = [] as any;
223
222
 
224
- if (contentType === "application/json" || contentType.endsWith("+json")) {
223
+ if (
224
+ contentType.includes("application/json") ||
225
+ contentType.endsWith("+json")
226
+ ) {
225
227
  if (jsonRequestBodyExample) {
226
228
  defaultBody = JSON.stringify(jsonRequestBodyExample, null, 2);
227
229
  }
@@ -70,12 +70,14 @@ function MethodEndpoint({ method, path }: Props) {
70
70
  <>
71
71
  <pre className="openapi__method-endpoint">
72
72
  <span className={"badge badge--" + colorForMethod(method)}>
73
- {method.toUpperCase()}
73
+ {method === "event" ? "Webhook" : method.toUpperCase()}
74
74
  </span>{" "}
75
- <h2 className="openapi__method-endpoint-path">
76
- {renderServerUrl()}
77
- {`${path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}`}
78
- </h2>
75
+ {method !== "event" && (
76
+ <h2 className="openapi__method-endpoint-path">
77
+ {renderServerUrl()}
78
+ {`${path.replace(/{([a-z0-9-_]+)}/gi, ":$1")}`}
79
+ </h2>
80
+ )}
79
81
  </pre>
80
82
  <div className="openapi__divider" />
81
83
  </>
@@ -173,7 +173,7 @@ function Request({ item }: { item: NonNullable<ApiItem> }) {
173
173
  )}
174
174
  </div>
175
175
  <div className="openapi-explorer__details-outer-container">
176
- {showServerOptions && (
176
+ {showServerOptions && item.method !== "event" && (
177
177
  <details
178
178
  open={expandServer}
179
179
  className="openapi-explorer__details-container"
@@ -272,7 +272,7 @@ function Request({ item }: { item: NonNullable<ApiItem> }) {
272
272
  <Accept />
273
273
  </details>
274
274
  )}
275
- {showRequestButton && (
275
+ {showRequestButton && item.method !== "event" && (
276
276
  <button className="openapi-explorer__request-btn" type="submit">
277
277
  Send API Request
278
278
  </button>
@@ -79,3 +79,41 @@
79
79
  .openapi-response__status-headers {
80
80
  margin-left: -1rem;
81
81
  }
82
+
83
+ /* loading spinner */
84
+ .openapi-response__lds-ring {
85
+ display: inline-block;
86
+ position: relative;
87
+ width: 80px;
88
+ height: 80px;
89
+ }
90
+ .openapi-response__lds-ring div {
91
+ box-sizing: border-box;
92
+ display: block;
93
+ position: absolute;
94
+ width: 64px;
95
+ height: 64px;
96
+ margin: 8px;
97
+ border: 5px solid #dfc;
98
+ border-radius: 50%;
99
+ animation: openapi-response__lds-ring 1.2s cubic-bezier(0.5, 0, 0.5, 1)
100
+ infinite;
101
+ border-color: var(--ifm-color-primary) transparent transparent transparent;
102
+ }
103
+ .openapi-response__lds-ring div:nth-child(1) {
104
+ animation-delay: -0.45s;
105
+ }
106
+ .openapi-response__lds-ring div:nth-child(2) {
107
+ animation-delay: -0.3s;
108
+ }
109
+ .openapi-response__lds-ring div:nth-child(3) {
110
+ animation-delay: -0.15s;
111
+ }
112
+ @keyframes openapi-response__lds-ring {
113
+ 0% {
114
+ transform: rotate(0deg);
115
+ }
116
+ 100% {
117
+ transform: rotate(360deg);
118
+ }
119
+ }
@@ -9,7 +9,6 @@ import React from "react";
9
9
 
10
10
  import { usePrismTheme } from "@docusaurus/theme-common";
11
11
  import { useDoc } from "@docusaurus/theme-common/internal";
12
- import { Loading } from "@nextui-org/react";
13
12
  import ApiCodeBlock from "@theme/ApiExplorer/ApiCodeBlock";
14
13
  import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
15
14
  import SchemaTabs from "@theme/SchemaTabs";
@@ -134,7 +133,12 @@ function Response({ item }: { item: NonNullable<ApiItem> }) {
134
133
  </SchemaTabs>
135
134
  ) : prettyResponse === "Fetching..." ? (
136
135
  <div className="openapi-explorer__loading-container">
137
- <Loading color="success" />
136
+ <div className="openapi-response__lds-ring">
137
+ <div></div>
138
+ <div></div>
139
+ <div></div>
140
+ <div></div>
141
+ </div>
138
142
  </div>
139
143
  ) : (
140
144
  <p className="openapi-explorer__response-placeholder-message">
@@ -24,10 +24,12 @@ function ApiExplorer({
24
24
 
25
25
  return (
26
26
  <>
27
- <CodeSnippets
28
- postman={postman}
29
- codeSamples={(item as any)["x-code-samples"] ?? []}
30
- />
27
+ {item.method !== "event" && (
28
+ <CodeSnippets
29
+ postman={postman}
30
+ codeSamples={(item as any)["x-code-samples"] ?? []}
31
+ />
32
+ )}
31
33
  <Request item={item} />
32
34
  <Response item={item} />
33
35
  </>