docusaurus-theme-openapi-docs 4.0.1 → 4.2.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/markdown/utils.d.ts +5 -4
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +1 -1
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +4 -113
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +1 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +30 -6
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +196 -2
- package/lib/theme/ApiExplorer/CodeTabs/index.js +34 -8
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.js +5 -2
- package/lib/theme/ApiExplorer/ParamOptions/index.js +1 -0
- package/lib/theme/ApiExplorer/Request/_Request.scss +5 -0
- package/lib/theme/ApiExplorer/index.js +6 -0
- package/lib/theme/ApiItem/Layout/index.d.ts +3 -0
- package/lib/theme/ApiItem/Layout/index.js +121 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
- package/lib/theme/ApiItem/index.js +16 -5
- package/lib/theme/ApiTabs/_ApiTabs.scss +0 -1
- package/lib/theme/ArrayBrackets/index.d.ts +3 -0
- package/lib/theme/ArrayBrackets/index.js +50 -0
- package/lib/theme/ParamsDetails/index.d.ts +6 -0
- package/lib/theme/ParamsDetails/index.js +134 -0
- package/lib/theme/ParamsItem/index.d.ts +3 -1
- package/lib/theme/ParamsItem/index.js +77 -16
- package/lib/theme/RequestSchema/index.d.ts +15 -0
- package/lib/theme/RequestSchema/index.js +235 -0
- package/lib/theme/ResponseExamples/index.d.ts +48 -0
- package/lib/theme/ResponseExamples/index.js +290 -0
- package/lib/theme/ResponseSchema/index.d.ts +15 -0
- package/lib/theme/ResponseSchema/index.js +206 -0
- package/lib/theme/Schema/index.d.ts +8 -0
- package/lib/theme/Schema/index.js +879 -0
- package/lib/theme/SchemaItem/index.d.ts +9 -9
- package/lib/theme/SchemaItem/index.js +110 -20
- package/lib/theme/SkeletonLoader/index.d.ts +6 -0
- package/lib/theme/SkeletonLoader/index.js +20 -0
- package/lib/theme/StatusCodes/index.d.ts +9 -0
- package/lib/theme/StatusCodes/index.js +78 -0
- package/lib/theme/styles.scss +56 -9
- package/package.json +9 -7
- package/src/markdown/utils.ts +7 -6
- package/src/plugin-content-docs.d.ts +2 -0
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +2 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +8 -113
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +26 -5
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +196 -2
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +40 -9
- package/src/theme/ApiExplorer/MethodEndpoint/index.tsx +7 -3
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +1 -0
- package/src/theme/ApiExplorer/Request/_Request.scss +5 -0
- package/src/theme/ApiExplorer/index.tsx +2 -0
- package/src/theme/ApiItem/Layout/index.tsx +85 -0
- package/src/theme/ApiItem/Layout/styles.module.css +17 -0
- package/src/theme/ApiItem/index.tsx +15 -3
- package/src/theme/ApiTabs/_ApiTabs.scss +0 -1
- package/src/theme/ArrayBrackets/index.tsx +37 -0
- package/src/theme/ParamsDetails/index.tsx +88 -0
- package/src/theme/ParamsItem/index.tsx +80 -17
- package/src/theme/RequestSchema/index.tsx +164 -0
- package/src/theme/ResponseExamples/index.tsx +290 -0
- package/src/theme/ResponseSchema/index.tsx +151 -0
- package/src/theme/Schema/index.tsx +928 -0
- package/src/theme/SchemaItem/index.tsx +116 -25
- package/src/theme/SkeletonLoader/index.tsx +18 -0
- package/src/theme/StatusCodes/index.tsx +72 -0
- package/src/theme/styles.scss +56 -9
- package/src/theme-classic.d.ts +0 -2
- package/src/theme-openapi.d.ts +4 -0
package/lib/markdown/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
|
|
2
|
+
/** @deprecated use ReactNode from React instead */
|
|
3
|
+
export type Children = ReactNode;
|
|
3
4
|
export type Props = Record<string, any> & {
|
|
4
|
-
children?:
|
|
5
|
+
children?: ReactNode;
|
|
5
6
|
};
|
|
6
7
|
export declare function create(tag: string, props: Props): string;
|
|
7
|
-
export declare function guard<T>(value: T | undefined | string, cb: (value: T) =>
|
|
8
|
-
export declare function render(children:
|
|
8
|
+
export declare function guard<T>(value: T | undefined | string, cb: (value: T) => ReactNode): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
|
|
9
|
+
export declare function render(children: ReactNode): string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | Iterable<ReactNode>;
|
|
9
10
|
export declare function toString(value: any): string | undefined;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type CodeSampleLanguage = "C" | "C#" | "C++" | "CoffeeScript" | "CSS" | "Dart" | "DM" | "Elixir" | "Go" | "Groovy" | "HTML" | "Java" | "JavaScript" | "Kotlin" | "Objective-C" | "Perl" | "PHP" | "PowerShell" | "Python" | "Ruby" | "Rust" | "Scala" | "Shell" | "Swift" | "TypeScript";
|
|
1
|
+
export type CodeSampleLanguage = "C" | "C#" | "C++" | "CoffeeScript" | "CSS" | "Dart" | "DM" | "Elixir" | "Go" | "Groovy" | "HTML" | "Java" | "JavaScript" | "Kotlin" | "Objective-C" | "OCaml" | "Perl" | "PHP" | "PowerShell" | "Python" | "R" | "Ruby" | "Rust" | "Scala" | "Shell" | "Swift" | "TypeScript";
|
|
2
2
|
export interface Language {
|
|
3
3
|
highlight: string;
|
|
4
4
|
language: string;
|
|
@@ -78,118 +78,7 @@ const postman_code_generators_1 = __importDefault(
|
|
|
78
78
|
require("postman-code-generators")
|
|
79
79
|
);
|
|
80
80
|
const languages_1 = require("./languages");
|
|
81
|
-
exports.languageSet =
|
|
82
|
-
{
|
|
83
|
-
highlight: "bash",
|
|
84
|
-
language: "curl",
|
|
85
|
-
codeSampleLanguage: "Shell",
|
|
86
|
-
logoClass: "bash",
|
|
87
|
-
options: {
|
|
88
|
-
longFormat: false,
|
|
89
|
-
followRedirect: true,
|
|
90
|
-
trimRequestBody: true,
|
|
91
|
-
},
|
|
92
|
-
variant: "cURL",
|
|
93
|
-
variants: ["curl"],
|
|
94
|
-
},
|
|
95
|
-
{
|
|
96
|
-
highlight: "python",
|
|
97
|
-
language: "python",
|
|
98
|
-
codeSampleLanguage: "Python",
|
|
99
|
-
logoClass: "python",
|
|
100
|
-
options: {
|
|
101
|
-
followRedirect: true,
|
|
102
|
-
trimRequestBody: true,
|
|
103
|
-
},
|
|
104
|
-
variant: "requests",
|
|
105
|
-
variants: ["requests", "http.client"],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
highlight: "go",
|
|
109
|
-
language: "go",
|
|
110
|
-
codeSampleLanguage: "Go",
|
|
111
|
-
logoClass: "go",
|
|
112
|
-
options: {
|
|
113
|
-
followRedirect: true,
|
|
114
|
-
trimRequestBody: true,
|
|
115
|
-
},
|
|
116
|
-
variant: "native",
|
|
117
|
-
variants: ["native"],
|
|
118
|
-
},
|
|
119
|
-
{
|
|
120
|
-
highlight: "javascript",
|
|
121
|
-
language: "nodejs",
|
|
122
|
-
codeSampleLanguage: "JavaScript",
|
|
123
|
-
logoClass: "nodejs",
|
|
124
|
-
options: {
|
|
125
|
-
ES6_enabled: true,
|
|
126
|
-
followRedirect: true,
|
|
127
|
-
trimRequestBody: true,
|
|
128
|
-
},
|
|
129
|
-
variant: "axios",
|
|
130
|
-
variants: ["axios", "native"],
|
|
131
|
-
},
|
|
132
|
-
{
|
|
133
|
-
highlight: "ruby",
|
|
134
|
-
language: "ruby",
|
|
135
|
-
codeSampleLanguage: "Ruby",
|
|
136
|
-
logoClass: "ruby",
|
|
137
|
-
options: {
|
|
138
|
-
followRedirect: true,
|
|
139
|
-
trimRequestBody: true,
|
|
140
|
-
},
|
|
141
|
-
variant: "Net::HTTP",
|
|
142
|
-
variants: ["net::http"],
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
highlight: "csharp",
|
|
146
|
-
language: "csharp",
|
|
147
|
-
codeSampleLanguage: "C#",
|
|
148
|
-
logoClass: "csharp",
|
|
149
|
-
options: {
|
|
150
|
-
followRedirect: true,
|
|
151
|
-
trimRequestBody: true,
|
|
152
|
-
},
|
|
153
|
-
variant: "RestSharp",
|
|
154
|
-
variants: ["restsharp", "httpclient"],
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
highlight: "php",
|
|
158
|
-
language: "php",
|
|
159
|
-
codeSampleLanguage: "PHP",
|
|
160
|
-
logoClass: "php",
|
|
161
|
-
options: {
|
|
162
|
-
followRedirect: true,
|
|
163
|
-
trimRequestBody: true,
|
|
164
|
-
},
|
|
165
|
-
variant: "cURL",
|
|
166
|
-
variants: ["curl", "guzzle", "pecl_http", "http_request2"],
|
|
167
|
-
},
|
|
168
|
-
{
|
|
169
|
-
highlight: "java",
|
|
170
|
-
language: "java",
|
|
171
|
-
codeSampleLanguage: "Java",
|
|
172
|
-
logoClass: "java",
|
|
173
|
-
options: {
|
|
174
|
-
followRedirect: true,
|
|
175
|
-
trimRequestBody: true,
|
|
176
|
-
},
|
|
177
|
-
variant: "OkHttp",
|
|
178
|
-
variants: ["okhttp", "unirest"],
|
|
179
|
-
},
|
|
180
|
-
{
|
|
181
|
-
highlight: "powershell",
|
|
182
|
-
language: "powershell",
|
|
183
|
-
codeSampleLanguage: "PowerShell",
|
|
184
|
-
logoClass: "powershell",
|
|
185
|
-
options: {
|
|
186
|
-
followRedirect: true,
|
|
187
|
-
trimRequestBody: true,
|
|
188
|
-
},
|
|
189
|
-
variant: "RestMethod",
|
|
190
|
-
variants: ["restmethod"],
|
|
191
|
-
},
|
|
192
|
-
];
|
|
81
|
+
exports.languageSet = (0, languages_1.generateLanguageSet)();
|
|
193
82
|
function CodeTab({ children, hidden, className }) {
|
|
194
83
|
return react_1.default.createElement(
|
|
195
84
|
"div",
|
|
@@ -335,7 +224,7 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
335
224
|
]);
|
|
336
225
|
// no dependencies was intentionlly set for this particular hook. it's safe as long as if conditions are set
|
|
337
226
|
(0, react_1.useEffect)(function onSelectedVariantUpdate() {
|
|
338
|
-
if (selectedVariant && selectedVariant !== language
|
|
227
|
+
if (selectedVariant && selectedVariant !== language?.variant) {
|
|
339
228
|
const postmanRequest = (0, buildPostmanRequest_1.default)(postman, {
|
|
340
229
|
queryParams,
|
|
341
230
|
pathParams,
|
|
@@ -365,6 +254,7 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
365
254
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
366
255
|
(0, react_1.useEffect)(function onSelectedSampleUpdate() {
|
|
367
256
|
if (
|
|
257
|
+
language &&
|
|
368
258
|
language.samples &&
|
|
369
259
|
language.samplesSources &&
|
|
370
260
|
selectedSample &&
|
|
@@ -392,6 +282,7 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
392
282
|
setSelectedSample: setSelectedSample,
|
|
393
283
|
},
|
|
394
284
|
languageSet: mergedLangs,
|
|
285
|
+
defaultValue: defaultLang[0]?.language ?? mergedLangs[0].language,
|
|
395
286
|
lazy: true,
|
|
396
287
|
},
|
|
397
288
|
mergedLangs.map((lang) => {
|
|
@@ -2,3 +2,4 @@ import { CodeSample, Language } from "./code-snippets-types";
|
|
|
2
2
|
export declare function mergeCodeSampleLanguage(languages: Language[], codeSamples: CodeSample[]): Language[];
|
|
3
3
|
export declare const mergeArraysbyLanguage: (arr1: any, arr2: any) => any[];
|
|
4
4
|
export declare function getCodeSampleSourceFromLanguage(language: Language): string;
|
|
5
|
+
export declare function generateLanguageSet(): Language[];
|
|
@@ -11,14 +11,17 @@ var __importDefault =
|
|
|
11
11
|
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
12
|
};
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
-
exports.
|
|
14
|
+
exports.generateLanguageSet =
|
|
15
|
+
exports.getCodeSampleSourceFromLanguage =
|
|
15
16
|
exports.mergeArraysbyLanguage =
|
|
16
17
|
exports.mergeCodeSampleLanguage =
|
|
17
18
|
void 0;
|
|
18
19
|
const find_1 = __importDefault(require("lodash/find"));
|
|
19
|
-
const isArray_1 = __importDefault(require("lodash/isArray"));
|
|
20
20
|
const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
|
|
21
21
|
const unionBy_1 = __importDefault(require("lodash/unionBy"));
|
|
22
|
+
const postman_code_generators_1 = __importDefault(
|
|
23
|
+
require("postman-code-generators")
|
|
24
|
+
);
|
|
22
25
|
function mergeCodeSampleLanguage(languages, codeSamples) {
|
|
23
26
|
return languages.map((language) => {
|
|
24
27
|
const languageCodeSamples = codeSamples.filter(
|
|
@@ -50,10 +53,7 @@ const mergeArraysbyLanguage = (arr1, arr2) => {
|
|
|
50
53
|
(0, find_1.default)(arr2, ["language", item["language"]]),
|
|
51
54
|
];
|
|
52
55
|
return (0, mergeWith_1.default)({}, ...matchingItems, (objValue) => {
|
|
53
|
-
|
|
54
|
-
return objValue;
|
|
55
|
-
}
|
|
56
|
-
return undefined;
|
|
56
|
+
return objValue;
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
};
|
|
@@ -73,3 +73,27 @@ function getCodeSampleSourceFromLanguage(language) {
|
|
|
73
73
|
return "";
|
|
74
74
|
}
|
|
75
75
|
exports.getCodeSampleSourceFromLanguage = getCodeSampleSourceFromLanguage;
|
|
76
|
+
function generateLanguageSet() {
|
|
77
|
+
const languageSet = [];
|
|
78
|
+
postman_code_generators_1.default.getLanguageList().forEach((language) => {
|
|
79
|
+
const variants = [];
|
|
80
|
+
language.variants.forEach((variant) => {
|
|
81
|
+
variants.push(variant.key);
|
|
82
|
+
});
|
|
83
|
+
languageSet.push({
|
|
84
|
+
highlight: language.syntax_mode,
|
|
85
|
+
language: language.key,
|
|
86
|
+
codeSampleLanguage: language.label,
|
|
87
|
+
logoClass: language.key,
|
|
88
|
+
options: {
|
|
89
|
+
longFormat: false,
|
|
90
|
+
followRedirect: true,
|
|
91
|
+
trimRequestBody: true,
|
|
92
|
+
},
|
|
93
|
+
variant: variants[0],
|
|
94
|
+
variants: variants,
|
|
95
|
+
});
|
|
96
|
+
});
|
|
97
|
+
return languageSet;
|
|
98
|
+
}
|
|
99
|
+
exports.generateLanguageSet = generateLanguageSet;
|
|
@@ -146,6 +146,24 @@ body[class="ReactModal__Body--open"] {
|
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
148
|
|
|
149
|
+
.openapi-tabs__code-item--dart {
|
|
150
|
+
color: var(--ifm-color-info);
|
|
151
|
+
|
|
152
|
+
&::after {
|
|
153
|
+
content: "";
|
|
154
|
+
width: var(--code-tab-logo-width);
|
|
155
|
+
height: var(--code-tab-logo-height);
|
|
156
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/dart/dart-original.svg")
|
|
157
|
+
no-repeat;
|
|
158
|
+
margin-block: auto;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
&.active {
|
|
162
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-dart);
|
|
163
|
+
border-color: var(--openapi-code-tab-border-color-dart);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
149
167
|
.openapi-tabs__code-item--javascript {
|
|
150
168
|
color: var(--ifm-color-warning);
|
|
151
169
|
|
|
@@ -164,7 +182,7 @@ body[class="ReactModal__Body--open"] {
|
|
|
164
182
|
}
|
|
165
183
|
}
|
|
166
184
|
|
|
167
|
-
.openapi-tabs__code-item--
|
|
185
|
+
.openapi-tabs__code-item--curl {
|
|
168
186
|
color: var(--ifm-color-danger);
|
|
169
187
|
|
|
170
188
|
&::after {
|
|
@@ -179,7 +197,7 @@ body[class="ReactModal__Body--open"] {
|
|
|
179
197
|
}
|
|
180
198
|
|
|
181
199
|
&.active {
|
|
182
|
-
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-
|
|
200
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-curl);
|
|
183
201
|
border-color: var(--ifm-color-danger);
|
|
184
202
|
}
|
|
185
203
|
}
|
|
@@ -220,6 +238,96 @@ body[class="ReactModal__Body--open"] {
|
|
|
220
238
|
}
|
|
221
239
|
}
|
|
222
240
|
|
|
241
|
+
.openapi-tabs__code-item--r {
|
|
242
|
+
color: var(--ifm-color-gray-500);
|
|
243
|
+
|
|
244
|
+
&::after {
|
|
245
|
+
content: "";
|
|
246
|
+
width: var(--code-tab-logo-width);
|
|
247
|
+
height: var(--code-tab-logo-height);
|
|
248
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/r/r-original.svg")
|
|
249
|
+
no-repeat;
|
|
250
|
+
margin-block: auto;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
&.active {
|
|
254
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-r);
|
|
255
|
+
border-color: var(--openapi-code-tab-border-color-r);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
.openapi-tabs__code-item--swift {
|
|
260
|
+
color: var(--ifm-color-danger);
|
|
261
|
+
|
|
262
|
+
&::after {
|
|
263
|
+
content: "";
|
|
264
|
+
width: var(--code-tab-logo-width);
|
|
265
|
+
height: var(--code-tab-logo-height);
|
|
266
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/swift/swift-original.svg")
|
|
267
|
+
no-repeat;
|
|
268
|
+
margin-block: auto;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
&.active {
|
|
272
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-swift);
|
|
273
|
+
border-color: var(--openapi-code-tab-border-color-swift);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
.openapi-tabs__code-item--c {
|
|
278
|
+
color: var(--ifm-color-info);
|
|
279
|
+
|
|
280
|
+
&::after {
|
|
281
|
+
content: "";
|
|
282
|
+
width: var(--code-tab-logo-width);
|
|
283
|
+
height: var(--code-tab-logo-height);
|
|
284
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/c/c-original.svg")
|
|
285
|
+
no-repeat;
|
|
286
|
+
margin-block: auto;
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
&.active {
|
|
290
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-c);
|
|
291
|
+
border-color: var(--openapi-code-tab-border-color-c);
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
.openapi-tabs__code-item--objective-c {
|
|
296
|
+
color: var(--ifm-color-info);
|
|
297
|
+
|
|
298
|
+
&::after {
|
|
299
|
+
content: "";
|
|
300
|
+
width: var(--code-tab-logo-width);
|
|
301
|
+
height: var(--code-tab-logo-height);
|
|
302
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/objectivec/objectivec-plain.svg")
|
|
303
|
+
no-repeat;
|
|
304
|
+
margin-block: auto;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
&.active {
|
|
308
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-objective-c);
|
|
309
|
+
border-color: var(--openapi-code-tab-border-color-objective-c);
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
.openapi-tabs__code-item--ocaml {
|
|
314
|
+
color: var(--ifm-color-warning);
|
|
315
|
+
|
|
316
|
+
&::after {
|
|
317
|
+
content: "";
|
|
318
|
+
width: var(--code-tab-logo-width);
|
|
319
|
+
height: var(--code-tab-logo-height);
|
|
320
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/ocaml/ocaml-original.svg")
|
|
321
|
+
no-repeat;
|
|
322
|
+
margin-block: auto;
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
&.active {
|
|
326
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-objective-ocaml);
|
|
327
|
+
border-color: var(--openapi-code-tab-border-color-objective-ocaml);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
223
331
|
.openapi-tabs__code-item--nodejs {
|
|
224
332
|
color: var(--ifm-color-success);
|
|
225
333
|
|
|
@@ -256,6 +364,42 @@ body[class="ReactModal__Body--open"] {
|
|
|
256
364
|
}
|
|
257
365
|
}
|
|
258
366
|
|
|
367
|
+
.openapi-tabs__code-item--kotlin {
|
|
368
|
+
color: var(--ifm-color-gray-500);
|
|
369
|
+
|
|
370
|
+
&::after {
|
|
371
|
+
content: "";
|
|
372
|
+
width: var(--code-tab-logo-width);
|
|
373
|
+
height: var(--code-tab-logo-height);
|
|
374
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/kotlin/kotlin-original.svg")
|
|
375
|
+
no-repeat;
|
|
376
|
+
margin-block: auto;
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
&.active {
|
|
380
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-kotlin);
|
|
381
|
+
border-color: var(--openapi-code-tab-border-color-kotlin);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
.openapi-tabs__code-item--rust {
|
|
386
|
+
color: var(--ifm-color-gray-500);
|
|
387
|
+
|
|
388
|
+
&::after {
|
|
389
|
+
content: "";
|
|
390
|
+
width: var(--code-tab-logo-width);
|
|
391
|
+
height: var(--code-tab-logo-height);
|
|
392
|
+
background: url("https://raw.githubusercontent.com/devicons/devicon/master/icons/rust/rust-original.svg")
|
|
393
|
+
no-repeat;
|
|
394
|
+
margin-block: auto;
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
&.active {
|
|
398
|
+
box-shadow: 0 0 0 3px var(--openapi-code-tab-shadow-color-rust);
|
|
399
|
+
border-color: var(--openapi-code-tab-border-color-rust);
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
|
|
259
403
|
.openapi-tabs__code-item--java {
|
|
260
404
|
color: var(--ifm-color-warning);
|
|
261
405
|
|
|
@@ -292,6 +436,56 @@ body[class="ReactModal__Body--open"] {
|
|
|
292
436
|
}
|
|
293
437
|
}
|
|
294
438
|
|
|
439
|
+
.openapi-tabs__code-item--http {
|
|
440
|
+
color: var(--ifm-color-gray-500);
|
|
441
|
+
display: flex;
|
|
442
|
+
align-items: center;
|
|
443
|
+
justify-content: center;
|
|
444
|
+
position: relative;
|
|
445
|
+
|
|
446
|
+
&::after {
|
|
447
|
+
content: "";
|
|
448
|
+
display: inline-block;
|
|
449
|
+
width: 32px; /* Explicitly setting width to 32 pixels */
|
|
450
|
+
height: 32px; /* Explicitly setting height to 32 pixels */
|
|
451
|
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIyTDggMTZMMTIgMTBNMjAgMjJMMjQgMTZMIDIwIDEwIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=");
|
|
452
|
+
background-size: contain;
|
|
453
|
+
background-repeat: no-repeat;
|
|
454
|
+
background-position: center; /* Center the SVG */
|
|
455
|
+
margin-top: 0.5rem;
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
&.active {
|
|
459
|
+
box-shadow: 0 0 0 3px var(--opeanpi-code-tab-shadow-color-http);
|
|
460
|
+
border-color: var(--openapi-code-tab-border-color-http);
|
|
461
|
+
}
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
.openapi-tabs__code-item--shell {
|
|
465
|
+
color: var(--ifm-color-gray-500);
|
|
466
|
+
display: flex;
|
|
467
|
+
align-items: center;
|
|
468
|
+
justify-content: center;
|
|
469
|
+
position: relative;
|
|
470
|
+
|
|
471
|
+
&::after {
|
|
472
|
+
content: "";
|
|
473
|
+
display: inline-block;
|
|
474
|
+
width: 32px; /* Explicitly setting width to 32 pixels */
|
|
475
|
+
height: 32px; /* Explicitly setting height to 32 pixels */
|
|
476
|
+
background-image: url("data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSJjdXJyZW50Q29sb3IiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDIyTDggMTZMMTIgMTBNMjAgMjJMMjQgMTZMIDIwIDEwIiBzdHJva2U9ImN1cnJlbnRDb2xvciIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiLz48L3N2Zz4=");
|
|
477
|
+
background-size: contain;
|
|
478
|
+
background-repeat: no-repeat;
|
|
479
|
+
background-position: center; /* Center the SVG */
|
|
480
|
+
margin-top: 0.5rem;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
&.active {
|
|
484
|
+
box-shadow: 0 0 0 3px var(--opeanpi-code-tab-shadow-color-shell);
|
|
485
|
+
border-color: var(--openapi-code-tab-border-color-shell);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
|
|
295
489
|
@media only screen and (min-width: 768px) and (max-width: 996px) {
|
|
296
490
|
.openapi-tabs__code-list {
|
|
297
491
|
justify-content: space-around;
|
|
@@ -71,12 +71,35 @@ function TabList({
|
|
|
71
71
|
selectValue,
|
|
72
72
|
tabValues,
|
|
73
73
|
}) {
|
|
74
|
-
const tabRefs = [];
|
|
74
|
+
const tabRefs = (0, react_1.useRef)([]);
|
|
75
|
+
const tabsScrollContainerRef = (0, react_1.useRef)();
|
|
75
76
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
76
77
|
internal_1.useScrollPositionBlocker)();
|
|
78
|
+
(0, react_1.useEffect)(() => {
|
|
79
|
+
const activeTab = tabRefs.current.find(
|
|
80
|
+
(tab) => tab?.getAttribute("aria-selected") === "true"
|
|
81
|
+
);
|
|
82
|
+
if (activeTab && tabsScrollContainerRef.current) {
|
|
83
|
+
const container = tabsScrollContainerRef.current;
|
|
84
|
+
const containerRect = container.getBoundingClientRect();
|
|
85
|
+
const activeTabRect = activeTab.getBoundingClientRect();
|
|
86
|
+
// Calculate the distance to scroll to align active tab to the left
|
|
87
|
+
const glowOffset = 3;
|
|
88
|
+
const scrollOffset =
|
|
89
|
+
activeTabRect.left -
|
|
90
|
+
containerRect.left +
|
|
91
|
+
container.scrollLeft -
|
|
92
|
+
glowOffset;
|
|
93
|
+
// Check if the active tab is not already at the left position
|
|
94
|
+
if (Math.abs(scrollOffset - container.scrollLeft) > 4) {
|
|
95
|
+
// Adjust the scroll of the container
|
|
96
|
+
container.scrollLeft = scrollOffset;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}, []);
|
|
77
100
|
const handleTabChange = (event) => {
|
|
78
101
|
const newTab = event.currentTarget;
|
|
79
|
-
const newTabIndex = tabRefs.indexOf(newTab);
|
|
102
|
+
const newTabIndex = tabRefs.current.indexOf(newTab);
|
|
80
103
|
const newTabValue = tabValues[newTabIndex].value;
|
|
81
104
|
if (newTabValue !== selectedValue) {
|
|
82
105
|
blockElementScrollPositionUntilNextRender(newTab);
|
|
@@ -100,7 +123,7 @@ function TabList({
|
|
|
100
123
|
newLanguage = languageSet.filter(
|
|
101
124
|
(lang) => lang.language === newTabValue
|
|
102
125
|
)[0];
|
|
103
|
-
action.setSelectedVariant(newLanguage.
|
|
126
|
+
action.setSelectedVariant(newLanguage.variants[0].toLowerCase());
|
|
104
127
|
action.setSelectedSample(newLanguage.sample);
|
|
105
128
|
}
|
|
106
129
|
action.setLanguage(newLanguage);
|
|
@@ -114,13 +137,15 @@ function TabList({
|
|
|
114
137
|
break;
|
|
115
138
|
}
|
|
116
139
|
case "ArrowRight": {
|
|
117
|
-
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
118
|
-
focusElement = tabRefs[nextTab] ?? tabRefs[0];
|
|
140
|
+
const nextTab = tabRefs.current.indexOf(event.currentTarget) + 1;
|
|
141
|
+
focusElement = tabRefs.current[nextTab] ?? tabRefs.current[0];
|
|
119
142
|
break;
|
|
120
143
|
}
|
|
121
144
|
case "ArrowLeft": {
|
|
122
|
-
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
123
|
-
focusElement =
|
|
145
|
+
const prevTab = tabRefs.current.indexOf(event.currentTarget) - 1;
|
|
146
|
+
focusElement =
|
|
147
|
+
tabRefs.current[prevTab] ??
|
|
148
|
+
tabRefs.current[tabRefs.current.length - 1];
|
|
124
149
|
break;
|
|
125
150
|
}
|
|
126
151
|
default:
|
|
@@ -141,6 +166,7 @@ function TabList({
|
|
|
141
166
|
},
|
|
142
167
|
className
|
|
143
168
|
),
|
|
169
|
+
ref: tabsScrollContainerRef,
|
|
144
170
|
},
|
|
145
171
|
tabValues.map(({ value, label, attributes }) =>
|
|
146
172
|
react_1.default.createElement(
|
|
@@ -151,7 +177,7 @@ function TabList({
|
|
|
151
177
|
tabIndex: selectedValue === value ? 0 : -1,
|
|
152
178
|
"aria-selected": selectedValue === value,
|
|
153
179
|
key: value,
|
|
154
|
-
ref: (tabControl) => tabRefs.push(tabControl),
|
|
180
|
+
ref: (tabControl) => tabRefs.current.push(tabControl),
|
|
155
181
|
onKeyDown: handleKeydown,
|
|
156
182
|
onClick: handleTabChange,
|
|
157
183
|
...attributes,
|
|
@@ -2,6 +2,7 @@ import React from "react";
|
|
|
2
2
|
export interface Props {
|
|
3
3
|
method: string;
|
|
4
4
|
path: string;
|
|
5
|
+
context?: "endpoint" | "callback";
|
|
5
6
|
}
|
|
6
|
-
declare function MethodEndpoint({ method, path }: Props): React.JSX.Element;
|
|
7
|
+
declare function MethodEndpoint({ method, path, context }: Props): React.JSX.Element;
|
|
7
8
|
export default MethodEndpoint;
|
|
@@ -13,7 +13,7 @@ var __importDefault =
|
|
|
13
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
14
|
const react_1 = __importDefault(require("react"));
|
|
15
15
|
const BrowserOnly_1 = __importDefault(require("@docusaurus/BrowserOnly"));
|
|
16
|
-
const hooks_1 = require("
|
|
16
|
+
const hooks_1 = require("@theme/ApiItem/hooks");
|
|
17
17
|
function colorForMethod(method) {
|
|
18
18
|
switch (method.toLowerCase()) {
|
|
19
19
|
case "get":
|
|
@@ -34,12 +34,15 @@ function colorForMethod(method) {
|
|
|
34
34
|
return undefined;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
-
function MethodEndpoint({ method, path }) {
|
|
37
|
+
function MethodEndpoint({ method, path, context }) {
|
|
38
38
|
let serverValue = (0, hooks_1.useTypedSelector)(
|
|
39
39
|
(state) => state.server.value
|
|
40
40
|
);
|
|
41
41
|
let serverUrlWithVariables = "";
|
|
42
42
|
const renderServerUrl = () => {
|
|
43
|
+
if (context === "callback") {
|
|
44
|
+
return "";
|
|
45
|
+
}
|
|
43
46
|
if (serverValue && serverValue.variables) {
|
|
44
47
|
serverUrlWithVariables = serverValue.url.replace(/\/$/, "");
|
|
45
48
|
Object.keys(serverValue.variables).forEach((variable) => {
|
|
@@ -114,6 +114,11 @@
|
|
|
114
114
|
}
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
+
.openapi-security__summary-container {
|
|
118
|
+
background: var(--ifm-pre-background);
|
|
119
|
+
border-radius: var(--ifm-pre-border-radius);
|
|
120
|
+
}
|
|
121
|
+
|
|
117
122
|
// Prevent auto zoom on mobile iOS devices when focusing on input elmenents
|
|
118
123
|
@media screen and (-webkit-min-device-pixel-ratio: 0) and (max-device-width: 1024px) {
|
|
119
124
|
.prism-code,
|
|
@@ -17,12 +17,18 @@ const CodeSnippets_1 = __importDefault(
|
|
|
17
17
|
);
|
|
18
18
|
const Request_1 = __importDefault(require("@theme/ApiExplorer/Request"));
|
|
19
19
|
const Response_1 = __importDefault(require("@theme/ApiExplorer/Response"));
|
|
20
|
+
const SecuritySchemes_1 = __importDefault(
|
|
21
|
+
require("@theme/ApiExplorer/SecuritySchemes")
|
|
22
|
+
);
|
|
20
23
|
const postman_collection_1 = __importDefault(require("postman-collection"));
|
|
21
24
|
function ApiExplorer({ item, infoPath }) {
|
|
22
25
|
const postman = new postman_collection_1.default.Request(item.postman);
|
|
23
26
|
return react_1.default.createElement(
|
|
24
27
|
react_1.default.Fragment,
|
|
25
28
|
null,
|
|
29
|
+
react_1.default.createElement(SecuritySchemes_1.default, {
|
|
30
|
+
infoPath: infoPath,
|
|
31
|
+
}),
|
|
26
32
|
item.method !== "event" &&
|
|
27
33
|
react_1.default.createElement(CodeSnippets_1.default, {
|
|
28
34
|
postman: postman,
|