@scalar/api-client 2.1.39 → 2.1.41

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 (53) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts +3 -0
  3. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  4. package/dist/components/CodeInput/CodeInput.vue.js +1 -1
  5. package/dist/components/CodeInput/CodeInput.vue2.js +105 -84
  6. package/dist/components/CodeInput/codeVariableWidget.d.ts +3 -0
  7. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  8. package/dist/components/CodeInput/codeVariableWidget.js +51 -47
  9. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  10. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +102 -129
  11. package/dist/components/ImportCollection/PrefetchError.vue.d.ts +2 -3
  12. package/dist/components/ImportCollection/PrefetchError.vue.d.ts.map +1 -1
  13. package/dist/components/ImportCollection/PrefetchError.vue.js +27 -0
  14. package/dist/components/ImportCollection/PrefetchError.vue2.js +4 -0
  15. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts +11 -17
  16. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.d.ts.map +1 -1
  17. package/dist/components/ImportCollection/hooks/useUrlPrefetcher.js +72 -29
  18. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  19. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
  20. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +20 -28
  21. package/dist/components/Sidebar/SidebarButton.vue.d.ts +5 -3
  22. package/dist/components/Sidebar/SidebarButton.vue.d.ts.map +1 -1
  23. package/dist/components/Sidebar/SidebarButton.vue.js +16 -16
  24. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  25. package/dist/components/Sidebar/SidebarList.vue.js +5 -5
  26. package/dist/components/Sidebar/SidebarListElement.vue.d.ts +1 -1
  27. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  28. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  29. package/dist/layouts/App/ApiClientApp.vue.js +37 -37
  30. package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
  31. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  32. package/dist/layouts/Modal/ApiClientModal.vue2.js +23 -21
  33. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  34. package/dist/layouts/Web/ApiClientWeb.vue.js +30 -30
  35. package/dist/store/environment.js +1 -1
  36. package/dist/style.css +1 -1
  37. package/dist/views/Cookies/Cookies.vue.d.ts +1 -5
  38. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  39. package/dist/views/Cookies/Cookies.vue2.js +58 -61
  40. package/dist/views/Environment/Environment.vue.d.ts +1 -5
  41. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  42. package/dist/views/Environment/Environment.vue2.js +142 -96
  43. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  44. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +17 -18
  45. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  46. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +36 -34
  47. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
  48. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +3 -3
  49. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +25 -25
  50. package/dist/views/Request/libs/oauth2.d.ts +2 -2
  51. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  52. package/dist/views/Request/libs/oauth2.js +45 -36
  53. package/package.json +7 -6
@@ -1,7 +1,3 @@
1
- declare const _default: import("vue").DefineComponent<{
2
- isApp: boolean;
3
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
4
- isApp: boolean;
5
- }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
2
  export default _default;
7
3
  //# sourceMappingURL=Cookies.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Cookies.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Cookies/Cookies.vue"],"names":[],"mappings":";WAwMS,OAAO;;WAAP,OAAO;;AAmWhB,wBAMG"}
