@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.
- package/CHANGELOG.md +6 -0
- package/dist/blocks/constants.js +6 -0
- package/dist/blocks/helpers/getPointer.js +12 -0
- package/dist/blocks/hooks/useBlockProps.d.ts +31 -0
- package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -0
- package/dist/blocks/hooks/useBlockProps.js +24 -0
- package/dist/browser/standalone.js +14550 -14647
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +176 -164
- package/dist/components/Content/Content.vue.js +2 -2
- package/dist/components/Content/Content.vue2.js +5 -5
- package/dist/features/Operation/Operation.vue.d.ts +6 -6
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +49 -50
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +6 -8
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +28 -21
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +3 -5
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js +18 -33
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +12 -11
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +162 -164
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +13 -12
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +117 -111
- package/dist/features/api-client-modal/useApiClient.d.ts +5795 -5795
- package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
- package/dist/features/example-request/ExamplePicker.vue.d.ts +13 -0
- package/dist/features/example-request/ExamplePicker.vue.d.ts.map +1 -0
- package/dist/features/example-request/ExamplePicker.vue.js +7 -0
- package/dist/features/example-request/ExamplePicker.vue2.js +57 -0
- package/dist/features/example-request/ExampleRequest.vue.d.ts +85 -0
- package/dist/features/example-request/ExampleRequest.vue.d.ts.map +1 -0
- package/dist/features/example-request/ExampleRequest.vue.js +7 -0
- package/dist/features/example-request/ExampleRequest.vue2.js +348 -0
- package/dist/features/example-request/TextSelect.vue.d.ts +34 -0
- package/dist/features/example-request/TextSelect.vue.d.ts.map +1 -0
- package/dist/features/example-request/TextSelect.vue.js +48 -0
- package/dist/features/example-request/TextSelect.vue3.js +5 -0
- package/dist/features/example-request/index.d.ts +3 -0
- package/dist/features/example-request/index.d.ts.map +1 -0
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue2.js +50 -51
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts +2 -3
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
- package/dist/features/test-request-button/TestRequestButton.vue2.js +19 -21
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -13
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts +1 -3
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +86 -113
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +3 -20
- package/dist/v2/blocks/scalar-request-example-block/index.d.ts +2 -2
- package/dist/v2/events/index.d.ts +1 -1
- package/dist/v2/events/listeners.d.ts +1 -1
- package/package.json +10 -10
- package/dist/helpers/convert-security-scheme.js +0 -23
- package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +0 -4
- package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +0 -64
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +0 -7
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +0 -212
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +0 -35
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +0 -29
- package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +0 -10
- package/dist/v2/events/definitions.js +0 -7
- package/dist/v2/hooks/useStore.js +0 -14
|
@@ -1,212 +0,0 @@
|
|
|
1
|
-
import { defineComponent as O, computed as i, ref as C, watch as j, useId as I, createBlock as y, createCommentVNode as S, openBlock as m, unref as a, withCtx as s, createVNode as o, createSlots as N, createElementVNode as p, createElementBlock as b, renderSlot as v, toDisplayString as R } from "vue";
|
|
2
|
-
import { ScalarCard as x, ScalarCardHeader as H, ScalarCombobox as K, ScalarButton as M, ScalarCardSection as q, ScalarCodeBlock as W, ScalarCardFooter as z } from "@scalar/components";
|
|
3
|
-
import { freezeElement as D } from "@scalar/helpers/dom/freeze-element";
|
|
4
|
-
import { ScalarIconCaretDown as F } from "@scalar/icons";
|
|
5
|
-
import { isReference as U } from "@scalar/workspace-store/schemas/v3.1/type-guard";
|
|
6
|
-
import { findClient as E } from "../helpers/find-client.js";
|
|
7
|
-
import { generateClientOptions as A, generateCustomId as G } from "../helpers/generate-client-options.js";
|
|
8
|
-
import { generateCodeSnippet as J } from "../helpers/generate-code-snippet.js";
|
|
9
|
-
import { getSecrets as P } from "../helpers/get-secrets.js";
|
|
10
|
-
import Q from "./ExamplePicker.vue2.js";
|
|
11
|
-
import $ from "../../../../components/HttpMethod/HttpMethod.vue.js";
|
|
12
|
-
import { emitCustomEvent as B } from "../../../events/definitions.js";
|
|
13
|
-
const X = ["innerHTML"], Y = ["id"], Z = {
|
|
14
|
-
key: 0,
|
|
15
|
-
class: "request-card-footer-addon"
|
|
16
|
-
}, _ = { class: "request-header" }, ee = {}, fe = /* @__PURE__ */ O({
|
|
17
|
-
...ee,
|
|
18
|
-
__name: "RequestExample",
|
|
19
|
-
props: {
|
|
20
|
-
allowedClients: {},
|
|
21
|
-
selectedClient: {},
|
|
22
|
-
selectedServer: { default: () => ({ url: "/" }) },
|
|
23
|
-
selectedContentType: {},
|
|
24
|
-
selectedExample: {},
|
|
25
|
-
securitySchemes: { default: () => [] },
|
|
26
|
-
method: {},
|
|
27
|
-
path: {},
|
|
28
|
-
operation: {},
|
|
29
|
-
fallback: { type: Boolean },
|
|
30
|
-
generateLabel: { type: Function },
|
|
31
|
-
hideClientSelector: { type: Boolean, default: !1 }
|
|
32
|
-
},
|
|
33
|
-
setup(l) {
|
|
34
|
-
const d = i(() => {
|
|
35
|
-
var c, k;
|
|
36
|
-
if (U(l.operation.requestBody))
|
|
37
|
-
return {};
|
|
38
|
-
const e = ((c = l.operation.requestBody) == null ? void 0 : c.content) ?? {}, t = l.selectedContentType || Object.keys(e)[0];
|
|
39
|
-
return ((k = e[t]) == null ? void 0 : k.examples) ?? {};
|
|
40
|
-
}), h = C(
|
|
41
|
-
l.selectedExample ?? Object.keys(d.value)[0]
|
|
42
|
-
), g = i(() => [
|
|
43
|
-
"x-custom-examples",
|
|
44
|
-
"x-codeSamples",
|
|
45
|
-
"x-code-samples"
|
|
46
|
-
].flatMap(
|
|
47
|
-
(t) => l.operation[t] ?? []
|
|
48
|
-
)), f = i(
|
|
49
|
-
() => A(g.value, l.allowedClients)
|
|
50
|
-
), n = C(
|
|
51
|
-
E(f.value, l.selectedClient)
|
|
52
|
-
);
|
|
53
|
-
j(
|
|
54
|
-
() => l.selectedClient,
|
|
55
|
-
(e) => {
|
|
56
|
-
const t = E(f.value, e);
|
|
57
|
-
t && (n.value = t);
|
|
58
|
-
}
|
|
59
|
-
);
|
|
60
|
-
const V = i(() => {
|
|
61
|
-
var e;
|
|
62
|
-
try {
|
|
63
|
-
return n.value.id.startsWith("custom") ? ((e = g.value.find(
|
|
64
|
-
(t) => G(t) === n.value.id
|
|
65
|
-
)) == null ? void 0 : e.source) ?? "Custom example not found" : J({
|
|
66
|
-
clientId: n.value.id,
|
|
67
|
-
operation: l.operation,
|
|
68
|
-
method: l.method,
|
|
69
|
-
server: l.selectedServer,
|
|
70
|
-
securitySchemes: l.securitySchemes,
|
|
71
|
-
contentType: l.selectedContentType,
|
|
72
|
-
path: l.path,
|
|
73
|
-
example: d.value[h.value || ""]
|
|
74
|
-
});
|
|
75
|
-
} catch (t) {
|
|
76
|
-
return console.error("[generateSnippet]", t), "";
|
|
77
|
-
}
|
|
78
|
-
}), T = i(() => P(l.securitySchemes)), u = C(null), w = (e) => {
|
|
79
|
-
var t;
|
|
80
|
-
if (u.value) {
|
|
81
|
-
const r = D(u.value.$el);
|
|
82
|
-
setTimeout(() => {
|
|
83
|
-
r();
|
|
84
|
-
}, 300);
|
|
85
|
-
}
|
|
86
|
-
n.value = e, e.id.startsWith("custom") || B(
|
|
87
|
-
(t = u.value) == null ? void 0 : t.$el,
|
|
88
|
-
"scalar-update-selected-client",
|
|
89
|
-
e.id
|
|
90
|
-
);
|
|
91
|
-
}, L = I();
|
|
92
|
-
return (e, t) => f.value.length ? (m(), y(a(x), {
|
|
93
|
-
key: 0,
|
|
94
|
-
class: "request-card dark-mode",
|
|
95
|
-
ref_key: "elem",
|
|
96
|
-
ref: u
|
|
97
|
-
}, {
|
|
98
|
-
default: s(() => [
|
|
99
|
-
o(a(H), { class: "pr-0.75" }, N({
|
|
100
|
-
default: s(() => [
|
|
101
|
-
t[3] || (t[3] = p("span", { class: "sr-only" }, "Request Example for", -1)),
|
|
102
|
-
o(a($), {
|
|
103
|
-
as: "span",
|
|
104
|
-
class: "request-method",
|
|
105
|
-
method: e.method
|
|
106
|
-
}, null, 8, ["method"]),
|
|
107
|
-
e.generateLabel ? (m(), b("span", {
|
|
108
|
-
key: 0,
|
|
109
|
-
innerHTML: e.generateLabel()
|
|
110
|
-
}, null, 8, X)) : v(e.$slots, "header", { key: 1 }, void 0, !0)
|
|
111
|
-
]),
|
|
112
|
-
_: 2
|
|
113
|
-
}, [
|
|
114
|
-
e.hideClientSelector ? void 0 : {
|
|
115
|
-
name: "actions",
|
|
116
|
-
fn: s(() => [
|
|
117
|
-
o(a(K), {
|
|
118
|
-
class: "max-h-80",
|
|
119
|
-
modelValue: n.value,
|
|
120
|
-
options: f.value,
|
|
121
|
-
teleport: "",
|
|
122
|
-
placement: "bottom-end",
|
|
123
|
-
"onUpdate:modelValue": t[0] || (t[0] = (r) => w(r))
|
|
124
|
-
}, {
|
|
125
|
-
default: s(() => [
|
|
126
|
-
o(a(M), {
|
|
127
|
-
"data-testid": "client-picker",
|
|
128
|
-
class: "text-c-1 hover:bg-b-3 flex h-full w-fit gap-1.5 px-1.5 py-0.75 font-normal",
|
|
129
|
-
fullWidth: "",
|
|
130
|
-
variant: "ghost"
|
|
131
|
-
}, {
|
|
132
|
-
default: s(() => [
|
|
133
|
-
p("span", null, R(n.value.title), 1),
|
|
134
|
-
o(a(F))
|
|
135
|
-
]),
|
|
136
|
-
_: 1
|
|
137
|
-
})
|
|
138
|
-
]),
|
|
139
|
-
_: 1
|
|
140
|
-
}, 8, ["modelValue", "options"])
|
|
141
|
-
]),
|
|
142
|
-
key: "0"
|
|
143
|
-
}
|
|
144
|
-
]), 1024),
|
|
145
|
-
o(a(q), { class: "request-editor-section custom-scroll p-0" }, {
|
|
146
|
-
default: s(() => [
|
|
147
|
-
p("div", {
|
|
148
|
-
id: `${a(L)}-example`,
|
|
149
|
-
class: "code-snippet"
|
|
150
|
-
}, [
|
|
151
|
-
o(a(W), {
|
|
152
|
-
class: "bg-b-2 !min-h-full -outline-offset-2",
|
|
153
|
-
content: V.value,
|
|
154
|
-
hideCredentials: T.value,
|
|
155
|
-
lang: n.value.lang,
|
|
156
|
-
lineNumbers: ""
|
|
157
|
-
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
158
|
-
], 8, Y)
|
|
159
|
-
]),
|
|
160
|
-
_: 1
|
|
161
|
-
}),
|
|
162
|
-
Object.keys(d.value).length || e.$slots.footer ? (m(), y(a(z), {
|
|
163
|
-
key: 0,
|
|
164
|
-
class: "request-card-footer bg-b-3"
|
|
165
|
-
}, {
|
|
166
|
-
default: s(() => [
|
|
167
|
-
Object.keys(d.value).length ? (m(), b("div", Z, [
|
|
168
|
-
o(Q, {
|
|
169
|
-
examples: d.value,
|
|
170
|
-
modelValue: h.value,
|
|
171
|
-
"onUpdate:modelValue": [
|
|
172
|
-
t[1] || (t[1] = (r) => h.value = r),
|
|
173
|
-
t[2] || (t[2] = (r) => {
|
|
174
|
-
var c;
|
|
175
|
-
return a(B)((c = u.value) == null ? void 0 : c.$el, "scalar-update-selected-example", r);
|
|
176
|
-
})
|
|
177
|
-
]
|
|
178
|
-
}, null, 8, ["examples", "modelValue"])
|
|
179
|
-
])) : S("", !0),
|
|
180
|
-
v(e.$slots, "footer", {}, void 0, !0)
|
|
181
|
-
]),
|
|
182
|
-
_: 3
|
|
183
|
-
})) : S("", !0)
|
|
184
|
-
]),
|
|
185
|
-
_: 3
|
|
186
|
-
}, 512)) : e.fallback ? (m(), y(a(x), {
|
|
187
|
-
key: 1,
|
|
188
|
-
class: "request-card dark-mode"
|
|
189
|
-
}, {
|
|
190
|
-
default: s(() => [
|
|
191
|
-
o(a(q), { class: "request-card-simple" }, {
|
|
192
|
-
default: s(() => [
|
|
193
|
-
p("div", _, [
|
|
194
|
-
o(a($), {
|
|
195
|
-
as: "span",
|
|
196
|
-
class: "request-method",
|
|
197
|
-
method: e.method
|
|
198
|
-
}, null, 8, ["method"]),
|
|
199
|
-
v(e.$slots, "header", {}, void 0, !0)
|
|
200
|
-
]),
|
|
201
|
-
v(e.$slots, "footer", {}, void 0, !0)
|
|
202
|
-
]),
|
|
203
|
-
_: 3
|
|
204
|
-
})
|
|
205
|
-
]),
|
|
206
|
-
_: 3
|
|
207
|
-
})) : S("", !0);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
export {
|
|
211
|
-
fe as default
|
|
212
|
-
};
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { snippetz as a } from "@scalar/snippetz";
|
|
2
|
-
import { capitalize as r } from "vue";
|
|
3
|
-
const f = (l) => `custom/${l.lang}`, u = (l, i) => {
|
|
4
|
-
const o = a().clients().flatMap((t) => {
|
|
5
|
-
const n = t.clients.flatMap((e) => {
|
|
6
|
-
const c = `${t.key}/${e.client}`;
|
|
7
|
-
return i && !i.includes(c) ? [] : {
|
|
8
|
-
id: c,
|
|
9
|
-
lang: e.client === "curl" ? "curl" : t.key,
|
|
10
|
-
title: `${r(t.title)} ${e.title}`,
|
|
11
|
-
label: e.title
|
|
12
|
-
};
|
|
13
|
-
});
|
|
14
|
-
return n.length === 0 ? [] : {
|
|
15
|
-
label: t.title,
|
|
16
|
-
options: n
|
|
17
|
-
};
|
|
18
|
-
}), s = l.map((t) => {
|
|
19
|
-
const n = f(t), e = t.label || t.lang || n;
|
|
20
|
-
return {
|
|
21
|
-
id: n,
|
|
22
|
-
lang: t.lang || "plaintext",
|
|
23
|
-
title: e,
|
|
24
|
-
label: e
|
|
25
|
-
};
|
|
26
|
-
});
|
|
27
|
-
return s.length > 0 && o.unshift({
|
|
28
|
-
label: "Code Examples",
|
|
29
|
-
options: s
|
|
30
|
-
}), o;
|
|
31
|
-
};
|
|
32
|
-
export {
|
|
33
|
-
u as generateClientOptions,
|
|
34
|
-
f as generateCustomId
|
|
35
|
-
};
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { operationToHar as u } from "@scalar/oas-utils/helpers/operation-to-har";
|
|
2
|
-
import { isReference as d } from "@scalar/workspace-store/schemas/v3.1/type-guard";
|
|
3
|
-
import { getSnippet as l } from "@scalar/api-client/views/Components/CodeSnippet";
|
|
4
|
-
const S = ({
|
|
5
|
-
clientId: t,
|
|
6
|
-
operation: e,
|
|
7
|
-
method: o,
|
|
8
|
-
path: n,
|
|
9
|
-
example: i,
|
|
10
|
-
contentType: p,
|
|
11
|
-
server: s,
|
|
12
|
-
securitySchemes: a
|
|
13
|
-
}) => {
|
|
14
|
-
if (d(e))
|
|
15
|
-
return "";
|
|
16
|
-
const c = u({
|
|
17
|
-
operation: e,
|
|
18
|
-
contentType: p,
|
|
19
|
-
method: o,
|
|
20
|
-
path: n,
|
|
21
|
-
server: s,
|
|
22
|
-
securitySchemes: a,
|
|
23
|
-
example: i
|
|
24
|
-
}), [m, f] = t.split("/"), [r, g] = l(m, f, c);
|
|
25
|
-
return r ? r.message ?? "Error generating code snippet" : g;
|
|
26
|
-
};
|
|
27
|
-
export {
|
|
28
|
-
S as generateCodeSnippet
|
|
29
|
-
};
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { isDefined as o } from "@scalar/helpers/array/is-defined";
|
|
2
|
-
const e = (t) => t.flatMap((r) => r.type === "apiKey" ? r["x-scalar-secret-token"] : (r == null ? void 0 : r.type) === "http" ? [
|
|
3
|
-
r["x-scalar-secret-token"],
|
|
4
|
-
r["x-scalar-secret-username"],
|
|
5
|
-
r["x-scalar-secret-password"],
|
|
6
|
-
btoa(`${r["x-scalar-secret-username"]}:${r["x-scalar-secret-password"]}`)
|
|
7
|
-
] : r.type === "oauth2" ? Object.values(r.flows).map((a) => a["x-scalar-secret-token"]) : []).filter(o);
|
|
8
|
-
export {
|
|
9
|
-
e as getSecrets
|
|
10
|
-
};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { provide as r, inject as n } from "vue";
|
|
2
|
-
const o = Symbol(), a = (e) => {
|
|
3
|
-
if (e)
|
|
4
|
-
return r(o, e), e;
|
|
5
|
-
const t = n(o);
|
|
6
|
-
if (!t)
|
|
7
|
-
throw new Error(
|
|
8
|
-
"useStore() was called without a store and no store instance was found. Make sure to call useStore(store) in a parent component first."
|
|
9
|
-
);
|
|
10
|
-
return t;
|
|
11
|
-
};
|
|
12
|
-
export {
|
|
13
|
-
a as useStore
|
|
14
|
-
};
|