docusaurus-theme-openapi-docs 1.4.4 → 1.4.6
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/Accept/index.js +3 -3
- package/lib/theme/ApiDemoPanel/Authorization/index.js +9 -9
- package/lib/theme/ApiDemoPanel/Authorization/slice.js +1 -1
- package/lib/theme/ApiDemoPanel/Body/index.js +9 -13
- package/lib/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
- package/lib/theme/ApiDemoPanel/ContentType/index.js +3 -3
- package/lib/theme/ApiDemoPanel/Curl/index.js +3 -3
- package/lib/theme/ApiDemoPanel/Execute/index.js +3 -3
- package/lib/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
- package/lib/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
- package/lib/theme/ApiDemoPanel/ParamOptions/index.js +6 -6
- package/lib/theme/ApiDemoPanel/Request/index.js +7 -7
- package/lib/theme/ApiDemoPanel/Response/index.js +1 -1
- package/lib/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
- package/lib/theme/ApiDemoPanel/Server/index.js +5 -5
- package/lib/theme/ApiDemoPanel/index.js +5 -5
- package/lib/theme/ApiDemoPanel/persistanceMiddleware.js +1 -1
- package/lib/theme/ApiItem/index.js +3 -3
- package/lib/theme/ApiItem/store.js +7 -7
- package/lib/theme/DiscriminatorTabs/styles.module.css +9 -5
- package/lib/theme/MimeTabs/index.js +4 -6
- package/lib/theme/ParamsItem/index.js +9 -3
- package/lib/theme/SchemaItem/index.js +4 -2
- package/lib/theme/styles.css +1 -0
- package/lib/theme-openapi.d.ts +186 -0
- package/lib-next/theme/ApiDemoPanel/Accept/index.js +3 -3
- package/lib-next/theme/ApiDemoPanel/Authorization/index.js +9 -9
- package/lib-next/theme/ApiDemoPanel/Authorization/slice.js +1 -1
- package/lib-next/theme/ApiDemoPanel/Body/index.js +9 -11
- package/lib-next/theme/ApiDemoPanel/CodeTabs/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/ContentType/index.js +3 -3
- package/lib-next/theme/ApiDemoPanel/Curl/index.js +3 -3
- package/lib-next/theme/ApiDemoPanel/Execute/index.js +3 -3
- package/lib-next/theme/ApiDemoPanel/FormFileUpload/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/LiveEditor/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/ParamOptions/index.js +9 -6
- package/lib-next/theme/ApiDemoPanel/Request/index.js +7 -7
- package/lib-next/theme/ApiDemoPanel/Response/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/SecuritySchemes/index.js +1 -1
- package/lib-next/theme/ApiDemoPanel/Server/index.js +5 -5
- package/lib-next/theme/ApiDemoPanel/index.js +5 -5
- package/lib-next/theme/ApiDemoPanel/persistanceMiddleware.js +4 -1
- package/lib-next/theme/ApiItem/index.js +3 -3
- package/lib-next/theme/ApiItem/store.js +7 -7
- package/lib-next/theme/DiscriminatorTabs/styles.module.css +9 -5
- package/lib-next/theme/MimeTabs/index.js +4 -6
- package/lib-next/theme/ParamsItem/index.js +9 -3
- package/lib-next/theme/SchemaItem/index.js +4 -2
- package/lib-next/theme/styles.css +1 -0
- package/lib-next/theme-openapi.d.ts +186 -0
- package/package.json +3 -3
- package/src/theme/ApiDemoPanel/Accept/index.tsx +7 -6
- package/src/theme/ApiDemoPanel/Authorization/index.tsx +20 -19
- package/src/theme/ApiDemoPanel/Authorization/slice.ts +3 -2
- package/src/theme/ApiDemoPanel/Body/index.tsx +16 -18
- package/src/theme/ApiDemoPanel/CodeTabs/index.tsx +3 -2
- package/src/theme/ApiDemoPanel/ContentType/index.tsx +9 -6
- package/src/theme/ApiDemoPanel/Curl/index.tsx +14 -14
- package/src/theme/ApiDemoPanel/Execute/index.tsx +15 -15
- package/src/theme/ApiDemoPanel/Execute/makeRequest.ts +1 -2
- package/src/theme/ApiDemoPanel/FloatingButton/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/FormFileUpload/index.tsx +2 -2
- package/src/theme/ApiDemoPanel/FormItem/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/FormMultiSelect/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/FormSelect/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/FormTextInput/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/LiveEditor/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/MethodEndpoint/index.tsx +1 -1
- package/src/theme/ApiDemoPanel/ParamOptions/index.tsx +26 -16
- package/src/theme/ApiDemoPanel/Request/index.tsx +10 -10
- package/src/theme/ApiDemoPanel/Response/index.tsx +2 -2
- package/src/theme/ApiDemoPanel/SecuritySchemes/index.tsx +4 -5
- package/src/theme/ApiDemoPanel/Server/index.tsx +14 -13
- package/src/theme/ApiDemoPanel/buildPostmanRequest.ts +2 -3
- package/src/theme/ApiDemoPanel/index.tsx +5 -6
- package/src/theme/ApiDemoPanel/persistanceMiddleware.ts +8 -4
- package/src/theme/ApiItem/index.tsx +8 -5
- package/src/theme/ApiItem/store.ts +7 -8
- package/src/theme/DiscriminatorTabs/styles.module.css +9 -5
- package/src/theme/MimeTabs/index.js +4 -6
- package/src/theme/ParamsItem/index.js +9 -3
- package/src/theme/SchemaItem/index.js +4 -2
- package/src/theme/styles.css +1 -0
- package/src/theme-openapi.d.ts +186 -0
|
@@ -9,9 +9,9 @@ import React, { useEffect, useState } from "react";
|
|
|
9
9
|
|
|
10
10
|
import { usePrismTheme } from "@docusaurus/theme-common";
|
|
11
11
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
12
|
+
import { setStringRawBody } from "@theme/ApiDemoPanel/Body/slice";
|
|
12
13
|
import { LiveProvider, LiveEditor, withLive } from "react-live";
|
|
13
14
|
|
|
14
|
-
import { setStringRawBody } from "../Body/slice";
|
|
15
15
|
import styles from "./styles.module.css";
|
|
16
16
|
|
|
17
17
|
function Live({ onEdit }: any) {
|
|
@@ -8,16 +8,16 @@
|
|
|
8
8
|
import React, { useState, useEffect } from "react";
|
|
9
9
|
|
|
10
10
|
import { nanoid } from "@reduxjs/toolkit";
|
|
11
|
+
import FormItem from "@theme/ApiDemoPanel/FormItem";
|
|
12
|
+
import FormMultiSelect from "@theme/ApiDemoPanel/FormMultiSelect";
|
|
13
|
+
import FormSelect from "@theme/ApiDemoPanel/FormSelect";
|
|
14
|
+
import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
|
|
15
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
11
16
|
|
|
12
|
-
import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
|
|
13
|
-
import FormItem from "./../FormItem";
|
|
14
|
-
import FormMultiSelect from "./../FormMultiSelect";
|
|
15
|
-
import FormSelect from "./../FormSelect";
|
|
16
|
-
import FormTextInput from "./../FormTextInput";
|
|
17
17
|
import { Param, setParam } from "./slice";
|
|
18
18
|
import styles from "./styles.module.css";
|
|
19
19
|
|
|
20
|
-
interface ParamProps {
|
|
20
|
+
export interface ParamProps {
|
|
21
21
|
param: Param;
|
|
22
22
|
}
|
|
23
23
|
|
|
@@ -54,10 +54,10 @@ function ParamOptionWrapper({ param }: ParamProps) {
|
|
|
54
54
|
function ParamOptions() {
|
|
55
55
|
const [showOptional, setShowOptional] = useState(false);
|
|
56
56
|
|
|
57
|
-
const pathParams = useTypedSelector((state) => state.params.path);
|
|
58
|
-
const queryParams = useTypedSelector((state) => state.params.query);
|
|
59
|
-
const cookieParams = useTypedSelector((state) => state.params.cookie);
|
|
60
|
-
const headerParams = useTypedSelector((state) => state.params.header);
|
|
57
|
+
const pathParams = useTypedSelector((state: any) => state.params.path);
|
|
58
|
+
const queryParams = useTypedSelector((state: any) => state.params.query);
|
|
59
|
+
const cookieParams = useTypedSelector((state: any) => state.params.cookie);
|
|
60
|
+
const headerParams = useTypedSelector((state: any) => state.params.header);
|
|
61
61
|
|
|
62
62
|
const allParams = [
|
|
63
63
|
...pathParams,
|
|
@@ -142,7 +142,7 @@ function ArrayItem({
|
|
|
142
142
|
return (
|
|
143
143
|
<FormSelect
|
|
144
144
|
options={["---", "true", "false"]}
|
|
145
|
-
onChange={(e) => {
|
|
145
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
146
146
|
const val = e.target.value;
|
|
147
147
|
onChange(val === "---" ? undefined : val);
|
|
148
148
|
}}
|
|
@@ -153,7 +153,7 @@ function ArrayItem({
|
|
|
153
153
|
return (
|
|
154
154
|
<FormTextInput
|
|
155
155
|
placeholder={param.description || param.name}
|
|
156
|
-
onChange={(e) => {
|
|
156
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
157
157
|
onChange(e.target.value);
|
|
158
158
|
}}
|
|
159
159
|
/>
|
|
@@ -246,7 +246,7 @@ function ParamSelectFormItem({ param }: ParamProps) {
|
|
|
246
246
|
return (
|
|
247
247
|
<FormSelect
|
|
248
248
|
options={["---", ...(options as string[])]}
|
|
249
|
-
onChange={(e) => {
|
|
249
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
250
250
|
const val = e.target.value;
|
|
251
251
|
dispatch(
|
|
252
252
|
setParam({
|
|
@@ -265,7 +265,7 @@ function ParamBooleanFormItem({ param }: ParamProps) {
|
|
|
265
265
|
return (
|
|
266
266
|
<FormSelect
|
|
267
267
|
options={["---", "true", "false"]}
|
|
268
|
-
onChange={(e) => {
|
|
268
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
269
269
|
const val = e.target.value;
|
|
270
270
|
dispatch(
|
|
271
271
|
setParam({
|
|
@@ -286,7 +286,7 @@ function ParamMultiSelectFormItem({ param }: ParamProps) {
|
|
|
286
286
|
return (
|
|
287
287
|
<FormMultiSelect
|
|
288
288
|
options={options as string[]}
|
|
289
|
-
onChange={(e) => {
|
|
289
|
+
onChange={(e: any) => {
|
|
290
290
|
const values = Array.prototype.filter
|
|
291
291
|
.call(e.target.options, (o) => o.selected)
|
|
292
292
|
.map((o) => o.value);
|
|
@@ -308,7 +308,17 @@ function ParamTextFormItem({ param }: ParamProps) {
|
|
|
308
308
|
return (
|
|
309
309
|
<FormTextInput
|
|
310
310
|
placeholder={param.description || param.name}
|
|
311
|
-
onChange={(e
|
|
311
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) =>
|
|
312
|
+
dispatch(
|
|
313
|
+
setParam({
|
|
314
|
+
...param,
|
|
315
|
+
value:
|
|
316
|
+
param.in === "path" || param.in === "query"
|
|
317
|
+
? e.target.value.replace(/\s/g, "%20")
|
|
318
|
+
: e.target.value,
|
|
319
|
+
})
|
|
320
|
+
)
|
|
321
|
+
}
|
|
312
322
|
/>
|
|
313
323
|
);
|
|
314
324
|
}
|
|
@@ -7,26 +7,26 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import { ThemeConfig } from "@docusaurus/types";
|
|
10
11
|
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
11
12
|
import sdk from "@paloaltonetworks/postman-collection";
|
|
13
|
+
import Accept from "@theme/ApiDemoPanel/Accept";
|
|
14
|
+
import Authorization from "@theme/ApiDemoPanel/Authorization";
|
|
15
|
+
import Body from "@theme/ApiDemoPanel/Body";
|
|
16
|
+
import Execute from "@theme/ApiDemoPanel/Execute";
|
|
17
|
+
import ParamOptions from "@theme/ApiDemoPanel/ParamOptions";
|
|
18
|
+
import Server from "@theme/ApiDemoPanel/Server";
|
|
19
|
+
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
12
20
|
import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
13
21
|
import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
14
22
|
|
|
15
|
-
import { ThemeConfig } from "../../../types";
|
|
16
|
-
import { useTypedSelector } from "../../ApiItem/hooks";
|
|
17
|
-
import Accept from "../Accept";
|
|
18
|
-
import Authorization from "../Authorization";
|
|
19
|
-
import Body from "../Body";
|
|
20
|
-
import Execute from "../Execute";
|
|
21
|
-
import ParamOptions from "../ParamOptions";
|
|
22
|
-
import Server from "../Server";
|
|
23
23
|
import styles from "./styles.module.css";
|
|
24
24
|
|
|
25
25
|
function Request({ item }: { item: NonNullable<ApiItem> }) {
|
|
26
|
-
const response = useTypedSelector((state) => state.response.value);
|
|
26
|
+
const response = useTypedSelector((state: any) => state.response.value);
|
|
27
27
|
const { siteConfig } = useDocusaurusContext();
|
|
28
28
|
const themeConfig = siteConfig.themeConfig as ThemeConfig;
|
|
29
|
-
const options = themeConfig.api;
|
|
29
|
+
const options = themeConfig.api as ApiItem;
|
|
30
30
|
const postman = new sdk.Request(item.postman);
|
|
31
31
|
|
|
32
32
|
const params = {
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
10
11
|
import CodeBlock from "@theme/CodeBlock";
|
|
11
12
|
|
|
12
|
-
import { useTypedDispatch, useTypedSelector } from "../../ApiItem/hooks";
|
|
13
13
|
import { clearResponse } from "./slice";
|
|
14
14
|
|
|
15
15
|
// TODO: We probably shouldn't attempt to format XML...
|
|
@@ -33,7 +33,7 @@ function formatXml(xml: string) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
function Response() {
|
|
36
|
-
const response = useTypedSelector((state) => state.response.value);
|
|
36
|
+
const response = useTypedSelector((state: any) => state.response.value);
|
|
37
37
|
const dispatch = useTypedDispatch();
|
|
38
38
|
|
|
39
39
|
if (response === undefined) {
|
|
@@ -8,12 +8,11 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import Link from "@docusaurus/Link";
|
|
11
|
-
|
|
12
|
-
import { useTypedSelector } from "../../ApiItem/hooks";
|
|
11
|
+
import { useTypedSelector } from "@theme/ApiItem/hooks";
|
|
13
12
|
|
|
14
13
|
function SecuritySchemes(props: any) {
|
|
15
|
-
const options = useTypedSelector((state) => state.auth.options);
|
|
16
|
-
const selected = useTypedSelector((state) => state.auth.selected);
|
|
14
|
+
const options = useTypedSelector((state: any) => state.auth.options);
|
|
15
|
+
const selected = useTypedSelector((state: any) => state.auth.selected);
|
|
17
16
|
const infoAuthPath = `/${props.infoPath}#authentication`;
|
|
18
17
|
|
|
19
18
|
if (selected === undefined) return null;
|
|
@@ -24,7 +23,7 @@ function SecuritySchemes(props: any) {
|
|
|
24
23
|
<summary className={`details__request-summary`}>
|
|
25
24
|
<h4>Authorization</h4>
|
|
26
25
|
</summary>
|
|
27
|
-
{selectedAuth.map((auth) => {
|
|
26
|
+
{selectedAuth.map((auth: any) => {
|
|
28
27
|
const isApiKey = auth.type === "apiKey";
|
|
29
28
|
const isBearer = auth.type === "http" && auth.key === "Bearer";
|
|
30
29
|
const isOauth2 = auth.type === "oauth2";
|
|
@@ -7,18 +7,19 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { useState } from "react";
|
|
9
9
|
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
10
|
+
import FloatingButton from "@theme/ApiDemoPanel/FloatingButton";
|
|
11
|
+
import FormItem from "@theme/ApiDemoPanel/FormItem";
|
|
12
|
+
import FormSelect from "@theme/ApiDemoPanel/FormSelect";
|
|
13
|
+
import FormTextInput from "@theme/ApiDemoPanel/FormTextInput";
|
|
14
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
15
|
+
|
|
15
16
|
import { setServer, setServerVariable } from "./slice";
|
|
16
17
|
import styles from "./styles.module.css";
|
|
17
18
|
|
|
18
19
|
function Server() {
|
|
19
20
|
const [isEditing, setIsEditing] = useState(false);
|
|
20
|
-
const value = useTypedSelector((state) => state.server.value);
|
|
21
|
-
const options = useTypedSelector((state) => state.server.options);
|
|
21
|
+
const value = useTypedSelector((state: any) => state.server.value);
|
|
22
|
+
const options = useTypedSelector((state: any) => state.server.options);
|
|
22
23
|
const dispatch = useTypedDispatch();
|
|
23
24
|
|
|
24
25
|
if (options.length <= 0) {
|
|
@@ -36,7 +37,7 @@ function Server() {
|
|
|
36
37
|
|
|
37
38
|
// Default to first option when existing server state is mismatched
|
|
38
39
|
if (value) {
|
|
39
|
-
const urlExists = options.find((s) => s.url === value.url);
|
|
40
|
+
const urlExists = options.find((s: any) => s.url === value.url);
|
|
40
41
|
if (!urlExists) {
|
|
41
42
|
const defaultOption = options[0];
|
|
42
43
|
dispatch(setServer(JSON.stringify(defaultOption)));
|
|
@@ -76,12 +77,12 @@ function Server() {
|
|
|
76
77
|
<FloatingButton onClick={() => setIsEditing(false)} label="Hide">
|
|
77
78
|
<FormItem label="Base URL">
|
|
78
79
|
<FormSelect
|
|
79
|
-
options={options.map((s) => s.url)}
|
|
80
|
-
onChange={(e) => {
|
|
80
|
+
options={options.map((s: any) => s.url)}
|
|
81
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
81
82
|
dispatch(
|
|
82
83
|
setServer(
|
|
83
84
|
JSON.stringify(
|
|
84
|
-
options.filter((s) => s.url === e.target.value)[0]
|
|
85
|
+
options.filter((s: any) => s.url === e.target.value)[0]
|
|
85
86
|
)
|
|
86
87
|
)
|
|
87
88
|
);
|
|
@@ -97,7 +98,7 @@ function Server() {
|
|
|
97
98
|
<FormItem label={key}>
|
|
98
99
|
<FormSelect
|
|
99
100
|
options={value.variables[key].enum}
|
|
100
|
-
onChange={(e) => {
|
|
101
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
101
102
|
dispatch(
|
|
102
103
|
setServerVariable(
|
|
103
104
|
JSON.stringify({ key, value: e.target.value })
|
|
@@ -113,7 +114,7 @@ function Server() {
|
|
|
113
114
|
<FormItem label={key}>
|
|
114
115
|
<FormTextInput
|
|
115
116
|
placeholder={value.variables?.[key].default}
|
|
116
|
-
onChange={(e) => {
|
|
117
|
+
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
|
|
117
118
|
dispatch(
|
|
118
119
|
setServerVariable(
|
|
119
120
|
JSON.stringify({ key, value: e.target.value })
|
|
@@ -6,15 +6,14 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
8
|
import sdk from "@paloaltonetworks/postman-collection";
|
|
9
|
+
import { AuthState, Scheme } from "@theme/ApiDemoPanel/Authorization/slice";
|
|
10
|
+
import { Body, Content } from "@theme/ApiDemoPanel/Body/slice";
|
|
9
11
|
import {
|
|
10
12
|
ParameterObject,
|
|
11
13
|
ServerObject,
|
|
12
14
|
} from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
13
15
|
import cloneDeep from "lodash/cloneDeep";
|
|
14
16
|
|
|
15
|
-
import { AuthState, Scheme } from "./Authorization/slice";
|
|
16
|
-
import { Body, Content } from "./Body/slice";
|
|
17
|
-
|
|
18
17
|
type Param = {
|
|
19
18
|
value?: string | string[];
|
|
20
19
|
} & ParameterObject;
|
|
@@ -8,14 +8,13 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import sdk from "@paloaltonetworks/postman-collection";
|
|
11
|
+
import Curl from "@theme/ApiDemoPanel/Curl";
|
|
12
|
+
import MethodEndpoint from "@theme/ApiDemoPanel/MethodEndpoint";
|
|
13
|
+
import Request from "@theme/ApiDemoPanel/Request";
|
|
14
|
+
import Response from "@theme/ApiDemoPanel/Response";
|
|
15
|
+
import SecuritySchemes from "@theme/ApiDemoPanel/SecuritySchemes";
|
|
11
16
|
import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
12
17
|
|
|
13
|
-
import Curl from "./Curl";
|
|
14
|
-
import MethodEndpoint from "./MethodEndpoint";
|
|
15
|
-
import Request from "./Request";
|
|
16
|
-
import Response from "./Response";
|
|
17
|
-
import SecuritySchemes from "./SecuritySchemes";
|
|
18
|
-
|
|
19
18
|
function ApiDemoPanel({
|
|
20
19
|
item,
|
|
21
20
|
infoPath,
|
|
@@ -6,10 +6,14 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
8
|
import { Middleware } from "@reduxjs/toolkit";
|
|
9
|
+
import {
|
|
10
|
+
setAuthData,
|
|
11
|
+
setSelectedAuth,
|
|
12
|
+
} from "@theme/ApiDemoPanel/Authorization/slice";
|
|
13
|
+
import { AppDispatch, RootState } from "@theme/ApiItem/store";
|
|
14
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
15
|
+
import { ThemeConfig } from "docusaurus-theme-openapi-docs/src/types";
|
|
9
16
|
|
|
10
|
-
import { ThemeConfig } from "../../types";
|
|
11
|
-
import { AppDispatch, RootState } from "../ApiItem/store";
|
|
12
|
-
import { setAuthData, setSelectedAuth } from "./Authorization/slice";
|
|
13
17
|
import { createStorage, hashArray } from "./storage-utils";
|
|
14
18
|
|
|
15
19
|
export function createPersistanceMiddleware(options: ThemeConfig["api"]) {
|
|
@@ -23,7 +27,7 @@ export function createPersistanceMiddleware(options: ThemeConfig["api"]) {
|
|
|
23
27
|
|
|
24
28
|
if (action.type === setAuthData.type) {
|
|
25
29
|
for (const [key, value] of Object.entries(state.auth.data)) {
|
|
26
|
-
if (Object.values(value).filter(Boolean).length > 0) {
|
|
30
|
+
if (Object.values(value as any).filter(Boolean).length > 0) {
|
|
27
31
|
storage.setItem(key, JSON.stringify(value));
|
|
28
32
|
} else {
|
|
29
33
|
storage.removeItem(key);
|
|
@@ -12,19 +12,22 @@ import ExecutionEnvironment from "@docusaurus/ExecutionEnvironment";
|
|
|
12
12
|
import { HtmlClassNameProvider } from "@docusaurus/theme-common";
|
|
13
13
|
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
|
|
14
14
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
15
|
+
import { createAuth } from "@theme/ApiDemoPanel/Authorization/slice";
|
|
16
|
+
import { createPersistanceMiddleware } from "@theme/ApiDemoPanel/persistanceMiddleware";
|
|
17
|
+
import DocItemLayout from "@theme/ApiItem/Layout";
|
|
15
18
|
import type { Props } from "@theme/DocItem";
|
|
16
19
|
import DocItemMetadata from "@theme/DocItem/Metadata";
|
|
17
20
|
import clsx from "clsx";
|
|
18
21
|
import { ServerObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
19
22
|
import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
20
23
|
import type { ApiItem as ApiItemType } from "docusaurus-plugin-openapi-docs/src/types";
|
|
24
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
25
|
+
import type {
|
|
26
|
+
DocFrontMatter,
|
|
27
|
+
ThemeConfig,
|
|
28
|
+
} from "docusaurus-theme-openapi-docs/src/types";
|
|
21
29
|
import { Provider } from "react-redux";
|
|
22
30
|
|
|
23
|
-
import { DocFrontMatter } from "../../types";
|
|
24
|
-
import { ThemeConfig } from "../../types";
|
|
25
|
-
import { createAuth } from "../ApiDemoPanel/Authorization/slice";
|
|
26
|
-
import { createPersistanceMiddleware } from "../ApiDemoPanel/persistanceMiddleware";
|
|
27
|
-
import DocItemLayout from "./Layout";
|
|
28
31
|
import { createStoreWithoutState, createStoreWithState } from "./store";
|
|
29
32
|
|
|
30
33
|
const { DocProvider } = require("@docusaurus/theme-common/internal");
|
|
@@ -6,14 +6,13 @@
|
|
|
6
6
|
* ========================================================================== */
|
|
7
7
|
|
|
8
8
|
import { configureStore, combineReducers } from "@reduxjs/toolkit";
|
|
9
|
-
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import server from "../ApiDemoPanel/Server/slice";
|
|
9
|
+
import accept from "@theme/ApiDemoPanel/Accept/slice";
|
|
10
|
+
import auth from "@theme/ApiDemoPanel/Authorization/slice";
|
|
11
|
+
import body from "@theme/ApiDemoPanel/Body/slice";
|
|
12
|
+
import contentType from "@theme/ApiDemoPanel/ContentType/slice";
|
|
13
|
+
import params from "@theme/ApiDemoPanel/ParamOptions/slice";
|
|
14
|
+
import response from "@theme/ApiDemoPanel/Response/slice";
|
|
15
|
+
import server from "@theme/ApiDemoPanel/Server/slice";
|
|
17
16
|
|
|
18
17
|
const rootReducer = combineReducers({
|
|
19
18
|
accept,
|
|
@@ -12,14 +12,19 @@
|
|
|
12
12
|
height: 1.8rem;
|
|
13
13
|
margin-top: 0 !important;
|
|
14
14
|
margin-right: 0.5rem;
|
|
15
|
-
border: 1px solid var(--
|
|
15
|
+
border: 1px solid var(--ifm-color-primary);
|
|
16
16
|
border-radius: var(--ifm-global-radius);
|
|
17
|
-
color: var(--
|
|
17
|
+
color: var(--ifm-color-primary);
|
|
18
18
|
font-size: 12px;
|
|
19
19
|
}
|
|
20
20
|
|
|
21
|
+
.tabItem:not(.discriminatorTabActive) {
|
|
22
|
+
opacity: 0.65;
|
|
23
|
+
}
|
|
24
|
+
|
|
21
25
|
.tabItem:hover {
|
|
22
|
-
|
|
26
|
+
opacity: 1;
|
|
27
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
23
28
|
}
|
|
24
29
|
|
|
25
30
|
.tabItem:last-child {
|
|
@@ -59,8 +64,7 @@
|
|
|
59
64
|
}
|
|
60
65
|
|
|
61
66
|
.tabItem.discriminatorTabActive {
|
|
62
|
-
|
|
63
|
-
color: var(--ifm-color-primary);
|
|
67
|
+
background-color: var(--ifm-color-emphasis-100);
|
|
64
68
|
}
|
|
65
69
|
|
|
66
70
|
.discriminatorTabLabel {
|
|
@@ -16,20 +16,18 @@ import React, {
|
|
|
16
16
|
|
|
17
17
|
import { duplicates } from "@docusaurus/theme-common";
|
|
18
18
|
import useIsBrowser from "@docusaurus/useIsBrowser";
|
|
19
|
+
import { setAccept } from "@theme/ApiDemoPanel/Accept/slice";
|
|
20
|
+
import { setContentType } from "@theme/ApiDemoPanel/ContentType/slice";
|
|
21
|
+
import { useTypedDispatch, useTypedSelector } from "@theme/ApiItem/hooks";
|
|
19
22
|
import clsx from "clsx";
|
|
20
23
|
|
|
21
|
-
import
|
|
22
|
-
import { setContentType } from "../ApiDemoPanel/ContentType/slice";
|
|
23
|
-
import { useTypedDispatch, useTypedSelector } from "../ApiItem/hooks";
|
|
24
|
-
import styles from "./styles.module.css"; // A very rough duck type, but good enough to guard against mistakes while
|
|
24
|
+
import styles from "./styles.module.css";
|
|
25
25
|
|
|
26
26
|
const {
|
|
27
27
|
useScrollPositionBlocker,
|
|
28
28
|
useTabGroupChoice,
|
|
29
29
|
} = require("@docusaurus/theme-common/internal");
|
|
30
30
|
|
|
31
|
-
// allowing customization
|
|
32
|
-
|
|
33
31
|
function isTabItem(comp) {
|
|
34
32
|
return typeof comp.props.value !== "undefined";
|
|
35
33
|
}
|
|
@@ -8,12 +8,18 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import CodeBlock from "@theme/CodeBlock";
|
|
11
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
12
|
+
import { createDescription } from "docusaurus-theme-openapi-docs/src/markdown/createDescription";
|
|
13
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
14
|
+
import {
|
|
15
|
+
getQualifierMessage,
|
|
16
|
+
getSchemaName,
|
|
17
|
+
} from "docusaurus-theme-openapi-docs/src/markdown/schema";
|
|
18
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
19
|
+
import { guard } from "docusaurus-theme-openapi-docs/src/markdown/utils";
|
|
11
20
|
import ReactMarkdown from "react-markdown";
|
|
12
21
|
import rehypeRaw from "rehype-raw";
|
|
13
22
|
|
|
14
|
-
import { createDescription } from "../../markdown/createDescription";
|
|
15
|
-
import { getQualifierMessage, getSchemaName } from "../../markdown/schema";
|
|
16
|
-
import { guard } from "../../markdown/utils";
|
|
17
23
|
import styles from "./styles.module.css";
|
|
18
24
|
|
|
19
25
|
function ParamsItem({
|
|
@@ -8,11 +8,13 @@
|
|
|
8
8
|
import React from "react";
|
|
9
9
|
|
|
10
10
|
import CodeBlock from "@theme/CodeBlock";
|
|
11
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
12
|
+
import { createDescription } from "docusaurus-theme-openapi-docs/src/markdown/createDescription";
|
|
13
|
+
/* eslint-disable import/no-extraneous-dependencies*/
|
|
14
|
+
import { guard } from "docusaurus-theme-openapi-docs/src/markdown/utils";
|
|
11
15
|
import ReactMarkdown from "react-markdown";
|
|
12
16
|
import rehypeRaw from "rehype-raw";
|
|
13
17
|
|
|
14
|
-
import { createDescription } from "../../markdown/createDescription";
|
|
15
|
-
import { guard } from "../../markdown/utils";
|
|
16
18
|
import styles from "./styles.module.css";
|
|
17
19
|
|
|
18
20
|
function SchemaItem({
|
package/src/theme/styles.css
CHANGED
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
--openapi-card-background-color: var(--ifm-color-gray-100);
|
|
15
15
|
--openapi-card-border-radius: var(--ifm-pre-border-radius);
|
|
16
16
|
--openapi-input-border: var(--ifm-color-primary);
|
|
17
|
+
--openapi-input-background: var(--openapi-card-background-color);
|
|
17
18
|
}
|
|
18
19
|
|
|
19
20
|
[data-theme="dark"] {
|