@scalar/api-client 2.1.1 → 2.1.4

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 (40) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/AddressBar/AddressBarServer.vue.d.ts.map +1 -1
  3. package/dist/components/AddressBar/AddressBarServer.vue.js +58 -58
  4. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  5. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  6. package/dist/libs/create-client.d.ts.map +1 -1
  7. package/dist/libs/send-request.d.ts.map +1 -1
  8. package/dist/libs/send-request.js +63 -62
  9. package/dist/store/request-example.d.ts.map +1 -1
  10. package/dist/store/store.d.ts.map +1 -1
  11. package/dist/style.css +1 -1
  12. package/dist/views/Request/Request.vue.js +1 -1
  13. package/dist/views/Request/Request.vue2.js +1 -1
  14. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  15. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +2 -2
  16. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +77 -73
  17. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts +0 -4
  18. package/dist/views/Request/RequestSection/RequestBody.vue.d.ts.map +1 -1
  19. package/dist/views/Request/RequestSection/RequestBody.vue.js +214 -162
  20. package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts.map +1 -1
  21. package/dist/views/Request/RequestSection/RequestPathParams.vue.js +38 -37
  22. package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
  23. package/dist/views/Request/RequestSection/RequestSection.vue.js +5 -8
  24. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  25. package/dist/views/Request/RequestSidebar.vue.js +2 -2
  26. package/dist/views/Request/RequestSidebar.vue2.js +164 -153
  27. package/dist/views/Request/RequestSidebarItem.vue.d.ts +7 -0
  28. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  29. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  30. package/dist/views/Request/RequestSidebarItem.vue2.js +230 -263
  31. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +8 -30
  32. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  33. package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
  34. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +131 -81
  35. package/dist/views/Request/types/index.d.ts +2 -0
  36. package/dist/views/Request/types/index.d.ts.map +1 -0
  37. package/dist/views/Request/types/index.js +1 -0
  38. package/dist/views/Request/types/sidebar-item.d.ts +23 -0
  39. package/dist/views/Request/types/sidebar-item.d.ts.map +1 -0
  40. package/package.json +10 -5
@@ -1,65 +1,66 @@
1
- import { defineComponent as K, computed as R, watch as E, openBlock as d, createBlock as f, withCtx as y, createTextVNode as g, toDisplayString as q, createElementBlock as C, createElementVNode as w } from "vue";
1
+ import { defineComponent as $, computed as K, watch as E, openBlock as d, createBlock as f, withCtx as y, createTextVNode as x, toDisplayString as q, createElementBlock as C, createElementVNode as w } from "vue";
2
2
  import P from "../../../components/ViewLayout/ViewLayoutCollapse.vue.js";
3
3
  import V from "./RequestTable.vue.js";
