@scalar/api-reference 1.32.8 → 1.32.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 (77) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/dist/blocks/constants.js +6 -0
  3. package/dist/blocks/helpers/getPointer.js +12 -0
  4. package/dist/blocks/hooks/useBlockProps.d.ts +31 -0
  5. package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -0
  6. package/dist/blocks/hooks/useBlockProps.js +24 -0
  7. package/dist/browser/standalone.js +14550 -14647
  8. package/dist/browser/webpack-stats.json +1 -1
  9. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  10. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  11. package/dist/components/ApiReferenceLayout.vue2.js +176 -164
  12. package/dist/components/Content/Content.vue.js +2 -2
  13. package/dist/components/Content/Content.vue2.js +5 -5
  14. package/dist/features/Operation/Operation.vue.d.ts +6 -6
  15. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  16. package/dist/features/Operation/Operation.vue.js +49 -50
  17. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +6 -8
  18. package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
  19. package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
  20. package/dist/features/Operation/components/callbacks/Callback.vue2.js +28 -21
  21. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +3 -5
  22. package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
  23. package/dist/features/Operation/components/callbacks/Callbacks.vue.js +18 -33
  24. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +12 -11
  25. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  26. package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
  27. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +162 -164
  28. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +13 -12
  29. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  30. package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
  31. package/dist/features/Operation/layouts/ModernLayout.vue2.js +117 -111
  32. package/dist/features/api-client-modal/useApiClient.d.ts +5795 -5795
  33. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  34. package/dist/features/example-request/ExamplePicker.vue.d.ts +13 -0
  35. package/dist/features/example-request/ExamplePicker.vue.d.ts.map +1 -0
  36. package/dist/features/example-request/ExamplePicker.vue.js +7 -0
  37. package/dist/features/example-request/ExamplePicker.vue2.js +57 -0
  38. package/dist/features/example-request/ExampleRequest.vue.d.ts +85 -0
  39. package/dist/features/example-request/ExampleRequest.vue.d.ts.map +1 -0
  40. package/dist/features/example-request/ExampleRequest.vue.js +7 -0
  41. package/dist/features/example-request/ExampleRequest.vue2.js +348 -0
  42. package/dist/features/example-request/TextSelect.vue.d.ts +34 -0
  43. package/dist/features/example-request/TextSelect.vue.d.ts.map +1 -0
  44. package/dist/features/example-request/TextSelect.vue.js +48 -0
  45. package/dist/features/example-request/TextSelect.vue3.js +5 -0
  46. package/dist/features/example-request/index.d.ts +3 -0
  47. package/dist/features/example-request/index.d.ts.map +1 -0
  48. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  49. package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
  50. package/dist/features/example-responses/ExampleResponses.vue2.js +50 -51
  51. package/dist/features/test-request-button/TestRequestButton.vue.d.ts +2 -3
  52. package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
  53. package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
  54. package/dist/features/test-request-button/TestRequestButton.vue2.js +19 -21
  55. package/dist/index.d.ts +1 -0
  56. package/dist/index.d.ts.map +1 -1
  57. package/dist/index.js +15 -13
  58. package/dist/style.css +1 -1
  59. package/dist/v2/ApiReferenceWorkspace.vue.d.ts +1 -3
  60. package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
  61. package/dist/v2/ApiReferenceWorkspace.vue.js +86 -113
  62. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
  63. package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +3 -20
  64. package/dist/v2/blocks/scalar-request-example-block/index.d.ts +2 -2
  65. package/dist/v2/events/index.d.ts +1 -1
  66. package/dist/v2/events/listeners.d.ts +1 -1
  67. package/package.json +10 -10
  68. package/dist/helpers/convert-security-scheme.js +0 -23
  69. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +0 -4
  70. package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +0 -64
  71. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +0 -7
  72. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +0 -212
  73. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +0 -35
  74. package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +0 -29
  75. package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +0 -10
  76. package/dist/v2/events/definitions.js +0 -7
  77. package/dist/v2/hooks/useStore.js +0 -14
