@scalar/api-client 2.19.3 → 2.20.0

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 (50) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +0 -9
  4. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +126 -67
  6. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
  7. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  8. package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
  9. package/dist/v2/blocks/operation-block/components/Header.vue2.js +25 -24
  10. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -1
  12. package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +1 -1
  13. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  14. package/dist/v2/blocks/operation-block/helpers/build-request.js +41 -39
  15. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts +42 -0
  16. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.d.ts.map +1 -0
  17. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +31 -0
  18. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +66 -0
  19. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts.map +1 -0
  20. package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js +43 -0
  21. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -0
  22. package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
  23. package/dist/v2/blocks/operation-block/helpers/send-request.js +40 -38
  24. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
  25. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +6 -0
  26. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  27. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
  28. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +24 -23
  29. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -3
  30. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
  31. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
  32. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +20 -20
  33. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -0
  34. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  35. package/dist/v2/components/sidebar/Sidebar.vue.js +60 -54
  36. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  37. package/dist/v2/features/app/app-events.js +53 -42
  38. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  39. package/dist/v2/features/app/app-state.js +72 -72
  40. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  41. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  42. package/dist/v2/features/app/components/AppSidebar.vue2.js +84 -76
  43. package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
  44. package/dist/v2/features/collection/DocumentCollection.vue.js +82 -43
  45. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/v2/features/operation/Operation.vue.js +2 -3
  47. package/dist/v2/workspace-events.d.ts.map +1 -1
  48. package/dist/v2/workspace-events.js +12 -6
  49. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  50. package/package.json +13 -13
@@ -1,49 +1,49 @@
1
1
  import { isDefined as C } from "@scalar/helpers/array/is-defined";
2
- import { sortByOrder as $ } from "@scalar/helpers/array/sort-by-order";
3
- import { isHttpMethod as H } from "@scalar/helpers/http/is-http-method";
4
- import { createSidebarState as V, generateReverseIndex as Y } from "@scalar/sidebar";
2
+ import { sortByOrder as H } from "@scalar/helpers/array/sort-by-order";
3
+ import { isHttpMethod as V } from "@scalar/helpers/http/is-http-method";
4
+ import { createSidebarState as Y, generateReverseIndex as j } from "@scalar/sidebar";
5
5
  import { createWorkspaceStore as D } from "@scalar/workspace-store/client";
6
- import { createWorkspaceEventBus as j } from "@scalar/workspace-store/events";
7
- import { generateUniqueValue as q } from "@scalar/workspace-store/helpers/generate-unique-value";
6
+ import { createWorkspaceEventBus as q } from "@scalar/workspace-store/events";
7
+ import { generateUniqueValue as z } from "@scalar/workspace-store/helpers/generate-unique-value";
8
8
  import { getParentEntry as p } from "@scalar/workspace-store/navigation";