4
- import { useWorkspace as M } from "../../../store/store.js";
5
- const B = {
4
+ import { pathRegex as M } from "@scalar/oas-utils/helpers";
5
+ import { useWorkspace as B } from "../../../store/store.js";
6
+ const N = {
6
7
  key: 1,
7
8
  class: "text-c-3 px-4 text-sm border rounded min-h-12 justify-center flex items-center bg-b-1 mx-1"
8
- }, N = /* @__PURE__ */ w("code", { class: "bg-b-2 ml-1 px-1 rounded" }, "/endpoint/{my_path_variable}", -1), H = /* @__PURE__ */ K({
9
+ }, U = /* @__PURE__ */ w("code", { class: "bg-b-2 ml-1 px-1 rounded" }, "/endpoint/{my_path_variable}", -1), S = /* @__PURE__ */ $({
9
10
  __name: "RequestPathParams",
10
11
  props: {
11
12
  title: {},
12
13
  paramKey: {}
13
14
  },
14
- setup(x) {
15
- const o = x, {
15
+ setup(g) {
16
+ const o = g, {
16
17
  activeRequest: s,
17
- activeExample: r,
18
+ activeExample: n,
18
19
  requestMutators: h,
19
20
  requestExampleMutators: v
20
- } = M(), u = R(() => {
21
- const e = r.value;
22
- return e ? e.parameters[o.paramKey].map((n) => {
21
+ } = B(), u = K(() => {
22
+ const e = n.value;
23
+ return e ? e.parameters[o.paramKey].map((r) => {
23
24
  var a;
24
25
  return {
25
- ...n,
26
- enum: n.enum || ((a = e.serverVariables) == null ? void 0 : a[n.key])
26
+ ...r,
27
+ enum: r.enum || ((a = e.serverVariables) == null ? void 0 : a[r.key])
27
28
  };
28
29
  }) : [];
29
- }), _ = (e, n, a) => {
30
- var p, t;
31
- if (!s.value || !r.value) return;
32
- const c = r.value.parameters[o.paramKey], l = (p = c[e]) == null ? void 0 : p.key;
33
- if (n === "key") {
34
- if ((t = c[e]) != null && t.required)
30
+ }), _ = (e, r, a) => {
31
+ var l, t;
32
+ if (!s.value || !n.value) return;
33
+ const p = n.value.parameters[o.paramKey], c = (l = p[e]) == null ? void 0 : l.key;
34
+ if (r === "key") {
35
+ if ((t = p[e]) != null && t.required)
35
36
  return;
36
37
  if (a) {
37
- const i = encodeURIComponent(l), m = encodeURIComponent(a), k = new RegExp(`(?<=/):${i}(?=[/?#]|$)`, "g"), $ = s.value.path.replace(
38
+ const i = encodeURIComponent(c), m = encodeURIComponent(a), k = new RegExp(`(?<=/):${i}(?=[/?#]|$)`, "g"), R = s.value.path.replace(
38
39
  k,
39
40
  `:${m}`
40
41
  );
41
- h.edit(s.value.uid, "path", $);
42
+ h.edit(s.value.uid, "path", R);
42
43
  } else {
43
- c.splice(e, 1);
44
- const i = new RegExp(`/:${encodeURIComponent(l)}(?=[/?#]|$)`, "g"), m = s.value.path.replace(i, "");
44
+ p.splice(e, 1);
45
+ const i = new RegExp(`/:${encodeURIComponent(c)}(?=[/?#]|$)`, "g"), m = s.value.path.replace(i, "");
45
46
  h.edit(s.value.uid, "path", m);
46
47
  }
47
48
  }
48
49
  v.edit(
49
- r.value.uid,
50
- `parameters.${o.paramKey}.${e}.${n}`,
50
+ n.value.uid,
51
+ `parameters.${o.paramKey}.${e}.${r}`,
51
52
  a
52
53
  );
53
54
  }, b = (e) => {
54
- var p;
55
- if (!r.value) return;
56
- const n = ((p = e.match(/{([^{}]+)}/g)) == null ? void 0 : p.map((t) => t.slice(1, -1))) || [], a = r.value.parameters[o.paramKey], c = new Map(a.map((t) => [t.key, t])), l = n.map(
57
- (t) => c.get(t) || { key: t, value: "", enabled: !0 }
55
+ var l;
56
+ if (!n.value) return;
57
+ const r = ((l = e.match(M)) == null ? void 0 : l.map((t) => t.slice(1, -1))) || [], a = n.value.parameters[o.paramKey], p = new Map(a.map((t) => [t.key, t])), c = r.map(
58
+ (t) => p.get(t) || { key: t, value: "", enabled: !0 }
58
59
  );
59
60
  a.forEach((t) => {
60
- !n.includes(t.key) && (t.value || t.required) && l.push(t);
61
- }), a.splice(0, a.length, ...l), v.edit(
62
- r.value.uid,
61
+ !r.includes(t.key) && (t.value || t.required) && c.push(t);
62
+ }), a.splice(0, a.length, ...c), v.edit(
63
+ n.value.uid,
63
64
  `parameters.${o.paramKey}`,
64
65
  a
65
66
  );
@@ -72,11 +73,11 @@ const B = {
72
73
  (e) => {
73
74
  e && b(e);
74
75
  }
75
- ), (e, n) => (d(), f(P, {
76
+ ), (e, r) => (d(), f(P, {
76
77
  itemCount: u.value.length
77
78
  }, {
78
79
  title: y(() => [
79
- g(q(e.title), 1)
80
+ x(q(e.title), 1)
80
81
  ]),
81
82
  default: y(() => [
82
83
  u.value.length ? (d(), f(V, {
@@ -85,9 +86,9 @@ const B = {
85
86
  isEnabledHidden: "",
86
87
  items: u.value,
87
88
  onUpdateRow: _
88
- }, null, 8, ["items"])) : (d(), C("div", B, [
89
- g(" You can use variables in your path: "),
90
- N
89
+ }, null, 8, ["items"])) : (d(), C("div", N, [
90
+ x(" You can use variables in your path: "),
91
+ U
91
92
  ]))
92
93
  ]),
93
94
  _: 1
@@ -95,5 +96,5 @@ const B = {
95
96
  }
96
97
  });
97
98
  export {
98
- H as default
99
+ S as default
99
100
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestSection.vue"],"names":[],"mappings":";AAuaA,wBAKG"}
1
+ {"version":3,"file":"RequestSection.vue.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/RequestSection/RequestSection.vue"],"names":[],"mappings":";AAsaA,wBAKG"}
@@ -1,5 +1,5 @@
1
- import { defineComponent as R, computed as _, ref as g, watch as C, openBlock as c, createBlock as w, withCtx as x, createVNode as n, unref as a, createElementVNode as A, createTextVNode as H, createElementBlock as d, createCommentVNode as N, toDisplayString as b, withDirectives as r, vShow as u } from "vue";
2
- import V from "../../../components/ContextBar.vue.js";
1
+ import { defineComponent as R, computed as _, ref as g, watch as C, openBlock as c, createBlock as w, withCtx as x, createVNode as n, unref as a, createElementVNode as A, createTextVNode as H, createElementBlock as d, createCommentVNode as N, toDisplayString as V, withDirectives as r, vShow as u } from "vue";
2
+ import b from "../../../components/ContextBar.vue.js";
3
3
  import E from "../../../components/ViewLayout/ViewLayoutSection.vue.js";
4
4
  import K from "./RequestBody.vue.js";
5
5
  import p from "./RequestParams.vue.js";
@@ -57,7 +57,7 @@ const M = { class: "flex-1 flex gap-1 items-center pointer-events-none" }, P = {
57
57
  A("div", M, [
58
58
  H(" Request "),
59
59
  a(m) ? N("", !0) : (c(), d("label", P)),
60
- a(m) ? (c(), d("span", L, b((i = a(o)) == null ? void 0 : i.summary), 1)) : (c(), d("input", {
60
+ a(m) ? (c(), d("span", L, V((i = a(o)) == null ? void 0 : i.summary), 1)) : (c(), d("input", {
61
61
  key: 1,
62
62
  id: "requestname",
63
63
  class: "outline-none border-0 text-c-2 rounded pointer-events-auto relative w-full",
@@ -72,7 +72,7 @@ const M = { class: "flex-1 flex gap-1 items-center pointer-events-none" }, P = {
72
72
  var s, i, y;
73
73
  return [
74
74
  A("div", O, [
75
- n(V, {
75
+ n(b, {
76
76
  activeSection: e.value,
77
77
  sections: q.value,
78
78
  onSetActiveSection: l[0] || (l[0] = (B) => e.value = B)
@@ -110,10 +110,7 @@ const M = { class: "flex-1 flex gap-1 items-center pointer-events-none" }, P = {
110
110
  }, null, 512), [
111
111
  [u, e.value === "All" || e.value === "Query"]
112
112
  ]),
113
- r(n(K, {
114
- body: "foo",
115
- title: "Body"
116
- }, null, 512), [
113
+ r(n(K, { title: "Body" }, null, 512), [
117
114
  [
118
115
  u,
119
116
  a(o) && (e.value === "All" || e.value === "Body") && a(v)(a(o).method)
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSidebar.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebar.vue"],"names":[],"mappings":";iBA8Ne,OAAO;gBACR,OAAO;;;;cAMkB,MAAM;aAAO,MAAM;;;iBAP3C,OAAO;gBACR,OAAO;;;cAMkB,MAAM;aAAO,MAAM;;;;AAyd1D,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"RequestSidebar.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebar.vue"],"names":[],"mappings":";iBAiPe,OAAO;gBACR,OAAO;;;;cAMkB,MAAM;aAAO,MAAM;;;iBAP3C,OAAO;gBACR,OAAO;;;cAMkB,MAAM;aAAO,MAAM;;;;AA0gB1D,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./RequestSidebar.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0a67e4bf"]]);
4
+ const d = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d4db0c38"]]);
5
5
  export {
6
- f as default
6
+ d as default
7
7
  };
@@ -1,179 +1,190 @@
1
- import { defineComponent as A, watch as j, onMounted as G, onBeforeUnmount as J, withDirectives as Q, openBlock as a, createBlock as l, unref as e, normalizeClass as m, createSlots as X, withCtx as r, createElementVNode as c, createVNode as d, isRef as Y, withKeys as f, withModifiers as u, createElementBlock as k, Fragment as y, renderList as C, createTextVNode as D, toDisplayString as Z, createCommentVNode as _, vShow as ee } from "vue";
2
- import te from "../../components/HttpMethod/HttpMethod.vue.js";
3
- import { useSearch as oe } from "../../components/Search/useSearch.js";
4
- import se from "../../components/Sidebar/SidebarButton.vue.js";
5
- import { dragHandlerFactory as re } from "./handle-drag.js";
6
- import { ScalarSearchInput as ae, ScalarSearchResultList as ie, ScalarSearchResultItem as ne, ScalarIcon as I } from "@scalar/components";
7
- import le from "./RequestSidebarItem.vue.js";
8
- import de from "../../components/Sidebar/Sidebar.vue.js";
9
- import ue from "./components/WorkspaceDropdown.vue.js";
10
- import { useSidebar as pe } from "../../hooks/useSidebar.js";
11
- import { useWorkspace as me } from "../../store/store.js";
12
- import { hotKeyBus as $ } from "../../libs/event-busses/hot-keys-bus.js";
13
- import { commandPaletteBus as x } from "../../libs/event-busses/command-palette-bus.js";
14
- const ce = { class: "search-button-fade sticky px-3 py-2.5 top-0 z-50" }, $e = /* @__PURE__ */ A({
1
+ import { defineComponent as J, reactive as Q, watch as X, onBeforeMount as Y, onMounted as Z, onBeforeUnmount as _, openBlock as r, createElementBlock as c, Fragment as b, withDirectives as ee, createVNode as l, unref as t, normalizeClass as f, createSlots as te, withCtx as a, createElementVNode as h, isRef as oe, withKeys as S, withModifiers as u, createBlock as m, renderList as I, createTextVNode as D, toDisplayString as se, createCommentVNode as $, vShow as re } from "vue";
2
+ import ae from "../../components/HttpMethod/HttpMethod.vue.js";
3
+ import { useSearch as ne } from "../../components/Search/useSearch.js";
4
+ import ie from "../../components/Sidebar/SidebarButton.vue.js";
5
+ import le from "./RequestSidebarItemMenu.vue.js";
6
+ import { dragHandlerFactory as de } from "./handle-drag.js";
7
+ import { ScalarSearchInput as ue, ScalarSearchResultList as me, ScalarSearchResultItem as pe, ScalarIcon as B } from "@scalar/components";
8
+ import fe from "./RequestSidebarItem.vue.js";
9
+ import ce from "../../components/Sidebar/Sidebar.vue.js";
10
+ import be from "./components/WorkspaceDropdown.vue.js";
11
+ import { useSidebar as he } from "../../hooks/useSidebar.js";
12
+ import { useWorkspace as Se } from "../../store/store.js";
13
+ import { hotKeyBus as x } from "../../libs/event-busses/hot-keys-bus.js";
14
+ import { commandPaletteBus as V } from "../../libs/event-busses/command-palette-bus.js";
15
+ const ve = { class: "search-button-fade sticky px-3 py-2.5 top-0 z-50" }, Me = /* @__PURE__ */ J({
15
16
  __name: "RequestSidebar",
16
17
  props: {
17
18
  showSidebar: { type: Boolean },
18
19
  isReadonly: { type: Boolean }
19
20
  },
20
21
  emits: ["update:showSidebar", "newTab"],
21
- setup(B, { emit: V }) {
22
- const F = B, h = V, b = me(), {
23
- activeWorkspaceCollections: E,
24
- activeRequest: q,
22
+ setup(E, { emit: F }) {
23
+ const M = E, v = F, R = Se(), {
24
+ activeWorkspaceCollections: q,
25
+ activeRequest: T,
25
26
  activeWorkspaceRequests: N,
26
- findRequestParents: P
27
- } = b, { handleDragEnd: T, isDroppable: z } = re(b), { collapsedSidebarFolders: K, setCollapsedSidebarFolder: U } = pe();
28
- j(
29
- q,
27
+ findRequestParents: O,
28
+ isReadOnly: P
29
+ } = R, { handleDragEnd: z, isDroppable: K } = de(R), { collapsedSidebarFolders: U, setCollapsedSidebarFolder: W } = he(), d = Q({ open: !1 });
30
+ X(
31
+ T,
30
32
  (s) => {
31
- s && P(s).forEach(
32
- (t) => U(t, !0)
33
+ s && O(s).forEach(
34
+ (e) => W(e, !0)
33
35
  );
34
36
  },
35
37
  { immediate: !0 }
36
38
  );
37
39
  const {
38
40
  searchText: p,
39
- searchResultsWithPlaceholderResults: S,
40
- selectedSearchResult: v,
41
- onSearchResultClick: W,
42
- fuseSearch: H,
43
- searchInputRef: R,
44
- searchResultRefs: M,
45
- navigateSearchResults: w,
46
- selectSearchResult: L
47
- } = oe(), g = (s) => {
48
- var t;
49
- s.toggleSidebar && h("update:showSidebar", F.showSidebar), s.openCommandPalette && (s.openCommandPalette.preventDefault(), x.emit()), s.focusRequestSearch && ((t = R.value) == null || t.focus());
41
+ searchResultsWithPlaceholderResults: w,
42
+ selectedSearchResult: g,
43
+ onSearchResultClick: H,
44
+ fuseSearch: L,
45
+ searchInputRef: k,
46
+ searchResultRefs: j,
47
+ navigateSearchResults: y,
48
+ selectSearchResult: A
49
+ } = ne(), C = (s) => {
50
+ var e;
51
+ s.toggleSidebar && v("update:showSidebar", M.showSidebar), s.openCommandPalette && (s.openCommandPalette.preventDefault(), V.emit()), s.focusRequestSearch && ((e = k.value) == null || e.focus());
50
52
  };
51
- return G(() => {
52
- $.on(g);
53
- }), J(() => {
54
- $.off(g);
55
- }), (s, t) => Q((a(), l(e(de), {
56
- class: m([s.showSidebar ? "sidebar-active-width" : ""]),
57
- showSidebar: s.showSidebar,
58
- "onUpdate:showSidebar": t[7] || (t[7] = (o) => s.$emit("update:showSidebar", o))
59
- }, X({
60
- content: r(() => [
61
- c("div", ce, [
62
- d(e(ae), {
63
- ref_key: "searchInputRef",
64
- ref: R,
65
- modelValue: e(p),
66
- "onUpdate:modelValue": t[0] || (t[0] = (o) => Y(p) ? p.value = o : null),
67
- sidebar: "",
68
- onInput: e(H),
69
- onKeydown: [
70
- t[1] || (t[1] = f(u((o) => e(w)("down"), ["stop"]), ["down"])),
71
- t[2] || (t[2] = f(u((o) => e(L)(), ["stop"]), ["enter"])),
72
- t[3] || (t[3] = f(u((o) => e(w)("up"), ["stop"]), ["up"]))
73
- ]
74
- }, null, 8, ["modelValue", "onInput"])
75
- ]),
76
- c("div", {
77
- class: m(["custom-scroll flex flex-1 flex-col overflow-visible px-3 pb-3 pt-0", {
78
- "pb-14": !s.isReadonly
79
- }]),
80
- onDragenter: t[5] || (t[5] = u(() => {
81
- }, ["prevent"])),
82
- onDragover: t[6] || (t[6] = u(() => {
83
- }, ["prevent"]))
84
- }, [
85
- e(p) ? (a(), l(e(ie), {
86
- key: 0,
87
- class: "gap-px custom-scroll",
88
- noResults: !e(S).length
89
- }, {
90
- default: r(() => [
91
- (a(!0), k(y, null, C(e(S), (o, i) => (a(), l(e(ne), {
92
- id: `#search-input-${o.item.id}`,
93
- key: o.refIndex,
94
- ref_for: !0,
95
- ref: (n) => e(M)[i] = n,
96
- active: e(v) === i,
97
- class: "px-2",
98
- onClick: (n) => e(W)(o),
99
- onFocus: (n) => v.value = i
53
+ return Y(() => console.time("sidebar")), Z(() => {
54
+ x.on(C), setTimeout(() => console.timeEnd("sidebar"), 0);
55
+ }), _(() => {
56
+ x.off(C);
57
+ }), (s, e) => (r(), c(b, null, [
58
+ ee(l(t(ce), {
59
+ class: f([s.showSidebar ? "sidebar-active-width" : ""]),
60
+ showSidebar: s.showSidebar,
61
+ "onUpdate:showSidebar": e[8] || (e[8] = (o) => s.$emit("update:showSidebar", o))
62
+ }, te({
63
+ content: a(() => [
64
+ h("div", ve, [
65
+ l(t(ue), {
66
+ ref_key: "searchInputRef",
67
+ ref: k,
68
+ modelValue: t(p),
69
+ "onUpdate:modelValue": e[0] || (e[0] = (o) => oe(p) ? p.value = o : null),
70
+ sidebar: "",
71
+ onInput: t(L),
72
+ onKeydown: [
73
+ e[1] || (e[1] = S(u((o) => t(y)("down"), ["stop"]), ["down"])),
74
+ e[2] || (e[2] = S(u((o) => t(A)(), ["stop"]), ["enter"])),
75
+ e[3] || (e[3] = S(u((o) => t(y)("up"), ["stop"]), ["up"]))
76
+ ]
77
+ }, null, 8, ["modelValue", "onInput"])
78
+ ]),
79
+ h("div", {
80
+ class: f(["custom-scroll flex flex-1 flex-col overflow-visible px-3 pb-3 pt-0", {
81
+ "pb-14": !s.isReadonly
82
+ }]),
83
+ onDragenter: e[6] || (e[6] = u(() => {
84
+ }, ["prevent"])),
85
+ onDragover: e[7] || (e[7] = u(() => {
86
+ }, ["prevent"]))
87
+ }, [
88
+ t(p) ? (r(), m(t(me), {
89
+ key: 0,
90
+ class: "gap-px custom-scroll",
91
+ noResults: !t(w).length
92
+ }, {
93
+ default: a(() => [
94
+ (r(!0), c(b, null, I(t(w), (o, i) => (r(), m(t(pe), {
95
+ id: `#search-input-${o.item.id}`,
96
+ key: o.refIndex,
97
+ ref_for: !0,
98
+ ref: (n) => t(j)[i] = n,
99
+ active: t(g) === i,
100
+ class: "px-2",
101
+ onClick: (n) => t(H)(o),
102
+ onFocus: (n) => g.value = i
103
+ }, {
104
+ addon: a(() => [
105
+ l(ae, {
106
+ class: "font-bold",
107
+ method: o.item.httpVerb ?? "get"
108
+ }, null, 8, ["method"])
109
+ ]),
110
+ default: a(() => [
111
+ D(se(o.item.title) + " ", 1)
112
+ ]),
113
+ _: 2
114
+ }, 1032, ["id", "active", "onClick", "onFocus"]))), 128))
115
+ ]),
116
+ _: 1
117
+ }, 8, ["noResults"])) : (r(!0), c(b, { key: 1 }, I(t(q), (o) => {
118
+ var i;
119
+ return r(), m(fe, {
120
+ key: o.uid,
121
+ isDraggable: !s.isReadonly && ((i = o.info) == null ? void 0 : i.title) !== "Drafts",
122
+ isDroppable: t(K),
123
+ menuItem: d,
124
+ parentUids: [],
125
+ uid: o.uid,
126
+ onNewTab: e[4] || (e[4] = (n, G) => v("newTab", { name: n, uid: G })),
127
+ onOnDragEnd: t(z),
128
+ onOpenMenu: e[5] || (e[5] = (n) => Object.assign(d, n))
100
129
  }, {
101
- addon: r(() => [
102
- d(te, {
103
- class: "font-bold",
104
- method: o.item.httpVerb ?? "get"
105
- }, null, 8, ["method"])
106
- ]),
107
- default: r(() => [
108
- D(Z(o.item.title) + " ", 1)
130
+ leftIcon: a(() => [
131
+ l(t(B), {
132
+ class: "text-sidebar-c-2 text-sm group-hover:hidden",
133
+ icon: "CodeFolder",
134
+ size: "sm",
135
+ thickness: "2"
136
+ }),
137
+ h("div", {
138
+ class: f({
139
+ "rotate-90": t(U)[o.uid]
140
+ })
141
+ }, [
142
+ l(t(B), {
143
+ class: "text-c-3 hidden text-sm group-hover:block",
144
+ icon: "ChevronRight",
145
+ size: "sm"
146
+ })
147
+ ], 2)
109
148
  ]),
110
149
  _: 2
111
- }, 1032, ["id", "active", "onClick", "onFocus"]))), 128))
150
+ }, 1032, ["isDraggable", "isDroppable", "menuItem", "uid", "onOnDragEnd"]);
151
+ }), 128))
152
+ ], 34)
153
+ ]),
154
+ button: a(() => [
155
+ s.isReadonly ? $("", !0) : (r(), m(ie, {
156
+ key: 0,
157
+ class: f({
158
+ "empty-sidebar-item": t(N).length === 1
159
+ }),
160
+ click: t(V).emit
161
+ }, {
162
+ title: a(() => [
163
+ D("Add Item")
112
164
  ]),
113
165
  _: 1
114
- }, 8, ["noResults"])) : (a(!0), k(y, { key: 1 }, C(e(E), (o) => {
115
- var i;
116
- return a(), l(le, {
117
- key: o.uid,
118
- isDraggable: !s.isReadonly && ((i = o.info) == null ? void 0 : i.title) !== "Drafts",
119
- isDroppable: e(z),
120
- parentUids: [],
121
- uid: o.uid,
122
- onNewTab: t[4] || (t[4] = (n, O) => h("newTab", { name: n, uid: O })),
123
- onOnDragEnd: e(T)
124
- }, {
125
- leftIcon: r(() => [
126
- d(e(I), {
127
- class: "text-sidebar-c-2 text-sm group-hover:hidden",
128
- icon: "CodeFolder",
129
- size: "sm",
130
- thickness: "2"
131
- }),
132
- c("div", {
133
- class: m({
134
- "rotate-90": e(K)[o.uid]
135
- })
136
- }, [
137
- d(e(I), {
138
- class: "text-c-3 hidden text-sm group-hover:block",
139
- icon: "ChevronRight",
140
- size: "sm"
141
- })
142
- ], 2)
143
- ]),
144
- _: 2
145
- }, 1032, ["isDraggable", "isDroppable", "uid", "onOnDragEnd"]);
146
- }), 128))
147
- ], 34)
148
- ]),
149
- button: r(() => [
150
- s.isReadonly ? _("", !0) : (a(), l(se, {
151
- key: 0,
152
- class: m({
153
- "empty-sidebar-item": e(N).length === 1
154
- }),
155
- click: e(x).emit
156
- }, {
157
- title: r(() => [
158
- D("Add Item")
166
+ }, 8, ["class", "click"]))
167
+ ]),
168
+ _: 2
169
+ }, [
170
+ s.isReadonly ? void 0 : {
171
+ name: "header",
172
+ fn: a(() => [
173
+ l(t(be))
159
174
  ]),
160
- _: 1
161
- }, 8, ["class", "click"]))
175
+ key: "0"
176
+ }
177
+ ]), 1032, ["class", "showSidebar"]), [
178
+ [re, s.showSidebar]
162
179
  ]),
163
- _: 2
164
- }, [
165
- s.isReadonly ? void 0 : {
166
- name: "header",
167
- fn: r(() => [
168
- d(e(ue))
169
- ]),
170
- key: "0"
171
- }
172
- ]), 1032, ["class", "showSidebar"])), [
173
- [ee, s.showSidebar]
174
- ]);
180
+ !t(P) && d ? (r(), m(le, {
181
+ key: 0,
182
+ menuItem: d,
183
+ onCloseMenu: e[9] || (e[9] = (o) => d.open = !1)
184
+ }, null, 8, ["menuItem"])) : $("", !0)
185
+ ], 64));
175
186
  }
176
187
  });
177
188
  export {
178
- $e as default
189
+ Me as default
179
190
  };
@@ -1,3 +1,4 @@
1
+ import type { SidebarMenuItem } from '../../views/Request/types/index.js';
1
2
  import { type DraggableProps, type DraggingItem, type HoveredItem } from '@scalar/draggable';
2
3
  declare function __VLS_template(): Readonly<{
3
4
  leftIcon(): void;
@@ -21,6 +22,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
21
22
  parentUids: string[];
22
23
  /** uid of a Collection, Tag, Request or RequestExample */
23
24
  uid: string;
25
+ /** To keep track of the menu being open */
26
+ menuItem: SidebarMenuItem;
24
27
  }>, {
25
28
  isDraggable: boolean;
26
29
  isDroppable: boolean;
@@ -28,6 +31,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
28
31
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
29
32
  onDragEnd: (draggingItem: DraggingItem, hoveredItem: HoveredItem) => void;
30
33
  newTab: (name: string, uid: string) => void;
34
+ openMenu: (menuItem: SidebarMenuItem) => void;
31
35
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
32
36
  /**
33
37
  * Toggle dragging on and off
@@ -45,6 +49,8 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
45
49
  parentUids: string[];
46
50
  /** uid of a Collection, Tag, Request or RequestExample */
47
51
  uid: string;
52
+ /** To keep track of the menu being open */
53
+ menuItem: SidebarMenuItem;
48
54
  }>, {
49
55
  isDraggable: boolean;
50
56
  isDroppable: boolean;
@@ -52,6 +58,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_WithDefaults<
52
58
  }>>> & {
53
59
  onOnDragEnd?: ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => any) | undefined;
54
60
  onNewTab?: ((name: string, uid: string) => any) | undefined;
61
+ onOpenMenu?: ((menuItem: SidebarMenuItem) => any) | undefined;
55
62
  }, {
56
63
  isDroppable: boolean | ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => boolean);
57
64
  isDraggable: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSidebarItem.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebarItem.vue"],"names":[],"mappings":"AAggBA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,mBAAmB,CAAA;AA+Q1B,iBAAS,cAAc;gBAnOT,IAAI;;gBAAJ,IAAI;EAo7BjB;AACD,QAAA,MAAM,eAAe;IAj9BjB;;;;OAIG;kBACW,OAAO;IACrB;;;;OAIG;kBACW,cAAc,CAAC,aAAa,CAAC;IAC3C,oEAAoE;gBACxD,MAAM,EAAE;IACpB,0DAA0D;SACrD,MAAM;;;;;;;;;IAfX;;;;OAIG;kBACW,OAAO;IACrB;;;;OAIG;kBACW,cAAc,CAAC,aAAa,CAAC;IAC3C,oEAAoE;gBACxD,MAAM,EAAE;IACpB,0DAA0D;SACrD,MAAM;;;;;;;;;;iBAVG,OAAO;MAm9BvB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAC7C,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO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AC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -2,7 +2,7 @@ import t from "./RequestSidebarItem.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import o from "../../_virtual/_plugin-vue_export-helper.js";
5
- const a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-1e316c86"]]);
5
+ const a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-49b059d4"]]);
6
6
  export {
7
7
  a as default
8
8
  };