@scalar/api-reference 1.14.10 → 1.15.1
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 +25 -0
- package/dist/browser/standalone.js +9 -9
- package/dist/components/ApiReferenceLayout.vue.d.ts +0 -2
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/EndpointsOverview.vue.d.ts.map +1 -1
- package/dist/components/Content/ReferenceEndpoint/CustomRequestExamples.vue.d.ts.map +1 -1
- package/dist/components/Content/ReferenceEndpoint/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/components/Content/ReferenceEndpoint/ReferenceEndpointAccordion.vue.d.ts.map +1 -1
- package/dist/components/Content/ReferenceEndpoint/TryRequestButton.vue.d.ts.map +1 -1
- package/dist/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/components/SidebarElement.vue.d.ts.map +1 -1
- package/dist/{index-e4a1ff91.js → index-2705292f.js} +27225 -27162
- package/dist/index-38f580a4.js +245 -0
- package/dist/index.js +2 -2
- package/package.json +4 -4
- package/dist/index-745cc021.js +0 -249
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { defineComponent as E, ref as C, watch as N, openBlock as m, createElementBlock as v, Fragment as k, createElementVNode as U, unref as a, createTextVNode as p, createCommentVNode as w, renderSlot as S, createVNode as n, withCtx as u, toDisplayString as R, computed as D, isRef as B, normalizeClass as L, createBlock as T } from "vue";
|
|
2
|
+
import { o as j, H as F, E as H, U as O, u as I, f as A, _ as $, a as J, m as z, R as Q } from "./index-2705292f.js";
|
|
3
|
+
import { b as Be } from "./index-2705292f.js";
|
|
4
|
+
import { useMediaQuery as W, useFileDialog as Y } from "@vueuse/core";
|
|
5
|
+
import "@headlessui/vue";
|
|
6
|
+
import "axios";
|
|
7
|
+
import "github-slugger";
|
|
8
|
+
import "@vcarl/remark-headings";
|
|
9
|
+
import "remark-parse";
|
|
10
|
+
import "remark-stringify";
|
|
11
|
+
import "unified";
|
|
12
|
+
import "js-yaml";
|
|
13
|
+
import "httpsnippet-lite";
|
|
14
|
+
import "unhead";
|
|
15
|
+
import "rehype-external-links";
|
|
16
|
+
import "rehype-format";
|
|
17
|
+
import "rehype-highlight";
|
|
18
|
+
import "rehype-raw";
|
|
19
|
+
import "rehype-sanitize";
|
|
20
|
+
import "rehype-stringify";
|
|
21
|
+
import "remark-gfm";
|
|
22
|
+
import "remark-rehype";
|
|
23
|
+
import "@floating-ui/vue";
|
|
24
|
+
import "fuse.js";
|
|
25
|
+
const q = (l) => {
|
|
26
|
+
if (typeof l != "string")
|
|
27
|
+
return !1;
|
|
28
|
+
try {
|
|
29
|
+
JSON.parse(l);
|
|
30
|
+
} catch {
|
|
31
|
+
return !1;
|
|
32
|
+
}
|
|
33
|
+
return !0;
|
|
34
|
+
}, G = { class: "swagger-editor-header" }, K = { class: "swagger-editor-title" }, P = { class: "swagger-editor-actions" }, X = { key: 0 }, Z = { key: 0 }, ee = { class: "swagger-editor-modal-layout" }, te = /* @__PURE__ */ E({
|
|
35
|
+
__name: "SwaggerEditorHeader",
|
|
36
|
+
props: {
|
|
37
|
+
proxyUrl: {}
|
|
38
|
+
},
|
|
39
|
+
emits: ["import"],
|
|
40
|
+
setup(l, { expose: _, emit: c }) {
|
|
41
|
+
const o = l, t = W("(max-width: 1000px)"), { files: r, open: g, reset: x } = Y({
|
|
42
|
+
multiple: !1,
|
|
43
|
+
accept: ".json,.yaml,.yml"
|
|
44
|
+
}), e = j(), f = C(null);
|
|
45
|
+
_({
|
|
46
|
+
importUrlModal: e,
|
|
47
|
+
openFileDialog: g
|
|
48
|
+
});
|
|
49
|
+
const d = C(""), y = () => {
|
|
50
|
+
f.value = "", A(d.value, o.proxyUrl).then(async (i) => {
|
|
51
|
+
c("import", i), e.hide();
|
|
52
|
+
}).catch((i) => {
|
|
53
|
+
console.error("[importUrl]", i), f.value = i;
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
return N(r, () => {
|
|
57
|
+
var i;
|
|
58
|
+
if ((i = r.value) != null && i.length) {
|
|
59
|
+
const s = r.value[0], h = new FileReader();
|
|
60
|
+
h.onload = (V) => {
|
|
61
|
+
var M;
|
|
62
|
+
const b = (M = V.target) == null ? void 0 : M.result;
|
|
63
|
+
typeof b == "string" && (c("import", b), x());
|
|
64
|
+
}, h.readAsText(s);
|
|
65
|
+
}
|
|
66
|
+
}), (i, s) => (m(), v(k, null, [
|
|
67
|
+
U("div", G, [
|
|
68
|
+
U("div", K, [
|
|
69
|
+
a(t) ? w("", !0) : (m(), v(k, { key: 0 }, [
|
|
70
|
+
p("Swagger ")
|
|
71
|
+
], 64)),
|
|
72
|
+
p("Editor ")
|
|
73
|
+
]),
|
|
74
|
+
S(i.$slots, "tab-items", {}, void 0, !0),
|
|
75
|
+
U("div", P, [
|
|
76
|
+
n(F, {
|
|
77
|
+
onClick: s[0] || (s[0] = () => a(g)())
|
|
78
|
+
}, {
|
|
79
|
+
default: u(() => [
|
|
80
|
+
p(" Upload"),
|
|
81
|
+
a(t) ? w("", !0) : (m(), v("span", X, " File"))
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}),
|
|
85
|
+
n(F, {
|
|
86
|
+
onClick: s[1] || (s[1] = (h) => a(e).show())
|
|
87
|
+
}, {
|
|
88
|
+
default: u(() => [
|
|
89
|
+
a(t) ? w("", !0) : (m(), v("span", Z, "Import ")),
|
|
90
|
+
p("URL ")
|
|
91
|
+
]),
|
|
92
|
+
_: 1
|
|
93
|
+
})
|
|
94
|
+
])
|
|
95
|
+
]),
|
|
96
|
+
n(a(H), {
|
|
97
|
+
state: a(e),
|
|
98
|
+
title: "Import Swagger from URL"
|
|
99
|
+
}, {
|
|
100
|
+
default: u(() => [
|
|
101
|
+
U("div", ee, [
|
|
102
|
+
n(a(O), {
|
|
103
|
+
modelValue: d.value,
|
|
104
|
+
"onUpdate:modelValue": s[2] || (s[2] = (h) => d.value = h),
|
|
105
|
+
autofocus: "",
|
|
106
|
+
class: "swagger-editor-modal-layout-input",
|
|
107
|
+
label: "URL",
|
|
108
|
+
labelShadowColor: "var(--theme-background-1, var(--default-theme-background-1))",
|
|
109
|
+
placeholder: "https://scalar.com/swagger.json"
|
|
110
|
+
}, null, 8, ["modelValue"]),
|
|
111
|
+
p(" " + R(f.value) + " ", 1),
|
|
112
|
+
n(a(I), {
|
|
113
|
+
variant: "outlined",
|
|
114
|
+
onClick: s[3] || (s[3] = (h) => a(e).hide())
|
|
115
|
+
}, {
|
|
116
|
+
default: u(() => [
|
|
117
|
+
p(" Cancel ")
|
|
118
|
+
]),
|
|
119
|
+
_: 1
|
|
120
|
+
}),
|
|
121
|
+
n(a(I), { onClick: y }, {
|
|
122
|
+
default: u(() => [
|
|
123
|
+
p("Import")
|
|
124
|
+
]),
|
|
125
|
+
_: 1
|
|
126
|
+
})
|
|
127
|
+
])
|
|
128
|
+
]),
|
|
129
|
+
_: 1
|
|
130
|
+
}, 8, ["state"])
|
|
131
|
+
], 64));
|
|
132
|
+
}
|
|
133
|
+
}), re = /* @__PURE__ */ $(te, [["__scopeId", "data-v-17d421af"]]), oe = { class: "swagger-editor-input" }, ae = /* @__PURE__ */ E({
|
|
134
|
+
__name: "SwaggerEditorInput",
|
|
135
|
+
props: {
|
|
136
|
+
value: {}
|
|
137
|
+
},
|
|
138
|
+
emits: ["contentUpdate"],
|
|
139
|
+
setup(l, { expose: _ }) {
|
|
140
|
+
_({
|
|
141
|
+
setCodeMirrorContent: (t) => {
|
|
142
|
+
var r;
|
|
143
|
+
(r = c.value) == null || r.setCodeMirrorContent(t);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
const c = C(null);
|
|
147
|
+
function o(t) {
|
|
148
|
+
return q(t) ? ["json"] : ["yaml"];
|
|
149
|
+
}
|
|
150
|
+
return (t, r) => (m(), v("div", oe, [
|
|
151
|
+
n(a(J), {
|
|
152
|
+
ref_key: "codeMirrorRef",
|
|
153
|
+
ref: c,
|
|
154
|
+
content: t.value,
|
|
155
|
+
languages: o(t.value),
|
|
156
|
+
lineNumbers: "",
|
|
157
|
+
onChange: r[0] || (r[0] = (g) => t.$emit("contentUpdate", g))
|
|
158
|
+
}, null, 8, ["content", "languages"])
|
|
159
|
+
]));
|
|
160
|
+
}
|
|
161
|
+
}), ne = {}, se = { class: "swagger-editor-notification swagger-editor-notification--error" };
|
|
162
|
+
function le(l, _) {
|
|
163
|
+
return m(), v("div", se, [
|
|
164
|
+
S(l.$slots, "default")
|
|
165
|
+
]);
|
|
166
|
+
}
|
|
167
|
+
const ie = /* @__PURE__ */ $(ne, [["render", le]]), de = /* @__PURE__ */ E({
|
|
168
|
+
__name: "SwaggerEditor",
|
|
169
|
+
props: {
|
|
170
|
+
value: {},
|
|
171
|
+
theme: {},
|
|
172
|
+
proxyUrl: {},
|
|
173
|
+
error: {}
|
|
174
|
+
},
|
|
175
|
+
emits: ["contentUpdate", "import", "changeTheme"],
|
|
176
|
+
setup(l, { expose: _, emit: c }) {
|
|
177
|
+
const o = l, t = C(null), r = (e) => {
|
|
178
|
+
c("contentUpdate", e);
|
|
179
|
+
}, g = D(() => {
|
|
180
|
+
if (o.error === void 0 || o.error === null || o.error === "")
|
|
181
|
+
return "";
|
|
182
|
+
const e = B(o.error) ? o.error.value : o.error;
|
|
183
|
+
return e.startsWith("YAMLException:") ? e.split(`
|
|
184
|
+
`)[0] : e;
|
|
185
|
+
});
|
|
186
|
+
return N(
|
|
187
|
+
() => o.value,
|
|
188
|
+
async () => {
|
|
189
|
+
o.value && r(o.value);
|
|
190
|
+
},
|
|
191
|
+
{ immediate: !0 }
|
|
192
|
+
), _({
|
|
193
|
+
handleOpenSwaggerEditor: (e) => {
|
|
194
|
+
var f, d, y;
|
|
195
|
+
e === "importUrl" ? (d = (f = t == null ? void 0 : t.value) == null ? void 0 : f.importUrlModal) == null || d.show() : e === "uploadFile" && ((y = t == null ? void 0 : t.value) == null || y.openFileDialog());
|
|
196
|
+
}
|
|
197
|
+
}), (e, f) => (m(), v(k, null, [
|
|
198
|
+
n(a(z), { id: e.theme }, null, 8, ["id"]),
|
|
199
|
+
n(Q, null, {
|
|
200
|
+
default: u(({ styles: d }) => [
|
|
201
|
+
U("div", {
|
|
202
|
+
class: L(["swagger-editor", d])
|
|
203
|
+
}, [
|
|
204
|
+
n(re, {
|
|
205
|
+
ref_key: "swaggerEditorHeaderRef",
|
|
206
|
+
ref: t,
|
|
207
|
+
proxyUrl: e.proxyUrl,
|
|
208
|
+
onImport: r
|
|
209
|
+
}, {
|
|
210
|
+
"tab-items": u(() => [
|
|
211
|
+
S(e.$slots, "tab-items", {}, void 0, !0)
|
|
212
|
+
]),
|
|
213
|
+
_: 3
|
|
214
|
+
}, 8, ["proxyUrl"]),
|
|
215
|
+
g.value ? (m(), T(ie, { key: 0 }, {
|
|
216
|
+
default: u(() => [
|
|
217
|
+
p(R(g.value), 1)
|
|
218
|
+
]),
|
|
219
|
+
_: 1
|
|
220
|
+
})) : w("", !0),
|
|
221
|
+
S(e.$slots, "editor-input", {
|
|
222
|
+
value: e.value,
|
|
223
|
+
onContentUpdate: r
|
|
224
|
+
}, () => [
|
|
225
|
+
n(ae, {
|
|
226
|
+
value: e.value,
|
|
227
|
+
onContentUpdate: r
|
|
228
|
+
}, null, 8, ["value"])
|
|
229
|
+
], !0)
|
|
230
|
+
], 2)
|
|
231
|
+
]),
|
|
232
|
+
_: 3
|
|
233
|
+
})
|
|
234
|
+
], 64));
|
|
235
|
+
}
|
|
236
|
+
}), Re = /* @__PURE__ */ $(de, [["__scopeId", "data-v-68ed8e3f"]]);
|
|
237
|
+
export {
|
|
238
|
+
Re as CodeEditor,
|
|
239
|
+
F as HeaderTabButton,
|
|
240
|
+
Q as ResetStyles,
|
|
241
|
+
Re as SwaggerEditor,
|
|
242
|
+
A as fetchSpecFromUrl,
|
|
243
|
+
q as isJsonString,
|
|
244
|
+
Be as useDarkModeState
|
|
245
|
+
};
|