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.
Files changed (142) hide show
  1. package/lib/markdown/utils.d.ts +3 -2
  2. package/lib/markdown/utils.js +1 -1
  3. package/lib/markdown/utils.test.d.ts +1 -0
  4. package/lib/markdown/utils.test.js +43 -0
  5. package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.d.ts +13 -0
  6. package/lib/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/index.js +199 -124
  7. package/lib/theme/ApiExplorer/Accept/index.d.ts +2 -2
  8. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  9. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
  10. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
  11. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
  12. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
  13. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +115 -96
  14. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
  15. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +200 -120
  20. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  21. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
  22. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  23. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
  24. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  25. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
  26. package/lib/theme/ApiExplorer/Authorization/index.d.ts +2 -2
  27. package/lib/theme/ApiExplorer/Authorization/slice.d.ts +1 -1
  28. package/lib/theme/ApiExplorer/Body/index.d.ts +2 -2
  29. package/lib/theme/ApiExplorer/Body/index.js +8 -1
  30. package/lib/theme/ApiExplorer/Body/slice.d.ts +3 -3
  31. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.d.ts +21 -0
  32. package/lib/theme/ApiExplorer/CodeSnippets/code-snippets-types.js +8 -0
  33. package/lib/theme/ApiExplorer/CodeSnippets/index.d.ts +4 -14
  34. package/lib/theme/ApiExplorer/CodeSnippets/index.js +86 -8
  35. package/lib/theme/ApiExplorer/CodeSnippets/languages.d.ts +3 -0
  36. package/lib/theme/ApiExplorer/CodeSnippets/languages.js +48 -0
  37. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
  38. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
  39. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  40. package/lib/theme/ApiExplorer/CodeTabs/index.js +131 -76
  41. package/lib/theme/ApiExplorer/ContentType/index.d.ts +2 -2
  42. package/lib/theme/ApiExplorer/Export/index.d.ts +2 -2
  43. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
  44. package/lib/theme/ApiExplorer/FloatingButton/index.d.ts +1 -1
  45. package/lib/theme/ApiExplorer/FormFileUpload/index.d.ts +2 -2
  46. package/lib/theme/ApiExplorer/FormItem/index.d.ts +1 -1
  47. package/lib/theme/ApiExplorer/FormMultiSelect/index.d.ts +1 -1
  48. package/lib/theme/ApiExplorer/FormSelect/index.d.ts +1 -1
  49. package/lib/theme/ApiExplorer/FormTextInput/index.d.ts +1 -1
  50. package/lib/theme/ApiExplorer/MethodEndpoint/index.d.ts +2 -2
  51. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamArrayFormItem.d.ts +2 -2
  52. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamBooleanFormItem.d.ts +2 -2
  53. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.d.ts +2 -2
  54. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
  55. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamSelectFormItem.d.ts +2 -2
  56. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamTextFormItem.d.ts +2 -2
  57. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
  58. package/lib/theme/ApiExplorer/ParamOptions/index.d.ts +2 -2
  59. package/lib/theme/ApiExplorer/ParamOptions/slice.d.ts +1 -1
  60. package/lib/theme/ApiExplorer/Request/_Request.scss +4 -2
  61. package/lib/theme/ApiExplorer/Request/index.d.ts +2 -2
  62. package/lib/theme/ApiExplorer/Request/makeRequest.js +50 -1
  63. package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
  64. package/lib/theme/ApiExplorer/Response/index.d.ts +2 -2
  65. package/lib/theme/ApiExplorer/Response/index.js +19 -19
  66. package/lib/theme/ApiExplorer/SecuritySchemes/index.d.ts +2 -2
  67. package/lib/theme/ApiExplorer/Server/index.d.ts +2 -2
  68. package/lib/theme/ApiExplorer/buildPostmanRequest.d.ts +1 -1
  69. package/lib/theme/ApiExplorer/index.d.ts +2 -2
  70. package/lib/theme/ApiExplorer/index.js +1 -1
  71. package/lib/theme/ApiExplorer/storage-utils.d.ts +1 -1
  72. package/lib/theme/ApiItem/index.js +28 -3
  73. package/lib/theme/ApiItem/store.d.ts +6 -6
  74. package/lib/theme/ApiLogo/index.d.ts +2 -2
  75. package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
  76. package/lib/theme/ApiTabs/index.d.ts +7 -0
  77. package/lib/theme/ApiTabs/index.js +167 -103
  78. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  79. package/lib/theme/DiscriminatorTabs/index.js +152 -98
  80. package/lib/theme/Markdown/index.js +37 -0
  81. package/lib/theme/MimeTabs/index.d.ts +6 -0
  82. package/lib/theme/MimeTabs/index.js +169 -118
  83. package/lib/theme/OperationTabs/_OperationTabs.scss +71 -0
  84. package/lib/theme/OperationTabs/index.d.ts +3 -0
  85. package/lib/theme/OperationTabs/index.js +234 -0
  86. package/lib/theme/ParamsItem/index.d.ts +23 -0
  87. package/lib/theme/ParamsItem/index.js +170 -111
  88. package/lib/theme/ResponseSamples/index.d.ts +8 -0
  89. package/lib/theme/ResponseSamples/index.js +18 -13
  90. package/lib/theme/SchemaItem/index.d.ts +12 -0
  91. package/lib/theme/SchemaItem/index.js +121 -89
  92. package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
  93. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  94. package/lib/theme/SchemaTabs/index.js +148 -95
  95. package/lib/theme/styles.scss +5 -0
  96. package/lib/types.d.ts +4 -4
  97. package/package.json +8 -7
  98. package/src/markdown/utils.test.ts +49 -0
  99. package/src/markdown/utils.ts +5 -3
  100. package/src/theme/ApiDemoPanel/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +21 -8
  101. package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
  102. package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
  103. package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +4 -4
  104. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
  105. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
  106. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +12 -2
  107. package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
  108. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
  109. package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
  110. package/src/theme/ApiExplorer/Body/index.tsx +3 -1
  111. package/src/theme/ApiExplorer/CodeSnippets/code-snippets-types.ts +55 -0
  112. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +94 -21
  113. package/src/theme/ApiExplorer/CodeSnippets/languages.json +0 -96
  114. package/src/theme/ApiExplorer/CodeSnippets/languages.ts +53 -0
  115. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +18 -2
  116. package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +64 -25
  117. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
  118. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
  119. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
  120. package/src/theme/ApiExplorer/Request/_Request.scss +4 -2
  121. package/src/theme/ApiExplorer/Request/makeRequest.ts +59 -4
  122. package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
  123. package/src/theme/ApiExplorer/Response/index.tsx +2 -2
  124. package/src/theme/ApiExplorer/index.tsx +1 -1
  125. package/src/theme/ApiItem/index.tsx +22 -3
  126. package/src/theme/ApiLogo/index.tsx +1 -1
  127. package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
  128. package/src/theme/ApiTabs/{index.js → index.tsx} +75 -31
  129. package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +63 -28
  130. package/src/theme/Markdown/index.js +37 -0
  131. package/src/theme/MimeTabs/{index.js → index.tsx} +64 -30
  132. package/src/theme/OperationTabs/_OperationTabs.scss +71 -0
  133. package/src/theme/OperationTabs/index.tsx +218 -0
  134. package/src/theme/ParamsItem/{index.js → index.tsx} +48 -17
  135. package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
  136. package/src/theme/SchemaItem/{index.js → index.tsx} +24 -18
  137. package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
  138. package/src/theme/SchemaTabs/{index.js → index.tsx} +62 -29
  139. package/src/theme/styles.scss +5 -0
  140. package/src/theme-classic.d.ts +69 -2
  141. package/src/theme-openapi.d.ts +6 -0
  142. 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
