@scalar/api-client 2.14.0 → 2.15.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 (79) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/dist/libs/string-template.d.ts +2 -0
  3. package/dist/libs/string-template.d.ts.map +1 -1
  4. package/dist/style.css +1 -1
  5. package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
  6. package/dist/v2/blocks/operation-block/OperationBlock.vue.js +28 -51
  7. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +0 -12
  8. package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
  10. package/dist/v2/blocks/operation-block/components/Header.vue2.js +26 -28
  11. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +33 -0
  12. package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -0
  13. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +18 -0
  14. package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -0
  15. package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts +7 -0
  16. package/dist/v2/blocks/operation-block/helpers/decode-buffer.d.ts.map +1 -0
  17. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts +8 -0
  18. package/dist/v2/blocks/operation-block/helpers/get-delimiter.d.ts.map +1 -0
  19. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +4 -0
  20. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -0
  21. package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  23. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +134 -125
  24. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +2 -0
  25. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  26. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  27. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +11 -10
  28. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +2 -2
  29. package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
  30. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -4
  31. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
  33. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -2
  34. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  35. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +10 -10
  36. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +1 -1
  37. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
  38. package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +21 -15
  39. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +4 -13
  40. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  41. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  42. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +106 -70
  43. package/dist/v2/components/code-input/CodeInput.vue.d.ts +10 -1
  44. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  45. package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
  46. package/dist/v2/components/code-input/CodeInput.vue2.js +65 -51
  47. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +4 -0
  48. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  49. package/dist/v2/components/sidebar/Sidebar.vue.js +42 -39
  50. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  51. package/dist/v2/features/app/App.vue.js +64 -66
  52. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  53. package/dist/v2/features/app/components/AppSidebar.vue.js +2 -2
  54. package/dist/v2/features/app/components/AppSidebar.vue2.js +193 -106
  55. package/dist/v2/features/app/components/ItemDecorator.vue.d.ts +22 -0
  56. package/dist/v2/features/app/components/ItemDecorator.vue.d.ts.map +1 -0
  57. package/dist/v2/features/app/components/ItemDecorator.vue.js +138 -0
  58. package/dist/v2/features/app/components/ItemDecorator.vue2.js +4 -0
  59. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +8 -0
  60. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
  61. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +76 -68
  62. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +8 -0
  63. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
  64. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +83 -75
  65. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +4 -0
  66. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
  67. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +32 -34
  68. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +16 -0
  69. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  70. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +24 -21
  71. package/dist/v2/features/operation/Operation.vue.js +1 -1
  72. package/dist/v2/features/settings/DocumentSettings.vue.js +2 -2
  73. package/dist/v2/features/settings/DocumentSettings.vue2.js +1 -1
  74. package/dist/v2/helpers/storage.d.ts.map +1 -1
  75. package/dist/v2/helpers/storage.js +5 -5
  76. package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
  77. package/dist/v2/hooks/use-workspace-client-events.js +102 -61
  78. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  79. package/package.json +21 -21
