docusaurus-theme-openapi-docs 3.0.0-beta.1 → 3.0.0-beta.10
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/markdown/utils.d.ts +3 -2
- package/lib/markdown/utils.js +1 -1
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +13 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +199 -124
- package/lib/theme/ApiExplorer/Accept/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +115 -96
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +200 -120
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Body/index.js +8 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +3 -3
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +4 -14
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +86 -8
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +3 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +48 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +131 -76
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Export/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/lib/theme/ApiExplorer/Request/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Request/makeRequest.js +50 -1
- package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/lib/theme/ApiExplorer/Response/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Response/index.js +19 -19
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/index.js +1 -1
- package/lib/theme/ApiExplorer/storage-utils.d.ts +1 -1
- package/lib/theme/ApiItem/index.js +28 -3
- package/lib/theme/ApiItem/store.d.ts +6 -6
- package/lib/theme/ApiLogo/index.d.ts +2 -2
- package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +167 -103
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +152 -98
- package/lib/theme/Markdown/index.js +37 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +169 -118
- package/lib/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +234 -0
- package/lib/theme/ParamsItem/index.d.ts +23 -0
- package/lib/theme/ParamsItem/index.js +170 -111
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +18 -13
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +121 -89
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +148 -95
- package/lib/theme/styles.scss +5 -0
- package/lib/types.d.ts +4 -4
- package/package.json +8 -7
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +5 -3
- package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +21 -8
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +12 -2
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
- package/src/theme/ApiExplorer/Body/index.tsx +3 -1
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +55 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +94 -21
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +53 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +64 -25
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/src/theme/ApiExplorer/Request/makeRequest.ts +59 -4
- package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/src/theme/ApiExplorer/Response/index.tsx +2 -2
- package/src/theme/ApiExplorer/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +22 -3
- package/src/theme/ApiLogo/index.tsx +1 -1
- package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/src/theme/ApiTabs/{index.js → index.tsx} +75 -31
- package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +63 -28
- package/src/theme/Markdown/index.js +37 -0
- package/src/theme/MimeTabs/{index.js → index.tsx} +64 -30
- package/src/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/src/theme/OperationTabs/index.tsx +218 -0
- package/src/theme/ParamsItem/{index.js → index.tsx} +48 -17
- package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
- package/src/theme/SchemaItem/{index.js → index.tsx} +24 -18
- package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/src/theme/SchemaTabs/{index.js → index.tsx} +62 -29
- package/src/theme/styles.scss +5 -0
- package/src/theme-classic.d.ts +69 -2
- package/src/theme-openapi.d.ts +6 -0
- package/tsconfig.json +4 -1
|
@@ -1,24 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
var __createBinding =
|
|
9
|
+
(this && this.__createBinding) ||
|
|
10
|
+
(Object.create
|
|
11
|
+
? function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (
|
|
15
|
+
!desc ||
|
|
16
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
17
|
+
) {
|
|
18
|
+
desc = {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return m[k];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(o, k2, desc);
|
|
26
|
+
}
|
|
27
|
+
: function (o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
});
|
|
31
|
+
var __setModuleDefault =
|
|
32
|
+
(this && this.__setModuleDefault) ||
|
|
33
|
+
(Object.create
|
|
34
|
+
? function (o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}
|
|
37
|
+
: function (o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar =
|
|
41
|
+
(this && this.__importStar) ||
|
|
42
|
+
function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null)
|
|
46
|
+
for (var k in mod)
|
|
47
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
48
|
+
__createBinding(result, mod, k);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
var __importDefault =
|
|
53
|
+
(this && this.__importDefault) ||
|
|
54
|
+
function (mod) {
|
|
55
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
60
|
+
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
61
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
18
62
|
function TabList({
|
|
19
63
|
action,
|
|
20
64
|
currentLanguage,
|
|
65
|
+
languageSet,
|
|
21
66
|
includeVariant,
|
|
67
|
+
includeSample,
|
|
22
68
|
className,
|
|
23
69
|
block,
|
|
24
70
|
selectedValue,
|
|
@@ -26,19 +72,16 @@ function TabList({
|
|
|
26
72
|
tabValues,
|
|
27
73
|
}) {
|
|
28
74
|
const tabRefs = [];
|
|
29
|
-
const { blockElementScrollPositionUntilNextRender } =
|
|
30
|
-
|
|
31
|
-
|
|
75
|
+
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
76
|
+
internal_1.useScrollPositionBlocker)();
|
|
32
77
|
const handleTabChange = (event) => {
|
|
33
78
|
const newTab = event.currentTarget;
|
|
34
79
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
35
80
|
const newTabValue = tabValues[newTabIndex].value;
|
|
36
|
-
|
|
37
81
|
if (newTabValue !== selectedValue) {
|
|
38
82
|
blockElementScrollPositionUntilNextRender(newTab);
|
|
39
83
|
selectValue(newTabValue);
|
|
40
84
|
}
|
|
41
|
-
|
|
42
85
|
if (action) {
|
|
43
86
|
let newLanguage;
|
|
44
87
|
if (currentLanguage && includeVariant) {
|
|
@@ -47,16 +90,22 @@ function TabList({
|
|
|
47
90
|
)[0];
|
|
48
91
|
newLanguage.variant = newTabValue;
|
|
49
92
|
action.setSelectedVariant(newTabValue.toLowerCase());
|
|
93
|
+
} else if (currentLanguage && includeSample) {
|
|
94
|
+
newLanguage = languageSet.filter(
|
|
95
|
+
(lang) => lang.language === currentLanguage
|
|
96
|
+
)[0];
|
|
97
|
+
newLanguage.sample = newTabValue;
|
|
98
|
+
action.setSelectedSample(newTabValue);
|
|
50
99
|
} else {
|
|
51
100
|
newLanguage = languageSet.filter(
|
|
52
101
|
(lang) => lang.language === newTabValue
|
|
53
102
|
)[0];
|
|
54
103
|
action.setSelectedVariant(newLanguage.variant.toLowerCase());
|
|
104
|
+
action.setSelectedSample(newLanguage.sample);
|
|
55
105
|
}
|
|
56
106
|
action.setLanguage(newLanguage);
|
|
57
107
|
}
|
|
58
108
|
};
|
|
59
|
-
|
|
60
109
|
const handleKeydown = (event) => {
|
|
61
110
|
let focusElement = null;
|
|
62
111
|
switch (event.key) {
|
|
@@ -79,96 +128,102 @@ function TabList({
|
|
|
79
128
|
}
|
|
80
129
|
focusElement?.focus();
|
|
81
130
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
role
|
|
86
|
-
aria-orientation
|
|
87
|
-
className
|
|
131
|
+
return react_1.default.createElement(
|
|
132
|
+
"ul",
|
|
133
|
+
{
|
|
134
|
+
role: "tablist",
|
|
135
|
+
"aria-orientation": "horizontal",
|
|
136
|
+
className: (0, clsx_1.default)(
|
|
88
137
|
"tabs",
|
|
89
138
|
"openapi-tabs__code-list-container",
|
|
90
139
|
{
|
|
91
140
|
"tabs--block": block,
|
|
92
141
|
},
|
|
93
142
|
className
|
|
94
|
-
)
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
143
|
+
),
|
|
144
|
+
},
|
|
145
|
+
tabValues.map(({ value, label, attributes }) =>
|
|
146
|
+
react_1.default.createElement(
|
|
147
|
+
"li",
|
|
148
|
+
{
|
|
98
149
|
// TODO extract TabListItem
|
|
99
|
-
role
|
|
100
|
-
tabIndex
|
|
101
|
-
aria-selected
|
|
102
|
-
key
|
|
103
|
-
ref
|
|
104
|
-
onKeyDown
|
|
105
|
-
onClick
|
|
106
|
-
|
|
107
|
-
className
|
|
150
|
+
role: "tab",
|
|
151
|
+
tabIndex: selectedValue === value ? 0 : -1,
|
|
152
|
+
"aria-selected": selectedValue === value,
|
|
153
|
+
key: value,
|
|
154
|
+
ref: (tabControl) => tabRefs.push(tabControl),
|
|
155
|
+
onKeyDown: handleKeydown,
|
|
156
|
+
onClick: handleTabChange,
|
|
157
|
+
...attributes,
|
|
158
|
+
className: (0, clsx_1.default)(
|
|
108
159
|
"tabs__item",
|
|
109
160
|
"openapi-tabs__code-item",
|
|
110
161
|
attributes?.className,
|
|
111
162
|
{
|
|
112
163
|
active: selectedValue === value,
|
|
113
164
|
}
|
|
114
|
-
)
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
</ul>
|
|
165
|
+
),
|
|
166
|
+
},
|
|
167
|
+
react_1.default.createElement("span", null, label ?? value)
|
|
168
|
+
)
|
|
169
|
+
)
|
|
120
170
|
);
|
|
121
171
|
}
|
|
122
|
-
|
|
123
172
|
function TabContent({ lazy, children, selectedValue }) {
|
|
124
|
-
|
|
125
|
-
|
|
173
|
+
const childTabs = (Array.isArray(children) ? children : [children]).filter(
|
|
174
|
+
Boolean
|
|
175
|
+
);
|
|
126
176
|
if (lazy) {
|
|
127
|
-
const selectedTabItem =
|
|
177
|
+
const selectedTabItem = childTabs.find(
|
|
128
178
|
(tabItem) => tabItem.props.value === selectedValue
|
|
129
179
|
);
|
|
130
180
|
if (!selectedTabItem) {
|
|
131
181
|
// fail-safe or fail-fast? not sure what's best here
|
|
132
182
|
return null;
|
|
133
183
|
}
|
|
134
|
-
return cloneElement(selectedTabItem, {
|
|
184
|
+
return (0, react_1.cloneElement)(selectedTabItem, {
|
|
185
|
+
className: "margin-top--md",
|
|
186
|
+
});
|
|
135
187
|
}
|
|
136
|
-
return (
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
)
|
|
144
|
-
|
|
188
|
+
return react_1.default.createElement(
|
|
189
|
+
"div",
|
|
190
|
+
{ className: "margin-top--md openapi-tabs__code-content" },
|
|
191
|
+
childTabs.map((tabItem, i) =>
|
|
192
|
+
(0, react_1.cloneElement)(tabItem, {
|
|
193
|
+
key: i,
|
|
194
|
+
hidden: tabItem.props.value !== selectedValue,
|
|
195
|
+
})
|
|
196
|
+
)
|
|
145
197
|
);
|
|
146
198
|
}
|
|
147
|
-
|
|
148
199
|
function TabsComponent(props) {
|
|
149
|
-
const tabs = useTabs(props);
|
|
200
|
+
const tabs = (0, internal_1.useTabs)(props);
|
|
150
201
|
const { className } = props;
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
className
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
202
|
+
return react_1.default.createElement(
|
|
203
|
+
"div",
|
|
204
|
+
{
|
|
205
|
+
className: (0, clsx_1.default)(
|
|
206
|
+
"tabs-container openapi-tabs__code-container",
|
|
207
|
+
className
|
|
208
|
+
),
|
|
209
|
+
},
|
|
210
|
+
react_1.default.createElement(TabList, { ...props, ...tabs }),
|
|
211
|
+
react_1.default.createElement(TabContent, { ...props, ...tabs })
|
|
161
212
|
);
|
|
162
213
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
214
|
+
function CodeTabs(props) {
|
|
215
|
+
const isBrowser = (0, useIsBrowser_1.default)();
|
|
216
|
+
return react_1.default.createElement(
|
|
217
|
+
TabsComponent,
|
|
218
|
+
// Remount tabs after hydration
|
|
219
|
+
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
220
|
+
{
|
|
168
221
|
// Remount tabs after hydration
|
|
169
222
|
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
170
|
-
key
|
|
171
|
-
|
|
172
|
-
|
|
223
|
+
key: String(isBrowser),
|
|
224
|
+
...props,
|
|
225
|
+
},
|
|
226
|
+
(0, internal_1.sanitizeTabsChildren)(props.children)
|
|
173
227
|
);
|
|
174
228
|
}
|
|
229
|
+
exports.default = CodeTabs;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function ContentType(): JSX.Element | null;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare function ContentType(): React.JSX.Element | null;
|
|
3
3
|
export default ContentType;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function Export({ url, proxy }: any): JSX.Element;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare function Export({ url, proxy }: any): React.JSX.Element;
|
|
3
3
|
export default Export;
|
|
@@ -11,7 +11,9 @@
|
|
|
11
11
|
padding: 0.4rem 0.5rem;
|
|
12
12
|
opacity: 0;
|
|
13
13
|
visibility: hidden;
|
|
14
|
-
transition:
|
|
14
|
+
transition:
|
|
15
|
+
opacity 0.2s ease-in-out,
|
|
16
|
+
visibility 0.2s ease-in-out,
|
|
15
17
|
bottom 0.2s ease-in-out;
|
|
16
18
|
position: absolute;
|
|
17
19
|
right: calc(var(--ifm-pre-padding) / 2);
|
|
@@ -4,5 +4,5 @@ export interface Props {
|
|
|
4
4
|
onClick?: React.MouseEventHandler<HTMLButtonElement>;
|
|
5
5
|
children?: React.ReactNode;
|
|
6
6
|
}
|
|
7
|
-
declare function FloatingButton({ label, onClick, children }: Props): JSX.Element;
|
|
7
|
+
declare function FloatingButton({ label, onClick, children }: Props): React.JSX.Element;
|
|
8
8
|
export default FloatingButton;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface Props {
|
|
3
3
|
placeholder: string;
|
|
4
4
|
onChange?(file?: File): any;
|
|
5
5
|
}
|
|
6
|
-
declare function FormFileUpload({ placeholder, onChange }: Props): JSX.Element;
|
|
6
|
+
declare function FormFileUpload({ placeholder, onChange }: Props): React.JSX.Element;
|
|
7
7
|
export default FormFileUpload;
|
|
@@ -6,5 +6,5 @@ export interface Props {
|
|
|
6
6
|
children?: React.ReactNode;
|
|
7
7
|
className?: string;
|
|
8
8
|
}
|
|
9
|
-
declare function FormItem({ label, type, required, children, className }: Props): JSX.Element;
|
|
9
|
+
declare function FormItem({ label, type, required, children, className }: Props): React.JSX.Element;
|
|
10
10
|
export default FormItem;
|
|
@@ -5,5 +5,5 @@ export interface Props {
|
|
|
5
5
|
onChange?: React.ChangeEventHandler<HTMLSelectElement>;
|
|
6
6
|
showErrors?: boolean;
|
|
7
7
|
}
|
|
8
|
-
declare function FormMultiSelect({ value, options, onChange, showErrors }: Props): JSX.Element | null;
|
|
8
|
+
declare function FormMultiSelect({ value, options, onChange, showErrors }: Props): React.JSX.Element | null;
|
|
9
9
|
export default FormMultiSelect;
|
|
@@ -4,5 +4,5 @@ export interface Props {
|
|
|
4
4
|
options?: string[];
|
|
5
5
|
onChange?: React.ChangeEventHandler<HTMLSelectElement>;
|
|
6
6
|
}
|
|
7
|
-
declare function FormSelect({ value, options, onChange }: Props): JSX.Element | null;
|
|
7
|
+
declare function FormSelect({ value, options, onChange }: Props): React.JSX.Element | null;
|
|
8
8
|
export default FormSelect;
|
|
@@ -5,5 +5,5 @@ export interface Props {
|
|
|
5
5
|
password?: boolean;
|
|
6
6
|
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
7
7
|
}
|
|
8
|
-
declare function FormTextInput({ isRequired, value, placeholder, password, onChange, paramName, }: Props): JSX.Element;
|
|
8
|
+
declare function FormTextInput({ isRequired, value, placeholder, password, onChange, paramName, }: Props): React.JSX.Element;
|
|
9
9
|
export default FormTextInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
export interface Props {
|
|
3
3
|
method: string;
|
|
4
4
|
path: string;
|
|
5
5
|
}
|
|
6
|
-
declare function MethodEndpoint({ method, path }: Props): JSX.Element;
|
|
6
|
+
declare function MethodEndpoint({ method, path }: Props): React.JSX.Element;
|
|
7
7
|
export default MethodEndpoint;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
export default function ParamArrayFormItem({ param }: ParamProps): JSX.Element;
|
|
6
|
+
export default function ParamArrayFormItem({ param }: ParamProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
export default function ParamBooleanFormItem({ param }: ParamProps): JSX.Element;
|
|
6
|
+
export default function ParamBooleanFormItem({ param }: ParamProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
export default function ParamMultiSelectFormItem({ param }: ParamProps): JSX.Element;
|
|
6
|
+
export default function ParamMultiSelectFormItem({ param }: ParamProps): React.JSX.Element;
|
|
@@ -42,10 +42,10 @@ function ParamMultiSelectFormItem({ param }) {
|
|
|
42
42
|
const paramTypeToWatch = pathParams.length
|
|
43
43
|
? pathParams
|
|
44
44
|
: queryParams.length
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
? queryParams
|
|
46
|
+
: cookieParams.length
|
|
47
|
+
? cookieParams
|
|
48
|
+
: headerParams;
|
|
49
49
|
const handleChange = (e, onChange) => {
|
|
50
50
|
const values = Array.prototype.filter
|
|
51
51
|
.call(e.target.options, (o) => o.selected)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
export default function ParamSelectFormItem({ param }: ParamProps): JSX.Element;
|
|
6
|
+
export default function ParamSelectFormItem({ param }: ParamProps): React.JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "@theme/ApiExplorer/ParamOptions/slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
export default function ParamTextFormItem({ param }: ParamProps): JSX.Element;
|
|
6
|
+
export default function ParamTextFormItem({ param }: ParamProps): React.JSX.Element;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { Param } from "./slice";
|
|
3
3
|
export interface ParamProps {
|
|
4
4
|
param: Param;
|
|
5
5
|
}
|
|
6
|
-
declare function ParamOptions(): JSX.Element;
|
|
6
|
+
declare function ParamOptions(): React.JSX.Element;
|
|
7
7
|
export default ParamOptions;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PayloadAction } from "@reduxjs/toolkit";
|
|
2
2
|
import { ParameterObject } from "docusaurus-plugin-openapi-docs/src/openapi/types";
|
|
3
|
-
export
|
|
3
|
+
export type Param = ParameterObject & {
|
|
4
4
|
value?: string[] | string;
|
|
5
5
|
};
|
|
6
6
|
export interface State {
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
background-color: var(--ifm-pre-background);
|
|
3
3
|
border-radius: var(--openapi-card-border-radius);
|
|
4
4
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
5
|
-
box-shadow:
|
|
5
|
+
box-shadow:
|
|
6
|
+
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
6
7
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
7
8
|
color: var(--ifm-pre-color);
|
|
8
9
|
line-height: var(--ifm-pre-line-height);
|
|
@@ -19,7 +20,8 @@
|
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
&:hover {
|
|
22
|
-
box-shadow:
|
|
23
|
+
box-shadow:
|
|
24
|
+
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
23
25
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
24
26
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
25
27
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
3
3
|
declare function Request({ item }: {
|
|
4
4
|
item: NonNullable<ApiItem>;
|
|
5
|
-
}): JSX.Element | null;
|
|
5
|
+
}): React.JSX.Element | null;
|
|
6
6
|
export default Request;
|
|
@@ -141,6 +141,10 @@ async function makeRequest(request, proxy, _body) {
|
|
|
141
141
|
if (data.key && data.value.content) {
|
|
142
142
|
myBody.append(data.key, data.value.content);
|
|
143
143
|
}
|
|
144
|
+
// handle generic key-value payload
|
|
145
|
+
if (data.key && typeof data.value === "string") {
|
|
146
|
+
myBody.append(data.key, data.value);
|
|
147
|
+
}
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
break;
|
|
@@ -166,7 +170,52 @@ async function makeRequest(request, proxy, _body) {
|
|
|
166
170
|
let normalizedProxy = proxy.replace(/\/$/, "") + "/";
|
|
167
171
|
finalUrl = normalizedProxy + request.url.toString();
|
|
168
172
|
}
|
|
169
|
-
return
|
|
173
|
+
return fetchWithtimeout(finalUrl, requestOptions).then((response) => {
|
|
174
|
+
const contentType = response.headers.get("content-type");
|
|
175
|
+
let fileExtension = "";
|
|
176
|
+
if (contentType) {
|
|
177
|
+
if (contentType.includes("application/pdf")) {
|
|
178
|
+
fileExtension = ".pdf";
|
|
179
|
+
} else if (contentType.includes("image/jpeg")) {
|
|
180
|
+
fileExtension = ".jpg";
|
|
181
|
+
} else if (contentType.includes("image/png")) {
|
|
182
|
+
fileExtension = ".png";
|
|
183
|
+
} else if (contentType.includes("image/gif")) {
|
|
184
|
+
fileExtension = ".gif";
|
|
185
|
+
} else if (contentType.includes("image/webp")) {
|
|
186
|
+
fileExtension = ".webp";
|
|
187
|
+
} else if (contentType.includes("video/mpeg")) {
|
|
188
|
+
fileExtension = ".mpeg";
|
|
189
|
+
} else if (contentType.includes("video/mp4")) {
|
|
190
|
+
fileExtension = ".mp4";
|
|
191
|
+
} else if (contentType.includes("audio/mpeg")) {
|
|
192
|
+
fileExtension = ".mp3";
|
|
193
|
+
} else if (contentType.includes("audio/ogg")) {
|
|
194
|
+
fileExtension = ".ogg";
|
|
195
|
+
} else if (contentType.includes("application/octet-stream")) {
|
|
196
|
+
fileExtension = ".bin";
|
|
197
|
+
} else if (contentType.includes("application/zip")) {
|
|
198
|
+
fileExtension = ".zip";
|
|
199
|
+
}
|
|
200
|
+
if (fileExtension) {
|
|
201
|
+
return response.blob().then((blob) => {
|
|
202
|
+
const url = window.URL.createObjectURL(blob);
|
|
203
|
+
const link = document.createElement("a");
|
|
204
|
+
link.href = url;
|
|
205
|
+
// Now the file name includes the extension
|
|
206
|
+
link.setAttribute("download", `file${fileExtension}`);
|
|
207
|
+
// These two lines are necessary to make the link click in Firefox
|
|
208
|
+
link.style.display = "none";
|
|
209
|
+
document.body.appendChild(link);
|
|
210
|
+
link.click();
|
|
211
|
+
// After link is clicked, it's safe to remove it.
|
|
212
|
+
setTimeout(() => document.body.removeChild(link), 0);
|
|
213
|
+
return response;
|
|
214
|
+
});
|
|
215
|
+
} else {
|
|
216
|
+
return response;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
170
219
|
return response;
|
|
171
220
|
});
|
|
172
221
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
background-color: var(--ifm-pre-background);
|
|
3
3
|
border-radius: var(--openapi-card-border-radius);
|
|
4
4
|
border: 1px solid var(--openapi-explorer-border-color);
|
|
5
|
-
box-shadow:
|
|
5
|
+
box-shadow:
|
|
6
|
+
0 2px 3px hsla(222, 8%, 43%, 0.1),
|
|
6
7
|
0 8px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
7
8
|
color: var(--ifm-pre-color);
|
|
8
9
|
line-height: var(--ifm-pre-line-height);
|
|
@@ -12,7 +13,8 @@
|
|
|
12
13
|
transition: 300ms;
|
|
13
14
|
|
|
14
15
|
&:hover {
|
|
15
|
-
box-shadow:
|
|
16
|
+
box-shadow:
|
|
17
|
+
0 0 0 2px rgba(38, 53, 61, 0.15),
|
|
16
18
|
0 2px 3px hsla(222, 8%, 43%, 0.15),
|
|
17
19
|
0 16px 16px -10px hsla(222, 8%, 43%, 0.2);
|
|
18
20
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import React from "react";
|
|
2
2
|
import { ApiItem } from "docusaurus-plugin-openapi-docs/src/types";
|
|
3
3
|
declare function Response({ item }: {
|
|
4
4
|
item: NonNullable<ApiItem>;
|
|
5
|
-
}): JSX.Element | null;
|
|
5
|
+
}): React.JSX.Element | null;
|
|
6
6
|
export default Response;
|
|
@@ -58,8 +58,8 @@ function Response({ item }) {
|
|
|
58
58
|
(parseInt(code) >= 400
|
|
59
59
|
? "openapi-response__dot--danger"
|
|
60
60
|
: parseInt(code) >= 200 && parseInt(code) < 300
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
? "openapi-response__dot--success"
|
|
62
|
+
: "openapi-response__dot--info");
|
|
63
63
|
if (!item.servers || hideSendButton) {
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
@@ -165,25 +165,25 @@ function Response({ item }) {
|
|
|
165
165
|
)
|
|
166
166
|
)
|
|
167
167
|
: prettyResponse === "Fetching..."
|
|
168
|
-
|
|
169
|
-
"div",
|
|
170
|
-
{ className: "openapi-explorer__loading-container" },
|
|
171
|
-
react_1.default.createElement(
|
|
168
|
+
? react_1.default.createElement(
|
|
172
169
|
"div",
|
|
173
|
-
{ className: "openapi-
|
|
174
|
-
react_1.default.createElement(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
170
|
+
{ className: "openapi-explorer__loading-container" },
|
|
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
|
+
)
|
|
179
|
+
)
|
|
180
|
+
: react_1.default.createElement(
|
|
181
|
+
"p",
|
|
182
|
+
{ className: "openapi-explorer__response-placeholder-message" },
|
|
183
|
+
"Click the ",
|
|
184
|
+
react_1.default.createElement("code", null, "Send API Request"),
|
|
185
|
+
" button above and see the response here!"
|
|
178
186
|
)
|
|
179
|
-
)
|
|
180
|
-
: react_1.default.createElement(
|
|
181
|
-
"p",
|
|
182
|
-
{ className: "openapi-explorer__response-placeholder-message" },
|
|
183
|
-
"Click the ",
|
|
184
|
-
react_1.default.createElement("code", null, "Send API Request"),
|
|
185
|
-
" button above and see the response here!"
|
|
186
|
-
)
|
|
187
187
|
)
|
|
188
188
|
);
|
|
189
189
|
}
|