@scalar/api-client 2.1.46 → 2.1.47

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.
Files changed (70) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  3. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +32 -26
  4. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -1
  5. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +14 -9
  6. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  7. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  8. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +15 -10
  9. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  10. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +17 -12
  11. package/dist/components/ImportCollection/DropEventListener.vue.d.ts +2 -2
  12. package/dist/components/ImportCollection/DropEventListener.vue.js +6 -6
  13. package/dist/components/ImportCollection/ImportCollectionListener.vue.d.ts.map +1 -1
  14. package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -21
  15. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts +1 -0
  16. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  17. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +87 -74
  18. package/dist/components/ImportCollection/PasteEventListener.vue.d.ts +2 -2
  19. package/dist/components/ImportCollection/PasteEventListener.vue.js +5 -5
  20. package/dist/components/ImportCollection/UrlQueryParameterChecker.vue.d.ts +2 -2
  21. package/dist/components/ImportCollection/UrlQueryParameterChecker.vue.d.ts.map +1 -1
  22. package/dist/components/ImportCollection/UrlQueryParameterChecker.vue.js +10 -5
  23. package/dist/components/ImportCollection/WorkspaceSelector.vue.d.ts.map +1 -1
  24. package/dist/components/ImportCollection/WorkspaceSelector.vue.js +43 -33
  25. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts +1 -0
  26. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts.map +1 -1
  27. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.js +31 -21
  28. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
  29. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +15 -15
  30. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  31. package/dist/layouts/App/create-api-client-app.js +14 -13
  32. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  33. package/dist/layouts/Web/create-api-client-web.js +11 -10
  34. package/dist/libs/create-client.d.ts.map +1 -1
  35. package/dist/libs/create-client.js +22 -10
  36. package/dist/router.d.ts +4 -41
  37. package/dist/router.d.ts.map +1 -1
  38. package/dist/router.js +18 -149
  39. package/dist/routes.d.ts +150 -0
  40. package/dist/routes.d.ts.map +1 -0
  41. package/dist/routes.js +182 -0
  42. package/dist/store/router-params.js +1 -1
  43. package/dist/store/store.d.ts.map +1 -1
  44. package/dist/store/store.js +90 -90
  45. package/dist/style.css +1 -1
  46. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  47. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +20 -15
  48. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  49. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  50. package/dist/views/Request/RequestSidebarItem.vue2.js +46 -33
  51. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +6 -6
  52. package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts.map +1 -1
  53. package/dist/views/Request/ResponseSection/ResponseBody.vue.js +21 -21
  54. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.d.ts.map +1 -1
  55. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.js +8 -8
  56. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  57. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.d.ts.map +1 -1
  58. package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +61 -55
  59. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
  60. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +2 -2
  61. package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +95 -64
  62. package/dist/views/Request/components/WorkspaceDropdown.vue.d.ts.map +1 -1
  63. package/dist/views/Request/components/WorkspaceDropdown.vue.js +60 -50
  64. package/dist/views/Request/types/sidebar-item.d.ts +2 -1
  65. package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
  66. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  67. package/dist/views/Servers/Servers.vue2.js +12 -7
  68. package/package.json +8 -8
  69. package/dist/components/SubpageHeader.vue.d.ts +0 -18
  70. package/dist/components/SubpageHeader.vue.d.ts.map +0 -1
@@ -1,128 +1,141 @@
1
- import { defineComponent as z, ref as S, computed as i, watch as p, onMounted as B, onUnmounted as F, openBlock as c, createBlock as g, unref as r, withCtx as O, createElementVNode as t, normalizeClass as T, createElementBlock as m, Fragment as f, createVNode as a, createCommentVNode as x, toDisplayString as q, createTextVNode as w } from "vue";
2
- import E from "../CommandPalette/WatchModeToggle.vue.js";
1
+ import { defineComponent as j, ref as z, computed as l, watch as f, onMounted as S, onUnmounted as B, openBlock as c, createBlock as g, unref as i, withCtx as E, createElementVNode as t, normalizeClass as F, createElementBlock as m, Fragment as x, createVNode as a, createCommentVNode as h, toDisplayString as q, createTextVNode as k } from "vue";
2
+ import R from "../CommandPalette/WatchModeToggle.vue.js";
3
3
  import W from "./ImportNowButton.vue.js";