9
- import { createWorkspaceStorePersistence as z } from "@scalar/workspace-store/persistence";
10
- import { persistencePlugin as J } from "@scalar/workspace-store/plugins/client";
11
- import { extensions as M } from "@scalar/workspace-store/schemas/extensions";
12
- import { shallowRef as g, computed as i, ref as u, watch as G } from "vue";
13
- import { getActiveEnvironment as Q } from "../../helpers/get-active-environment.js";
14
- import { getTabDetails as X } from "../../helpers/get-tab-details.js";
15
- import { slugify as Z } from "../../helpers/slugify.js";
16
- import { workspaceStorage as ee } from "../../helpers/storage.js";
17
- import { useCommandPaletteState as te } from "../command-palette/hooks/use-command-palette-state.js";
18
- import { initializeAppEventHandlers as ae } from "./app-events.js";
19
- const ne = 1e3, m = j({
9
+ import { createWorkspaceStorePersistence as J } from "@scalar/workspace-store/persistence";
10
+ import { persistencePlugin as M } from "@scalar/workspace-store/plugins/client";
11
+ import { extensions as G } from "@scalar/workspace-store/schemas/extensions";
12
+ import { shallowRef as g, computed as i, ref as u, watch as Q } from "vue";
13
+ import { getActiveEnvironment as X } from "../../helpers/get-active-environment.js";
14
+ import { getTabDetails as Z } from "../../helpers/get-tab-details.js";
15
+ import { slugify as ee } from "../../helpers/slugify.js";
16
+ import { workspaceStorage as te } from "../../helpers/storage.js";
17
+ import { useCommandPaletteState as ae } from "../command-palette/hooks/use-command-palette-state.js";
18
+ import { initializeAppEventHandlers as ne } from "./app-events.js";
19
+ const re = 1e3, v = q({
20
20
  debug: !1
21
- }), x = u(void 0), v = u(void 0), R = u(void 0), A = u(void 0), U = u(void 0), d = u(!1), c = g(null);
22
- G(c, (e) => {
23
- e && e.afterEach((t) => we(t));
21
+ }), x = u(void 0), f = u(void 0), R = u(void 0), A = u(void 0), U = u(void 0), m = u(!1), c = g(null);
22
+ Q(c, (e) => {
23
+ e && e.afterEach((t) => xe(t));
24
24
  });
25
- const f = i(() => c.value?.currentRoute.value ?? null);
25
+ const d = i(() => c.value?.currentRoute.value ?? null);
26
26
  function s(e, t) {
27
27
  const a = t?.params[e];
28
28
  if (typeof a == "string")
29
- return e === "method" ? a && H(a) ? a : void 0 : decodeURIComponent(a);
29
+ return e === "method" ? a && V(a) ? a : void 0 : decodeURIComponent(a);
30
30
  }
31
- const S = g(null), y = u([]), n = g(null), E = i(() => n.value?.workspace.documents[v.value ?? ""] || null), re = i(() => Q(n.value, E.value)), { workspace: h } = await z();
31
+ const S = g(null), y = u([]), n = g(null), E = i(() => n.value?.workspace.documents[f.value ?? ""] || null), oe = i(() => X(n.value, E.value)), { workspace: h } = await J();
32
32
  y.value = await h.getAll().then((e) => e.map(({ id: t, name: a }) => ({ id: t, label: a })));
33
- const oe = async ({ workspaceId: e }) => D({
34
- plugins: [await J({ workspaceId: e, debounceDelay: ne })]
35
- }), se = async (e) => {
33
+ const se = async ({ workspaceId: e }) => D({
34
+ plugins: [await M({ workspaceId: e, debounceDelay: re })]
35
+ }), ce = async (e) => {
36
36
  const t = await h.getItem(e);
37
37
  if (!t)
38
38
  return {
39
39
  success: !1
40
40
  };
41
- const a = await oe({ workspaceId: e });
41
+ const a = await se({ workspaceId: e });
42
42
  return a.loadWorkspace(t.workspace), S.value = { id: e, label: t.name }, n.value = a, {
43
43
  success: !0,
44
44
  workspace: a.workspace
45
45
  };
46
- }, ce = async ({ id: e, name: t }) => {
46
+ }, ie = async ({ id: e, name: t }) => {
47
47
  const a = D();
48
48
  await a.addDocument({
49
49
  name: "drafts",
@@ -75,35 +75,35 @@ const oe = async ({ workspaceId: e }) => D({
75
75
  name: t
76
76
  }) => {
77
77
  n.value = null;
78
- const a = await q({
78
+ const a = await z({
79
79
  defaultValue: e ?? t,
80
80
  // Use the provided id if it exists, otherwise use the name
81
81
  validation: async (l) => !await h.has(l),
82
82
  maxRetries: 100,
83
- transformation: Z
83
+ transformation: ee
84
84
  });
85
85
  if (!a)
86
86
  return;
87
87
  const o = { id: a, name: t };
88
- return await ce(o), await B(a), o;
89
- }, ie = async (e) => {
90
- n.value = null, d.value = !0;
91
- const t = await se(e);
88
+ return await ie(o), await B(a), o;
89
+ }, le = async (e) => {
90
+ n.value = null, m.value = !0;
91
+ const t = await ce(e);
92
92
  if (t.success) {
93
93
  const o = t.workspace["x-scalar-active-tab"] ?? 0, l = t.workspace["x-scalar-tabs"], W = l?.[o];
94
- W && await c.value?.replace(W.path), l && o >= l.length && m.emit("tabs:update:tabs", {
94
+ W && await c.value?.replace(W.path), l && o >= l.length && v.emit("tabs:update:tabs", {
95
95
  "x-scalar-active-tab": 0
96
- }), l || m.emit("tabs:update:tabs", {
97
- "x-scalar-tabs": [I(f.value)],
96
+ }), l || v.emit("tabs:update:tabs", {
97
+ "x-scalar-tabs": [I(d.value)],
98
98
  "x-scalar-active-tab": 0
99
- }), d.value = !1;
99
+ }), m.value = !1;
100
100
  return;
101
101
  }
102
102
  const a = await P({
103
103
  name: "Default Workspace",
104
104
  id: "default"
105
105
  });
106
- if (d.value = !1, !a)
106
+ if (m.value = !1, !a)
107
107
  return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
108
108
  r.reset();
109
109
  }, O = i(() => {
@@ -111,14 +111,14 @@ const oe = async ({ workspaceId: e }) => D({
111
111
  if (!e)
112
112
  return [];
113
113
  const t = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
114
- return $(Object.keys(e.workspace.documents), t, (a) => a).map((a) => e.workspace.documents[a]?.["x-scalar-navigation"]).filter(C);
115
- }), r = V(O), b = ({
114
+ return H(Object.keys(e.workspace.documents), t, (a) => a).map((a) => e.workspace.documents[a]?.["x-scalar-navigation"]).filter(C);
115
+ }), r = Y(O), b = ({
116
116
  document: e,
117
117
  path: t,
118
118
  method: a,
119
119
  example: o
120
120
  }) => JSON.stringify([e, t, a, o].filter(C)), T = i(
121
- () => Y({
121
+ () => j({
122
122
  items: O.value,
123
123
  nestedKey: "children",
124
124
  filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
@@ -189,14 +189,14 @@ const oe = async ({ workspaceId: e }) => D({
189
189
  }
190
190
  });
191
191
  r.setExpanded(e, !r.isExpanded(e));
192
- }, le = async () => {
192
+ }, ue = async () => {
193
193
  if (!n.value)
194
194
  return;
195
195
  const e = n.value.workspace["x-scalar-active-tab"] ?? 0, t = n.value.workspace["x-scalar-tabs"]?.[e];
196
196
  t && await c.value?.replace(t.path);
197
197
  }, N = (e) => {
198
198
  e && n.value?.buildSidebar(e);
199
- }, ue = (e) => {
199
+ }, pe = (e) => {
200
200
  const t = E.value?.["x-scalar-navigation"]?.name;
201
201
  if (!t)
202
202
  return;
@@ -206,20 +206,20 @@ const oe = async ({ workspaceId: e }) => D({
206
206
  method: e.method,
207
207
  example: e.exampleKey
208
208
  });
209
- (!a || a.type !== "example") && N(t);
210
- }, pe = 288, de = i(() => n.value?.workspace?.["x-scalar-sidebar-width"] ?? pe), me = (e) => n.value?.update("x-scalar-sidebar-width", e), k = u(!0), ve = "x-scalar-tabs", fe = "x-scalar-active-tab", I = (e) => {
209
+ (!a || a.type !== "example") && (N(t), d.value && K(d.value));
210
+ }, de = 288, me = i(() => n.value?.workspace?.["x-scalar-sidebar-width"] ?? de), ve = (e) => n.value?.update("x-scalar-sidebar-width", e), k = u(!0), fe = "x-scalar-tabs", he = "x-scalar-active-tab", I = (e) => {
211
211
  const t = s("method", e), a = s("pathEncoded", e), o = s("documentSlug", e), l = s("workspaceSlug", e);
212
212
  return {
213
- ...X({
213
+ ...Z({
214
214
  workspace: l,
215
215
  document: o,
216
216
  path: a,
217
217
  method: t,
218
218
  getEntryByLocation: w
219
219
  }),
220
- path: f.value?.path ?? ""
220
+ path: d.value?.path ?? ""
221
221
  };
222
- }, _ = i(() => n.value?.workspace[ve] ?? [I(f.value)]), he = i(() => n.value?.workspace[fe] ?? 0), F = async (e) => {
222
+ }, _ = i(() => n.value?.workspace[fe] ?? [I(d.value)]), we = i(() => n.value?.workspace[he] ?? 0), F = async (e) => {
223
223
  const t = _.value[e];
224
224
  if (!t) {
225
225
  console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
@@ -231,19 +231,19 @@ const oe = async ({ workspaceId: e }) => D({
231
231
  } catch (o) {
232
232
  console.error("Failed to copy URL to clipboard:", o);
233
233
  }
234
- }, we = (e) => {
234
+ }, xe = (e) => {
235
235
  const t = s("workspaceSlug", e), a = s("documentSlug", e);
236
- if (x.value = t, v.value = a, R.value = s("method", e), A.value = s("pathEncoded", e), U.value = s("exampleName", e), !!t) {
237
- if (e.path !== "" && ee.setCurrentPath(e.path), t !== S.value?.id)
238
- return ie(t);
239
- if (a && a !== n.value?.workspace[M.workspace.activeDocument])
236
+ if (x.value = t, f.value = a, R.value = s("method", e), A.value = s("pathEncoded", e), U.value = s("exampleName", e), !!t) {
237
+ if (e.path !== "" && te.setCurrentPath(e.path), t !== S.value?.id)
238
+ return le(t);
239
+ if (a && a !== n.value?.workspace[G.workspace.activeDocument])
240
240
  return n?.value?.update("x-scalar-active-document", a);
241
- xe(e), be(e);
241
+ be(e), K(e);
242
242
  }
243
- }, xe = (e) => {
243
+ }, be = (e) => {
244
244
  const t = n.value?.workspace["x-scalar-tabs"] ?? [], a = n.value?.workspace["x-scalar-active-tab"] ?? 0, o = t[a];
245
245
  !o || o.path === e.path || (t[a] = I(e));
246
- }, be = (e) => {
246
+ }, K = (e) => {
247
247
  const t = s("documentSlug", e);
248
248
  if (!t) {
249
249
  r.setSelected(null);
@@ -256,15 +256,15 @@ const oe = async ({ workspaceId: e }) => D({
256
256
  example: s("exampleName", e)
257
257
  });
258
258
  a && (r.setSelected(a.id), r.setExpanded(a.id, !0));
259
- }, K = te();
260
- ae({
261
- eventBus: m,
259
+ }, $ = ae();
260
+ ne({
261
+ eventBus: v,
262
262
  router: c,
263
263
  store: n,
264
- navigateToCurrentTab: le,
264
+ navigateToCurrentTab: ue,
265
265
  rebuildSidebar: N,
266
- onAfterExampleCreation: ue,
267
- onOpenCommandPalette: K.open,
266
+ onAfterExampleCreation: pe,
267
+ onOpenCommandPalette: $.open,
268
268
  onSelectSidebarItem: L,
269
269
  onCopyTabUrl: (e) => F(e),
270
270
  onToggleSidebar: () => k.value = !k.value
@@ -275,15 +275,15 @@ function _e(e) {
275
275
  store: n,
276
276
  sidebar: {
277
277
  state: r,
278
- width: de,
278
+ width: me,
279
279
  isOpen: k,
280
280
  handleSelectItem: L,
281
- handleSidebarWidthUpdate: me,
281
+ handleSidebarWidthUpdate: ve,
282
282
  getEntryByLocation: w
283
283
  },
284
284
  tabs: {
285
285
  state: _,
286
- activeTabIndex: he,
286
+ activeTabIndex: we,
287
287
  copyTabUrl: F
288
288
  },
289
289
  workspace: {
@@ -291,21 +291,21 @@ function _e(e) {
291
291
  workspaceList: y,
292
292
  activeWorkspace: S,
293
293
  setId: B,
294
- isOpen: i(() => !!(x.value && !v.value))
294
+ isOpen: i(() => !!(x.value && !f.value))
295
295
  },
296
- commandPalette: K,
297
- eventBus: m,
296
+ commandPalette: $,
297
+ eventBus: v,
298
298
  router: c,
299
- currentRoute: f,
300
- loading: d,
299
+ currentRoute: d,
300
+ loading: m,
301
301
  activeEntities: {
302
302
  workspaceSlug: x,
303
- documentSlug: v,
303
+ documentSlug: f,
304
304
  path: A,
305
305
  method: R,
306
306
  exampleName: U
307
307
  },
308
- environment: re,
308
+ environment: oe,
309
309
  document: E
310
310
  };
311
311
  }
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AAwcA,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;AAmcF,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":"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,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-59eb2624"]]);
4
+ const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-e30bf25b"]]);
5
5
  export {
6
6
  e as default
7
7
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as q, mergeModels as x, computed as b, capitalize as V, useModel as C, ref as G, createElementBlock as W, openBlock as m, createVNode as l, createBlock as g, createCommentVNode as f, unref as i, createSlots as R, withCtx as r, createTextVNode as y, withKeys as k, withModifiers as c, toDisplayString as j, renderSlot as F, createElementVNode as d, normalizeClass as H, nextTick as L } from "vue";
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
2
  import { useModal as U, ScalarSidebarItem as I, ScalarIconButton as J, ScalarButton as $, ScalarModal as Y } from "@scalar/components";
3
3
  import { ScalarIconPlus as Q, ScalarIconDotsThree as X, ScalarIconGlobe as Z } from "@scalar/icons";
4
4
  import { getParentEntry as w } from "@scalar/workspace-store/navigation";
@@ -10,11 +10,14 @@ import ae from "./SidebarItemMenu.vue.js";
10
10
  import { dragHandleFactory as oe } from "../../../helpers/drag-handle-factory.js";
11
11
  import ne from "../../../components/sidebar/Sidebar.vue.js";
12
12
  const ie = { class: "flex" }, se = {
13
+ key: 0,
14
+ class: "flex items-center"
15
+ }, re = {
13
16
  key: 0,
14
17
  class: "empty-sidebar-item-content overflow-hidden px-2.5 py-2.5"
15
- }, re = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, le = { class: "gap-1.5 p-2" }, Se = /* @__PURE__ */ q({
18
+ }, le = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, de = { class: "gap-1.5 p-2" }, ge = /* @__PURE__ */ q({
16
19
  __name: "AppSidebar",
17
- props: /* @__PURE__ */ x({
20
+ props: /* @__PURE__ */ C({
18
21
  layout: {},
19
22
  sidebarState: {},
20
23
  isWorkspaceOpen: { type: Boolean },
@@ -31,65 +34,65 @@ const ie = { class: "flex" }, se = {
31
34
  },
32
35
  sidebarWidthModifiers: {}
33
36
  }),
34
- emits: /* @__PURE__ */ x(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
35
- setup(o, { emit: O }) {
36
- const p = O, A = b(() => V(o.activeWorkspace.label)), B = C(o, "isSidebarOpen"), M = C(o, "sidebarWidth"), S = b(() => o.sidebarState.items.value.length <= 1), h = b(
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(
37
40
  () => oe({
38
- store: o.store,
39
- sidebarState: o.sidebarState
41
+ store: a.store,
42
+ sidebarState: a.sidebarState
40
43
  })
41
- ), D = (a, e) => h.value.handleDragEnd(a, e), N = (a, e) => h.value.isDroppable(a, e), s = G(null), v = U(), T = b(() => {
42
- const a = s.value?.item;
43
- 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.`;
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.`;
44
47
  }), z = () => {
45
- const a = s.value?.item;
46
- if (!a)
48
+ const o = s.value?.item;
49
+ if (!o)
47
50
  return;
48
- const e = o.sidebarState.getEntryById(a.id), t = w("document", e), n = w("operation", e);
51
+ const e = a.sidebarState.getEntryById(o.id), t = w("document", e), n = w("operation", e);
49
52
  if (t) {
50
- if (a.type === "document")
51
- o.eventBus.emit("document:delete:document", { name: t.name });
52
- else if (a.type === "tag")
53
- o.eventBus.emit("tag:delete:tag", {
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
57
  documentName: t.name,
55
- name: a.name
58
+ name: o.name
56
59
  });
57
- else if (a.type === "operation") {
60
+ else if (o.type === "operation") {
58
61
  if (!n)
59
62
  return;
60
- o.eventBus.emit("operation:delete:operation", {
63
+ a.eventBus.emit("operation:delete:operation", {
61
64
  meta: {
62
65
  method: n.method,
63
66
  path: n.path
64
67
  },
65
68
  documentName: t.name
66
69
  });
67
- } else if (a.type === "example") {
70
+ } else if (o.type === "example") {
68
71
  if (!n)
69
72
  return;
70
- o.eventBus.emit("operation:delete:example", {
73
+ a.eventBus.emit("operation:delete:example", {
71
74
  meta: {
72
75
  method: n.method,
73
76
  path: n.path,
74
- exampleKey: a.name
77
+ exampleKey: o.name
75
78
  },
76
79
  documentName: t.name
77
80
  });
78
81
  }
79
- v.hide(), s.value = null;
82
+ b.hide(), s.value = null;
80
83
  }
81
- }, u = async (a, e) => {
84
+ }, m = async (o, e) => {
82
85
  if (s.value?.showMenu)
83
86
  return;
84
- const t = a.currentTarget;
87
+ const t = o.currentTarget;
85
88
  s.value = { item: e, el: t, showMenu: !0 }, await L();
86
- const n = a instanceof MouseEvent ? new MouseEvent(a.type, a) : new KeyboardEvent(a.type, a);
89
+ const n = o instanceof MouseEvent ? new MouseEvent(o.type, o) : new KeyboardEvent(o.type, o);
87
90
  s.value?.el.dispatchEvent(n);
88
91
  }, K = () => {
89
92
  s.value && (s.value.showMenu = !1);
90
- }, P = (a) => {
91
- const e = o.sidebarState.getEntryById(a.id), t = w("document", e), n = w("tag", e);
92
- o.eventBus.emit("ui:open:command-palette", {
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", {
93
96
  action: "create-request",
94
97
  payload: {
95
98
  documentId: t?.id,
@@ -97,33 +100,33 @@ const ie = { class: "flex" }, se = {
97
100
  }
98
101
  });
99
102
  };
100
- return (a, e) => (m(), W("div", ie, [
103
+ return (o, e) => (u(), g("div", ie, [
101
104
  l(i(ne), {
102
- isSidebarOpen: B.value,
103
- "onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => B.value = t),
104
- sidebarWidth: M.value,
105
- "onUpdate:sidebarWidth": e[4] || (e[4] = (t) => M.value = t),
106
- activeWorkspace: o.activeWorkspace,
107
- documents: Object.values(o.store.workspace.documents),
108
- eventBus: o.eventBus,
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,
109
112
  isDroppable: N,
110
- layout: o.layout,
111
- sidebarState: o.sidebarState,
112
- workspaces: o.workspaces,
113
- "onCreate:workspace": e[5] || (e[5] = (t) => p("create:workspace")),
113
+ layout: a.layout,
114
+ sidebarState: a.sidebarState,
115
+ workspaces: a.workspaces,
116
+ "onCreate:workspace": e[5] || (e[5] = (t) => v("create:workspace")),
114
117
  onReorder: e[6] || (e[6] = (t, n) => D(t, n)),
115
- "onSelect:workspace": e[7] || (e[7] = (t) => p("select:workspace", t)),
116
- onSelectItem: e[8] || (e[8] = (t) => p("selectItem", t))
118
+ "onSelect:workspace": e[7] || (e[7] = (t) => v("select:workspace", t)),
119
+ onSelectItem: e[8] || (e[8] = (t) => v("selectItem", t))
117
120
  }, R({
118
121
  sidebarMenuActions: r(() => [
119
- F(a.$slots, "sidebarMenuActions", {}, void 0, !0)
122
+ F(o.$slots, "sidebarMenuActions", {}, void 0, !0)
120
123
  ]),
121
124
  workspaceButton: r(() => [
122
125
  l(i(I), {
123
126
  is: "button",
124
- active: o.isWorkspaceOpen,
127
+ active: a.isWorkspaceOpen,
125
128
  icon: i(Z),
126
- onClick: e[0] || (e[0] = (t) => p("click:workspace"))
129
+ onClick: e[0] || (e[0] = (t) => v("click:workspace"))
127
130
  }, {
128
131
  default: r(() => [
129
132
  y(j(A.value), 1)
@@ -139,15 +142,20 @@ const ie = { class: "flex" }, se = {
139
142
  label: "More options",
140
143
  size: "sm",
141
144
  weight: "bold",
142
- onClick: c((n) => u(n, t), ["stop"]),
145
+ onClick: p((n) => m(n, t), ["stop"]),
143
146
  onKeydown: [
144
- k(c((n) => u(n, t), ["stop"]), ["down"]),
145
- k(c((n) => u(n, t), ["stop"]), ["enter"]),
146
- k(c((n) => u(n, t), ["stop"]), ["space"]),
147
- k(c((n) => u(n, t), ["stop"]), ["up"])
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"])
148
151
  ]
149
152
  }, null, 8, ["icon", "onClick", "onKeydown"])
150
153
  ]),
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)
158
+ ]),
151
159
  empty: r(({ item: t }) => [
152
160
  l(i(I), {
153
161
  is: "button",
@@ -156,7 +164,7 @@ const ie = { class: "flex" }, se = {
156
164
  icon: r(() => [
157
165
  l(i(Q))
158
166
  ]),
159
- default: r(() => [...e[11] || (e[11] = [
167
+ default: r(() => [...e[12] || (e[12] = [
160
168
  y("Add operation", -1)
161
169
  ])]),
162
170
  _: 1
@@ -164,7 +172,7 @@ const ie = { class: "flex" }, se = {
164
172
  ]),
165
173
  _: 2
166
174
  }, [
167
- o.layout !== "modal" ? {
175
+ a.layout !== "modal" ? {
168
176
  name: "footer",
169
177
  fn: r(() => [
170
178
  d("div", {
@@ -172,8 +180,8 @@ const ie = { class: "flex" }, se = {
172
180
  "empty-sidebar-item border-t": S.value
173
181
  })
174
182
  }, [
175
- S.value ? (m(), W("div", se, [
176
- d("div", re, [
183
+ S.value ? (u(), g("div", re, [
184
+ d("div", le, [
177
185
  l(E, {
178
186
  art: i(_),
179
187
  class: "rabbitsit font-bold"
@@ -183,34 +191,34 @@ const ie = { class: "flex" }, se = {
183
191
  class: "rabbitjump absolute top-0 left-0 font-bold"
184
192
  }, null, 8, ["art"])
185
193
  ]),
186
- e[12] || (e[12] = d("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
194
+ e[13] || (e[13] = d("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
187
195
  d("b", { class: "font-medium" }, "Let's Get Started"),
188
196
  d("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
189
197
  ], -1))
190
- ])) : f("", !0),
191
- d("div", le, [
192
- S.value ? (m(), g(i($), {
198
+ ])) : c("", !0),
199
+ d("div", de, [
200
+ S.value ? (u(), B(i($), {
193
201
  key: 0,
194
202
  class: "w-full",
195
203
  size: "sm",
196
- onClick: e[1] || (e[1] = (t) => o.eventBus.emit("ui:open:command-palette", {
204
+ onClick: e[1] || (e[1] = (t) => a.eventBus.emit("ui:open:command-palette", {
197
205
  action: "import-from-openapi-swagger-postman-curl",
198
206
  payload: void 0
199
207
  }))
200
208
  }, {
201
- default: r(() => [...e[13] || (e[13] = [
209
+ default: r(() => [...e[14] || (e[14] = [
202
210
  y(" Import Collection ", -1)
203
211
  ])]),
204
212
  _: 1
205
- })) : f("", !0),
213
+ })) : c("", !0),
206
214
  l(i($), {
207
215
  class: "w-full",
208
216
  hotkey: "K",
209
217
  size: "sm",
210
218
  variant: "outlined",
211
- onClick: e[2] || (e[2] = (t) => o.eventBus.emit("ui:open:command-palette"))
219
+ onClick: e[2] || (e[2] = (t) => a.eventBus.emit("ui:open:command-palette"))
212
220
  }, {
213
- default: r(() => [...e[14] || (e[14] = [
221
+ default: r(() => [...e[15] || (e[15] = [
214
222
  y(" Add Item ", -1)
215
223
  ])]),
216
224
  _: 1
@@ -221,34 +229,34 @@ const ie = { class: "flex" }, se = {
221
229
  key: "0"
222
230
  } : void 0
223
231
  ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "eventBus", "layout", "sidebarState", "workspaces"]),
224
- s.value?.showMenu ? (m(), g(ae, {
232
+ s.value?.showMenu ? (u(), B(ae, {
225
233
  key: 0,
226
- eventBus: o.eventBus,
234
+ eventBus: a.eventBus,
227
235
  item: s.value.item,
228
- sidebarState: o.sidebarState,
236
+ sidebarState: a.sidebarState,
229
237
  target: s.value.el,
230
238
  onCloseMenu: K,
231
- onShowDeleteModal: e[9] || (e[9] = (t) => i(v).show())
232
- }, null, 8, ["eventBus", "item", "sidebarState", "target"])) : f("", !0),
233
- s.value ? (m(), g(i(Y), {
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), {
234
242
  key: 1,
235
243
  size: "xxs",
236
- state: i(v),
244
+ state: i(b),
237
245
  title: `Delete ${s.value.item.title}`
238
246
  }, {
239
247
  default: r(() => [
240
248
  l(te, {
241
249
  variableName: s.value.item.title,
242
250
  warningMessage: T.value,
243
- onClose: e[10] || (e[10] = (t) => i(v).hide()),
251
+ onClose: e[10] || (e[10] = (t) => i(b).hide()),
244
252
  onDelete: z
245
253
  }, null, 8, ["variableName", "warningMessage"])
246
254
  ]),
247
255
  _: 1
248
- }, 8, ["state", "title"])) : f("", !0)
256
+ }, 8, ["state", "title"])) : c("", !0)
249
257
  ]));
250
258
  }
251
259
  });
252
260
  export {
253
- Se as default
261
+ ge as default
254
262
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DocumentCollection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"names":[],"mappings":"AA8GA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;;AACH,wBAqPC"}
1
+ {"version":3,"file":"DocumentCollection.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/collection/DocumentCollection.vue"],"names":[],"mappings":"AAiJA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;;AACH,wBAmVC"}