docusaurus-theme-openapi-docs 3.0.0-beta.1 → 3.0.0-beta.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/markdown/utils.d.ts +3 -2
- package/lib/markdown/utils.js +1 -1
- package/lib/markdown/utils.test.d.ts +1 -0
- package/lib/markdown/utils.test.js +43 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +13 -0
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +199 -124
- package/lib/theme/ApiExplorer/Accept/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +115 -96
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +200 -120
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
- package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
- package/lib/theme/ApiExplorer/Authorization/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Body/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Body/index.js +8 -1
- package/lib/theme/ApiExplorer/Body/slice.d.ts +3 -3
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
- package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
- package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +4 -14
- package/lib/theme/ApiExplorer/CodeSnippets/index.js +86 -8
- package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +3 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.js +48 -0
- package/lib/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
- package/lib/theme/ApiExplorer/CodeTabs/index.js +131 -76
- package/lib/theme/ApiExplorer/ContentType/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Export/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormSelect/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +1 -1
- package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
- package/lib/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/lib/theme/ApiExplorer/Request/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Request/makeRequest.js +50 -1
- package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/lib/theme/ApiExplorer/Response/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Response/index.js +19 -19
- package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/Server/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
- package/lib/theme/ApiExplorer/index.d.ts +2 -2
- package/lib/theme/ApiExplorer/index.js +1 -1
- package/lib/theme/ApiExplorer/storage-utils.d.ts +1 -1
- package/lib/theme/ApiItem/index.js +28 -3
- package/lib/theme/ApiItem/store.d.ts +6 -6
- package/lib/theme/ApiLogo/index.d.ts +2 -2
- package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/lib/theme/ApiTabs/index.d.ts +7 -0
- package/lib/theme/ApiTabs/index.js +167 -103
- package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
- package/lib/theme/DiscriminatorTabs/index.js +152 -98
- package/lib/theme/Markdown/index.js +37 -0
- package/lib/theme/MimeTabs/index.d.ts +6 -0
- package/lib/theme/MimeTabs/index.js +169 -118
- package/lib/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/lib/theme/OperationTabs/index.d.ts +3 -0
- package/lib/theme/OperationTabs/index.js +234 -0
- package/lib/theme/ParamsItem/index.d.ts +23 -0
- package/lib/theme/ParamsItem/index.js +170 -111
- package/lib/theme/ResponseSamples/index.d.ts +8 -0
- package/lib/theme/ResponseSamples/index.js +18 -13
- package/lib/theme/SchemaItem/index.d.ts +12 -0
- package/lib/theme/SchemaItem/index.js +121 -89
- package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/lib/theme/SchemaTabs/index.d.ts +3 -0
- package/lib/theme/SchemaTabs/index.js +148 -95
- package/lib/theme/styles.scss +5 -0
- package/lib/types.d.ts +4 -4
- package/package.json +8 -7
- package/src/markdown/utils.test.ts +49 -0
- package/src/markdown/utils.ts +5 -3
- package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +21 -8
- package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +4 -4
- package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
- package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +12 -2
- package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
- package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
- package/src/theme/ApiExplorer/Body/index.tsx +3 -1
- package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +55 -0
- package/src/theme/ApiExplorer/CodeSnippets/index.tsx +94 -21
- package/src/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
- package/src/theme/ApiExplorer/CodeSnippets/languages.ts +53 -0
- package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
- package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +64 -25
- package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
- package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
- package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
- package/src/theme/ApiExplorer/Request/_Request.scss +4 -2
- package/src/theme/ApiExplorer/Request/makeRequest.ts +59 -4
- package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
- package/src/theme/ApiExplorer/Response/index.tsx +2 -2
- package/src/theme/ApiExplorer/index.tsx +1 -1
- package/src/theme/ApiItem/index.tsx +22 -3
- package/src/theme/ApiLogo/index.tsx +1 -1
- package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
- package/src/theme/ApiTabs/{index.js → index.tsx} +75 -31
- package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +63 -28
- package/src/theme/Markdown/index.js +37 -0
- package/src/theme/MimeTabs/{index.js → index.tsx} +64 -30
- package/src/theme/OperationTabs/_OperationTabs.scss +71 -0
- package/src/theme/OperationTabs/index.tsx +218 -0
- package/src/theme/ParamsItem/{index.js → index.tsx} +48 -17
- package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
- package/src/theme/SchemaItem/{index.js → index.tsx} +24 -18
- package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
- package/src/theme/SchemaTabs/{index.js → index.tsx} +62 -29
- package/src/theme/styles.scss +5 -0
- package/src/theme-classic.d.ts +69 -2
- package/src/theme-openapi.d.ts +6 -0
- package/tsconfig.json +4 -1
|
@@ -1,23 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
8
|
+
var __createBinding =
|
|
9
|
+
(this && this.__createBinding) ||
|
|
10
|
+
(Object.create
|
|
11
|
+
? function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (
|
|
15
|
+
!desc ||
|
|
16
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
17
|
+
) {
|
|
18
|
+
desc = {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return m[k];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(o, k2, desc);
|
|
26
|
+
}
|
|
27
|
+
: function (o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
});
|
|
31
|
+
var __setModuleDefault =
|
|
32
|
+
(this && this.__setModuleDefault) ||
|
|
33
|
+
(Object.create
|
|
34
|
+
? function (o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}
|
|
37
|
+
: function (o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar =
|
|
41
|
+
(this && this.__importStar) ||
|
|
42
|
+
function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null)
|
|
46
|
+
for (var k in mod)
|
|
47
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
48
|
+
__createBinding(result, mod, k);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
var __importDefault =
|
|
53
|
+
(this && this.__importDefault) ||
|
|
54
|
+
function (mod) {
|
|
55
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const theme_common_1 = require("@docusaurus/theme-common");
|
|
60
|
+
const Translate_1 = require("@docusaurus/Translate");
|
|
61
|
+
const Container_1 = __importDefault(
|
|
62
|
+
require("@theme/ApiExplorer/ApiCodeBlock/Container")
|
|
63
|
+
);
|
|
64
|
+
const CopyButton_1 = __importDefault(
|
|
65
|
+
require("@theme/ApiExplorer/ApiCodeBlock/CopyButton")
|
|
66
|
+
);
|
|
67
|
+
const ExitButton_1 = __importDefault(
|
|
68
|
+
require("@theme/ApiExplorer/ApiCodeBlock/ExitButton")
|
|
69
|
+
);
|
|
70
|
+
const Line_1 = __importDefault(require("@theme/ApiExplorer/ApiCodeBlock/Line"));
|
|
71
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
72
|
+
const prism_react_renderer_1 = require("prism-react-renderer");
|
|
73
|
+
const react_modal_1 = __importDefault(require("react-modal"));
|
|
74
|
+
function ExpandButton({
|
|
21
75
|
code,
|
|
22
76
|
className,
|
|
23
77
|
language,
|
|
@@ -26,131 +80,157 @@ export default function ExpandButton({
|
|
|
26
80
|
title,
|
|
27
81
|
lineClassNames,
|
|
28
82
|
}) {
|
|
29
|
-
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
30
|
-
const prismTheme = usePrismTheme();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
Modal.setAppElement("body");
|
|
83
|
+
const [isModalOpen, setIsModalOpen] = (0, react_1.useState)(false);
|
|
84
|
+
const prismTheme = (0, theme_common_1.usePrismTheme)();
|
|
85
|
+
(0, react_1.useEffect)(() => {
|
|
86
|
+
react_modal_1.default.setAppElement("body");
|
|
34
87
|
}, []);
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
title
|
|
88
|
+
return react_1.default.createElement(
|
|
89
|
+
react_1.default.Fragment,
|
|
90
|
+
null,
|
|
91
|
+
react_1.default.createElement(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
type: "button",
|
|
95
|
+
"aria-label": isModalOpen
|
|
96
|
+
? (0, Translate_1.translate)({
|
|
97
|
+
id: "theme.CodeBlock.expanded",
|
|
98
|
+
message: "Expanded",
|
|
99
|
+
description: "The expanded button label on code blocks",
|
|
100
|
+
})
|
|
101
|
+
: (0, Translate_1.translate)({
|
|
102
|
+
id: "theme.CodeBlock.expandButtonAriaLabel",
|
|
103
|
+
message: "Expand code to fullscreen",
|
|
104
|
+
description: "The ARIA label for expand code blocks button",
|
|
105
|
+
}),
|
|
106
|
+
title: (0, Translate_1.translate)({
|
|
54
107
|
id: "theme.CodeBlock.expand",
|
|
55
108
|
message: "Expand",
|
|
56
109
|
description: "The expand button label on code blocks",
|
|
57
|
-
})
|
|
58
|
-
className
|
|
110
|
+
}),
|
|
111
|
+
className: (0, clsx_1.default)(
|
|
59
112
|
"clean-btn",
|
|
60
113
|
className,
|
|
61
114
|
"openapi-explorer__code-block-expand-btn",
|
|
62
115
|
isModalOpen && "openapi-explorer__code-block-expand-btn--copied"
|
|
63
|
-
)
|
|
64
|
-
onClick
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
116
|
+
),
|
|
117
|
+
onClick: () => setIsModalOpen(true),
|
|
118
|
+
},
|
|
119
|
+
react_1.default.createElement(
|
|
120
|
+
"span",
|
|
121
|
+
{
|
|
122
|
+
className: "openapi-explorer__code-block-expand-btn-icons",
|
|
123
|
+
"aria-hidden": "true",
|
|
124
|
+
},
|
|
125
|
+
react_1.default.createElement(
|
|
126
|
+
"svg",
|
|
127
|
+
{
|
|
128
|
+
className: "openapi-explorer__code-block-expand-btn-icon",
|
|
129
|
+
viewBox: "0 0 448 512",
|
|
130
|
+
},
|
|
131
|
+
react_1.default.createElement("path", {
|
|
132
|
+
d: "M32 32C14.3 32 0 46.3 0 64v96c0 17.7 14.3 32 32 32s32-14.3 32-32V96h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H64V352zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32h64v64c0 17.7 14.3 32 32 32s32-14.3 32-32V64c0-17.7-14.3-32-32-32H320zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32V352z",
|
|
133
|
+
})
|
|
134
|
+
),
|
|
135
|
+
react_1.default.createElement(
|
|
136
|
+
"svg",
|
|
137
|
+
{
|
|
138
|
+
className: "openapi-explorer__code-block-expand-btn-icon--success",
|
|
139
|
+
viewBox: "0 0 24 24",
|
|
140
|
+
},
|
|
141
|
+
react_1.default.createElement("path", {
|
|
142
|
+
d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",
|
|
143
|
+
})
|
|
144
|
+
)
|
|
145
|
+
)
|
|
146
|
+
),
|
|
147
|
+
react_1.default.createElement(
|
|
148
|
+
react_modal_1.default,
|
|
149
|
+
{
|
|
150
|
+
className: "openapi-explorer__expand-modal-content",
|
|
151
|
+
overlayClassName: "openapi-explorer__expand-modal-overlay",
|
|
152
|
+
isOpen: isModalOpen,
|
|
153
|
+
onRequestClose: () => setIsModalOpen(false),
|
|
154
|
+
contentLabel: "Code Snippet",
|
|
155
|
+
},
|
|
156
|
+
react_1.default.createElement(
|
|
157
|
+
Container_1.default,
|
|
158
|
+
{
|
|
159
|
+
as: "div",
|
|
160
|
+
className: (0, clsx_1.default)(
|
|
94
161
|
"openapi-explorer__code-block-container",
|
|
95
162
|
language &&
|
|
96
163
|
!blockClassName.includes(`language-${language}`) &&
|
|
97
164
|
`language-${language}`
|
|
98
|
-
)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
165
|
+
),
|
|
166
|
+
},
|
|
167
|
+
title &&
|
|
168
|
+
react_1.default.createElement(
|
|
169
|
+
"div",
|
|
170
|
+
{ className: "openapi-explorer__code-block-title" },
|
|
171
|
+
title
|
|
172
|
+
),
|
|
173
|
+
react_1.default.createElement(
|
|
174
|
+
"div",
|
|
175
|
+
{ className: "openapi-explorer__code-block-content" },
|
|
176
|
+
react_1.default.createElement(
|
|
177
|
+
prism_react_renderer_1.Highlight,
|
|
178
|
+
// {...defaultProps}
|
|
179
|
+
{
|
|
105
180
|
// {...defaultProps}
|
|
106
|
-
theme
|
|
107
|
-
code
|
|
108
|
-
language
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
181
|
+
theme: prismTheme,
|
|
182
|
+
code: code,
|
|
183
|
+
language: language ?? "text",
|
|
184
|
+
},
|
|
185
|
+
({ className, tokens, getLineProps, getTokenProps }) =>
|
|
186
|
+
react_1.default.createElement(
|
|
187
|
+
"pre",
|
|
188
|
+
{
|
|
112
189
|
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
113
|
-
tabIndex
|
|
114
|
-
className
|
|
190
|
+
tabIndex: 0,
|
|
191
|
+
className: (0, clsx_1.default)(
|
|
115
192
|
className,
|
|
116
193
|
"openapi-explorer__code-block",
|
|
117
194
|
"thin-scrollbar"
|
|
118
|
-
)
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
195
|
+
),
|
|
196
|
+
},
|
|
197
|
+
react_1.default.createElement(
|
|
198
|
+
"code",
|
|
199
|
+
{
|
|
200
|
+
className: (0, clsx_1.default)(
|
|
122
201
|
"openapi-explorer__code-block-lines",
|
|
123
202
|
showLineNumbers &&
|
|
124
203
|
"openapi-explorer__code-block-lines-numbers"
|
|
125
|
-
)
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
204
|
+
),
|
|
205
|
+
},
|
|
206
|
+
tokens.map((line, i) =>
|
|
207
|
+
react_1.default.createElement(Line_1.default, {
|
|
208
|
+
key: i,
|
|
209
|
+
line: line,
|
|
210
|
+
getLineProps: getLineProps,
|
|
211
|
+
getTokenProps: getTokenProps,
|
|
212
|
+
classNames: lineClassNames[i],
|
|
213
|
+
showLineNumbers: showLineNumbers,
|
|
214
|
+
})
|
|
215
|
+
)
|
|
216
|
+
)
|
|
217
|
+
)
|
|
218
|
+
),
|
|
219
|
+
react_1.default.createElement(
|
|
220
|
+
"div",
|
|
221
|
+
{ className: "openapi-explorer__code-block-btn-group" },
|
|
222
|
+
react_1.default.createElement(CopyButton_1.default, {
|
|
223
|
+
className: "openapi-explorer__code-block-code-btn",
|
|
224
|
+
code: code,
|
|
225
|
+
}),
|
|
226
|
+
react_1.default.createElement(ExitButton_1.default, {
|
|
227
|
+
className: "openapi-explorer__code-block-code-btn",
|
|
228
|
+
handler: () => setIsModalOpen(false),
|
|
229
|
+
})
|
|
230
|
+
)
|
|
231
|
+
)
|
|
232
|
+
)
|
|
233
|
+
)
|
|
155
234
|
);
|
|
156
235
|
}
|
|
236
|
+
exports.default = ExpandButton;
|
|
@@ -1,15 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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 clsx_1 = __importDefault(require("clsx"));
|
|
16
|
+
function CodeBlockLine({
|
|
13
17
|
line,
|
|
14
18
|
classNames,
|
|
15
19
|
showLineNumbers,
|
|
@@ -21,27 +25,35 @@ export default function CodeBlockLine({
|
|
|
21
25
|
}
|
|
22
26
|
const lineProps = getLineProps({
|
|
23
27
|
line,
|
|
24
|
-
className:
|
|
28
|
+
className: (0, clsx_1.default)(
|
|
25
29
|
classNames,
|
|
26
30
|
showLineNumbers && "openapi-explorer__code-block-code-line"
|
|
27
31
|
),
|
|
28
32
|
});
|
|
29
|
-
const lineTokens = line.map((token, key) =>
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
33
|
+
const lineTokens = line.map((token, key) =>
|
|
34
|
+
react_1.default.createElement("span", {
|
|
35
|
+
key: key,
|
|
36
|
+
...getTokenProps({ token, key }),
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
return react_1.default.createElement(
|
|
40
|
+
"span",
|
|
41
|
+
{ ...lineProps },
|
|
42
|
+
showLineNumbers
|
|
43
|
+
? react_1.default.createElement(
|
|
44
|
+
react_1.default.Fragment,
|
|
45
|
+
null,
|
|
46
|
+
react_1.default.createElement("span", {
|
|
47
|
+
className: "openapi-explorer__code-block-code-line-number",
|
|
48
|
+
}),
|
|
49
|
+
react_1.default.createElement(
|
|
50
|
+
"span",
|
|
51
|
+
{ className: "openapi-explorer__code-block-code-line-content" },
|
|
52
|
+
lineTokens
|
|
53
|
+
)
|
|
54
|
+
)
|
|
55
|
+
: lineTokens,
|
|
56
|
+
react_1.default.createElement("br", null)
|
|
46
57
|
);
|
|
47
58
|
}
|
|
59
|
+
exports.default = CodeBlockLine;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface Props {
|
|
3
|
+
readonly className?: string;
|
|
4
|
+
readonly onClick: React.MouseEventHandler;
|
|
5
|
+
readonly isEnabled: boolean;
|
|
6
|
+
}
|
|
7
|
+
export default function WordWrapButton({ className, onClick, isEnabled, }: Props): React.JSX.Element | null;
|
|
@@ -1,44 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 Translate_1 = require("@docusaurus/Translate");
|
|
16
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
17
|
+
function WordWrapButton({ className, onClick, isEnabled }) {
|
|
18
|
+
const title = (0, Translate_1.translate)({
|
|
15
19
|
id: "theme.CodeBlock.wordWrapToggle",
|
|
16
20
|
message: "Toggle word wrap",
|
|
17
21
|
description:
|
|
18
22
|
"The title attribute for toggle word wrapping button of code block lines",
|
|
19
23
|
});
|
|
20
|
-
return (
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
24
|
+
return react_1.default.createElement(
|
|
25
|
+
"button",
|
|
26
|
+
{
|
|
27
|
+
type: "button",
|
|
28
|
+
onClick: onClick,
|
|
29
|
+
className: (0, clsx_1.default)(
|
|
25
30
|
"clean-btn",
|
|
26
31
|
className,
|
|
27
32
|
isEnabled && "openapi-explorer__code-block-word-wrap-btn--enabled"
|
|
28
|
-
)
|
|
29
|
-
aria-label
|
|
30
|
-
title
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
),
|
|
34
|
+
"aria-label": title,
|
|
35
|
+
title: title,
|
|
36
|
+
},
|
|
37
|
+
react_1.default.createElement(
|
|
38
|
+
"svg",
|
|
39
|
+
{
|
|
40
|
+
className: "openapi-explorer__code-block-word-wrap-btn-icon",
|
|
41
|
+
viewBox: "0 0 24 24",
|
|
42
|
+
"aria-hidden": "true",
|
|
43
|
+
},
|
|
44
|
+
react_1.default.createElement("path", {
|
|
45
|
+
fill: "currentColor",
|
|
46
|
+
d: "M4 19h6v-2H4v2zM20 5H4v2h16V5zm-3 6H4v2h13.25c1.1 0 2 .9 2 2s-.9 2-2 2H15v-2l-3 3l3 3v-2h2c2.21 0 4-1.79 4-4s-1.79-4-4-4z",
|
|
47
|
+
})
|
|
48
|
+
)
|
|
43
49
|
);
|
|
44
50
|
}
|
|
51
|
+
exports.default = WordWrapButton;
|
|
@@ -1,15 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
1
2
|
/* ============================================================================
|
|
2
3
|
* Copyright (c) Palo Alto Networks
|
|
3
4
|
*
|
|
4
5
|
* This source code is licensed under the MIT license found in the
|
|
5
6
|
* LICENSE file in the root directory of this source tree.
|
|
6
7
|
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
var __createBinding =
|
|
9
|
+
(this && this.__createBinding) ||
|
|
10
|
+
(Object.create
|
|
11
|
+
? function (o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (
|
|
15
|
+
!desc ||
|
|
16
|
+
("get" in desc ? !m.__esModule : desc.writable || desc.configurable)
|
|
17
|
+
) {
|
|
18
|
+
desc = {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return m[k];
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
Object.defineProperty(o, k2, desc);
|
|
26
|
+
}
|
|
27
|
+
: function (o, m, k, k2) {
|
|
28
|
+
if (k2 === undefined) k2 = k;
|
|
29
|
+
o[k2] = m[k];
|
|
30
|
+
});
|
|
31
|
+
var __setModuleDefault =
|
|
32
|
+
(this && this.__setModuleDefault) ||
|
|
33
|
+
(Object.create
|
|
34
|
+
? function (o, v) {
|
|
35
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
36
|
+
}
|
|
37
|
+
: function (o, v) {
|
|
38
|
+
o["default"] = v;
|
|
39
|
+
});
|
|
40
|
+
var __importStar =
|
|
41
|
+
(this && this.__importStar) ||
|
|
42
|
+
function (mod) {
|
|
43
|
+
if (mod && mod.__esModule) return mod;
|
|
44
|
+
var result = {};
|
|
45
|
+
if (mod != null)
|
|
46
|
+
for (var k in mod)
|
|
47
|
+
if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k))
|
|
48
|
+
__createBinding(result, mod, k);
|
|
49
|
+
__setModuleDefault(result, mod);
|
|
50
|
+
return result;
|
|
51
|
+
};
|
|
52
|
+
var __importDefault =
|
|
53
|
+
(this && this.__importDefault) ||
|
|
54
|
+
function (mod) {
|
|
55
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
56
|
+
};
|
|
57
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
58
|
+
const react_1 = __importStar(require("react"));
|
|
59
|
+
const useIsBrowser_1 = __importDefault(require("@docusaurus/useIsBrowser"));
|
|
60
|
+
const Element_1 = __importDefault(
|
|
61
|
+
require("@theme/ApiExplorer/ApiCodeBlock/Content/Element")
|
|
62
|
+
);
|
|
63
|
+
const String_1 = __importDefault(
|
|
64
|
+
require("@theme/ApiExplorer/ApiCodeBlock/Content/String")
|
|
65
|
+
);
|
|
13
66
|
/**
|
|
14
67
|
* Best attempt to make the children a plain string so it is copyable. If there
|
|
15
68
|
* are react elements, we will not be able to copy the content, and it will
|
|
@@ -17,24 +70,29 @@ import StringContent from "@theme/ApiExplorer/ApiCodeBlock/Content/String";
|
|
|
17
70
|
* together.
|
|
18
71
|
*/
|
|
19
72
|
function maybeStringifyChildren(children) {
|
|
20
|
-
if (
|
|
73
|
+
if (
|
|
74
|
+
react_1.default.Children.toArray(children).some((el) =>
|
|
75
|
+
(0, react_1.isValidElement)(el)
|
|
76
|
+
)
|
|
77
|
+
) {
|
|
21
78
|
return children;
|
|
22
79
|
}
|
|
23
80
|
// The children is now guaranteed to be one/more plain strings
|
|
24
81
|
return Array.isArray(children) ? children.join("") : children;
|
|
25
82
|
}
|
|
26
|
-
|
|
83
|
+
function ApiCodeBlock({ children: rawChildren, ...props }) {
|
|
27
84
|
// The Prism theme on SSR is always the default theme but the site theme can
|
|
28
85
|
// be in a different mode. React hydration doesn't update DOM styles that come
|
|
29
86
|
// from SSR. Hence force a re-render after mounting to apply the current
|
|
30
87
|
// relevant styles.
|
|
31
|
-
const isBrowser =
|
|
88
|
+
const isBrowser = (0, useIsBrowser_1.default)();
|
|
32
89
|
const children = maybeStringifyChildren(rawChildren);
|
|
33
90
|
const CodeBlockComp =
|
|
34
|
-
typeof children === "string" ?
|
|
35
|
-
return (
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
91
|
+
typeof children === "string" ? String_1.default : Element_1.default;
|
|
92
|
+
return react_1.default.createElement(
|
|
93
|
+
CodeBlockComp,
|
|
94
|
+
{ key: String(isBrowser), ...props },
|
|
95
|
+
children
|
|
39
96
|
);
|
|
40
97
|
}
|
|
98
|
+
exports.default = ApiCodeBlock;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
declare function Authorization(): JSX.Element | null;
|
|
1
|
+
import React from "react";
|
|
2
|
+
declare function Authorization(): React.JSX.Element | null;
|
|
3
3
|
export default Authorization;
|