4
4
  import K from "./IntegrationLogo.vue.js";
5
- import R from "./PrefetchError.vue.js";
6
- import G from "./WorkspaceSelector.vue.js";
7
- import { useUrlPrefetcher as H } from "./hooks/useUrlPrefetcher.js";
8
- import { getOpenApiDocumentVersion as k } from "./utils/getOpenApiDocumentVersion.js";
9
- import { isDocument as I } from "./utils/isDocument.js";
10
- import { isUrl as h } from "./utils/isUrl.js";
11
- import { useModal as J, ScalarModal as Q, ScalarIcon as X } from "@scalar/components";
12
- import { isLocalUrl as Y } from "@scalar/oas-utils/helpers";
13
- import { normalize as Z } from "@scalar/openapi-parser";
14
- import { useWorkspace as ee } from "../../store/store.js";
15
- const te = { class: "flex flex-col h-screen justify-center px-6 overflow-hidden relative md:px-0" }, oe = { class: "text-center text-md font-bold mb-2 line-clamp-1" }, se = { class: "inline-flex flex-col gap-2 items-center z-10 w-full" }, ne = { class: "flex justify-center" }, re = { class: "inline-flex py-1 px-4 items-center text-xs font-medium text-c-3" }, le = {
5
+ import G from "./PrefetchError.vue.js";
6
+ import H from "./WorkspaceSelector.vue.js";
7
+ import { useUrlPrefetcher as J } from "./hooks/useUrlPrefetcher.js";
8
+ import { getOpenApiDocumentVersion as I } from "./utils/getOpenApiDocumentVersion.js";
9
+ import { isDocument as U } from "./utils/isDocument.js";
10
+ import { isUrl as A } from "./utils/isUrl.js";
11
+ import { useModal as Q, ScalarModal as X, ScalarIcon as Y } from "@scalar/components";
12
+ import { isLocalUrl as Z } from "@scalar/oas-utils/helpers";
13
+ import { normalize as ee } from "@scalar/openapi-parser";
14
+ import { useWorkspace as te } from "../../store/store.js";
15
+ const oe = { class: "flex flex-col h-screen justify-center px-6 overflow-hidden relative md:px-0" }, se = { class: "text-center text-md font-bold mb-2 line-clamp-1" }, re = { class: "inline-flex flex-col gap-2 items-center z-10 w-full" }, ne = { class: "flex justify-center" }, ie = { class: "inline-flex py-1 px-4 items-center text-xs font-medium text-c-3" }, le = {
16
16
  key: 0,
17
17
  class: "text-sm overflow-hidden mt-5 pt-4 border-t-1/2"
18
- }, ie = { class: "flex items-center justify-center" }, ce = { class: "flex flex-col justify-center items-center pb-8" }, ae = { class: "text-center flex items-center flex-col" }, me = { class: "mb-2 w-10 h-10 border rounded-[10px] flex items-center justify-center" }, de = {
18
+ }, ce = { class: "flex items-center justify-center" }, ae = { class: "flex flex-col justify-center items-center pb-8" }, de = { class: "text-center flex items-center flex-col" }, me = { class: "mb-2 w-10 h-10 border rounded-[10px] flex items-center justify-center" }, ue = {
19
19
  href: "https://scalar.com/download",
20
20
  target: "_blank"
21
- }, Le = /* @__PURE__ */ z({
21
+ }, Le = /* @__PURE__ */ j({
22
22
  __name: "ImportCollectionModal",
23
23
  props: {
24
24
  source: {},
25
- integration: {}
25
+ integration: {},
26
+ eventType: {}
26
27
  },
27
28
  emits: ["importFinished"],
28
- setup(A) {
29
- const n = A, { activeWorkspace: L, events: U } = ee(), { prefetchResult: s, prefetchUrl: C } = H(), l = J(), d = S(!0);
30
- U.hotKeys.on(() => l.hide());
31
- const M = i(() => {
29
+ setup(L) {
30
+ const s = L, { activeWorkspace: v, events: P } = te(), { prefetchResult: r, prefetchUrl: y, resetPrefetchResult: C } = J(), n = Q(), u = z(!0);
31
+ P.hotKeys.on(() => n.hide());
32
+ const D = l(() => {
32
33
  try {
33
- return Z(
34
- s.content || n.source || ""
34
+ return ee(
35
+ r.content || s.source || ""
35
36
  );
36
37
  } catch {
37
38
  return;
38
39
  }
39
- }), V = i(() => {
40
+ }), M = l(() => {
40
41
  var o, e;
41
- return (e = (o = M.value) == null ? void 0 : o.info) == null ? void 0 : e.title;
42
- }), v = i(
43
- () => k(s.content || n.source || "")
42
+ return (e = (o = D.value) == null ? void 0 : o.info) == null ? void 0 : e.title;
43
+ }), b = l(
44
+ () => I(r.content || s.source || "")
44
45
  );
45
- p(
46
- () => n.source,
47
- (o) => {
48
- h(o) && C(o, L.value.proxyUrl), o && (h(o) || I(o) && k(o)) ? l.show() : l.hide();
46
+ f(
47
+ () => s.source,
48
+ async (o) => {
49
+ if (C(), A(o)) {
50
+ if (s.eventType && ["paste", "drop"].includes(s.eventType)) {
51
+ const { error: d } = await y(
52
+ o,
53
+ v.value.proxyUrl
54
+ );
55
+ d ? n.hide() : n.show();
56
+ return;
57
+ }
58
+ y(o, v.value.proxyUrl), n.show();
59
+ return;
60
+ }
61
+ o && U(o) && I(o) ? n.show() : n.hide();
49
62
  }
50
63
  );
51
- const D = i(() => !!n.source && h(n.source)), N = i(() => !!n.source && I(n.source)), P = i(() => s.url && Y(s.url)), u = (o) => {
52
- document.body.classList.remove("has-no-import-url"), (D.value || N.value) && l.open ? document.body.classList.add("has-import-url") : document.body.classList.remove("has-import-url");
53
- }, $ = () => {
64
+ const V = l(() => !!s.source && A(s.source)), N = l(() => !!s.source && U(s.source)), O = l(() => r.url && Z(r.url)), p = (o) => {
65
+ document.body.classList.remove("has-no-import-url"), (V.value || N.value) && n.open ? document.body.classList.add("has-import-url") : document.body.classList.remove("has-import-url");
66
+ }, T = () => {
54
67
  document.body.classList.remove("has-import-url"), document.body.classList.add("has-no-import-url");
55
68
  };
56
- return p(
57
- () => l.open,
69
+ return f(
70
+ () => n.open,
58
71
  (o) => {
59
- o ? u() : $();
72
+ o ? p() : T();
60
73
  }
61
- ), p(
62
- () => n.source,
74
+ ), f(
75
+ () => s.source,
63
76
  () => {
64
- u();
77
+ p();
65
78
  }
66
- ), B(() => {
67
- u();
68
- }), F(() => {
79
+ ), S(() => {
80
+ p();
81
+ }), B(() => {
69
82
  document.body.classList.remove("has-import-url"), document.body.classList.remove("has-no-import-url");
70
- }), (o, e) => (c(), g(r(Q), {
83
+ }), (o, e) => (c(), g(i(X), {
71
84
  size: "full",
72
- state: r(l)
85
+ state: i(n)
73
86
  }, {
74
- default: O(() => {
75
- var y, b, _;
87
+ default: E(() => {
88
+ var d, _, w;
76
89
  return [
77
- t("div", te, [
90
+ t("div", oe, [
78
91
  t("div", {
79
- class: T(["flex items-center flex-col m-auto px-8 py-8 rounded-xl border-1/2 max-w-[380px] w-full transition-opacity", { "opacity-0": r(s).state === "loading" }])
92
+ class: F(["flex items-center flex-col m-auto px-8 py-8 rounded-xl border-1/2 max-w-[380px] w-full transition-opacity", { "opacity-0": i(r).state === "loading" }])
80
93
  }, [
81
- r(s).error && r(s).state === "idle" && !v.value ? (c(), m(f, { key: 0 }, [
94
+ i(r).error && i(r).state === "idle" && !b.value ? (c(), m(x, { key: 0 }, [
82
95
  e[2] || (e[2] = t("div", { class: "text-center text-md font-bold mb-2 line-clamp-1" }, " No OpenAPI document found ", -1)),
83
- a(R, {
84
- url: ((y = r(s)) == null ? void 0 : y.input) || n.source
96
+ a(G, {
97
+ url: ((d = i(r)) == null ? void 0 : d.input) || s.source
85
98
  }, null, 8, ["url"])
86
- ], 64)) : (c(), m(f, { key: 1 }, [
87
- P.value ? (c(), g(K, {
99
+ ], 64)) : (c(), m(x, { key: 1 }, [
100
+ O.value ? (c(), g(K, {
88
101
  key: 0,
89
102
  integration: o.integration
90
- }, null, 8, ["integration"])) : x("", !0),
91
- t("div", oe, q(V.value || "Untitled Collection"), 1),
103
+ }, null, 8, ["integration"])) : h("", !0),
104
+ t("div", se, q(M.value || "Untitled Collection"), 1),
92
105
  e[5] || (e[5] = t("div", { class: "text-c-1 text-sm font-medium text-center text-balance" }, " Import the OpenAPI document to instantly send API requests. No signup required. ", -1)),
93
- v.value ? (c(), m(f, { key: 1 }, [
94
- t("div", se, [
106
+ b.value ? (c(), m(x, { key: 1 }, [
107
+ t("div", re, [
95
108
  a(W, {
96
- source: ((b = r(s)) == null ? void 0 : b.url) ?? o.source,
109
+ source: ((_ = i(r)) == null ? void 0 : _.url) ?? o.source,
97
110
  variant: "button",
98
- watchMode: d.value,
111
+ watchMode: u.value,
99
112
  onImportFinished: e[0] || (e[0] = () => o.$emit("importFinished"))
100
113
  }, null, 8, ["source", "watchMode"])
101
114
  ]),
102
115
  t("div", ne, [
103
- t("div", re, [
104
- e[3] || (e[3] = w(" Import to: ")),
105
- a(G)
116
+ t("div", ie, [
117
+ e[3] || (e[3] = k(" Import to: ")),
118
+ a(H)
106
119
  ])
107
120
  ]),
108
- (_ = r(s)) != null && _.url ? (c(), m("div", le, [
109
- t("div", ie, [
110
- a(E, {
111
- modelValue: d.value,
112
- "onUpdate:modelValue": e[1] || (e[1] = (j) => d.value = j),
121
+ (w = i(r)) != null && w.url ? (c(), m("div", le, [
122
+ t("div", ce, [
123
+ a(R, {
124
+ modelValue: u.value,
125
+ "onUpdate:modelValue": e[1] || (e[1] = ($) => u.value = $),
113
126
  disableToolTip: !0
114
127
  }, null, 8, ["modelValue"])
115
128
  ]),
116
129
  e[4] || (e[4] = t("div", { class: "pt-0 text-center text-balance font-medium text-xs text-c-3" }, " Automatically update your API client when the OpenAPI document content changes. ", -1))
117
- ])) : x("", !0)
118
- ], 64)) : x("", !0)
130
+ ])) : h("", !0)
131
+ ], 64)) : h("", !0)
119
132
  ], 64))
120
133
  ], 2),
121
- t("div", ce, [
122
- t("div", ae, [
134
+ t("div", ae, [
135
+ t("div", de, [
123
136
  t("div", me, [
124
- t("a", de, [
125
- a(r(X), {
137
+ t("a", ue, [
138
+ a(i(Y), {
126
139
  icon: "Logo",
127
140
  size: "xl"
128
141
  })
@@ -135,7 +148,7 @@ const te = { class: "flex flex-col h-screen justify-center px-6 overflow-hidden
135
148
  target: "_blank"
136
149
  }, " Download Desktop App "),
137
150
  t("br"),
138
- w(" free · open-source · offline first ")
151
+ k(" free · open-source · offline first ")
139
152
  ], -1))
140
153
  ])
141
154
  ])
@@ -1,7 +1,7 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
- input: (value: string) => any;
2
+ input: (value: string, integration: null, eventType: "paste") => any;
3
3
  }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
- onInput?: ((value: string) => any) | undefined;
4
+ onInput?: ((value: string, integration: null, eventType: "paste") => any) | undefined;
5
5
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
6
  export default _default;
7
7
  //# sourceMappingURL=PasteEventListener.vue.d.ts.map
@@ -1,10 +1,10 @@
1
- import { defineComponent as r, onMounted as s, onBeforeUnmount as c } from "vue";
2
- const u = /* @__PURE__ */ r({
1
+ import { defineComponent as i, onMounted as r, onBeforeUnmount as c } from "vue";
2
+ const u = /* @__PURE__ */ i({
3
3
  __name: "PasteEventListener",
4
4
  emits: ["input"],
5
5
  setup(m, { emit: o }) {
6
- const i = o;
7
- s(() => {
6
+ const s = o;
7
+ r(() => {
8
8
  document.addEventListener("paste", n);
9
9
  }), c(() => {
10
10
  document.removeEventListener("paste", n);
@@ -13,7 +13,7 @@ const u = /* @__PURE__ */ r({
13
13
  const t = e.target;
14
14
  if (!(t && (t.tagName === "INPUT" || t.tagName === "TEXTAREA" || t.isContentEditable)) && e.clipboardData) {
15
15
  const a = e.clipboardData.getData("text");
16
- a && i("input", a);
16
+ a && s("input", a, null, "paste");
17
17
  }
18
18
  }
19
19
  return (e, t) => null;
@@ -1,7 +1,7 @@
1
1
  declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
2
- input: (url: string, integration: string | null) => any;
2
+ input: (url: string, integration: string | null, eventType: "query") => any;
3
3
  }, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
4
- onInput?: ((url: string, integration: string | null) => any) | undefined;
4
+ onInput?: ((url: string, integration: string | null, eventType: "query") => any) | undefined;
5
5
  }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
6
  export default _default;
7
7
  //# sourceMappingURL=UrlQueryParameterChecker.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"UrlQueryParameterChecker.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/UrlQueryParameterChecker.vue"],"names":[],"mappings":";;;;;AA8FA,wBAMG"}
1
+ {"version":3,"file":"UrlQueryParameterChecker.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/UrlQueryParameterChecker.vue"],"names":[],"mappings":";;;;;AAkHA,wBAMG"}
@@ -2,12 +2,17 @@ import { defineComponent as a, onMounted as o } from "vue";
2
2
  const c = /* @__PURE__ */ a({
3
3
  __name: "UrlQueryParameterChecker",
4
4
  emits: ["input"],
5
- setup(i, { emit: r }) {
6
- const n = r;
5
+ setup(u, { emit: t }) {
6
+ const n = t;
7
7
  return o(() => {
8
- const e = new URLSearchParams(window.location.search), t = e.get("url");
9
- t && n("input", t, e.get("integration"));
10
- }), (e, t) => null;
8
+ const e = new URLSearchParams(window.location.search), r = e.get("url");
9
+ r && n(
10
+ "input",
11
+ r,
12
+ e.get("integration"),
13
+ "query"
14
+ );
15
+ }), (e, r) => null;
11
16
  }
12
17
  });
13
18
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"WorkspaceSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/WorkspaceSelector.vue"],"names":[],"mappings":";AAiaA,wBAKG"}
1
+ {"version":3,"file":"WorkspaceSelector.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/WorkspaceSelector.vue"],"names":[],"mappings":";AA2bA,wBAKG"}
@@ -1,77 +1,87 @@
1
- import { defineComponent as y, ref as D, openBlock as d, createElementBlock as x, Fragment as w, createElementVNode as t, createVNode as s, unref as e, withCtx as r, renderList as W, createBlock as N, withModifiers as h, normalizeClass as M, toDisplayString as k, withDirectives as $, vModelText as z, createTextVNode as B } from "vue";
2
- import { useModal as V, ScalarDropdown as j, ScalarDropdownItem as v, ScalarIcon as u, ScalarDropdownDivider as T, ScalarButton as _, ScalarModal as E } from "@scalar/components";
1
+ import { defineComponent as y, ref as W, openBlock as d, createElementBlock as x, Fragment as w, createElementVNode as t, createVNode as s, unref as e, withCtx as o, renderList as D, createBlock as N, withModifiers as k, normalizeClass as M, toDisplayString as h, withDirectives as z, vModelText as B, createTextVNode as V } from "vue";
2
+ import { useModal as j, ScalarDropdown as T, ScalarDropdownItem as v, ScalarIcon as m, ScalarDropdownDivider as $, ScalarButton as _, ScalarModal as E } from "@scalar/components";
3
3
  import { useToasts as I } from "@scalar/use-toasts";
4
4
  import { useRouter as A } from "vue-router";
5
5
  import { useWorkspace as F } from "../../store/store.js";
6
6
  const L = { class: "flex items-center text-sm w-[inherit]" }, P = { class: "font-medium m-0 text-sm flex gap-1 items-center" }, R = { class: "line-clamp-1 text-left w-[calc(100%-10px)] text-xs" }, U = { class: "text-ellipsis overflow-hidden" }, q = { class: "flex items-center justify-center h-4 w-4" }, Y = /* @__PURE__ */ y({
7
7
  __name: "WorkspaceSelector",
8
8
  setup(G) {
9
- const { activeWorkspace: i, workspaces: b, workspaceMutators: g } = F(), { push: m } = A(), c = V(), { toast: f } = I(), a = D(""), C = (l) => {
10
- l !== i.value.uid && m(`/workspace/${l}`);
9
+ const { activeWorkspace: i, workspaces: b, workspaceMutators: g } = F(), { push: u } = A(), c = j(), { toast: f } = I(), r = W(""), C = (n) => {
10
+ n !== i.value.uid && u({
11
+ name: "workspace",
12
+ params: {
13
+ workspace: n
14
+ }
15
+ });
11
16
  }, S = () => {
12
- if (!a.value.trim()) {
17
+ if (!r.value.trim()) {
13
18
  f("Please enter a name before creating a workspace.", "error");
14
19
  return;
15
20
  }
16
- const l = g.add({
17
- name: a.value
21
+ const n = g.add({
22
+ name: r.value
18
23
  });
19
- m(`/workspace/${l.uid}`), f(`Created new workspace '${a.value}'`), a.value = "", c.hide();
24
+ f(`Created new workspace '${n.name}'`), u({
25
+ name: "workspace",
26
+ params: {
27
+ workspace: n.uid
28
+ }
29
+ }), r.value = "", c.hide();
20
30
  };
21
- return (l, o) => (d(), x(w, null, [
31
+ return (n, a) => (d(), x(w, null, [
22
32
  t("div", L, [
23
- s(e(j), null, {
24
- items: r(() => [
25
- (d(!0), x(w, null, W(e(b), (n, p) => (d(), N(e(v), {
33
+ s(e(T), null, {
34
+ items: o(() => [
35
+ (d(!0), x(w, null, D(e(b), (l, p) => (d(), N(e(v), {
26
36
  key: p,
27
37
  class: "flex gap-1.5 group/item items-center whitespace-nowrap text-ellipsis overflow-hidden w-full",
28
- onClick: h((H) => C(p), ["stop"])
38
+ onClick: k((H) => C(p), ["stop"])
29
39
  }, {
30
- default: r(() => [
40
+ default: o(() => [
31
41
  t("div", {
32
42
  class: M([
33
43
  "flex items-center justify-center rounded-full p-[3px] w-4 h-4",
34
44
  e(i).uid === p ? "bg-c-accent text-b-1" : "group-hover/item:shadow-border text-transparent"
35
45
  ])
36
46
  }, [
37
- s(e(u), {
47
+ s(e(m), {
38
48
  class: "size-2.5",
39
49
  icon: "Checkmark",
40
50
  thickness: "3.5"
41
51
  })
42
52
  ], 2),
43
- t("span", U, k(n.name), 1)
53
+ t("span", U, h(l.name), 1)
44
54
  ]),
45
55
  _: 2
46
56
  }, 1032, ["onClick"]))), 128)),
47
- s(e(T)),
57
+ s(e($)),
48
58
  s(e(v), {
49
59
  class: "flex items-center gap-1.5",
50
- onClick: o[0] || (o[0] = (n) => e(c).show())
60
+ onClick: a[0] || (a[0] = (l) => e(c).show())
51
61
  }, {
52
- default: r(() => [
62
+ default: o(() => [
53
63
  t("div", q, [
54
- s(e(u), {
64
+ s(e(m), {
55
65
  class: "h-2.5",
56
66
  icon: "Add",
57
67
  thickness: "3"
58
68
  })
59
69
  ]),
60
- o[2] || (o[2] = t("span", null, "New Workspace", -1))
70
+ a[2] || (a[2] = t("span", null, "New Workspace", -1))
61
71
  ]),
62
72
  _: 1
63
73
  })
64
74
  ]),
65
- default: r(() => [
75
+ default: o(() => [
66
76
  s(e(_), {
67
77
  class: "font-normal h-full justify-start line-clamp-1 py-1 px-1.5 text-c-1 hover:bg-b-2 w-fit text-c-3",
68
78
  fullWidth: "",
69
79
  variant: "ghost"
70
80
  }, {
71
- default: r(() => [
81
+ default: o(() => [
72
82
  t("div", P, [
73
- t("h2", R, k(e(i).name), 1),
74
- s(e(u), {
83
+ t("h2", R, h(e(i).name), 1),
84
+ s(e(m), {
75
85
  class: "size-3",
76
86
  icon: "ChevronDown",
77
87
  thickness: "3"
@@ -90,26 +100,26 @@ const L = { class: "flex items-center text-sm w-[inherit]" }, P = { class: "font
90
100
  state: e(c),
91
101
  variant: "form"
92
102
  }, {
93
- default: r(() => [
103
+ default: o(() => [
94
104
  t("form", {
95
105
  class: "flex gap-1 rounded",
96
- onSubmit: h(S, ["prevent"])
106
+ onSubmit: k(S, ["prevent"])
97
107
  }, [
98
- $(t("input", {
99
- "onUpdate:modelValue": o[1] || (o[1] = (n) => a.value = n),
108
+ z(t("input", {
109
+ "onUpdate:modelValue": a[1] || (a[1] = (l) => r.value = l),
100
110
  class: "border-none outline-none flex-1 w-full text-sm min-h-8 p-1.5",
101
111
  placeholder: "New Workspace",
102
112
  type: "text"
103
113
  }, null, 512), [
104
- [z, a.value]
114
+ [B, r.value]
105
115
  ]),
106
116
  s(e(_), {
107
117
  class: "max-h-8 text-xs p-0 px-3",
108
- disabled: !a.value.trim(),
118
+ disabled: !r.value.trim(),
109
119
  type: "submit"
110
120
  }, {
111
- default: r(() => o[3] || (o[3] = [
112
- B(" Continue ")
121
+ default: o(() => a[3] || (a[3] = [
122
+ V(" Continue ")
113
123
  ])),
114
124
  _: 1
115
125
  }, 8, ["disabled"])
@@ -35,5 +35,6 @@ export declare function useUrlPrefetcher(): {
35
35
  input: string;
36
36
  error: any;
37
37
  }>;
38
+ resetPrefetchResult: () => Promise<void>;
38
39
  };
39
40
  //# sourceMappingURL=useUrlPrefetcher.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useUrlPrefetcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ImportCollection/hooks/useUrlPrefetcher.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB;;eAVvB,MAAM,GAAG,SAAS;iBAChB,MAAM,GAAG,IAAI;eACf,MAAM,GAAG,IAAI;aACf,MAAM,GAAG,IAAI;eACX,MAAM,GAAG,IAAI;;yBAuGX,MAAM,GAAG,IAAI,UACZ,MAAM;;;;;;;;;;;;;;;;;;;EAmBjB"}
1
+ {"version":3,"file":"useUrlPrefetcher.d.ts","sourceRoot":"","sources":["../../../../src/components/ImportCollection/hooks/useUrlPrefetcher.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,EAAE,MAAM,GAAG,SAAS,CAAA;IACzB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;IACpB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAA;CACrB,CAAA;AAED;;GAEG;AACH,wBAAgB,gBAAgB;;eAVvB,MAAM,GAAG,SAAS;iBAChB,MAAM,GAAG,IAAI;eACf,MAAM,GAAG,IAAI;aACf,MAAM,GAAG,IAAI;eACX,MAAM,GAAG,IAAI;;yBAiHX,MAAM,GAAG,IAAI,UACZ,MAAM;;;;;;;;;;;;;;;;;;;;EAoBjB"}
@@ -1,16 +1,25 @@
1
- import { resolve as a } from "@scalar/import";
2
- import { redirectToProxy as i, fetchWithProxyFallback as f } from "@scalar/oas-utils/helpers";
3
- import { reactive as d } from "vue";
4
- import { isUrl as h } from "../../../libs/isUrl.js";
5
- function v() {
6
- const l = d({
1
+ import { resolve as i } from "@scalar/import";
2
+ import { redirectToProxy as f, fetchWithProxyFallback as d } from "@scalar/oas-utils/helpers";
3
+ import { reactive as h } from "vue";
4
+ import { isUrl as m } from "../../../libs/isUrl.js";
5
+ function b() {
6
+ const n = h({
7
7
  state: "idle",
8
8
  content: null,
9
9
  url: null,
10
10
  input: null,
11
11
  error: null
12
12
  });
13
- async function u(t, r) {
13
+ async function u() {
14
+ Object.assign(n, {
15
+ state: "idle",
16
+ content: null,
17
+ url: null,
18
+ input: null,
19
+ error: null
20
+ });
21
+ }
22
+ async function s(t, r) {
14
23
  if (!t)
15
24
  return {
16
25
  state: "idle",
@@ -20,8 +29,8 @@ function v() {
20
29
  error: null
21
30
  };
22
31
  try {
23
- const e = await a(t, {
24
- fetch: (c) => fetch(r ? i(r, c) : c, {
32
+ const e = await i(t, {
33
+ fetch: (c) => fetch(r ? f(r, c) : c, {
25
34
  cache: "no-cache"
26
35
  })
27
36
  });
@@ -35,7 +44,7 @@ function v() {
35
44
  input: t,
36
45
  error: `Could not find an OpenAPI document in ${t}`
37
46
  };
38
- if (!h(e))
47
+ if (!m(e))
39
48
  return {
40
49
  state: "idle",
41
50
  content: null,
@@ -43,13 +52,13 @@ function v() {
43
52
  input: t,
44
53
  error: "Oops, we got invalid content for the given URL."
45
54
  };
46
- const o = e, n = await f(o, {
55
+ const o = e, l = await d(o, {
47
56
  proxy: r,
48
57
  cache: "no-cache"
49
58
  });
50
- return n.ok ? {
59
+ return l.ok ? {
51
60
  state: "idle",
52
- content: await n.text(),
61
+ content: await l.text(),
53
62
  url: o,
54
63
  error: null
55
64
  } : {
@@ -57,7 +66,7 @@ function v() {
57
66
  content: null,
58
67
  url: null,
59
68
  input: t,
60
- error: `Couldn't fetch ${o}, got error ${[n.status, n.statusText].join(" ").trim()}.`
69
+ error: `Couldn't fetch ${o}, got error ${[l.status, l.statusText].join(" ").trim()}.`
61
70
  };
62
71
  } catch (e) {
63
72
  return console.error("[prefetchDocument]", e), {
@@ -69,22 +78,23 @@ function v() {
69
78
  };
70
79
  }
71
80
  }
72
- async function s(t, r) {
73
- Object.assign(l, {
81
+ async function a(t, r) {
82
+ Object.assign(n, {
74
83
  state: "loading",
75
84
  content: null,
76
85
  url: null,
77
86
  input: t,
78
87
  error: null
79
88
  });
80
- const e = await u(t, r);
81
- return Object.assign(l, e), e;
89
+ const e = await s(t, r);
90
+ return Object.assign(n, e), e;
82
91
  }
83
92
  return {
84
- prefetchResult: l,
85
- prefetchUrl: s
93
+ prefetchResult: n,
94
+ prefetchUrl: a,
95
+ resetPrefetchResult: u
86
96
  };
87
97
  }
88
98
  export {
89
- v as useUrlPrefetcher
99
+ b as useUrlPrefetcher
90
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ViewLayoutCollapse.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ViewLayout/ViewLayoutCollapse.vue"],"names":[],"mappings":"AA8DA,KAAK,WAAW,GAAG;IACf,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC;AAkBJ,iBAAS,cAAc;WAyIT,OAAO,IAA6B;;;;YAVtB,GAAG;;;YACD,GAAG;;;YACH,GAAG;;;;EAahC;AAaD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;iBAhLH,OAAO;eACT,MAAM;6EAuLpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAgBpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"ViewLayoutCollapse.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ViewLayout/ViewLayoutCollapse.vue"],"names":[],"mappings":"AAgEA,KAAK,WAAW,GAAG;IACf,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,CAAC;AAkBJ,iBAAS,cAAc;WA2IT,OAAO,IAA6B;;;;YAVtB,GAAG;;;YACD,GAAG;;;YACH,GAAG;;;;EAahC;AAaD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe;iBAlLH,OAAO;eACT,MAAM;6EAyLpB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAgBpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}