@scalar/api-client 2.0.36 → 2.0.38

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 (39) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
  3. package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +35 -42
  4. package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
  5. package/dist/components/CommandPalette/CommandPaletteExample.vue.js +54 -64
  6. package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
  7. package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +37 -44
  8. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +33 -43
  10. package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
  11. package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +50 -57
  12. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -1
  13. package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +29 -36
  14. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  15. package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
  16. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +34 -34
  17. package/dist/components/SideNav/SideHelp.vue.d.ts.map +1 -1
  18. package/dist/components/SideNav/SideHelp.vue.js +34 -34
  19. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
  20. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js +12 -12
  21. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +14 -14
  22. package/dist/layouts/App/create-api-client-app.d.ts +5 -5
  23. package/dist/layouts/Modal/create-api-client-modal.d.ts +10 -10
  24. package/dist/libs/create-client.d.ts +6 -5
  25. package/dist/libs/create-client.d.ts.map +1 -1
  26. package/dist/store/workspace.d.ts +12 -12
  27. package/dist/store/workspace.d.ts.map +1 -1
  28. package/dist/store/workspace.js +185 -181
  29. package/dist/style.css +1 -1
  30. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  31. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  32. package/dist/views/Request/RequestSidebarItem.vue2.js +112 -101
  33. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +8 -2
  34. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  35. package/dist/views/Request/RequestSidebarItemMenu.vue.js +92 -82
  36. package/package.json +4 -4
  37. package/dist/components/CommandPalette/handleKeyDown.d.ts +0 -2
  38. package/dist/components/CommandPalette/handleKeyDown.d.ts.map +0 -1
  39. package/dist/components/CommandPalette/handleKeyDown.js +0 -7
