@scalar/api-client 2.1.19 → 2.1.21

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 (105) hide show
  1. package/CHANGELOG.md +20 -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 +77 -79
  5. package/dist/components/AddressBar/AddressBarServer.vue.js +23 -23
  6. package/dist/components/CommandPalette/CommandPaletteServer.vue.d.ts.map +1 -1
  7. package/dist/components/CommandPalette/CommandPaletteServer.vue.js +62 -45
  8. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +6 -0
  9. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  10. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  11. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +89 -91
  12. package/dist/components/DataTable/DataTableInput.vue.d.ts +1 -1
  13. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  14. package/dist/components/ImportCollection/ImportCollectionModal.vue.d.ts.map +1 -1
  15. package/dist/components/ImportCollection/ImportCollectionModal.vue.js +29 -32
  16. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  17. package/dist/components/TopNav/TopNav.vue.js +3 -3
  18. package/dist/components/TopNav/TopNav.vue2.js +41 -40
  19. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
  20. package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +1 -1
  21. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  22. package/dist/layouts/App/ApiClientApp.vue.js +38 -38
  23. package/dist/layouts/App/create-api-client-app.d.ts +33 -26
  24. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  25. package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
  26. package/dist/layouts/Modal/ApiClientModal.vue2.js +15 -15
  27. package/dist/layouts/Modal/create-api-client-modal.d.ts +66 -52
  28. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  29. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  30. package/dist/layouts/Web/ApiClientWeb.vue.js +30 -30
  31. package/dist/layouts/Web/create-api-client-web.d.ts +33 -26
  32. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  33. package/dist/libs/create-client.d.ts +33 -26
  34. package/dist/libs/create-client.d.ts.map +1 -1
  35. package/dist/libs/event-bus.d.ts +41 -0
  36. package/dist/libs/event-bus.d.ts.map +1 -0
  37. package/dist/libs/event-bus.js +32 -0
  38. package/dist/libs/{event-busses/hot-keys-bus.d.ts → hot-keys.d.ts} +6 -7
  39. package/dist/libs/hot-keys.d.ts.map +1 -0
  40. package/dist/libs/hot-keys.js +45 -0
  41. package/dist/libs/index.d.ts +3 -1
  42. package/dist/libs/index.d.ts.map +1 -1
  43. package/dist/libs/index.js +31 -33
  44. package/dist/libs/send-request.d.ts +4 -1
  45. package/dist/libs/send-request.d.ts.map +1 -1
  46. package/dist/libs/send-request.js +103 -103
  47. package/dist/store/collections.d.ts +4 -4
  48. package/dist/store/events.d.ts +29 -0
  49. package/dist/store/events.d.ts.map +1 -0
  50. package/dist/store/events.js +31 -0
  51. package/dist/store/request-example.d.ts +2 -2
  52. package/dist/store/requests.d.ts +4 -4
  53. package/dist/store/security-schemes.d.ts +4 -4
  54. package/dist/store/servers.d.ts +4 -4
  55. package/dist/store/store.d.ts +66 -52
  56. package/dist/store/store.d.ts.map +1 -1
  57. package/dist/store/store.js +75 -73
  58. package/dist/store/tags.d.ts +4 -4
  59. package/dist/store/workspace.d.ts +4 -4
  60. package/dist/style.css +1 -1
  61. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  62. package/dist/views/Request/Request.vue.js +1 -1
  63. package/dist/views/Request/Request.vue2.js +63 -63
  64. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  65. package/dist/views/Request/RequestSidebar.vue.js +1 -1
  66. package/dist/views/Request/RequestSidebar.vue2.js +101 -102
  67. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  68. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  69. package/dist/views/Request/RequestSidebarItem.vue2.js +76 -76
  70. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  71. package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
  72. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +33 -34
  73. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.d.ts +16 -0
  74. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.d.ts.map +1 -0
  75. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.js +31 -0
  76. package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +5 -0
  77. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.d.ts.map +1 -1
  78. package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
  79. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +30 -33
  80. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.d.ts.map +1 -1
  81. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +3 -3
  82. package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +17 -18
  83. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.d.ts.map +1 -1
  84. package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +20 -20
  85. package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
  86. package/dist/views/Request/ResponseSection/ResponseSection.vue.js +68 -56
  87. package/dist/views/Request/components/WorkspaceDropdown.vue.js +29 -30
  88. package/package.json +6 -6
  89. package/dist/libs/event-busses/cancel-request-bus.d.ts +0 -2
  90. package/dist/libs/event-busses/cancel-request-bus.d.ts.map +0 -1
  91. package/dist/libs/event-busses/cancel-request-bus.js +0 -5
  92. package/dist/libs/event-busses/command-palette-bus.d.ts +0 -14
  93. package/dist/libs/event-busses/command-palette-bus.d.ts.map +0 -1
  94. package/dist/libs/event-busses/command-palette-bus.js +0 -5
  95. package/dist/libs/event-busses/execute-request-bus.d.ts +0 -2
  96. package/dist/libs/event-busses/execute-request-bus.d.ts.map +0 -1
  97. package/dist/libs/event-busses/execute-request-bus.js +0 -5
  98. package/dist/libs/event-busses/hot-keys-bus.d.ts.map +0 -1
  99. package/dist/libs/event-busses/hot-keys-bus.js +0 -47
  100. package/dist/libs/event-busses/index.d.ts +0 -6
  101. package/dist/libs/event-busses/index.d.ts.map +0 -1
  102. package/dist/libs/event-busses/index.js +0 -15
  103. package/dist/libs/event-busses/request-status-bus.d.ts +0 -5
  104. package/dist/libs/event-busses/request-status-bus.d.ts.map +0 -1
  105. package/dist/libs/event-busses/request-status-bus.js +0 -5
