@scalar/api-reference 1.31.7 → 1.31.9

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 (183) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/dist/browser/standalone.js +18613 -18470
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReference.vue.js +10 -30
  6. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  7. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  8. package/dist/components/ApiReferenceLayout.vue2.js +240 -222
  9. package/dist/components/Content/Content.vue.d.ts +2 -0
  10. package/dist/components/Content/Content.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Content.vue.js +2 -2
  12. package/dist/components/Content/Content.vue2.js +84 -74
  13. package/dist/components/Content/Introduction/Introduction.vue.d.ts +1 -3
  14. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  15. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  16. package/dist/components/Content/Introduction/Introduction.vue2.js +93 -83
  17. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Lazy/Loading.vue.js +84 -86
  19. package/dist/components/Content/Models/Models.vue.js +1 -1
  20. package/dist/components/Content/Models/Models.vue2.js +4 -4
  21. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  23. package/dist/components/Content/Schema/Schema.vue2.js +53 -53
  24. package/dist/components/Content/Schema/SchemaDiscriminator.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Schema/SchemaDiscriminator.vue.js +1 -1
  26. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  27. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  28. package/dist/components/Content/Schema/SchemaProperty.vue2.js +117 -112
  29. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  30. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +2 -2
  31. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +161 -191
  32. package/dist/components/Content/Schema/helpers/schema-name.d.ts +13 -0
  33. package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/helpers/schema-name.js +59 -13
  35. package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
  36. package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
  37. package/dist/components/Content/Tag/OperationsList.vue2.js +22 -25
  38. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts +2 -3
  39. package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
  40. package/dist/components/Content/Tag/OperationsListItem.vue.js +2 -2
  41. package/dist/components/Content/Tag/OperationsListItem.vue2.js +46 -47
  42. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  43. package/dist/components/Content/Tag/Tag.vue.js +45 -47
  44. package/dist/components/Content/Tag/TagList.vue.d.ts +2 -0
  45. package/dist/components/Content/Tag/TagList.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Tag/TagList.vue.js +40 -41
  47. package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
  48. package/dist/components/Content/Tag/TagSection.vue.js +2 -2
  49. package/dist/components/Content/Tag/TagSection.vue2.js +21 -21
  50. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +16 -1
  51. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  52. package/dist/components/HttpMethod/HttpMethod.vue.js +12 -11
  53. package/dist/components/MobileHeader.vue.d.ts +1 -8
  54. package/dist/components/MobileHeader.vue.d.ts.map +1 -1
  55. package/dist/components/MobileHeader.vue.js +1 -1
  56. package/dist/components/MobileHeader.vue2.js +19 -19
  57. package/dist/components/Section/Section.vue.js +2 -2
  58. package/dist/components/Section/Section.vue2.js +1 -1
  59. package/dist/components/ShowMoreButton.vue.js +2 -2
  60. package/dist/components/ShowMoreButton.vue2.js +1 -1
  61. package/dist/components/Sidebar/Sidebar.vue.d.ts +2 -4
  62. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  63. package/dist/components/Sidebar/Sidebar.vue.js +1 -1
  64. package/dist/components/Sidebar/Sidebar.vue2.js +113 -159
  65. package/dist/components/Sidebar/SidebarElement.vue.d.ts +2 -11
  66. package/dist/components/Sidebar/SidebarElement.vue.d.ts.map +1 -1
  67. package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
  68. package/dist/components/Sidebar/SidebarElement.vue2.js +85 -81
  69. package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts +16 -1
  70. package/dist/components/Sidebar/SidebarHttpBadge.vue.d.ts.map +1 -1
  71. package/dist/components/Sidebar/SidebarHttpBadge.vue.js +2 -2
  72. package/dist/components/Sidebar/SidebarHttpBadge.vue2.js +11 -5
  73. package/dist/features/ApiClientModal/ApiClientModal.vue.d.ts.map +1 -1
  74. package/dist/features/ApiClientModal/ApiClientModal.vue.js +54 -42
  75. package/dist/features/ApiClientModal/useApiClient.d.ts +74 -72
  76. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  77. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts +0 -2
  78. package/dist/features/DocumentSource/hooks/useDocumentSource.d.ts.map +1 -1
  79. package/dist/features/DocumentSource/hooks/useDocumentSource.js +40 -67
  80. package/dist/features/DownloadLink/DownloadLink.vue.js +1 -1
  81. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +5 -5
  82. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  83. package/dist/features/ExampleRequest/ExampleRequest.vue.js +1 -1
  84. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +200 -179
  85. package/dist/features/Operation/Operation.vue.d.ts +0 -1
  86. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  87. package/dist/features/Operation/Operation.vue.js +31 -34
  88. package/dist/features/Operation/components/OperationParameters.vue.d.ts +3 -2
  89. package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
  90. package/dist/features/Operation/components/OperationParameters.vue.js +62 -64
  91. package/dist/features/Operation/components/OperationResponses.vue.d.ts +1 -2
  92. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  93. package/dist/features/Operation/components/OperationResponses.vue.js +2 -2
  94. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  95. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  96. package/dist/features/Operation/components/callbacks/Callback.vue2.js +31 -38
  97. package/dist/features/Operation/hooks/useResponses.d.ts +3 -3
  98. package/dist/features/Operation/hooks/useResponses.d.ts.map +1 -1
  99. package/dist/features/Operation/hooks/useResponses.js +12 -13
  100. package/dist/features/Operation/index.d.ts +0 -1
  101. package/dist/features/Operation/index.d.ts.map +1 -1
  102. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +4 -6
  103. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  104. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  105. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +85 -72
  106. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +2 -4
  107. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  108. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  109. package/dist/features/Operation/layouts/ModernLayout.vue2.js +114 -98
  110. package/dist/features/Search/SearchModal.vue.js +2 -2
  111. package/dist/features/Search/SearchModal.vue2.js +1 -1
  112. package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
  113. package/dist/features/Search/useSearchIndex.js +61 -64
  114. package/dist/features/sidebar/helpers/create-sidebar.d.ts +4 -2
  115. package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -1
  116. package/dist/features/sidebar/helpers/create-sidebar.js +33 -0
  117. package/dist/features/sidebar/hooks/useSidebar.d.ts +2 -3
  118. package/dist/features/sidebar/hooks/useSidebar.d.ts.map +1 -1
  119. package/dist/features/sidebar/hooks/useSidebar.js +18 -0
  120. package/dist/features/sidebar/index.d.ts +2 -1
  121. package/dist/features/sidebar/index.d.ts.map +1 -1
  122. package/dist/features/traverse-schema/helpers/get-tag.d.ts +4 -2
  123. package/dist/features/traverse-schema/helpers/get-tag.d.ts.map +1 -1
  124. package/dist/features/traverse-schema/helpers/get-tag.js +7 -0
  125. package/dist/features/traverse-schema/helpers/traverse-description.js +33 -0
  126. package/dist/features/traverse-schema/helpers/traverse-document.d.ts.map +1 -1
  127. package/dist/features/traverse-schema/helpers/traverse-document.js +34 -0
  128. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +5 -3
  129. package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
  130. package/dist/features/traverse-schema/helpers/traverse-paths.js +32 -0
  131. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts +2 -2
  132. package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
  133. package/dist/features/traverse-schema/helpers/traverse-schemas.js +23 -0
  134. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts +2 -2
  135. package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
  136. package/dist/features/traverse-schema/helpers/traverse-tags.js +43 -0
  137. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts +2 -2
  138. package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
  139. package/dist/features/traverse-schema/helpers/traverse-webhooks.js +26 -0
  140. package/dist/features/traverse-schema/index.d.ts +3 -3
  141. package/dist/features/traverse-schema/index.d.ts.map +1 -1
  142. package/dist/features/traverse-schema/types.d.ts +8 -5
  143. package/dist/features/traverse-schema/types.d.ts.map +1 -1
  144. package/dist/helpers/parse.d.ts +2 -1
  145. package/dist/helpers/parse.d.ts.map +1 -1
  146. package/dist/helpers/parse.js +72 -88
  147. package/dist/hooks/useMultipleDocuments.d.ts +6 -6
  148. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  149. package/dist/hooks/useNavState.d.ts +1 -1
  150. package/dist/hooks/useNavState.d.ts.map +1 -1
  151. package/dist/hooks/useNavState.js +14 -9
  152. package/dist/hooks/useOperation.d.ts +7 -7
  153. package/dist/hooks/useOperation.d.ts.map +1 -1
  154. package/dist/hooks/useOperation.js +13 -12
  155. package/dist/index.d.ts +0 -1
  156. package/dist/index.d.ts.map +1 -1
  157. package/dist/index.js +23 -25
  158. package/dist/legacy/fixtures/index.d.ts +1 -1
  159. package/dist/libs/openapi.d.ts +3 -4
  160. package/dist/libs/openapi.d.ts.map +1 -1
  161. package/dist/libs/openapi.js +8 -9
  162. package/dist/style.css +1 -1
  163. package/dist/v2/ApiReferenceWorkspace.vue.d.ts +4 -18
  164. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  165. package/dist/v2/ApiReferenceWorkspace.vue.js +68 -45
  166. package/package.json +17 -17
  167. package/dist/components/Content/Webhooks/index.d.ts +0 -2
  168. package/dist/components/Content/Webhooks/index.d.ts.map +0 -1
  169. package/dist/features/Operation/Webhooks.vue.d.ts +0 -7
  170. package/dist/features/Operation/Webhooks.vue.d.ts.map +0 -1
  171. package/dist/features/Operation/Webhooks.vue.js +0 -7
  172. package/dist/features/Operation/Webhooks.vue2.js +0 -121
  173. package/dist/features/Operation/components/Webhook.vue.d.ts +0 -7
  174. package/dist/features/Operation/components/Webhook.vue.d.ts.map +0 -1
  175. package/dist/features/Operation/components/Webhook.vue.js +0 -7
  176. package/dist/features/Operation/components/Webhook.vue2.js +0 -29
  177. package/dist/features/traverse-schema/helpers/operation-id-params.d.ts +0 -8
  178. package/dist/features/traverse-schema/helpers/operation-id-params.d.ts.map +0 -1
  179. package/dist/features/traverse-schema/helpers/operation-id-params.js +0 -8
  180. package/dist/hooks/useSidebar.d.ts +0 -53
  181. package/dist/hooks/useSidebar.d.ts.map +0 -1
  182. package/dist/hooks/useSidebar.js +0 -248
  183. package/dist/legacy/fixtures/httpRequestMethods.js +0 -14
