@scalar/api-reference 1.17.16 → 1.18.0

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.
@@ -1,24 +1,24 @@
1
- import { defineComponent as b, ref as k, watch as R, openBlock as m, createElementBlock as f, Fragment as E, createElementVNode as U, unref as a, createTextVNode as c, createCommentVNode as S, renderSlot as x, createVNode as s, withCtx as p, toDisplayString as V, computed as D, isRef as L, normalizeClass as T, createBlock as j } from "vue";
2
- import { b as H, H as I, r as O, l as A, C as N, f as J, _ as $, a as z, h as Q, R as W } from "./index-DB9G8SWm.js";
3
- import { u as _e } from "./index-DB9G8SWm.js";
1
+ import { defineComponent as x, ref as k, watch as V, openBlock as m, createElementBlock as f, Fragment as b, createElementVNode as w, unref as o, createTextVNode as c, createCommentVNode as S, renderSlot as $, createVNode as l, withCtx as p, toDisplayString as T, computed as D, isRef as B, normalizeClass as L, createBlock as j } from "vue";
2
+ import { b as H, H as I, r as O, l as A, C as N, f as J, _ as E, a as z, $ as Q, T as W } from "./index-BNQlaahg.js";
3
+ import { u as _e } from "./index-BNQlaahg.js";
4
4
  import { useMediaQuery as Y, useFileDialog as q } from "@vueuse/core";