@@ -1,17 +1,20 @@
1
- import { defineComponent as A, mergeModels as k, computed as p, capitalize as D, useModel as f, createBlock as S, openBlock as m, unref as o, createSlots as $, withCtx as i, createVNode as l, createTextVNode as u, toDisplayString as z, createElementVNode as s, normalizeClass as E, createElementBlock as M, createCommentVNode as w } from "vue";
2
- import { ScalarSidebarItem as N, ScalarButton as y } from "@scalar/components";
3
- import { ScalarIconGlobe as V } from "@scalar/icons";
4
- import q from "../../../../assets/rabbit.ascii.js";
5
- import G from "../../../../assets/rabbitjump.ascii.js";
6
- import W from "../../../../components/ScalarAsciiArt.vue.js";
7
- import { dragHandleFactory as R } from "../../../helpers/drag-handle-factory.js";
8
- import j from "../../../components/sidebar/Sidebar.vue.js";
9
- const H = {
1
+ import { defineComponent as T, mergeModels as w, computed as c, capitalize as x, useModel as B, ref as P, createElementBlock as C, openBlock as m, createVNode as r, createBlock as f, createCommentVNode as v, unref as i, createSlots as V, withCtx as l, createTextVNode as k, toDisplayString as q, createElementVNode as d, normalizeClass as G } from "vue";
2
+ import { useModal as R, ScalarIconButton as j, ScalarSidebarItem as H, ScalarButton as O, ScalarModal as K } from "@scalar/components";
3
+ import { ScalarIconDotsThree as L, ScalarIconGlobe as U } from "@scalar/icons";
4
+ import { getParentEntry as W } from "@scalar/workspace-store/navigation";
5
+ import F from "../../../../assets/rabbit.ascii.js";
6
+ import J from "../../../../assets/rabbitjump.ascii.js";
7
+ import M from "../../../../components/ScalarAsciiArt.vue.js";
8
+ import Y from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
9
+ import Q from "./ItemDecorator.vue.js";
10
+ import { dragHandleFactory as X } from "../../../helpers/drag-handle-factory.js";
11
+ import Z from "../../../components/sidebar/Sidebar.vue.js";
12
+ const _ = { class: "flex" }, ee = {
10
13
  key: 0,
11
14
  class: "empty-sidebar-item-content overflow-hidden px-2.5 py-2.5"
12
- }, L = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, P = { class: "gap-1.5 p-2" }, Y = /* @__PURE__ */ A({
15
+ }, te = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" }, ae = { class: "gap-1.5 p-2" }, ve = /* @__PURE__ */ T({
13
16
  __name: "AppSidebar",
14
- props: /* @__PURE__ */ k({
17
+ props: /* @__PURE__ */ w({
15
18
  layout: {},
16
19
  sidebarState: {},
17
20
  isWorkspaceOpen: { type: Boolean },
@@ -28,105 +31,189 @@ const H = {
28
31
  },
29
32
  sidebarWidthModifiers: {}
30
33
  }),
31
- emits: /* @__PURE__ */ k(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
32
- setup(r, { emit: B }) {
33
- const n = B, g = p(() => D(r.activeWorkspace.name)), b = f(r, "isSidebarOpen"), c = f(r, "sidebarWidth"), d = p(() => r.sidebarState.items.value.length <= 1), v = p(
34
- () => R({
35
- store: r.store,
36
- sidebarState: r.sidebarState
34
+ emits: /* @__PURE__ */ w(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
35
+ setup(n, { emit: h }) {
36
+ const u = h, I = c(() => x(n.activeWorkspace.name)), S = B(n, "isSidebarOpen"), y = B(n, "sidebarWidth"), b = c(() => n.sidebarState.items.value.length <= 1), g = c(
37
+ () => X({
38
+ store: n.store,
39
+ sidebarState: n.sidebarState
37
40
  })
38
- ), O = (t, e) => v.value.handleDragEnd(t, e), C = (t, e) => v.value.isDroppable(t, e);
39
- return (t, e) => (m(), S(o(j), {
40
- isSidebarOpen: b.value,
41
- "onUpdate:isSidebarOpen": e[3] || (e[3] = (a) => b.value = a),
42
- sidebarWidth: c.value,
43
- "onUpdate:sidebarWidth": e[4] || (e[4] = (a) => c.value = a),
44
- activeWorkspace: t.activeWorkspace,
45
- documents: Object.values(t.store.workspace.documents),
46
- eventBus: t.eventBus,
47
- isDroppable: C,
48
- layout: t.layout,
49
- sidebarState: t.sidebarState,
50
- workspaces: t.workspaces,
51
- "onCreate:workspace": e[5] || (e[5] = (a) => n("create:workspace")),
52
- onReorder: e[6] || (e[6] = (a, I) => O(a, I)),
53
- "onSelect:workspace": e[7] || (e[7] = (a) => n("select:workspace", a)),
54
- onSelectItem: e[8] || (e[8] = (a) => n("selectItem", a))
55
- }, $({
56
- workspaceButton: i(() => [
57
- l(o(N), {
58
- is: "button",
59
- active: t.isWorkspaceOpen,
60
- icon: o(V),
61
- onClick: e[0] || (e[0] = (a) => n("click:workspace"))
62
- }, {
63
- default: i(() => [
64
- u(z(g.value), 1)
65
- ]),
66
- _: 1
67
- }, 8, ["active", "icon"])
68
- ]),
69
- _: 2
70
- }, [
71
- t.layout !== "modal" ? {
72
- name: "footer",
73
- fn: i(() => [
74
- s("div", {
75
- class: E({
76
- "empty-sidebar-item border-t": d.value
77
- })
78
- }, [
79
- d.value ? (m(), M("div", H, [
80
- s("div", L, [
81
- l(W, {
82
- art: o(q),
83
- class: "rabbitsit font-bold"
84
- }, null, 8, ["art"]),
85
- l(W, {
86
- art: o(G),
87
- class: "rabbitjump absolute top-0 left-0 font-bold"
88
- }, null, 8, ["art"])
89
- ]),
90
- e[9] || (e[9] = s("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
91
- s("b", { class: "font-medium" }, "Let's Get Started"),
92
- s("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
93
- ], -1))
94
- ])) : w("", !0),
95
- s("div", P, [
96
- d.value ? (m(), S(o(y), {
97
- key: 0,
98
- class: "w-full",
99
- size: "sm",
100
- onClick: e[1] || (e[1] = (a) => t.eventBus.emit("ui:open:command-palette", {
101
- action: "import-from-openapi-swagger-postman-curl",
102
- payload: void 0
103
- }))
104
- }, {
105
- default: i(() => [...e[10] || (e[10] = [
106
- u(" Import Collection ", -1)
107
- ])]),
108
- _: 1
109
- })) : w("", !0),
110
- l(o(y), {
111
- class: "w-full",
112
- hotkey: "K",
113
- size: "sm",
114
- variant: "outlined",
115
- onClick: e[2] || (e[2] = (a) => t.eventBus.emit("ui:open:command-palette"))
116
- }, {
117
- default: i(() => [...e[11] || (e[11] = [
118
- u(" Add Item ", -1)
119
- ])]),
120
- _: 1
41
+ ), D = (t, e) => g.value.handleDragEnd(t, e), $ = (t, e) => g.value.isDroppable(t, e), o = P(null), p = R(), N = c(() => {
42
+ const t = o.value?.item;
43
+ return t?.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 ${t?.type ?? "item"}? This action cannot be undone.`;
44
+ }), z = () => {
45
+ const t = o.value?.item;
46
+ if (!t)
47
+ return;
48
+ const e = n.sidebarState.getEntryById(t.id), a = W("document", e), s = W("operation", e);
49
+ if (a) {
50
+ if (t.type === "document")
51
+ n.eventBus.emit("document:delete:document", { name: t.id });
52
+ else if (t.type === "tag")
53
+ n.eventBus.emit("tag:delete:tag", {
54
+ documentName: a.id,
55
+ name: t.name
56
+ });
57
+ else if (t.type === "operation") {
58
+ if (!s)
59
+ return;
60
+ n.eventBus.emit("operation:delete:operation", {
61
+ meta: {
62
+ method: s.method,
63
+ path: s.path
64
+ },
65
+ documentName: a.id
66
+ });
67
+ } else if (t.type === "example") {
68
+ if (!s)
69
+ return;
70
+ n.eventBus.emit("operation:delete:example", {
71
+ meta: {
72
+ method: s.method,
73
+ path: s.path,
74
+ exampleKey: t.name
75
+ },
76
+ documentName: a.id
77
+ });
78
+ }
79
+ p.hide(), o.value = null;
80
+ }
81
+ }, A = (t, e) => {
82
+ t.preventDefault(), t.stopPropagation(), o.value = {
83
+ item: e,
84
+ target: t.currentTarget,
85
+ isOpen: !0
86
+ };
87
+ }, E = () => {
88
+ o.value && (o.value.isOpen = !1);
89
+ };
90
+ return (t, e) => (m(), C("div", _, [
91
+ r(i(Z), {
92
+ isSidebarOpen: S.value,
93
+ "onUpdate:isSidebarOpen": e[3] || (e[3] = (a) => S.value = a),
94
+ sidebarWidth: y.value,
95
+ "onUpdate:sidebarWidth": e[4] || (e[4] = (a) => y.value = a),
96
+ activeWorkspace: t.activeWorkspace,
97
+ documents: Object.values(t.store.workspace.documents),
98
+ eventBus: t.eventBus,
99
+ isDroppable: $,
100
+ layout: t.layout,
101
+ sidebarState: t.sidebarState,
102
+ workspaces: t.workspaces,
103
+ "onCreate:workspace": e[5] || (e[5] = (a) => u("create:workspace")),
104
+ onReorder: e[6] || (e[6] = (a, s) => D(a, s)),
105
+ "onSelect:workspace": e[7] || (e[7] = (a) => u("select:workspace", a)),
106
+ onSelectItem: e[8] || (e[8] = (a) => u("selectItem", a))
107
+ }, V({
108
+ workspaceButton: l(() => [
109
+ r(i(H), {
110
+ is: "button",
111
+ active: t.isWorkspaceOpen,
112
+ icon: i(U),
113
+ onClick: e[0] || (e[0] = (a) => u("click:workspace"))
114
+ }, {
115
+ default: l(() => [
116
+ k(q(I.value), 1)
117
+ ]),
118
+ _: 1
119
+ }, 8, ["active", "icon"])
120
+ ]),
121
+ decorator: l(({ item: a }) => [
122
+ r(i(j), {
123
+ icon: i(L),
124
+ weight: "bold",
125
+ label: "More options",
126
+ size: "sm",
127
+ onClick: (s) => A(s, a)
128
+ }, null, 8, ["icon", "onClick"])
129
+ ]),
130
+ _: 2
131
+ }, [
132
+ t.layout !== "modal" ? {
133
+ name: "footer",
134
+ fn: l(() => [
135
+ d("div", {
136
+ class: G({
137
+ "empty-sidebar-item border-t": b.value
121
138
  })
122
- ])
123
- ], 2)
139
+ }, [
140
+ b.value ? (m(), C("div", ee, [
141
+ d("div", te, [
142
+ r(M, {
143
+ art: i(F),
144
+ class: "rabbitsit font-bold"
145
+ }, null, 8, ["art"]),
146
+ r(M, {
147
+ art: i(J),
148
+ class: "rabbitjump absolute top-0 left-0 font-bold"
149
+ }, null, 8, ["art"])
150
+ ]),
151
+ e[11] || (e[11] = d("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
152
+ d("b", { class: "font-medium" }, "Let's Get Started"),
153
+ d("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
154
+ ], -1))
155
+ ])) : v("", !0),
156
+ d("div", ae, [
157
+ b.value ? (m(), f(i(O), {
158
+ key: 0,
159
+ class: "w-full",
160
+ size: "sm",
161
+ onClick: e[1] || (e[1] = (a) => t.eventBus.emit("ui:open:command-palette", {
162
+ action: "import-from-openapi-swagger-postman-curl",
163
+ payload: void 0
164
+ }))
165
+ }, {
166
+ default: l(() => [...e[12] || (e[12] = [
167
+ k(" Import Collection ", -1)
168
+ ])]),
169
+ _: 1
170
+ })) : v("", !0),
171
+ r(i(O), {
172
+ class: "w-full",
173
+ hotkey: "K",
174
+ size: "sm",
175
+ variant: "outlined",
176
+ onClick: e[2] || (e[2] = (a) => t.eventBus.emit("ui:open:command-palette"))
177
+ }, {
178
+ default: l(() => [...e[13] || (e[13] = [
179
+ k(" Add Item ", -1)
180
+ ])]),
181
+ _: 1
182
+ })
183
+ ])
184
+ ], 2)
185
+ ]),
186
+ key: "0"
187
+ } : void 0
188
+ ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "eventBus", "layout", "sidebarState", "workspaces"]),
189
+ o.value && o.value.isOpen ? (m(), f(Q, {
190
+ key: 0,
191
+ eventBus: t.eventBus,
192
+ item: o.value.item,
193
+ sidebarState: t.sidebarState,
194
+ target: o.value.target,
195
+ onCloseMenu: E,
196
+ onShowDeleteModal: e[9] || (e[9] = (a) => i(p).show())
197
+ }, null, 8, ["eventBus", "item", "sidebarState", "target"])) : v("", !0),
198
+ o.value ? (m(), f(i(K), {
199
+ key: 1,
200
+ size: "xxs",
201
+ state: i(p),
202
+ title: `Delete ${o.value.item.title}`
203
+ }, {
204
+ default: l(() => [
205
+ r(Y, {
206
+ variableName: o.value.item.title,
207
+ warningMessage: N.value,
208
+ onClose: e[10] || (e[10] = (a) => i(p).hide()),
209
+ onDelete: z
210
+ }, null, 8, ["variableName", "warningMessage"])
124
211
  ]),
125
- key: "0"
126
- } : void 0
127
- ]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "eventBus", "layout", "sidebarState", "workspaces"]));
212
+ _: 1
213
+ }, 8, ["state", "title"])) : v("", !0)
214
+ ]));
128
215
  }
129
216
  });
130
217
  export {
131
- Y as default
218
+ ve as default
132
219
  };
@@ -0,0 +1,22 @@
1
+ import type { SidebarState } from '@scalar/sidebar';
2
+ import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
3
+ import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
4
+ type __VLS_Props = {
5
+ /** The item to display the decorator for */
6
+ item: TraversedEntry;
7
+ /** The event bus to emit events to */
8
+ eventBus: WorkspaceEventBus;
9
+ /** The sidebar state to get the parent entry from */
10
+ sidebarState: SidebarState<TraversedEntry>;
11
+ /** The target to position the dropdown relative to */
12
+ target: HTMLElement;
13
+ };
14
+ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
15
+ closeMenu: () => any;
16
+ showDeleteModal: () => any;
17
+ }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
18
+ onCloseMenu?: (() => any) | undefined;
19
+ onShowDeleteModal?: (() => any) | undefined;
20
+ }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
21
+ export default _default;
22
+ //# sourceMappingURL=ItemDecorator.vue.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ItemDecorator.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/ItemDecorator.vue"],"names":[],"mappings":"AAkLA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAA;AACnD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAIhF,KAAK,WAAW,GAAG;IACjB,4CAA4C;IAC5C,IAAI,EAAE,cAAc,CAAA;IACpB,sCAAsC;IACtC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,qDAAqD;IACrD,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAC1C,sDAAsD;IACtD,MAAM,EAAE,WAAW,CAAA;CACpB,CAAC;;;;;;;;AAsVF,wBAOG"}
@@ -0,0 +1,138 @@
1
+ import { defineComponent as M, ref as p, createBlock as d, openBlock as i, unref as n, withCtx as o, createVNode as l, withKeys as S, createCommentVNode as r, createElementVNode as c, createTextVNode as s } from "vue";
2
+ import { ScalarFloating as E, ScalarDropdownMenu as $, ScalarDropdownButton as y, ScalarIcon as f, ScalarDropdownDivider as b } from "@scalar/components";
3
+ import { getParentEntry as w } from "@scalar/workspace-store/navigation";
4
+ import { onClickOutside as z } from "@vueuse/core";
5
+ const N = { class: "flex items-center gap-2" }, O = { class: "flex items-center gap-2" }, T = { class: "flex items-center gap-2" }, V = { class: "text-red flex items-center gap-2" }, W = /* @__PURE__ */ M({
6
+ __name: "ItemDecorator",
7
+ props: {
8
+ item: {},
9
+ eventBus: {},
10
+ sidebarState: {},
11
+ target: {}
12
+ },
13
+ emits: ["closeMenu", "showDeleteModal"],
14
+ setup(e, { emit: B }) {
15
+ const u = B, g = p(null);
16
+ z(e.target, () => u("closeMenu"), {
17
+ ignore: [g]
18
+ });
19
+ const v = () => e.item.type === "document" || e.item.type === "tag", k = () => e.item.type === "document", x = () => e.item.type === "operation", A = () => e.item.type === "document" && e.item.id !== "drafts" || e.item.type === "tag" || e.item.type === "operation" || e.item.type === "example", D = () => {
20
+ if (e.item.type === "document" && e.eventBus.emit("ui:open:command-palette", {
21
+ action: "create-request",
22
+ payload: {
23
+ documentId: e.item.id
24
+ }
25
+ }), e.item.type === "tag") {
26
+ const a = e.sidebarState.getEntryById(e.item.id);
27
+ e.eventBus.emit("ui:open:command-palette", {
28
+ action: "create-request",
29
+ payload: {
30
+ documentId: w("document", a)?.id,
31
+ tagId: e.item.name
32
+ }
33
+ });
34
+ }
35
+ }, I = () => {
36
+ e.item.type === "document" && e.eventBus.emit("ui:open:command-palette", {
37
+ action: "add-tag",
38
+ payload: {
39
+ documentId: e.item.id
40
+ }
41
+ });
42
+ }, C = () => {
43
+ if (e.item.type === "operation") {
44
+ const a = e.sidebarState.getEntryById(e.item.id);
45
+ e.eventBus.emit("ui:open:command-palette", {
46
+ action: "add-example",
47
+ payload: {
48
+ documentId: w("document", a)?.id,
49
+ operationId: e.item.id
50
+ }
51
+ });
52
+ }
53
+ };
54
+ return (a, t) => (i(), d(n(E), {
55
+ placement: "bottom-end",
56
+ target: a.target,
57
+ teleport: ""
58
+ }, {
59
+ floating: o(() => [
60
+ l(n($), {
61
+ ref_key: "dropdownMenuRef",
62
+ ref: g,
63
+ onClick: t[4] || (t[4] = (m) => u("closeMenu")),
64
+ onKeydown: t[5] || (t[5] = S((m) => u("closeMenu"), ["escape"]))
65
+ }, {
66
+ default: o(() => [
67
+ v() ? (i(), d(n(y), {
68
+ key: 0,
69
+ onClick: t[0] || (t[0] = (m) => D())
70
+ }, {
71
+ default: o(() => [
72
+ c("div", N, [
73
+ l(n(f), {
74
+ icon: "Add",
75
+ size: "sm"
76
+ }),
77
+ t[6] || (t[6] = s(" Add Operation ", -1))
78
+ ])
79
+ ]),
80
+ _: 1
81
+ })) : r("", !0),
82
+ k() ? (i(), d(n(y), {
83
+ key: 1,
84
+ onClick: t[1] || (t[1] = (m) => I())
85
+ }, {
86
+ default: o(() => [
87
+ c("div", O, [
88
+ l(n(f), {
89
+ icon: "Add",
90
+ size: "sm"
91
+ }),
92
+ t[7] || (t[7] = s(" Add Tag ", -1))
93
+ ])
94
+ ]),
95
+ _: 1
96
+ })) : r("", !0),
97
+ x() ? (i(), d(n(y), {
98
+ key: 2,
99
+ onClick: t[2] || (t[2] = (m) => C())
100
+ }, {
101
+ default: o(() => [
102
+ c("div", T, [
103
+ l(n(f), {
104
+ icon: "Add",
105
+ size: "sm"
106
+ }),
107
+ t[8] || (t[8] = s(" Add Example ", -1))
108
+ ])
109
+ ]),
110
+ _: 1
111
+ })) : r("", !0),
112
+ (x() || v() || k()) && A() ? (i(), d(n(b), { key: 3 })) : r("", !0),
113
+ A() ? (i(), d(n(y), {
114
+ key: 4,
115
+ onClick: t[3] || (t[3] = (m) => u("showDeleteModal"))
116
+ }, {
117
+ default: o(() => [
118
+ c("div", V, [
119
+ l(n(f), {
120
+ icon: "Delete",
121
+ size: "sm"
122
+ }),
123
+ t[9] || (t[9] = s(" Delete ", -1))
124
+ ])
125
+ ]),
126
+ _: 1
127
+ })) : r("", !0)
128
+ ]),
129
+ _: 1
130
+ }, 512)
131
+ ]),
132
+ _: 1
133
+ }, 8, ["target"]));
134
+ }
135
+ });
136
+ export {
137
+ W as default
138
+ };
@@ -0,0 +1,4 @@
1
+ import f from "./ItemDecorator.vue.js";
2
+ export {
3
+ f as default
4
+ };
@@ -16,12 +16,20 @@ import type { WorkspaceStore } from '@scalar/workspace-store/client';
16
16
  declare const _default: import("vue").DefineComponent<{
17
17
  /** The workspace store for accessing documents and operations */
18
18
  workspaceStore: WorkspaceStore;
19
+ /** Document id to create the example for */
20
+ documentId?: string;
21
+ /** Preselected path and method to create the example for */
22
+ operationId?: string;
19
23
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
20
24
  close: () => any;
21
25
  back: (keyboardEvent: KeyboardEvent) => any;
22
26
  }, string, import("vue").PublicProps, Readonly<{
23
27
  /** The workspace store for accessing documents and operations */
24
28
  workspaceStore: WorkspaceStore;
29
+ /** Document id to create the example for */
30
+ documentId?: string;
31
+ /** Preselected path and method to create the example for */
32
+ operationId?: string;
25
33
  }> & Readonly<{
26
34
  onClose?: (() => any) | undefined;
27
35
  onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteExample.vue"],"names":[],"mappings":"AAoRA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAcpE;;;;;;;;;;;;;GAaG;;IAGD,iEAAiE;oBACjD,cAAc;;;;;IAD9B,iEAAiE;oBACjD,cAAc;;;;;AAHhC,wBAubC"}
1
+ {"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteExample.vue"],"names":[],"mappings":"AAoSA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAcpE;;;;;;;;;;;;;GAaG;;IAGD,iEAAiE;oBACjD,cAAc;IAC9B,4CAA4C;iBAC/B,MAAM;IACnB,4DAA4D;kBAC9C,MAAM;;;;;IALpB,iEAAiE;oBACjD,cAAc;IAC9B,4CAA4C;iBAC/B,MAAM;IACnB,4DAA4D;kBAC9C,MAAM;;;;;AAPtB,wBAucC"}