package/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.1.21
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [f935fad]
8
+ - @scalar/components@0.12.53
9
+ - @scalar/use-codemirror@0.11.20
10
+
11
+ ## 2.1.20
12
+
13
+ ### Patch Changes
14
+
15
+ - 0ddd4f3: feat: added virtual text component
16
+ - deb13b9: fix: updates command palette server collection logic
17
+ - b99799e: refactor(api-client): localize event bus in workspace store
18
+ - Updated dependencies [0ddd4f3]
19
+ - @scalar/components@0.12.52
20
+ - @scalar/oas-utils@0.2.55
21
+ - @scalar/use-codemirror@0.11.19
22
+
3
23
  ## 2.1.19
4
24
 
5
25
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";;;;;AA2vBA,wBAMG"}
1
+ {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":";;;;;AAmvBA,wBAMG"}
@@ -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 d = /* @__PURE__ */ r(o, [["__scopeId", "data-v-30d2e87b"]]);
4
+ const s = /* @__PURE__ */ r(o, [["__scopeId", "data-v-b2aad57d"]]);
5
5
  export {
6
- d as default
6
+ s as default
7
7
  };
@@ -1,40 +1,38 @@
1
- import { defineComponent as z, ref as u, watch as A, onMounted as K, onBeforeUnmount as N, unref as l, openBlock as T, createElementBlock as $, createElementVNode as o, createVNode as n, withCtx as w, normalizeClass as B, normalizeStyle as D, createCommentVNode as P, pushScopeId as Q, popScopeId as W } from "vue";
2
- import j from "../CodeInput/CodeInput.vue.js";
3
- import { Listbox as F } from "@headlessui/vue";
4
- import { ScalarButton as G, ScalarIcon as J } from "@scalar/components";
5
- import { REQUEST_METHODS as X } from "@scalar/oas-utils/helpers";
6
- import { isMacOS as Y } from "@scalar/use-tooltip";
7
- import { useMagicKeys as Z, whenever as ee } from "@vueuse/core";
8
- import te from "../HttpMethod/HttpMethod.vue.js";
9
- import le from "./AddressBarHistory.vue.js";
10
- import oe from "./AddressBarServer.vue.js";
11
- import { executeRequestBus as C } from "../../libs/event-busses/execute-request-bus.js";
12
- import { useWorkspace as ae } from "../../store/store.js";
13
- import { requestStatusBus as re } from "../../libs/event-busses/request-status-bus.js";
14
- import { hotKeyBus as S } from "../../libs/event-busses/hot-keys-bus.js";
15
- const m = (d) => (Q("data-v-30d2e87b"), d = d(), W(), d), se = {
1
+ import { defineComponent as K, ref as u, watch as O, onMounted as z, onBeforeUnmount as A, unref as l, openBlock as N, createElementBlock as T, createElementVNode as o, createVNode as n, withCtx as C, normalizeClass as y, normalizeStyle as $, createCommentVNode as D, pushScopeId as P, popScopeId as Q } from "vue";
2
+ import W from "../CodeInput/CodeInput.vue.js";
3
+ import { Listbox as j } from "@headlessui/vue";
4
+ import { ScalarButton as F, ScalarIcon as G } from "@scalar/components";
5
+ import { REQUEST_METHODS as J } from "@scalar/oas-utils/helpers";
6
+ import { isMacOS as X } from "@scalar/use-tooltip";
7
+ import { useMagicKeys as Y, whenever as Z } from "@vueuse/core";
8
+ import ee from "../HttpMethod/HttpMethod.vue.js";
9
+ import te from "./AddressBarHistory.vue.js";
10
+ import le from "./AddressBarServer.vue.js";
11
+ import { useWorkspace as oe } from "../../store/store.js";
12
+ const v = (c) => (P("data-v-b2aad57d"), c = c(), Q(), c), ae = {
16
13
  key: 0,
17
14
  class: "order-last lg:order-none lg:w-auto w-full"
18
- }, ne = { class: "m-auto flex flex-row items-center" }, ie = { class: "pointer-events-none absolute left-0 top-0 block h-full w-full overflow-hidden" }, ue = { class: "flex gap-1" }, de = { class: "codemirror-bg-switcher scroll-timeline-x scroll-timeline-x-hidden relative flex w-full" }, fe = /* @__PURE__ */ m(() => /* @__PURE__ */ o("div", { class: "fade-left" }, null, -1)), ce = /* @__PURE__ */ m(() => /* @__PURE__ */ o("div", { class: "fade-right" }, null, -1)), me = /* @__PURE__ */ m(() => /* @__PURE__ */ o("span", { class: "text-xxs relative lg:flex hidden" }, "Send", -1)), qe = /* @__PURE__ */ z({
15
+ }, re = { class: "m-auto flex flex-row items-center" }, se = { class: "pointer-events-none absolute left-0 top-0 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__ */ o("div", { class: "fade-left" }, null, -1)), de = /* @__PURE__ */ v(() => /* @__PURE__ */ o("div", { class: "fade-right" }, null, -1)), ce = /* @__PURE__ */ v(() => /* @__PURE__ */ o("span", { class: "text-xxs relative lg:flex hidden" }, "Send", -1)), ye = /* @__PURE__ */ K({
19
16
  __name: "AddressBar",
20
17
  emits: ["importCurl"],
21
- setup(d) {
18
+ setup(c) {
22
19
  const {
23
20
  activeRequest: t,
24
- activeExample: k,
25
- activeServer: y,
26
- isReadOnly: v,
27
- requestMutators: c,
28
- requestHistory: R
29
- } = ae(), p = u(R[0]), h = u(null), b = Z();
30
- ee(
31
- Y() ? b.meta_enter : b.ctrl_enter,
32
- () => C.emit()
21
+ activeExample: S,
22
+ activeServer: k,
23
+ isReadOnly: p,
24
+ requestMutators: m,
25
+ requestHistory: R,
26
+ events: d
27
+ } = oe(), h = u(R[0]), x = u(null), b = Y();
28
+ Z(
29
+ X() ? b.meta_enter : b.ctrl_enter,
30
+ () => d.executeRequest.emit()
33
31
  );
34
32
  const q = (e) => {
35
- !t.value || t.value.path === e || c.edit(t.value.uid, "path", e);
33
+ !t.value || t.value.path === e || m.edit(t.value.uid, "path", e);
36
34
  };
37
- A(
35
+ O(
38
36
  () => {
39
37
  var e;
40
38
  return (e = t.value) == null ? void 0 : e.path;
@@ -43,102 +41,102 @@ const m = (d) => (Q("data-v-30d2e87b"), d = d(), W(), d), se = {
43
41
  !t.value || !e || q(e);
44
42
  }
45
43
  );
46
- const a = u(100), x = u(0), r = u(!1), i = u();
44
+ const a = u(100), _ = u(0), r = u(!1), i = u();
45
+ function B() {
46
+ r.value ? a.value -= (a.value - 15) / 60 : a.value -= _.value / 20, a.value <= 0 && (clearInterval(i.value), i.value = void 0, a.value = 100, r.value = !1);
47
+ }
47
48
  function E() {
48
- r.value ? a.value -= (a.value - 15) / 60 : a.value -= x.value / 20, a.value <= 0 && (clearInterval(i.value), i.value = void 0, a.value = 100, r.value = !1);
49
+ i.value || (r.value = !0, i.value = setInterval(B, 20));
49
50
  }
50
51
  function I() {
51
- i.value || (r.value = !0, i.value = setInterval(E, 20));
52
+ _.value = a.value, r.value = !1;
52
53
  }
53
54
  function V() {
54
- x.value = a.value, r.value = !1;
55
- }
56
- function M() {
57
55
  clearInterval(i.value), i.value = void 0, a.value = 100, r.value = !1;
58
56
  }
59
- re.on((e) => {
60
- e === "start" && I(), e === "stop" && V(), e === "abort" && M();
57
+ d.requestStatus.on((e) => {
58
+ e === "start" && E(), e === "stop" && I(), e === "abort" && V();
61
59
  });
62
- function U(e) {
63
- t.value && c.edit(t.value.uid, "method", e);
60
+ function M(e) {
61
+ t.value && m.edit(t.value.uid, "method", e);
64
62
  }
65
- function H() {
63
+ function U() {
66
64
  if (!t.value) return;
67
65
  const { method: e } = t.value;
68
- return X[e].backgroundColor;
66
+ return J[e].backgroundColor;
69
67
  }
70
- function _() {
71
- r.value || (r.value = !0, C.emit());
68
+ function g() {
69
+ r.value || (r.value = !0, d.executeRequest.emit());
72
70
  }
73
- function L(e) {
74
- t.value && c.edit(t.value.uid, "path", e);
71
+ function H(e) {
72
+ t.value && m.edit(t.value.uid, "path", e);
75
73
  }
76
- function g(e) {
74
+ function w(e) {
77
75
  var s;
78
- e.focusAddressBar && ((s = h.value) == null || s.focus());
76
+ e != null && e.focusAddressBar && ((s = x.value) == null || s.focus());
79
77
  }
80
- return K(() => S.on(g)), N(() => S.off(g)), (e, s) => l(t) && l(k) ? (T(), $("div", se, [
81
- o("div", ne, [
82
- n(l(F), {
83
- modelValue: p.value,
84
- "onUpdate:modelValue": s[1] || (s[1] = (f) => p.value = f)
78
+ return z(() => d.hotKeys.on(w)), A(() => d.hotKeys.off(w)), (e, s) => l(t) && l(S) ? (N(), T("div", ae, [
79
+ o("div", re, [
80
+ n(l(j), {
81
+ modelValue: h.value,
82
+ "onUpdate:modelValue": s[1] || (s[1] = (f) => h.value = f)
85
83
  }, {
86
- default: w(({ open: f }) => [
84
+ default: C(({ open: f }) => [
87
85
  o("div", {
88
- class: B([
86
+ class: y([
89
87
  "addressbar-bg-states text-xxs relative flex w-full lg:min-w-[720px] lg:max-w-[720px] order-last overflow-hidden lg:order-none flex-1 flex-row items-stretch rounded-lg border-1/2 p-[3px]",
90
88
  { "border-transparent overflow-visible rounded-b-none": f }
91
89
  ])
92
90
  }, [
93
- o("div", ie, [
91
+ o("div", se, [
94
92
  o("div", {
95
- class: B(["bg-mix-transparent bg-mix-amount-90 absolute left-0 top-0 h-full w-full", H()]),
96
- style: D({ transform: `translate3d(-${a.value}%,0,0)` })
93
+ class: y(["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)` })
97
95
  }, null, 6)
98
96
  ]),
99
- o("div", ue, [
100
- n(te, {
101
- isEditable: !l(v),
97
+ o("div", ne, [
98
+ n(ee, {
99
+ isEditable: !l(p),
102
100
  isSquare: "",
103
101
  method: l(t).method,
104
102
  teleport: ".scalar-client",
105
- onChange: U
103
+ onChange: M
106
104
  }, null, 8, ["isEditable", "method"])
107
105
  ]),
108
- o("div", de, [
109
- fe,
110
- n(oe),
111
- n(j, {
106
+ o("div", ie, [
107
+ ue,
108
+ n(le),
109
+ n(W, {
112
110
  ref_key: "addressBarRef",
113
- ref: h,
111
+ ref: x,
114
112
  disableCloseBrackets: "",
115
- disabled: l(v),
113
+ disabled: l(p),
116
114
  disableEnter: "",
117
115
  disableTabIndent: "",
118
116
  emitOnBlur: !1,
119
117
  importCurl: "",
120
118
  modelValue: l(t).path,
121
- placeholder: l(y) ? "" : "Enter a URL or cURL command",
119
+ placeholder: l(k) ? "" : "Enter a URL or cURL command",
122
120
  server: "",
123
- onCurl: s[0] || (s[0] = (O) => e.$emit("importCurl", O)),
124
- onSubmit: _,
125
- "onUpdate:modelValue": L
121
+ onCurl: s[0] || (s[0] = (L) => e.$emit("importCurl", L)),
122
+ onSubmit: g,
123
+ "onUpdate:modelValue": H
126
124
  }, null, 8, ["disabled", "modelValue", "placeholder"]),
127
- ce
125
+ de
128
126
  ]),
129
- n(le, { open: f }, null, 8, ["open"]),
130
- n(l(G), {
127
+ n(te, { open: f }, null, 8, ["open"]),
128
+ n(l(F), {
131
129
  class: "relative h-auto shrink-0 gap-1 overflow-hidden pl-2 pr-2.5 py-1 font-bold",
132
130
  disabled: r.value,
133
- onClick: _
131
+ onClick: g
134
132
  }, {
135
- default: w(() => [
136
- n(l(J), {
133
+ default: C(() => [
134
+ n(l(G), {
137
135
  class: "relative shrink-0 fill-current",
138
136
  icon: "Play",
139
137
  size: "xs"
140
138
  }),
141
- me
139
+ ce
142
140
  ]),
143
141
  _: 1
144
142
  }, 8, ["disabled"])
@@ -147,9 +145,9 @@ const m = (d) => (Q("data-v-30d2e87b"), d = d(), W(), d), se = {
147
145
  _: 1
148
146
  }, 8, ["modelValue"])
149
147
  ])
150
- ])) : P("", !0);
148
+ ])) : D("", !0);
151
149
  }
152
150
  });
153
151
  export {
154
- qe as default
152
+ ye as default
155
153
  };
@@ -1,15 +1,14 @@
1
- import { defineComponent as U, computed as u, watch as O, openBlock as l, createBlock as h, unref as s, withCtx as _, createElementBlock as n, createCommentVNode as v, Fragment as m, renderList as g, createVNode as p, createElementVNode as c, withModifiers as R, toDisplayString as b } from "vue";
2
- import { ScalarDropdown as V, ScalarDropdownDivider as C, ScalarDropdownItem as W, ScalarIcon as E } from "@scalar/components";
1
+ import { defineComponent as O, computed as u, watch as R, openBlock as l, createBlock as h, unref as o, withCtx as _, createElementBlock as n, createCommentVNode as v, Fragment as m, renderList as g, createVNode as p, createElementVNode as c, withModifiers as V, toDisplayString as b } from "vue";
2
+ import { ScalarDropdown as W, ScalarDropdownDivider as C, ScalarDropdownItem as E, ScalarIcon as I } from "@scalar/components";
3
3
  import D from "./AddressBarServerItem.vue.js";
4
- import { useWorkspace as I } from "../../store/store.js";
5
- import { commandPaletteBus as L } from "../../libs/event-busses/command-palette-bus.js";
4
+ import { useWorkspace as L } from "../../store/store.js";
6
5
  const M = {
7
6
  key: 0,
8
7
  class: "text-xxs text-c-2 ml-8"
9
8
  }, j = /* @__PURE__ */ c("div", { class: "text-xxs text-c-2 ml-8" }, "Collection Servers", -1), F = { class: "flex items-center justify-center h-4 w-4" }, P = /* @__PURE__ */ c("span", null, "Add Server", -1), T = {
10
9
  key: 1,
11
10
  class: "flex whitespace-nowrap items-center font-code lg:text-sm text-xs"
12
- }, K = /* @__PURE__ */ U({
11
+ }, J = /* @__PURE__ */ O({
13
12
  __name: "AddressBarServer",
14
13
  setup($) {
15
14
  const {
@@ -18,15 +17,16 @@ const M = {
18
17
  activeServer: x,
19
18
  isReadOnly: A,
20
19
  servers: w,
21
- collectionMutators: B
22
- } = I(), i = u(
20
+ collectionMutators: B,
21
+ events: N
22
+ } = L(), i = u(
23
23
  () => {
24
24
  var t, e;
25
25
  return (e = (t = S.value) == null ? void 0 : t.servers) == null ? void 0 : e.map((r) => {
26
- var o;
26
+ var s;
27
27
  return {
28
28
  id: r,
29
- label: ((o = w[r]) == null ? void 0 : o.url) ?? "Unknown server"
29
+ label: ((s = w[r]) == null ? void 0 : s.url) ?? "Unknown server"
30
30
  };
31
31
  });
32
32
  }
@@ -34,10 +34,10 @@ const M = {
34
34
  () => {
35
35
  var t, e;
36
36
  return (e = (t = k.value) == null ? void 0 : t.servers) == null ? void 0 : e.map((r) => {
37
- var o;
37
+ var s;
38
38
  return {
39
39
  id: r,
40
- label: ((o = w[r]) == null ? void 0 : o.url) ?? "Unknown server"
40
+ label: ((s = w[r]) == null ? void 0 : s.url) ?? "Unknown server"
41
41
  };
42
42
  });
43
43
  }
@@ -47,22 +47,22 @@ const M = {
47
47
  return ((t = i.value) == null ? void 0 : t.length) && ((e = d.value) == null ? void 0 : e.length);
48
48
  }
49
49
  );
50
- O([k, S], ([t, e]) => {
50
+ R([k, S], ([t, e]) => {
51
51
  !t || t.selectedServerUid || e != null && e.selectedServerUid || B.edit(
52
52
  t.uid,
53
53
  "selectedServerUid",
54
54
  t.servers[0]
55
55
  );
56
56
  });
57
- const N = () => L.emit({
57
+ const U = () => N.commandPalette.emit({
58
58
  commandName: "Add Server"
59
59
  }), f = u(() => {
60
60
  var t, e, r;
61
61
  return (e = (t = x.value) == null ? void 0 : t.url) != null && e.endsWith("/") ? x.value.url.slice(0, -1) : ((r = x.value) == null ? void 0 : r.url) || "";
62
62
  });
63
63
  return (t, e) => {
64
- var r, o;
65
- return i.value && ((r = i.value) == null ? void 0 : r.length) > 1 || d.value && ((o = d.value) == null ? void 0 : o.length) > 1 ? (l(), h(s(V), {
64
+ var r, s;
65
+ return i.value && ((r = i.value) == null ? void 0 : r.length) > 1 || d.value && ((s = d.value) == null ? void 0 : s.length) > 1 ? (l(), h(o(W), {
66
66
  key: 0,
67
67
  teleport: ".scalar-client"
68
68
  }, {
@@ -74,7 +74,7 @@ const M = {
74
74
  type: "request"
75
75
  }, null, 8, ["serverOption"]))), 128)),
76
76
  y.value ? (l(), n(m, { key: 1 }, [
77
- p(s(C)),
77
+ p(o(C)),
78
78
  j
79
79
  ], 64)) : v("", !0),
80
80
  (l(!0), n(m, null, g(d.value, (a) => (l(), h(D, {
@@ -82,16 +82,16 @@ const M = {
82
82
  serverOption: a,
83
83
  type: "collection"
84
84
  }, null, 8, ["serverOption"]))), 128)),
85
- s(A) ? v("", !0) : (l(), n(m, { key: 2 }, [
86
- p(s(C)),
87
- p(s(W), null, {
85
+ o(A) ? v("", !0) : (l(), n(m, { key: 2 }, [
86
+ p(o(C)),
87
+ p(o(E), null, {
88
88
  default: _(() => [
89
89
  c("div", {
90
90
  class: "font-code text-xxs flex items-center gap-1.5",
91
- onClick: N
91
+ onClick: U
92
92
  }, [
93
93
  c("div", F, [
94
- p(s(E), {
94
+ p(o(I), {
95
95
  class: "h-2.5",
96
96
  icon: "Add"
97
97
  })
@@ -107,7 +107,7 @@ const M = {
107
107
  c("button", {
108
108
  class: "font-code lg:text-sm text-xs whitespace-nowrap border border-b-3 border-solid rounded px-1.5 py-0.5 text-c-2",
109
109
  type: "button",
110
- onClick: e[0] || (e[0] = R(() => {
110
+ onClick: e[0] || (e[0] = V(() => {
111
111
  }, ["stop"]))
112
112
  }, b(f.value), 1)
113
113
  ]),
@@ -117,5 +117,5 @@ const M = {
117
117
  }
118
118
  });
119
119
  export {
120
- K as default
120
+ J as default
121
121
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteServer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteServer.vue"],"names":[],"mappings":";;;;;;;AAyTA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteServer.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteServer.vue"],"names":[],"mappings":";;;;;;;AA6XA,wBAMG"}
@@ -1,20 +1,21 @@
1
- import { defineComponent as S, ref as c, computed as C, openBlock as V, createBlock as _, withCtx as r, createVNode as i, unref as s, createElementVNode as U, normalizeClass as k, toDisplayString as g, createTextVNode as w } from "vue";
2
- import { ScalarListbox as D, ScalarButton as B, ScalarIcon as L } from "@scalar/components";
3
- import { useToasts as M } from "@scalar/use-toasts";
4
- import N from "./CommandActionForm.vue.js";
5
- import y from "./CommandActionInput.vue.js";
6
- import { useWorkspace as z } from "../../store/store.js";
7
- const E = /* @__PURE__ */ S({
1
+ import { defineComponent as U, ref as v, computed as w, openBlock as s, createBlock as c, withCtx as a, createVNode as u, unref as n, createElementVNode as p, normalizeClass as h, toDisplayString as y, createTextVNode as D } from "vue";
2
+ import { ScalarListbox as N, ScalarButton as f, ScalarIcon as P } from "@scalar/components";
3
+ import { useToasts as B } from "@scalar/use-toasts";
4
+ import L from "./CommandActionForm.vue.js";
5
+ import M from "./CommandActionInput.vue.js";
6
+ import { useWorkspace as T } from "../../store/store.js";
7
+ const j = /* @__PURE__ */ p("span", { class: "text-c-1" }, "Create Collection", -1), q = /* @__PURE__ */ U({
8
8
  __name: "CommandPaletteServer",
9
9
  emits: ["close", "back"],
10
- setup(P, { emit: d }) {
11
- const n = d, { toast: m } = M(), {
12
- activeCollection: v,
13
- activeWorkspaceCollections: f,
14
- collectionMutators: p,
15
- serverMutators: b
16
- } = z(), a = c(""), u = C(
17
- () => f.value.flatMap(
10
+ setup(z, { emit: b }) {
11
+ const d = b, { toast: m } = B(), {
12
+ activeCollection: C,
13
+ activeWorkspaceCollections: x,
14
+ collectionMutators: S,
15
+ serverMutators: _,
16
+ events: k
17
+ } = T(), r = v(""), i = w(
18
+ () => x.value.flatMap(
18
19
  (l) => {
19
20
  var e, t;
20
21
  return ((e = l.info) == null ? void 0 : e.title) === "Drafts" ? [] : {
@@ -23,65 +24,81 @@ const E = /* @__PURE__ */ S({
23
24
  };
24
25
  }
25
26
  )
26
- ), o = c(
27
- u.value.find(
27
+ ), o = v(
28
+ i.value.find(
28
29
  (l) => {
29
30
  var e;
30
- return l.id === ((e = v.value) == null ? void 0 : e.uid);
31
+ return l.id === ((e = C.value) == null ? void 0 : e.uid);
31
32
  }
32
33
  )
33
- ), x = () => {
34
+ ), V = () => {
34
35
  var t;
35
- if (!a.value.trim()) {
36
+ if (!r.value.trim()) {
36
37
  m("Please enter a valid url before creating a server.", "error");
37
38
  return;
38
39
  }
39
40
  const l = (t = o.value) == null ? void 0 : t.id;
40
- if (!l) return;
41
- const e = b.add({ url: a.value }, l);
42
- p.edit(l, "selectedServerUid", e.uid), n("close");
41
+ if (!l) {
42
+ m("Please select a collection before creating a server.", "error");
43
+ return;
44
+ }
45
+ const e = _.add({ url: r.value }, l);
46
+ S.edit(l, "selectedServerUid", e.uid), d("close");
47
+ }, g = () => {
48
+ k.commandPalette.emit({ commandName: "Create Collection" });
43
49
  };
44
- return (l, e) => (V(), _(N, {
45
- disabled: !a.value.trim(),
46
- onSubmit: x
50
+ return (l, e) => (s(), c(L, {
51
+ disabled: !r.value.trim() || !o.value,
52
+ onSubmit: V
47
53
  }, {
48
- options: r(() => [
49
- i(s(D), {
54
+ options: a(() => [
55
+ u(n(N), {
50
56
  modelValue: o.value,
51
57
  "onUpdate:modelValue": e[2] || (e[2] = (t) => o.value = t),
52
- options: u.value
58
+ options: i.value
53
59
  }, {
54
- default: r(() => [
55
- i(s(B), {
60
+ default: a(() => [
61
+ i.value.length > 0 ? (s(), c(n(f), {
62
+ key: 0,
56
63
  class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
57
64
  variant: "outlined"
58
65
  }, {
59
- default: r(() => [
60
- U("span", {
61
- class: k(o.value ? "text-c-1" : "text-c-3")
62
- }, g(o.value ? o.value.label : "Select Collection"), 3),
63
- i(s(L), {
66
+ default: a(() => [
67
+ p("span", {
68
+ class: h(o.value ? "text-c-1" : "text-c-3")
69
+ }, y(o.value ? o.value.label : "Select Collection"), 3),
70
+ u(n(P), {
64
71
  class: "text-c-3",
65
72
  icon: "ChevronDown",
66
73
  size: "xs"
67
74
  })
68
75
  ]),
69
76
  _: 1
70
- })
77
+ })) : (s(), c(n(f), {
78
+ key: 1,
79
+ class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
80
+ variant: "outlined",
81
+ onClick: g
82
+ }, {
83
+ default: a(() => [
84
+ j
85
+ ]),
86
+ _: 1
87
+ }))
71
88
  ]),
72
89
  _: 1
73
90
  }, 8, ["modelValue", "options"])
74
91
  ]),
75
- submit: r(() => [
76
- w("Create Server")
92
+ submit: a(() => [
93
+ D("Create Server")
77
94
  ]),
78
- default: r(() => [
79
- i(y, {
80
- modelValue: a.value,
81
- "onUpdate:modelValue": e[0] || (e[0] = (t) => a.value = t),
95
+ default: a(() => [
96
+ u(M, {
97
+ modelValue: r.value,
98
+ "onUpdate:modelValue": e[0] || (e[0] = (t) => r.value = t),
82
99
  label: "Server URL",
83
100
  placeholder: "Server URL",
84
- onOnDelete: e[1] || (e[1] = (t) => n("back", t))
101
+ onOnDelete: e[1] || (e[1] = (t) => d("back", t))
85
102
  }, null, 8, ["modelValue"])
86
103
  ]),
87
104
  _: 1
@@ -89,5 +106,5 @@ const E = /* @__PURE__ */ S({
89
106
  }
90
107
  });
91
108
  export {
92
- E as default
109
+ q as default
93
110
  };
@@ -84,4 +84,10 @@ export declare const PaletteComponents: {
84
84
  };
85
85
  /** Infer the types from the commands */
86
86
  export type CommandNames = keyof typeof PaletteComponents;
87
+ export type CommandPaletteEvent = {
88
+ /** The command name which matches with the command palette */
89
+ commandName?: CommandNames;
90
+ /** Any extra metadata we want to pass to the command palettes */
91
+ metaData?: Record<string, any>;
92
+ };
87
93
  //# sourceMappingURL=TheCommandPalette.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AAiYA;;;;GAIG;;AACH,wBAybI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQpB,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":"AA8XA;;;;GAIG;;AACH,wBAybI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQpB,CAAA;AAEV,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B,CACA"}
@@ -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-3d5a686d"]]);
5
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-60105bc4"]]);
6
6
  export {
7
- f as PaletteComponents,
8
- r as default
7
+ s as PaletteComponents,
8
+ a as default
9
9
  };