docusaurus-theme-openapi-docs 4.0.1 → 4.1.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 +2 -112
- 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 +146 -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 +117 -0
- package/lib/theme/ApiItem/Layout/styles.module.css +17 -0
- package/lib/theme/ApiItem/index.js +1 -1
- package/lib/theme/ParamsItem/index.d.ts +2 -1
- package/lib/theme/ParamsItem/index.js +74 -17
- package/lib/theme/SchemaItem/index.d.ts +1 -1
- package/lib/theme/SchemaItem/index.js +106 -20
- package/package.json +6 -5
- 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 +6 -112
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +26 -5
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +146 -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 +82 -0
- package/src/theme/ApiItem/Layout/styles.module.css +17 -0
- package/src/theme/ApiItem/index.tsx +1 -1
- package/src/theme/ParamsItem/index.tsx +75 -15
- package/src/theme/SchemaItem/index.tsx +106 -17
- 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",
|
|
@@ -392,6 +281,7 @@ function CodeSnippets({ postman, codeSamples }) {
|
|
|
392
281
|
setSelectedSample: setSelectedSample,
|
|
393
282
|
},
|
|
394
283
|
languageSet: mergedLangs,
|
|
284
|
+
defaultValue: defaultLang[0]?.language ?? mergedLangs[0].language,
|
|
395
285
|
lazy: true,
|
|
396
286
|
},
|
|
397
287
|
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
|
|
|
@@ -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,
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Copyright (c) Palo Alto Networks
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
* ========================================================================== */
|
|
8
|
+
var __importDefault =
|
|
9
|
+
(this && this.__importDefault) ||
|
|
10
|
+
function (mod) {
|
|
11
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
12
|
+
};
|
|
13
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
|
+
const react_1 = __importDefault(require("react"));
|
|
15
|
+
const client_1 = require("@docusaurus/plugin-content-docs/client");
|
|
16
|
+
const theme_common_1 = require("@docusaurus/theme-common");
|
|
17
|
+
const ContentVisibility_1 = __importDefault(
|
|
18
|
+
require("@theme/ContentVisibility")
|
|
19
|
+
);
|
|
20
|
+
const DocBreadcrumbs_1 = __importDefault(require("@theme/DocBreadcrumbs"));
|
|
21
|
+
const Content_1 = __importDefault(require("@theme/DocItem/Content"));
|
|
22
|
+
const Footer_1 = __importDefault(require("@theme/DocItem/Footer"));
|
|
23
|
+
const Paginator_1 = __importDefault(require("@theme/DocItem/Paginator"));
|
|
24
|
+
const Desktop_1 = __importDefault(require("@theme/DocItem/TOC/Desktop"));
|
|
25
|
+
const Mobile_1 = __importDefault(require("@theme/DocItem/TOC/Mobile"));
|
|
26
|
+
const DocVersionBadge_1 = __importDefault(require("@theme/DocVersionBadge"));
|
|
27
|
+
const DocVersionBanner_1 = __importDefault(require("@theme/DocVersionBanner"));
|
|
28
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
29
|
+
const styles_module_css_1 = __importDefault(require("./styles.module.css"));
|
|
30
|
+
/**
|
|
31
|
+
* Decide if the toc should be rendered, on mobile or desktop viewports
|
|
32
|
+
*/
|
|
33
|
+
function useDocTOC() {
|
|
34
|
+
const { frontMatter, toc } = (0, client_1.useDoc)();
|
|
35
|
+
const windowSize = (0, theme_common_1.useWindowSize)();
|
|
36
|
+
const hidden = frontMatter.hide_table_of_contents;
|
|
37
|
+
const canRender = !hidden && toc.length > 0;
|
|
38
|
+
const mobile = canRender
|
|
39
|
+
? react_1.default.createElement(Mobile_1.default, null)
|
|
40
|
+
: undefined;
|
|
41
|
+
const desktop =
|
|
42
|
+
canRender && (windowSize === "desktop" || windowSize === "ssr")
|
|
43
|
+
? react_1.default.createElement(Desktop_1.default, null)
|
|
44
|
+
: undefined;
|
|
45
|
+
return {
|
|
46
|
+
hidden,
|
|
47
|
+
mobile,
|
|
48
|
+
desktop,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
function DocItemLayout({ children }) {
|
|
52
|
+
const docTOC = useDocTOC();
|
|
53
|
+
const { metadata } = (0, client_1.useDoc)();
|
|
54
|
+
const { frontMatter } = (0, client_1.useDoc)();
|
|
55
|
+
const api = frontMatter.api;
|
|
56
|
+
return react_1.default.createElement(
|
|
57
|
+
"div",
|
|
58
|
+
{ className: "row" },
|
|
59
|
+
react_1.default.createElement(
|
|
60
|
+
"div",
|
|
61
|
+
{
|
|
62
|
+
className: (0, clsx_1.default)(
|
|
63
|
+
"col",
|
|
64
|
+
!docTOC.hidden && styles_module_css_1.default.docItemCol
|
|
65
|
+
),
|
|
66
|
+
},
|
|
67
|
+
react_1.default.createElement(ContentVisibility_1.default, {
|
|
68
|
+
metadata: metadata,
|
|
69
|
+
}),
|
|
70
|
+
react_1.default.createElement(DocVersionBanner_1.default, null),
|
|
71
|
+
react_1.default.createElement(
|
|
72
|
+
"div",
|
|
73
|
+
{ className: styles_module_css_1.default.docItemContainer },
|
|
74
|
+
react_1.default.createElement(
|
|
75
|
+
"article",
|
|
76
|
+
null,
|
|
77
|
+
react_1.default.createElement(DocBreadcrumbs_1.default, null),
|
|
78
|
+
react_1.default.createElement(DocVersionBadge_1.default, null),
|
|
79
|
+
docTOC.mobile,
|
|
80
|
+
react_1.default.createElement(Content_1.default, null, children),
|
|
81
|
+
react_1.default.createElement(
|
|
82
|
+
"div",
|
|
83
|
+
{ className: "row" },
|
|
84
|
+
react_1.default.createElement(
|
|
85
|
+
"div",
|
|
86
|
+
{
|
|
87
|
+
className: (0, clsx_1.default)(
|
|
88
|
+
"col",
|
|
89
|
+
api ? "col--7" : "col--12"
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
react_1.default.createElement(Footer_1.default, null)
|
|
93
|
+
)
|
|
94
|
+
)
|
|
95
|
+
),
|
|
96
|
+
react_1.default.createElement(
|
|
97
|
+
"div",
|
|
98
|
+
{ className: "row" },
|
|
99
|
+
react_1.default.createElement(
|
|
100
|
+
"div",
|
|
101
|
+
{
|
|
102
|
+
className: (0, clsx_1.default)("col", api ? "col--7" : "col--12"),
|
|
103
|
+
},
|
|
104
|
+
react_1.default.createElement(Paginator_1.default, null)
|
|
105
|
+
)
|
|
106
|
+
)
|
|
107
|
+
)
|
|
108
|
+
),
|
|
109
|
+
docTOC.desktop &&
|
|
110
|
+
react_1.default.createElement(
|
|
111
|
+
"div",
|
|
112
|
+
{ className: "col col--3" },
|
|
113
|
+
docTOC.desktop
|
|
114
|
+
)
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
exports.default = DocItemLayout;
|