@scalar/api-reference 1.24.30 → 1.24.33

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 (47) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/browser/standalone.js +12437 -11954
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  6. package/dist/components/ApiReferenceLayout.vue2.js +37 -37
  7. package/dist/components/Content/Operation/Operation.vue.d.ts.map +1 -1
  8. package/dist/components/Content/Operation/Operation.vue.js +2 -2
  9. package/dist/components/Content/Operation/Operation.vue2.js +52 -71
  10. package/dist/components/Content/Operation/OperationAccordion.vue.d.ts.map +1 -1
  11. package/dist/components/Content/Operation/OperationAccordion.vue.js +2 -2
  12. package/dist/components/Content/Operation/OperationAccordion.vue2.js +12 -12
  13. package/dist/components/Content/Operation/PathResponses/PathResponses.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Operation/PathResponses/PathResponses.vue.js +2 -2
  15. package/dist/components/Content/Operation/PathResponses/PathResponses.vue2.js +13 -13
  16. package/dist/components/SearchModal.vue.js +1 -1
  17. package/dist/components/SearchModal.vue2.js +2 -2
  18. package/dist/features/ExampleRequest/ExamplePicker.vue.d.ts.map +1 -0
  19. package/dist/features/ExampleRequest/ExamplePicker.vue.js +7 -0
  20. package/dist/features/ExampleRequest/ExampleRequest.stories.d.ts.map +1 -0
  21. package/dist/{components/Content/Operation/CustomRequestExamples.vue.d.ts → features/ExampleRequest/ExampleRequest.vue.d.ts} +3 -3
  22. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -0
  23. package/dist/features/ExampleRequest/ExampleRequest.vue.js +7 -0
  24. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +246 -0
  25. package/dist/features/ExampleRequest/TextSelect.vue.d.ts.map +1 -0
  26. package/dist/features/ExampleRequest/index.d.ts +3 -0
  27. package/dist/features/ExampleRequest/index.d.ts.map +1 -0
  28. package/dist/index.js +1 -1
  29. package/dist/style.css +1 -1
  30. package/package.json +5 -5
  31. package/dist/components/Content/Operation/CustomRequestExamples.vue.d.ts.map +0 -1
  32. package/dist/components/Content/Operation/CustomRequestExamples.vue.js +0 -7
  33. package/dist/components/Content/Operation/CustomRequestExamples.vue2.js +0 -124
  34. package/dist/components/Content/Operation/ExamplePicker.vue.d.ts.map +0 -1
  35. package/dist/components/Content/Operation/ExamplePicker.vue.js +0 -7
  36. package/dist/components/Content/Operation/ExampleRequest.stories.d.ts.map +0 -1
  37. package/dist/components/Content/Operation/ExampleRequest.vue.d.ts +0 -25
  38. package/dist/components/Content/Operation/ExampleRequest.vue.d.ts.map +0 -1
  39. package/dist/components/Content/Operation/ExampleRequest.vue.js +0 -7
  40. package/dist/components/Content/Operation/ExampleRequest.vue2.js +0 -188
  41. package/dist/components/Content/Operation/TextSelect.vue.d.ts.map +0 -1
  42. /package/dist/{components/Content/Operation → features/ExampleRequest}/ExamplePicker.vue.d.ts +0 -0
  43. /package/dist/{components/Content/Operation → features/ExampleRequest}/ExamplePicker.vue2.js +0 -0
  44. /package/dist/{components/Content/Operation → features/ExampleRequest}/ExampleRequest.stories.d.ts +0 -0
  45. /package/dist/{components/Content/Operation → features/ExampleRequest}/TextSelect.vue.d.ts +0 -0
  46. /package/dist/{components/Content/Operation → features/ExampleRequest}/TextSelect.vue.js +0 -0
  47. /package/dist/{components/Content/Operation → features/ExampleRequest}/TextSelect.vue3.js +0 -0