@@ -0,0 +1,348 @@
1
+ import { defineComponent as ye, useId as ve, ref as j, inject as Q, computed as c, watch as Y, onMounted as ge, createBlock as w, createCommentVNode as J, unref as r, openBlock as g, withCtx as s, createVNode as n, renderSlot as T, createTextVNode as K, createElementBlock as U, Fragment as Z, toDisplayString as D, createElementVNode as _ } from "vue";
2
+ import { useWorkspace as xe } from "@scalar/api-client/store";
3
+ import { getHarRequest as he, getSnippet as qe } from "@scalar/api-client/views/Components/CodeSnippet";
4
+ import { filterSecurityRequirements as Ee } from "@scalar/api-client/views/Request/RequestSection";
5
+ import { ScalarCard as ee, ScalarCardHeader as Se, ScalarCardSection as te, ScalarCodeBlock as Ke, ScalarCardFooter as be } from "@scalar/components";
6
+ import { freezeElement as ke } from "@scalar/helpers/dom/freeze-element";
7
+ import { requestSchema as Ce, createExampleFromRequest as Oe } from "@scalar/oas-utils/entities/spec";
8
+ import { isDereferenced as Ne } from "@scalar/openapi-types/helpers";
9
+ import H from "../../components/ScreenReader.vue.js";
10
+ import { useConfig as Te } from "../../hooks/useConfig.js";
11
+ import { EXAMPLE_CONTEXT as Ve, DISCRIMINATOR_CONTEXT as Re } from "../../hooks/useDiscriminator.js";
12
+ import { useHttpClientStore as $e } from "../../stores/useHttpClientStore.js";
13
+ import Be from "./ExamplePicker.vue.js";
14
+ import je from "./TextSelect.vue.js";
15
+ /* empty css */
16
+ import ae from "../../components/HttpMethod/HttpMethod.vue.js";
17
+ import { useExampleStore as we } from "../../legacy/stores/useExampleStore.js";
18
+ const Je = ["id"], Ue = {
19
+ key: 0,
20
+ class: "request-card-footer-addon"
21
+ }, De = { class: "request-header" }, at = /* @__PURE__ */ ye({
22
+ __name: "ExampleRequest",
23
+ props: {
24
+ server: {},
25
+ collection: {},
26
+ operation: {},
27
+ request: {},
28
+ method: {},
29
+ fallback: { type: Boolean },
30
+ schemas: {}
31
+ },
32
+ setup(l) {
33
+ const { selectedExampleKey: I, operationId: le } = we(), { requestExamples: b, securitySchemes: M, requestExampleMutators: V } = xe(), re = Te(), {
34
+ httpClient: u,
35
+ setHttpClient: oe,
36
+ availableTargets: A,
37
+ httpTargetTitle: se,
38
+ httpClientTitle: ne
39
+ } = $e(), F = ve(), x = j(!1), k = Q(Ve), f = Q(Re), R = c(() => {
40
+ var e;
41
+ return (e = f == null ? void 0 : f.value) == null ? void 0 : e.selectedType;
42
+ }), P = c(
43
+ () => {
44
+ var e;
45
+ return ((e = f == null ? void 0 : f.value) == null ? void 0 : e.hasDiscriminator) || !1;
46
+ }
47
+ ), d = c(() => {
48
+ var t;
49
+ const e = ["x-custom-examples", "x-codeSamples", "x-code-samples"];
50
+ for (const a of e)
51
+ if ((t = l.operation) != null && t[a])
52
+ return [...l.operation[a]];
53
+ return [];
54
+ }), o = j(
55
+ // Default to first custom example
56
+ d.value.length ? {
57
+ targetKey: "customExamples",
58
+ clientKey: 0
59
+ } : (
60
+ // Otherwise use the globally selected HTTP client
61
+ {
62
+ targetKey: u.targetKey,
63
+ clientKey: u.clientKey
64
+ }
65
+ )
66
+ );
67
+ Y(u, () => {
68
+ o.value = {
69
+ targetKey: u.targetKey,
70
+ clientKey: u.clientKey
71
+ };
72
+ });
73
+ const X = c(() => {
74
+ const e = C.value;
75
+ return Object.keys(e).length > 1;
76
+ }), ue = () => {
77
+ var q, E, S;
78
+ if (o.value.targetKey === "customExamples")
79
+ return ((q = d.value[o.value.clientKey]) == null ? void 0 : q.source) ?? "";
80
+ const e = u.clientKey, t = u.targetKey, a = l.request || Ce.parse({
81
+ uid: l.operation.operationId || "temp-request",
82
+ method: l.method,
83
+ path: l.operation.path,
84
+ parameters: l.operation.parameters || [],
85
+ requestBody: l.operation.requestBody,
86
+ examples: [],
87
+ type: "request",
88
+ selectedSecuritySchemeUids: [],
89
+ selectedServerUid: "",
90
+ servers: [],
91
+ summary: l.operation.summary || "Example Request"
92
+ });
93
+ let i = b[((S = (E = l.request) == null ? void 0 : E.examples) == null ? void 0 : S[0]) ?? ""];
94
+ if (!i) {
95
+ const N = C.value, m = Object.keys(N)[0];
96
+ i = Oe(a, m);
97
+ }
98
+ const p = Ee(
99
+ l.operation.security || l.collection.security,
100
+ l.collection.selectedSecuritySchemeUids,
101
+ M
102
+ ), y = he({
103
+ operation: a,
104
+ example: i,
105
+ server: l.server,
106
+ securitySchemes: p
107
+ }), [h, O] = qe(t, e, y);
108
+ return h ? h.message ?? "" : O;
109
+ }, z = c(() => {
110
+ try {
111
+ return ue();
112
+ } catch (e) {
113
+ return console.error("[generateSnippet]", e), "";
114
+ }
115
+ }), C = c(() => {
116
+ var a;
117
+ if (!Ne(l.operation.requestBody))
118
+ return {};
119
+ const e = ((a = l.operation.requestBody) == null ? void 0 : a.content) ?? {}, t = Object.values(e)[0];
120
+ return (t == null ? void 0 : t.examples) ?? {};
121
+ }), ie = c(() => {
122
+ var t, a;
123
+ const e = (
124
+ // Specified language
125
+ ((t = o.value) == null ? void 0 : t.targetKey) === "customExamples" ? ((a = d.value[o.value.clientKey]) == null ? void 0 : a.lang) ?? "plaintext" : (
126
+ // Or language for the globally selected HTTP client
127
+ u.targetKey
128
+ )
129
+ );
130
+ return e === "shell" && z.value.includes("curl") ? "curl" : e === "Objective-C" ? "objc" : e;
131
+ }), ce = c(
132
+ () => Object.values(M).flatMap((e) => e.type === "apiKey" ? e.value : (e == null ? void 0 : e.type) === "http" ? [
133
+ e.token,
134
+ e.password,
135
+ btoa(`${e.username}:${e.password}`)
136
+ ] : e.type === "oauth2" ? Object.values(e.flows).map((t) => t.token) : [])
137
+ ), me = c(() => {
138
+ const e = A.value.map((t) => ({
139
+ value: t.key,
140
+ label: t.title,
141
+ options: t.clients.map((a) => ({
142
+ value: JSON.stringify({
143
+ targetKey: t.key,
144
+ clientKey: a.client
145
+ }),
146
+ label: a.title
147
+ }))
148
+ }));
149
+ return d.value.length && e.unshift({
150
+ value: "customExamples",
151
+ label: "Examples",
152
+ options: d.value.map((t, a) => ({
153
+ value: JSON.stringify({
154
+ targetKey: "customExamples",
155
+ clientKey: a
156
+ }),
157
+ label: t.label ?? t.lang ?? `Example #${a + 1}`
158
+ }))
159
+ }), e;
160
+ }), $ = j(null);
161
+ function de(e) {
162
+ const t = JSON.parse(e);
163
+ if ($.value) {
164
+ const a = ke($.value.$el);
165
+ setTimeout(() => {
166
+ a();
167
+ }, 300);
168
+ }
169
+ t.targetKey === "customExamples" || o.value.targetKey === "customExamples" && t.targetKey === u.targetKey && t.clientKey === u.clientKey ? o.value = t : oe(t);
170
+ }
171
+ function pe(e) {
172
+ var i, p;
173
+ if (!e)
174
+ return;
175
+ I.value = e, le.value = l.operation.operationId;
176
+ const t = b[((p = (i = l.request) == null ? void 0 : i.examples) == null ? void 0 : p[0]) ?? ""], a = C.value[e];
177
+ if (t && (a != null && a.value))
178
+ try {
179
+ V.edit(
180
+ t.uid,
181
+ "body.raw.value",
182
+ JSON.stringify(a.value, null, 2)
183
+ );
184
+ } catch (y) {
185
+ console.error("[handleExampleUpdate]", y);
186
+ }
187
+ }
188
+ ge(() => {
189
+ P.value && R.value && !x.value && L(R.value);
190
+ });
191
+ const L = (e) => {
192
+ var t, a, i, p, y, h, O, q, E, S, N;
193
+ if (!x.value)
194
+ try {
195
+ x.value = !0;
196
+ const m = b[((a = (t = l.request) == null ? void 0 : t.examples) == null ? void 0 : a[0]) ?? ""];
197
+ if (m && (k != null && k.generateExampleValue)) {
198
+ const fe = (p = (i = m.body) == null ? void 0 : i.raw) != null && p.value ? JSON.parse(m.body.raw.value) : void 0, B = k.generateExampleValue(
199
+ Array.isArray(fe)
200
+ );
201
+ if (V.edit(
202
+ m.uid,
203
+ "body.raw.value",
204
+ JSON.stringify(B, null, 2)
205
+ ), (h = (y = l.request) == null ? void 0 : y.examples) != null && h[0]) {
206
+ const v = b[(q = (O = l.request) == null ? void 0 : O.examples) == null ? void 0 : q[0]];
207
+ v && V.edit(
208
+ v.uid,
209
+ "body.raw.value",
210
+ JSON.stringify(B, null, 2)
211
+ );
212
+ }
213
+ if ((N = (S = (E = l.operation.requestBody) == null ? void 0 : E.content) == null ? void 0 : S["application/json"]) != null && N.examples) {
214
+ const v = l.operation.requestBody.content["application/json"].examples;
215
+ Object.keys(v).forEach((W) => {
216
+ var G;
217
+ (G = v[W]) != null && G.value && (v[W].value = B);
218
+ });
219
+ }
220
+ }
221
+ } catch (m) {
222
+ console.error("[handleDiscriminatorChange]", m);
223
+ } finally {
224
+ x.value = !1;
225
+ }
226
+ };
227
+ return Y(R, (e) => {
228
+ e && P.value && !x.value && L();
229
+ }), (e, t) => r(A).length || d.value.length ? (g(), w(r(ee), {
230
+ key: 0,
231
+ class: "request-card dark-mode",
232
+ ref_key: "elem",
233
+ ref: $
234
+ }, {
235
+ default: s(() => [
236
+ n(r(Se), { class: "pr-0.75" }, {
237
+ actions: s(() => [
238
+ n(je, {
239
+ class: "request-client-picker",
240
+ controls: `${r(F)}-example`,
241
+ modelValue: JSON.stringify(o.value),
242
+ options: me.value,
243
+ "onUpdate:modelValue": de
244
+ }, {
245
+ default: s(() => [
246
+ o.value.targetKey === "customExamples" ? (g(), U(Z, { key: 0 }, [
247
+ n(H, null, {
248
+ default: s(() => t[1] || (t[1] = [
249
+ K("Selected Example:")
250
+ ])),
251
+ _: 1,
252
+ __: [1]
253
+ }),
254
+ K(" " + D(d.value[o.value.clientKey].label ?? "Example"), 1)
255
+ ], 64)) : (g(), U(Z, { key: 1 }, [
256
+ n(H, null, {
257
+ default: s(() => t[2] || (t[2] = [
258
+ K("Selected HTTP client:")
259
+ ])),
260
+ _: 1,
261
+ __: [2]
262
+ }),
263
+ K(" " + D(r(se)) + " " + D(r(ne)), 1)
264
+ ], 64))
265
+ ]),
266
+ _: 1
267
+ }, 8, ["controls", "modelValue", "options"])
268
+ ]),
269
+ default: s(() => [
270
+ n(H, null, {
271
+ default: s(() => t[0] || (t[0] = [
272
+ K("Request Example for")
273
+ ])),
274
+ _: 1,
275
+ __: [0]
276
+ }),
277
+ n(r(ae), {
278
+ as: "span",
279
+ class: "request-method",
280
+ method: e.method
281
+ }, null, 8, ["method"]),
282
+ T(e.$slots, "header", {}, void 0, !0)
283
+ ]),
284
+ _: 3
285
+ }),
286
+ n(r(te), { class: "request-editor-section custom-scroll border-none p-0" }, {
287
+ default: s(() => [
288
+ _("div", {
289
+ id: `${r(F)}-example`,
290
+ class: "code-snippet"
291
+ }, [
292
+ n(r(Ke), {
293
+ class: "bg-b-2 !min-h-full -outline-offset-2",
294
+ content: z.value,
295
+ hideCredentials: ce.value,
296
+ lang: ie.value,
297
+ lineNumbers: ""
298
+ }, null, 8, ["content", "hideCredentials", "lang"])
299
+ ], 8, Je)
300
+ ]),
301
+ _: 1
302
+ }),
303
+ (X.value || !r(re).hideTestRequestButton) && e.$slots.footer ? (g(), w(r(be), {
304
+ key: 0,
305
+ class: "request-card-footer bg-b-3"
306
+ }, {
307
+ default: s(() => [
308
+ X.value ? (g(), U("div", Ue, [
309
+ n(Be, {
310
+ class: "request-example-selector",
311
+ examples: C.value,
312
+ modelValue: r(I),
313
+ "onUpdate:modelValue": pe
314
+ }, null, 8, ["examples", "modelValue"])
315
+ ])) : J("", !0),
316
+ T(e.$slots, "footer", {}, void 0, !0)
317
+ ]),
318
+ _: 3
319
+ })) : J("", !0)
320
+ ]),
321
+ _: 3
322
+ }, 512)) : e.fallback ? (g(), w(r(ee), {
323
+ key: 1,
324
+ class: "request-card dark-mode"
325
+ }, {
326
+ default: s(() => [
327
+ n(r(te), { class: "request-card-simple" }, {
328
+ default: s(() => [
329
+ _("div", De, [
330
+ n(r(ae), {
331
+ as: "span",
332
+ class: "request-method",
333
+ method: e.method
334
+ }, null, 8, ["method"]),
335
+ T(e.$slots, "header", {}, void 0, !0)
336
+ ]),
337
+ T(e.$slots, "footer", {}, void 0, !0)
338
+ ]),
339
+ _: 3
340
+ })
341
+ ]),
342
+ _: 3
343
+ })) : J("", !0);
344
+ }
345
+ });
346
+ export {
347
+ at as default
348
+ };
@@ -0,0 +1,34 @@
1
+ type __VLS_Props = {
2
+ modelValue: any;
3
+ options: {
4
+ value: string;
5
+ label: string;
6
+ options?: {
7
+ value: string;
8
+ label: string;
9
+ }[];
10
+ }[];
11
+ controls?: string;
12
+ };
13
+ declare function __VLS_template(): {
14
+ attrs: Partial<{}>;
15
+ slots: {
16
+ default?(_: {}): any;
17
+ };
18
+ refs: {};
19
+ rootEl: HTMLLabelElement;
20
+ };
21
+ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
22
+ declare const __VLS_component: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
23
+ "update:modelValue": (value: any) => any;
24
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
25
+ "onUpdate:modelValue"?: ((value: any) => any) | undefined;
26
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLLabelElement>;
27
+ declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
28
+ export default _default;
29
+ type __VLS_WithTemplateSlots<T, S> = T & {
30
+ new (): {
31
+ $slots: S;
32
+ };
33
+ };
34
+ //# sourceMappingURL=TextSelect.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-request/TextSelect.vue"],"names":[],"mappings":"AA4HA,KAAK,WAAW,GAAG;IACjB,UAAU,EAAE,GAAG,CAAA;IACf,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAA;QACb,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,CAAC,EAAE;YACR,KAAK,EAAE,MAAM,CAAA;YACb,KAAK,EAAE,MAAM,CAAA;SACd,EAAE,CAAA;KACJ,EAAE,CAAA;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,CAAC;AAkBF,iBAAS,cAAc;WAyDT,OAAO,IAA6B;;yBARrB,GAAG;;;;EAa/B;AAUD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;;;;+FAQnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -0,0 +1,48 @@
1
+ import { defineComponent as m, computed as v, createElementBlock as l, openBlock as o, normalizeClass as b, createElementVNode as u, renderSlot as _, Fragment as s, renderList as r, toDisplayString as p } from "vue";
2
+ const g = { class: "text-select-label" }, f = ["aria-controls", "tabindex", "value"], k = ["label"], y = ["value"], V = ["value"], S = /* @__PURE__ */ m({
3
+ __name: "TextSelect",
4
+ props: {
5
+ modelValue: {},
6
+ options: {},
7
+ controls: {}
8
+ },
9
+ emits: ["update:modelValue"],
10
+ setup(i) {
11
+ const d = i, c = v(
12
+ () => d.options.flatMap((e) => e.options ?? e).length
13
+ );
14
+ return (e, n) => (o(), l("label", {
15
+ class: b(["text-select", c.value === 1 ? "text-select--single-option" : ""])
16
+ }, [
17
+ u("span", g, [
18
+ _(e.$slots, "default")
19
+ ]),
20
+ u("select", {
21
+ "aria-controls": e.controls,
22
+ tabindex: e.options.length === 1 ? -1 : 0,
23
+ value: e.modelValue,
24
+ onInput: n[0] || (n[0] = (t) => e.$emit("update:modelValue", t.target.value))
25
+ }, [
26
+ (o(!0), l(s, null, r(e.options, (t) => (o(), l(s, {
27
+ key: t.value
28
+ }, [
29
+ t.options ? (o(), l("optgroup", {
30
+ key: 0,
31
+ label: t.label
32
+ }, [
33
+ (o(!0), l(s, null, r(t.options, (a) => (o(), l("option", {
34
+ key: a.value,
35
+ value: a.value
36
+ }, p(a.label), 9, y))), 128))
37
+ ], 8, k)) : (o(), l("option", {
38
+ key: t.value,
39
+ value: t.value
40
+ }, p(t.label), 9, V))
41
+ ], 64))), 128))
42
+ ], 40, f)
43
+ ], 2));
44
+ }
45
+ });
46
+ export {
47
+ S as default
48
+ };
@@ -0,0 +1,5 @@
1
+ import o from "./TextSelect.vue.js";
2
+ /* empty css */
3
+ export {
4
+ o as default
5
+ };
@@ -0,0 +1,3 @@
1
+ export { default as ExamplePicker } from './ExamplePicker.vue.js';
2
+ export { default as ExampleRequest } from './ExampleRequest.vue.js';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/example-request/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ExampleResponses.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponses.vue"],"names":[],"mappings":"AAmVA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAiBhE;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;;AAwUzD,wBAMG"}
1
+ {"version":3,"file":"ExampleResponses.vue.d.ts","sourceRoot":"","sources":["../../../src/features/example-responses/ExampleResponses.vue"],"names":[],"mappings":"AAmVA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAA;AAiBhE;;GAEG;AAEH,KAAK,WAAW,GAAG;IAAE,SAAS,EAAE,SAAS,CAAC,WAAW,CAAC,CAAA;CAAE,CAAC;;AAuVzD,wBAMG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./ExampleResponses.vue2.js";
2
2
  /* empty css */
3
3
  import p from "../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ p(o, [["__scopeId", "data-v-15c8f436"]]);
4
+ const m = /* @__PURE__ */ p(o, [["__scopeId", "data-v-65bd9cd0"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,16 +1,16 @@
1
- import { defineComponent as N, useId as O, ref as R, computed as v, createBlock as t, createCommentVNode as x, openBlock as o, unref as l, withCtx as u, createVNode as f, createElementBlock as k, Fragment as _, renderList as C, createTextVNode as g, toDisplayString as F, withDirectives as I, createElementVNode as w, vModelCheckbox as A } from "vue";
2
- import { ScalarCard as D, ScalarIcon as K, ScalarCardSection as L, ScalarCodeBlock as U, ScalarCardFooter as J, ScalarMarkdown as P } from "@scalar/components";
3
- import { normalizeMimeTypeObject as W, getObjectKeys as $ } from "@scalar/oas-utils/helpers";
4
- import { useClipboard as q } from "@scalar/use-hooks/useClipboard";
5
- import G from "../../components/ScreenReader.vue.js";
6
- import j from "./ExampleResponse.vue.js";
7
- import H from "./ExampleResponseTab.vue.js";
8
- import Q from "./ExampleResponseTabList.vue.js";
9
- import X from "../../v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js";
10
- const Y = {
1
+ import { defineComponent as N, useId as O, ref as E, computed as v, createBlock as t, createCommentVNode as x, openBlock as o, unref as l, withCtx as u, createVNode as k, createElementBlock as f, Fragment as j, renderList as C, createTextVNode as R, toDisplayString as F, withDirectives as I, createElementVNode as T, vModelCheckbox as A } from "vue";
2
+ import { ScalarCard as D, ScalarIcon as K, ScalarCardSection as L, ScalarCodeBlock as P, ScalarCardFooter as U, ScalarMarkdown as J } from "@scalar/components";
3
+ import { normalizeMimeTypeObject as W, getObjectKeys as q } from "@scalar/oas-utils/helpers";
4
+ import { useClipboard as G } from "@scalar/use-hooks/useClipboard";
5
+ import H from "../../components/ScreenReader.vue.js";
6
+ import V from "./ExampleResponse.vue.js";
7
+ import Q from "./ExampleResponseTab.vue.js";
8
+ import X from "./ExampleResponseTabList.vue.js";
9
+ import Y from "../example-request/ExamplePicker.vue.js";
10
+ const Z = {
11
11
  key: 1,
12
12
  class: "scalar-card-checkbox"
13
- }, Z = ["aria-controls"], z = {
13
+ }, $ = ["aria-controls"], z = {
14
14
  key: 1,
15
15
  class: "response-description"
16
16
  }, ne = /* @__PURE__ */ N({
@@ -18,18 +18,18 @@ const Y = {
18
18
  props: {
19
19
  responses: {}
20
20
  },
21
- setup(E) {
22
- const p = O(), { copyToClipboard: T } = q(), c = R(""), S = v(() => Object.keys(E.responses ?? {}).sort()), y = v(
21
+ setup(g) {
22
+ const n = O(), { copyToClipboard: _ } = G(), p = E(), S = v(() => Object.keys(g.responses ?? {}).sort()), y = v(
23
23
  () => !!s.value.examples
24
- ), V = R(0), i = v(() => {
24
+ ), w = E(0), i = v(() => {
25
25
  var a;
26
- const e = S.value[V.value];
27
- return (a = E.responses) == null ? void 0 : a[e];
26
+ const e = S.value[w.value];
27
+ return (a = g.responses) == null ? void 0 : a[e];
28
28
  }), s = v(() => {
29
29
  var m;
30
30
  const e = W(
31
31
  (m = i.value) == null ? void 0 : m.content
32
- ), a = $(e ?? {});
32
+ ), a = q(e ?? {});
33
33
  return (
34
34
  // OpenAPI 3.x
35
35
  (e == null ? void 0 : e["application/json"]) ?? (e == null ? void 0 : e["application/xml"]) ?? (e == null ? void 0 : e["text/plain"]) ?? (e == null ? void 0 : e["text/html"]) ?? (e == null ? void 0 : e["*/*"]) ?? // Take the first key - in the future we may want to use the selected content type
@@ -45,10 +45,10 @@ const Y = {
45
45
  return (a == null ? void 0 : a.value) ?? a;
46
46
  }, b = v(() => ({
47
47
  ...s.value,
48
- example: y.value && c.value ? s.value.examples[c.value].value ?? s.value.examples[c.value] : B()
48
+ example: y.value && p.value ? s.value.examples[p.value].value ?? s.value.examples[p.value] : B()
49
49
  })), M = (e) => {
50
- V.value = e, c.value = "";
51
- }, h = R(!1);
50
+ w.value = e, p.value = void 0;
51
+ }, h = E(!1);
52
52
  return (e, a) => S.value.length ? (o(), t(l(D), {
53
53
  key: 0,
54
54
  "aria-label": "Example Responses",
@@ -58,98 +58,97 @@ const Y = {
58
58
  default: u(() => {
59
59
  var m;
60
60
  return [
61
- f(Q, { onChange: M }, {
61
+ k(X, { onChange: M }, {
62
62
  actions: u(() => {
63
63
  var r, d;
64
64
  return [
65
- (r = s.value) != null && r.example ? (o(), k("button", {
65
+ (r = s.value) != null && r.example ? (o(), f("button", {
66
66
  key: 0,
67
67
  class: "code-copy",
68
68
  type: "button",
69
69
  onClick: a[0] || (a[0] = () => {
70
- var n;
71
- return l(T)((n = s.value) == null ? void 0 : n.example);
70
+ var c;
71
+ return l(_)((c = s.value) == null ? void 0 : c.example);
72
72
  })
73
73
  }, [
74
- f(l(K), {
74
+ k(l(K), {
75
75
  icon: "Clipboard",
76
76
  width: "12px"
77
77
  })
78
78
  ])) : x("", !0),
79
- (d = s.value) != null && d.schema ? (o(), k("label", Y, [
80
- a[4] || (a[4] = g(" Show Schema ")),
81
- I(w("input", {
82
- "onUpdate:modelValue": a[1] || (a[1] = (n) => h.value = n),
83
- "aria-controls": l(p),
79
+ (d = s.value) != null && d.schema ? (o(), f("label", Z, [
80
+ a[4] || (a[4] = R(" Show Schema ")),
81
+ I(T("input", {
82
+ "onUpdate:modelValue": a[1] || (a[1] = (c) => h.value = c),
83
+ "aria-controls": l(n),
84
84
  class: "scalar-card-checkbox-input",
85
85
  type: "checkbox"
86
- }, null, 8, Z), [
86
+ }, null, 8, $), [
87
87
  [A, h.value]
88
88
  ]),
89
- a[5] || (a[5] = w("span", { class: "scalar-card-checkbox-checkmark" }, null, -1))
89
+ a[5] || (a[5] = T("span", { class: "scalar-card-checkbox-checkmark" }, null, -1))
90
90
  ])) : x("", !0)
91
91
  ];
92
92
  }),
93
93
  default: u(() => [
94
- (o(!0), k(_, null, C(S.value, (r) => (o(), t(H, {
94
+ (o(!0), f(j, null, C(S.value, (r) => (o(), t(Q, {
95
95
  key: r,
96
- "aria-controls": l(p)
96
+ "aria-controls": l(n)
97
97
  }, {
98
98
  default: u(() => [
99
- f(G, null, {
99
+ k(H, null, {
100
100
  default: u(() => a[3] || (a[3] = [
101
- g("Status:")
101
+ R("Status:")
102
102
  ])),
103
103
  _: 1,
104
104
  __: [3]
105
105
  }),
106
- g(" " + F(r), 1)
106
+ R(" " + F(r), 1)
107
107
  ]),
108
108
  _: 2
109
109
  }, 1032, ["aria-controls"]))), 128))
110
110
  ]),
111
111
  _: 1
112
112
  }),
113
- f(l(L), { class: "grid flex-1" }, {
113
+ k(l(L), { class: "grid flex-1" }, {
114
114
  default: u(() => {
115
115
  var r;
116
116
  return [
117
- (r = s.value) != null && r.schema ? (o(), k(_, { key: 0 }, [
118
- h.value && b.value ? (o(), t(l(U), {
117
+ (r = s.value) != null && r.schema ? (o(), f(j, { key: 0 }, [
118
+ h.value && b.value ? (o(), t(l(P), {
119
119
  key: 0,
120
- id: l(p),
120
+ id: l(n),
121
121
  class: "-outline-offset-2",
122
122
  content: b.value,
123
123
  lang: "json"
124
- }, null, 8, ["id", "content"])) : (o(), t(j, {
124
+ }, null, 8, ["id", "content"])) : (o(), t(V, {
125
125
  key: 1,
126
- id: l(p),
126
+ id: l(n),
127
127
  response: b.value
128
128
  }, null, 8, ["id", "response"]))
129
- ], 64)) : (o(), t(j, {
129
+ ], 64)) : (o(), t(V, {
130
130
  key: 1,
131
- id: l(p),
131
+ id: l(n),
132
132
  response: b.value
133
133
  }, null, 8, ["id", "response"]))
134
134
  ];
135
135
  }),
136
136
  _: 1
137
137
  }),
138
- (m = i.value) != null && m.description || y.value ? (o(), t(l(J), {
138
+ (m = i.value) != null && m.description || y.value ? (o(), t(l(U), {
139
139
  key: 0,
140
140
  class: "response-card-footer"
141
141
  }, {
142
142
  default: u(() => {
143
143
  var r, d;
144
144
  return [
145
- y.value ? (o(), t(l(X), {
145
+ y.value ? (o(), t(l(Y), {
146
146
  key: 0,
147
147
  class: "response-example-selector",
148
148
  examples: (r = s.value) == null ? void 0 : r.examples,
149
- modelValue: c.value,
150
- "onUpdate:modelValue": a[2] || (a[2] = (n) => c.value = n)
151
- }, null, 8, ["examples", "modelValue"])) : (d = i.value) != null && d.description ? (o(), k("div", z, [
152
- f(l(P), {
149
+ "onUpdate:modelValue": a[2] || (a[2] = (c) => p.value = c)
150
+ }, null, 8, ["examples"])) : (d = i.value) != null && d.description ? (o(), f("div", z, [
151
+ k(l(J), {
153
152
  class: "markdown",
154
153
  value: i.value.description
155
154
  }, null, 8, ["value"])