@@ -1,13 +1,13 @@
1
- import { defineComponent as j, useCssVars as F, computed as o, resolveComponent as L, openBlock as a, createElementBlock as d, normalizeClass as u, unref as i, createVNode as m, withCtx as D, createBlock as p, createElementVNode as n, toDisplayString as y, createCommentVNode as f, createTextVNode as k, renderSlot as P, withDirectives as T, Fragment as W, renderList as A, vShow as _ } from "vue";
2
- import { PathId as G } from "../../router.js";
3
- import { useWorkspace as H } from "../../store/workspace.js";
4
- import { ScalarIcon as J } from "@scalar/components";
5
- import { Draggable as K } from "@scalar/draggable";
6
- import { RouterLink as M } from "vue-router";
7
- import Q from "./RequestSidebarItemMenu.vue.js";
8
- import X from "../../components/HttpMethod/HttpMethod.vue.js";
9
- import { useSidebar as Y } from "../../hooks/useSidebar.js";
10
- const Z = { class: "z-10 font-medium w-full editable-sidebar-hover-item pl-2" }, ee = { class: "relative" }, te = { class: "flex" }, ie = { class: "z-10 flex h-fit items-center justify-center max-w-[14px]" }, se = { class: "z-10 font-medium" }, re = { key: 2 }, q = "hover:bg-sidebar-active-b indent-padding-left", be = /* @__PURE__ */ j({
1
+ import { defineComponent as P, useCssVars as T, computed as o, resolveComponent as W, openBlock as r, createElementBlock as u, normalizeClass as p, unref as i, createVNode as c, withCtx as k, createBlock as m, createElementVNode as n, toDisplayString as w, createCommentVNode as f, createTextVNode as q, renderSlot as A, withDirectives as G, Fragment as H, renderList as J, vShow as K } from "vue";
2
+ import { PathId as M } from "../../router.js";
3
+ import { useWorkspace as Q } from "../../store/workspace.js";
4
+ import { ScalarIcon as X } from "@scalar/components";
5
+ import { Draggable as Y } from "@scalar/draggable";
6
+ import { RouterLink as Z } from "vue-router";
7
+ import $ from "./RequestSidebarItemMenu.vue.js";
8
+ import _ from "../../components/HttpMethod/HttpMethod.vue.js";
9
+ import { useSidebar as ee } from "../../hooks/useSidebar.js";
10
+ const te = { class: "z-10 font-medium w-full editable-sidebar-hover-item pl-2" }, ie = { class: "flex flex-row gap-1" }, se = { class: "flex" }, re = { class: "z-10 flex h-fit items-center justify-center max-w-[14px]" }, ne = { class: "flex flex-1 flex-row justify-between" }, ae = { class: "z-10 font-medium" }, le = { key: 2 }, x = "hover:bg-sidebar-active-b indent-padding-left", he = /* @__PURE__ */ P({
11
11
  __name: "RequestSidebarItem",
12
12
  props: {
13
13
  isDraggable: { type: Boolean, default: !1 },
@@ -16,116 +16,127 @@ const Z = { class: "z-10 font-medium w-full editable-sidebar-hover-item pl-2" },
16
16
  item: {}
17
17
  },
18
18
  emits: ["onDragEnd"],
19
- setup($) {
20
- F((e) => ({
21
- "1fe07419": R.value,
22
- "096d41f6": E.value
19
+ setup(C) {
20
+ T((e) => ({
21
+ "2005dcd1": z.value,
22
+ "06c2c966": B.value
23
23
  }));
24
- const t = $, {
24
+ const t = C, {
25
25
  activeRequest: b,
26
- activeRouterParams: w,
27
- activeWorkspace: c,
28
- folders: x,
29
- isReadOnly: l,
30
- requests: g,
31
- requestExamples: C
32
- } = H(), { collapsedSidebarFolders: h, toggleSidebarFolder: S } = Y(), v = o(() => "childUids" in t.item), R = o(() => t.parentUids.length ? l.value ? `${(t.parentUids.length - 1) * 12}px` : `${t.parentUids.length * 12}px` : "12px"), E = o(() => t.parentUids.length ? l.value ? `${(t.parentUids.length - 1) * 12}px` : `${t.parentUids.length * 12}px` : "0px"), U = (e) => {
26
+ activeRouterParams: S,
27
+ activeWorkspace: g,
28
+ folders: R,
29
+ isReadOnly: a,
30
+ requests: h,
31
+ requestExamples: E
32
+ } = Q(), { collapsedSidebarFolders: v, toggleSidebarFolder: I } = ee(), U = o(() => "childUids" in t.item), z = o(() => t.parentUids.length ? a.value ? `${(t.parentUids.length - 1) * 12}px` : `${t.parentUids.length * 12}px` : "12px"), B = o(() => t.parentUids.length ? a.value ? `${(t.parentUids.length - 1) * 12}px` : `${t.parentUids.length * 12}px` : "0px"), D = (e) => {
33
33
  var s;
34
34
  return "spec" in e ? (s = e.spec.info) == null ? void 0 : s.title : "summary" in e ? e.summary || e.path : "name" in e ? e.name : "";
35
- }, I = o(() => ("requestUid" in t.item ? g[t.item.requestUid] : t.item).method), z = o(
35
+ }, O = o(() => ("requestUid" in t.item ? h[t.item.requestUid] : t.item).method), V = o(
36
36
  () => {
37
37
  var e;
38
- return h[t.item.uid] || ((e = b.value) == null ? void 0 : e.uid) === t.item.uid && t.item.childUids.length > 1;
38
+ return v[t.item.uid] || ((e = b.value) == null ? void 0 : e.uid) === t.item.uid && t.item.childUids.length > 1;
39
39
  }
40
- ), B = () => "requestUid" in t.item ? `/workspace/${c.value.uid}/request/${t.item.requestUid}/examples/${t.item.uid}` : `/workspace/${c.value.uid}/request/${t.item.uid}`, O = o(
41
- () => w.value[G.Request] === "default" && b.value.uid === t.item.uid
40
+ ), j = () => "requestUid" in t.item ? `/workspace/${g.value.uid}/request/${t.item.requestUid}/examples/${t.item.uid}` : `/workspace/${g.value.uid}/request/${t.item.uid}`, N = o(
41
+ () => S.value[M.Request] === "default" && b.value.uid === t.item.uid
42
42
  );
43
43
  return (e, s) => {
44
- const V = L("RequestSidebarItem", !0);
45
- return a(), d("div", {
46
- class: u(["relative flex flex-row", [
47
- i(l) && e.parentUids.length > 1 || !i(l) && e.parentUids.length ? "before:bg-b-3 before:absolute before:left-[calc(.75rem_+_.5px)] before:top-0 before:z-10 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-px mb-[.5px] last:mb-0 indent-border-line-offset" : ""
44
+ const F = W("RequestSidebarItem", !0);
45
+ return r(), u("div", {
46
+ class: p(["relative flex flex-row", [
47
+ i(a) && e.parentUids.length > 1 || !i(a) && e.parentUids.length ? "before:bg-b-3 before:absolute before:left-[calc(.75rem_+_.5px)] before:top-0 before:z-10 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-px mb-[.5px] last:mb-0 indent-border-line-offset" : ""
48
48
  ]])
49
49
  }, [
50
- m(i(K), {
50
+ c(i(Y), {
51
51
  id: e.item.uid,
52
- ceiling: v.value ? 0.8 : 0.5,
52
+ ceiling: U.value ? 0.8 : 0.5,
53
53
  class: "flex flex-1 flex-col gap-[.5px] text-sm",
54
- floor: v.value ? 0.2 : 0.5,
54
+ floor: U.value ? 0.2 : 0.5,
55
55
  isDraggable: e.parentUids.length > 0 && e.isDraggable,
56
56
  isDroppable: e.isDroppable,
57
57
  parentIds: e.parentUids,
58
- onOnDragEnd: s[2] || (s[2] = (...r) => e.$emit("onDragEnd", ...r))
58
+ onOnDragEnd: s[2] || (s[2] = (...d) => e.$emit("onDragEnd", ...d))
59
59
  }, {
60
- default: D(() => [
61
- "summary" in e.item || "requestUid" in e.item ? (a(), p(i(M), {
62
- key: 0,
63
- class: "no-underline",
64
- to: B()
65
- }, {
66
- default: D(({ isExactActive: r }) => [
67
- n("div", {
68
- class: u(["group relative flex min-h-8 cursor-pointer flex-row items-start justify-between gap-2 py-1.5 pr-2 rounded editable-sidebar-hover", [
69
- q,
70
- r || O.value ? "bg-sidebar-active-b text-sidebar-active-c transition-none" : "text-sidebar-c-2"
71
- ]]),
72
- tabindex: "0"
73
- }, [
74
- n("span", Z, y(U(e.item)), 1),
75
- n("div", ee, [
76
- i(l) ? f("", !0) : (a(), p(Q, {
77
- key: 0,
78
- item: e.item
79
- }, null, 8, ["item"])),
80
- n("span", te, [
81
- k("   "),
82
- m(i(X), {
83
- class: "font-bold",
84
- method: I.value
85
- }, null, 8, ["method"])
86
- ])
87
- ])
88
- ], 2)
89
- ]),
90
- _: 1
91
- }, 8, ["to"])) : !i(l) || e.parentUids.length ? (a(), d("button", {
92
- key: 1,
93
- class: u(["hover:bg-b-2 group relative flex w-full flex-row justify-start gap-1.5 rounded p-1.5 z-[1]", q]),
94
- type: "button",
95
- onClick: s[0] || (s[0] = (r) => i(S)(e.item.uid))
96
- }, [
97
- n("span", ie, [
98
- P(e.$slots, "leftIcon", {}, () => [
60
+ default: k(() => {
61
+ var d, y;
62
+ return [
63
+ "summary" in e.item || "requestUid" in e.item ? (r(), m(i(Z), {
64
+ key: 0,
65
+ class: "no-underline",
66
+ to: j()
67
+ }, {
68
+ default: k(({ isExactActive: l }) => [
99
69
  n("div", {
100
- class: u({
101
- "rotate-90": i(h)[e.item.uid]
102
- })
70
+ class: p(["group relative flex min-h-8 cursor-pointer flex-row items-start justify-between gap-2 py-1.5 pr-2 rounded editable-sidebar-hover", [
71
+ x,
72
+ l || N.value ? "bg-sidebar-active-b text-sidebar-active-c transition-none" : "text-sidebar-c-2"
73
+ ]]),
74
+ tabindex: "0"
103
75
  }, [
104
- m(i(J), {
105
- class: "text-c-3 text-sm",
106
- icon: "ChevronRight",
107
- size: "sm",
108
- thickness: "2.5"
109
- })
76
+ n("span", te, w(D(e.item)), 1),
77
+ n("div", ie, [
78
+ i(a) ? f("", !0) : (r(), m($, {
79
+ key: 0,
80
+ item: e.item,
81
+ parentUids: e.parentUids
82
+ }, null, 8, ["item", "parentUids"])),
83
+ n("span", se, [
84
+ q("   "),
85
+ c(i(_), {
86
+ class: "font-bold",
87
+ method: O.value
88
+ }, null, 8, ["method"])
89
+ ])
90
+ ])
110
91
  ], 2)
111
- ], !0),
112
- k("   ")
113
- ]),
114
- n("span", se, y(U(e.item)), 1)
115
- ])) : f("", !0),
116
- "childUids" in e.item ? T((a(), d("div", re, [
117
- (a(!0), d(W, null, A("summary" in e.item ? e.item.childUids.slice(1) : e.item.childUids, (r) => (a(), p(V, {
118
- key: r,
119
- isDraggable: e.isDraggable,
120
- isDroppable: e.isDroppable,
121
- item: i(x)[r] || i(g)[r] || i(C)[r],
122
- parentUids: [...e.parentUids, e.item.uid],
123
- onOnDragEnd: s[1] || (s[1] = (...N) => e.$emit("onDragEnd", ...N))
124
- }, null, 8, ["isDraggable", "isDroppable", "item", "parentUids"]))), 128))
125
- ], 512)), [
126
- [_, z.value]
127
- ]) : f("", !0)
128
- ]),
92
+ ]),
93
+ _: 1
94
+ }, 8, ["to"])) : !i(a) || e.parentUids.length ? (r(), u("button", {
95
+ key: 1,
96
+ class: p(["hover:bg-b-2 group relative flex w-full flex-row justify-start gap-1.5 rounded p-1.5 z-[1]", x]),
97
+ type: "button",
98
+ onClick: s[0] || (s[0] = (l) => i(I)(e.item.uid))
99
+ }, [
100
+ n("span", re, [
101
+ A(e.$slots, "leftIcon", {}, () => [
102
+ n("div", {
103
+ class: p({
104
+ "rotate-90": i(v)[e.item.uid]
105
+ })
106
+ }, [
107
+ c(i(X), {
108
+ class: "text-c-3 text-sm",
109
+ icon: "ChevronRight",
110
+ size: "sm",
111
+ thickness: "2.5"
112
+ })
113
+ ], 2)
114
+ ], !0),
115
+ q("   ")
116
+ ]),
117
+ n("div", ne, [
118
+ n("span", ae, w(D(e.item)), 1),
119
+ !i(a) && ((y = (d = e.item.spec) == null ? void 0 : d.info) == null ? void 0 : y.title) !== "Drafts" ? (r(), m($, {
120
+ key: 0,
121
+ item: e.item,
122
+ parentUids: e.parentUids
123
+ }, null, 8, ["item", "parentUids"])) : f("", !0)
124
+ ])
125
+ ])) : f("", !0),
126
+ "childUids" in e.item ? G((r(), u("div", le, [
127
+ (r(!0), u(H, null, J("summary" in e.item ? e.item.childUids.slice(1) : e.item.childUids, (l) => (r(), m(F, {
128
+ key: l,
129
+ isDraggable: e.isDraggable,
130
+ isDroppable: e.isDroppable,
131
+ item: i(R)[l] || i(h)[l] || i(E)[l],
132
+ parentUids: [...e.parentUids, e.item.uid],
133
+ onOnDragEnd: s[1] || (s[1] = (...L) => e.$emit("onDragEnd", ...L))
134
+ }, null, 8, ["isDraggable", "isDroppable", "item", "parentUids"]))), 128))
135
+ ], 512)), [
136
+ [K, V.value]
137
+ ]) : f("", !0)
138
+ ];
139
+ }),
129
140
  _: 3
130
141
  }, 8, ["id", "ceiling", "floor", "isDraggable", "isDroppable", "parentIds"])
131
142
  ], 2);
@@ -133,5 +144,5 @@ const Z = { class: "z-10 font-medium w-full editable-sidebar-hover-item pl-2" },
133
144
  }
134
145
  });
135
146
  export {
136
- be as default
147
+ he as default
137
148
  };
@@ -1,8 +1,14 @@
1
+ import type { Collection } from '@scalar/oas-utils/entities/workspace/collection';
2
+ import type { Folder } from '@scalar/oas-utils/entities/workspace/folder';
1
3
  import type { Request, RequestExample } from '@scalar/oas-utils/entities/workspace/spec';
2
4
  declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
3
- item: Request | RequestExample;
5
+ /** Both inidicate the level and provide a way to traverse upwards */
6
+ parentUids: string[];
7
+ item: Collection | Folder | Request | RequestExample;
4
8
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
5
- item: Request | RequestExample;
9
+ /** Both inidicate the level and provide a way to traverse upwards */
10
+ parentUids: string[];
11
+ item: Collection | Folder | Request | RequestExample;
6
12
  }>>>, {}, {}>;
7
13
  export default _default;
8
14
  type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
@@ -1 +1 @@
1
- {"version":3,"file":"RequestSidebarItemMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebarItemMenu.vue"],"names":[],"mappings":"AA0MA,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACf,MAAM,2CAA2C,CAAA;;UAO1C,OAAO,GAAG,cAAc;;UAAxB,OAAO,GAAG,cAAc;;AAkdhC,wBAMG;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":"RequestSidebarItemMenu.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Request/RequestSidebarItemMenu.vue"],"names":[],"mappings":"AAkPA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAA;AACjF,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,6CAA6C,CAAA;AACzE,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACf,MAAM,2CAA2C,CAAA;;IAOhD,qEAAqE;gBACzD,MAAM,EAAE;UACd,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc;;IAFpD,qEAAqE;gBACzD,MAAM,EAAE;UACd,UAAU,GAAG,MAAM,GAAG,OAAO,GAAG,cAAc;;AAghBtD,wBAMG;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,93 +1,101 @@
1
- import { defineComponent as V, computed as q, ref as I, openBlock as E, createElementBlock as $, Fragment as B, createVNode as a, unref as e, withCtx as l, createBlock as A, createCommentVNode as F, createElementVNode as r, createTextVNode as C } from "vue";
2
- import P from "../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
3
- import { commandPaletteBus as T } from "../../libs/eventBusses/command-palette.js";
4
- import { PathId as b } from "../../router.js";
5
- import { useWorkspace as U } from "../../store/workspace.js";
6
- import { useModal as g, ScalarDropdown as W, ScalarDropdownItem as p, ScalarIcon as u, ScalarButton as f, ScalarModal as N, ScalarTextField as j } from "@scalar/components";
7
- import { useRouter as G } from "vue-router";
8
- const H = /* @__PURE__ */ r("span", null, "Add Example", -1), J = /* @__PURE__ */ r("span", null, "Rename", -1), K = /* @__PURE__ */ r("span", null, "Delete", -1), L = { class: "flex gap-3" }, ae = /* @__PURE__ */ V({
1
+ import { defineComponent as V, computed as p, ref as I, openBlock as M, createElementBlock as B, Fragment as A, createVNode as l, unref as t, withCtx as a, createBlock as F, createCommentVNode as P, withKeys as T, withModifiers as K, createElementVNode as u, createTextVNode as b } from "vue";
2
+ import W from "../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
3
+ import { commandPaletteBus as j } from "../../libs/eventBusses/command-palette.js";
4
+ import { PathId as E } from "../../router.js";
5
+ import { useWorkspace as G } from "../../store/workspace.js";
6
+ import { useModal as R, ScalarDropdown as H, ScalarDropdownItem as f, ScalarIcon as r, ScalarButton as v, ScalarModal as N, ScalarTextField as J } from "@scalar/components";
7
+ import { useRouter as L } from "vue-router";
8
+ const O = /* @__PURE__ */ u("span", null, "Add Example", -1), Q = /* @__PURE__ */ u("span", null, "Rename", -1), X = /* @__PURE__ */ u("span", null, "Delete", -1), Y = { class: "flex gap-3" }, se = /* @__PURE__ */ V({
9
9
  __name: "RequestSidebarItemMenu",
10
10
  props: {
11
+ parentUids: {},
11
12
  item: {}
12
13
  },
13
- setup(y) {
14
- const t = y, {
15
- activeWorkspace: v,
16
- activeRouterParams: x,
17
- findRequestFolders: D,
18
- requestMutators: _,
19
- requestExampleMutators: R
20
- } = U(), { replace: h } = G(), M = () => T.emit({
14
+ setup(S) {
15
+ const e = S, {
16
+ activeWorkspace: x,
17
+ activeRouterParams: h,
18
+ collectionMutators: k,
19
+ folderMutators: _,
20
+ requestMutators: C,
21
+ requestExampleMutators: y
22
+ } = G(), { replace: g } = L(), U = () => j.emit({
21
23
  commandName: "Add Example",
22
- metaData: t.item.uid
23
- }), S = () => {
24
- if ("requestUid" in t.item)
25
- R.delete(t.item), x.value[b.Examples] === t.item.uid && h(`/workspace/${v.value}/request/default`);
26
- else {
27
- const c = D(t.item.uid);
28
- if (!c.length) return;
29
- _.delete(t.item, c[0]), x.value[b.Request] === t.item.uid && h(`/workspace/${v.value.uid}/request/default`);
30
- }
31
- }, n = q(() => "summary" in t.item), k = q(() => "summary" in t.item ? t.item.summary || "" : "name" in t.item && t.item.name || ""), i = I(""), w = () => {
32
- "summary" in t.item ? _.edit(t.item.uid, "summary", i.value) : "summary" in t.item || R.edit(t.item.uid, "name", i.value), i.value = "", o.hide();
33
- }, o = g(), d = g(), z = () => {
34
- i.value = k.value, o.show();
35
- };
36
- return (c, s) => (E(), $(B, null, [
37
- a(e(W), { teleport: "#scalar-client" }, {
38
- items: l(() => [
39
- n.value ? (E(), A(e(p), {
24
+ metaData: e.item.uid
25
+ }), $ = () => {
26
+ "requestUid" in e.item ? (y.delete(e.item), h.value[E.Examples] === e.item.uid && g(`/workspace/${x.value}/request/default`)) : "summary" in e.item ? (C.delete(
27
+ e.item,
28
+ e.parentUids[e.parentUids.length - 1]
29
+ ), h.value[E.Request] === e.item.uid && g(`/workspace/${x.value.uid}/request/default`)) : "spec" in e.item ? k.delete(e.item) : "name" in e.item && _.delete(
30
+ e.item,
31
+ e.parentUids[e.parentUids.length - 1]
32
+ );
33
+ }, z = p(() => "summary" in e.item), w = p(() => {
34
+ var c;
35
+ return "summary" in e.item ? e.item.summary || "" : "name" in e.item ? e.item.name || "" : "spec" in e.item && ((c = e.item.spec.info) == null ? void 0 : c.title) || "";
36
+ }), n = I(""), q = () => {
37
+ "summary" in e.item ? C.edit(e.item.uid, "summary", n.value) : "requestUid" in e.item ? y.edit(e.item.uid, "name", n.value) : "spec" in e.item ? k.edit(e.item.uid, "spec.info.title", n.value) : _.edit(e.item.uid, "name", n.value), m.hide();
38
+ }, m = R(), d = R(), D = () => {
39
+ n.value = w.value, m.show();
40
+ }, o = p(() => "requestUid" in e.item ? "Example" : "summary" in e.item ? "Request" : "spec" in e.item ? "Collection" : "Folder");
41
+ return (c, i) => (M(), B(A, null, [
42
+ l(t(H), { teleport: "#scalar-client" }, {
43
+ items: a(() => [
44
+ z.value ? (M(), F(t(f), {
40
45
  key: 0,
41
46
  class: "flex !gap-2",
42
- onClick: M
47
+ onClick: U
43
48
  }, {
44
- default: l(() => [
45
- a(e(u), {
49
+ default: a(() => [
50
+ l(t(r), {
46
51
  class: "inline-flex",
47
52
  icon: "Add",
48
53
  size: "sm"
49
54
  }),
50
- H
55
+ O
51
56
  ]),
52
57
  _: 1
53
- })) : F("", !0),
54
- a(e(p), {
58
+ })) : P("", !0),
59
+ l(t(f), {
55
60
  class: "flex !gap-2",
56
- onClick: z
61
+ onClick: D
57
62
  }, {
58
- default: l(() => [
59
- a(e(u), {
63
+ default: a(() => [
64
+ l(t(r), {
60
65
  class: "inline-flex",
61
66
  icon: "Edit",
62
67
  size: "sm"
63
68
  }),
64
- J
69
+ Q
65
70
  ]),
66
71
  _: 1
67
72
  }),
68
- a(e(p), {
73
+ l(t(f), {
69
74
  class: "flex !gap-2",
70
- onClick: s[0] || (s[0] = (m) => e(d).show())
75
+ onClick: i[1] || (i[1] = (s) => t(d).show())
71
76
  }, {
72
- default: l(() => [
73
- a(e(u), {
77
+ default: a(() => [
78
+ l(t(r), {
74
79
  class: "inline-flex",
75
80
  icon: "Trash",
76
81
  size: "sm"
77
82
  }),
78
- K
83
+ X
79
84
  ]),
80
85
  _: 1
81
86
  })
82
87
  ]),
83
- default: l(() => [
84
- a(e(f), {
85
- class: "z-10 hover:bg-b-3 transition-none p-1 group-hover:flex ui-open:flex absolute left-0 hidden -translate-x-full -ml-1",
88
+ default: a(() => [
89
+ l(t(v), {
90
+ class: "px-1 py-0 z-10 hover:bg-b-3 hidden group-hover:flex ui-open:flex",
86
91
  size: "sm",
87
- variant: "ghost"
92
+ variant: "ghost",
93
+ onClick: i[0] || (i[0] = (s) => {
94
+ (o.value === "Collection" || o.value === "Folder") && s.stopPropagation();
95
+ })
88
96
  }, {
89
- default: l(() => [
90
- a(e(u), {
97
+ default: a(() => [
98
+ l(t(r), {
91
99
  icon: "Ellipses",
92
100
  size: "sm"
93
101
  })
@@ -97,48 +105,50 @@ const H = /* @__PURE__ */ r("span", null, "Add Example", -1), J = /* @__PURE__ *
97
105
  ]),
98
106
  _: 1
99
107
  }),
100
- a(e(N), {
108
+ l(t(N), {
101
109
  size: "sm",
102
- state: e(d),
103
- title: n.value ? "Delete Request" : "Delete Example"
110
+ state: t(d),
111
+ title: `Delete ${o.value}`
104
112
  }, {
105
- default: l(() => [
106
- a(P, {
107
- variableName: k.value,
108
- onClose: s[1] || (s[1] = (m) => e(d).hide()),
109
- onDelete: S
113
+ default: a(() => [
114
+ l(W, {
115
+ variableName: w.value,
116
+ onClose: i[2] || (i[2] = (s) => t(d).hide()),
117
+ onDelete: $
110
118
  }, null, 8, ["variableName"])
111
119
  ]),
112
120
  _: 1
113
121
  }, 8, ["state", "title"]),
114
- a(e(N), {
115
- state: e(o),
116
- title: n.value ? "Rename Request" : "Rename Example"
122
+ l(t(N), {
123
+ state: t(m),
124
+ title: `Rename ${o.value}`
117
125
  }, {
118
- default: l(() => [
119
- a(e(j), {
120
- modelValue: i.value,
121
- "onUpdate:modelValue": s[2] || (s[2] = (m) => i.value = m),
122
- label: n.value ? "Request" : "Example"
123
- }, null, 8, ["modelValue", "label"]),
124
- r("div", L, [
125
- a(e(f), {
126
+ default: a(() => [
127
+ l(t(J), {
128
+ modelValue: n.value,
129
+ "onUpdate:modelValue": i[3] || (i[3] = (s) => n.value = s),
130
+ label: o.value,
131
+ labelShadowColor: "var(--scalar-background-1)",
132
+ onKeydown: T(K(q, ["prevent"]), ["enter"])
133
+ }, null, 8, ["modelValue", "label", "onKeydown"]),
134
+ u("div", Y, [
135
+ l(t(v), {
126
136
  class: "flex-1",
127
137
  variant: "outlined",
128
- onClick: s[3] || (s[3] = (m) => e(o).hide())
138
+ onClick: i[4] || (i[4] = (s) => t(m).hide())
129
139
  }, {
130
- default: l(() => [
131
- C(" Cancel ")
140
+ default: a(() => [
141
+ b(" Cancel ")
132
142
  ]),
133
143
  _: 1
134
144
  }),
135
- a(e(f), {
145
+ l(t(v), {
136
146
  class: "flex-1",
137
147
  type: "submit",
138
- onClick: w
148
+ onClick: q
139
149
  }, {
140
- default: l(() => [
141
- C(" Save ")
150
+ default: a(() => [
151
+ b(" Save ")
142
152
  ]),
143
153
  _: 1
144
154
  })
@@ -150,5 +160,5 @@ const H = /* @__PURE__ */ r("span", null, "Add Example", -1), J = /* @__PURE__ *
150
160
  }
151
161
  });
152
162
  export {
153
- ae as default
163
+ se as default
154
164
  };
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.0.36",
21
+ "version": "2.0.38",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -126,11 +126,11 @@
126
126
  "vue": "^3.4.29",
127
127
  "vue-router": "^4.3.0",
128
128
  "zod": "^3.22.4",
129
- "@scalar/components": "0.12.22",
129
+ "@scalar/components": "0.12.24",
130
130
  "@scalar/draggable": "0.1.3",
131
- "@scalar/oas-utils": "0.2.19",
131
+ "@scalar/oas-utils": "0.2.20",
132
132
  "@scalar/object-utils": "1.1.5",
133
- "@scalar/themes": "0.9.16",
133
+ "@scalar/themes": "0.9.17",
134
134
  "@scalar/use-codemirror": "0.11.8",
135
135
  "@scalar/use-toasts": "0.7.4",
136
136
  "@scalar/use-tooltip": "1.0.2"
@@ -1,2 +0,0 @@
1
- export declare const handleKeyDown: (event: KeyboardEvent, handleSubmit: () => void) => void;
2
- //# sourceMappingURL=handleKeyDown.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"handleKeyDown.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/handleKeyDown.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,UACjB,aAAa,gBACN,MAAM,IAAI,SAOzB,CAAA"}
@@ -1,7 +0,0 @@
1
- import { isMacOS as t } from "@scalar/use-tooltip";
2
- const a = (r, o) => {
3
- e(r) && (r.stopPropagation(), r.preventDefault(), o());
4
- }, e = (r) => t() ? r.metaKey && r.key === "Enter" : r.ctrlKey && r.key === "Enter";
5
- export {
6
- a as handleKeyDown
7
- };