@scalar/api-client 2.22.0 → 2.22.2

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 (62) hide show
  1. package/CHANGELOG.md +56 -0
  2. package/dist/hooks/useClientConfig.d.ts +6 -3
  3. package/dist/hooks/useClientConfig.d.ts.map +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
  7. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  8. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  10. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +23 -29
  11. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  12. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +45 -43
  13. package/dist/v2/components/code-input/CodeInput.vue.d.ts +0 -6
  14. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  15. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  16. package/dist/v2/components/code-input/CodeInput.vue2.js +50 -63
  17. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +0 -3
  18. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  19. package/dist/v2/components/sidebar/Sidebar.vue.js +55 -53
  20. package/dist/v2/features/app/App.vue.d.ts +3 -1
  21. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  22. package/dist/v2/features/app/App.vue.js +46 -43
  23. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  24. package/dist/v2/features/app/app-state.js +33 -28
  25. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  26. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  27. package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -127
  28. package/dist/v2/features/app/index.d.ts +3 -0
  29. package/dist/v2/features/app/index.d.ts.map +1 -1
  30. package/dist/v2/features/app/index.js +17 -11
  31. package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -1
  32. package/dist/v2/features/command-palette/TheCommandPalette.vue.js +1 -1
  33. package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +6 -6
  34. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +2 -2
  35. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  36. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +60 -56
  37. package/dist/v2/features/operation/Operation.vue.js +1 -1
  38. package/dist/v2/features/search/hooks/use-search-index.d.ts +3 -7
  39. package/dist/v2/features/search/hooks/use-search-index.d.ts.map +1 -1
  40. package/dist/v2/features/search/hooks/use-search-index.js +12 -18
  41. package/dist/v2/features/search/index.d.ts +1 -2
  42. package/dist/v2/features/search/index.d.ts.map +1 -1
  43. package/dist/v2/features/search/index.js +2 -4
  44. package/dist/v2/features/search/types.d.ts +1 -1
  45. package/dist/v2/features/search/types.d.ts.map +1 -1
  46. package/dist/v2/helpers/handle-hotkeys.js +1 -1
  47. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  48. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  49. package/dist/views/Request/libs/oauth2.js +54 -52
  50. package/package.json +19 -19
  51. package/dist/v2/features/search/components/SearchButton.vue.d.ts +0 -12
  52. package/dist/v2/features/search/components/SearchButton.vue.d.ts.map +0 -1
  53. package/dist/v2/features/search/components/SearchButton.vue.js +0 -71
  54. package/dist/v2/features/search/components/SearchButton.vue2.js +0 -4
  55. package/dist/v2/features/search/components/SearchModal.vue.d.ts +0 -11
  56. package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +0 -1
  57. package/dist/v2/features/search/components/SearchModal.vue.js +0 -7
  58. package/dist/v2/features/search/components/SearchModal.vue2.js +0 -102
  59. package/dist/v2/features/search/components/SearchResult.vue.d.ts +0 -10
  60. package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +0 -1
  61. package/dist/v2/features/search/components/SearchResult.vue.js +0 -80
  62. package/dist/v2/features/search/components/SearchResult.vue2.js +0 -4
@@ -9,7 +9,7 @@ import { getParentEntry as p } from "@scalar/workspace-store/navigation";
9
9
  import { createWorkspaceStorePersistence as z } from "@scalar/workspace-store/persistence";
10
10
  import { persistencePlugin as J } from "@scalar/workspace-store/plugins/client";
11
11
  import { extensions as M } from "@scalar/workspace-store/schemas/extensions";
12
- import { shallowRef as g, computed as i, ref as l, watch as G } from "vue";
12
+ import { shallowRef as g, computed as u, ref as l, watch as G } from "vue";
13
13
  import { getActiveEnvironment as Q } from "../../helpers/get-active-environment.js";
14
14
  import { getTabDetails as X } from "../../helpers/get-tab-details.js";
15
15
  import { slugify as Z } from "../../helpers/slugify.js";
