@scalar/api-client 2.0.32 → 2.0.34

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 (55) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  3. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  4. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +39 -31
  5. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  6. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +65 -55
  7. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
  8. package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +53 -44
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  10. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +42 -34
  11. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  12. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +126 -70
  13. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -1
  14. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +37 -29
  15. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  16. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  17. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +97 -85
  18. package/dist/components/CommandPalette/handleKeyDown.d.ts +2 -0
  19. package/dist/components/CommandPalette/handleKeyDown.d.ts.map +1 -0
  20. package/dist/components/CommandPalette/handleKeyDown.js +7 -0
  21. package/dist/components/Form/Form.vue.js +1 -1
  22. package/dist/components/Search/SearchButton.vue.d.ts.map +1 -1
  23. package/dist/components/Search/SearchButton.vue.js +14 -16
  24. package/dist/components/Sidebar/SidebarButton.vue.js +1 -1
  25. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  26. package/dist/components/Sidebar/SidebarList.vue.js +1 -1
  27. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  28. package/dist/components/Sidebar/SidebarListElement.vue.js +1 -1
  29. package/dist/components/Sidebar/SidebarListElement.vue2.js +9 -9
  30. package/dist/constants.d.ts +0 -4
  31. package/dist/constants.d.ts.map +1 -1
  32. package/dist/constants.js +2 -2
  33. package/dist/hooks/useDarkModeState.d.ts.map +1 -1
  34. package/dist/hooks/useDarkModeState.js +5 -5
  35. package/dist/layouts/App/create-api-client-app.d.ts +1 -1
  36. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  37. package/dist/layouts/App/create-api-client-app.js +1 -1
  38. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  39. package/dist/layouts/Modal/ApiClientModal.vue2.js +9 -9
  40. package/dist/layouts/Modal/api-client-modal.d.ts +2 -2
  41. package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -1
  42. package/dist/layouts/Modal/api-client-modal.js +2 -2
  43. package/dist/libs/create-client.d.ts +2 -2
  44. package/dist/libs/create-client.d.ts.map +1 -1
  45. package/dist/libs/create-client.js +68 -68
  46. package/dist/libs/sendRequest.d.ts +2 -1
  47. package/dist/libs/sendRequest.d.ts.map +1 -1
  48. package/dist/libs/sendRequest.js +54 -45
  49. package/dist/style.css +1 -1
  50. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  51. package/dist/views/Request/Request.vue.js +2 -2
  52. package/dist/views/Request/Request.vue2.js +102 -103
  53. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  54. package/dist/views/Request/RequestSection/RequestSection.vue.js +37 -37
  55. package/package.json +6 -6
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.0.34
4
+
5
+ ### Patch Changes
6
+
7
+ - c0cf4ac: fix: hide servers page
8
+ - 225e32a: feat: make the command palette amazing
9
+ - bb5909f: fix: tw-bg-base bug in gitbook and some app polish
10
+ - 9815191: fix: actually add workspace cookies to request
11
+ - a7ea3e3: fix: add default active collection to folder create command
12
+ - 9243580: feat: improve create request command
13
+ - 12bd5b8: fix: upload file in form-data with key
14
+ - Updated dependencies [9815191]
15
+ - Updated dependencies [e8fa353]
16
+ - Updated dependencies [869d255]
17
+ - @scalar/oas-utils@0.2.18
18
+ - @scalar/components@0.12.21
19
+
20
+ ## 2.0.33
21
+
22
+ ### Patch Changes
23
+
24
+ - ce3f630: fix: remove layout code from scalar-app class
25
+ - d88c403: fix(api-client): remove default proxy
26
+ - 0bea5b6: fix: window.matchMedia is not a function
27
+ - 2c61c21: feat: make the configuration for createApiClientApp and createApiClientModal optional
28
+ - 19a50de: feat: do not hide auth on write mode
29
+ - Updated dependencies [b2a662a]
30
+ - Updated dependencies [86014b5]
31
+ - Updated dependencies [a60c916]
32
+ - @scalar/components@0.12.20
33
+
3
34
  ## 2.0.32
4
35
 
5
36
  ### Patch Changes
