@scalar/api-client 2.0.57 → 2.0.58

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 (57) hide show
  1. package/CHANGELOG.md +18 -0
  2. package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBar.vue.js +2 -2
  4. package/dist/components/AddressBar/AddressBar.vue2.js +61 -58
  5. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  6. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +31 -25
  7. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  8. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +51 -45
  9. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
  10. package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +47 -41
  11. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  12. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +56 -40
  13. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  14. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +67 -61
  15. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  16. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +30 -30
  17. package/dist/components/TopNav/TopNav.vue.d.ts +20 -1
  18. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  19. package/dist/components/TopNav/TopNav.vue.js +2 -2
  20. package/dist/components/TopNav/TopNav.vue2.js +64 -49
  21. package/dist/layouts/App/ApiClientApp.vue.d.ts +11 -1
  22. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  23. package/dist/layouts/App/ApiClientApp.vue.js +53 -49
  24. package/dist/libs/event-busses/cancel-request-bus.d.ts +2 -0
  25. package/dist/libs/event-busses/cancel-request-bus.d.ts.map +1 -0
  26. package/dist/libs/event-busses/cancel-request-bus.js +5 -0
  27. package/dist/libs/event-busses/hot-keys-bus.d.ts +3 -1
  28. package/dist/libs/event-busses/hot-keys-bus.d.ts.map +1 -1
  29. package/dist/libs/event-busses/hot-keys-bus.js +1 -0
  30. package/dist/libs/event-busses/index.d.ts +2 -1
  31. package/dist/libs/event-busses/index.d.ts.map +1 -1
  32. package/dist/libs/event-busses/index.js +11 -8
  33. package/dist/libs/index.js +21 -18
  34. package/dist/libs/local-storage.js +1 -1
  35. package/dist/libs/sendRequest.d.ts +2 -2
  36. package/dist/libs/sendRequest.d.ts.map +1 -1
  37. package/dist/libs/sendRequest.js +22 -21
  38. package/dist/store/workspace.d.ts.map +1 -1
  39. package/dist/store/workspace.js +100 -103
  40. package/dist/style.css +1 -1
  41. package/dist/views/Request/Request.vue.d.ts +11 -1
  42. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  43. package/dist/views/Request/Request.vue.js +3 -3
  44. package/dist/views/Request/Request.vue2.js +184 -174
  45. package/dist/views/Request/RequestSidebarItem.vue.d.ts +2 -0
  46. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  47. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  48. package/dist/views/Request/RequestSidebarItem.vue2.js +139 -130
  49. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.d.ts +3 -0
  50. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.d.ts.map +1 -0
  51. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +7 -0
  52. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +39 -0
  53. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.d.ts.map +1 -1
  54. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +37 -30
  55. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
  56. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +23 -21
  57. package/package.json +7 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.0.58
4
+
5
+ ### Patch Changes
6
+
7
+ - 1c3de0e: fix(api-client): correctly initialize complex auth, fixes #2874
8
+ - 857380d: fix: command palette import collection
9
+ - ab8c4d7: feat: meta clik link request to topnav
10
+ - 8d615dc: fix: request sidebar item new tab event modifier
11
+ - 9bc0ae7: feat: command palette input required on submit
12
+ - 8f24069: feat(api-client): add loading state and cancellation for slow requests
13
+ - Updated dependencies [9bc0ae7]
14
+ - Updated dependencies [a792002]
15
+ - Updated dependencies [bb13304]
16
+ - @scalar/components@0.12.39
17
+ - @scalar/themes@0.9.27
18
+ - @scalar/oas-utils@0.2.38
19
+ - @scalar/types@0.0.4
20
+
3
21
  ## 2.0.57
4
22
 
