@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/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "vue",
16
16
  "vue3"
17
17
  ],
18
- "version": "1.14.10",
18
+ "version": "1.15.1",
19
19
  "engines": {
20
20
  "node": ">=18"
21
21
  },
@@ -66,13 +66,13 @@
66
66
  "remark-stringify": "^11.0.0",
67
67
  "unhead": "^1.8.3",
68
68
  "unified": "^11.0.4",
69
- "@scalar/api-client": "0.10.2",
69
+ "@scalar/api-client": "0.11.1",
70
70
  "@scalar/components": "0.2.2",
71
- "@scalar/swagger-editor": "0.9.12",
71
+ "@scalar/swagger-editor": "0.10.1",
72
72
  "@scalar/swagger-parser": "0.5.15",
73
73
  "@scalar/themes": "0.5.4",
74
74
  "@scalar/use-clipboard": "0.5.13",
75
- "@scalar/use-codemirror": "0.7.22",
75
+ "@scalar/use-codemirror": "0.8.1",
76
76
  "@scalar/use-keyboard-event": "0.5.8",
77
77
  "@scalar/use-modal": "0.2.3",
78
78
  "@scalar/use-toasts": "0.5.13",
@@ -1,249 +0,0 @@
1
- import { defineComponent as b, ref as w, watch as I, openBlock as p, createElementBlock as g, Fragment as E, createElementVNode as U, unref as a, createTextVNode as d, createCommentVNode as S, renderSlot as k, createVNode as s, withCtx as u, toDisplayString as N, computed as D, isRef as B, normalizeClass as L, createBlock as T } from "vue";
2
- import { o as j, H as R, E as H, U as O, u as F, f as A, _ as M, a as J, m as z, R as Q } from "./index-e4a1ff91.js";
3
- import { b as Be } from "./index-e4a1ff91.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 = (i) => {
26
- if (typeof i != "string")
27
- return !1;
28
- try {
29
- JSON.parse(i);
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__ */ b({
35
- __name: "SwaggerEditorHeader",
36
- props: {
37
- proxyUrl: {}
38
- },
39
- emits: ["import"],
40
- setup(i, { expose: v, emit: c }) {
41
- const o = i, e = W("(max-width: 1000px)"), { files: r, open: m, reset: C } = Y({
42
- multiple: !1,
43
- accept: ".json,.yaml,.yml"
44
- }), _ = j(), t = w(null);
45
- v({
46
- importUrlModal: _,
47
- openFileDialog: m
48
- });
49
- const f = w(""), h = () => {
50
- t.value = "", A(f.value, o.proxyUrl).then(async (n) => {
51
- c("import", n), _.hide();
52
- }).catch((n) => {
53
- console.error("[importUrl]", n), t.value = n;
54
- });
55
- };
56
- return I(r, () => {
57
- var n;
58
- if ((n = r.value) != null && n.length) {
59
- const l = r.value[0], y = new FileReader();
60
- y.onload = (V) => {
61
- var x;
62
- const $ = (x = V.target) == null ? void 0 : x.result;
63
- typeof $ == "string" && (c("import", $), C());
64
- }, y.readAsText(l);
65
- }
66
- }), (n, l) => (p(), g(E, null, [
67
- U("div", G, [
68
- U("div", K, [
69
- a(e) ? S("", !0) : (p(), g(E, { key: 0 }, [
70
- d("Swagger ")
71
- ], 64)),
72
- d("Editor ")
73
- ]),
74
- k(n.$slots, "tab-items", {}, void 0, !0),
75
- U("div", P, [
76
- s(R, {
77
- onClick: l[0] || (l[0] = () => a(m)())
78
- }, {
79
- default: u(() => [
80
- d(" Upload"),
81
- a(e) ? S("", !0) : (p(), g("span", X, " File"))
82
- ]),
83
- _: 1
84
- }),
85
- s(R, {
86
- onClick: l[1] || (l[1] = (y) => a(_).show())
87
- }, {
88
- default: u(() => [
89
- a(e) ? S("", !0) : (p(), g("span", Z, "Import ")),
90
- d("URL ")
91
- ]),
92
- _: 1
93
- })
94
- ])
95
- ]),
96
- s(a(H), {
97
- state: a(_),
98
- title: "Import Swagger from URL"
99
- }, {
100
- default: u(() => [
101
- U("div", ee, [
102
- s(a(O), {
103
- modelValue: f.value,
104
- "onUpdate:modelValue": l[2] || (l[2] = (y) => f.value = y),
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
- d(" " + N(t.value) + " ", 1),
112
- s(a(F), {
113
- variant: "outlined",
114
- onClick: l[3] || (l[3] = (y) => a(_).hide())
115
- }, {
116
- default: u(() => [
117
- d(" Cancel ")
118
- ]),
119
- _: 1
120
- }),
121
- s(a(F), { onClick: h }, {
122
- default: u(() => [
123
- d("Import")
124
- ]),
125
- _: 1
126
- })
127
- ])
128
- ]),
129
- _: 1
130
- }, 8, ["state"])
131
- ], 64));
132
- }
133
- }), re = /* @__PURE__ */ M(te, [["__scopeId", "data-v-17d421af"]]), oe = { class: "swagger-editor-input" }, ae = /* @__PURE__ */ b({
134
- __name: "SwaggerEditorInput",
135
- props: {
136
- value: {}
137
- },
138
- emits: ["contentUpdate"],
139
- setup(i, { expose: v }) {
140
- v({
141
- setCodeMirrorContent: (e) => {
142
- var r;
143
- (r = c.value) == null || r.setCodeMirrorContent(e);
144
- }
145
- });
146
- const c = w(null);
147
- function o(e) {
148
- return q(e) ? ["json"] : ["yaml"];
149
- }
150
- return (e, r) => (p(), g("div", oe, [
151
- s(a(J), {
152
- ref_key: "codeMirrorRef",
153
- ref: c,
154
- content: e.value,
155
- languages: o(e.value),
156
- lineNumbers: "",
157
- onChange: r[0] || (r[0] = (m) => e.$emit("contentUpdate", m))
158
- }, null, 8, ["content", "languages"])
159
- ]));
160
- }
161
- }), ne = {}, se = { class: "swagger-editor-notification swagger-editor-notification--error" };
162
- function le(i, v) {
163
- return p(), g("div", se, [
164
- k(i.$slots, "default")
165
- ]);
166
- }
167
- const ie = /* @__PURE__ */ M(ne, [["render", le]]), de = /* @__PURE__ */ b({
168
- __name: "SwaggerEditor",
169
- props: {
170
- value: {},
171
- theme: {},
172
- proxyUrl: {},
173
- error: {}
174
- },
175
- emits: ["contentUpdate", "import", "changeTheme"],
176
- setup(i, { expose: v, emit: c }) {
177
- const o = i, e = w(null), r = (t) => {
178
- c("contentUpdate", t);
179
- }, m = w(null), C = D(() => {
180
- if (o.error === void 0 || o.error === null || o.error === "")
181
- return "";
182
- const t = B(o.error) ? o.error.value : o.error;
183
- return t.startsWith("YAMLException:") ? t.split(`
184
- `)[0] : t;
185
- });
186
- return I(
187
- () => o.value,
188
- async () => {
189
- o.value && r(o.value);
190
- },
191
- { immediate: !0 }
192
- ), v({
193
- handleOpenSwaggerEditor: (t) => {
194
- var f, h, n;
195
- t === "importUrl" ? (h = (f = e == null ? void 0 : e.value) == null ? void 0 : f.importUrlModal) == null || h.show() : t === "uploadFile" && ((n = e == null ? void 0 : e.value) == null || n.openFileDialog());
196
- }
197
- }), (t, f) => (p(), g(E, null, [
198
- s(a(z), { id: t.theme }, null, 8, ["id"]),
199
- s(Q, null, {
200
- default: u(({ styles: h }) => [
201
- U("div", {
202
- class: L(["swagger-editor", h])
203
- }, [
204
- s(re, {
205
- ref_key: "swaggerEditorHeaderRef",
206
- ref: e,
207
- proxyUrl: t.proxyUrl,
208
- onImport: r
209
- }, {
210
- "tab-items": u(() => [
211
- k(t.$slots, "tab-items", {}, void 0, !0)
212
- ]),
213
- _: 3
214
- }, 8, ["proxyUrl"]),
215
- C.value ? (p(), T(ie, { key: 0 }, {
216
- default: u(() => [
217
- d(N(C.value), 1)
218
- ]),
219
- _: 1
220
- })) : S("", !0),
221
- k(t.$slots, "editor-input", {
222
- ref_key: "codeMirrorReference",
223
- ref: m,
224
- value: t.value,
225
- onContentUpdate: r
226
- }, () => [
227
- s(ae, {
228
- ref_key: "codeMirrorReference",
229
- ref: m,
230
- value: t.value,
231
- onContentUpdate: r
232
- }, null, 8, ["value"])
233
- ], !0)
234
- ], 2)
235
- ]),
236
- _: 3
237
- })
238
- ], 64));
239
- }
240
- }), Ne = /* @__PURE__ */ M(de, [["__scopeId", "data-v-fcc7bbc6"]]);
241
- export {
242
- Ne as CodeEditor,
243
- R as HeaderTabButton,
244
- Q as ResetStyles,
245
- Ne as SwaggerEditor,
246
- A as fetchSpecFromUrl,
247
- q as isJsonString,
248
- Be as useDarkModeState
249
- };