1
+ {"version":3,"file":"Cookies.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Cookies/Cookies.vue"],"names":[],"mappings":";AAsiBA,wBAKG"}
@@ -1,25 +1,22 @@
1
- import { defineComponent as L, computed as V, onMounted as D, onBeforeUnmount as M, openBlock as n, createBlock as O, withCtx as a, createVNode as s, unref as l, createElementVNode as f, createElementBlock as m, Fragment as _, renderList as x, normalizeClass as $, createTextVNode as k, toDisplayString as j, withDirectives as A, vShow as E } from "vue";
2
- import R from "../../components/Sidebar/SidebarButton.vue.js";
3
- import F from "../../components/Sidebar/SidebarList.vue.js";
4
- import K from "../../components/Sidebar/SidebarListElement.vue.js";
5
- import H from "../../components/ViewLayout/ViewLayout.vue.js";
6
- import I from "../../components/ViewLayout/ViewLayoutContent.vue.js";
7
- import { ScalarIcon as N } from "@scalar/components";
8
- import { cookieSchema as P } from "@scalar/oas-utils/entities/cookie";
9
- import { useRouter as T, useRoute as U } from "vue-router";
10
- import W from "./CookieForm.vue.js";
11
- import q from "./CookieRaw.vue.js";
12
- import { useSidebar as G } from "../../hooks/useSidebar.js";
13
- import { useWorkspace as J } from "../../store/store.js";
14
- import Q from "../../components/Sidebar/Sidebar.vue.js";
15
- const X = { class: "flex-1" }, Y = ["onClick"], Z = { class: "before:bg-border before:pointer-events-none before:z-1 before:absolute before:left-[calc(1rem_-_1.5px)] before:top-0 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-[.5px] mb-[.5px] last:mb-0 relative" }, ee = ["onClick"], te = { class: "before:bg-border before:pointer-events-none before:z-1 before:absolute before:left-[calc(1.75rem_-_1.5px)] before:top-0 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-[.5px] mb-[.5px] last:mb-0 relative" }, xe = /* @__PURE__ */ L({
1
+ import { defineComponent as D, inject as M, computed as R, onMounted as F, onBeforeUnmount as K, openBlock as l, createBlock as j, withCtx as a, createVNode as s, unref as n, createElementVNode as f, createElementBlock as m, Fragment as _, renderList as x, normalizeClass as O, createTextVNode as k, toDisplayString as $, withDirectives as E, vShow as N } from "vue";
2
+ import A from "../../components/Sidebar/SidebarButton.vue.js";
3
+ import H from "../../components/Sidebar/SidebarList.vue.js";
4
+ import I from "../../components/Sidebar/SidebarListElement.vue.js";
5
+ import P from "../../components/ViewLayout/ViewLayout.vue.js";
6
+ import T from "../../components/ViewLayout/ViewLayoutContent.vue.js";
7
+ import { ScalarIcon as z } from "@scalar/components";
8
+ import { cookieSchema as U } from "@scalar/oas-utils/entities/cookie";
9
+ import { useRouter as W, useRoute as q } from "vue-router";
10
+ import G from "./CookieForm.vue.js";
11
+ import J from "./CookieRaw.vue.js";
12
+ import { useSidebar as Q } from "../../hooks/useSidebar.js";
13
+ import { useWorkspace as X } from "../../store/store.js";
14
+ import Y from "../../components/Sidebar/Sidebar.vue.js";
15
+ const Z = { class: "flex-1" }, ee = ["onClick"], te = { class: "before:bg-border before:pointer-events-none before:z-1 before:absolute before:left-[calc(1rem_-_1.5px)] before:top-0 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-[.5px] mb-[.5px] last:mb-0 relative" }, oe = ["onClick"], re = { class: "before:bg-border before:pointer-events-none before:z-1 before:absolute before:left-[calc(1.75rem_-_1.5px)] before:top-0 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-[.5px] mb-[.5px] last:mb-0 relative" }, ve = /* @__PURE__ */ D({
16
16
  __name: "Cookies",
17
- props: {
18
- isApp: { type: Boolean }
19
- },
20
- setup(oe) {
21
- const { cookies: d, cookieMutators: v, events: g } = J(), { collapsedSidebarFolders: i, toggleSidebarFolder: y } = G(), b = T(), z = U(), C = () => {
22
- const t = Object.keys(d).length, e = P.parse({
17
+ setup(se) {
18
+ const { cookies: p, cookieMutators: v, events: y } = X(), { collapsedSidebarFolders: i, toggleSidebarFolder: g } = Q(), b = W(), L = q(), V = M("layout"), C = () => {
19
+ const t = Object.keys(p).length, e = U.parse({
23
20
  name: `Cookie ${t}`,
24
21
  value: "",
25
22
  domain: "example.com",
@@ -31,84 +28,84 @@ const X = { class: "flex-1" }, Y = ["onClick"], Z = { class: "before:bg-border b
31
28
  v.add(e), b.push(e.uid);
32
29
  }, B = (t) => {
33
30
  v.delete(t);
34
- const e = Object.values(d).filter(
31
+ const e = Object.values(p).filter(
35
32
  (o) => o.uid !== t
36
33
  );
37
34
  if (e.length > 1) {
38
35
  const o = e[e.length - 1];
39
36
  b.push(o.uid);
40
37
  } else e.length === 1 && e[0].uid === "default" && b.push("default");
41
- }, h = V(() => {
38
+ }, h = R(() => {
42
39
  const t = {};
43
- return Object.values(d).forEach((e) => {
40
+ return Object.values(p).forEach((e) => {
44
41
  e.domain && e.path && (t[e.domain] || (t[e.domain] = {}), t[e.domain][e.path] || (t[e.domain][e.path] = []), t[e.domain][e.path].push(e));
45
42
  }), t;
46
43
  }), w = (t) => i[t], S = (t) => {
47
- t != null && t.createNew && z.name === "cookies" && C();
44
+ t != null && t.createNew && L.name === "cookies" && C();
48
45
  };
49
- return D(() => {
46
+ return F(() => {
50
47
  const t = Object.keys(h.value), e = Object.entries(h.value).flatMap(
51
- ([o, r]) => Object.keys(r).map((p) => o + p)
48
+ ([o, r]) => Object.keys(r).map((d) => o + d)
52
49
  );
53
50
  t.forEach((o) => {
54
51
  i[o] = !0;
55
52
  }), e.forEach((o) => {
56
53
  i[o] = !0;
57
- }), g.hotKeys.on(S);
58
- }), M(() => g.hotKeys.off(S)), (t, e) => (n(), O(H, null, {
54
+ }), y.hotKeys.on(S);
55
+ }), K(() => y.hotKeys.off(S)), (t, e) => (l(), j(P, null, {
59
56
  default: a(() => [
60
- s(l(Q), { title: "Cookies" }, {
57
+ s(n(Y), { title: "Cookies" }, {
61
58
  content: a(() => [
62
- f("div", X, [
63
- s(F, null, {
59
+ f("div", Z, [
60
+ s(H, null, {
64
61
  default: a(() => [
65
- (n(!0), m(_, null, x(h.value, (o, r) => (n(), m("div", { key: r }, [
62
+ (l(!0), m(_, null, x(h.value, (o, r) => (l(), m("div", { key: r }, [
66
63
  f("button", {
67
64
  class: "flex font-medium gap-1.5 items-center px-2 py-1.5 text-left text-sm w-full break-words rounded hover:bg-b-2",
68
65
  type: "button",
69
- onClick: (p) => l(y)(r)
66
+ onClick: (d) => n(g)(r)
70
67
  }, [
71
- s(l(N), {
72
- class: $(["text-c-3", {
73
- "rotate-90": l(i)[r]
68
+ s(n(z), {
69
+ class: O(["text-c-3", {
70
+ "rotate-90": n(i)[r]
74
71
  }]),
75
72
  icon: "ChevronRight",
76
73
  size: "sm",
77
74
  thickness: "2.5"
78
75
  }, null, 8, ["class"]),
79
- k(" " + j(r), 1)
80
- ], 8, Y),
81
- A(f("div", Z, [
82
- (n(!0), m(_, null, x(o, (p, c) => (n(), m("div", { key: c }, [
76
+ k(" " + $(r), 1)
77
+ ], 8, ee),
78
+ E(f("div", te, [
79
+ (l(!0), m(_, null, x(o, (d, u) => (l(), m("div", { key: u }, [
83
80
  f("button", {
84
81
  class: "flex font-medium gap-1.5 items-center pl-5 pr-2 py-1.5 text-left text-sm w-full break-words rounded hover:bg-b-2",
85
82
  type: "button",
86
- onClick: (u) => l(y)(r + c)
83
+ onClick: (c) => n(g)(r + u)
87
84
  }, [
88
- s(l(N), {
89
- class: $(["text-c-3", {
90
- "rotate-90": l(i)[r + c]
85
+ s(n(z), {
86
+ class: O(["text-c-3", {
87
+ "rotate-90": n(i)[r + u]
91
88
  }]),
92
89
  icon: "ChevronRight",
93
90
  size: "sm",
94
91
  thickness: "2.5"
95
92
  }, null, 8, ["class"]),
96
- k(" " + j(c), 1)
97
- ], 8, ee),
98
- A(f("div", te, [
99
- (n(!0), m(_, null, x(p, (u) => (n(), O(K, {
100
- key: u.uid,
93
+ k(" " + $(u), 1)
94
+ ], 8, oe),
95
+ E(f("div", re, [
96
+ (l(!0), m(_, null, x(d, (c) => (l(), j(I, {
97
+ key: c.uid,
101
98
  class: "cookie text-xs",
102
- variable: { name: u.name, uid: u.uid },
99
+ variable: { name: c.name, uid: c.uid },
103
100
  warningMessage: "Are you sure you want to delete this cookie?",
104
- onDelete: (re) => B(u.uid)
101
+ onDelete: (ne) => B(c.uid)
105
102
  }, null, 8, ["variable", "onDelete"]))), 128))
106
103
  ], 512), [
107
- [E, w(r + c)]
104
+ [N, w(r + u)]
108
105
  ])
109
106
  ]))), 128))
110
107
  ], 512), [
111
- [E, w(r)]
108
+ [N, w(r)]
112
109
  ])
113
110
  ]))), 128))
114
111
  ]),
@@ -117,23 +114,23 @@ const X = { class: "flex-1" }, Y = ["onClick"], Z = { class: "before:bg-border b
117
114
  ])
118
115
  ]),
119
116
  button: a(() => [
120
- s(R, {
117
+ s(A, {
121
118
  click: C,
122
119
  hotkey: "N",
123
- isApp: t.isApp
120
+ layout: n(V)
124
121
  }, {
125
122
  title: a(() => e[0] || (e[0] = [
126
123
  k("Add Cookie")
127
124
  ])),
128
125
  _: 1
129
- }, 8, ["isApp"])
126
+ }, 8, ["layout"])
130
127
  ]),
131
128
  _: 1
132
129
  }),
133
- s(I, { class: "flex-1" }, {
130
+ s(T, { class: "flex-1" }, {
134
131
  default: a(() => [
135
- s(W),
136
- s(q)
132
+ s(G),
133
+ s(J)
137
134
  ]),
138
135
  _: 1
139
136
  })
@@ -143,5 +140,5 @@ const X = { class: "flex-1" }, Y = ["onClick"], Z = { class: "before:bg-border b
143
140
  }
144
141
  });
145
142
  export {
146
- xe as default
143
+ ve as default
147
144
  };
@@ -1,7 +1,3 @@
1
- declare const _default: import("vue").DefineComponent<{
2
- isApp: boolean;
3
- }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
4
- isApp: boolean;
5
- }> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
1
+ declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
6
2
  export default _default;
7
3
  //# sourceMappingURL=Environment.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/Environment.vue"],"names":[],"mappings":";WA6NS,OAAO;;WAAP,OAAO;;AAibhB,wBAMG"}
1
+ {"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/Environment.vue"],"names":[],"mappings":";AAw0BA,wBAKG"}
@@ -1,72 +1,116 @@
1
- import { defineComponent as B, ref as m, onMounted as K, onBeforeUnmount as L, openBlock as i, createBlock as p, withCtx as r, createVNode as u, createElementVNode as R, createElementBlock as y, Fragment as U, renderList as O, unref as a, createTextVNode as T, createSlots as j, createCommentVNode as F, toDisplayString as H, withKeys as J, nextTick as W } from "vue";
2
- import q from "../../components/CodeInput/CodeInput.vue.js";
3
- import z from "../../components/Sidebar/Sidebar.vue.js";
4
- import G from "../../components/Sidebar/SidebarButton.vue.js";
5
- import P from "../../components/Sidebar/SidebarList.vue.js";
6
- import Q from "../../components/Sidebar/SidebarListElement.vue.js";
7
- import X from "../../components/ViewLayout/ViewLayout.vue.js";
8
- import Y from "../../components/ViewLayout/ViewLayoutContent.vue.js";
9
- import Z from "../../components/ViewLayout/ViewLayoutSection.vue.js";
10
- import { useModal as x } from "@scalar/components";
11
- import { environmentSchema as ee } from "@scalar/oas-utils/entities/environment";
12
- import { nanoid as te } from "nanoid";
13
- import { useRouter as oe, useRoute as ne } from "vue-router";
14
- import le from "./EnvironmentColorModal.vue.js";
15
- import ae from "./EnvironmentModal.vue.js";
16
- import { useWorkspace as re } from "../../store/store.js";
17
- const ue = { class: "flex-1" }, ie = ["value"], we = /* @__PURE__ */ B({
1
+ import { defineComponent as J, ref as d, inject as T, watch as F, onMounted as H, onBeforeUnmount as W, openBlock as m, createBlock as b, withCtx as i, createVNode as s, createElementVNode as q, createElementBlock as g, Fragment as G, renderList as P, unref as a, createTextVNode as Q, createSlots as X, createCommentVNode as Y, toDisplayString as Z, withKeys as ee, nextTick as ne } from "vue";
2
+ import te from "../../components/CodeInput/CodeInput.vue.js";
3
+ import oe from "../../components/Sidebar/Sidebar.vue.js";
4
+ import le from "../../components/Sidebar/SidebarButton.vue.js";
5
+ import ae from "../../components/Sidebar/SidebarList.vue.js";
6
+ import ue from "../../components/Sidebar/SidebarListElement.vue.js";
7
+ import ie from "../../components/ViewLayout/ViewLayout.vue.js";
8
+ import re from "../../components/ViewLayout/ViewLayoutContent.vue.js";
9
+ import se from "../../components/ViewLayout/ViewLayoutSection.vue.js";
10
+ import { useModal as M } from "@scalar/components";
11
+ import { environmentSchema as me } from "@scalar/oas-utils/entities/environment";
12
+ import { nanoid as ce } from "nanoid";
13
+ import { useRouter as de, useRoute as fe } from "vue-router";
14
+ import ve from "./EnvironmentColorModal.vue.js";
15
+ import pe from "./EnvironmentModal.vue.js";
16
+ import { useWorkspace as ye } from "../../store/store.js";
17
+ const Ee = { class: "flex-1" }, he = ["value"], Re = /* @__PURE__ */ J({
18
18
  __name: "Environment",
19
- props: {
20
- isApp: { type: Boolean }
21
- },
22
- setup(se) {
23
- const E = oe(), h = ne(), { environments: l, environmentMutators: s, events: k } = re(), d = x(), f = x(), t = m(null), g = m(null), c = m(!1), v = m(null), C = m("");
24
- function _(e) {
25
- const o = ee.parse({
19
+ setup(be) {
20
+ const f = de(), k = fe(), { environments: l, environmentMutators: r, events: C } = ye(), v = M(), p = M(), o = d(null), _ = d(null), y = d(!1), E = d(null), V = d(""), O = T("layout"), c = (e) => JSON.parse(e), h = (e) => JSON.stringify(e, null, 2);
21
+ function x(e) {
22
+ const t = l[Object.keys(l)[0]], u = (t ? Object.keys(c(t.value)) : []).reduce(
23
+ (D, z) => (D[z] = "", D),
24
+ {}
25
+ ), w = me.parse({
26
26
  name: e.name,
27
- uid: te(),
27
+ uid: ce(),
28
28
  color: e.color,
29
- value: JSON.stringify({ exampleKey: "exampleValue" }, null, 2),
29
+ value: h(u),
30
30
  isDefault: !1
31
31
  });
32
- s.add(o), t.value = o.uid, E.push(t.value), f.hide();
32
+ r.add(w), o.value = w.uid, f.push(o.value), p.hide();
33
33
  }
34
- function N(e) {
35
- t.value && s.edit(t.value, "value", e);
34
+ function S(e) {
35
+ Object.values(l).forEach((t) => {
36
+ const n = c(t.value);
37
+ e in n || (n[e] = "", r.edit(
38
+ t.uid,
39
+ "value",
40
+ h(n)
41
+ ));
42
+ });
43
+ }
44
+ function $(e) {
45
+ Object.values(l).forEach((t) => {
46
+ const n = c(t.value);
47
+ e in n && (delete n[e], r.edit(
48
+ t.uid,
49
+ "value",
50
+ h(n)
51
+ ));
52
+ });
53
+ }
54
+ function j(e) {
55
+ if (o.value) {
56
+ const t = c(e), n = c(
57
+ l[o.value].value
58
+ );
59
+ Object.keys(t).forEach((u) => {
60
+ u in n || S(u);
61
+ }), Object.keys(n).forEach((u) => {
62
+ u in t || $(u);
63
+ }), r.edit(o.value, "value", e);
64
+ }
36
65
  }
37
- const w = (e) => {
38
- s.delete(e), t.value === e && (t.value = null);
39
- }, D = (e) => {
40
- v.value = e, C.value = l[e].color || "", d.show();
41
- }, M = (e) => {
42
- v.value && (s.edit(v.value, "color", e), d.hide());
43
- }, V = () => {
44
- E.currentRoute.value.params.environment === "default" && (t.value = l.default.uid);
45
- }, $ = () => {
46
- t.value && !l[t.value].isDefault && (c.value = !0, W(() => {
66
+ const K = (e) => {
67
+ if (r.delete(e), o.value === e) {
68
+ const t = Object.values(l);
69
+ if (t.length > 0) {
70
+ const n = t[t.length - 1];
71
+ o.value = n.uid, f.push({
72
+ name: "environment",
73
+ params: { environment: n.uid }
74
+ });
75
+ } else
76
+ o.value = l.default.uid, f.push({ name: "environment", params: { environment: "default" } });
77
+ }
78
+ }, I = (e) => {
79
+ E.value = e, V.value = l[e].color || "", v.show();
80
+ }, R = (e) => {
81
+ E.value && (r.edit(E.value, "color", e), v.hide());
82
+ }, B = () => {
83
+ const e = f.currentRoute.value.params.environment;
84
+ e ? o.value = e : e === "default" && (o.value = l.default.uid);
85
+ }, L = () => {
86
+ o.value && !l[o.value].isDefault && (y.value = !0, ne(() => {
47
87
  var e;
48
- (e = g.value) == null || e.focus();
88
+ (e = _.value) == null || e.focus();
49
89
  }));
50
- }, S = (e) => {
90
+ }, A = (e) => {
51
91
  const n = e.target.value;
52
- t.value && !l[t.value].isDefault && s.edit(t.value, "name", n);
53
- }, b = (e) => {
54
- e != null && e.createNew && h.name === "environment" && _({ name: "", color: "" });
55
- }, A = () => {
56
- f.show();
92
+ o.value && !l[o.value].isDefault && r.edit(o.value, "name", n);
93
+ }, N = (e) => {
94
+ e != null && e.createNew && k.name === "environment" && x({ name: "", color: "" });
95
+ }, U = () => {
96
+ p.show();
57
97
  };
58
- return K(() => {
59
- V(), k.hotKeys.on(b);
60
- }), L(() => k.hotKeys.off(b)), (e, o) => (i(), p(X, null, {
61
- default: r(() => [
62
- u(z, { title: "Environment" }, {
63
- content: r(() => [
64
- R("div", ue, [
65
- u(P, null, {
66
- default: r(() => [
67
- (i(!0), y(U, null, O(a(l), (n) => (i(), p(Q, {
98
+ return F(
99
+ () => k.params.environment,
100
+ (e) => o.value = e || l.default.uid
101
+ ), H(() => {
102
+ B(), C.hotKeys.on(N);
103
+ }), W(() => C.hotKeys.off(N)), (e, t) => (m(), b(ie, null, {
104
+ default: i(() => [
105
+ s(oe, { title: "Environment" }, {
106
+ content: i(() => [
107
+ q("div", Ee, [
108
+ s(ae, null, {
109
+ default: i(() => [
110
+ (m(!0), g(G, null, P(a(l), (n) => (m(), b(ue, {
68
111
  key: n.uid,
69
112
  class: "text-xs",
113
+ isCopyable: !1,
70
114
  variable: {
71
115
  name: n.name,
72
116
  uid: n.uid,
@@ -74,62 +118,64 @@ const ue = { class: "flex-1" }, ie = ["value"], we = /* @__PURE__ */ B({
74
118
  isDefault: n.isDefault
75
119
  },
76
120
  warningMessage: "Are you sure you want to delete this environment?",
77
- onClick: (I) => t.value = n.uid,
78
- onColorModal: D,
79
- onDelete: (I) => w(n.uid)
121
+ onClick: (u) => o.value = n.uid,
122
+ onColorModal: I,
123
+ onDelete: (u) => K(n.uid)
80
124
  }, null, 8, ["variable", "onClick", "onDelete"]))), 128))
81
125
  ]),
82
126
  _: 1
83
127
  })
84
128
  ])
85
129
  ]),
86
- button: r(() => [
87
- u(G, {
88
- click: A,
130
+ button: i(() => [
131
+ s(le, {
132
+ click: U,
89
133
  hotkey: "N",
90
- isApp: e.isApp
134
+ layout: a(O)
91
135
  }, {
92
- title: r(() => o[4] || (o[4] = [
93
- T("Add Environment")
136
+ title: i(() => t[4] || (t[4] = [
137
+ Q("Add Environment")
94
138
  ])),
95
139
  _: 1
96
- }, 8, ["isApp"])
140
+ }, 8, ["layout"])
97
141
  ]),
98
142
  _: 1
99
143
  }),
100
- u(Y, { class: "flex-1" }, {
101
- default: r(() => [
102
- u(Z, null, j({
103
- default: r(() => [
104
- t.value ? (i(), p(q, {
144
+ s(re, { class: "flex-1" }, {
145
+ default: i(() => [
146
+ s(se, null, X({
147
+ default: i(() => [
148
+ o.value ? (m(), b(te, {
105
149
  key: 0,
106
- class: "pl-px pr-2 md:px-2 py-2.5",
150
+ class: "pl-px pr-2 md:px-4 py-2",
151
+ isCopyable: "",
107
152
  language: "json",
108
153
  lineNumbers: "",
109
- modelValue: a(l)[t.value].value,
110
- "onUpdate:modelValue": N
111
- }, null, 8, ["modelValue"])) : F("", !0)
154
+ lint: "",
155
+ modelValue: a(l)[o.value].value,
156
+ "onUpdate:modelValue": j
157
+ }, null, 8, ["modelValue"])) : Y("", !0)
112
158
  ]),
113
159
  _: 2
114
160
  }, [
115
- t.value ? {
161
+ o.value ? {
116
162
  name: "title",
117
- fn: r(() => [
118
- !c.value || a(l)[t.value].isDefault ? (i(), y("span", {
163
+ fn: i(() => [
164
+ !y.value || a(l)[o.value].isDefault ? (m(), g("span", {
119
165
  key: 0,
120
- onDblclick: $
121
- }, H(a(l)[t.value].name), 33)) : (i(), y("input", {
166
+ onDblclick: L
167
+ }, Z(a(l)[o.value].name), 33)) : (m(), g("input", {
122
168
  key: 1,
123
169
  ref_key: "nameInputRef",
124
- ref: g,
170
+ ref: _,
125
171
  class: "ring-1 ring-offset-4 ring-b-outline rounded",
126
172
  spellcheck: "false",
127
173
  type: "text",
128
- value: a(l)[t.value].name,
129
- onBlur: o[0] || (o[0] = (n) => c.value = !1),
130
- onInput: S,
131
- onKeyup: o[1] || (o[1] = J((n) => c.value = !1, ["enter"]))
132
- }, null, 40, ie))
174
+ value: a(l)[o.value].name,
175
+ onBlur: t[0] || (t[0] = (n) => y.value = !1),
176
+ onInput: A,
177
+ onKeyup: t[1] || (t[1] = ee((n) => y.value = !1, ["enter"]))
178
+ }, null, 40, he))
133
179
  ]),
134
180
  key: "0"
135
181
  } : void 0
@@ -137,16 +183,16 @@ const ue = { class: "flex-1" }, ie = ["value"], we = /* @__PURE__ */ B({
137
183
  ]),
138
184
  _: 1
139
185
  }),
140
- u(le, {
141
- selectedColor: C.value,
142
- state: a(d),
143
- onCancel: o[2] || (o[2] = (n) => a(d).hide()),
144
- onSubmit: M
186
+ s(ve, {
187
+ selectedColor: V.value,
188
+ state: a(v),
189
+ onCancel: t[2] || (t[2] = (n) => a(v).hide()),
190
+ onSubmit: R
145
191
  }, null, 8, ["selectedColor", "state"]),
146
- u(ae, {
147
- state: a(f),
148
- onCancel: o[3] || (o[3] = (n) => a(f).hide()),
149
- onSubmit: _
192
+ s(pe, {
193
+ state: a(p),
194
+ onCancel: t[3] || (t[3] = (n) => a(p).hide()),
195
+ onSubmit: x
150
196
  }, null, 8, ["state"])
151
197
  ]),
152
198
  _: 1
@@ -154,5 +200,5 @@ const ue = { class: "flex-1" }, ie = ["value"], we = /* @__PURE__ */ B({
154
200
  }
155
201
  });
156
202
  export {
157
- we as default
203
+ Re as default
158
204
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentVariableDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentVariableDropdown.vue"],"names":[],"mappings":"AAkKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;;WAK/B,MAAM;uBACM,cAAc,CAAC,mBAAmB,CAAC;wBAClC,cAAc,CAAC,oBAAoB,CAAC;YAChD,MAAM;uBAEK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;gCA0Df,IAAI,GAAG,MAAM;;;;;WA/DvC,MAAM;uBACM,cAAc,CAAC,mBAAmB,CAAC;wBAClC,cAAc,CAAC,oBAAoB,CAAC;YAChD,MAAM;uBAEK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;;;AA+RlD,wBAUG"}
1
+ {"version":3,"file":"EnvironmentVariableDropdown.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentVariableDropdown.vue"],"names":[],"mappings":"AAiKA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAK7C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;;WAK/B,MAAM;uBACM,cAAc,CAAC,mBAAmB,CAAC;wBAClC,cAAc,CAAC,oBAAoB,CAAC;YAChD,MAAM;uBAEK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;gCA0Df,IAAI,GAAG,MAAM;;;;;WA/DvC,MAAM;uBACM,cAAc,CAAC,mBAAmB,CAAC;wBAClC,cAAc,CAAC,oBAAoB,CAAC;YAChD,MAAM;uBAEK;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE;;;;AAwRlD,wBAUG"}
@@ -1,8 +1,8 @@
1
- import { defineComponent as I, ref as d, computed as N, onMounted as P, openBlock as s, createBlock as w, unref as p, normalizeStyle as h, withCtx as y, createElementBlock as f, Fragment as R, renderList as j, normalizeClass as q, createElementVNode as v, createTextVNode as b, toDisplayString as k, createVNode as z } from "vue";
1
+ import { defineComponent as I, ref as d, computed as N, onMounted as P, openBlock as a, createBlock as w, unref as p, normalizeStyle as h, withCtx as y, createElementBlock as f, Fragment as R, renderList as j, normalizeClass as q, createElementVNode as v, createTextVNode as k, toDisplayString as b, createVNode as z } from "vue";
2
2
  import { ScalarDropdown as F, ScalarButton as K, ScalarIcon as T } from "@scalar/components";
3
3
  import { onClickOutside as $ } from "@vueuse/core";
4
4
  import L from "fuse.js";
5
- import { parseEnvVariables as g } from "../../libs/environment-parser.js";
5
+ import { parseEnvVariables as x } from "../../libs/environment-parser.js";
6
6
  const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 whitespace-nowrap" }, H = { class: "w-20 overflow-hidden text-ellipsis text-right whitespace-nowrap" }, oe = /* @__PURE__ */ I({
7
7
  __name: "EnvironmentVariableDropdown",
8
8
  props: {
@@ -13,16 +13,16 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
13
13
  dropdownPosition: {}
14
14
  },
15
15
  emits: ["select"],
16
- setup(x, { expose: E, emit: V }) {
17
- const a = x, _ = V, c = d(!0), u = d(null), r = d(0), C = () => {
16
+ setup(g, { expose: E, emit: V }) {
17
+ const l = g, _ = V, c = d(!0), u = d(null), r = d(0), C = () => {
18
18
  const e = A.value.params.workspace;
19
19
  S(`/workspace/${e}/environment/default`), c.value = !1;
20
- }, { push: S, currentRoute: A } = a.router, B = new L(g(a.activeEnvVariables.value), {
20
+ }, { push: S, currentRoute: A } = l.router, B = new L(x(l.activeEnvVariables.value), {
21
21
  keys: ["key", "value"]
22
- }), l = N(() => {
23
- const e = a.query;
22
+ }), s = N(() => {
23
+ const e = l.query;
24
24
  if (!e)
25
- return g(a.activeEnvVariables.value).slice(-4).filter(({ key: t, value: n }) => t !== "" || n !== "");
25
+ return x(l.activeEnvVariables.value).slice(-4).filter(({ key: t, value: n }) => t !== "" || n !== "");
26
26
  const o = B.search(e);
27
27
  return o.length > 0 ? o.map((t) => t.item).filter(({ key: t, value: n }) => t !== "" || n !== "") : [];
28
28
  }), m = (e) => {
@@ -30,12 +30,12 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
30
30
  }, O = (e) => e.value ? e.value.color : "#8E8E8E";
31
31
  return E({
32
32
  handleArrowKey: (e) => {
33
- const o = e === "up" ? -1 : 1, t = l.value.length;
33
+ const o = e === "up" ? -1 : 1, t = s.value.length;
34
34
  t !== 0 && (r.value = (r.value + o + t) % t);
35
35
  },
36
36
  handleSelect: () => {
37
37
  if (r.value >= 0) {
38
- const e = l.value[r.value];
38
+ const e = s.value[r.value];
39
39
  e && m(e.key);
40
40
  }
41
41
  }
@@ -49,10 +49,9 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
49
49
  { ignore: [u] }
50
50
  ), (e, o) => {
51
51
  var t, n;
52
- return s(), w(p(F), {
52
+ return a(), w(p(F), {
53
53
  ref_key: "dropdownRef",
54
54
  ref: u,
55
- class: "mt-2 min-w-60 rounded border bg-b-1 p-1 w-fit",
56
55
  static: "",
57
56
  staticOpen: c.value,
58
57
  style: h({
@@ -62,8 +61,8 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
62
61
  teleport: ".scalar-client"
63
62
  }, {
64
63
  items: y(() => [
65
- l.value.length ? (s(), f("ul", M, [
66
- (s(!0), f(R, null, j(l.value, (i, D) => (s(), f("li", {
64
+ s.value.length ? (a(), f("ul", M, [
65
+ (a(!0), f(R, null, j(s.value, (i, D) => (a(), f("li", {
67
66
  key: i.key,
68
67
  class: q(["h-8 font-code text-xxs hover:bg-b-2 flex cursor-pointer items-center justify-between gap-1.5 rounded p-1.5 transition-colors duration-150", { "bg-b-2": D === r.value }]),
69
68
  onClick: (W) => m(i.key)
@@ -75,11 +74,11 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
75
74
  backgroundColor: O(e.activeEnvironment)
76
75
  })
77
76
  }, null, 4),
78
- b(" " + k(i.key), 1)
77
+ k(" " + b(i.key), 1)
79
78
  ]),
80
- v("span", H, k(i.value), 1)
79
+ v("span", H, b(i.value), 1)
81
80
  ], 10, Q))), 128))
82
- ])) : (s(), w(p(K), {
81
+ ])) : (a(), w(p(K), {
83
82
  key: 1,
84
83
  class: "font-code text-xxs hover:bg-b-2 flex h-8 w-full justify-start gap-2 px-1.5 transition-colors duration-150",
85
84
  variant: "secondary",
@@ -90,7 +89,7 @@ const M = { key: 0 }, Q = ["onClick"], G = { class: "flex items-center gap-1.5 w
90
89
  class: "w-2.5",
91
90
  icon: "Add"
92
91
  }),
93
- o[0] || (o[0] = b(" Add Variable "))
92
+ o[0] || (o[0] = k(" Add Variable "))
94
93
  ]),
95
94
  _: 1
96
95
  }))