@@ -2,7 +2,7 @@ import o from "./CodeInput.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5c73f0cd"]]);
5
+ const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4c6b20da"]]);
6
6
  export {
7
- f as default
7
+ _ as default
8
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteCollection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteCollection.vue"],"names":[],"mappings":";;;;;AAiMA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteCollection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteCollection.vue"],"names":[],"mappings":";;;;;AA2OA,wBAMG"}
@@ -1,61 +1,69 @@
1
- import { defineComponent as d, ref as s, onMounted as p, openBlock as f, createElementBlock as x, withModifiers as h, createElementVNode as e, withDirectives as _, vModelText as v, createVNode as b, unref as w, withCtx as C, createTextVNode as N } from "vue";
2
- import { useWorkspace as g } from "../../store/workspace.js";
3
- import { ScalarButton as k } from "@scalar/components";
4
- const y = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, M = /* @__PURE__ */ e("label", {
1
+ import { defineComponent as p, ref as c, onMounted as f, onBeforeUnmount as _, openBlock as h, createElementBlock as v, createElementVNode as o, withDirectives as x, vModelText as w, createVNode as b, unref as k, withCtx as C, createTextVNode as y } from "vue";
2
+ import { useWorkspace as N } from "../../store/workspace.js";
3
+ import { ScalarButton as g } from "@scalar/components";
4
+ import { handleKeyDown as i } from "./handleKeyDown.js";
5
+ const B = { class: "flex w-full flex-col gap-3" }, E = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, V = /* @__PURE__ */ o("label", {
5
6
  class: "absolute w-full h-full opacity-0 cursor-text",
6
7
  for: "collectionanme"
7
- }, null, -1), V = { class: "flex" }, B = /* @__PURE__ */ e("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), W = /* @__PURE__ */ d({
8
+ }, null, -1), M = { class: "flex" }, D = /* @__PURE__ */ o("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), W = /* @__PURE__ */ p({
8
9
  __name: "CommandPaletteCollection",
9
10
  emits: ["close"],
10
- setup(S, { emit: c }) {
11
- const a = c, { activeWorkspace: i, collectionMutators: r } = g(), t = s(""), u = () => {
12
- r.add(
11
+ setup(I, { emit: a }) {
12
+ const r = a, { activeWorkspace: u, collectionMutators: d } = N(), l = c(""), n = () => {
13
+ d.add(
13
14
  {
14
15
  spec: {
15
16
  openapi: "3.1.0",
16
17
  info: {
17
- title: t.value,
18
+ title: l.value,
18
19
  version: "0.0.1"
19
20
  }
20
21
  }
21
22
  },
22
- i.value.uid
23
- ), a("close");
24
- }, l = s(null);
25
- return p(() => {
26
- var o;
27
- (o = l.value) == null || o.focus();
28
- }), (o, n) => (f(), x("form", {
29
- class: "flex w-full flex-col gap-3",
30
- onSubmit: h(u, ["prevent"])
31
- }, [
32
- e("div", y, [
33
- M,
34
- _(e("input", {
23
+ u.value.uid
24
+ ), r("close");
25
+ }, s = c(null);
26
+ return f(() => {
27
+ var e;
28
+ (e = s.value) == null || e.focus(), window.addEventListener(
29
+ "keydown",
30
+ (t) => i(t, n),
31
+ !0
32
+ );
33
+ }), _(() => {
34
+ window.removeEventListener(
35
+ "keydown",
36
+ (e) => i(e, n),
37
+ !0
38
+ );
39
+ }), (e, t) => (h(), v("div", B, [
40
+ o("div", E, [
41
+ V,
42
+ x(o("input", {
35
43
  id: "collectionanme",
36
44
  ref_key: "collectionInput",
37
- ref: l,
38
- "onUpdate:modelValue": n[0] || (n[0] = (m) => t.value = m),
45
+ ref: s,
46
+ "onUpdate:modelValue": t[0] || (t[0] = (m) => l.value = m),
39
47
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
40
48
  label: "Collection Name",
41
49
  placeholder: "Collection Name"
42
50
  }, null, 512), [
43
- [v, t.value]
51
+ [w, l.value]
44
52
  ])
45
53
  ]),
46
- e("div", V, [
47
- B,
48
- b(w(k), {
54
+ o("div", M, [
55
+ D,
56
+ b(k(g), {
49
57
  class: "max-h-8 text-xs p-0 px-3",
50
- type: "submit"
58
+ onClick: n
51
59
  }, {
52
60
  default: C(() => [
53
- N(" Continue ")
61
+ y(" Continue ")
54
62
  ]),
55
63
  _: 1
56
64
  })
57
65
  ])
58
- ], 32));
66
+ ]));
59
67
  }
60
68
  });
61
69
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteExample.vue"],"names":[],"mappings":";IAqIE,oCAAoC;eACzB,MAAM;;;;IADjB,oCAAoC;eACzB,MAAM;;;;AA+SnB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteExample.vue"],"names":[],"mappings":";IAuJE,oCAAoC;eACzB,MAAM;;;;IADjB,oCAAoC;eACzB,MAAM;;;;AA2TnB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,75 +1,86 @@
1
- import { defineComponent as N, ref as u, onMounted as B, openBlock as i, createElementBlock as f, withModifiers as I, createElementVNode as l, withDirectives as M, vModelText as R, createVNode as s, unref as n, withCtx as r, Fragment as V, renderList as q, createBlock as W, createTextVNode as c, toDisplayString as x } from "vue";
2
- import v from "../HttpMethod/HttpMethod.vue.js";
3
- import { useWorkspace as j } from "../../store/workspace.js";
4
- import { ScalarDropdown as z, ScalarDropdownItem as T, ScalarButton as h, ScalarIcon as F } from "@scalar/components";
5
- import { useRouter as L } from "vue-router";
6
- const P = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, U = /* @__PURE__ */ l("label", {
1
+ import { defineComponent as $, ref as c, onMounted as x, onBeforeUnmount as B, openBlock as d, createElementBlock as v, createElementVNode as l, withDirectives as I, vModelText as R, createVNode as s, unref as n, withCtx as r, Fragment as V, renderList as q, createBlock as L, createTextVNode as p, toDisplayString as h } from "vue";
2
+ import _ from "../HttpMethod/HttpMethod.vue.js";
3
+ import { useWorkspace as M } from "../../store/workspace.js";
4
+ import { ScalarDropdown as W, ScalarDropdownItem as j, ScalarButton as w, ScalarIcon as z } from "@scalar/components";
5
+ import { useRouter as T } from "vue-router";
6
+ import { handleKeyDown as b } from "./handleKeyDown.js";
7
+ const U = { class: "flex w-full flex-col gap-3" }, F = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, K = /* @__PURE__ */ l("label", {
7
8
  class: "absolute w-full h-full opacity-0 cursor-text",
8
9
  for: "examplename"
9
- }, null, -1), A = { class: "flex gap-2" }, G = { class: "flex flex-1 max-h-8" }, H = { class: "flex items-center gap-2" }, J = { class: "max-h-40 custom-scroll" }, ee = /* @__PURE__ */ N({
10
+ }, null, -1), P = { class: "flex gap-2" }, A = { class: "flex flex-1 max-h-8" }, G = { class: "flex items-center gap-2" }, H = { class: "max-h-40 custom-scroll" }, le = /* @__PURE__ */ $({
10
11
  __name: "CommandPaletteExample",
11
12
  props: {
12
13
  metaData: {}
13
14
  },
14
15
  emits: ["close"],
15
- setup(_, { emit: b }) {
16
- const w = _, k = b, { push: g } = L(), {
17
- activeRequest: y,
18
- activeWorkspace: C,
19
- activeWorkspaceRequests: S,
20
- requests: D,
21
- requestExampleMutators: E
22
- } = j(), m = u(""), a = u(
16
+ setup(k, { emit: J }) {
17
+ const y = k, { push: g } = T(), {
18
+ activeRequest: C,
19
+ activeWorkspace: E,
20
+ activeWorkspaceRequests: D,
21
+ requests: S,
22
+ requestExampleMutators: N
23
+ } = M(), u = c(""), o = c(
23
24
  // Ensure we pre-select the correct request
24
- D[w.metaData ?? ""] ?? y.value
25
- ), p = (e) => a.value = e, d = u(null);
26
- B(() => {
25
+ S[y.metaData ?? ""] ?? C.value
26
+ ), f = (e) => o.value = e, m = c(null);
27
+ x(() => {
27
28
  var e;
28
- return (e = d.value) == null ? void 0 : e.focus();
29
+ return (e = m.value) == null ? void 0 : e.focus();
29
30
  });
30
- const $ = () => {
31
- const e = E.add(
32
- a.value,
33
- m.value
31
+ const i = () => {
32
+ const e = N.add(
33
+ o.value,
34
+ u.value
34
35
  );
35
36
  e && g(
36
- `/workspace/${C.value.uid}/request/${a.value.uid}/examples/${e.uid}`
37
+ `/workspace/${E.value.uid}/request/${o.value.uid}/examples/${e.uid}`
37
38
  );
38
39
  };
39
- return (e, o) => (i(), f("form", {
40
- class: "flex w-full flex-col gap-3",
41
- onSubmit: o[2] || (o[2] = I((t) => k("close"), ["prevent"]))
42
- }, [
43
- l("div", P, [
44
- U,
45
- M(l("input", {
40
+ return x(() => {
41
+ var e;
42
+ (e = m.value) == null || e.focus(), window.addEventListener(
43
+ "keydown",
44
+ (a) => b(a, i),
45
+ !0
46
+ );
47
+ }), B(() => {
48
+ window.removeEventListener(
49
+ "keydown",
50
+ (e) => b(e, i),
51
+ !0
52
+ );
53
+ }), (e, a) => (d(), v("div", U, [
54
+ l("div", F, [
55
+ K,
56
+ I(l("input", {
46
57
  id: "examplename",
47
58
  ref_key: "exampleInput",
48
- ref: d,
49
- "onUpdate:modelValue": o[0] || (o[0] = (t) => m.value = t),
59
+ ref: m,
60
+ "onUpdate:modelValue": a[0] || (a[0] = (t) => u.value = t),
50
61
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
51
62
  label: "Example Name",
52
63
  placeholder: "Example Name"
53
64
  }, null, 512), [
54
- [R, m.value]
65
+ [R, u.value]
55
66
  ])
56
67
  ]),
57
- l("div", A, [
58
- l("div", G, [
59
- s(n(z), {
68
+ l("div", P, [
69
+ l("div", A, [
70
+ s(n(W), {
60
71
  placement: "bottom",
61
72
  resize: ""
62
73
  }, {
63
74
  items: r(() => [
64
- l("div", J, [
65
- (i(!0), f(V, null, q(n(S), (t) => (i(), W(n(T), {
75
+ l("div", H, [
76
+ (d(!0), v(V, null, q(n(D), (t) => (d(), L(n(j), {
66
77
  key: t.uid,
67
78
  class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
68
- onClick: (K) => p(t)
79
+ onClick: (O) => f(t)
69
80
  }, {
70
81
  default: r(() => [
71
- c(x(t.summary) + " ", 1),
72
- s(v, {
82
+ p(h(t.summary) + " ", 1),
83
+ s(_, {
73
84
  method: t.method
74
85
  }, null, 8, ["method"])
75
86
  ]),
@@ -78,18 +89,18 @@ const P = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
78
89
  ])
79
90
  ]),
80
91
  default: r(() => [
81
- s(n(h), {
92
+ s(n(w), {
82
93
  class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
83
94
  variant: "outlined",
84
- onClick: o[1] || (o[1] = (t) => p(a.value))
95
+ onClick: a[1] || (a[1] = (t) => f(o.value))
85
96
  }, {
86
97
  default: r(() => [
87
- c(x(a.value.summary) + " ", 1),
88
- l("div", H, [
89
- s(v, {
90
- method: a.value.method
98
+ p(h(o.value.summary) + " ", 1),
99
+ l("div", G, [
100
+ s(_, {
101
+ method: o.value.method
91
102
  }, null, 8, ["method"]),
92
- s(n(F), {
103
+ s(n(z), {
93
104
  class: "text-c-3",
94
105
  icon: "ChevronDown",
95
106
  size: "xs"
@@ -102,20 +113,19 @@ const P = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
102
113
  _: 1
103
114
  })
104
115
  ]),
105
- s(n(h), {
116
+ s(n(w), {
106
117
  class: "max-h-8 text-xs p-0 px-3",
107
- type: "submit",
108
- onClick: $
118
+ onClick: i
109
119
  }, {
110
120
  default: r(() => [
111
- c(" Create Example ")
121
+ p(" Create Example ")
112
122
  ]),
113
123
  _: 1
114
124
  })
115
125
  ])
116
- ], 32));
126
+ ]));
117
127
  }
118
128
  });
119
129
  export {
120
- ee as default
130
+ le as default
121
131
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteFolder.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteFolder.vue"],"names":[],"mappings":";;;;;AA4SA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteFolder.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteFolder.vue"],"names":[],"mappings":";;;;;AA0VA,wBAMG"}
@@ -1,74 +1,83 @@
1
- import { defineComponent as w, ref as r, computed as m, onMounted as C, openBlock as g, createElementBlock as S, withModifiers as V, createElementVNode as a, withDirectives as y, vModelText as N, createVNode as n, unref as i, withCtx as d, normalizeClass as k, toDisplayString as F, createTextVNode as I } from "vue";
2
- import { useWorkspace as M } from "../../store/workspace.js";
3
- import { ScalarListbox as B, ScalarButton as p, ScalarIcon as D } from "@scalar/components";
4
- const j = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, z = /* @__PURE__ */ a("label", {
1
+ import { defineComponent as k, ref as u, computed as p, onMounted as y, onBeforeUnmount as V, openBlock as N, createElementBlock as S, createElementVNode as a, withDirectives as B, vModelText as D, createVNode as s, unref as i, withCtx as c, normalizeClass as E, toDisplayString as F, createTextVNode as I } from "vue";
2
+ import { useWorkspace as L } from "../../store/workspace.js";
3
+ import { ScalarListbox as M, ScalarButton as x, ScalarIcon as U } from "@scalar/components";
4
+ import { handleKeyDown as h } from "./handleKeyDown.js";
5
+ const z = { class: "flex w-full flex-col gap-3" }, T = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, W = /* @__PURE__ */ a("label", {
5
6
  class: "absolute w-full h-full opacity-0 cursor-text",
6
7
  for: "foldername"
7
- }, null, -1), E = { class: "flex" }, T = { class: "flex flex-1 gap-2 max-h-8" }, W = /* @__PURE__ */ w({
8
+ }, null, -1), j = { class: "flex" }, K = { class: "flex flex-1 gap-2 max-h-8" }, J = /* @__PURE__ */ k({
8
9
  __name: "CommandPaletteFolder",
9
10
  emits: ["close"],
10
- setup(U, { emit: v }) {
11
- const x = v, { collections: b, folderMutators: h } = M(), s = r(""), u = r(""), c = m(
12
- () => Object.values(b).map((e) => {
11
+ setup(P, { emit: w }) {
12
+ var v;
13
+ const _ = w, { activeWorkspaceCollections: b, folderMutators: C, activeCollection: g } = L(), n = u(""), d = u(((v = g.value) == null ? void 0 : v.uid) ?? ""), f = p(
14
+ () => b.value.map((e) => {
13
15
  var l, o;
14
16
  return {
15
17
  id: e.uid,
16
18
  label: ((o = (l = e.spec) == null ? void 0 : l.info) == null ? void 0 : o.title) ?? ""
17
19
  };
18
20
  })
19
- ), t = m({
20
- get: () => c.value.find(
21
- ({ id: e }) => e === u.value
21
+ ), t = p({
22
+ get: () => f.value.find(
23
+ ({ id: e }) => e === d.value
22
24
  ),
23
25
  set: (e) => {
24
- e != null && e.id && (u.value = e.id);
26
+ e != null && e.id && (d.value = e.id);
25
27
  }
26
- }), _ = () => {
27
- s.value && t.value && (h.add(
28
+ }), r = () => {
29
+ n.value && t.value && (C.add(
28
30
  {
29
- name: s.value
31
+ name: n.value
30
32
  },
31
- u.value
32
- ), x("close"));
33
- }, f = r(null);
34
- return C(() => {
33
+ d.value
34
+ ), _("close"));
35
+ }, m = u(null);
36
+ return y(() => {
35
37
  var e;
36
- (e = f.value) == null || e.focus();
37
- }), (e, l) => (g(), S("form", {
38
- class: "flex w-full flex-col gap-3",
39
- onSubmit: V(_, ["prevent"])
40
- }, [
41
- a("div", j, [
42
- z,
43
- y(a("input", {
38
+ (e = m.value) == null || e.focus(), window.addEventListener(
39
+ "keydown",
40
+ (l) => h(l, r),
41
+ !0
42
+ );
43
+ }), V(() => {
44
+ window.removeEventListener(
45
+ "keydown",
46
+ (e) => h(e, r),
47
+ !0
48
+ );
49
+ }), (e, l) => (N(), S("div", z, [
50
+ a("div", T, [
51
+ W,
52
+ B(a("input", {
44
53
  id: "foldername",
45
54
  ref_key: "folderInput",
46
- ref: f,
47
- "onUpdate:modelValue": l[0] || (l[0] = (o) => s.value = o),
55
+ ref: m,
56
+ "onUpdate:modelValue": l[0] || (l[0] = (o) => n.value = o),
48
57
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
49
58
  label: "Folder Name",
50
59
  placeholder: "Folder Name"
51
60
  }, null, 512), [
52
- [N, s.value]
61
+ [D, n.value]
53
62
  ])
54
63
  ]),
55
- a("div", E, [
56
- a("div", T, [
57
- n(i(B), {
64
+ a("div", j, [
65
+ a("div", K, [
66
+ s(i(M), {
58
67
  modelValue: t.value,
59
68
  "onUpdate:modelValue": l[1] || (l[1] = (o) => t.value = o),
60
- options: c.value
69
+ options: f.value
61
70
  }, {
62
- default: d(() => [
63
- n(i(p), {
71
+ default: c(() => [
72
+ s(i(x), {
64
73
  class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
65
74
  variant: "outlined"
66
75
  }, {
67
- default: d(() => [
76
+ default: c(() => [
68
77
  a("span", {
69
- class: k(t.value ? "text-c-1" : "text-c-3")
78
+ class: E(t.value ? "text-c-1" : "text-c-3")
70
79
  }, F(t.value ? t.value.label : "Select Collection"), 3),
71
- n(i(D), {
80
+ s(i(U), {
72
81
  class: "text-c-3",
73
82
  icon: "ChevronDown",
74
83
  size: "xs"
@@ -80,19 +89,19 @@ const j = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
80
89
  _: 1
81
90
  }, 8, ["modelValue", "options"])
82
91
  ]),
83
- n(i(p), {
92
+ s(i(x), {
84
93
  class: "max-h-8 text-xs p-0 px-3",
85
- type: "submit"
94
+ onClick: r
86
95
  }, {
87
- default: d(() => [
96
+ default: c(() => [
88
97
  I(" Create Folder ")
89
98
  ]),
90
99
  _: 1
91
100
  })
92
101
  ])
93
- ], 32));
102
+ ]));
94
103
  }
95
104
  });
96
105
  export {
97
- W as default
106
+ J as default
98
107
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;AAkRA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;AA4TA,wBAMG"}
@@ -1,41 +1,49 @@
1
- import { defineComponent as S, ref as m, onMounted as y, openBlock as F, createElementBlock as k, withModifiers as C, createElementVNode as t, createVNode as a, unref as o, withCtx as u, createTextVNode as d } from "vue";
2
- import { useWorkspace as I } from "../../store/workspace.js";
3
- import { ScalarButton as f, ScalarIcon as N } from "@scalar/components";
4
- import { useFileDialog as R } from "../../hooks/useFileDialog.js";
5
- const U = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, A = /* @__PURE__ */ t("label", {
1
+ import { defineComponent as k, ref as m, onMounted as S, onBeforeUnmount as C, openBlock as F, createElementBlock as I, createElementVNode as o, createVNode as a, unref as n, withCtx as u, createTextVNode as d } from "vue";
2
+ import { useWorkspace as L } from "../../store/workspace.js";
3
+ import { ScalarButton as f, ScalarIcon as U } from "@scalar/components";
4
+ import { handleKeyDown as h } from "./handleKeyDown.js";
5
+ import { useFileDialog as B } from "../../hooks/useFileDialog.js";
6
+ const E = { class: "flex w-full flex-col gap-3" }, N = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, R = /* @__PURE__ */ o("label", {
6
7
  class: "absolute w-full h-full opacity-0 cursor-text",
7
8
  for: "requestimport"
8
- }, null, -1), B = { class: "flex gap-2" }, L = { class: "flex flex-1 gap-2 max-h-8" }, E = /* @__PURE__ */ S({
9
+ }, null, -1), A = { class: "flex gap-2" }, D = { class: "flex flex-1 gap-2 max-h-8" }, j = /* @__PURE__ */ k({
9
10
  __name: "CommandPaletteImport",
10
11
  emits: ["close"],
11
- setup(M, { emit: x }) {
12
- const s = x, { activeWorkspace: h, importSpecFile: _, importSpecFromUrl: g } = I(), r = m(""), { open: b } = R({
12
+ setup(P, { emit: x }) {
13
+ const r = x, { activeWorkspace: _, importSpecFile: w, importSpecFromUrl: g } = L(), s = m(""), { open: v } = B({
13
14
  onChange: async (e) => {
14
- const l = e == null ? void 0 : e[0];
15
- if (l) {
15
+ const t = e == null ? void 0 : e[0];
16
+ if (t) {
16
17
  const i = new FileReader();
17
- i.onload = async (v) => {
18
+ i.onload = async (b) => {
18
19
  var p;
19
- const w = (p = v.target) == null ? void 0 : p.result;
20
- _(w, h.value.uid), n(), s("close");
21
- }, i.readAsText(l);
20
+ const y = (p = b.target) == null ? void 0 : p.result;
21
+ w(y, _.value.uid), l(), r("close");
22
+ }, i.readAsText(t);
22
23
  }
23
24
  },
24
25
  multiple: !1,
25
26
  accept: ".json,.yaml,.yml"
26
- }), n = async () => {
27
- r.value && (await g(r.value), s("close"));
27
+ }), l = async () => {
28
+ s.value && (await g(s.value), r("close"));
28
29
  }, c = m(null);
29
- return y(() => {
30
+ return S(() => {
30
31
  var e;
31
- (e = c.value) == null || e.focus();
32
- }), (e, l) => (F(), k("form", {
33
- class: "flex w-full flex-col gap-3",
34
- onSubmit: C(n, ["prevent"])
35
- }, [
36
- t("div", U, [
37
- A,
38
- t("input", {
32
+ (e = c.value) == null || e.focus(), window.addEventListener(
33
+ "keydown",
34
+ (t) => h(t, l),
35
+ !0
36
+ );
37
+ }), C(() => {
38
+ window.removeEventListener(
39
+ "keydown",
40
+ (e) => h(e, l),
41
+ !0
42
+ );
43
+ }), (e, t) => (F(), I("div", E, [
44
+ o("div", N, [
45
+ R,
46
+ o("input", {
39
47
  id: "requestimport",
40
48
  ref_key: "importInput",
41
49
  ref: c,
@@ -44,16 +52,16 @@ const U = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
44
52
  placeholder: "Paste Swagger File URL"
45
53
  }, null, 512)
46
54
  ]),
47
- t("div", B, [
48
- t("div", L, [
49
- a(o(f), {
55
+ o("div", A, [
56
+ o("div", D, [
57
+ a(n(f), {
50
58
  class: "p-2 max-h-8 gap-1 text-xs hover:bg-b-2 relative",
51
59
  variant: "outlined",
52
- onClick: o(b)
60
+ onClick: n(v)
53
61
  }, {
54
62
  default: u(() => [
55
63
  d(" JSON, or YAML Files "),
56
- a(o(N), {
64
+ a(n(U), {
57
65
  class: "text-c-3 -rotate-90",
58
66
  icon: "ArrowRight",
59
67
  size: "sm"
@@ -62,9 +70,9 @@ const U = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
62
70
  _: 1
63
71
  }, 8, ["onClick"])
64
72
  ]),
65
- a(o(f), {
73
+ a(n(f), {
66
74
  class: "max-h-8 text-xs p-0 px-3",
67
- type: "submit"
75
+ onClick: l
68
76
  }, {
69
77
  default: u(() => [
70
78
  d(" Import Collection ")
@@ -72,9 +80,9 @@ const U = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
72
80
  _: 1
73
81
  })
74
82
  ])
75
- ], 32));
83
+ ]));
76
84
  }
77
85
  });
78
86
  export {
79
- E as default
87
+ j as default
80
88
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteRequest.vue"],"names":[],"mappings":";;;;;AAyYA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteRequest.vue"],"names":[],"mappings":";;;;;AAgjBA,wBAMG"}