@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,95 +1,145 @@
1
- import { defineComponent as _, computed as g, openBlock as u, createBlock as f, unref as e, withCtx as o, createVNode as t, createCommentVNode as C, pushScopeId as S, popScopeId as v, createElementVNode as r } from "vue";
2
- import { ScalarDropdown as E, ScalarDropdownItem as c, ScalarIcon as i, ScalarButton as y } from "@scalar/components";
3
- import { commandPaletteBus as z } from "../../libs/event-busses/command-palette-bus.js";
4
- const m = (l) => (S("data-v-d6fc1c6f"), l = l(), v(), l), I = /* @__PURE__ */ m(() => /* @__PURE__ */ r("span", null, "Add Example", -1)), B = /* @__PURE__ */ m(() => /* @__PURE__ */ r("span", null, "Rename", -1)), D = /* @__PURE__ */ m(() => /* @__PURE__ */ r("span", null, "Delete", -1)), q = /* @__PURE__ */ _({
1
+ import { defineComponent as A, ref as y, watch as L, onMounted as P, onBeforeUnmount as V, openBlock as p, createElementBlock as K, Fragment as T, createBlock as E, unref as n, withKeys as U, withCtx as i, createVNode as a, createCommentVNode as C, pushScopeId as W, popScopeId as F, createElementVNode as v } from "vue";
2
+ import j from "../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
3
+ import G from "../../components/Sidebar/Actions/RenameSidebarListElement.vue.js";
4
+ import { PathId as x } from "../../router.js";
5
+ import { useModal as D, ScalarDropdown as H, ScalarDropdownItem as f, ScalarIcon as I, ScalarModal as S } from "@scalar/components";
6
+ import { useRouter as J } from "vue-router";
7
+ import { useWorkspace as O } from "../../store/store.js";
8
+ import { commandPaletteBus as Q } from "../../libs/event-busses/command-palette-bus.js";
9
+ const k = (s) => (W("data-v-59cf3dad"), s = s(), F(), s), X = /* @__PURE__ */ k(() => /* @__PURE__ */ v("span", null, "Add Example", -1)), Y = /* @__PURE__ */ k(() => /* @__PURE__ */ v("span", null, "Rename", -1)), Z = /* @__PURE__ */ k(() => /* @__PURE__ */ v("span", null, "Delete", -1)), re = /* @__PURE__ */ A({
5
10
  __name: "RequestSidebarItemMenu",
6
11
  props: {
7
- item: {},
8
- resourceTitle: {},
9
- static: { type: Boolean, default: !1 }
12
+ menuItem: {}
10
13
  },
11
- emits: ["delete", "rename"],
12
- setup(l, { emit: x }) {
13
- const a = l, d = x, h = () => z.emit({
14
- commandName: "Add Example",
15
- metaData: {
16
- itemUid: a.item.uid
17
- }
18
- }), k = g(() => "summary" in a.item);
19
- return (p, s) => (u(), f(e(E), {
20
- static: p.static,
21
- teleport: !p.static
22
- }, {
23
- items: o(() => [
24
- k.value ? (u(), f(e(c), {
14
+ emits: ["closeMenu"],
15
+ setup(s, { emit: N }) {
16
+ const o = s, _ = N, { replace: w } = J(), { activeWorkspace: R, activeRouterParams: $ } = O(), g = y(""), r = D(), c = D(), q = () => {
17
+ var e;
18
+ return Q.emit({
19
+ commandName: "Add Example",
20
+ metaData: {
21
+ itemUid: (e = o.menuItem.item) == null ? void 0 : e.entity.uid
22
+ }
23
+ });
24
+ }, z = () => {
25
+ var e;
26
+ g.value = ((e = o.menuItem.item) == null ? void 0 : e.title) || "", r.show();
27
+ }, B = (e) => {
28
+ var t;
29
+ g.value = e, (t = o.menuItem.item) == null || t.rename(e), r.hide();
30
+ }, b = () => {
31
+ var e, t, l;
32
+ (e = o.menuItem.item) == null || e.delete(), $.value[x.Request] === ((t = o.menuItem.item) == null ? void 0 : t.entity.uid) && w(`/workspace/${R.value.uid}/request/default`), $.value[x.Examples] === ((l = o.menuItem.item) == null ? void 0 : l.entity.uid) && w(`/workspace/${R.value}/request/default`);
33
+ }, u = y(null);
34
+ L([() => o.menuItem.open, u], async ([e]) => {
35
+ var t, l;
36
+ e && ((l = (t = u.value) == null ? void 0 : t.$parent) != null && l.$el) && u.value.$parent.$el.focus();
37
+ });
38
+ const h = () => o.menuItem.open && _("closeMenu");
39
+ return P(() => window.addEventListener("click", h)), V(() => window.removeEventListener("click", h)), (e, t) => {
40
+ var l, M;
41
+ return p(), K(T, null, [
42
+ e.menuItem.targetRef && e.menuItem.open ? (p(), E(n(H), {
25
43
  key: 0,
26
- class: "flex gap-2",
27
- onClick: h
44
+ static: "",
45
+ targetRef: e.menuItem.targetRef,
46
+ teleport: "",
47
+ onKeydown: t[1] || (t[1] = U((m) => e.$emit("closeMenu"), ["escape"]))
28
48
  }, {
29
- default: o(() => [
30
- t(e(i), {
31
- class: "inline-flex",
32
- icon: "Example",
33
- size: "md",
34
- thickness: "1.5"
35
- }),
36
- I
37
- ]),
49
+ items: i(() => {
50
+ var m;
51
+ return [
52
+ ((m = e.menuItem.item) == null ? void 0 : m.entity.type) === "request" ? (p(), E(n(f), {
53
+ key: 0,
54
+ class: "flex gap-2",
55
+ onClick: q
56
+ }, {
57
+ default: i(() => [
58
+ a(n(I), {
59
+ class: "inline-flex",
60
+ icon: "Example",
61
+ size: "md",
62
+ thickness: "1.5"
63
+ }),
64
+ X
65
+ ]),
66
+ _: 1
67
+ })) : C("", !0),
68
+ a(n(f), {
69
+ ref_key: "menuRef",
70
+ ref: u,
71
+ class: "flex gap-2",
72
+ onClick: z
73
+ }, {
74
+ default: i(() => [
75
+ a(n(I), {
76
+ class: "inline-flex",
77
+ icon: "Edit",
78
+ size: "md",
79
+ thickness: "1.5"
80
+ }),
81
+ Y
82
+ ]),
83
+ _: 1
84
+ }, 512),
85
+ a(n(f), {
86
+ class: "flex gap-2",
87
+ onClick: t[0] || (t[0] = (d) => n(c).show())
88
+ }, {
89
+ default: i(() => [
90
+ a(n(I), {
91
+ class: "inline-flex",
92
+ icon: "Delete",
93
+ size: "md",
94
+ thickness: "1.5"
95
+ }),
96
+ Z
97
+ ]),
98
+ _: 1
99
+ })
100
+ ];
101
+ }),
38
102
  _: 1
39
- })) : C("", !0),
40
- t(e(c), {
41
- class: "flex gap-2",
42
- onClick: s[1] || (s[1] = (n) => d("rename"))
103
+ }, 8, ["targetRef"])) : C("", !0),
104
+ a(n(S), {
105
+ size: "xxs",
106
+ state: n(c),
107
+ title: `Delete ${(l = e.menuItem.item) == null ? void 0 : l.resourceTitle}`
43
108
  }, {
44
- default: o(() => [
45
- t(e(i), {
46
- class: "inline-flex",
47
- icon: "Edit",
48
- size: "md",
49
- thickness: "1.5"
50
- }),
51
- B
52
- ]),
109
+ default: i(() => {
110
+ var m, d;
111
+ return [
112
+ a(j, {
113
+ variableName: ((m = e.menuItem.item) == null ? void 0 : m.title) ?? "",
114
+ warningMessage: (d = e.menuItem.item) == null ? void 0 : d.warning,
115
+ onClose: t[2] || (t[2] = (ee) => n(c).hide()),
116
+ onDelete: b
117
+ }, null, 8, ["variableName", "warningMessage"])
118
+ ];
119
+ }),
53
120
  _: 1
54
- }),
55
- t(e(c), {
56
- class: "flex gap-2",
57
- onClick: s[2] || (s[2] = (n) => d("delete"))
121
+ }, 8, ["state", "title"]),
122
+ a(n(S), {
123
+ size: "xxs",
124
+ state: n(r),
125
+ title: `Rename ${(M = e.menuItem.item) == null ? void 0 : M.resourceTitle}`
58
126
  }, {
59
- default: o(() => [
60
- t(e(i), {
61
- class: "inline-flex",
62
- icon: "Delete",
63
- size: "md",
64
- thickness: "1.5"
65
- }),
66
- D
67
- ]),
127
+ default: i(() => {
128
+ var m;
129
+ return [
130
+ a(G, {
131
+ name: ((m = e.menuItem.item) == null ? void 0 : m.title) ?? "",
132
+ onClose: t[3] || (t[3] = (d) => n(r).hide()),
133
+ onRename: B
134
+ }, null, 8, ["name"])
135
+ ];
136
+ }),
68
137
  _: 1
69
- })
70
- ]),
71
- default: o(() => [
72
- t(e(y), {
73
- class: "px-0.5 py-0 z-10 hover:bg-b-3 hidden group-hover:flex ui-open:flex absolute -translate-y-1/2 right-0 aspect-square inset-y-2/4 h-fit",
74
- size: "sm",
75
- variant: "ghost",
76
- onClick: s[0] || (s[0] = (n) => {
77
- (a.resourceTitle === "Collection" || a.resourceTitle === "Folder") && n.stopPropagation();
78
- })
79
- }, {
80
- default: o(() => [
81
- t(e(i), {
82
- icon: "Ellipses",
83
- size: "sm"
84
- })
85
- ]),
86
- _: 1
87
- })
88
- ]),
89
- _: 1
90
- }, 8, ["static", "teleport"]));
138
+ }, 8, ["state", "title"])
139
+ ], 64);
140
+ };
91
141
  }
92
142
  });
93
143
  export {
94
- q as default
144
+ re as default
95
145
  };
@@ -0,0 +1,2 @@
1
+ export * from './sidebar-item';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
@@ -0,0 +1 @@
1
+
@@ -0,0 +1,23 @@
1
+ import type { Collection, Request, RequestExample, RequestMethod, Tag } from '@scalar/oas-utils/entities/spec';
2
+ export type SidebarItem = {
3
+ title: string;
4
+ entity: Collection | Tag | Request | RequestExample;
5
+ resourceTitle: string;
6
+ children: string[];
7
+ method?: RequestMethod;
8
+ link?: string;
9
+ warning?: string;
10
+ rename: (name: string) => void;
11
+ delete: () => void;
12
+ };
13
+ export type SidebarMenuItem = {
14
+ /** The resource which we are opening the menu for */
15
+ item?: SidebarItem;
16
+ /** Array of parentUids used when nesting in the sidemenu */
17
+ parentUids?: string[];
18
+ /** Target ref from the button which triggered the menu for positioning */
19
+ targetRef?: HTMLButtonElement;
20
+ /** Controls wether the menu is open or not */
21
+ open: boolean;
22
+ };
23
+ //# sourceMappingURL=sidebar-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,GAAG,cAAc,CAAA;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;IAC9B,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
package/package.json CHANGED
@@ -18,7 +18,7 @@
18
18
  "rest",
19
19
  "testing"
20
20
  ],
21
- "version": "2.1.1",
21
+ "version": "2.1.4",
22
22
  "engines": {
23
23
  "node": ">=18"
24
24
  },
@@ -29,6 +29,10 @@
29
29
  "import": "./dist/index.js",
30
30
  "types": "./dist/index.d.ts"
31
31
  },
32
+ "./views/Request/types": {
33
+ "import": "./dist/views/Request/types/index.js",
34
+ "types": "./dist/views/Request/types/index.d.ts"
35
+ },
32
36
  "./views/Request/libs": {
33
37
  "import": "./dist/views/Request/libs/index.js",
34
38
  "types": "./dist/views/Request/libs/index.d.ts"
@@ -125,15 +129,15 @@
125
129
  "vue-router": "^4.3.0",
126
130
  "whatwg-mimetype": "^4.0.0",
127
131
  "zod": "^3.23.8",
128
- "@scalar/components": "0.12.45",
129
132
  "@scalar/draggable": "0.1.5",
130
- "@scalar/object-utils": "1.1.8",
131
- "@scalar/oas-utils": "0.2.44",
133
+ "@scalar/components": "0.12.46",
134
+ "@scalar/oas-utils": "0.2.45",
132
135
  "@scalar/openapi-parser": "0.8.3",
136
+ "@scalar/object-utils": "1.1.8",
133
137
  "@scalar/openapi-types": "0.1.1",
134
138
  "@scalar/themes": "0.9.30",
135
139
  "@scalar/types": "0.0.9",
136
- "@scalar/use-codemirror": "0.11.11",
140
+ "@scalar/use-codemirror": "0.11.12",
137
141
  "@scalar/use-toasts": "0.7.6",
138
142
  "@scalar/use-tooltip": "1.0.2"
139
143
  },
@@ -142,6 +146,7 @@
142
146
  "@types/js-cookie": "^3.0.6",
143
147
  "@types/whatwg-mimetype": "^3.0.2",
144
148
  "@vitejs/plugin-vue": "^5.0.4",
149
+ "@vue/test-utils": "^2.4.1",
145
150
  "autoprefixer": "^10.4.19",
146
151
  "jsdom": "^22.1.0",
147
152
  "postcss": "^8.4.38",