@@ -1,125 +1,145 @@
1
- import { defineComponent as ce, useId as me, ref as T, inject as z, computed as c, watch as L, onMounted as de, createBlock as V, createCommentVNode as j, unref as l, openBlock as y, withCtx as n, createVNode as s, createElementVNode as w, renderSlot as S, createTextVNode as h, createElementBlock as B, Fragment as W, toDisplayString as R } from "vue";
2
- import { useWorkspace as pe } from "@scalar/api-client/store";
3
- import { getSnippet as fe } from "@scalar/api-client/views/Components/CodeSnippet";
4
- import { filterSecurityRequirements as ye } from "@scalar/api-client/views/Request/RequestSection";
5
- import { ScalarCodeBlock as ve } from "@scalar/components";
6
- import { freezeElement as ge } from "@scalar/helpers/dom/freeze-element";
7
- import J from "../../components/ScreenReader.vue.js";
8
- import { useConfig as xe } from "../../hooks/useConfig.js";
9
- import { EXAMPLE_CONTEXT as he, DISCRIMINATOR_CONTEXT as Ee } from "../../hooks/useDiscriminator.js";
10
- import { useHttpClientStore as Ke } from "../../stores/useHttpClientStore.js";
11
- import be from "./ExamplePicker.vue.js";
12
- import ke from "./TextSelect.vue.js";
1
+ import { defineComponent as pe, useId as fe, ref as R, inject as Q, computed as c, watch as Y, onMounted as ye, createBlock as w, createCommentVNode as J, unref as r, openBlock as g, withCtx as s, createVNode as n, createElementVNode as U, renderSlot as N, createTextVNode as K, createElementBlock as D, Fragment as Z, toDisplayString as I } from "vue";
2
+ import { useWorkspace as ve } from "@scalar/api-client/store";
3
+ import { getSnippet as ge } from "@scalar/api-client/views/Components/CodeSnippet";
4
+ import { filterSecurityRequirements as xe } from "@scalar/api-client/views/Request/RequestSection";
5
+ import { ScalarCodeBlock as he } from "@scalar/components";
6
+ import { freezeElement as qe } from "@scalar/helpers/dom/freeze-element";
7
+ import { requestSchema as Ee, createExampleFromRequest as Ke } from "@scalar/oas-utils/entities/spec";
8
+ import { isDereferenced as be } from "@scalar/openapi-types/helpers";
9
+ import H from "../../components/ScreenReader.vue.js";
10
+ import { useConfig as Se } from "../../hooks/useConfig.js";
11
+ import { EXAMPLE_CONTEXT as ke, DISCRIMINATOR_CONTEXT as Ce } from "../../hooks/useDiscriminator.js";
12
+ import { useHttpClientStore as Oe } from "../../stores/useHttpClientStore.js";
13
+ import Ne from "./ExamplePicker.vue.js";
14
+ import $e from "./TextSelect.vue.js";
13
15
  /* empty css */
