@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
@@ -1,102 +1,158 @@
1
- import { defineComponent as y, ref as n, computed as h, onMounted as V, openBlock as N, createElementBlock as R, withModifiers as I, createElementVNode as o, withDirectives as U, vModelText as E, createVNode as u, unref as r, withCtx as d, normalizeClass as B, toDisplayString as D, createTextVNode as F } from "vue";
2
- import T from "../HttpMethod/HttpMethod.vue.js";
3
- import { useWorkspace as W } from "../../store/workspace.js";
4
- import { ScalarListbox as $, ScalarButton as x, ScalarIcon as z } from "@scalar/components";
5
- import { useRouter as j } from "vue-router";
6
- const G = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, L = /* @__PURE__ */ o("label", {
1
+ import { defineComponent as T, ref as d, computed as v, onMounted as W, onBeforeUnmount as $, openBlock as V, createElementBlock as G, createElementVNode as u, withDirectives as K, vModelText as O, createVNode as o, unref as s, withCtx as r, normalizeClass as U, toDisplayString as S, createBlock as P, createCommentVNode as A, createTextVNode as H } from "vue";
2
+ import J from "../HttpMethod/HttpMethod.vue.js";
3
+ import { useWorkspace as Q } from "../../store/workspace.js";
4
+ import { ScalarListbox as M, ScalarButton as h, ScalarIcon as N } from "@scalar/components";
5
+ import { useRouter as X } from "vue-router";
6
+ import { handleKeyDown as R } from "./handleKeyDown.js";
7
+ const Y = { class: "flex w-full flex-col gap-3" }, Z = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, ee = /* @__PURE__ */ u("label", {
7
8
  class: "absolute w-full h-full opacity-0 cursor-text",
8
9
  for: "requestname"
9
- }, null, -1), P = { class: "flex" }, A = { class: "flex flex-1 gap-2 max-h-8" }, Y = /* @__PURE__ */ y({
10
+ }, null, -1), te = { class: "flex" }, le = { class: "flex flex-1 gap-2 max-h-8" }, re = /* @__PURE__ */ T({
10
11
  __name: "CommandPaletteRequest",
11
12
  emits: ["close"],
12
- setup(H, { emit: b }) {
13
- const _ = b, { push: q } = j(), {
14
- activeCollection: c,
15
- activeWorkspace: w,
16
- activeWorkspaceCollections: g,
17
- requestMutators: C,
18
- folders: M
19
- } = W(), s = n(""), i = n("GET"), m = n(""), f = h(
20
- () => g.value.flatMap(
21
- (e) => e.childUids.flatMap((l) => {
22
- const t = M[l];
23
- return t ? [
13
+ setup(ae, { emit: E }) {
14
+ var g, q;
15
+ const I = E, { push: B } = X(), {
16
+ activeCollection: D,
17
+ activeWorkspace: j,
18
+ activeWorkspaceCollections: x,
19
+ requestMutators: z,
20
+ activeRequest: F,
21
+ folders: b
22
+ } = Q(), i = d(""), m = d("GET"), c = d(((g = D.value) == null ? void 0 : g.uid) ?? ""), w = v(
23
+ () => x.value.map((e) => {
24
+ var t;
25
+ return {
26
+ id: e.uid,
27
+ label: ((t = e.spec.info) == null ? void 0 : t.title) ?? "Unititled Collection"
28
+ };
29
+ })
30
+ ), n = v({
31
+ get: () => w.value.find(({ id: e }) => e === c.value),
32
+ set: (e) => {
33
+ e != null && e.id && (c.value = e.id);
34
+ }
35
+ }), f = v(
36
+ () => x.value.flatMap(
37
+ (e) => e.uid === c.value ? e.childUids.flatMap((t) => {
38
+ const l = b[t];
39
+ return l ? [
24
40
  {
25
- id: t.uid,
26
- label: t.name
41
+ id: l.uid,
42
+ label: l.name
27
43
  }
28
44
  ] : [];
29
- })
45
+ }) : []
30
46
  )
31
- ), a = h({
32
- get: () => f.value.find(({ id: e }) => e === m.value),
47
+ ), _ = d(
48
+ ((q = Object.values(b).find(
49
+ (e) => {
50
+ var t;
51
+ return e.childUids.includes((t = F.value) == null ? void 0 : t.uid);
52
+ }
53
+ )) == null ? void 0 : q.uid) ?? ""
54
+ ), a = v({
55
+ get: () => f.value.find(({ id: e }) => e === _.value),
33
56
  set: (e) => {
34
- e != null && e.id && (m.value = e.id);
57
+ e != null && e.id && (_.value = e.id);
35
58
  }
36
59
  });
37
- function S(e) {
38
- i.value = e;
60
+ function L(e) {
61
+ m.value = e;
39
62
  }
40
- const k = () => {
41
- var t, v;
42
- if (!c.value) return;
43
- const e = ((t = a.value) == null ? void 0 : t.id) ?? ((v = c.value) == null ? void 0 : v.uid), l = C.add(
63
+ const p = () => {
64
+ var l, k, y;
65
+ if (!c.value && !((l = a.value) != null && l.id)) return;
66
+ const e = ((k = a.value) == null ? void 0 : k.id) ?? ((y = n.value) == null ? void 0 : y.id), t = z.add(
44
67
  {
45
68
  path: "",
46
- method: i.value.toUpperCase(),
47
- description: s.value,
48
- operationId: s.value,
49
- summary: s.value,
69
+ method: m.value.toUpperCase(),
70
+ description: i.value,
71
+ operationId: i.value,
72
+ summary: i.value,
50
73
  tags: ["default"]
51
74
  },
52
75
  e
53
76
  );
54
- q(`/workspace/${w.value.uid}/request/${l.uid}`), _("close");
55
- }, p = n(null);
56
- return V(() => {
77
+ B(`/workspace/${j.value.uid}/request/${t.uid}`), I("close");
78
+ }, C = d(null);
79
+ return W(() => {
57
80
  var e;
58
- (e = p.value) == null || e.focus();
59
- }), (e, l) => (N(), R("form", {
60
- class: "flex w-full flex-col gap-3",
61
- onSubmit: I(k, ["prevent"])
62
- }, [
63
- o("div", G, [
64
- L,
65
- U(o("input", {
81
+ (e = C.value) == null || e.focus(), window.addEventListener(
82
+ "keydown",
83
+ (t) => R(t, p),
84
+ !0
85
+ );
86
+ }), $(() => {
87
+ window.removeEventListener(
88
+ "keydown",
89
+ (e) => R(e, p),
90
+ !0
91
+ );
92
+ }), (e, t) => (V(), G("div", Y, [
93
+ u("div", Z, [
94
+ ee,
95
+ K(u("input", {
66
96
  id: "requestname",
67
97
  ref_key: "requestInput",
68
- ref: p,
69
- "onUpdate:modelValue": l[0] || (l[0] = (t) => s.value = t),
98
+ ref: C,
99
+ "onUpdate:modelValue": t[0] || (t[0] = (l) => i.value = l),
70
100
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
71
101
  label: "Request Name",
72
102
  placeholder: "Request Name"
73
103
  }, null, 512), [
74
- [E, s.value]
104
+ [O, i.value]
75
105
  ])
76
106
  ]),
77
- o("div", P, [
78
- o("div", A, [
79
- u(T, {
107
+ u("div", te, [
108
+ u("div", le, [
109
+ o(J, {
80
110
  isEditable: !0,
81
111
  isSquare: "",
82
- method: i.value,
83
- onChange: S
112
+ method: m.value,
113
+ onChange: L
84
114
  }, null, 8, ["method"]),
85
- u(r($), {
115
+ o(s(M), {
116
+ modelValue: n.value,
117
+ "onUpdate:modelValue": t[1] || (t[1] = (l) => n.value = l),
118
+ options: w.value
119
+ }, {
120
+ default: r(() => [
121
+ o(s(h), {
122
+ class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
123
+ variant: "outlined"
124
+ }, {
125
+ default: r(() => [
126
+ u("span", {
127
+ class: U(n.value ? "text-c-1" : "text-c-3")
128
+ }, S(n.value ? n.value.label : "Select Collection"), 3),
129
+ o(s(N), {
130
+ class: "text-c-3",
131
+ icon: "ChevronDown",
132
+ size: "xs"
133
+ })
134
+ ]),
135
+ _: 1
136
+ })
137
+ ]),
138
+ _: 1
139
+ }, 8, ["modelValue", "options"]),
140
+ f.value.length ? (V(), P(s(M), {
141
+ key: 0,
86
142
  modelValue: a.value,
87
- "onUpdate:modelValue": l[1] || (l[1] = (t) => a.value = t),
143
+ "onUpdate:modelValue": t[2] || (t[2] = (l) => a.value = l),
88
144
  options: f.value
89
145
  }, {
90
- default: d(() => [
91
- u(r(x), {
146
+ default: r(() => [
147
+ o(s(h), {
92
148
  class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
93
149
  variant: "outlined"
94
150
  }, {
95
- default: d(() => [
96
- o("span", {
97
- class: B(a.value ? "text-c-1" : "text-c-3")
98
- }, D(a.value ? a.value.label : "Select Folder"), 3),
99
- u(r(z), {
151
+ default: r(() => [
152
+ u("span", {
153
+ class: U(a.value ? "text-c-1" : "text-c-3")
154
+ }, S(a.value ? a.value.label : "Select Folder"), 3),
155
+ o(s(N), {
100
156
  class: "text-c-3",
101
157
  icon: "ChevronDown",
102
158
  size: "xs"
@@ -106,21 +162,21 @@ const G = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
106
162
  })
107
163
  ]),
108
164
  _: 1
109
- }, 8, ["modelValue", "options"])
165
+ }, 8, ["modelValue", "options"])) : A("", !0)
110
166
  ]),
111
- u(r(x), {
167
+ o(s(h), {
112
168
  class: "max-h-8 text-xs p-0 px-3",
113
- type: "submit"
169
+ onClick: p
114
170
  }, {
115
- default: d(() => [
116
- F(" Create Request ")
171
+ default: r(() => [
172
+ H(" Create Request ")
117
173
  ]),
118
174
  _: 1
119
175
  })
120
176
  ])
121
- ], 32));
177
+ ]));
122
178
  }
123
179
  });
124
180
  export {
125
- Y as default
181
+ re as default
126
182
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteWorkspace.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteWorkspace.vue"],"names":[],"mappings":";;;;;AAsLA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteWorkspace.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteWorkspace.vue"],"names":[],"mappings":";;;;;AAgOA,wBAMG"}
@@ -1,55 +1,63 @@
1
- import { defineComponent as m, ref as l, onMounted as d, openBlock as f, createElementBlock as h, withModifiers as w, createElementVNode as o, withDirectives as x, vModelText as _, createVNode as k, unref as b, withCtx as v, createTextVNode as N } from "vue";
1
+ import { defineComponent as m, ref as l, onMounted as f, onBeforeUnmount as w, openBlock as h, createElementBlock as k, createElementVNode as o, withDirectives as _, vModelText as x, createVNode as v, unref as b, withCtx as y, createTextVNode as N } from "vue";
2
2
  import { useWorkspace as g } from "../../store/workspace.js";
3
- import { ScalarButton as y } from "@scalar/components";
4
- import { useRouter as C } from "vue-router";
5
- const M = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, V = /* @__PURE__ */ o("label", {
3
+ import { ScalarButton as C } from "@scalar/components";
4
+ import { useRouter as B } from "vue-router";
5
+ import { handleKeyDown as r } from "./handleKeyDown.js";
6
+ const E = { class: "flex w-full flex-col gap-3" }, V = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, W = /* @__PURE__ */ o("label", {
6
7
  class: "absolute w-full h-full opacity-0 cursor-text",
7
8
  for: "workspacename"
8
- }, null, -1), W = { class: "flex" }, B = /* @__PURE__ */ o("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), P = /* @__PURE__ */ m({
9
+ }, null, -1), M = { class: "flex" }, D = /* @__PURE__ */ o("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), P = /* @__PURE__ */ m({
9
10
  __name: "CommandPaletteWorkspace",
10
11
  emits: ["close"],
11
- setup(S, { emit: n }) {
12
- const r = n, { push: c } = C(), { workspaceMutators: u } = g(), t = l(""), i = () => {
13
- const e = u.add({
14
- name: t.value
12
+ setup(I, { emit: c }) {
13
+ const u = c, { push: i } = B(), { workspaceMutators: d } = g(), s = l(""), n = () => {
14
+ const e = d.add({
15
+ name: s.value
15
16
  });
16
- c(`/workspace/${e.uid}`), r("close");
17
- }, s = l(null);
18
- return d(() => {
17
+ i(`/workspace/${e.uid}`), u("close");
18
+ }, a = l(null);
19
+ return f(() => {
19
20
  var e;
20
- (e = s.value) == null || e.focus();
21
- }), (e, a) => (f(), h("form", {
22
- class: "flex w-full flex-col gap-3",
23
- onSubmit: w(i, ["prevent"])
24
- }, [
25
- o("div", M, [
26
- V,
27
- x(o("input", {
21
+ (e = a.value) == null || e.focus(), window.addEventListener(
22
+ "keydown",
23
+ (t) => r(t, n),
24
+ !0
25
+ );
26
+ }), w(() => {
27
+ window.removeEventListener(
28
+ "keydown",
29
+ (e) => r(e, n),
30
+ !0
31
+ );
32
+ }), (e, t) => (h(), k("div", E, [
33
+ o("div", V, [
34
+ W,
35
+ _(o("input", {
28
36
  id: "workspacename",
29
37
  ref_key: "workspaceInput",
30
- ref: s,
31
- "onUpdate:modelValue": a[0] || (a[0] = (p) => t.value = p),
38
+ ref: a,
39
+ "onUpdate:modelValue": t[0] || (t[0] = (p) => s.value = p),
32
40
  autofocus: "",
33
41
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
34
42
  label: "Workspace Name",
35
43
  placeholder: "Workspace Name"
36
44
  }, null, 512), [
37
- [_, t.value]
45
+ [x, s.value]
38
46
  ])
39
47
  ]),
40
- o("div", W, [
41
- B,
42
- k(b(y), {
48
+ o("div", M, [
49
+ D,
50
+ v(b(C), {
43
51
  class: "max-h-8 text-xs p-0 px-3",
44
- type: "submit"
52
+ onClick: n
45
53
  }, {
46
- default: v(() => [
54
+ default: y(() => [
47
55
  N(" Continue ")
48
56
  ]),
49
57
  _: 1
50
58
  })
51
59
  ])
52
- ], 32));
60
+ ]));
53
61
  }
54
62
  });
55
63
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AAqWA;;;;GAIG;;AACH,wBAgYI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOpB,CAAA;AAEV,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CACxD"}
1
+ {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AAkYA;;;;GAIG;;AACH,wBA2ZI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOpB,CAAA;AAEV,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CACxD"}
@@ -1,9 +1,9 @@
1
1
  import o from "./TheCommandPalette.vue2.js";
2
- import { PaletteComponents as f } from "./TheCommandPalette.vue2.js";
2
+ import { PaletteComponents as s } from "./TheCommandPalette.vue2.js";
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-caaeb4c4"]]);
5
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-84799061"]]);
6
6
  export {
7
- f as PaletteComponents,
8
- r as default
7
+ s as PaletteComponents,
8
+ a as default
9
9
  };
@@ -1,27 +1,28 @@
1
- import { defineComponent as z, ref as d, computed as I, onMounted as M, onBeforeUnmount as P, openBlock as r, createElementBlock as s, Fragment as u, withDirectives as h, createElementVNode as m, vShow as A, unref as v, createVNode as $, vModelText as F, renderList as R, toDisplayString as E, normalizeClass as q, createTextVNode as N, createBlock as T, resolveDynamicComponent as U } from "vue";
2
- import { useModal as G, ScalarIcon as S } from "@scalar/components";
3
- import { useMagicKeys as H, whenever as C } from "@vueuse/core";
4
- import { useRouter as K } from "vue-router";
5
- import { commandPaletteBus as B } from "../../libs/eventBusses/command-palette.js";
6
- import { useWorkspace as Q } from "../../store/workspace.js";
7
- import j from "./CommandPaletteCollection.vue.js";
8
- import J from "./CommandPaletteExample.vue.js";
9
- import O from "./CommandPaletteFolder.vue.js";
10
- import X from "./CommandPaletteImport.vue.js";
11
- import Y from "./CommandPaletteRequest.vue.js";
12
- import Z from "./CommandPaletteWorkspace.vue.js";
13
- const ee = { class: "commandmenu" }, oe = { class: "bg-b-2 flex items-center rounded mb-2 pl-2 focus-within:bg-b-1 focus-within:shadow-border" }, te = { for: "commandmenu" }, ne = ["onClick"], ae = {
1
+ import { defineComponent as K, ref as u, computed as F, onMounted as q, onBeforeUnmount as I, openBlock as l, createElementBlock as m, Fragment as d, withDirectives as h, createElementVNode as c, vShow as L, unref as p, createVNode as S, vModelText as N, renderList as B, toDisplayString as M, normalizeClass as T, createTextVNode as U, createBlock as G, resolveDynamicComponent as H } from "vue";
2
+ import { useModal as O, ScalarIcon as A } from "@scalar/components";
3
+ import { useMagicKeys as Q, whenever as k } from "@vueuse/core";
4
+ import { useRouter as j } from "vue-router";
5
+ import { isMacOS as J } from "@scalar/use-tooltip";
6
+ import { commandPaletteBus as P } from "../../libs/eventBusses/command-palette.js";
7
+ import { useWorkspace as X } from "../../store/workspace.js";
8
+ import Y from "./CommandPaletteCollection.vue.js";
9
+ import Z from "./CommandPaletteExample.vue.js";
10
+ import ee from "./CommandPaletteFolder.vue.js";
11
+ import oe from "./CommandPaletteImport.vue.js";
12
+ import te from "./CommandPaletteRequest.vue.js";
13
+ import ne from "./CommandPaletteWorkspace.vue.js";
14
+ const ae = { class: "commandmenu" }, re = { class: "bg-b-2 flex items-center rounded mb-2 pl-2 focus-within:bg-b-1 focus-within:shadow-border" }, le = { for: "commandmenu" }, se = ["onClick"], me = {
14
15
  name: "TheCommandPalette"
15
- }, le = {
16
- "Import Collection": X,
17
- "Create Request": Y,
18
- "Create Workspace": Z,
19
- "Add Folder": O,
20
- "Create Collection": j,
21
- "Add Example": J
22
- }, ke = /* @__PURE__ */ z({
23
- ...ae,
24
- setup(re) {
16
+ }, ce = {
17
+ "Import Collection": oe,
18
+ "Create Request": te,
19
+ "Create Workspace": ne,
20
+ "Add Folder": ee,
21
+ "Create Collection": Y,
22
+ "Add Example": Z
23
+ }, Ee = /* @__PURE__ */ K({
24
+ ...me,
25
+ setup(ie) {
25
26
  const b = [
26
27
  {
27
28
  label: "Add to Request Sidebar",
@@ -72,127 +73,138 @@ const ee = { class: "commandmenu" }, oe = { class: "bg-b-2 flex items-center rou
72
73
  }
73
74
  ]
74
75
  }
75
- ], p = H(), a = G(), { push: V } = K(), { activeWorkspace: W } = Q(), g = d(), c = d(""), i = d(null), o = d(0), k = d([]), _ = I(
76
- () => b.reduce((e, t) => {
77
- const n = t.commands.filter(
78
- (f) => f.name.toLowerCase().includes(c.value.toLowerCase())
76
+ ], f = Q(), a = O(), { push: V } = j(), { activeWorkspace: W } = X(), $ = u(), i = u(""), s = u(null), t = u(0), w = u([]), _ = F(
77
+ () => b.reduce((e, n) => {
78
+ const o = n.commands.filter(
79
+ (C) => C.name.toLowerCase().includes(i.value.toLowerCase())
79
80
  );
80
- return [...e, ...n];
81
+ return [...e, ...o];
81
82
  }, [])
82
- ), w = () => {
83
- a.hide(), c.value = "", i.value = null;
83
+ ), v = () => {
84
+ a.hide(), i.value = "", s.value = null, window.removeEventListener("keydown", y, !0);
84
85
  };
85
- C(p.escape, () => {
86
- a.open && a.hide();
87
- }), C(p.enter, () => {
86
+ k(f.escape, () => {
87
+ a.open && v();
88
+ }), k(f.enter, () => {
88
89
  if (!a.open) return;
89
- const e = _.value[o.value];
90
- L(e);
91
- }), C(p.ArrowDown, () => {
90
+ const e = _.value[t.value];
91
+ g(e);
92
+ }), k(f.ArrowDown, () => {
92
93
  var e;
93
- a.open && (o.value < _.value.length - 1 ? o.value++ : o.value = 0, (e = k.value[o.value]) == null || e.scrollIntoView({
94
+ a.open && (t.value < _.value.length - 1 ? t.value++ : t.value = 0, (e = w.value[t.value]) == null || e.scrollIntoView({
94
95
  behavior: "smooth",
95
96
  block: "center"
96
97
  }));
97
- }), C(p.ArrowUp, () => {
98
+ }), k(f.ArrowUp, () => {
98
99
  var e;
99
- a.open && (o.value > 0 ? o.value-- : o.value = _.value.length - 1, (e = k.value[o.value]) == null || e.scrollIntoView({
100
+ a.open && (t.value > 0 ? t.value-- : t.value = _.value.length - 1, (e = w.value[t.value]) == null || e.scrollIntoView({
100
101
  behavior: "smooth",
101
102
  block: "center"
102
103
  }));
103
104
  });
104
- const L = (e) => {
105
- "path" in e ? (V(`/workspace/${W.value.uid}${e.path}`), w()) : i.value = e.name;
106
- }, D = ({
105
+ const g = (e) => {
106
+ "path" in e ? (V(`/workspace/${W.value.uid}${e.path}`), v()) : s.value = e.name;
107
+ }, D = u(), R = ({
107
108
  commandName: e,
108
- metaData: t
109
+ metaData: n
109
110
  } = {}) => {
110
- i.value = e ?? null, g.value = t, a.show();
111
+ var o;
112
+ s.value = e ?? null, $.value = n, a.show(), (o = D.value) == null || o.focus(), window.addEventListener("keydown", y, !0);
111
113
  };
112
- return M(() => B.on(D)), P(() => B.off(D)), (e, t) => (r(), s(u, null, [
113
- h(m("div", {
114
+ q(() => P.on(R)), I(() => P.off(R));
115
+ const z = (e) => J() ? e.metaKey && e.key === "Enter" : e.ctrlKey && e.key === "Enter", y = (e) => {
116
+ z(e) && !s.value && (e.stopPropagation(), e.preventDefault());
117
+ };
118
+ return I(() => {
119
+ window.removeEventListener("keydown", y, !0);
120
+ }), (e, n) => (l(), m(d, null, [
121
+ h(c("div", {
114
122
  class: "commandmenu-clickout",
115
- onClick: t[0] || (t[0] = (n) => w())
123
+ onClick: n[0] || (n[0] = (o) => v())
116
124
  }, null, 512), [
117
- [A, v(a).open]
125
+ [L, p(a).open]
118
126
  ]),
119
- h(m("div", ee, [
120
- i.value ? (r(), s(u, { key: 1 }, [
121
- m("button", {
127
+ h(c("div", ae, [
128
+ s.value ? (l(), m(d, { key: 1 }, [
129
+ c("button", {
122
130
  class: "absolute p-1 hover:bg-b-3 rounded text-c-3 active:text-c-1 m-1.5 z-10",
123
131
  type: "button",
124
- onClick: t[2] || (t[2] = (n) => i.value = null)
132
+ onClick: n[2] || (n[2] = (o) => s.value = null)
125
133
  }, [
126
- $(v(S), {
134
+ S(p(A), {
127
135
  icon: "ChevronLeft",
128
136
  size: "sm"
129
137
  })
130
138
  ]),
131
- (r(), T(U(le[i.value]), {
132
- metaData: g.value,
133
- onClose: w
139
+ (l(), G(H(ce[s.value]), {
140
+ metaData: $.value,
141
+ onClose: v
134
142
  }, null, 40, ["metaData"]))
135
- ], 64)) : (r(), s(u, { key: 0 }, [
136
- m("div", oe, [
137
- m("label", te, [
138
- $(v(S), {
143
+ ], 64)) : (l(), m(d, { key: 0 }, [
144
+ c("div", re, [
145
+ c("label", le, [
146
+ S(p(A), {
139
147
  class: "text-c-1 mr-2.5",
140
148
  icon: "Search",
141
149
  size: "sm",
142
150
  thickness: "1.5"
143
151
  })
144
152
  ]),
145
- h(m("input", {
153
+ h(c("input", {
146
154
  id: "commandmenu",
147
- "onUpdate:modelValue": t[1] || (t[1] = (n) => c.value = n),
155
+ ref_key: "commandInputRef",
156
+ ref: D,
157
+ "onUpdate:modelValue": n[1] || (n[1] = (o) => i.value = o),
158
+ autocomplete: "off",
159
+ autofocus: "",
148
160
  class: "w-full rounded bg-none border-none py-1.5 text-sm focus:outline-none",
149
161
  placeholder: "Search commands...",
150
162
  type: "text"
151
163
  }, null, 512), [
152
- [F, c.value]
164
+ [N, i.value]
153
165
  ])
154
166
  ]),
155
- (r(), s(u, null, R(b, (n, f) => (r(), s(u, {
156
- key: n.label
167
+ (l(), m(d, null, B(b, (o, C) => (l(), m(d, {
168
+ key: o.label
157
169
  }, [
158
- h(m("div", { class: "text-c-3 font-medium text-xs mt-2" }, E(n.label), 513), [
170
+ h(c("div", { class: "text-c-3 font-medium text-xs mt-2" }, M(o.label), 513), [
159
171
  [
160
- A,
161
- n.commands.filter(
162
- (l) => l.name.toLowerCase().includes(c.value.toLowerCase())
172
+ L,
173
+ o.commands.filter(
174
+ (r) => r.name.toLowerCase().includes(i.value.toLowerCase())
163
175
  ).length > 0
164
176
  ]
165
177
  ]),
166
- (r(!0), s(u, null, R(n.commands.filter(
167
- (l) => l.name.toLowerCase().includes(c.value.toLowerCase())
168
- ), (l, x) => (r(), s("div", {
169
- key: l.name,
178
+ (l(!0), m(d, null, B(o.commands.filter(
179
+ (r) => r.name.toLowerCase().includes(i.value.toLowerCase())
180
+ ), (r, x) => (l(), m("div", {
181
+ key: r.name,
170
182
  ref_for: !0,
171
- ref: (y) => {
172
- y && (k.value[x] = y);
183
+ ref: (E) => {
184
+ E && (w.value[x] = E);
173
185
  },
174
- class: q(["commandmenu-item text-sm flex items-center py-1.5 px-2 rounded hover:bg-b-2 cursor-pointer", {
175
- "bg-b-2": f > 0 ? o.value === x + b[f - 1].commands.length : o.value === x
186
+ class: T(["commandmenu-item text-sm flex items-center py-1.5 px-2 rounded hover:bg-b-2 cursor-pointer", {
187
+ "bg-b-2": C > 0 ? t.value === x + b[C - 1].commands.length : t.value === x
176
188
  }]),
177
- onClick: (y) => L(l)
189
+ onClick: (E) => g(r)
178
190
  }, [
179
- $(v(S), {
191
+ S(p(A), {
180
192
  class: "text-c-1 mr-2.5",
181
- icon: l.icon,
193
+ icon: r.icon,
182
194
  size: "md",
183
195
  thickness: "1.5"
184
196
  }, null, 8, ["icon"]),
185
- N(" " + E(l.name), 1)
186
- ], 10, ne))), 128))
197
+ U(" " + M(r.name), 1)
198
+ ], 10, se))), 128))
187
199
  ], 64))), 64))
188
200
  ], 64))
189
201
  ], 512), [
190
- [A, v(a).open]
202
+ [L, p(a).open]
191
203
  ])
192
204
  ], 64));
193
205
  }
194
206
  });
195
207
  export {
196
- le as PaletteComponents,
197
- ke as default
208
+ ce as PaletteComponents,
209
+ Ee as default
198
210
  };
@@ -0,0 +1,2 @@
1
+ export declare const handleKeyDown: (event: KeyboardEvent, handleSubmit: () => void) => void;
2
+ //# sourceMappingURL=handleKeyDown.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handleKeyDown.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/handleKeyDown.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,UACjB,aAAa,gBACN,MAAM,IAAI,SAOzB,CAAA"}