@scalar/api-client 2.0.26 → 2.0.27

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,128 +1,39 @@
1
- import { defineComponent as D, computed as C, ref as y, watch as m, nextTick as f, openBlock as c, createBlock as p, withCtx as r, createTextVNode as L, toDisplayString as v, createVNode as i, createElementVNode as u, unref as g, withDirectives as B, withModifiers as S, createElementBlock as h, Fragment as V, renderList as T, vModelSelect as W, createCommentVNode as N } from "vue";
2
- import $ from "../../../components/DataTable/DataTable.vue.js";
3
- import j from "../../../components/DataTable/DataTableHeader.vue.js";
4
- import k from "../../../components/DataTable/DataTableRow.vue.js";
5
- import z from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
6
- import { useWorkspace as I } from "../../../store/workspace.js";
7
- import { ScalarIcon as M, ScalarCodeBlock as E } from "@scalar/components";
8
- import { getThemeStyles as R } from "@scalar/themes";
9
- import { useDarkModeState as F } from "../../../hooks/useDarkModeState.js";
10
- const H = { class: "text-c-2 group-hover:text-c-1 flex h-full w-full items-center justify-start rounded px-1.5" }, O = { class: "capitalize" }, P = ["value"], Z = /* @__PURE__ */ D({
1
+ import { defineComponent as s, computed as u, ref as d, toRef as i, openBlock as f, createBlock as m, withCtx as o, createTextVNode as p, toDisplayString as _, createElementVNode as h } from "vue";
2
+ import y from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
3
+ import { useCodeMirror as g } from "@scalar/use-codemirror";
4
+ const x = /* @__PURE__ */ s({
11
5
  __name: "ResponseBody",
12
6
  props: {
13
7
  title: {},
14
- active: { type: Boolean, default: !1 },
15
8
  data: { default: null },
16
9
  headers: {}
17
10
  },
18
- setup(_) {
19
- const d = _, { activeWorkspace: w } = I(), x = C(() => {
11
+ setup(a) {
12
+ const r = a, l = u(() => {
20
13
  var t;
21
- const o = ((t = d.headers.find((e) => e.name.toLowerCase() === "content-type")) == null ? void 0 : t.value) ?? "";
22
- return o.includes("json") ? "json" : o.includes("html") ? "html" : "plaintext";
23
- }), a = y(null), n = y("raw"), b = ["raw", "preview"], { isDark: s } = F();
24
- return m(
25
- () => n.value,
26
- async (o) => {
27
- var t;
28
- if (o === "preview" && (await f(), a.value)) {
29
- const e = a.value.contentDocument || ((t = a.value.contentWindow) == null ? void 0 : t.document);
30
- if (!e) return;
31
- e.open(), e.write(d.data), e.close();
32
- }
33
- }
34
- ), m(
35
- () => s.value,
36
- async (o) => {
37
- var t;
38
- if (await f(), a.value) {
39
- const e = a.value.contentDocument || ((t = a.value.contentWindow) == null ? void 0 : t.document);
40
- if (!e) return;
41
- e.body.classList.toggle("dark-mode", s.value), e.body.classList.toggle("light-mode", !s.value);
42
- }
43
- }
44
- ), m(
45
- () => n.value,
46
- async (o) => {
47
- var t, e;
48
- if (o === "preview" && (await f(), a.value)) {
49
- const l = a.value.contentDocument || ((t = a.value.contentWindow) == null ? void 0 : t.document);
50
- if (!l) return;
51
- l.open(), l.write(d.data), l.body.classList.toggle("dark-mode", s.value), l.body.classList.toggle("light-mode", !s.value), l.write(
52
- "<style>body,html {body:not(:has(* + style + style)) {font-family: var(--scalar-font-code); font-size: 12px; font-weight: 400;background:var(--scalar-background-1); color: var(--scalar-color-2)}</style>"
53
- ), (e = w.value) != null && e.themeId && l.write(
54
- `<style>${R(w.value.themeId)}</style>`
55
- ), l.close();
56
- }
57
- }
58
- ), (o, t) => (c(), p(z, null, {
59
- title: r(() => [
60
- L(v(o.title), 1)
14
+ const e = ((t = r.headers.find((c) => c.name.toLowerCase() === "content-type")) == null ? void 0 : t.value) ?? "";
15
+ return e.includes("json") ? "json" : (e.includes("html"), "html");
16
+ }), n = d(null);
17
+ return g({
18
+ codeMirrorRef: n,
19
+ readOnly: !0,
20
+ lineNumbers: !0,
21
+ content: i(() => r.data),
22
+ language: l
23
+ }), (e, t) => (f(), m(y, null, {
24
+ title: o(() => [
25
+ p(_(e.title), 1)
61
26
  ]),
62
- default: r(() => [
63
- o.active ? (c(), p($, {
64
- key: 0,
65
- columns: [""]
66
- }, {
67
- default: r(() => [
68
- i(k, null, {
69
- default: r(() => [
70
- i(j, { class: "relative col-span-full flex h-8 cursor-pointer items-center px-[2.25px] py-[2.25px]" }, {
71
- default: r(() => [
72
- u("div", H, [
73
- u("span", O, v(n.value), 1),
74
- i(g(M), {
75
- class: "text-c-3 ml-1 mt-px",
76
- icon: "ChevronDown",
77
- size: "xs"
78
- })
79
- ]),
80
- B(u("select", {
81
- "onUpdate:modelValue": t[0] || (t[0] = (e) => n.value = e),
82
- class: "absolute inset-0 w-auto opacity-0",
83
- onClick: t[1] || (t[1] = S(() => {
84
- }, ["prevent"]))
85
- }, [
86
- (c(), h(V, null, T(b, (e) => u("option", {
87
- key: e,
88
- value: e
89
- }, v(e), 9, P)), 64))
90
- ], 512), [
91
- [W, n.value]
92
- ])
93
- ]),
94
- _: 1
95
- })
96
- ]),
97
- _: 1
98
- }),
99
- i(k, null, {
100
- default: r(() => [
101
- n.value === "raw" ? (c(), p(g(E), {
102
- key: 0,
103
- class: "force-text-sm rounded-b border-t-0",
104
- content: o.data,
105
- lang: x.value
106
- }, null, 8, ["content", "lang"])) : (c(), h("iframe", {
107
- key: 1,
108
- ref_key: "iframe",
109
- ref: a,
110
- allowfullscreen: "",
111
- allowtransparency: "true",
112
- class: "w-full aspect-video",
113
- frameborder: "0"
114
- }, null, 512))
115
- ]),
116
- _: 1
117
- })
118
- ]),
119
- _: 1
120
- })) : N("", !0)
27
+ default: o(() => [
28
+ h("div", {
29
+ ref_key: "codeMirrorRef",
30
+ ref: n
31
+ }, null, 512)
121
32
  ]),
122
33
  _: 1
123
34
  }));
124
35
  }
125
36
  });
126
37
  export {
127
- Z as default
38
+ x as default
128
39
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.0.26",
21
+ "version": "2.0.27",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -118,14 +118,14 @@
118
118
  "vue": "^3.4.29",
119
119
  "vue-router": "^4.3.0",
120
120
  "zod": "^3.22.4",
121
- "@scalar/components": "0.12.17",
122
121
  "@scalar/draggable": "0.1.3",
122
+ "@scalar/components": "0.12.18",
123
123
  "@scalar/object-utils": "1.1.4",
124
124
  "@scalar/oas-utils": "0.2.16",
125
125
  "@scalar/themes": "0.9.15",
126
- "@scalar/use-codemirror": "0.11.7",
127
- "@scalar/use-tooltip": "1.0.2",
128
- "@scalar/use-toasts": "0.7.4"
126
+ "@scalar/use-codemirror": "0.11.8",
127
+ "@scalar/use-toasts": "0.7.4",
128
+ "@scalar/use-tooltip": "1.0.2"
129
129
  },
130
130
  "devDependencies": {
131
131
  "@types/content-type": "^1.1.8",