- import React, { useEffect, useState } from "react";
9
-
10
- import { usePrismTheme } from "@docusaurus/theme-common";
11
- import { translate } from "@docusaurus/Translate";
12
- import Container from "@theme/ApiExplorer/ApiCodeBlock/Container";
13
- import CopyButton from "@theme/ApiExplorer/ApiCodeBlock/CopyButton";
14
- import ExitButton from "@theme/ApiExplorer/ApiCodeBlock/ExitButton";
15
- import Line from "@theme/ApiExplorer/ApiCodeBlock/Line";
16
- import clsx from "clsx";
17
- import { Highlight } from "prism-react-renderer";
18
- import Modal from "react-modal";
19
-
20
- export default function ExpandButton({
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
- useEffect(() => {
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
- return (
37
- <>
38
- <button
39
- type="button"
40
- aria-label={
41
- isModalOpen
42
- ? translate({
43
- id: "theme.CodeBlock.expanded",
44
- message: "Expanded",
45
- description: "The expanded button label on code blocks",
46
- })
47
- : translate({
48
- id: "theme.CodeBlock.expandButtonAriaLabel",
49
- message: "Expand code to fullscreen",
50
- description: "The ARIA label for expand code blocks button",
51
- })
52
- }
53
- title={translate({
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={clsx(
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={() => setIsModalOpen(true)}
65
- >
66
- <span
67
- className="openapi-explorer__code-block-expand-btn-icons"
68
- aria-hidden="true"
69
- >
70
- <svg
71
- className="openapi-explorer__code-block-expand-btn-icon"
72
- viewBox="0 0 448 512"
73
- >
74
- <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" />
75
- </svg>
76
- <svg
77
- className="openapi-explorer__code-block-expand-btn-icon--success"
78
- viewBox="0 0 24 24"
79
- >
80
- <path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" />
81
- </svg>
82
- </span>
83
- </button>
84
- <Modal
85
- className="openapi-explorer__expand-modal-content"
86
- overlayClassName="openapi-explorer__expand-modal-overlay"
87
- isOpen={isModalOpen}
88
- onRequestClose={() => setIsModalOpen(false)}
89
- contentLabel="Code Snippet"
90
- >
91
- <Container
92
- as="div"
93
- className={clsx(
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
- {title && (
101
- <div className="openapi-explorer__code-block-title">{title}</div>
102
- )}
103
- <div className="openapi-explorer__code-block-content">
104
- <Highlight
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={prismTheme}
107
- code={code}
108
- language={language ?? "text"}
109
- >
110
- {({ className, tokens, getLineProps, getTokenProps }) => (
111
- <pre
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={0}
114
- className={clsx(
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
- <code
121
- className={clsx(
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
- {tokens.map((line, i) => (
128
- <Line
129
- key={i}
130
- line={line}
131
- getLineProps={getLineProps}
132
- getTokenProps={getTokenProps}
133
- classNames={lineClassNames[i]}
134
- showLineNumbers={showLineNumbers}
135
- />
136
- ))}
137
- </code>
138
- </pre>
139
- )}
140
- </Highlight>
141
- <div className="openapi-explorer__code-block-btn-group">
142
- <CopyButton
143
- className="openapi-explorer__code-block-code-btn"
144
- code={code}
145
- />
146
- <ExitButton
147
- className="openapi-explorer__code-block-code-btn"
148
- handler={() => setIsModalOpen(false)}
149
- />
150
- </div>
151
- </div>
152
- </Container>
153
- </Modal>
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;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { LineProps } from "@docusaurus/theme-common/internal";
3
+ export default function CodeBlockLine({ line, classNames, showLineNumbers, getLineProps, getTokenProps, }: LineProps): React.JSX.Element;
@@ -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
- import React from "react";
9
-
10
- import clsx from "clsx";
11
-
12
- export default function CodeBlockLine({
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: clsx(
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
- <span key={key} {...getTokenProps({ token, key })} />
31
- ));
32
- return (
33
- <span {...lineProps}>
34
- {showLineNumbers ? (
35
- <>
36
- <span className="openapi-explorer__code-block-code-line-number" />
37
- <span className="openapi-explorer__code-block-code-line-content">
38
- {lineTokens}
39
- </span>
40
- </>
41
- ) : (
42
- lineTokens
43
- )}
44
- <br />
45
- </span>
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
- import React from "react";
9
-
10
- import { translate } from "@docusaurus/Translate";
11
- import clsx from "clsx";
12
-
13
- export default function WordWrapButton({ className, onClick, isEnabled }) {
14
- const title = translate({
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
- <button
22
- type="button"
23
- onClick={onClick}
24
- className={clsx(
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={title}
30
- title={title}
31
- >
32
- <svg
33
- className="openapi-explorer__code-block-word-wrap-btn-icon"
34
- viewBox="0 0 24 24"
35
- aria-hidden="true"
36
- >
37
- <path
38
- fill="currentColor"
39
- 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"
40
- />
41
- </svg>
42
- </button>
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;
@@ -0,0 +1,3 @@
1
+ import React from "react";
2
+ import { CodeBlockProps } from "@docusaurus/theme-common/internal";
3
+ export default function ApiCodeBlock({ children: rawChildren, ...props }: CodeBlockProps): React.JSX.Element;
@@ -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
- import React, { isValidElement } from "react";
9
-
10
- import useIsBrowser from "@docusaurus/useIsBrowser";
11
- import ElementContent from "@theme/ApiExplorer/ApiCodeBlock/Content/Element";
12
- import StringContent from "@theme/ApiExplorer/ApiCodeBlock/Content/String";
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 (React.Children.toArray(children).some((el) => isValidElement(el))) {
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
- export default function ApiCodeBlock({ children: rawChildren, ...props }) {
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 = useIsBrowser();
88
+ const isBrowser = (0, useIsBrowser_1.default)();
32
89
  const children = maybeStringifyChildren(rawChildren);
33
90
  const CodeBlockComp =
34
- typeof children === "string" ? StringContent : ElementContent;
35
- return (
36
- <CodeBlockComp key={String(isBrowser)} {...props}>
37
- {children}
38
- </CodeBlockComp>
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
- /// <reference types="react" />
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;