@scalar/api-reference 1.31.0 → 1.31.2

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