docusaurus-theme-openapi-docs 0.0.0-1294 → 0.0.0-1310
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/schema.js +4 -5
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +4 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +9 -6
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/Authorization/index.js +9 -10
- package/lib/theme/ApiExplorer/Body/index.js +4 -5
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/CodeTabs/index.js +6 -5
- package/lib/theme/ApiExplorer/Export/index.js +9 -2
- package/lib/theme/ApiExplorer/FormFileUpload/index.js +1 -2
- package/lib/theme/ApiExplorer/FormLabel/index.js +1 -2
- package/lib/theme/ApiExplorer/FormTextInput/index.js +1 -2
- package/lib/theme/ApiExplorer/LiveEditor/index.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.js +5 -3
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.js +1 -2
- package/lib/theme/ApiExplorer/ParamOptions/index.js +2 -3
- package/lib/theme/ApiExplorer/Request/index.js +17 -18
- package/lib/theme/ApiExplorer/Response/index.js +7 -11
- package/lib/theme/ApiExplorer/SecuritySchemes/index.js +57 -50
- package/lib/theme/ApiExplorer/Server/index.js +2 -3
- package/lib/theme/ApiTabs/index.d.ts +1 -1
- package/lib/theme/ApiTabs/index.js +7 -7
- package/lib/theme/DiscriminatorTabs/index.d.ts +1 -1
- package/lib/theme/DiscriminatorTabs/index.js +6 -5
- package/lib/theme/Example/index.js +3 -4
- package/lib/theme/MimeTabs/index.d.ts +1 -1
- package/lib/theme/MimeTabs/index.js +6 -5
- package/lib/theme/OperationTabs/index.d.ts +1 -1
- package/lib/theme/OperationTabs/index.js +6 -5
- package/lib/theme/ParamsDetails/index.js +1 -2
- package/lib/theme/ParamsItem/index.js +7 -8
- package/lib/theme/RequestSchema/index.js +4 -6
- package/lib/theme/ResponseExamples/index.js +3 -4
- package/lib/theme/ResponseSchema/index.js +2 -3
- package/lib/theme/Schema/index.js +8 -9
- package/lib/theme/SchemaExpansion/index.js +4 -5
- package/lib/theme/SchemaItem/index.js +9 -10
- package/lib/theme/SchemaTabs/index.d.ts +1 -1
- package/lib/theme/SchemaTabs/index.js +6 -5
- package/lib/theme/StatusCodes/index.js +2 -4
- package/lib/theme/TabItem/index.d.ts +5 -0
- package/lib/theme/TabItem/index.js +51 -0
- package/lib/theme/TabItem/styles.module.css +3 -0
- package/lib/theme/Tabs/index.d.ts +5 -0
- package/lib/theme/Tabs/index.js +148 -0
- package/lib/theme/Tabs/styles.module.css +7 -0
- package/lib/theme/translationIds.d.ts +1 -99
- package/lib/theme/translationIds.js +0 -116
- package/lib/theme/utils/codeBlockUtils.d.ts +28 -0
- package/lib/theme/utils/codeBlockUtils.js +223 -0
- package/lib/theme/utils/reactUtils.d.ts +1 -0
- package/lib/theme/utils/reactUtils.js +23 -0
- package/lib/theme/utils/scrollUtils.d.ts +7 -0
- package/lib/theme/utils/scrollUtils.js +175 -0
- package/lib/theme/utils/tabsUtils.d.ts +47 -0
- package/lib/theme/utils/tabsUtils.js +299 -0
- package/lib/theme/utils/useCodeWordWrap.d.ts +8 -0
- package/lib/theme/utils/useCodeWordWrap.js +84 -0
- package/lib/theme/utils/useMutationObserver.d.ts +3 -0
- package/lib/theme/utils/useMutationObserver.js +34 -0
- package/package.json +4 -4
- package/src/markdown/schema.ts +4 -5
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/index.tsx +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/String.tsx +8 -7
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/index.tsx +1 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/index.tsx +1 -1
- package/src/theme/ApiExplorer/Authorization/index.tsx +9 -10
- package/src/theme/ApiExplorer/Body/index.tsx +7 -5
- package/src/theme/ApiExplorer/CodeTabs/index.tsx +5 -5
- package/src/theme/ApiExplorer/Export/index.tsx +6 -2
- package/src/theme/ApiExplorer/FormFileUpload/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormLabel/index.tsx +1 -2
- package/src/theme/ApiExplorer/FormTextInput/index.tsx +1 -2
- package/src/theme/ApiExplorer/LiveEditor/index.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.tsx +5 -3
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.tsx +1 -2
- package/src/theme/ApiExplorer/ParamOptions/index.tsx +2 -3
- package/src/theme/ApiExplorer/Request/index.tsx +23 -18
- package/src/theme/ApiExplorer/Response/index.tsx +10 -8
- package/src/theme/ApiExplorer/SecuritySchemes/index.tsx +60 -52
- package/src/theme/ApiExplorer/Server/index.tsx +8 -3
- package/src/theme/ApiTabs/index.tsx +8 -8
- package/src/theme/DiscriminatorTabs/index.tsx +6 -5
- package/src/theme/Example/index.tsx +3 -4
- package/src/theme/MimeTabs/index.tsx +9 -8
- package/src/theme/OperationTabs/index.tsx +5 -4
- package/src/theme/ParamsDetails/index.tsx +1 -2
- package/src/theme/ParamsItem/index.tsx +13 -8
- package/src/theme/RequestSchema/index.tsx +4 -5
- package/src/theme/ResponseExamples/index.tsx +3 -4
- package/src/theme/ResponseSchema/index.tsx +2 -3
- package/src/theme/Schema/index.tsx +8 -9
- package/src/theme/SchemaExpansion/index.tsx +4 -5
- package/src/theme/SchemaItem/index.tsx +18 -10
- package/src/theme/SchemaTabs/index.tsx +6 -5
- package/src/theme/StatusCodes/index.tsx +2 -3
- package/src/theme/TabItem/index.tsx +61 -0
- package/src/theme/TabItem/styles.module.css +3 -0
- package/src/theme/Tabs/index.tsx +164 -0
- package/src/theme/Tabs/styles.module.css +7 -0
- package/src/theme/translationIds.ts +37 -113
- package/src/theme/utils/codeBlockUtils.ts +296 -0
- package/src/theme/utils/reactUtils.ts +22 -0
- package/src/theme/utils/scrollUtils.tsx +153 -0
- package/src/theme/utils/tabsUtils.tsx +329 -0
- package/src/theme/utils/useCodeWordWrap.ts +110 -0
- package/src/theme/utils/useMutationObserver.ts +43 -0
- package/src/theme-classic.d.ts +0 -96
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -16,18 +16,17 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
16
16
|
const Example_1 = require("@theme/Example");
|
|
17
17
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
18
18
|
/* eslint-disable import/no-extraneous-dependencies*/
|
|
19
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
20
19
|
const clsx_1 = __importDefault(require("clsx"));
|
|
21
20
|
const schema_1 = require("../../markdown/schema");
|
|
22
21
|
const utils_1 = require("../../markdown/utils");
|
|
23
22
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
24
23
|
if (enumDescriptions?.length) {
|
|
25
24
|
const enumValue = (0, Translate_1.translate)({
|
|
26
|
-
id:
|
|
25
|
+
id: "theme.openapi.schemaItem.enumValue",
|
|
27
26
|
message: "Enum Value",
|
|
28
27
|
});
|
|
29
28
|
const description = (0, Translate_1.translate)({
|
|
30
|
-
id:
|
|
29
|
+
id: "theme.openapi.schemaItem.enumDescription",
|
|
31
30
|
message: "Description",
|
|
32
31
|
});
|
|
33
32
|
return `| ${enumValue} | ${description} |
|
|
@@ -73,7 +72,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
73
72
|
"span",
|
|
74
73
|
{ className: "openapi-schema__required" },
|
|
75
74
|
(0, Translate_1.translate)({
|
|
76
|
-
id:
|
|
75
|
+
id: "theme.openapi.schemaItem.required",
|
|
77
76
|
message: "required",
|
|
78
77
|
})
|
|
79
78
|
)
|
|
@@ -83,7 +82,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
83
82
|
"span",
|
|
84
83
|
{ className: "openapi-schema__deprecated" },
|
|
85
84
|
(0, Translate_1.translate)({
|
|
86
|
-
id:
|
|
85
|
+
id: "theme.openapi.schemaItem.deprecated",
|
|
87
86
|
message: "deprecated",
|
|
88
87
|
})
|
|
89
88
|
)
|
|
@@ -99,7 +98,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
99
98
|
return undefined;
|
|
100
99
|
}
|
|
101
100
|
const label = (0, Translate_1.translate)({
|
|
102
|
-
id:
|
|
101
|
+
id: "theme.openapi.schemaItem.constantValue",
|
|
103
102
|
message: "Constant value:",
|
|
104
103
|
});
|
|
105
104
|
return react_1.default.createElement(
|
|
@@ -142,7 +141,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
142
141
|
"strong",
|
|
143
142
|
null,
|
|
144
143
|
(0, Translate_1.translate)({
|
|
145
|
-
id:
|
|
144
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
146
145
|
message: "Default value:",
|
|
147
146
|
}),
|
|
148
147
|
" "
|
|
@@ -161,7 +160,7 @@ function ParamsItem({ param, ...rest }) {
|
|
|
161
160
|
"strong",
|
|
162
161
|
null,
|
|
163
162
|
(0, Translate_1.translate)({
|
|
164
|
-
id:
|
|
163
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
165
164
|
message: "Default value:",
|
|
166
165
|
}),
|
|
167
166
|
" "
|
|
@@ -23,7 +23,6 @@ const SchemaExpansion_1 = __importDefault(require("@theme/SchemaExpansion"));
|
|
|
23
23
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
24
24
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
25
25
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
26
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
27
26
|
const RequestSchemaComponent = ({ title, body, style }) => {
|
|
28
27
|
if (
|
|
29
28
|
body === undefined ||
|
|
@@ -84,7 +83,7 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
84
83
|
"openapi-markdown__details-summary-header-body",
|
|
85
84
|
},
|
|
86
85
|
(0, Translate_1.translate)({
|
|
87
|
-
id:
|
|
86
|
+
id: "theme.openapi.request.body.title",
|
|
88
87
|
message: title,
|
|
89
88
|
}),
|
|
90
89
|
body.required === true &&
|
|
@@ -92,8 +91,7 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
92
91
|
"span",
|
|
93
92
|
{ className: "openapi-schema__required" },
|
|
94
93
|
(0, Translate_1.translate)({
|
|
95
|
-
id:
|
|
96
|
-
.REQUIRED,
|
|
94
|
+
id: "theme.openapi.schemaItem.required",
|
|
97
95
|
message: "required",
|
|
98
96
|
})
|
|
99
97
|
)
|
|
@@ -193,7 +191,7 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
193
191
|
className: "openapi-markdown__details-summary-header-body",
|
|
194
192
|
},
|
|
195
193
|
(0, Translate_1.translate)({
|
|
196
|
-
id:
|
|
194
|
+
id: "theme.openapi.request.body.title",
|
|
197
195
|
message: title,
|
|
198
196
|
}),
|
|
199
197
|
firstBody.type === "array" &&
|
|
@@ -207,7 +205,7 @@ const RequestSchemaComponent = ({ title, body, style }) => {
|
|
|
207
205
|
"strong",
|
|
208
206
|
{ className: "openapi-schema__required" },
|
|
209
207
|
(0, Translate_1.translate)({
|
|
210
|
-
id:
|
|
208
|
+
id: "theme.openapi.schemaItem.required",
|
|
211
209
|
message: "required",
|
|
212
210
|
})
|
|
213
211
|
)
|
|
@@ -21,7 +21,6 @@ const Translate_1 = require("@docusaurus/Translate");
|
|
|
21
21
|
const CodeSamples_1 = __importDefault(require("@theme/CodeSamples"));
|
|
22
22
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
23
23
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
24
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
25
24
|
const createResponseExample_1 = require("docusaurus-plugin-openapi-docs/lib/openapi/createResponseExample");
|
|
26
25
|
const xml_formatter_1 = __importDefault(require("xml-formatter"));
|
|
27
26
|
function json2xml(o, tab) {
|
|
@@ -111,7 +110,7 @@ const ResponseExample = ({ responseExample, mimeType }) => {
|
|
|
111
110
|
TabItem_1.default,
|
|
112
111
|
{
|
|
113
112
|
label: (0, Translate_1.translate)({
|
|
114
|
-
id:
|
|
113
|
+
id: "theme.openapi.responseExamples.example",
|
|
115
114
|
message: "Example",
|
|
116
115
|
}),
|
|
117
116
|
value: "Example",
|
|
@@ -173,7 +172,7 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
173
172
|
TabItem_1.default,
|
|
174
173
|
{
|
|
175
174
|
label: (0, Translate_1.translate)({
|
|
176
|
-
id:
|
|
175
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
177
176
|
message: "Example (auto)",
|
|
178
177
|
}),
|
|
179
178
|
value: "Example (auto)",
|
|
@@ -196,7 +195,7 @@ const ExampleFromSchema = ({ schema, mimeType }) => {
|
|
|
196
195
|
TabItem_1.default,
|
|
197
196
|
{
|
|
198
197
|
label: (0, Translate_1.translate)({
|
|
199
|
-
id:
|
|
198
|
+
id: "theme.openapi.responseExamples.autoExample",
|
|
200
199
|
message: "Example (auto)",
|
|
201
200
|
}),
|
|
202
201
|
value: "Example (auto)",
|
|
@@ -23,7 +23,6 @@ const SchemaExpansion_1 = __importDefault(require("@theme/SchemaExpansion"));
|
|
|
23
23
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
24
24
|
const SkeletonLoader_1 = __importDefault(require("@theme/SkeletonLoader"));
|
|
25
25
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
26
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
27
26
|
const ResponseSchemaComponent = ({ title, body, style }) => {
|
|
28
27
|
if (
|
|
29
28
|
body === undefined ||
|
|
@@ -58,7 +57,7 @@ const ResponseSchemaComponent = ({ title, body, style }) => {
|
|
|
58
57
|
"div",
|
|
59
58
|
null,
|
|
60
59
|
(0, Translate_1.translate)({
|
|
61
|
-
id:
|
|
60
|
+
id: "theme.openapi.schema.noSchema",
|
|
62
61
|
message: "No schema",
|
|
63
62
|
})
|
|
64
63
|
)
|
|
@@ -101,7 +100,7 @@ const ResponseSchemaComponent = ({ title, body, style }) => {
|
|
|
101
100
|
"span",
|
|
102
101
|
{ className: "openapi-schema__required" },
|
|
103
102
|
(0, Translate_1.translate)({
|
|
104
|
-
id:
|
|
103
|
+
id: "theme.openapi.schemaItem.required",
|
|
105
104
|
message: "required",
|
|
106
105
|
})
|
|
107
106
|
)
|
|
@@ -81,7 +81,6 @@ const SchemaExpansion_1 = require("@theme/SchemaExpansion");
|
|
|
81
81
|
const SchemaItem_1 = __importDefault(require("@theme/SchemaItem"));
|
|
82
82
|
const SchemaTabs_1 = __importDefault(require("@theme/SchemaTabs"));
|
|
83
83
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
84
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
85
84
|
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
86
85
|
const allof_merge_1 = require("allof-merge");
|
|
87
86
|
const clsx_1 = __importDefault(require("clsx"));
|
|
@@ -286,7 +285,7 @@ const Summary = ({ name, schemaName, schema, required }) => {
|
|
|
286
285
|
"span",
|
|
287
286
|
{ className: "openapi-schema__nullable" },
|
|
288
287
|
(0, Translate_1.translate)({
|
|
289
|
-
id:
|
|
288
|
+
id: "theme.openapi.schemaItem.nullable",
|
|
290
289
|
message: "nullable",
|
|
291
290
|
})
|
|
292
291
|
),
|
|
@@ -295,7 +294,7 @@ const Summary = ({ name, schemaName, schema, required }) => {
|
|
|
295
294
|
"span",
|
|
296
295
|
{ className: "openapi-schema__required" },
|
|
297
296
|
(0, Translate_1.translate)({
|
|
298
|
-
id:
|
|
297
|
+
id: "theme.openapi.schemaItem.required",
|
|
299
298
|
message: "required",
|
|
300
299
|
})
|
|
301
300
|
),
|
|
@@ -304,7 +303,7 @@ const Summary = ({ name, schemaName, schema, required }) => {
|
|
|
304
303
|
"span",
|
|
305
304
|
{ className: "openapi-schema__deprecated" },
|
|
306
305
|
(0, Translate_1.translate)({
|
|
307
|
-
id:
|
|
306
|
+
id: "theme.openapi.schemaItem.deprecated",
|
|
308
307
|
message: "deprecated",
|
|
309
308
|
})
|
|
310
309
|
)
|
|
@@ -321,11 +320,11 @@ const AnyOneOf = ({ schema, schemaType, schemaPath }) => {
|
|
|
321
320
|
}
|
|
322
321
|
const type = schema.oneOf
|
|
323
322
|
? (0, Translate_1.translate)({
|
|
324
|
-
id:
|
|
323
|
+
id: "theme.openapi.schemaItem.oneOf",
|
|
325
324
|
message: "oneOf",
|
|
326
325
|
})
|
|
327
326
|
: (0, Translate_1.translate)({
|
|
328
|
-
id:
|
|
327
|
+
id: "theme.openapi.schemaItem.anyOf",
|
|
329
328
|
message: "anyOf",
|
|
330
329
|
});
|
|
331
330
|
// Generate a unique ID for this anyOf/oneOf to prevent tab value collisions
|
|
@@ -372,12 +371,12 @@ const AnyOneOf = ({ schema, schemaType, schemaPath }) => {
|
|
|
372
371
|
if (!label) {
|
|
373
372
|
if (anyOneSchema.oneOf) {
|
|
374
373
|
label = (0, Translate_1.translate)({
|
|
375
|
-
id:
|
|
374
|
+
id: "theme.openapi.schemaItem.oneOf",
|
|
376
375
|
message: "oneOf",
|
|
377
376
|
});
|
|
378
377
|
} else if (anyOneSchema.anyOf) {
|
|
379
378
|
label = (0, Translate_1.translate)({
|
|
380
|
-
id:
|
|
379
|
+
id: "theme.openapi.schemaItem.anyOf",
|
|
381
380
|
message: "anyOf",
|
|
382
381
|
});
|
|
383
382
|
} else {
|
|
@@ -546,7 +545,7 @@ const PropertyDiscriminator = ({
|
|
|
546
545
|
"span",
|
|
547
546
|
{ className: "openapi-schema__required" },
|
|
548
547
|
(0, Translate_1.translate)({
|
|
549
|
-
id:
|
|
548
|
+
id: "theme.openapi.schemaItem.required",
|
|
550
549
|
message: "required",
|
|
551
550
|
})
|
|
552
551
|
)
|
|
@@ -76,7 +76,6 @@ exports.SCHEMA_EXPANSION_STORAGE_KEY =
|
|
|
76
76
|
void 0;
|
|
77
77
|
const react_1 = __importStar(require("react"));
|
|
78
78
|
const Translate_1 = require("@docusaurus/Translate");
|
|
79
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
80
79
|
const clsx_1 = __importDefault(require("clsx"));
|
|
81
80
|
const context_1 = require("./context");
|
|
82
81
|
var context_2 = require("./context");
|
|
@@ -219,17 +218,17 @@ const SchemaExpansionControl = () => {
|
|
|
219
218
|
};
|
|
220
219
|
if (!config.enabled) return null;
|
|
221
220
|
const buttonLabel = (0, Translate_1.translate)({
|
|
222
|
-
id:
|
|
221
|
+
id: "theme.openapi.schema.expansion.button",
|
|
223
222
|
message: "Schema expansion depth",
|
|
224
223
|
description: "Aria/title tooltip for the schema expansion icon button",
|
|
225
224
|
});
|
|
226
225
|
const menuLabel = (0, Translate_1.translate)({
|
|
227
|
-
id:
|
|
226
|
+
id: "theme.openapi.schema.expansion.menu",
|
|
228
227
|
message: "Schema expansion depth options",
|
|
229
228
|
description: "Accessible label for the expansion options menu",
|
|
230
229
|
});
|
|
231
230
|
const allLabel = (0, Translate_1.translate)({
|
|
232
|
-
id:
|
|
231
|
+
id: "theme.openapi.schema.expansion.all",
|
|
233
232
|
message: "All",
|
|
234
233
|
description: "Label for the expand-all option",
|
|
235
234
|
});
|
|
@@ -279,7 +278,7 @@ const SchemaExpansionControl = () => {
|
|
|
279
278
|
? allLabel
|
|
280
279
|
: (0, Translate_1.translate)(
|
|
281
280
|
{
|
|
282
|
-
id:
|
|
281
|
+
id: "theme.openapi.schema.expansion.depthOption",
|
|
283
282
|
message: "Expand to depth {depth}",
|
|
284
283
|
description: "Accessible label for a depth option",
|
|
285
284
|
},
|
|
@@ -16,7 +16,6 @@ const react_1 = __importDefault(require("react"));
|
|
|
16
16
|
const Translate_1 = require("@docusaurus/Translate");
|
|
17
17
|
const Example_1 = require("@theme/Example");
|
|
18
18
|
const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
19
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
20
19
|
const clsx_1 = __importDefault(require("clsx"));
|
|
21
20
|
const schema_1 = require("../../markdown/schema");
|
|
22
21
|
const utils_1 = require("../../markdown/utils");
|
|
@@ -29,11 +28,11 @@ const transformEnumDescriptions = (enumDescriptions) => {
|
|
|
29
28
|
const getEnumDescriptionMarkdown = (enumDescriptions) => {
|
|
30
29
|
if (enumDescriptions?.length) {
|
|
31
30
|
const enumValue = (0, Translate_1.translate)({
|
|
32
|
-
id:
|
|
31
|
+
id: "theme.openapi.schemaItem.enumValue",
|
|
33
32
|
message: "Enum Value",
|
|
34
33
|
});
|
|
35
34
|
const description = (0, Translate_1.translate)({
|
|
36
|
-
id:
|
|
35
|
+
id: "theme.openapi.schemaItem.enumDescription",
|
|
37
36
|
message: "Description",
|
|
38
37
|
});
|
|
39
38
|
return `| ${enumValue} | ${description} |
|
|
@@ -84,7 +83,7 @@ function SchemaItem(props) {
|
|
|
84
83
|
"span",
|
|
85
84
|
{ className: "openapi-schema__required" },
|
|
86
85
|
(0, Translate_1.translate)({
|
|
87
|
-
id:
|
|
86
|
+
id: "theme.openapi.schemaItem.required",
|
|
88
87
|
message: "required",
|
|
89
88
|
})
|
|
90
89
|
)
|
|
@@ -94,7 +93,7 @@ function SchemaItem(props) {
|
|
|
94
93
|
"span",
|
|
95
94
|
{ className: "openapi-schema__deprecated" },
|
|
96
95
|
(0, Translate_1.translate)({
|
|
97
|
-
id:
|
|
96
|
+
id: "theme.openapi.schemaItem.deprecated",
|
|
98
97
|
message: "deprecated",
|
|
99
98
|
})
|
|
100
99
|
)
|
|
@@ -104,7 +103,7 @@ function SchemaItem(props) {
|
|
|
104
103
|
"span",
|
|
105
104
|
{ className: "openapi-schema__nullable" },
|
|
106
105
|
(0, Translate_1.translate)({
|
|
107
|
-
id:
|
|
106
|
+
id: "theme.openapi.schemaItem.nullable",
|
|
108
107
|
message: "nullable",
|
|
109
108
|
})
|
|
110
109
|
)
|
|
@@ -151,7 +150,7 @@ function SchemaItem(props) {
|
|
|
151
150
|
"strong",
|
|
152
151
|
null,
|
|
153
152
|
(0, Translate_1.translate)({
|
|
154
|
-
id:
|
|
153
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
155
154
|
message: "Default value:",
|
|
156
155
|
}),
|
|
157
156
|
" "
|
|
@@ -170,7 +169,7 @@ function SchemaItem(props) {
|
|
|
170
169
|
"strong",
|
|
171
170
|
null,
|
|
172
171
|
(0, Translate_1.translate)({
|
|
173
|
-
id:
|
|
172
|
+
id: "theme.openapi.schemaItem.defaultValue",
|
|
174
173
|
message: "Default value:",
|
|
175
174
|
}),
|
|
176
175
|
" "
|
|
@@ -198,7 +197,7 @@ function SchemaItem(props) {
|
|
|
198
197
|
"strong",
|
|
199
198
|
null,
|
|
200
199
|
(0, Translate_1.translate)({
|
|
201
|
-
id:
|
|
200
|
+
id: "theme.openapi.schemaItem.constantValue",
|
|
202
201
|
message: "Constant value:",
|
|
203
202
|
}),
|
|
204
203
|
" "
|
|
@@ -217,7 +216,7 @@ function SchemaItem(props) {
|
|
|
217
216
|
"strong",
|
|
218
217
|
null,
|
|
219
218
|
(0, Translate_1.translate)({
|
|
220
|
-
id:
|
|
219
|
+
id: "theme.openapi.schemaItem.constantValue",
|
|
221
220
|
message: "Constant value:",
|
|
222
221
|
}),
|
|
223
222
|
" "
|
|
@@ -69,10 +69,11 @@ var __importDefault =
|
|
|
69
69
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
70
70
|
exports.default = SchemaTabs;
|
|
71
71
|
const react_1 = __importStar(require("react"));
|
|
72
|
-
const internal_1 = require("@docusaurus/theme-common/internal");
|
|
73
72
|
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
74
73
|
const clsx_1 = __importDefault(require("clsx"));
|
|
75
74
|
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
75
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
76
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
76
77
|
function TabList({
|
|
77
78
|
className,
|
|
78
79
|
block,
|
|
@@ -83,7 +84,7 @@ function TabList({
|
|
|
83
84
|
}) {
|
|
84
85
|
const tabRefs = [];
|
|
85
86
|
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
86
|
-
|
|
87
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
87
88
|
const handleTabChange = (event) => {
|
|
88
89
|
const newTab = event.currentTarget;
|
|
89
90
|
const newTabIndex = tabRefs.indexOf(newTab);
|
|
@@ -237,9 +238,9 @@ function TabContent({ lazy, children, selectedValue }) {
|
|
|
237
238
|
);
|
|
238
239
|
}
|
|
239
240
|
function TabsComponent(props) {
|
|
240
|
-
const tabs = (0,
|
|
241
|
+
const tabs = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
241
242
|
return react_1.default.createElement(
|
|
242
|
-
|
|
243
|
+
tabsUtils_1.TabsProvider,
|
|
243
244
|
{ value: tabs },
|
|
244
245
|
react_1.default.createElement(
|
|
245
246
|
"div",
|
|
@@ -261,7 +262,7 @@ function SchemaTabs(props) {
|
|
|
261
262
|
}
|
|
262
263
|
let sanitizedChildren;
|
|
263
264
|
try {
|
|
264
|
-
sanitizedChildren = (0,
|
|
265
|
+
sanitizedChildren = (0, tabsUtils_1.sanitizeTabsChildren)(children);
|
|
265
266
|
} catch {
|
|
266
267
|
return null;
|
|
267
268
|
}
|
|
@@ -19,7 +19,6 @@ const Markdown_1 = __importDefault(require("@theme/Markdown"));
|
|
|
19
19
|
const ResponseHeaders_1 = __importDefault(require("@theme/ResponseHeaders"));
|
|
20
20
|
const ResponseSchema_1 = __importDefault(require("@theme/ResponseSchema"));
|
|
21
21
|
const TabItem_1 = __importDefault(require("@theme/TabItem"));
|
|
22
|
-
const translationIds_1 = require("@theme/translationIds");
|
|
23
22
|
const StatusCodes = ({ label, id, responses }) => {
|
|
24
23
|
if (!responses) return null;
|
|
25
24
|
const codes = Object.keys(responses);
|
|
@@ -64,8 +63,7 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
64
63
|
"strong",
|
|
65
64
|
null,
|
|
66
65
|
(0, Translate_1.translate)({
|
|
67
|
-
id:
|
|
68
|
-
.RESPONSE_HEADERS,
|
|
66
|
+
id: "theme.openapi.statusCodes.responseHeaders",
|
|
69
67
|
message: "Response Headers",
|
|
70
68
|
})
|
|
71
69
|
)
|
|
@@ -77,7 +75,7 @@ const StatusCodes = ({ label, id, responses }) => {
|
|
|
77
75
|
),
|
|
78
76
|
react_1.default.createElement(ResponseSchema_1.default, {
|
|
79
77
|
title: (0, Translate_1.translate)({
|
|
80
|
-
id:
|
|
78
|
+
id: "theme.openapi.statusCodes.schemaTitle",
|
|
81
79
|
message: "Schema",
|
|
82
80
|
}),
|
|
83
81
|
body: { content: response.content },
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
* Portions Copyright (c) Palo Alto Networks
|
|
5
|
+
*
|
|
6
|
+
* Swizzled from @docusaurus/theme-classic/src/theme/TabItem/index.tsx (MIT).
|
|
7
|
+
* Re-points useTabs to our vendored tabsUtils so that <TabItem> reads the same
|
|
8
|
+
* context our swizzled <Tabs> and OpenAPI tab variants (ApiTabs, MimeTabs,
|
|
9
|
+
* SchemaTabs, etc.) provide. See:
|
|
10
|
+
* https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/1140
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
* ========================================================================== */
|
|
15
|
+
var __importDefault =
|
|
16
|
+
(this && this.__importDefault) ||
|
|
17
|
+
function (mod) {
|
|
18
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.default = TabItem;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
24
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
25
|
+
const styles_module_css_1 = __importDefault(require("./styles.module.css"));
|
|
26
|
+
function TabItemPanel({ children, className, hidden }) {
|
|
27
|
+
return react_1.default.createElement(
|
|
28
|
+
"div",
|
|
29
|
+
{
|
|
30
|
+
role: "tabpanel",
|
|
31
|
+
className: (0, clsx_1.default)(
|
|
32
|
+
styles_module_css_1.default.tabItem,
|
|
33
|
+
className
|
|
34
|
+
),
|
|
35
|
+
hidden,
|
|
36
|
+
},
|
|
37
|
+
children
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
function TabItem({ children, className, value }) {
|
|
41
|
+
const { selectedValue, lazy } = (0, tabsUtils_1.useTabs)();
|
|
42
|
+
const isSelected = value === selectedValue;
|
|
43
|
+
if (!isSelected && lazy) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return react_1.default.createElement(
|
|
47
|
+
TabItemPanel,
|
|
48
|
+
{ className: className, hidden: !isSelected },
|
|
49
|
+
children
|
|
50
|
+
);
|
|
51
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
* Portions Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
* Portions Copyright (c) Palo Alto Networks
|
|
5
|
+
*
|
|
6
|
+
* Swizzled from @docusaurus/theme-classic/src/theme/Tabs/index.tsx (MIT).
|
|
7
|
+
* Re-points the internal hooks (useTabs, useTabsContextValue, etc.) to our
|
|
8
|
+
* vendored tabsUtils so that the entire <Tabs>/<TabItem> pair runs through a
|
|
9
|
+
* single React context owned by this package. See:
|
|
10
|
+
* https://github.com/PaloAltoNetworks/docusaurus-openapi-docs/issues/1140
|
|
11
|
+
*
|
|
12
|
+
* This source code is licensed under the MIT license found in the
|
|
13
|
+
* LICENSE file in the root directory of this source tree.
|
|
14
|
+
* ========================================================================== */
|
|
15
|
+
var __importDefault =
|
|
16
|
+
(this && this.__importDefault) ||
|
|
17
|
+
function (mod) {
|
|
18
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.default = Tabs;
|
|
22
|
+
const react_1 = __importDefault(require("react"));
|
|
23
|
+
const theme_common_1 = require("@docusaurus/theme-common");
|
|
24
|
+
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
25
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
26
|
+
const scrollUtils_1 = require("@theme/utils/scrollUtils");
|
|
27
|
+
const tabsUtils_1 = require("@theme/utils/tabsUtils");
|
|
28
|
+
const styles_module_css_1 = __importDefault(require("./styles.module.css"));
|
|
29
|
+
function TabList({ className }) {
|
|
30
|
+
const { selectedValue, selectValue, tabValues, block } = (0,
|
|
31
|
+
tabsUtils_1.useTabs)();
|
|
32
|
+
const tabRefs = [];
|
|
33
|
+
const { blockElementScrollPositionUntilNextRender } = (0,
|
|
34
|
+
scrollUtils_1.useScrollPositionBlocker)();
|
|
35
|
+
const handleTabChange = (event) => {
|
|
36
|
+
const newTab = event.currentTarget;
|
|
37
|
+
const newTabIndex = tabRefs.indexOf(newTab);
|
|
38
|
+
const newTabValue = tabValues[newTabIndex].value;
|
|
39
|
+
if (newTabValue !== selectedValue) {
|
|
40
|
+
blockElementScrollPositionUntilNextRender(newTab);
|
|
41
|
+
selectValue(newTabValue);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
const handleKeydown = (event) => {
|
|
45
|
+
let focusElement = null;
|
|
46
|
+
switch (event.key) {
|
|
47
|
+
case "Enter": {
|
|
48
|
+
handleTabChange(event);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
case "ArrowRight": {
|
|
52
|
+
const nextTab = tabRefs.indexOf(event.currentTarget) + 1;
|
|
53
|
+
focusElement = tabRefs[nextTab] ?? tabRefs[0];
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "ArrowLeft": {
|
|
57
|
+
const prevTab = tabRefs.indexOf(event.currentTarget) - 1;
|
|
58
|
+
focusElement = tabRefs[prevTab] ?? tabRefs[tabRefs.length - 1];
|
|
59
|
+
break;
|
|
60
|
+
}
|
|
61
|
+
default:
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
focusElement?.focus();
|
|
65
|
+
};
|
|
66
|
+
return react_1.default.createElement(
|
|
67
|
+
"ul",
|
|
68
|
+
{
|
|
69
|
+
role: "tablist",
|
|
70
|
+
"aria-orientation": "horizontal",
|
|
71
|
+
className: (0, clsx_1.default)(
|
|
72
|
+
"tabs",
|
|
73
|
+
{
|
|
74
|
+
"tabs--block": block,
|
|
75
|
+
},
|
|
76
|
+
className
|
|
77
|
+
),
|
|
78
|
+
},
|
|
79
|
+
tabValues.map(({ value, label, attributes }) =>
|
|
80
|
+
react_1.default.createElement(
|
|
81
|
+
"li",
|
|
82
|
+
{
|
|
83
|
+
// TODO extract TabListItem
|
|
84
|
+
role: "tab",
|
|
85
|
+
tabIndex: selectedValue === value ? 0 : -1,
|
|
86
|
+
"aria-selected": selectedValue === value,
|
|
87
|
+
key: value,
|
|
88
|
+
ref: (ref) => {
|
|
89
|
+
tabRefs.push(ref);
|
|
90
|
+
},
|
|
91
|
+
onKeyDown: handleKeydown,
|
|
92
|
+
onClick: handleTabChange,
|
|
93
|
+
...attributes,
|
|
94
|
+
className: (0, clsx_1.default)(
|
|
95
|
+
"tabs__item",
|
|
96
|
+
styles_module_css_1.default.tabItem,
|
|
97
|
+
attributes?.className,
|
|
98
|
+
{
|
|
99
|
+
"tabs__item--active": selectedValue === value,
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
},
|
|
103
|
+
label ?? value
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
);
|
|
107
|
+
}
|
|
108
|
+
function TabContent({ children }) {
|
|
109
|
+
return react_1.default.createElement(
|
|
110
|
+
"div",
|
|
111
|
+
{ className: "margin-top--md" },
|
|
112
|
+
children
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
function TabsContainer({ className, children }) {
|
|
116
|
+
return react_1.default.createElement(
|
|
117
|
+
"div",
|
|
118
|
+
{
|
|
119
|
+
className: (0, clsx_1.default)(
|
|
120
|
+
theme_common_1.ThemeClassNames.tabs.container,
|
|
121
|
+
// former name kept for backward compatibility
|
|
122
|
+
// see https://github.com/facebook/docusaurus/pull/4086
|
|
123
|
+
"tabs-container",
|
|
124
|
+
styles_module_css_1.default.tabList
|
|
125
|
+
),
|
|
126
|
+
},
|
|
127
|
+
react_1.default.createElement(TabList, { className: className }),
|
|
128
|
+
react_1.default.createElement(TabContent, null, children)
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
function Tabs(props) {
|
|
132
|
+
const isBrowser = (0, useIsBrowser_1.default)();
|
|
133
|
+
const value = (0, tabsUtils_1.useTabsContextValue)(props);
|
|
134
|
+
return react_1.default.createElement(
|
|
135
|
+
tabsUtils_1.TabsProvider,
|
|
136
|
+
{
|
|
137
|
+
value: value,
|
|
138
|
+
// Remount tabs after hydration
|
|
139
|
+
// Temporary fix for https://github.com/facebook/docusaurus/issues/5653
|
|
140
|
+
key: String(isBrowser),
|
|
141
|
+
},
|
|
142
|
+
react_1.default.createElement(
|
|
143
|
+
TabsContainer,
|
|
144
|
+
{ className: props.className },
|
|
145
|
+
(0, tabsUtils_1.sanitizeTabsChildren)(props.children)
|
|
146
|
+
)
|
|
147
|
+
);
|
|
148
|
+
}
|