@@ -21,15 +21,15 @@ const ae = 1e3, v = j({
21
21
  G(c, (e) => {
22
22
  e && e.afterEach((t) => he(t));
23
23
  });
24
- const d = i(() => c.value?.currentRoute.value ?? null);
24
+ const d = u(() => c.value?.currentRoute.value ?? null);
25
25
  function s(e, t) {
26
26
  const a = t?.params[e];
27
27
  if (typeof a == "string")
28
28
  return e === "method" ? a && H(a) ? a : void 0 : decodeURIComponent(a);
29
29
  }
30
- const y = g(null), S = l([]), n = g(null), E = i(() => n.value?.workspace.documents[f.value ?? ""] || null), ne = i(() => Q(n.value, E.value)), { workspace: h } = await z();
30
+ const y = g(null), S = l([]), n = g(null), E = u(() => n.value?.workspace.documents[f.value ?? ""] || null), re = u(() => Q(n.value, E.value)), { workspace: h } = await z();
31
31
  S.value = await h.getAll().then((e) => e.map(({ id: t, name: a }) => ({ id: t, label: a })));
32
- const re = async ({ workspaceId: e }) => R({
32
+ const ne = async ({ workspaceId: e }) => R({
33
33
  plugins: [await J({ workspaceId: e, debounceDelay: ae })]
34
34
  }), oe = async (e) => {
35
35
  const t = await h.getItem(e);
@@ -37,7 +37,7 @@ const re = async ({ workspaceId: e }) => R({
37
37
  return {
38
38
  success: !1
39
39
  };
40
- const a = await re({ workspaceId: e });
40
+ const a = await ne({ workspaceId: e });
41
41
  return a.loadWorkspace(t.workspace), y.value = { id: e, label: t.name }, n.value = a, {
42
42
  success: !0,
43
43
  workspace: a.workspace
@@ -77,7 +77,7 @@ const re = async ({ workspaceId: e }) => R({
77
77
  const a = await q({
78
78
  defaultValue: e ?? t,
79
79
  // Use the provided id if it exists, otherwise use the name
80
- validation: async (u) => !await h.has(u),
80
+ validation: async (i) => !await h.has(i),
81
81
  maxRetries: 100,
82
82
  transformation: Z
83
83
  });
@@ -89,10 +89,10 @@ const re = async ({ workspaceId: e }) => R({
89
89
  n.value = null, m.value = !0;
90
90
  const t = await oe(e);
91
91
  if (t.success) {
92
- const o = t.workspace["x-scalar-active-tab"] ?? 0, u = t.workspace["x-scalar-tabs"], W = u?.[o];
93
- W && await c.value?.replace(W.path), u && o >= u.length && v.emit("tabs:update:tabs", {
92
+ const o = t.workspace["x-scalar-active-tab"] ?? 0, i = t.workspace["x-scalar-tabs"], W = i?.[o];
93
+ W && await c.value?.replace(W.path), i && o >= i.length && v.emit("tabs:update:tabs", {
94
94
  "x-scalar-active-tab": 0
95
- }), u || v.emit("tabs:update:tabs", {
95
+ }), i || v.emit("tabs:update:tabs", {
96
96
  "x-scalar-tabs": [I(d.value)],
97
97
  "x-scalar-active-tab": 0
98
98
  }), m.value = !1;
@@ -105,7 +105,7 @@ const re = async ({ workspaceId: e }) => R({
105
105
  if (m.value = !1, !a)
106
106
  return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
107
107
  r.reset();
108
- }, L = i(() => {
108
+ }, L = u(() => {
109
109
  const e = n.value;
110
110
  if (!e)
111
111
  return [];
@@ -116,7 +116,7 @@ const re = async ({ workspaceId: e }) => R({
116
116
  path: t,
117
117
  method: a,
118
118
  example: o
119
- }) => JSON.stringify([e, t, a, o].filter(D)), T = i(
119
+ }) => JSON.stringify([e, t, a, o].filter(D)), T = u(
120
120
  () => Y({
121
121
  items: L.value,
122
122
  nestedKey: "children",
@@ -146,16 +146,21 @@ const re = async ({ workspaceId: e }) => R({
146
146
  console.warn(`Could not find sidebar entry with id ${e} to select`);
147
147
  return;
148
148
  }
149
- if (r.isSelected(e)) {
150
- r.setExpanded(e, !r.isExpanded(e));
151
- return;
152
- }
153
- if (t.type === "document")
154
- return r.setSelected(e), r.setExpanded(e, !r.isExpanded(e)), c.value?.push({
149
+ if (t.type === "document") {
150
+ if (r.selectedItem.value === e) {
151
+ r.setExpanded(e, !r.isExpanded(e));
152
+ return;
153
+ }
154
+ return r.setSelected(e), r.setExpanded(e, !0), c.value?.push({
155
155
  name: "document.overview",
156
156
  params: { documentSlug: t.name }
157
157
  });
158
+ }
158
159
  if (t.type === "operation") {
160
+ if (r.isSelected(e)) {
161
+ r.setExpanded(e, !r.isExpanded(e));
162
+ return;
163
+ }
159
164
  const a = t.children?.find((o) => o.type === "example");
160
165
  return a ? (r.setSelected(a.id), r.setExpanded(a.id, !0)) : r.setSelected(e), c.value?.push({
161
166
  name: "example",
@@ -168,7 +173,7 @@ const re = async ({ workspaceId: e }) => R({
168
173
  });
169
174
  }
170
175
  if (t.type === "example") {
171
- r.setSelected(e), r.setExpanded(e, !0);
176
+ r.setSelected(e);
172
177
  const a = p("operation", t);
173
178
  return c.value?.push({
174
179
  name: "example",
@@ -188,14 +193,14 @@ const re = async ({ workspaceId: e }) => R({
188
193
  }
189
194
  });
190
195
  r.setExpanded(e, !r.isExpanded(e));
191
- }, ie = async () => {
196
+ }, ue = async () => {
192
197
  if (!n.value)
193
198
  return;
194
199
  const e = n.value.workspace["x-scalar-active-tab"] ?? 0, t = n.value.workspace["x-scalar-tabs"]?.[e];
195
200
  t && await c.value?.replace(t.path);
196
201
  }, P = (e) => {
197
202
  e && n.value?.buildSidebar(e);
198
- }, ue = (e) => {
203
+ }, ie = (e) => {
199
204
  const t = E.value?.["x-scalar-navigation"]?.name;
200
205
  if (!t)
201
206
  return;
@@ -206,11 +211,11 @@ const re = async ({ workspaceId: e }) => R({
206
211
  example: e.exampleKey
207
212
  });
208
213
  (!a || a.type !== "example") && (P(t), d.value && K(d.value));
209
- }, le = 288, pe = i(() => n.value?.workspace?.["x-scalar-sidebar-width"] ?? le), de = (e) => n.value?.update("x-scalar-sidebar-width", e), k = l(!0), me = "x-scalar-tabs", ve = "x-scalar-active-tab", I = (e) => {
210
- const t = s("method", e), a = s("pathEncoded", e), o = s("documentSlug", e), u = s("workspaceSlug", e);
214
+ }, le = 288, pe = u(() => n.value?.workspace?.["x-scalar-sidebar-width"] ?? le), de = (e) => n.value?.update("x-scalar-sidebar-width", e), k = l(!0), me = "x-scalar-tabs", ve = "x-scalar-active-tab", I = (e) => {
215
+ const t = s("method", e), a = s("pathEncoded", e), o = s("documentSlug", e), i = s("workspaceSlug", e);
211
216
  return {
212
217
  ...X({
213
- workspace: u,
218
+ workspace: i,
214
219
  document: o,
215
220
  path: a,
216
221
  method: t,
@@ -218,7 +223,7 @@ const re = async ({ workspaceId: e }) => R({
218
223
  }),
219
224
  path: d.value?.path ?? ""
220
225
  };
221
- }, _ = i(() => n.value?.workspace[me] ?? [I(d.value)]), fe = i(() => n.value?.workspace[ve] ?? 0), F = async (e) => {
226
+ }, _ = u(() => n.value?.workspace[me] ?? [I(d.value)]), fe = u(() => n.value?.workspace[ve] ?? 0), F = async (e) => {
222
227
  const t = _.value[e];
223
228
  if (!t) {
224
229
  console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
@@ -260,9 +265,9 @@ te({
260
265
  eventBus: v,
261
266
  router: c,
262
267
  store: n,
263
- navigateToCurrentTab: ie,
268
+ navigateToCurrentTab: ue,
264
269
  rebuildSidebar: P,
265
- onAfterExampleCreation: ue,
270
+ onAfterExampleCreation: ie,
266
271
  onSelectSidebarItem: N,
267
272
  onCopyTabUrl: (e) => F(e),
268
273
  onToggleSidebar: () => k.value = !k.value
@@ -289,7 +294,7 @@ function Le(e) {
289
294
  workspaceList: S,
290
295
  activeWorkspace: y,
291
296
  setId: B,
292
- isOpen: i(() => !!(x.value && !f.value))
297
+ isOpen: u(() => !!(x.value && !f.value))
293
298
  },
294
299
  eventBus: v,
295
300
  router: c,
@@ -302,7 +307,7 @@ function Le(e) {
302
307
  method: A,
303
308
  exampleName: U
304
309
  },
305
- environment: ne,
310
+ environment: re,
306
311
  document: E
307
312
  };
308
313
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AAqdA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAM3B,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,MAAM,EAAE,YAAY,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAE1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C;;;OAGG;IACH,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAgBJ,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,kBAAkB,CAAC,IAAI,OAAO,CAAA;CAC/B,CAAC;AAmLF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;AAwdF,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AAkeA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAO3B,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,MAAM,EAAE,YAAY,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAE1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C;;;OAGG;IACH,UAAU,EAAE,mBAAmB,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAgBJ,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,kBAAkB,CAAC,IAAI,OAAO,CAAA;CAC/B,CAAC;AAmLF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;AAqfF,QAAA,MAAM,eAAe;;;;;;;;;;;;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AppSidebar.vue2.js";
2
2
  /* empty css */
3
3
  import p from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-e30bf25b"]]);
4
+ const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-b574e7b1"]]);
5
5
  export {
6
6
  e as default
7
7
  };
@@ -1,23 +1,24 @@
1
- import { defineComponent as q, mergeModels as C, computed as f, capitalize as V, useModel as W, ref as G, createElementBlock as g, openBlock as u, createVNode as l, createBlock as B, createCommentVNode as c, unref as i, createSlots as R, withCtx as r, createTextVNode as y, createElementVNode as d, withKeys as k, withModifiers as p, toDisplayString as j, renderSlot as F, normalizeClass as H, nextTick as L } from "vue";
2
- import { useModal as U, ScalarSidebarItem as I, ScalarIconButton as J, ScalarButton as $, ScalarModal as Y } from "@scalar/components";
3
- import { ScalarIconPlus as Q, ScalarIconDotsThree as X, ScalarIconGlobe as Z } from "@scalar/icons";
4
- import { getParentEntry as w } from "@scalar/workspace-store/navigation";
5
- import _ from "../../../../assets/rabbit.ascii.js";
6
- import ee from "../../../../assets/rabbitjump.ascii.js";
1
+ import { defineComponent as R, mergeModels as W, computed as k, capitalize as V, useModel as I, ref as F, createElementBlock as c, openBlock as u, createVNode as d, createBlock as M, createCommentVNode as p, unref as s, createSlots as G, withCtx as r, createTextVNode as b, createElementVNode as l, withKeys as w, withModifiers as v, toDisplayString as L, renderSlot as j, normalizeClass as H, Fragment as h, nextTick as U } from "vue";
2
+ import { useModal as J, ScalarSidebarItem as O, ScalarIconButton as Y, ScalarButton as $, ScalarModal as Q } from "@scalar/components";
3
+ import { isMacOS as X } from "@scalar/helpers/general/is-mac-os";
4
+ import { ScalarIconPlus as Z, ScalarIconDotsThree as _, ScalarIconGlobe as ee } from "@scalar/icons";
5
+ import { getParentEntry as S } from "@scalar/workspace-store/navigation";
6
+ import te from "../../../../assets/rabbit.ascii.js";
7
+ import ae from "../../../../assets/rabbitjump.ascii.js";
7
8
  import E from "../../../../components/ScalarAsciiArt.vue.js";
8
- import te from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
9
- import ae from "./SidebarItemMenu.vue.js";
10
- import { dragHandleFactory as oe } from "../../../helpers/drag-handle-factory.js";
11
- import ne from "../../../components/sidebar/Sidebar.vue.js";
12
- const ie = { class: "flex" }, se = {
9
+ import oe from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
10
+ import ne from "./SidebarItemMenu.vue.js";
11
+ import { dragHandleFactory as se } from "../../../helpers/drag-handle-factory.js";
12
+ import ie from "../../../components/sidebar/Sidebar.vue.js";
13
+ const re = { class: "flex" }, le = {
13
14
  key: 0,
14
15
  class: "flex items-center"
15
- }, re = {
16
+ }, de = {
16
17
  key: 0,
17
18
  class: "empty-sidebar-item-content overflow-hidden px-2.5 py-2.5"
18
- }, le = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, de = { class: "gap-1.5 p-2" }, ge = /* @__PURE__ */ q({
19
+ }, ue = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, me = { class: "gap-1.5 p-2" }, ce = { class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase" }, Ce = /* @__PURE__ */ R({
19
20
  __name: "AppSidebar",
20
- props: /* @__PURE__ */ C({
21
+ props: /* @__PURE__ */ W({
21
22
  layout: {},
22
23
  sidebarState: {},
23
24
  isWorkspaceOpen: { type: Boolean },
@@ -34,65 +35,65 @@ const ie = { class: "flex" }, se = {
34
35
  },
35
36
  sidebarWidthModifiers: {}
36
37
  }),
37
- emits: /* @__PURE__ */ C(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
38
- setup(a, { emit: O }) {
39
- const v = O, A = f(() => V(a.activeWorkspace.label)), M = W(a, "isSidebarOpen"), h = W(a, "sidebarWidth"), S = f(() => a.sidebarState.items.value.length <= 1), x = f(
40
- () => oe({
41
- store: a.store,
42
- sidebarState: a.sidebarState
38
+ emits: /* @__PURE__ */ W(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
39
+ setup(o, { emit: A }) {
40
+ const f = A, D = k(() => V(o.activeWorkspace.label)), x = I(o, "isSidebarOpen"), B = I(o, "sidebarWidth"), g = k(() => o.sidebarState.items.value.length <= 1), C = k(
41
+ () => se({
42
+ store: o.store,
43
+ sidebarState: o.sidebarState
43
44
  })
44
- ), D = (o, e) => x.value.handleDragEnd(o, e), N = (o, e) => x.value.isDroppable(o, e), s = G(null), b = U(), T = f(() => {
45
- const o = s.value?.item;
46
- return o?.type === "document" ? "This cannot be undone. You're about to delete the document and all tags and operations inside it." : `Are you sure you want to delete this ${o?.type ?? "item"}? This action cannot be undone.`;
45
+ ), N = (a, e) => C.value.handleDragEnd(a, e), T = (a, e) => C.value.isDroppable(a, e), i = F(null), y = J(), K = k(() => {
46
+ const a = i.value?.item;
47
+ return a?.type === "document" ? "This cannot be undone. You're about to delete the document and all tags and operations inside it." : `Are you sure you want to delete this ${a?.type ?? "item"}? This action cannot be undone.`;
47
48
  }), z = () => {
48
- const o = s.value?.item;
49
- if (!o)
49
+ const a = i.value?.item;
50
+ if (!a)
50
51
  return;
51
- const e = a.sidebarState.getEntryById(o.id), t = w("document", e), n = w("operation", e);
52
+ const e = o.sidebarState.getEntryById(a.id), t = S("document", e), n = S("operation", e);
52
53
  if (t) {
53
- if (o.type === "document")
54
- a.eventBus.emit("document:delete:document", { name: t.name });
55
- else if (o.type === "tag")
56
- a.eventBus.emit("tag:delete:tag", {
54
+ if (a.type === "document")
55
+ o.eventBus.emit("document:delete:document", { name: t.name });
56
+ else if (a.type === "tag")
57
+ o.eventBus.emit("tag:delete:tag", {
57
58
  documentName: t.name,
58
- name: o.name
59
+ name: a.name
59
60
  });
60
- else if (o.type === "operation") {
61
+ else if (a.type === "operation") {
61
62
  if (!n)
62
63
  return;
63
- a.eventBus.emit("operation:delete:operation", {
64
+ o.eventBus.emit("operation:delete:operation", {
64
65
  meta: {
65
66
  method: n.method,
66
67
  path: n.path
67
68
  },
68
69
  documentName: t.name
69
70
  });
70
- } else if (o.type === "example") {
71
+ } else if (a.type === "example") {
71
72
  if (!n)
72
73
  return;
73
- a.eventBus.emit("operation:delete:example", {
74
+ o.eventBus.emit("operation:delete:example", {
74
75
  meta: {
75
76
  method: n.method,
76
77
  path: n.path,
77
- exampleKey: o.name
78
+ exampleKey: a.name
78
79
  },
79
80
  documentName: t.name
80
81
  });
81
82
  }
82
- b.hide(), s.value = null;
83
+ y.hide(), i.value = null;
83
84
  }
84
- }, m = async (o, e) => {
85
- if (s.value?.showMenu)
85
+ }, m = async (a, e) => {
86
+ if (i.value?.showMenu)
86
87
  return;
87
- const t = o.currentTarget;
88
- s.value = { item: e, el: t, showMenu: !0 }, await L();
89
- const n = o instanceof MouseEvent ? new MouseEvent(o.type, o) : new KeyboardEvent(o.type, o);
90
- s.value?.el.dispatchEvent(n);
91
- }, K = () => {
92
- s.value && (s.value.showMenu = !1);
93
- }, P = (o) => {
94
- const e = a.sidebarState.getEntryById(o.id), t = w("document", e), n = w("tag", e);
95
- a.eventBus.emit("ui:open:command-palette", {
88
+ const t = a.currentTarget;
89
+ i.value = { item: e, el: t, showMenu: !0 }, await U();
90
+ const n = a instanceof MouseEvent ? new MouseEvent(a.type, a) : new KeyboardEvent(a.type, a);
91
+ i.value?.el.dispatchEvent(n);
92
+ }, P = () => {
93
+ i.value && (i.value.showMenu = !1);
94
+ }, q = (a) => {
95
+ const e = o.sidebarState.getEntryById(a.id), t = S("document", e), n = S("tag", e);
96
+ o.eventBus.emit("ui:open:command-palette", {
96
97
  action: "create-request",
97
98
  payload: {
98
99
  documentId: t?.id,
@@ -100,127 +101,136 @@ const ie = { class: "flex" }, se = {
100
101
  }
101
102
  });
102
103
  };
103
- return (o, e) => (u(), g("div", ie, [
104
- l(i(ne), {
105
- isSidebarOpen: M.value,
106
- "onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => M.value = t),
107
- sidebarWidth: h.value,
108
- "onUpdate:sidebarWidth": e[4] || (e[4] = (t) => h.value = t),
109
- activeWorkspace: a.activeWorkspace,
110
- documents: Object.values(a.store.workspace.documents),
111
- eventBus: a.eventBus,
112
- isDroppable: N,
113
- layout: a.layout,
114
- sidebarState: a.sidebarState,
115
- workspaces: a.workspaces,
116
- "onCreate:workspace": e[5] || (e[5] = (t) => v("create:workspace")),
117
- onReorder: e[6] || (e[6] = (t, n) => D(t, n)),
118
- "onSelect:workspace": e[7] || (e[7] = (t) => v("select:workspace", t)),
119
- onSelectItem: e[8] || (e[8] = (t) => v("selectItem", t))
120
- }, R({
104
+ return (a, e) => (u(), c("div", re, [
105
+ d(s(ie), {
106
+ isSidebarOpen: x.value,
107
+ "onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => x.value = t),
108
+ sidebarWidth: B.value,
109
+ "onUpdate:sidebarWidth": e[4] || (e[4] = (t) => B.value = t),
110
+ activeWorkspace: o.activeWorkspace,
111
+ documents: Object.values(o.store.workspace.documents),
112
+ isDroppable: T,
113
+ layout: o.layout,
114
+ sidebarState: o.sidebarState,
115
+ workspaces: o.workspaces,
116
+ "onCreate:workspace": e[5] || (e[5] = (t) => f("create:workspace")),
117
+ onReorder: e[6] || (e[6] = (t, n) => N(t, n)),
118
+ "onSelect:workspace": e[7] || (e[7] = (t) => f("select:workspace", t)),
119
+ onSelectItem: e[8] || (e[8] = (t) => f("selectItem", t))
120
+ }, G({
121
121
  sidebarMenuActions: r(() => [
122
- F(o.$slots, "sidebarMenuActions", {}, void 0, !0)
122
+ j(a.$slots, "sidebarMenuActions", {}, void 0, !0)
123
123
  ]),
124
124
  workspaceButton: r(() => [
125
- l(i(I), {
125
+ d(s(O), {
126
126
  is: "button",
127
- active: a.isWorkspaceOpen,
128
- icon: i(Z),
129
- onClick: e[0] || (e[0] = (t) => v("click:workspace"))
127
+ active: o.isWorkspaceOpen,
128
+ icon: s(ee),
129
+ onClick: e[0] || (e[0] = (t) => f("click:workspace"))
130
130
  }, {
131
131
  default: r(() => [
132
- y(j(A.value), 1)
132
+ b(L(D.value), 1)
133
133
  ]),
134
134
  _: 1
135
135
  }, 8, ["active", "icon"])
136
136
  ]),
137
137
  decorator: r(({ item: t }) => [
138
- l(i(J), {
138
+ d(s(Y), {
139
139
  "aria-expanded": "false",
140
140
  "aria-haspopup": "menu",
141
- icon: i(X),
141
+ icon: s(_),
142
142
  label: "More options",
143
143
  size: "sm",
144
144
  weight: "bold",
145
- onClick: p((n) => m(n, t), ["stop"]),
145
+ onClick: v((n) => m(n, t), ["stop"]),
146
146
  onKeydown: [
147
- k(p((n) => m(n, t), ["stop"]), ["down"]),
148
- k(p((n) => m(n, t), ["stop"]), ["enter"]),
149
- k(p((n) => m(n, t), ["stop"]), ["space"]),
150
- k(p((n) => m(n, t), ["stop"]), ["up"])
147
+ w(v((n) => m(n, t), ["stop"]), ["down"]),
148
+ w(v((n) => m(n, t), ["stop"]), ["enter"]),
149
+ w(v((n) => m(n, t), ["stop"]), ["space"]),
150
+ w(v((n) => m(n, t), ["stop"]), ["up"])
151
151
  ]
152
152
  }, null, 8, ["icon", "onClick", "onKeydown"])
153
153
  ]),
154
154
  icon: r(({ item: t }) => [
155
- t.type === "document" && a.store.workspace.documents[t.name]?.["x-scalar-is-dirty"] === !0 ? (u(), g("div", se, [...e[11] || (e[11] = [
156
- d("div", { class: "h-2 w-2 rounded-full bg-white" }, null, -1)
157
- ])])) : c("", !0)
155
+ t.type === "document" && o.store.workspace.documents[t.name]?.["x-scalar-is-dirty"] === !0 ? (u(), c("div", le, [...e[11] || (e[11] = [
156
+ l("div", { class: "h-2 w-2 rounded-full bg-white" }, null, -1)
157
+ ])])) : p("", !0)
158
158
  ]),
159
159
  empty: r(({ item: t }) => [
160
- l(i(I), {
160
+ d(s(O), {
161
161
  is: "button",
162
- onClick: (n) => P(t)
162
+ onClick: (n) => q(t)
163
163
  }, {
164
164
  icon: r(() => [
165
- l(i(Q))
165
+ d(s(Z))
166
166
  ]),
167
167
  default: r(() => [...e[12] || (e[12] = [
168
- y("Add operation", -1)
168
+ b("Add operation", -1)
169
169
  ])]),
170
170
  _: 1
171
171
  }, 8, ["onClick"])
172
172
  ]),
173
173
  _: 2
174
174
  }, [
175
- a.layout !== "modal" ? {
175
+ o.layout !== "modal" ? {
176
176
  name: "footer",
177
177
  fn: r(() => [
178
- d("div", {
178
+ l("div", {
179
179
  class: H({
180
- "empty-sidebar-item border-t": S.value
180
+ "empty-sidebar-item border-t": g.value
181
181
  })
182
182
  }, [
183
- S.value ? (u(), g("div", re, [
184
- d("div", le, [
185
- l(E, {
186
- art: i(_),
183
+ g.value ? (u(), c("div", de, [
184
+ l("div", ue, [
185
+ d(E, {
186
+ art: s(te),
187
187
  class: "rabbitsit font-bold"
188
188
  }, null, 8, ["art"]),
189
- l(E, {
190
- art: i(ee),
189
+ d(E, {
190
+ art: s(ae),
191
191
  class: "rabbitjump absolute top-0 left-0 font-bold"
192
192
  }, null, 8, ["art"])
193
193
  ]),
194
- e[13] || (e[13] = d("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
195
- d("b", { class: "font-medium" }, "Let's Get Started"),
196
- d("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
194
+ e[13] || (e[13] = l("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
195
+ l("b", { class: "font-medium" }, "Let's Get Started"),
196
+ l("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
197
197
  ], -1))
198
- ])) : c("", !0),
199
- d("div", de, [
200
- S.value ? (u(), B(i($), {
198
+ ])) : p("", !0),
199
+ l("div", me, [
200
+ g.value ? (u(), M(s($), {
201
201
  key: 0,
202
202
  class: "w-full",
203
203
  size: "sm",
204
- onClick: e[1] || (e[1] = (t) => a.eventBus.emit("ui:open:command-palette", {
204
+ onClick: e[1] || (e[1] = (t) => o.eventBus.emit("ui:open:command-palette", {
205
205
  action: "import-from-openapi-swagger-postman-curl",
206
206
  payload: void 0
207
207
  }))
208
208
  }, {
209
209
  default: r(() => [...e[14] || (e[14] = [
210
- y(" Import Collection ", -1)
210
+ b(" Import Collection ", -1)
211
211
  ])]),
212
212
  _: 1
213
- })) : c("", !0),
214
- l(i($), {
213
+ })) : p("", !0),
214
+ d(s($), {
215
215
  class: "w-full",
216
216
  hotkey: "K",
217
217
  size: "sm",
218
218
  variant: "outlined",
219
- onClick: e[2] || (e[2] = (t) => a.eventBus.emit("ui:open:command-palette"))
219
+ onClick: e[2] || (e[2] = (t) => o.eventBus.emit("ui:open:command-palette"))
220
220
  }, {
221
- default: r(() => [...e[15] || (e[15] = [
222
- y(" Add Item ", -1)
223
- ])]),
221
+ default: r(() => [
222
+ e[20] || (e[20] = b(" Add Item   ", -1)),
223
+ l("span", ce, [
224
+ s(X)() ? (u(), c(h, { key: 0 }, [
225
+ e[15] || (e[15] = l("span", { class: "sr-only" }, "Command", -1)),
226
+ e[16] || (e[16] = l("span", { "aria-hidden": "true" }, "⌘", -1))
227
+ ], 64)) : (u(), c(h, { key: 1 }, [
228
+ e[17] || (e[17] = l("span", { class: "sr-only" }, "CTRL", -1)),
229
+ e[18] || (e[18] = l("span", { "aria-hidden": "true" }, "⌃", -1))
230
+ ], 64)),
231
+ e[19] || (e[19] = b(" K ", -1))
232
+ ])
233
+ ]),
224
234
  _: 1
225
235
  })
226
236
  ])
@@ -228,35 +238,35 @@ const ie = { class: "flex" }, se = {
228
238
  ]),
229
239
  key: "0"
230
240
  } : void 0
231
- ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "eventBus", "layout", "sidebarState", "workspaces"]),
232
- s.value?.showMenu ? (u(), B(ae, {
241
+ ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "layout", "sidebarState", "workspaces"]),
242
+ i.value?.showMenu ? (u(), M(ne, {
233
243
  key: 0,
234
- eventBus: a.eventBus,
235
- item: s.value.item,
236
- sidebarState: a.sidebarState,
237
- target: s.value.el,
238
- onCloseMenu: K,
239
- onShowDeleteModal: e[9] || (e[9] = (t) => i(b).show())
240
- }, null, 8, ["eventBus", "item", "sidebarState", "target"])) : c("", !0),
241
- s.value ? (u(), B(i(Y), {
244
+ eventBus: o.eventBus,
245
+ item: i.value.item,
246
+ sidebarState: o.sidebarState,
247
+ target: i.value.el,
248
+ onCloseMenu: P,
249
+ onShowDeleteModal: e[9] || (e[9] = (t) => s(y).show())
250
+ }, null, 8, ["eventBus", "item", "sidebarState", "target"])) : p("", !0),
251
+ i.value ? (u(), M(s(Q), {
242
252
  key: 1,
243
253
  size: "xxs",
244
- state: i(b),
245
- title: `Delete ${s.value.item.title}`
254
+ state: s(y),
255
+ title: `Delete ${i.value.item.title}`
246
256
  }, {
247
257
  default: r(() => [
248
- l(te, {
249
- variableName: s.value.item.title,
250
- warningMessage: T.value,
251
- onClose: e[10] || (e[10] = (t) => i(b).hide()),
258
+ d(oe, {
259
+ variableName: i.value.item.title,
260
+ warningMessage: K.value,
261
+ onClose: e[10] || (e[10] = (t) => s(y).hide()),
252
262
  onDelete: z
253
263
  }, null, 8, ["variableName", "warningMessage"])
254
264
  ]),
255
265
  _: 1
256
- }, 8, ["state", "title"])) : c("", !0)
266
+ }, 8, ["state", "title"])) : p("", !0)
257
267
  ]));
258
268
  }
259
269
  });
260
270
  export {
261
- ge as default
271
+ Ce as default
262
272
  };
@@ -1,4 +1,7 @@
1
1
  export { type AppState, useAppState } from '../../../v2/features/app/app-state.js';
2
+ export { default as CreateWorkspaceModal } from '../../../v2/features/app/components/CreateWorkspaceModal.vue.js';
3
+ export { default as CommandActionForm } from '../../../v2/features/command-palette/components/CommandActionForm.vue.js';
4
+ export { default as CommandActionInput } from '../../../v2/features/command-palette/components/CommandActionInput.vue.js';
2
5
  export type { ClientPlugin } from '../../../v2/helpers/plugins.js';
3
6
  export type { ClientLayout } from '../../../v2/types/layout';
4
7
  export { type CommandPaletteAction, type CommandPaletteRoute, baseClientActions, baseRoutes, useCommandPaletteState, } from '../command-palette/hooks/use-command-palette-state.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACxE,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,UAAU,EACV,sBAAsB,GACvB,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,QAAQ,EAAE,WAAW,EAAE,MAAM,6BAA6B,CAAA;AACxE,OAAO,EAAE,OAAO,IAAI,oBAAoB,EAAE,MAAM,uDAAuD,CAAA;AACvG,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,gEAAgE,CAAA;AAC7G,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,iEAAiE,CAAA;AAC/G,YAAY,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,YAAY,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,iBAAiB,EACjB,UAAU,EACV,sBAAsB,GACvB,MAAM,oDAAoD,CAAA;AAC3D,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,WAAW,CAAA;AAChD,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAA"}