docusaurus-theme-openapi-docs 0.0.0-beta.736 → 0.0.0-beta.740
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/theme/ApiExplorer/Body/slice.d.ts +8 -8
- package/package.json +3 -3
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +0 -13
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +0 -240
- package/lib/theme/ApiDemoPanel/ApiCodeBlock/Line/_Line.scss +0 -46
- package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.tsx +0 -178
- package/src/theme/ApiDemoPanel/ApiCodeBlock/Line/_Line.scss +0 -46
|
@@ -26,18 +26,18 @@ export interface EmptyBody {
|
|
|
26
26
|
}
|
|
27
27
|
export type Body = EmptyBody | FormBody | RawBody;
|
|
28
28
|
export type State = Body;
|
|
29
|
-
export declare const slice: import("@reduxjs/toolkit").Slice<
|
|
30
|
-
clearRawBody: (_state: import("immer/dist/internal").WritableDraft<
|
|
29
|
+
export declare const slice: import("@reduxjs/toolkit").Slice<FormBody | RawBody | EmptyBody, {
|
|
30
|
+
clearRawBody: (_state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>) => {
|
|
31
31
|
type: "empty";
|
|
32
32
|
};
|
|
33
|
-
setStringRawBody: (_state: import("immer/dist/internal").WritableDraft<
|
|
33
|
+
setStringRawBody: (_state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>, action: PayloadAction<string>) => {
|
|
34
34
|
type: "raw";
|
|
35
35
|
content: {
|
|
36
36
|
type: "string";
|
|
37
37
|
value: string;
|
|
38
38
|
};
|
|
39
39
|
};
|
|
40
|
-
setFileRawBody: (_state: import("immer/dist/internal").WritableDraft<
|
|
40
|
+
setFileRawBody: (_state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>, action: PayloadAction<FileContent["value"]>) => {
|
|
41
41
|
type: "raw";
|
|
42
42
|
content: {
|
|
43
43
|
type: "file";
|
|
@@ -47,12 +47,12 @@ export declare const slice: import("@reduxjs/toolkit").Slice<EmptyBody | FormBod
|
|
|
47
47
|
};
|
|
48
48
|
};
|
|
49
49
|
};
|
|
50
|
-
clearFormBodyKey: (state: import("immer/dist/internal").WritableDraft<
|
|
51
|
-
setStringFormBody: (state: import("immer/dist/internal").WritableDraft<
|
|
50
|
+
clearFormBodyKey: (state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>, action: PayloadAction<string>) => void;
|
|
51
|
+
setStringFormBody: (state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>, action: PayloadAction<{
|
|
52
52
|
key: string;
|
|
53
53
|
value: string;
|
|
54
54
|
}>) => import("immer/dist/internal").WritableDraft<FormBody>;
|
|
55
|
-
setFileFormBody: (state: import("immer/dist/internal").WritableDraft<
|
|
55
|
+
setFileFormBody: (state: import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody> | import("immer/dist/internal").WritableDraft<EmptyBody>, action: PayloadAction<{
|
|
56
56
|
key: string;
|
|
57
57
|
value: FileContent["value"];
|
|
58
58
|
}>) => import("immer/dist/internal").WritableDraft<FormBody> | {
|
|
@@ -78,5 +78,5 @@ export declare const clearRawBody: import("@reduxjs/toolkit").ActionCreatorWitho
|
|
|
78
78
|
key: string;
|
|
79
79
|
value: FileContent["value"];
|
|
80
80
|
}, "body/setFileFormBody">;
|
|
81
|
-
declare const _default: import("redux").Reducer<
|
|
81
|
+
declare const _default: import("redux").Reducer<FormBody | RawBody | EmptyBody, import("redux").AnyAction>;
|
|
82
82
|
export default _default;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docusaurus-theme-openapi-docs",
|
|
3
3
|
"description": "OpenAPI theme for Docusaurus.",
|
|
4
|
-
"version": "0.0.0-beta.
|
|
4
|
+
"version": "0.0.0-beta.740",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"openapi",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"clsx": "^1.1.1",
|
|
45
45
|
"copy-text-to-clipboard": "^3.1.0",
|
|
46
46
|
"crypto-js": "^4.1.1",
|
|
47
|
-
"docusaurus-plugin-openapi-docs": "0.0.0-beta.
|
|
47
|
+
"docusaurus-plugin-openapi-docs": "0.0.0-beta.740",
|
|
48
48
|
"docusaurus-plugin-sass": "^0.2.3",
|
|
49
49
|
"file-saver": "^2.0.5",
|
|
50
50
|
"lodash": "^4.17.20",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"engines": {
|
|
70
70
|
"node": ">=14"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b45ebece30ec50a563de43ab0b49526bd7ed9b77"
|
|
73
73
|
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { type Language } from "prism-react-renderer";
|
|
3
|
-
interface Props {
|
|
4
|
-
code: string;
|
|
5
|
-
className: string;
|
|
6
|
-
language: Language;
|
|
7
|
-
showLineNumbers: boolean;
|
|
8
|
-
blockClassName: string;
|
|
9
|
-
title: string;
|
|
10
|
-
lineClassNames: string[];
|
|
11
|
-
}
|
|
12
|
-
export default function ExpandButton({ code, className, language, showLineNumbers, blockClassName, title, lineClassNames, }: Props): React.JSX.Element;
|
|
13
|
-
export {};
|
|
@@ -1,240 +0,0 @@
|
|
|
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 __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
|
-
// @ts-ignore
|
|
62
|
-
const Container_1 = __importDefault(
|
|
63
|
-
require("@theme/ApiExplorer/ApiCodeBlock/Container")
|
|
64
|
-
);
|
|
65
|
-
// @ts-ignore
|
|
66
|
-
const CopyButton_1 = __importDefault(
|
|
67
|
-
require("@theme/ApiExplorer/ApiCodeBlock/CopyButton")
|
|
68
|
-
);
|
|
69
|
-
// @ts-ignore
|
|
70
|
-
const ExitButton_1 = __importDefault(
|
|
71
|
-
require("@theme/ApiExplorer/ApiCodeBlock/ExitButton")
|
|
72
|
-
);
|
|
73
|
-
// @ts-ignore
|
|
74
|
-
const Line_1 = __importDefault(require("@theme/ApiExplorer/ApiCodeBlock/Line"));
|
|
75
|
-
const clsx_1 = __importDefault(require("clsx"));
|
|
76
|
-
const prism_react_renderer_1 = require("prism-react-renderer");
|
|
77
|
-
const react_modal_1 = __importDefault(require("react-modal"));
|
|
78
|
-
function ExpandButton({
|
|
79
|
-
code,
|
|
80
|
-
className,
|
|
81
|
-
language,
|
|
82
|
-
showLineNumbers,
|
|
83
|
-
blockClassName,
|
|
84
|
-
title,
|
|
85
|
-
lineClassNames,
|
|
86
|
-
}) {
|
|
87
|
-
const prismTheme = (0, theme_common_1.usePrismTheme)();
|
|
88
|
-
function openModal() {
|
|
89
|
-
setIsOpen(true);
|
|
90
|
-
}
|
|
91
|
-
function closeModal() {
|
|
92
|
-
setIsOpen(false);
|
|
93
|
-
}
|
|
94
|
-
const [modalIsOpen, setIsOpen] = react_1.default.useState(false);
|
|
95
|
-
(0, react_1.useEffect)(() => {
|
|
96
|
-
react_modal_1.default.setAppElement("body");
|
|
97
|
-
});
|
|
98
|
-
return react_1.default.createElement(
|
|
99
|
-
react_1.default.Fragment,
|
|
100
|
-
null,
|
|
101
|
-
react_1.default.createElement(
|
|
102
|
-
"button",
|
|
103
|
-
{
|
|
104
|
-
type: "button",
|
|
105
|
-
"aria-label": modalIsOpen
|
|
106
|
-
? (0, Translate_1.translate)({
|
|
107
|
-
id: "theme.CodeBlock.expanded",
|
|
108
|
-
message: "Expanded",
|
|
109
|
-
description: "The expanded button label on code blocks",
|
|
110
|
-
})
|
|
111
|
-
: (0, Translate_1.translate)({
|
|
112
|
-
id: "theme.CodeBlock.expandButtonAriaLabel",
|
|
113
|
-
message: "Expand code to fullscreen",
|
|
114
|
-
description: "The ARIA label for expand code blocks button",
|
|
115
|
-
}),
|
|
116
|
-
title: (0, Translate_1.translate)({
|
|
117
|
-
id: "theme.CodeBlock.expand",
|
|
118
|
-
message: "Expand",
|
|
119
|
-
description: "The expand button label on code blocks",
|
|
120
|
-
}),
|
|
121
|
-
className: (0, clsx_1.default)(
|
|
122
|
-
"clean-btn",
|
|
123
|
-
className,
|
|
124
|
-
"openapi-explorer__code-block-expand-btn",
|
|
125
|
-
modalIsOpen && "openapi-explorer__code-block-expand-btn--copied"
|
|
126
|
-
),
|
|
127
|
-
onClick: openModal,
|
|
128
|
-
},
|
|
129
|
-
react_1.default.createElement(
|
|
130
|
-
"span",
|
|
131
|
-
{
|
|
132
|
-
className: "openapi-explorer__code-block-expand-btn-icons",
|
|
133
|
-
"aria-hidden": "true",
|
|
134
|
-
},
|
|
135
|
-
react_1.default.createElement(
|
|
136
|
-
"svg",
|
|
137
|
-
{
|
|
138
|
-
className: "openapi-explorer__code-block-expand-btn-icon",
|
|
139
|
-
viewBox: "0 0 448 512",
|
|
140
|
-
},
|
|
141
|
-
react_1.default.createElement("path", {
|
|
142
|
-
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",
|
|
143
|
-
})
|
|
144
|
-
),
|
|
145
|
-
react_1.default.createElement(
|
|
146
|
-
"svg",
|
|
147
|
-
{
|
|
148
|
-
className: "openapi-explorer__code-block-expand-btn-icon--success",
|
|
149
|
-
viewBox: "0 0 24 24",
|
|
150
|
-
},
|
|
151
|
-
react_1.default.createElement("path", {
|
|
152
|
-
d: "M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",
|
|
153
|
-
})
|
|
154
|
-
)
|
|
155
|
-
)
|
|
156
|
-
),
|
|
157
|
-
react_1.default.createElement(
|
|
158
|
-
react_modal_1.default,
|
|
159
|
-
{
|
|
160
|
-
className: "openapi-explorer__expand-modal-content",
|
|
161
|
-
overlayClassName: "openapi-explorer__expand-modal-overlay",
|
|
162
|
-
isOpen: modalIsOpen,
|
|
163
|
-
onRequestClose: closeModal,
|
|
164
|
-
contentLabel: "Code Snippet",
|
|
165
|
-
},
|
|
166
|
-
react_1.default.createElement(
|
|
167
|
-
Container_1.default,
|
|
168
|
-
{
|
|
169
|
-
as: "div",
|
|
170
|
-
className: (0, clsx_1.default)(
|
|
171
|
-
"openapi-explorer__code-block-container",
|
|
172
|
-
language &&
|
|
173
|
-
!blockClassName.includes(`language-${language}`) &&
|
|
174
|
-
`language-${language}`
|
|
175
|
-
),
|
|
176
|
-
},
|
|
177
|
-
title &&
|
|
178
|
-
react_1.default.createElement(
|
|
179
|
-
"div",
|
|
180
|
-
{ className: "openapi-explorer__code-block-title" },
|
|
181
|
-
title
|
|
182
|
-
),
|
|
183
|
-
react_1.default.createElement(
|
|
184
|
-
"div",
|
|
185
|
-
{ className: "openapi-explorer__code-block-content" },
|
|
186
|
-
react_1.default.createElement(
|
|
187
|
-
prism_react_renderer_1.Highlight,
|
|
188
|
-
{ theme: prismTheme, code: code, language: language ?? "text" },
|
|
189
|
-
({ className, tokens, getLineProps, getTokenProps }) =>
|
|
190
|
-
react_1.default.createElement(
|
|
191
|
-
"pre",
|
|
192
|
-
{
|
|
193
|
-
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
194
|
-
tabIndex: 0,
|
|
195
|
-
className: (0, clsx_1.default)(
|
|
196
|
-
className,
|
|
197
|
-
"openapi-explorer__code-block",
|
|
198
|
-
"thin-scrollbar"
|
|
199
|
-
),
|
|
200
|
-
},
|
|
201
|
-
react_1.default.createElement(
|
|
202
|
-
"code",
|
|
203
|
-
{
|
|
204
|
-
className: (0, clsx_1.default)(
|
|
205
|
-
"openapi-explorer__code-block-lines",
|
|
206
|
-
showLineNumbers &&
|
|
207
|
-
"openapi-explorer__code-block-lines-numbers"
|
|
208
|
-
),
|
|
209
|
-
},
|
|
210
|
-
tokens.map((line, i) =>
|
|
211
|
-
react_1.default.createElement(Line_1.default, {
|
|
212
|
-
key: i,
|
|
213
|
-
line: line,
|
|
214
|
-
getLineProps: getLineProps,
|
|
215
|
-
getTokenProps: getTokenProps,
|
|
216
|
-
classNames: lineClassNames,
|
|
217
|
-
showLineNumbers: showLineNumbers,
|
|
218
|
-
})
|
|
219
|
-
)
|
|
220
|
-
)
|
|
221
|
-
)
|
|
222
|
-
),
|
|
223
|
-
react_1.default.createElement(
|
|
224
|
-
"div",
|
|
225
|
-
{ className: "openapi-explorer__code-block-btn-group" },
|
|
226
|
-
react_1.default.createElement(CopyButton_1.default, {
|
|
227
|
-
className: "openapi-explorer__code-block-code-btn",
|
|
228
|
-
code: code,
|
|
229
|
-
}),
|
|
230
|
-
react_1.default.createElement(ExitButton_1.default, {
|
|
231
|
-
className: "openapi-dmeo__code-block-code-btn",
|
|
232
|
-
handler: closeModal,
|
|
233
|
-
})
|
|
234
|
-
)
|
|
235
|
-
)
|
|
236
|
-
)
|
|
237
|
-
)
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
exports.default = ExpandButton;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* Intentionally has zero specificity, so that to be able to override
|
|
2
|
-
the background in custom CSS file due bug https://github.com/facebook/docusaurus/issues/3678 */
|
|
3
|
-
:where(:root) {
|
|
4
|
-
--docusaurus-highlighted-code-line-bg: rgb(72 77 91);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:where([data-theme="dark"]) {
|
|
8
|
-
--docusaurus-highlighted-code-line-bg: rgb(100 100 100);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.theme-code-block-highlighted-line {
|
|
12
|
-
background-color: var(--docusaurus-highlighted-code-line-bg);
|
|
13
|
-
display: block;
|
|
14
|
-
margin: 0 calc(-1 * var(--ifm-pre-padding));
|
|
15
|
-
padding: 0 var(--ifm-pre-padding);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.openapi-explorer__code-block-code-line {
|
|
19
|
-
display: table-row;
|
|
20
|
-
counter-increment: line-count;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.openapi-explorer__code-block-code-line-number {
|
|
24
|
-
display: table-cell;
|
|
25
|
-
text-align: right;
|
|
26
|
-
width: 1%;
|
|
27
|
-
position: sticky;
|
|
28
|
-
left: 0;
|
|
29
|
-
padding: 0 var(--ifm-pre-padding);
|
|
30
|
-
background: var(--ifm-pre-background);
|
|
31
|
-
overflow-wrap: normal;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.openapi-explorer__code-block-code-line-number::before {
|
|
35
|
-
content: counter(line-count);
|
|
36
|
-
opacity: 0.4;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:global(.theme-code-block-highlighted-line)
|
|
40
|
-
.openapi-explorer__code-block-code-line-number::before {
|
|
41
|
-
opacity: 0.8;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.openapi-explorer__code-block-code-line-number {
|
|
45
|
-
padding-right: var(--ifm-pre-padding);
|
|
46
|
-
}
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
/* ============================================================================
|
|
2
|
-
* Copyright (c) Palo Alto Networks
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE file in the root directory of this source tree.
|
|
6
|
-
* ========================================================================== */
|
|
7
|
-
|
|
8
|
-
import React, { useEffect } from "react";
|
|
9
|
-
|
|
10
|
-
import { usePrismTheme } from "@docusaurus/theme-common";
|
|
11
|
-
import { translate } from "@docusaurus/Translate";
|
|
12
|
-
// @ts-ignore
|
|
13
|
-
import Container from "@theme/ApiExplorer/ApiCodeBlock/Container";
|
|
14
|
-
// @ts-ignore
|
|
15
|
-
import CopyButton from "@theme/ApiExplorer/ApiCodeBlock/CopyButton";
|
|
16
|
-
// @ts-ignore
|
|
17
|
-
import ExitButton from "@theme/ApiExplorer/ApiCodeBlock/ExitButton";
|
|
18
|
-
// @ts-ignore
|
|
19
|
-
import Line from "@theme/ApiExplorer/ApiCodeBlock/Line";
|
|
20
|
-
import clsx from "clsx";
|
|
21
|
-
import { Highlight, type Language } from "prism-react-renderer";
|
|
22
|
-
import Modal from "react-modal";
|
|
23
|
-
|
|
24
|
-
interface Props {
|
|
25
|
-
code: string;
|
|
26
|
-
className: string;
|
|
27
|
-
language: Language;
|
|
28
|
-
showLineNumbers: boolean;
|
|
29
|
-
blockClassName: string;
|
|
30
|
-
title: string;
|
|
31
|
-
lineClassNames: string[];
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export default function ExpandButton({
|
|
35
|
-
code,
|
|
36
|
-
className,
|
|
37
|
-
language,
|
|
38
|
-
showLineNumbers,
|
|
39
|
-
blockClassName,
|
|
40
|
-
title,
|
|
41
|
-
lineClassNames,
|
|
42
|
-
}: Props): React.JSX.Element {
|
|
43
|
-
const prismTheme = usePrismTheme();
|
|
44
|
-
|
|
45
|
-
function openModal() {
|
|
46
|
-
setIsOpen(true);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function closeModal() {
|
|
50
|
-
setIsOpen(false);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
const [modalIsOpen, setIsOpen] = React.useState(false);
|
|
54
|
-
|
|
55
|
-
useEffect(() => {
|
|
56
|
-
Modal.setAppElement("body");
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<button
|
|
62
|
-
type="button"
|
|
63
|
-
aria-label={
|
|
64
|
-
modalIsOpen
|
|
65
|
-
? translate({
|
|
66
|
-
id: "theme.CodeBlock.expanded",
|
|
67
|
-
message: "Expanded",
|
|
68
|
-
description: "The expanded button label on code blocks",
|
|
69
|
-
})
|
|
70
|
-
: translate({
|
|
71
|
-
id: "theme.CodeBlock.expandButtonAriaLabel",
|
|
72
|
-
message: "Expand code to fullscreen",
|
|
73
|
-
description: "The ARIA label for expand code blocks button",
|
|
74
|
-
})
|
|
75
|
-
}
|
|
76
|
-
title={translate({
|
|
77
|
-
id: "theme.CodeBlock.expand",
|
|
78
|
-
message: "Expand",
|
|
79
|
-
description: "The expand button label on code blocks",
|
|
80
|
-
})}
|
|
81
|
-
className={clsx(
|
|
82
|
-
"clean-btn",
|
|
83
|
-
className,
|
|
84
|
-
"openapi-explorer__code-block-expand-btn",
|
|
85
|
-
modalIsOpen && "openapi-explorer__code-block-expand-btn--copied"
|
|
86
|
-
)}
|
|
87
|
-
onClick={openModal}
|
|
88
|
-
>
|
|
89
|
-
<span
|
|
90
|
-
className="openapi-explorer__code-block-expand-btn-icons"
|
|
91
|
-
aria-hidden="true"
|
|
92
|
-
>
|
|
93
|
-
<svg
|
|
94
|
-
className="openapi-explorer__code-block-expand-btn-icon"
|
|
95
|
-
viewBox="0 0 448 512"
|
|
96
|
-
>
|
|
97
|
-
<path 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" />
|
|
98
|
-
</svg>
|
|
99
|
-
<svg
|
|
100
|
-
className="openapi-explorer__code-block-expand-btn-icon--success"
|
|
101
|
-
viewBox="0 0 24 24"
|
|
102
|
-
>
|
|
103
|
-
<path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" />
|
|
104
|
-
</svg>
|
|
105
|
-
</span>
|
|
106
|
-
</button>
|
|
107
|
-
<Modal
|
|
108
|
-
className="openapi-explorer__expand-modal-content"
|
|
109
|
-
overlayClassName="openapi-explorer__expand-modal-overlay"
|
|
110
|
-
isOpen={modalIsOpen}
|
|
111
|
-
onRequestClose={closeModal}
|
|
112
|
-
contentLabel="Code Snippet"
|
|
113
|
-
>
|
|
114
|
-
<Container
|
|
115
|
-
as="div"
|
|
116
|
-
className={clsx(
|
|
117
|
-
"openapi-explorer__code-block-container",
|
|
118
|
-
language &&
|
|
119
|
-
!blockClassName.includes(`language-${language}`) &&
|
|
120
|
-
`language-${language}`
|
|
121
|
-
)}
|
|
122
|
-
>
|
|
123
|
-
{title && (
|
|
124
|
-
<div className="openapi-explorer__code-block-title">{title}</div>
|
|
125
|
-
)}
|
|
126
|
-
<div className="openapi-explorer__code-block-content">
|
|
127
|
-
<Highlight
|
|
128
|
-
theme={prismTheme}
|
|
129
|
-
code={code}
|
|
130
|
-
language={language ?? "text"}
|
|
131
|
-
>
|
|
132
|
-
{({ className, tokens, getLineProps, getTokenProps }) => (
|
|
133
|
-
<pre
|
|
134
|
-
/* eslint-disable-next-line jsx-a11y/no-noninteractive-tabindex */
|
|
135
|
-
tabIndex={0}
|
|
136
|
-
className={clsx(
|
|
137
|
-
className,
|
|
138
|
-
"openapi-explorer__code-block",
|
|
139
|
-
"thin-scrollbar"
|
|
140
|
-
)}
|
|
141
|
-
>
|
|
142
|
-
<code
|
|
143
|
-
className={clsx(
|
|
144
|
-
"openapi-explorer__code-block-lines",
|
|
145
|
-
showLineNumbers &&
|
|
146
|
-
"openapi-explorer__code-block-lines-numbers"
|
|
147
|
-
)}
|
|
148
|
-
>
|
|
149
|
-
{tokens.map((line, i) => (
|
|
150
|
-
<Line
|
|
151
|
-
key={i}
|
|
152
|
-
line={line}
|
|
153
|
-
getLineProps={getLineProps}
|
|
154
|
-
getTokenProps={getTokenProps}
|
|
155
|
-
classNames={lineClassNames}
|
|
156
|
-
showLineNumbers={showLineNumbers}
|
|
157
|
-
/>
|
|
158
|
-
))}
|
|
159
|
-
</code>
|
|
160
|
-
</pre>
|
|
161
|
-
)}
|
|
162
|
-
</Highlight>
|
|
163
|
-
<div className="openapi-explorer__code-block-btn-group">
|
|
164
|
-
<CopyButton
|
|
165
|
-
className="openapi-explorer__code-block-code-btn"
|
|
166
|
-
code={code}
|
|
167
|
-
/>
|
|
168
|
-
<ExitButton
|
|
169
|
-
className="openapi-dmeo__code-block-code-btn"
|
|
170
|
-
handler={closeModal}
|
|
171
|
-
/>
|
|
172
|
-
</div>
|
|
173
|
-
</div>
|
|
174
|
-
</Container>
|
|
175
|
-
</Modal>
|
|
176
|
-
</>
|
|
177
|
-
);
|
|
178
|
-
}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/* Intentionally has zero specificity, so that to be able to override
|
|
2
|
-
the background in custom CSS file due bug https://github.com/facebook/docusaurus/issues/3678 */
|
|
3
|
-
:where(:root) {
|
|
4
|
-
--docusaurus-highlighted-code-line-bg: rgb(72 77 91);
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
:where([data-theme="dark"]) {
|
|
8
|
-
--docusaurus-highlighted-code-line-bg: rgb(100 100 100);
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
.theme-code-block-highlighted-line {
|
|
12
|
-
background-color: var(--docusaurus-highlighted-code-line-bg);
|
|
13
|
-
display: block;
|
|
14
|
-
margin: 0 calc(-1 * var(--ifm-pre-padding));
|
|
15
|
-
padding: 0 var(--ifm-pre-padding);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.openapi-explorer__code-block-code-line {
|
|
19
|
-
display: table-row;
|
|
20
|
-
counter-increment: line-count;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.openapi-explorer__code-block-code-line-number {
|
|
24
|
-
display: table-cell;
|
|
25
|
-
text-align: right;
|
|
26
|
-
width: 1%;
|
|
27
|
-
position: sticky;
|
|
28
|
-
left: 0;
|
|
29
|
-
padding: 0 var(--ifm-pre-padding);
|
|
30
|
-
background: var(--ifm-pre-background);
|
|
31
|
-
overflow-wrap: normal;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
.openapi-explorer__code-block-code-line-number::before {
|
|
35
|
-
content: counter(line-count);
|
|
36
|
-
opacity: 0.4;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
:global(.theme-code-block-highlighted-line)
|
|
40
|
-
.openapi-explorer__code-block-code-line-number::before {
|
|
41
|
-
opacity: 0.8;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.openapi-explorer__code-block-code-line-number {
|
|
45
|
-
padding-right: var(--ifm-pre-padding);
|
|
46
|
-
}
|