docusaurus-theme-openapi-docs 0.0.0-740 → 0.0.0-751

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 (97) hide show
  1. package/lib/markdown/utils.d.ts +2 -1
  2. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.d.ts +4 -0
  3. package/lib/theme/ApiExplorer/ApiCodeBlock/Container/index.js +25 -19
  4. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.d.ts +4 -0
  5. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/Element.js +27 -16
  6. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.d.ts +4 -0
  7. package/lib/theme/ApiExplorer/ApiCodeBlock/Content/String.js +116 -97
  8. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.d.ts +3 -0
  9. package/lib/theme/ApiExplorer/ApiCodeBlock/CopyButton/index.js +115 -54
  10. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.d.ts +6 -0
  11. package/lib/theme/ApiExplorer/ApiCodeBlock/ExitButton/index.js +41 -30
  12. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.d.ts +14 -0
  13. package/lib/theme/ApiExplorer/ApiCodeBlock/ExpandButton/index.js +201 -121
  14. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.d.ts +3 -0
  15. package/lib/theme/ApiExplorer/ApiCodeBlock/Line/index.js +36 -24
  16. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.d.ts +7 -0
  17. package/lib/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/index.js +35 -28
  18. package/lib/theme/ApiExplorer/ApiCodeBlock/index.d.ts +3 -0
  19. package/lib/theme/ApiExplorer/ApiCodeBlock/index.js +72 -14
  20. package/lib/theme/ApiExplorer/Body/slice.d.ts +8 -8
  21. package/lib/theme/ApiExplorer/CodeSnippets/index.js +2 -2
  22. package/lib/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  23. package/lib/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +4 -2
  24. package/lib/theme/ApiExplorer/CodeTabs/index.d.ts +15 -0
  25. package/lib/theme/ApiExplorer/CodeTabs/index.js +122 -76
  26. package/lib/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
  27. package/lib/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.js +4 -4
  28. package/lib/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
  29. package/lib/theme/ApiExplorer/Request/_Request.scss +4 -6
  30. package/lib/theme/ApiExplorer/Response/_Response.scss +4 -2
  31. package/lib/theme/ApiExplorer/Response/index.js +23 -20
  32. package/lib/theme/ApiExplorer/index.js +0 -4
  33. package/lib/theme/ApiExplorer/persistanceMiddleware.js +6 -6
  34. package/lib/theme/ApiItem/Layout/index.js +3 -0
  35. package/lib/theme/ApiItem/index.js +6 -5
  36. package/lib/theme/ApiLogo/index.d.ts +2 -2
  37. package/lib/theme/ApiTabs/_ApiTabs.scss +3 -1
  38. package/lib/theme/ApiTabs/index.d.ts +7 -0
  39. package/lib/theme/ApiTabs/index.js +152 -98
  40. package/lib/theme/DiscriminatorTabs/index.d.ts +3 -0
  41. package/lib/theme/DiscriminatorTabs/index.js +146 -94
  42. package/lib/theme/MimeTabs/index.d.ts +6 -0
  43. package/lib/theme/MimeTabs/index.js +163 -114
  44. package/lib/theme/OperationTabs/_OperationTabs.scss +4 -1
  45. package/lib/theme/OperationTabs/index.d.ts +3 -0
  46. package/lib/theme/OperationTabs/index.js +148 -103
  47. package/lib/theme/ParamsItem/index.d.ts +23 -0
  48. package/lib/theme/ParamsItem/index.js +168 -123
  49. package/lib/theme/ResponseSamples/index.d.ts +8 -0
  50. package/lib/theme/ResponseSamples/index.js +18 -13
  51. package/lib/theme/SchemaItem/index.d.ts +12 -0
  52. package/lib/theme/SchemaItem/index.js +123 -88
  53. package/lib/theme/SchemaTabs/_SchemaTabs.scss +0 -4
  54. package/lib/theme/SchemaTabs/index.d.ts +3 -0
  55. package/lib/theme/SchemaTabs/index.js +148 -93
  56. package/lib/theme/styles.scss +4 -0
  57. package/package.json +8 -7
  58. package/src/markdown/utils.ts +4 -2
  59. package/src/theme/ApiExplorer/ApiCodeBlock/Container/{index.js → index.tsx} +6 -3
  60. package/src/theme/ApiExplorer/ApiCodeBlock/Content/{Element.js → Element.tsx} +5 -1
  61. package/src/theme/ApiExplorer/ApiCodeBlock/Content/{String.js → String.tsx} +5 -5
  62. package/src/theme/ApiExplorer/ApiCodeBlock/CopyButton/{index.js → index.tsx} +8 -3
  63. package/src/theme/ApiExplorer/ApiCodeBlock/ExitButton/{index.js → index.tsx} +9 -1
  64. package/src/theme/ApiExplorer/ApiCodeBlock/ExpandButton/{index.js → index.tsx} +13 -3
  65. package/src/theme/ApiExplorer/ApiCodeBlock/Line/{index.js → index.tsx} +2 -1
  66. package/src/theme/ApiExplorer/ApiCodeBlock/WordWrapButton/{index.js → index.tsx} +11 -1
  67. package/src/theme/ApiExplorer/ApiCodeBlock/{index.js → index.tsx} +10 -5
  68. package/src/theme/ApiExplorer/CodeSnippets/index.tsx +3 -5
  69. package/src/theme/ApiExplorer/CodeSnippets/languages.json +1290 -0
  70. package/src/theme/ApiExplorer/CodeTabs/_CodeTabs.scss +4 -2
  71. package/src/theme/ApiExplorer/CodeTabs/{index.js → index.tsx} +56 -26
  72. package/src/theme/ApiExplorer/FloatingButton/_FloatingButton.scss +3 -1
  73. package/src/theme/ApiExplorer/ParamOptions/ParamFormItems/ParamMultiSelectFormItem.tsx +4 -4
  74. package/src/theme/ApiExplorer/ParamOptions/_ParamOptions.scss +2 -1
  75. package/src/theme/ApiExplorer/Request/_Request.scss +4 -6
  76. package/src/theme/ApiExplorer/Response/_Response.scss +4 -2
  77. package/src/theme/ApiExplorer/Response/index.tsx +6 -3
  78. package/src/theme/ApiExplorer/index.tsx +0 -3
  79. package/src/theme/ApiExplorer/persistanceMiddleware.ts +6 -6
  80. package/src/theme/ApiItem/Layout/index.tsx +3 -0
  81. package/src/theme/ApiItem/index.tsx +3 -4
  82. package/src/theme/ApiLogo/index.tsx +1 -1
  83. package/src/theme/ApiTabs/_ApiTabs.scss +3 -1
  84. package/src/theme/ApiTabs/{index.js → index.tsx} +60 -26
  85. package/src/theme/DiscriminatorTabs/{index.js → index.tsx} +57 -24
  86. package/src/theme/MimeTabs/{index.js → index.tsx} +57 -25
  87. package/src/theme/OperationTabs/_OperationTabs.scss +4 -1
  88. package/src/theme/OperationTabs/{index.js → index.tsx} +54 -25
  89. package/src/theme/ParamsItem/{index.js → index.tsx} +31 -14
  90. package/src/theme/ResponseSamples/{index.js → index.tsx} +10 -1
  91. package/src/theme/SchemaItem/{index.js → index.tsx} +18 -9
  92. package/src/theme/SchemaTabs/_SchemaTabs.scss +0 -4
  93. package/src/theme/SchemaTabs/{index.js → index.tsx} +64 -28
  94. package/src/theme/styles.scss +4 -0
  95. package/src/theme-classic.d.ts +69 -2
  96. package/src/theme-openapi.d.ts +3 -0
  97. package/tsconfig.json +4 -1