5
- const G = (l) => {
6
- if (typeof l != "string")
5
+ const G = (s) => {
6
+ if (typeof s != "string")
7
7
  return !1;
8
8
  try {
9
- JSON.parse(l);
9
+ JSON.parse(s);
10
10
  } catch {
11
11
  return !1;
12
12
  }
13
13
  return !0;
14
- }, K = { class: "swagger-editor-header" }, P = { class: "swagger-editor-title" }, X = { class: "swagger-editor-actions" }, Z = { key: 0 }, ee = { key: 0 }, te = { class: "swagger-editor-modal-layout" }, re = /* @__PURE__ */ b({
14
+ }, K = { class: "swagger-editor-header" }, P = { class: "swagger-editor-title" }, X = { class: "swagger-editor-actions" }, Z = { key: 0 }, ee = { key: 0 }, te = { class: "swagger-editor-modal-layout" }, re = /* @__PURE__ */ x({
15
15
  __name: "SwaggerEditorHeader",
16
16
  props: {
17
17
  proxyUrl: {}
18
18
  },
19
19
  emits: ["import"],
20
- setup(l, { expose: v, emit: y }) {
21
- const r = l, _ = y, o = Y("(max-width: 1000px)"), { files: t, open: n, reset: w } = q({
20
+ setup(s, { expose: v, emit: U }) {
21
+ const r = s, _ = U, a = Y("(max-width: 1000px)"), { files: t, open: n, reset: y } = q({
22
22
  multiple: !1,
23
23
  accept: ".json,.yaml,.yml"
24
24
  }), e = H(), g = k(null);
@@ -33,53 +33,53 @@ const G = (l) => {
33
33
  console.error("[importUrl]", d), g.value = d;
34
34
  });
35
35
  };
36
- return R(t, () => {
36
+ return V(t, () => {
37
37
  var d;
38
38
  if ((d = t.value) != null && d.length) {
39
39
  const i = t.value[0], h = new FileReader();
40
- h.onload = (B) => {
40
+ h.onload = (R) => {
41
41
  var F;
42
- const M = (F = B.target) == null ? void 0 : F.result;
43
- typeof M == "string" && (_("import", M), w());
42
+ const M = (F = R.target) == null ? void 0 : F.result;
43
+ typeof M == "string" && (_("import", M), y());
44
44
  }, h.readAsText(i);
45
45
  }
46
- }), (d, i) => (m(), f(E, null, [
47
- U("div", K, [
48
- U("div", P, [
49
- a(o) ? S("", !0) : (m(), f(E, { key: 0 }, [
46
+ }), (d, i) => (m(), f(b, null, [
47
+ w("div", K, [
48
+ w("div", P, [
49
+ o(a) ? S("", !0) : (m(), f(b, { key: 0 }, [
50
50
  c("Swagger ")
51
51
  ], 64)),
52
52
  c("Editor ")
53
53
  ]),
54
- x(d.$slots, "tab-items", {}, void 0, !0),
55
- U("div", X, [
56
- s(I, {
57
- onClick: i[0] || (i[0] = () => a(n)())
54
+ $(d.$slots, "tab-items", {}, void 0, !0),
55
+ w("div", X, [
56
+ l(I, {
57
+ onClick: i[0] || (i[0] = () => o(n)())
58
58
  }, {
59
59
  default: p(() => [
60
60
  c(" Upload"),
61
- a(o) ? S("", !0) : (m(), f("span", Z, " File"))
61
+ o(a) ? S("", !0) : (m(), f("span", Z, " File"))
62
62
  ]),
63
63
  _: 1
64
64
  }),
65
- s(I, {
66
- onClick: i[1] || (i[1] = (h) => a(e).show())
65
+ l(I, {
66
+ onClick: i[1] || (i[1] = (h) => o(e).show())
67
67
  }, {
68
68
  default: p(() => [
69
- a(o) ? S("", !0) : (m(), f("span", ee, "Import ")),
69
+ o(a) ? S("", !0) : (m(), f("span", ee, "Import ")),
70
70
  c("URL ")
71
71
  ]),
72
72
  _: 1
73
73
  })
74
74
  ])
75
75
  ]),
76
- s(a(O), {
77
- state: a(e),
76
+ l(o(O), {
77
+ state: o(e),
78
78
  title: "Import Swagger from URL"
79
79
  }, {
80
80
  default: p(() => [
81
- U("div", te, [
82
- s(a(A), {
81
+ w("div", te, [
82
+ l(o(A), {
83
83
  modelValue: u.value,
84
84
  "onUpdate:modelValue": i[2] || (i[2] = (h) => u.value = h),
85
85
  autofocus: "",
@@ -88,17 +88,17 @@ const G = (l) => {
88
88
  labelShadowColor: "var(--theme-background-1, var(--default-theme-background-1))",
89
89
  placeholder: "https://scalar.com/swagger.json"
90
90
  }, null, 8, ["modelValue"]),
91
- c(" " + V(g.value) + " ", 1),
92
- s(a(N), {
91
+ c(" " + T(g.value) + " ", 1),
92
+ l(o(N), {
93
93
  variant: "outlined",
94
- onClick: i[3] || (i[3] = (h) => a(e).hide())
94
+ onClick: i[3] || (i[3] = (h) => o(e).hide())
95
95
  }, {
96
96
  default: p(() => [
97
97
  c(" Cancel ")
98
98
  ]),
99
99
  _: 1
100
100
  }),
101
- s(a(N), { onClick: C }, {
101
+ l(o(N), { onClick: C }, {
102
102
  default: p(() => [
103
103
  c("Import")
104
104
  ]),
@@ -110,14 +110,14 @@ const G = (l) => {
110
110
  }, 8, ["state"])
111
111
  ], 64));
112
112
  }
113
- }), oe = /* @__PURE__ */ $(re, [["__scopeId", "data-v-17d421af"]]), ae = { class: "swagger-editor-input" }, ne = /* @__PURE__ */ b({
113
+ }), oe = /* @__PURE__ */ E(re, [["__scopeId", "data-v-17d421af"]]), ae = { class: "swagger-editor-input" }, ne = /* @__PURE__ */ x({
114
114
  __name: "SwaggerEditorInput",
115
115
  props: {
116
116
  value: {}
117
117
  },
118
118
  emits: ["contentUpdate"],
119
- setup(l, { expose: v }) {
120
- const y = l;
119
+ setup(s, { expose: v }) {
120
+ const U = s;
121
121
  v({
122
122
  setCodeMirrorContent: (t) => {
123
123
  var n;
@@ -128,25 +128,25 @@ const G = (l) => {
128
128
  function _(t) {
129
129
  return G(t) ? "json" : "yaml";
130
130
  }
131
- const o = D(() => _(y.value));
131
+ const a = D(() => _(U.value));
132
132
  return (t, n) => (m(), f("div", ae, [
133
- s(a(z), {
133
+ l(o(z), {
134
134
  ref_key: "codeMirrorRef",
135
135
  ref: r,
136
136
  content: t.value,
137
- language: o.value,
137
+ language: a.value,
138
138
  lineNumbers: "",
139
- onChange: n[0] || (n[0] = (w) => t.$emit("contentUpdate", w))
139
+ onChange: n[0] || (n[0] = (y) => t.$emit("contentUpdate", y))
140
140
  }, null, 8, ["content", "language"])
141
141
  ]));
142
142
  }
143
- }), se = {}, le = { class: "swagger-editor-notification swagger-editor-notification--error" };
144
- function ie(l, v) {
145
- return m(), f("div", le, [
146
- x(l.$slots, "default")
143
+ }), le = {}, se = { class: "swagger-editor-notification swagger-editor-notification--error" };
144
+ function ie(s, v) {
145
+ return m(), f("div", se, [
146
+ $(s.$slots, "default")
147
147
  ]);
148
148
  }
149
- const de = /* @__PURE__ */ $(se, [["render", ie]]), ue = /* @__PURE__ */ b({
149
+ const de = /* @__PURE__ */ E(le, [["render", ie]]), ue = /* @__PURE__ */ x({
150
150
  __name: "SwaggerEditor",
151
151
  props: {
152
152
  value: {},
@@ -155,17 +155,17 @@ const de = /* @__PURE__ */ $(se, [["render", ie]]), ue = /* @__PURE__ */ b({
155
155
  error: {}
156
156
  },
157
157
  emits: ["contentUpdate", "import", "changeTheme"],
158
- setup(l, { expose: v, emit: y }) {
159
- const r = l, _ = y, o = k(null), t = (e) => {
158
+ setup(s, { expose: v, emit: U }) {
159
+ const r = s, _ = U, a = k(null), t = (e) => {
160
160
  _("contentUpdate", e);
161
161
  }, n = D(() => {
162
162
  if (r.error === void 0 || r.error === null || r.error === "")
163
163
  return "";
164
- const e = L(r.error) ? r.error.value : r.error;
164
+ const e = B(r.error) ? r.error.value : r.error;
165
165
  return e.startsWith("YAMLException:") ? e.split(`
166
166
  `)[0] : e;
167
167
  });
168
- return R(
168
+ return V(
169
169
  () => r.value,
170
170
  async () => {
171
171
  r.value && t(r.value);
@@ -174,37 +174,37 @@ const de = /* @__PURE__ */ $(se, [["render", ie]]), ue = /* @__PURE__ */ b({
174
174
  ), v({
175
175
  handleOpenSwaggerEditor: (e) => {
176
176
  var g, u, C;
177
- e === "importUrl" ? (u = (g = o == null ? void 0 : o.value) == null ? void 0 : g.importUrlModal) == null || u.show() : e === "uploadFile" && ((C = o == null ? void 0 : o.value) == null || C.openFileDialog());
177
+ e === "importUrl" ? (u = (g = a == null ? void 0 : a.value) == null ? void 0 : g.importUrlModal) == null || u.show() : e === "uploadFile" && ((C = a == null ? void 0 : a.value) == null || C.openFileDialog());
178
178
  }
179
- }), (e, g) => (m(), f(E, null, [
180
- s(a(Q), { id: e.theme }, null, 8, ["id"]),
181
- s(W, null, {
179
+ }), (e, g) => (m(), f(b, null, [
180
+ l(o(Q), { id: e.theme }, null, 8, ["id"]),
181
+ l(o(W), null, {
182
182
  default: p(({ styles: u }) => [
183
- U("div", {
184
- class: T(["swagger-editor", u])
183
+ w("div", {
184
+ class: L(["swagger-editor", u])
185
185
  }, [
186
- s(oe, {
186
+ l(oe, {
187
187
  ref_key: "swaggerEditorHeaderRef",
188
- ref: o,
188
+ ref: a,
189
189
  proxyUrl: e.proxyUrl,
190
190
  onImport: t
191
191
  }, {
192
192
  "tab-items": p(() => [
193
- x(e.$slots, "tab-items", {}, void 0, !0)
193
+ $(e.$slots, "tab-items", {}, void 0, !0)
194
194
  ]),
195
195
  _: 3
196
196
  }, 8, ["proxyUrl"]),
197
197
  n.value ? (m(), j(de, { key: 0 }, {
198
198
  default: p(() => [
199
- c(V(n.value), 1)
199
+ c(T(n.value), 1)
200
200
  ]),
201
201
  _: 1
202
202
  })) : S("", !0),
203
- x(e.$slots, "editor-input", {
203
+ $(e.$slots, "editor-input", {
204
204
  value: e.value,
205
205
  onContentUpdate: t
206
206
  }, () => [
207
- s(ne, {
207
+ l(ne, {
208
208
  value: e.value,
209
209
  onContentUpdate: t
210
210
  }, null, 8, ["value"])
@@ -215,11 +215,10 @@ const de = /* @__PURE__ */ $(se, [["render", ie]]), ue = /* @__PURE__ */ b({
215
215
  })
216
216
  ], 64));
217
217
  }
218
- }), ge = /* @__PURE__ */ $(ue, [["__scopeId", "data-v-68ed8e3f"]]);
218
+ }), ge = /* @__PURE__ */ E(ue, [["__scopeId", "data-v-9f3238b6"]]);
219
219
  export {
220
220
  ge as CodeEditor,
221
221
  I as HeaderTabButton,
222
- W as ResetStyles,
223
222
  ge as SwaggerEditor,
224
223
  J as fetchSpecFromUrl,
225
224
  G as isJsonString,