5
23
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";AAqtBA,wBAKG"}
1
+ {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";AAutBA,wBAKG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AddressBar.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../_virtual/_plugin-vue_export-helper.js";
4
- const a = /* @__PURE__ */ r(o, [["__scopeId", "data-v-28ee5506"]]);
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-0989c8b5"]]);
5
5
  export {
6
- a as default
6
+ m as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as L, ref as n, watch as O, onMounted as $, onBeforeUnmount as K, unref as l, openBlock as N, createElementBlock as T, createElementVNode as a, createVNode as i, withCtx as y, normalizeClass as B, normalizeStyle as A, createCommentVNode as D, pushScopeId as Q, popScopeId as W } from "vue";
1
+ import { defineComponent as L, ref as n, watch as O, onMounted as K, onBeforeUnmount as N, unref as l, openBlock as T, createElementBlock as A, createElementVNode as o, createVNode as u, withCtx as y, normalizeClass as B, normalizeStyle as $, createCommentVNode as D, pushScopeId as Q, popScopeId as W } from "vue";
2
2
  import j from "../CodeInput/CodeInput.vue.js";
3
3
  import { useWorkspace as F } from "../../store/workspace.js";
4
4
  import { Listbox as G } from "@headlessui/vue";
@@ -8,29 +8,29 @@ import { isMacOS as Y } from "@scalar/use-tooltip";
8
8
  import { useMagicKeys as Z, whenever as ee } from "@vueuse/core";
9
9
  import te from "../HttpMethod/HttpMethod.vue.js";
10
10
  import le from "./AddressBarHistory.vue.js";
11
- import { executeRequestBus as m } from "../../libs/event-busses/execute-request-bus.js";
11
+ import { executeRequestBus as k } from "../../libs/event-busses/execute-request-bus.js";
12
12
  import { requestStatusBus as oe } from "../../libs/event-busses/request-status-bus.js";
13
- import { hotKeyBus as k } from "../../libs/event-busses/hot-keys-bus.js";
14
- const v = (f) => (Q("data-v-28ee5506"), f = f(), W(), f), ae = {
13
+ import { hotKeyBus as E } from "../../libs/event-busses/hot-keys-bus.js";
14
+ const m = (c) => (Q("data-v-0989c8b5"), c = c(), W(), c), ae = {
15
15
  key: 0,
16
16
  class: "order-last lg:order-none lg:w-auto w-full"
17
- }, re = { class: "m-auto flex basis-1/2 flex-row items-center" }, se = { class: "pointer-events-none absolute left-0 top-0 z-10 block h-full w-full overflow-hidden" }, ne = { class: "flex gap-1" }, ie = { class: "codemirror-bg-switcher scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" }, ue = /* @__PURE__ */ v(() => /* @__PURE__ */ a("div", { class: "fade-left" }, null, -1)), de = /* @__PURE__ */ v(() => /* @__PURE__ */ a("div", { class: "fade-right" }, null, -1)), fe = /* @__PURE__ */ v(() => /* @__PURE__ */ a("span", { class: "text-xxs relative z-10 lg:flex hidden" }, "Send", -1)), Ee = /* @__PURE__ */ L({
17
+ }, re = { class: "m-auto flex basis-1/2 flex-row items-center" }, se = { class: "pointer-events-none absolute left-0 top-0 z-10 block h-full w-full overflow-hidden" }, ne = { class: "flex gap-1" }, ue = { class: "codemirror-bg-switcher scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" }, ie = /* @__PURE__ */ m(() => /* @__PURE__ */ o("div", { class: "fade-left" }, null, -1)), de = /* @__PURE__ */ m(() => /* @__PURE__ */ o("div", { class: "fade-right" }, null, -1)), ce = /* @__PURE__ */ m(() => /* @__PURE__ */ o("span", { class: "text-xxs relative z-10 lg:flex hidden" }, "Send", -1)), Se = /* @__PURE__ */ L({
18
18
  __name: "AddressBar",
19
- setup(f) {
19
+ setup(c) {
20
20
  const {
21
21
  activeRequest: t,
22
- activeExample: c,
23
- isReadOnly: p,
24
- requestMutators: h,
22
+ activeExample: f,
23
+ isReadOnly: v,
24
+ requestMutators: p,
25
25
  requestExampleMutators: S,
26
- requestsHistory: E
27
- } = F(), x = n(E.value[0]), b = n(null), g = Z();
26
+ requestsHistory: q
27
+ } = F(), h = n(q.value[0]), x = n(null), _ = Z();
28
28
  ee(
29
- Y() ? g.meta_enter : g.ctrl_enter,
30
- () => m.emit()
29
+ Y() ? _.meta_enter : _.ctrl_enter,
30
+ () => k.emit()
31
31
  );
32
32
  const C = (e) => {
33
- !t.value || t.value.path === e || h.edit(t.value.uid, "path", e);
33
+ !t.value || t.value.path === e || p.edit(t.value.uid, "path", e);
34
34
  };
35
35
  O(
36
36
  () => {
@@ -41,95 +41,98 @@ const v = (f) => (Q("data-v-28ee5506"), f = f(), W(), f), ae = {
41
41
  t.value && C(e);
42
42
  }
43
43
  );
44
- const r = n(100), _ = n(0), s = n(!1), u = n();
45
- function q() {
46
- s.value ? r.value -= (r.value - 15) / 60 : r.value -= _.value / 20, r.value <= 0 && (clearInterval(u.value), u.value = void 0, r.value = 100, s.value = !1);
47
- }
44
+ const a = n(100), b = n(0), r = n(!1), s = n();
48
45
  function R() {
49
- s.value || (s.value = !0, u.value = setInterval(q, 20));
46
+ r.value ? a.value -= (a.value - 15) / 60 : a.value -= b.value / 20, a.value <= 0 && (clearInterval(s.value), s.value = void 0, a.value = 100, r.value = !1);
50
47
  }
51
48
  function I() {
52
- _.value = r.value, s.value = !1;
49
+ s.value || (r.value = !0, s.value = setInterval(R, 20));
53
50
  }
54
51
  function V() {
55
- clearInterval(u.value), u.value = void 0, r.value = 100, s.value = !1;
52
+ b.value = a.value, r.value = !1;
53
+ }
54
+ function M() {
55
+ clearInterval(s.value), s.value = void 0, a.value = 100, r.value = !1;
56
56
  }
57
57
  oe.on((e) => {
58
- e === "start" && R(), e === "stop" && I(), e === "abort" && V();
58
+ e === "start" && I(), e === "stop" && V(), e === "abort" && M();
59
59
  });
60
- function M(e) {
61
- t.value && h.edit(t.value.uid, "method", e);
60
+ function z(e) {
61
+ t.value && p.edit(t.value.uid, "method", e);
62
62
  }
63
- function z() {
63
+ function U() {
64
64
  if (!t.value) return;
65
65
  const { method: e } = t.value;
66
66
  return X[e].backgroundColor;
67
67
  }
68
- const U = (e) => {
69
- c.value && S.edit(c.value.uid, "url", e);
68
+ function g() {
69
+ r.value || (r.value = !0, k.emit());
70
+ }
71
+ const H = (e) => {
72
+ S.edit(f.value.uid, "url", e);
70
73
  }, w = (e) => {
71
- var o;
72
- e.focusAddressBar && ((o = b.value) == null || o.focus());
74
+ var i;
75
+ e.focusAddressBar && ((i = x.value) == null || i.focus());
73
76
  };
74
- return $(() => k.on(w)), K(() => k.off(w)), (e, o) => l(t) && l(c) ? (N(), T("div", ae, [
75
- a("div", re, [
76
- i(l(G), {
77
- modelValue: x.value,
78
- "onUpdate:modelValue": o[2] || (o[2] = (d) => x.value = d)
77
+ return K(() => E.on(w)), N(() => E.off(w)), (e, i) => l(t) && l(f) ? (T(), A("div", ae, [
78
+ o("div", re, [
79
+ u(l(G), {
80
+ modelValue: h.value,
81
+ "onUpdate:modelValue": i[0] || (i[0] = (d) => h.value = d)
79
82
  }, {
80
83
  default: y(({ open: d }) => [
81
- a("div", {
84
+ o("div", {
82
85
  class: B([
83
86
  "addressbar-bg-states text-xxs relative flex w-full lg:min-w-[720px] lg:max-w-[720px] order-last lg:order-none flex-1 flex-row items-stretch rounded-lg border-1/2 p-[3px]",
84
87
  { "rounded-b-none": d },
85
88
  { "border-transparent": d }
86
89
  ])
87
90
  }, [
88
- a("div", se, [
89
- a("div", {
90
- class: B(["bg-mix-transparent bg-mix-amount-90 absolute left-0 top-0 h-full w-full", z()]),
91
- style: A({ transform: `translate3d(-${r.value}%,0,0)` })
91
+ o("div", se, [
92
+ o("div", {
93
+ class: B(["bg-mix-transparent bg-mix-amount-90 absolute left-0 top-0 h-full w-full", U()]),
94
+ style: $({ transform: `translate3d(-${a.value}%,0,0)` })
92
95
  }, null, 6)
93
96
  ]),
94
- a("div", ne, [
95
- i(te, {
96
- isEditable: !l(p),
97
+ o("div", ne, [
98
+ u(te, {
99
+ isEditable: !l(v),
97
100
  isSquare: "",
98
101
  method: l(t).method,
99
- onChange: M
102
+ onChange: z
100
103
  }, null, 8, ["isEditable", "method"])
101
104
  ]),
102
- a("div", ie, [
103
- ue,
104
- i(j, {
105
+ o("div", ue, [
106
+ ie,
107
+ u(j, {
105
108
  ref_key: "addressBarRef",
106
- ref: b,
109
+ ref: x,
107
110
  disableCloseBrackets: "",
108
- disabled: l(p),
111
+ disabled: l(v),
109
112
  disableEnter: "",
110
113
  disableTabIndent: "",
111
114
  emitOnBlur: !1,
112
- modelValue: l(c).url,
115
+ modelValue: l(f).url,
113
116
  placeholder: "Enter URL to get started",
114
117
  server: "",
115
- onSubmit: o[0] || (o[0] = (H) => l(m).emit()),
116
- "onUpdate:modelValue": U
118
+ onSubmit: g,
119
+ "onUpdate:modelValue": H
117
120
  }, null, 8, ["disabled", "modelValue"]),
118
121
  de
119
122
  ]),
120
- i(le, { open: d }, null, 8, ["open"]),
121
- i(l(J), {
123
+ u(le, { open: d }, null, 8, ["open"]),
124
+ u(l(J), {
122
125
  class: "relative h-auto shrink-0 gap-1 overflow-hidden pl-2 pr-2.5 py-1 z-[1] font-bold",
123
- disabled: s.value,
124
- onClick: o[1] || (o[1] = (H) => l(m).emit())
126
+ disabled: r.value,
127
+ onClick: g
125
128
  }, {
126
129
  default: y(() => [
127
- i(l(P), {
130
+ u(l(P), {
128
131
  class: "relative z-10 shrink-0 fill-current",
129
132
  icon: "Play",
130
133
  size: "xs"
131
134
  }),
132
- fe
135
+ ce
133
136
  ]),
134
137
  _: 1
135
138
  }, 8, ["disabled"])
@@ -142,5 +145,5 @@ const v = (f) => (Q("data-v-28ee5506"), f = f(), W(), f), ae = {
142
145
  }
143
146
  });
144
147
  export {
145
- Ee as default
148
+ Se as default
146
149
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteCollection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteCollection.vue"],"names":[],"mappings":";;;;;AAiNA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteCollection.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteCollection.vue"],"names":[],"mappings":";;;;;AA8NA,wBAMG"}
@@ -1,64 +1,70 @@
1
- import { defineComponent as p, ref as a, onMounted as m, openBlock as f, createElementBlock as h, createElementVNode as e, withDirectives as _, withKeys as x, withModifiers as v, vModelText as w, createVNode as b, unref as C, withCtx as y, createTextVNode as g } from "vue";
2
- import { useWorkspace as k } from "../../store/workspace.js";
3
- import { ScalarButton as N } from "@scalar/components";
4
- const M = { 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" }, B = /* @__PURE__ */ e("label", {
1
+ import { defineComponent as p, ref as s, onMounted as f, openBlock as h, createElementBlock as _, createElementVNode as o, withDirectives as v, withKeys as x, withModifiers as b, vModelText as w, createVNode as C, unref as g, withCtx as y, createTextVNode as k } from "vue";
2
+ import { useWorkspace as N } from "../../store/workspace.js";
3
+ import { ScalarButton as M } from "@scalar/components";
4
+ import { useToasts as V } from "@scalar/use-toasts";
5
+ const B = { class: "flex w-full flex-col gap-3" }, K = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, T = /* @__PURE__ */ o("label", {
5
6
  class: "absolute w-full h-full opacity-0 cursor-text",
6
7
  for: "collectionanme"
7
- }, null, -1), K = ["onKeydown"], E = { class: "flex" }, I = /* @__PURE__ */ e("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), P = /* @__PURE__ */ p({
8
+ }, null, -1), E = ["onKeydown"], I = { class: "flex" }, P = /* @__PURE__ */ o("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), q = /* @__PURE__ */ p({
8
9
  __name: "CommandPaletteCollection",
9
10
  emits: ["close"],
10
- setup(S, { emit: c }) {
11
- const i = c, { activeWorkspace: r, collectionMutators: u } = k(), o = a(""), l = () => {
11
+ setup(S, { emit: i }) {
12
+ const c = i, { activeWorkspace: r, collectionMutators: u } = N(), e = s(""), { toast: d } = V(), l = () => {
13
+ if (!e.value) {
14
+ d("Please enter a name before creating a collection.", "error");
15
+ return;
16
+ }
12
17
  u.add(
13
18
  {
14
19
  spec: {
15
20
  openapi: "3.1.0",
16
21
  info: {
17
- title: o.value,
22
+ title: e.value,
18
23
  version: "0.0.1"
19
24
  }
20
25
  }
21
26
  },
22
27
  r.value.uid
23
- ), i("close");
24
- }, n = a(null);
25
- return m(() => {
28
+ ), c("close");
29
+ }, n = s(null);
30
+ return f(() => {
26
31
  var t;
27
32
  (t = n.value) == null || t.focus();
28
- }), (t, s) => (f(), h("div", M, [
29
- e("div", V, [
30
- B,
31
- _(e("input", {
33
+ }), (t, a) => (h(), _("div", B, [
34
+ o("div", K, [
35
+ T,
36
+ v(o("input", {
32
37
  id: "collectionanme",
33
38
  ref_key: "collectionInput",
34
39
  ref: n,
35
- "onUpdate:modelValue": s[0] || (s[0] = (d) => o.value = d),
40
+ "onUpdate:modelValue": a[0] || (a[0] = (m) => e.value = m),
36
41
  autocomplete: "off",
37
42
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
38
43
  "data-form-type": "other",
39
44
  "data-lpignore": "true",
40
45
  label: "Collection Name",
41
46
  placeholder: "Collection Name",
42
- onKeydown: x(v(l, ["prevent"]), ["enter"])
43
- }, null, 40, K), [
44
- [w, o.value]
47
+ onKeydown: x(b(l, ["prevent"]), ["enter"])
48
+ }, null, 40, E), [
49
+ [w, e.value]
45
50
  ])
46
51
  ]),
47
- e("div", E, [
48
- I,
49
- b(C(N), {
52
+ o("div", I, [
53
+ P,
54
+ C(g(M), {
50
55
  class: "max-h-8 text-xs p-0 px-3",
56
+ disabled: !e.value.trim(),
51
57
  onClick: l
52
58
  }, {
53
59
  default: y(() => [
54
- g(" Continue ")
60
+ k(" Continue ")
55
61
  ]),
56
62
  _: 1
57
- })
63
+ }, 8, ["disabled"])
58
64
  ])
59
65
  ]));
60
66
  }
61
67
  });
62
68
  export {
63
- P as default
69
+ q as default
64
70
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteExample.vue"],"names":[],"mappings":";IAwIE,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":";IAgJE,oCAAoC;eACzB,MAAM;;;;IADjB,oCAAoC;eACzB,MAAM;;;;AAoTnB,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,76 +1,81 @@
1
- import { defineComponent as $, ref as i, onMounted as f, openBlock as m, createElementBlock as h, createElementVNode as l, withDirectives as B, withKeys as I, withModifiers as R, vModelText as V, createVNode as a, unref as s, withCtx as n, Fragment as q, renderList as K, createBlock as W, createTextVNode as d, toDisplayString as v } from "vue";
1
+ import { defineComponent as B, ref as c, onMounted as x, openBlock as m, createElementBlock as h, createElementVNode as a, withDirectives as I, withKeys as R, withModifiers as V, vModelText as q, createVNode as o, unref as s, withCtx as r, Fragment as K, renderList as T, createBlock as W, createTextVNode as d, toDisplayString as v } from "vue";
2
2
  import _ from "../HttpMethod/HttpMethod.vue.js";
3
3
  import { useWorkspace as j } from "../../store/workspace.js";
4
- import { ScalarDropdown as z, ScalarDropdownItem as T, ScalarButton as w, ScalarIcon as F } from "@scalar/components";
5
- import { useRouter as H } from "vue-router";
6
- const L = { class: "flex w-full flex-col gap-3" }, 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", {
4
+ import { ScalarDropdown as z, ScalarDropdownItem as P, ScalarButton as w, ScalarIcon as F } from "@scalar/components";
5
+ import { useToasts as H } from "@scalar/use-toasts";
6
+ import { useRouter as L } from "vue-router";
7
+ const U = { class: "flex w-full flex-col gap-3" }, A = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, G = /* @__PURE__ */ a("label", {
7
8
  class: "absolute w-full h-full opacity-0 cursor-text",
8
9
  for: "examplename"
9
- }, null, -1), A = ["onKeydown"], G = { class: "flex gap-2" }, J = { class: "flex flex-1 max-h-8" }, O = { class: "flex items-center gap-2" }, Q = { class: "max-h-40 custom-scroll" }, oe = /* @__PURE__ */ $({
10
+ }, null, -1), J = ["onKeydown"], O = { class: "flex gap-2" }, Q = { class: "flex flex-1 max-h-8" }, X = { class: "flex items-center gap-2" }, Y = { class: "max-h-40 custom-scroll" }, ne = /* @__PURE__ */ B({
10
11
  __name: "CommandPaletteExample",
11
12
  props: {
12
13
  metaData: {}
13
14
  },
14
15
  emits: ["close"],
15
16
  setup(b, { emit: k }) {
16
- const y = b, g = k, { push: C } = H(), {
17
+ const y = b, g = k, { push: C } = L(), {
17
18
  activeRequest: D,
18
19
  activeWorkspace: E,
19
20
  activeWorkspaceRequests: S,
20
21
  requests: N,
21
22
  requestExampleMutators: M
22
- } = j(), c = i(""), o = i(
23
+ } = j(), { toast: $ } = H(), n = c(""), l = c(
23
24
  // Ensure we pre-select the correct request
24
25
  N[y.metaData ?? ""] ?? D.value
25
- ), p = (e) => o.value = e, u = i(null);
26
- f(() => {
26
+ ), p = (e) => l.value = e, u = c(null);
27
+ x(() => {
27
28
  var e;
28
29
  return (e = u.value) == null ? void 0 : e.focus();
29
30
  });
30
- const x = () => {
31
+ const f = () => {
32
+ if (!n.value) {
33
+ $("Please enter a name before creating an example.", "error");
34
+ return;
35
+ }
31
36
  const e = M.add(
32
- o.value,
33
- c.value
37
+ l.value,
38
+ n.value
34
39
  );
35
40
  e && (C(
36
- `/workspace/${E.value.uid}/request/${o.value.uid}/examples/${e.uid}`
41
+ `/workspace/${E.value.uid}/request/${l.value.uid}/examples/${e.uid}`
37
42
  ), g("close"));
38
43
  };
39
- return f(() => {
44
+ return x(() => {
40
45
  var e;
41
46
  (e = u.value) == null || e.focus();
42
- }), (e, r) => (m(), h("div", L, [
43
- l("div", P, [
44
- U,
45
- B(l("input", {
47
+ }), (e, i) => (m(), h("div", U, [
48
+ a("div", A, [
49
+ G,
50
+ I(a("input", {
46
51
  id: "examplename",
47
52
  ref_key: "exampleInput",
48
53
  ref: u,
49
- "onUpdate:modelValue": r[0] || (r[0] = (t) => c.value = t),
54
+ "onUpdate:modelValue": i[0] || (i[0] = (t) => n.value = t),
50
55
  class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
51
56
  label: "Example Name",
52
57
  placeholder: "Example Name",
53
- onKeydown: I(R(x, ["prevent"]), ["enter"])
54
- }, null, 40, A), [
55
- [V, c.value]
58
+ onKeydown: R(V(f, ["prevent"]), ["enter"])
59
+ }, null, 40, J), [
60
+ [q, n.value]
56
61
  ])
57
62
  ]),
58
- l("div", G, [
59
- l("div", J, [
60
- a(s(z), {
63
+ a("div", O, [
64
+ a("div", Q, [
65
+ o(s(z), {
61
66
  placement: "bottom",
62
67
  resize: ""
63
68
  }, {
64
- items: n(() => [
65
- l("div", Q, [
66
- (m(!0), h(q, null, K(s(S), (t) => (m(), W(s(T), {
69
+ items: r(() => [
70
+ a("div", Y, [
71
+ (m(!0), h(K, null, T(s(S), (t) => (m(), W(s(P), {
67
72
  key: t.uid,
68
73
  class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
69
- onClick: (X) => p(t)
74
+ onClick: (Z) => p(t)
70
75
  }, {
71
- default: n(() => [
76
+ default: r(() => [
72
77
  d(v(t.summary) + " ", 1),
73
- a(_, {
78
+ o(_, {
74
79
  method: t.method
75
80
  }, null, 8, ["method"])
76
81
  ]),
@@ -78,19 +83,19 @@ const L = { class: "flex w-full flex-col gap-3" }, P = { class: "gap-3 rounded b
78
83
  }, 1032, ["onClick"]))), 128))
79
84
  ])
80
85
  ]),
81
- default: n(() => [
82
- a(s(w), {
86
+ default: r(() => [
87
+ o(s(w), {
83
88
  class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
84
89
  variant: "outlined",
85
- onClick: r[1] || (r[1] = (t) => p(o.value))
90
+ onClick: i[1] || (i[1] = (t) => p(l.value))
86
91
  }, {
87
- default: n(() => [
88
- d(v(o.value.summary) + " ", 1),
89
- l("div", O, [
90
- a(_, {
91
- method: o.value.method
92
+ default: r(() => [
93
+ d(v(l.value.summary) + " ", 1),
94
+ a("div", X, [
95
+ o(_, {
96
+ method: l.value.method
92
97
  }, null, 8, ["method"]),
93
- a(s(F), {
98
+ o(s(F), {
94
99
  class: "text-c-3",
95
100
  icon: "ChevronDown",
96
101
  size: "xs"
@@ -103,19 +108,20 @@ const L = { class: "flex w-full flex-col gap-3" }, P = { class: "gap-3 rounded b
103
108
  _: 1
104
109
  })
105
110
  ]),
106
- a(s(w), {
111
+ o(s(w), {
107
112
  class: "max-h-8 text-xs p-0 px-3",
108
- onClick: x
113
+ disabled: !n.value.trim(),
114
+ onClick: f
109
115
  }, {
110
- default: n(() => [
116
+ default: r(() => [
111
117
  d(" Create Example ")
112
118
  ]),
113
119
  _: 1
114
- })
120
+ }, 8, ["disabled"])
115
121
  ])
116
122
  ]));
117
123
  }
118
124
  });
119
125
  export {
120
- oe as default
126
+ ne as default
121
127
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteFolder.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteFolder.vue"],"names":[],"mappings":";;;;;AAgUA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteFolder.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteFolder.vue"],"names":[],"mappings":";;;;;AA6UA,wBAMG"}