@@ -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;
@@ -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<EmptyBody | FormBody | RawBody, {
30
- clearRawBody: (_state: import("immer/dist/internal").WritableDraft<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>) => {
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<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>, action: PayloadAction<string>) => {
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<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>, action: PayloadAction<FileContent["value"]>) => {
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<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>, action: PayloadAction<string>) => void;
51
- setStringFormBody: (state: import("immer/dist/internal").WritableDraft<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>, action: PayloadAction<{
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<EmptyBody> | import("immer/dist/internal").WritableDraft<FormBody> | import("immer/dist/internal").WritableDraft<RawBody>, action: PayloadAction<{
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<EmptyBody | FormBody | RawBody, import("redux").AnyAction>;
81
+ declare const _default: import("redux").Reducer<FormBody | RawBody | EmptyBody, import("redux").AnyAction>;
82
82
  export default _default;
@@ -220,7 +220,8 @@ function CodeSnippets({ postman, codeSamples }) {
220
220
  const auth = (0, hooks_1.useTypedSelector)((state) => state.auth);
221
221
  // User-defined languages array
222
222
  // Can override languageSet, change order of langs, override options and variants
223
- const userDefinedLanguageSet = siteConfig?.themeConfig?.languageTabs;
223
+ const userDefinedLanguageSet =
224
+ siteConfig?.themeConfig?.languageTabs ?? exports.languageSet;
224
225
  // Filter languageSet by user-defined langs
225
226
  const filteredLanguageSet = exports.languageSet.filter((ls) => {
226
227
  return userDefinedLanguageSet?.some((lang) => {
@@ -235,7 +236,6 @@ function CodeSnippets({ postman, codeSamples }) {
235
236
  ),
236
237
  codeSamples
237
238
  );
238
- console.log("merged", mergedLangs);
239
239
  // Read defaultLang from localStorage
240
240
  const defaultLang = mergedLangs.filter(
241
241
  (lang) =>