@@ -0,0 +1,7 @@
1
+ import o from "./ExampleRequest.vue2.js";
2
+ /* empty css */
3
+ import t from "../../_virtual/_plugin-vue_export-helper.js";
4
+ const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ad03e328"]]);
5
+ export {
6
+ p as default
7
+ };
@@ -0,0 +1,246 @@
1
+ import { defineComponent as I, ref as _, watch as L, computed as y, inject as M, onServerPrefetch as Y, useSSRContext as z, openBlock as d, createBlock as V, unref as a, withCtx as p, createVNode as i, createElementBlock as v, Fragment as H, createTextVNode as O, toDisplayString as K, createElementVNode as x, renderSlot as j, createCommentVNode as N } from "vue";
2
+ import { ScalarIcon as D, ScalarCodeBlock as Q } from "@scalar/components";
3
+ import { createHash as W, ssrState as X } from "@scalar/oas-utils/helpers";
4
+ import { getRequestFromOperation as Z } from "@scalar/oas-utils/spec-getters";
5
+ import { snippetz as R } from "@scalar/snippetz";
6
+ import { asyncComputed as G } from "@vueuse/core";
7
+ import { HTTPSnippet as ee } from "httpsnippet-lite";
8
+ import te from "./ExamplePicker.vue.js";
9
+ import oe from "./TextSelect.vue.js";
10
+ /* empty css */
11
+ import { GLOBAL_SECURITY_SYMBOL as re } from "../../helpers/provideSymbols.js";
12
+ import ae from "../../components/Card/Card.vue.js";
13
+ import ne from "../../components/Card/CardHeader.vue.js";
14
+ import se from "../../components/HttpMethod/HttpMethod.vue.js";
15
+ import le from "../../components/Card/CardContent.vue.js";
16
+ import { getSecretCredentialsFromAuthentication as ie, getRequestFromAuthentication as ce } from "../../legacy/helpers/getRequestFromAuthentication.js";
17
+ import pe from "../../components/Card/CardFooter.vue.js";
18
+ import { useClipboard as me } from "../../hooks/useClipboard.js";
19
+ import { useHttpClientStore as ue } from "../../stores/useHttpClientStore.js";
20
+ import { getApiClientRequest as de } from "../../helpers/getApiClientRequest.js";
21
+ import { useServerStore as fe } from "../../legacy/stores/useServerStore.js";
22
+ import { useAuthenticationStore as ye } from "../../legacy/stores/useAuthenticationStore.js";
23
+ import { getHarRequest as ge } from "../../helpers/getHarRequest.js";
24
+ import { getUrlFromServerState as he } from "../../legacy/helpers/getUrlFromServerState.js";
25
+ const ve = { class: "request-header" }, Ke = { class: "code-snippet" }, xe = {
26
+ key: 0,
27
+ class: "request-card-footer-addon"
28
+ }, Ye = /* @__PURE__ */ I({
29
+ __name: "ExampleRequest",
30
+ props: {
31
+ customExamples: {},
32
+ operation: {}
33
+ },
34
+ setup(T) {
35
+ var q;
36
+ const n = T, C = `components-Content-Operation-Example-Request${W(
37
+ n.operation.path + n.operation.httpVerb + n.operation.operationId
38
+ )}`, E = _(), { copyToClipboard: B } = me(), {
39
+ httpClient: s,
40
+ setHttpClient: $,
41
+ availableTargets: w,
42
+ httpTargetTitle: F,
43
+ httpClientTitle: A
44
+ } = ue(), { server: S } = fe(), { authentication: g } = ye(), l = _(
45
+ // Default to first custom example
46
+ (q = n.customExamples) != null && q.length ? {
47
+ targetKey: "customExamples",
48
+ clientKey: 0
49
+ } : (
50
+ // Otherwise use the globally selected HTTP client
51
+ {
52
+ targetKey: s.targetKey,
53
+ clientKey: s.clientKey
54
+ }
55
+ )
56
+ );
57
+ L(s, () => {
58
+ l.value = {
59
+ targetKey: s.targetKey,
60
+ clientKey: s.clientKey
61
+ };
62
+ });
63
+ const b = y(
64
+ () => {
65
+ var t, o, e, r;
66
+ return Object.keys(
67
+ ((r = (e = (o = (t = n.operation.information) == null ? void 0 : t.requestBody) == null ? void 0 : o.content) == null ? void 0 : e["application/json"]) == null ? void 0 : r.examples) ?? {}
68
+ ).length > 1;
69
+ }
70
+ ), c = M(re);
71
+ async function k() {
72
+ var r, m, u;
73
+ if (l.value.targetKey === "customExamples")
74
+ return ((m = (r = n.customExamples) == null ? void 0 : r[l.value.clientKey]) == null ? void 0 : m.source) ?? "";
75
+ const t = ge(
76
+ {
77
+ url: he(S)
78
+ },
79
+ Z(
80
+ n.operation,
81
+ {
82
+ replaceVariables: !0
83
+ },
84
+ E.value
85
+ ),
86
+ ce(
87
+ g,
88
+ ((u = n.operation.information) == null ? void 0 : u.security) ?? (c == null ? void 0 : c())
89
+ )
90
+ ), o = s.clientKey === "undici" || s.clientKey === "fetch" || s.clientKey === "ofetch" ? s.clientKey : null, e = s.targetKey.replace("javascript", "js");
91
+ if (o && R().hasPlugin(e, o) && (e === "node" || e === "js"))
92
+ return R().print(e, o, t) ?? "";
93
+ try {
94
+ return await new ee(t).convert(
95
+ s.targetKey,
96
+ s.clientKey
97
+ );
98
+ } catch (f) {
99
+ return console.error("[ExampleRequest]", f), "";
100
+ }
101
+ }
102
+ const h = G(async () => {
103
+ try {
104
+ return await k();
105
+ } catch (t) {
106
+ return console.error("[generateSnippet]", t), "";
107
+ }
108
+ }, X[C] ?? "");
109
+ Y(async () => {
110
+ const t = z();
111
+ t.payload.data[C] = await k();
112
+ }), y(() => de({
113
+ serverState: S,
114
+ authenticationState: g,
115
+ operation: n.operation,
116
+ globalSecurity: c == null ? void 0 : c()
117
+ }));
118
+ const J = y(() => {
119
+ var o, e, r;
120
+ const t = (
121
+ // Specified language
122
+ ((o = l.value) == null ? void 0 : o.targetKey) === "customExamples" ? ((r = (e = n.customExamples) == null ? void 0 : e[l.value.clientKey]) == null ? void 0 : r.lang) ?? "plaintext" : (
123
+ // Or language for the globally selected HTTP client
124
+ s.targetKey
125
+ )
126
+ );
127
+ return t === "shell" && h.value.includes("curl") ? "curl" : t === "Objective-C" ? "objc" : t;
128
+ }), P = y(() => {
129
+ var o;
130
+ const t = w.value.map((e) => ({
131
+ value: e.key,
132
+ label: e.title,
133
+ options: e.clients.map((r) => ({
134
+ value: JSON.stringify({
135
+ targetKey: e.key,
136
+ clientKey: r.key
137
+ }),
138
+ label: r.title
139
+ }))
140
+ }));
141
+ return (o = n.customExamples) != null && o.length && t.unshift({
142
+ value: "customExamples",
143
+ label: "Examples",
144
+ options: n.customExamples.map((e, r) => ({
145
+ value: JSON.stringify({
146
+ targetKey: "customExamples",
147
+ clientKey: r
148
+ }),
149
+ label: e.label ?? e.lang ?? `Example #${r + 1}`
150
+ }))
151
+ }), t;
152
+ });
153
+ function U(t) {
154
+ const o = JSON.parse(t);
155
+ o.targetKey === "customExamples" ? l.value = o : $(o);
156
+ }
157
+ return (t, o) => (d(), V(a(ae), { class: "dark-mode" }, {
158
+ default: p(() => [
159
+ i(a(ne), { muted: "" }, {
160
+ actions: p(() => [
161
+ i(oe, {
162
+ class: "request-client-picker",
163
+ modelValue: JSON.stringify(l.value),
164
+ options: P.value,
165
+ "onUpdate:modelValue": U
166
+ }, {
167
+ default: p(() => {
168
+ var e;
169
+ return [
170
+ l.value.targetKey === "customExamples" ? (d(), v(H, { key: 0 }, [
171
+ O(K(((e = n.customExamples) == null ? void 0 : e[l.value.clientKey].label) ?? "Example"), 1)
172
+ ], 64)) : (d(), v(H, { key: 1 }, [
173
+ O(K(a(F)) + " " + K(a(A)), 1)
174
+ ], 64))
175
+ ];
176
+ }),
177
+ _: 1
178
+ }, 8, ["modelValue", "options"]),
179
+ x("button", {
180
+ class: "copy-button",
181
+ type: "button",
182
+ onClick: o[0] || (o[0] = (e) => a(B)(a(h)))
183
+ }, [
184
+ i(a(D), {
185
+ icon: "Clipboard",
186
+ width: "10px"
187
+ })
188
+ ])
189
+ ]),
190
+ default: p(() => [
191
+ x("div", ve, [
192
+ i(a(se), {
193
+ as: "span",
194
+ class: "request-method",
195
+ method: t.operation.httpVerb
196
+ }, null, 8, ["method"]),
197
+ j(t.$slots, "header", {}, void 0, !0)
198
+ ])
199
+ ]),
200
+ _: 3
201
+ }),
202
+ i(a(le), {
203
+ borderless: "",
204
+ class: "request-editor-section custom-scroll",
205
+ frameless: ""
206
+ }, {
207
+ default: p(() => [
208
+ x("div", Ke, [
209
+ i(a(Q), {
210
+ content: a(h),
211
+ hideCredentials: a(ie)(a(g)),
212
+ lang: J.value,
213
+ lineNumbers: ""
214
+ }, null, 8, ["content", "hideCredentials", "lang"])
215
+ ])
216
+ ]),
217
+ _: 1
218
+ }),
219
+ b.value || t.$slots.footer ? (d(), V(a(pe), {
220
+ key: 0,
221
+ class: "request-card-footer",
222
+ contrast: ""
223
+ }, {
224
+ default: p(() => {
225
+ var e, r, m, u;
226
+ return [
227
+ b.value ? (d(), v("div", xe, [
228
+ i(te, {
229
+ class: "request-example-selector",
230
+ examples: ((u = (m = (r = (e = t.operation.information) == null ? void 0 : e.requestBody) == null ? void 0 : r.content) == null ? void 0 : m["application/json"]) == null ? void 0 : u.examples) ?? [],
231
+ "onUpdate:modelValue": o[1] || (o[1] = (f) => E.value = f)
232
+ }, null, 8, ["examples"])
233
+ ])) : N("", !0),
234
+ j(t.$slots, "footer", {}, void 0, !0)
235
+ ];
236
+ }),
237
+ _: 3
238
+ })) : N("", !0)
239
+ ]),
240
+ _: 3
241
+ }));
242
+ }
243
+ });
244
+ export {
245
+ Ye as default
246
+ };
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TextSelect.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ExampleRequest/TextSelect.vue"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAuMA,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -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/ExampleRequest/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAC9D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,sBAAsB,CAAA"}