14
- import G from "../../components/Card/Card.vue.js";
15
- import Se from "../../components/Card/CardHeader.vue.js";
16
- import Q from "../../components/HttpMethod/HttpMethod.vue.js";
17
- import Y from "../../components/Card/CardContent.vue.js";
18
- import Oe from "../../components/Card/CardFooter.vue.js";
19
- import { useExampleStore as Ce } from "../../legacy/stores/useExampleStore.js";
20
- const qe = ["id"], Ne = ["id"], $e = {
16
+ import _ from "../../components/Card/Card.vue.js";
17
+ import Te from "../../components/Card/CardHeader.vue.js";
18
+ import ee from "../../components/HttpMethod/HttpMethod.vue.js";
19
+ import te from "../../components/Card/CardContent.vue.js";
20
+ import Ve from "../../components/Card/CardFooter.vue.js";
21
+ import { useExampleStore as Be } from "../../legacy/stores/useExampleStore.js";
22
+ const je = ["id"], Re = ["id"], we = {
21
23
  key: 0,
22
24
  class: "request-card-footer-addon"
23
- }, Te = { class: "request-header" }, Qe = /* @__PURE__ */ ce({
25
+ }, Je = { class: "request-header" }, rt = /* @__PURE__ */ pe({
24
26
  __name: "ExampleRequest",
25
27
  props: {
26
- operation: {},
27
28
  server: {},
28
29
  collection: {},
30
+ operation: {},
31
+ request: {},
32
+ method: {},
29
33
  fallback: { type: Boolean },
30
- transformedOperation: {},
31
34
  schemas: {}
32
35
  },
33
- setup(o) {
34
- const { selectedExampleKey: D, operationId: Z } = Ce(), { requestExamples: E, securitySchemes: H, requestExampleMutators: O } = pe(), _ = xe(), {
35
- httpClient: i,
36
- setHttpClient: ee,
37
- availableTargets: I,
38
- httpTargetTitle: te,
39
- httpClientTitle: ae
40
- } = Ke(), K = me(), v = T(!1), b = z(he), d = z(Ee), C = c(() => {
36
+ setup(l) {
37
+ const { selectedExampleKey: M, operationId: ae } = Be(), { requestExamples: b, securitySchemes: A, requestExampleMutators: $ } = ve(), le = Se(), {
38
+ httpClient: u,
39
+ setHttpClient: re,
40
+ availableTargets: F,
41
+ httpTargetTitle: oe,
42
+ httpClientTitle: se
43
+ } = Oe(), S = fe(), x = R(!1), k = Q(ke), y = Q(Ce), T = c(() => {
41
44
  var e;
42
- return (e = d == null ? void 0 : d.value) == null ? void 0 : e.selectedType;
43
- }), M = c(
45
+ return (e = y == null ? void 0 : y.value) == null ? void 0 : e.selectedType;
46
+ }), P = c(
44
47
  () => {
45
48
  var e;
46
- return ((e = d == null ? void 0 : d.value) == null ? void 0 : e.hasDiscriminator) || !1;
49
+ return ((e = y == null ? void 0 : y.value) == null ? void 0 : e.hasDiscriminator) || !1;
47
50
  }
48
- ), m = c(() => {
51
+ ), d = c(() => {
49
52
  var t;
50
53
  const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
51
54
  for (const a of e)
52
- if ((t = o.transformedOperation.information) != null && t[a])
53
- return [...o.transformedOperation.information[a]];
55
+ if ((t = l.operation) != null && t[a])
56
+ return [...l.operation[a]];
54
57
  return [];
55
- }), r = T(
58
+ }), o = R(
56
59
  // Default to first custom example
57
- m.value.length ? {
60
+ d.value.length ? {
58
61
  targetKey: "customExamples",
59
62
  clientKey: 0
60
63
  } : (
61
64
  // Otherwise use the globally selected HTTP client
62
65
  {
63
- targetKey: i.targetKey,
64
- clientKey: i.clientKey
66
+ targetKey: u.targetKey,
67
+ clientKey: u.clientKey
65
68
  }
66
69
  )
67
70
  );
68
- L(i, () => {
69
- r.value = {
70
- targetKey: i.targetKey,
71
- clientKey: i.clientKey
71
+ Y(u, () => {
72
+ o.value = {
73
+ targetKey: u.targetKey,
74
+ clientKey: u.clientKey
72
75
  };
73
76
  });
74
- const U = c(() => {
75
- const e = q.value;
77
+ const X = c(() => {
78
+ const e = C.value;
76
79
  return Object.keys(e).length > 1;
77
- }), le = () => {
78
- var x;
79
- if (r.value.targetKey === "customExamples")
80
- return ((x = m.value[r.value.clientKey]) == null ? void 0 : x.source) ?? "";
81
- const e = i.clientKey, t = i.targetKey, a = E[o.operation.examples[0]];
82
- if (!a)
83
- return "";
84
- const u = ye(
85
- o.operation.security || o.collection.security,
86
- o.collection.selectedSecuritySchemeUids,
87
- H
88
- ), [g, k] = fe(t, e, {
89
- operation: o.operation,
90
- example: a,
91
- server: o.server,
92
- securitySchemes: u
80
+ }), ne = () => {
81
+ var h, q, E;
82
+ if (o.value.targetKey === "customExamples")
83
+ return ((h = d.value[o.value.clientKey]) == null ? void 0 : h.source) ?? "";
84
+ const e = u.clientKey, t = u.targetKey, a = l.request || Ee.parse({
85
+ uid: l.operation.operationId || "temp-request",
86
+ method: l.method,
87
+ path: l.operation.path,
88
+ parameters: l.operation.parameters || [],
89
+ requestBody: l.operation.requestBody,
90
+ examples: [],
91
+ type: "request",
92
+ selectedSecuritySchemeUids: [],
93
+ selectedServerUid: "",
94
+ servers: [],
95
+ summary: l.operation.summary || "Example Request"
96
+ });
97
+ let i = b[((E = (q = l.request) == null ? void 0 : q.examples) == null ? void 0 : E[0]) ?? ""];
98
+ if (!i) {
99
+ const m = C.value, B = Object.keys(m)[0];
100
+ i = Ke(a, B);
101
+ }
102
+ const p = xe(
103
+ l.operation.security || l.collection.security,
104
+ l.collection.selectedSecuritySchemeUids,
105
+ A
106
+ ), [f, O] = ge(t, e, {
107
+ operation: l.request,
108
+ example: i,
109
+ server: l.server,
110
+ securitySchemes: p
93
111
  });
94
- return g ? g.message ?? "" : k;
95
- }, A = c(() => {
112
+ return f ? f.message ?? "" : O;
113
+ }, z = c(() => {
96
114
  try {
97
- return le();
115
+ return ne();
98
116
  } catch (e) {
99
117
  return console.error("[generateSnippet]", e), "";
100
118
  }
101
- }), q = c(() => {
102
- var a, u;
103
- const e = ((u = (a = o.transformedOperation.information) == null ? void 0 : a.requestBody) == null ? void 0 : u.content) ?? {}, t = Object.values(e)[0];
119
+ }), C = c(() => {
120
+ var a;
121
+ if (!be(l.operation.requestBody))
122
+ return {};
123
+ const e = ((a = l.operation.requestBody) == null ? void 0 : a.content) ?? {}, t = Object.values(e)[0];
104
124
  return (t == null ? void 0 : t.examples) ?? {};
105
- }), oe = c(() => {
125
+ }), ue = c(() => {
106
126
  var t, a;
107
127
  const e = (
108
128
  // Specified language
109
- ((t = r.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = m.value[r.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
129
+ ((t = o.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = d.value[o.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
110
130
  // Or language for the globally selected HTTP client
111
- i.targetKey
131
+ u.targetKey
112
132
  )
113
133
  );
114
- return e === "shell" && A.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
115
- }), re = c(
116
- () => Object.values(H).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
134
+ return e === "shell" && z.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
135
+ }), ie = c(
136
+ () => Object.values(A).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
117
137
  e.token,
118
138
  e.password,
119
139
  btoa(`${e.username}:${e.password}`)
120
140
  ] : e.type === "oauth2" ? Object.values(e.flows).map((t) => t.token) : [])
121
- ), ne = c(() => {
122
- const e = I.value.map((t) => ({
141
+ ), ce = c(() => {
142
+ const e = F.value.map((t) => ({
123
143
  value: t.key,
124
144
  label: t.title,
125
145
  options: t.clients.map((a) => ({
@@ -130,10 +150,10 @@ const qe = ["id"], Ne = ["id"], $e = {
130
150
  label: a.title
131
151
  }))
132
152
  }));
133
- return m.value.length && e.unshift({
153
+ return d.value.length && e.unshift({
134
154
  value: "customExamples",
135
155
  label: "Examples",
136
- options: m.value.map((t, a) => ({
156
+ options: d.value.map((t, a) => ({
137
157
  value: JSON.stringify({
138
158
  targetKey: "customExamples",
139
159
  clientKey: a
@@ -141,198 +161,199 @@ const qe = ["id"], Ne = ["id"], $e = {
141
161
  label: t.label ?? t.lang ?? `Example #${a + 1}`
142
162
  }))
143
163
  }), e;
144
- }), N = T(null);
145
- function se(e) {
164
+ }), V = R(null);
165
+ function me(e) {
146
166
  const t = JSON.parse(e);
147
- if (N.value) {
148
- const a = ge(N.value.$el);
167
+ if (V.value) {
168
+ const a = qe(V.value.$el);
149
169
  setTimeout(() => {
150
170
  a();
151
171
  }, 300);
152
172
  }
153
- t.targetKey === "customExamples" || r.value.targetKey === "customExamples" && t.targetKey === i.targetKey && t.clientKey === i.clientKey ? r.value = t : ee(t);
173
+ t.targetKey === "customExamples" || o.value.targetKey === "customExamples" && t.targetKey === u.targetKey && t.clientKey === u.clientKey ? o.value = t : re(t);
154
174
  }
155
- function ie(e) {
156
- D.value = e, Z.value = o.operation.operationId;
157
- const t = E[o.operation.examples[0]], a = q.value[e];
175
+ function de(e) {
176
+ var i, p;
177
+ M.value = e, ae.value = l.operation.operationId;
178
+ const t = b[((p = (i = l.request) == null ? void 0 : i.examples) == null ? void 0 : p[0]) ?? ""], a = C.value[e];
158
179
  if (t && (a != null && a.value))
159
180
  try {
160
- O.edit(
181
+ $.edit(
161
182
  t.uid,
162
183
  "body.raw.value",
163
184
  JSON.stringify(a.value, null, 2)
164
185
  );
165
- } catch (u) {
166
- console.error("[handleExampleUpdate]", u);
186
+ } catch (f) {
187
+ console.error("[handleExampleUpdate]", f);
167
188
  }
168
189
  }
169
- de(() => {
170
- M.value && C.value && !v.value && F(C.value);
190
+ ye(() => {
191
+ P.value && T.value && !x.value && L(T.value);
171
192
  });
172
- const F = (e) => {
173
- var t, a, u, g, k, x;
174
- if (!v.value)
193
+ const L = (e) => {
194
+ var t, a, i, p, f, O, h, q, E;
195
+ if (!x.value)
175
196
  try {
176
- v.value = !0;
177
- const p = E[o.operation.examples[0]];
178
- if (p && (b != null && b.generateExampleValue)) {
179
- const ue = (a = (t = p.body) == null ? void 0 : t.raw) != null && a.value ? JSON.parse(p.body.raw.value) : void 0, $ = b.generateExampleValue(
180
- Array.isArray(ue)
197
+ x.value = !0;
198
+ const m = b[l.operation.examples[0]];
199
+ if (m && (k != null && k.generateExampleValue)) {
200
+ const B = (a = (t = m.body) == null ? void 0 : t.raw) != null && a.value ? JSON.parse(m.body.raw.value) : void 0, j = k.generateExampleValue(
201
+ Array.isArray(B)
181
202
  );
182
- if (O.edit(
183
- p.uid,
203
+ if ($.edit(
204
+ m.uid,
184
205
  "body.raw.value",
185
- JSON.stringify($, null, 2)
186
- ), o.operation.examples[0]) {
187
- const f = E[o.operation.examples[0]];
188
- f && O.edit(
189
- f.uid,
206
+ JSON.stringify(j, null, 2)
207
+ ), (p = (i = l.request) == null ? void 0 : i.examples) != null && p[0]) {
208
+ const v = b[(O = (f = l.request) == null ? void 0 : f.examples) == null ? void 0 : O[0]];
209
+ v && $.edit(
210
+ v.uid,
190
211
  "body.raw.value",
191
- JSON.stringify($, null, 2)
212
+ JSON.stringify(j, null, 2)
192
213
  );
193
214
  }
194
- if ((x = (k = (g = (u = o.transformedOperation.information) == null ? void 0 : u.requestBody) == null ? void 0 : g.content) == null ? void 0 : k["application/json"]) != null && x.examples) {
195
- const f = o.transformedOperation.information.requestBody.content["application/json"].examples;
196
- Object.keys(f).forEach((P) => {
197
- var X;
198
- (X = f[P]) != null && X.value && (f[P].value = $);
215
+ if ((E = (q = (h = l.operation.requestBody) == null ? void 0 : h.content) == null ? void 0 : q["application/json"]) != null && E.examples) {
216
+ const v = l.operation.requestBody.content["application/json"].examples;
217
+ Object.keys(v).forEach((W) => {
218
+ var G;
219
+ (G = v[W]) != null && G.value && (v[W].value = j);
199
220
  });
200
221
  }
201
222
  }
202
- } catch (p) {
203
- console.error("[handleDiscriminatorChange]", p);
223
+ } catch (m) {
224
+ console.error("[handleDiscriminatorChange]", m);
204
225
  } finally {
205
- v.value = !1;
226
+ x.value = !1;
206
227
  }
207
228
  };
208
- return L(C, (e) => {
209
- e && M.value && !v.value && F();
210
- }), (e, t) => l(I).length || m.value.length ? (y(), V(l(G), {
229
+ return Y(T, (e) => {
230
+ e && P.value && !x.value && L();
231
+ }), (e, t) => r(F).length || d.value.length ? (g(), w(r(_), {
211
232
  key: 0,
212
- "aria-labelledby": `${l(K)}-header`,
233
+ "aria-labelledby": `${r(S)}-header`,
213
234
  class: "dark-mode",
214
235
  ref_key: "elem",
215
- ref: N,
236
+ ref: V,
216
237
  role: "region"
217
238
  }, {
218
- default: n(() => [
219
- s(l(Se), { muted: "" }, {
220
- actions: n(() => [
221
- s(ke, {
239
+ default: s(() => [
240
+ n(r(Te), { muted: "" }, {
241
+ actions: s(() => [
242
+ n($e, {
222
243
  class: "request-client-picker",
223
- controls: `${l(K)}-example`,
224
- modelValue: JSON.stringify(r.value),
225
- options: ne.value,
226
- "onUpdate:modelValue": se
244
+ controls: `${r(S)}-example`,
245
+ modelValue: JSON.stringify(o.value),
246
+ options: ce.value,
247
+ "onUpdate:modelValue": me
227
248
  }, {
228
- default: n(() => [
229
- r.value.targetKey === "customExamples" ? (y(), B(W, { key: 0 }, [
230
- s(J, null, {
231
- default: n(() => t[1] || (t[1] = [
232
- h("Selected Example:")
249
+ default: s(() => [
250
+ o.value.targetKey === "customExamples" ? (g(), D(Z, { key: 0 }, [
251
+ n(H, null, {
252
+ default: s(() => t[1] || (t[1] = [
253
+ K("Selected Example:")
233
254
  ])),
234
255
  _: 1
235
256
  }),
236
- h(" " + R(m.value[r.value.clientKey].label ?? "Example"), 1)
237
- ], 64)) : (y(), B(W, { key: 1 }, [
238
- s(J, null, {
239
- default: n(() => t[2] || (t[2] = [
240
- h("Selected HTTP client:")
257
+ K(" " + I(d.value[o.value.clientKey].label ?? "Example"), 1)
258
+ ], 64)) : (g(), D(Z, { key: 1 }, [
259
+ n(H, null, {
260
+ default: s(() => t[2] || (t[2] = [
261
+ K("Selected HTTP client:")
241
262
  ])),
242
263
  _: 1
243
264
  }),
244
- h(" " + R(l(te)) + " " + R(l(ae)), 1)
265
+ K(" " + I(r(oe)) + " " + I(r(se)), 1)
245
266
  ], 64))
246
267
  ]),
247
268
  _: 1
248
269
  }, 8, ["controls", "modelValue", "options"])
249
270
  ]),
250
- default: n(() => [
251
- w("div", {
252
- id: `${l(K)}-header`,
271
+ default: s(() => [
272
+ U("div", {
273
+ id: `${r(S)}-header`,
253
274
  class: "request-header"
254
275
  }, [
255
- s(J, null, {
256
- default: n(() => t[0] || (t[0] = [
257
- h("Request Example for")
276
+ n(H, null, {
277
+ default: s(() => t[0] || (t[0] = [
278
+ K("Request Example for")
258
279
  ])),
259
280
  _: 1
260
281
  }),
261
- s(l(Q), {
282
+ n(r(ee), {
262
283
  as: "span",
263
284
  class: "request-method",
264
- method: e.operation.method
285
+ method: e.method
265
286
  }, null, 8, ["method"]),
266
- S(e.$slots, "header", {}, void 0, !0)
267
- ], 8, qe)
287
+ N(e.$slots, "header", {}, void 0, !0)
288
+ ], 8, je)
268
289
  ]),
269
290
  _: 3
270
291
  }),
271
- s(l(Y), {
292
+ n(r(te), {
272
293
  borderless: "",
273
294
  class: "request-editor-section custom-scroll",
274
295
  frameless: ""
275
296
  }, {
276
- default: n(() => [
277
- w("div", {
278
- id: `${l(K)}-example`,
297
+ default: s(() => [
298
+ U("div", {
299
+ id: `${r(S)}-example`,
279
300
  class: "code-snippet"
280
301
  }, [
281
- s(l(ve), {
302
+ n(r(he), {
282
303
  class: "bg-b-2 -outline-offset-2",
283
- content: A.value,
284
- hideCredentials: re.value,
285
- lang: oe.value,
304
+ content: z.value,
305
+ hideCredentials: ie.value,
306
+ lang: ue.value,
286
307
  lineNumbers: ""
287
308
  }, null, 8, ["content", "hideCredentials", "lang"])
288
- ], 8, Ne)
309
+ ], 8, Re)
289
310
  ]),
290
311
  _: 1
291
312
  }),
292
- (U.value || !l(_).hideTestRequestButton) && e.$slots.footer ? (y(), V(l(Oe), {
313
+ (X.value || !r(le).hideTestRequestButton) && e.$slots.footer ? (g(), w(r(Ve), {
293
314
  key: 0,
294
315
  class: "request-card-footer",
295
316
  contrast: ""
296
317
  }, {
297
- default: n(() => [
298
- U.value ? (y(), B("div", $e, [
299
- s(be, {
318
+ default: s(() => [
319
+ X.value ? (g(), D("div", we, [
320
+ n(Ne, {
300
321
  class: "request-example-selector",
301
- examples: q.value,
302
- modelValue: l(D),
303
- "onUpdate:modelValue": ie
322
+ examples: C.value,
323
+ modelValue: r(M),
324
+ "onUpdate:modelValue": de
304
325
  }, null, 8, ["examples", "modelValue"])
305
- ])) : j("", !0),
306
- S(e.$slots, "footer", {}, void 0, !0)
326
+ ])) : J("", !0),
327
+ N(e.$slots, "footer", {}, void 0, !0)
307
328
  ]),
308
329
  _: 3
309
- })) : j("", !0)
330
+ })) : J("", !0)
310
331
  ]),
311
332
  _: 3
312
- }, 8, ["aria-labelledby"])) : e.fallback ? (y(), V(l(G), {
333
+ }, 8, ["aria-labelledby"])) : e.fallback ? (g(), w(r(_), {
313
334
  key: 1,
314
335
  class: "dark-mode"
315
336
  }, {
316
- default: n(() => [
317
- s(l(Y), { class: "request-card-simple" }, {
318
- default: n(() => [
319
- w("div", Te, [
320
- s(l(Q), {
337
+ default: s(() => [
338
+ n(r(te), { class: "request-card-simple" }, {
339
+ default: s(() => [
340
+ U("div", Je, [
341
+ n(r(ee), {
321
342
  as: "span",
322
343
  class: "request-method",
323
- method: e.operation.method
344
+ method: e.method
324
345
  }, null, 8, ["method"]),
325
- S(e.$slots, "header", {}, void 0, !0)
346
+ N(e.$slots, "header", {}, void 0, !0)
326
347
  ]),
327
- S(e.$slots, "footer", {}, void 0, !0)
348
+ N(e.$slots, "footer", {}, void 0, !0)
328
349
  ]),
329
350
  _: 3
330
351
  })
331
352
  ]),
332
353
  _: 3
333
- })) : j("", !0);
354
+ })) : J("", !0);
334
355
  }
335
356
  });
336
357
  export {
337
- Qe as default
358
+ rt as default
338
359
  };
@@ -2,7 +2,6 @@ import type { Collection, Server } from '@scalar/oas-utils/entities/spec';
2
2
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
3
3
  import type { TransformedOperation } from '@scalar/types/legacy';
4
4
  type __VLS_Props = {
5
- id?: string;
6
5
  layout?: 'modern' | 'classic';
7
6
  transformedOperation: TransformedOperation;
8
7
  collection: Collection;
@@ -1 +1 @@
1
- {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAsGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAahE,KAAK,WAAW,GAAG;IACjB,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAA;CAC7D,CAAC;;AA4JF,wBAMG"}
1
+ {"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../src/features/Operation/Operation.vue"],"names":[],"mappings":"AAiGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAA;AACzE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAYhE,KAAK,WAAW,GAAG;IACjB,MAAM,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAA;IAC7B,oBAAoB,EAAE,oBAAoB,CAAA;IAC1C,UAAU,EAAE,UAAU,CAAA;IACtB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,OAAO,CAAA;CAC7D,CAAC;;AA2JF,wBAMG"}