@scalar/api-client 2.1.25 → 2.1.27
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.
- package/CHANGELOG.md +26 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +150 -90
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +42 -42
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
- package/dist/layouts/App/create-api-client-app.d.ts +77 -20
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +14 -12
- package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.js +23 -26
- package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.js +12 -10
- package/dist/libs/create-client.d.ts +77 -20
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +60 -58
- package/dist/store/collections.d.ts +34 -4
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/import-spec.d.ts +43 -4
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/import-spec.js +60 -36
- package/dist/store/requests.d.ts +4 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +76 -76
- package/dist/store/security-schemes.d.ts +2 -2
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +35 -37
- package/dist/store/servers.d.ts +10 -10
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +154 -40
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +74 -72
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +23 -18
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +39 -38
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +4 -4
- package/dist/views/Request/RequestSidebar.vue2.js +107 -102
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
- package/dist/views/Request/libs/live-sync.d.ts +59 -0
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
- package/dist/views/Request/libs/live-sync.js +289 -0
- package/dist/views/Request/types/sidebar-item.d.ts +2 -0
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
- package/dist/views/Settings/Settings.vue2.js +15 -45
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.js +135 -102
- package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneralMode.vue.js +76 -68
- package/package.json +8 -6
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.1.27
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 4e50d65: feat: added openapi watcher to live update the api client
|
|
8
|
+
- 4e50d65: feat: adds watch toggle in request sidebar item menu
|
|
9
|
+
- Updated dependencies [4e50d65]
|
|
10
|
+
- Updated dependencies [4e50d65]
|
|
11
|
+
- Updated dependencies [4e50d65]
|
|
12
|
+
- Updated dependencies [4e50d65]
|
|
13
|
+
- Updated dependencies [4e50d65]
|
|
14
|
+
- Updated dependencies [6bbb815]
|
|
15
|
+
- @scalar/components@0.12.56
|
|
16
|
+
- @scalar/oas-utils@0.2.59
|
|
17
|
+
- @scalar/themes@0.9.40
|
|
18
|
+
- @scalar/use-codemirror@0.11.23
|
|
19
|
+
|
|
20
|
+
## 2.1.26
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- 8223e31: fix: updates proxy default setting
|
|
25
|
+
- f8b81ee: fix: new settings page
|
|
26
|
+
- 9e769df: fix: sets default request uid to request example
|
|
27
|
+
- a80a931: fix: command palette modal overflow
|
|
28
|
+
|
|
3
29
|
## 2.1.25
|
|
4
30
|
|
|
5
31
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA6sBA,wBASG"}
|
|
@@ -1,133 +1,193 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { useToasts as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { getOpenApiDocumentDetails as
|
|
7
|
-
import { isUrl as
|
|
8
|
-
import { useFileDialog as
|
|
9
|
-
import { useWorkspace as
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as M, ref as U, computed as w, watch as O, openBlock as a, createBlock as h, unref as l, withCtx as c, createElementVNode as d, createVNode as f, createTextVNode as n, normalizeClass as V, createElementBlock as i, Fragment as g, toDisplayString as _, createCommentVNode as N } from "vue";
|
|
2
|
+
import { useLoadingState as $, ScalarButton as F, ScalarIcon as L, ScalarTooltip as j, ScalarToggle as E, ScalarCodeBlock as J } from "@scalar/components";
|
|
3
|
+
import { useToasts as Y } from "@scalar/use-toasts";
|
|
4
|
+
import q from "./CommandActionForm.vue.js";
|
|
5
|
+
import G from "./CommandActionInput.vue.js";
|
|
6
|
+
import { getOpenApiDocumentDetails as H } from "../../libs/getOpenApiDocumentDetails.js";
|
|
7
|
+
import { isUrl as k } from "../../libs/isUrl.js";
|
|
8
|
+
import { useFileDialog as K } from "../../hooks/useFileDialog.js";
|
|
9
|
+
import { useWorkspace as Q } from "../../store/store.js";
|
|
10
|
+
const X = { class: "flex justify-between" }, Z = { class: "flex flex-row items-center justify-between gap-3 w-full" }, ee = { class: "grid gap-1.5 pointer-events-none max-w-[320px] w-content shadow-lg rounded bg-b-1 z-100 p-2 text-xxs leading-5 z-10 text-c-1" }, te = { class: "flex items-center text-c-2" }, oe = { key: 0 }, ae = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "text-pretty"
|
|
13
|
+
}, ve = /* @__PURE__ */ M({
|
|
11
14
|
__name: "CommandPaletteImport",
|
|
12
15
|
emits: ["close", "back"],
|
|
13
|
-
setup(
|
|
14
|
-
const
|
|
15
|
-
() =>
|
|
16
|
-
),
|
|
17
|
-
() =>
|
|
18
|
-
),
|
|
19
|
-
onChange: async (
|
|
20
|
-
const e =
|
|
16
|
+
setup(le, { emit: A }) {
|
|
17
|
+
const b = A, { activeWorkspace: x, importSpecFile: C, importSpecFromUrl: D } = Q(), { toast: m } = Y(), u = $(), t = U(""), p = U(!0), r = w(
|
|
18
|
+
() => H(t.value)
|
|
19
|
+
), S = w(
|
|
20
|
+
() => r.value ? r.value.type : "json"
|
|
21
|
+
), v = w(() => k(t.value)), R = w(() => !!r.value), { open: z } = K({
|
|
22
|
+
onChange: async (o) => {
|
|
23
|
+
const e = o == null ? void 0 : o[0];
|
|
21
24
|
if (e) {
|
|
22
|
-
const
|
|
23
|
-
|
|
25
|
+
const s = new FileReader();
|
|
26
|
+
s.onload = async (T) => {
|
|
24
27
|
var I;
|
|
25
|
-
const
|
|
28
|
+
const W = (I = T.target) == null ? void 0 : I.result;
|
|
26
29
|
try {
|
|
27
|
-
await
|
|
28
|
-
} catch (
|
|
29
|
-
console.error(
|
|
30
|
-
const
|
|
31
|
-
|
|
30
|
+
await C(W, x.value.uid), m("Import successful", "info"), b("close");
|
|
31
|
+
} catch (y) {
|
|
32
|
+
console.error(y);
|
|
33
|
+
const B = (y == null ? void 0 : y.message) || "Unknown error";
|
|
34
|
+
m(`Import failed: ${B}`, "error");
|
|
32
35
|
}
|
|
33
|
-
},
|
|
36
|
+
}, s.readAsText(e);
|
|
34
37
|
}
|
|
35
38
|
},
|
|
36
39
|
multiple: !1,
|
|
37
40
|
accept: ".json,.yaml,.yml"
|
|
38
41
|
});
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
O(v, (o) => {
|
|
43
|
+
o || (p.value = !1);
|
|
44
|
+
}), O(t, (o) => {
|
|
45
|
+
k(o) || (p.value = !1);
|
|
46
|
+
});
|
|
47
|
+
async function P() {
|
|
48
|
+
if (!(!t.value || u.isLoading)) {
|
|
49
|
+
u.startLoading();
|
|
42
50
|
try {
|
|
43
|
-
if (
|
|
44
|
-
await
|
|
51
|
+
if (v.value) {
|
|
52
|
+
const [o] = await D(
|
|
45
53
|
t.value,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
x.value.uid,
|
|
55
|
+
{
|
|
56
|
+
proxy: x.value.proxyUrl,
|
|
57
|
+
watchForChanges: p.value
|
|
58
|
+
}
|
|
49
59
|
);
|
|
50
|
-
|
|
51
|
-
|
|
60
|
+
if (o) {
|
|
61
|
+
m(
|
|
62
|
+
"There was a possible CORS error while importing your spec, please make sure this server is allowed in the CORS policy of your OpenAPI document.",
|
|
63
|
+
"error",
|
|
64
|
+
{ timeout: 5e3 }
|
|
65
|
+
), u.invalidate(2e3, !0);
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
} else if (R.value)
|
|
69
|
+
await C(
|
|
52
70
|
String(t.value),
|
|
53
|
-
|
|
71
|
+
x.value.uid
|
|
54
72
|
);
|
|
55
73
|
else {
|
|
56
|
-
|
|
74
|
+
m("Import failed: Invalid URL or OpenAPI document", "error"), u.invalidate(2e3, !0);
|
|
57
75
|
return;
|
|
58
76
|
}
|
|
59
|
-
|
|
60
|
-
} catch (
|
|
61
|
-
console.error("[importCollection]",
|
|
62
|
-
const e = (
|
|
63
|
-
|
|
77
|
+
u.clear(), b("close"), m("Import successful", "info");
|
|
78
|
+
} catch (o) {
|
|
79
|
+
console.error("[importCollection]", o);
|
|
80
|
+
const e = (o == null ? void 0 : o.message) || "Unknown error";
|
|
81
|
+
u.invalidate(2e3, !0), m(`Import failed: ${e}`, "error");
|
|
64
82
|
}
|
|
65
83
|
}
|
|
66
84
|
}
|
|
67
|
-
return (
|
|
85
|
+
return (o, e) => (a(), h(q, {
|
|
68
86
|
disabled: !t.value.trim(),
|
|
69
|
-
loading:
|
|
70
|
-
onSubmit:
|
|
87
|
+
loading: l(u),
|
|
88
|
+
onSubmit: P
|
|
71
89
|
}, {
|
|
72
|
-
options:
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
90
|
+
options: c(() => [
|
|
91
|
+
d("div", Z, [
|
|
92
|
+
f(l(F), {
|
|
93
|
+
class: "p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
94
|
+
variant: "outlined",
|
|
95
|
+
onClick: l(z)
|
|
96
|
+
}, {
|
|
97
|
+
default: c(() => [
|
|
98
|
+
e[6] || (e[6] = n(" JSON, or YAML File ")),
|
|
99
|
+
f(l(L), {
|
|
100
|
+
class: "text-c-3",
|
|
101
|
+
icon: "UploadSimple",
|
|
102
|
+
size: "md"
|
|
103
|
+
})
|
|
104
|
+
]),
|
|
105
|
+
_: 1
|
|
106
|
+
}, 8, ["onClick"]),
|
|
107
|
+
f(l(j), {
|
|
108
|
+
as: "div",
|
|
109
|
+
class: "z-[10001]",
|
|
110
|
+
side: "bottom",
|
|
111
|
+
sideOffset: 5
|
|
112
|
+
}, {
|
|
113
|
+
trigger: c(() => [
|
|
114
|
+
d("label", {
|
|
115
|
+
class: V([
|
|
116
|
+
"p-3 py-1.5 rounded flex items-center text-sm text-c-2 gap-2 select-none",
|
|
117
|
+
t.value && !v.value ? "cursor-default" : "cursor-pointer"
|
|
118
|
+
]),
|
|
119
|
+
for: "watch-toggle"
|
|
120
|
+
}, [
|
|
121
|
+
d("span", {
|
|
122
|
+
class: V(["text-c-1 flex gap-1 items-center font-medium text-xs", { "text-c-3": !p.value }])
|
|
123
|
+
}, [
|
|
124
|
+
f(l(L), {
|
|
125
|
+
icon: "Watch",
|
|
126
|
+
size: "sm"
|
|
127
|
+
}),
|
|
128
|
+
e[7] || (e[7] = n(" Watch Mode "))
|
|
129
|
+
], 2),
|
|
130
|
+
f(l(E), {
|
|
131
|
+
id: "watch-toggle",
|
|
132
|
+
modelValue: p.value,
|
|
133
|
+
"onUpdate:modelValue": e[3] || (e[3] = (s) => p.value = s),
|
|
134
|
+
disabled: !!t.value && !v.value
|
|
135
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
136
|
+
], 2)
|
|
137
|
+
]),
|
|
138
|
+
content: c(() => [
|
|
139
|
+
d("div", ee, [
|
|
140
|
+
d("div", te, [
|
|
141
|
+
t.value && !v.value ? (a(), i("span", oe, "Watch Mode is only supported with URL")) : (a(), i("span", ae, "Watch your OpenAPI URL for changes. Enabled it will update the API client for you."))
|
|
142
|
+
])
|
|
143
|
+
])
|
|
144
|
+
]),
|
|
145
|
+
_: 1
|
|
146
|
+
})
|
|
147
|
+
])
|
|
88
148
|
]),
|
|
89
|
-
submit:
|
|
90
|
-
e[
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
], 64)) :
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
], 64)) : (
|
|
97
|
-
|
|
149
|
+
submit: c(() => [
|
|
150
|
+
e[8] || (e[8] = n(" Import ")),
|
|
151
|
+
v.value ? (a(), i(g, { key: 0 }, [
|
|
152
|
+
n(" from URL ")
|
|
153
|
+
], 64)) : r.value && S.value ? (a(), i(g, { key: 1 }, [
|
|
154
|
+
r.value.title ? (a(), i(g, { key: 0 }, [
|
|
155
|
+
n(' "' + _(r.value.title) + '" ', 1)
|
|
156
|
+
], 64)) : (a(), i(g, { key: 1 }, [
|
|
157
|
+
n(_(r.value.version) + " Spec", 1)
|
|
98
158
|
], 64))
|
|
99
|
-
], 64)) : (
|
|
100
|
-
|
|
159
|
+
], 64)) : (a(), i(g, { key: 2 }, [
|
|
160
|
+
n("Collection")
|
|
101
161
|
], 64))
|
|
102
162
|
]),
|
|
103
|
-
default:
|
|
104
|
-
!
|
|
163
|
+
default: c(() => [
|
|
164
|
+
!r.value || l(k)(t.value) ? (a(), h(G, {
|
|
105
165
|
key: 0,
|
|
106
166
|
modelValue: t.value,
|
|
107
|
-
"onUpdate:modelValue": e[0] || (e[0] = (
|
|
108
|
-
placeholder: "
|
|
109
|
-
onOnDelete: e[1] || (e[1] = (
|
|
110
|
-
}, null, 8, ["modelValue"])) : (
|
|
111
|
-
|
|
112
|
-
e[
|
|
113
|
-
|
|
167
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => t.value = s),
|
|
168
|
+
placeholder: "OpenAPI/Swagger URL or document",
|
|
169
|
+
onOnDelete: e[1] || (e[1] = (s) => b("back", s))
|
|
170
|
+
}, null, 8, ["modelValue"])) : (a(), i(g, { key: 1 }, [
|
|
171
|
+
d("div", X, [
|
|
172
|
+
e[5] || (e[5] = d("div", { class: "pl-8 text-xs min-h-8 py-2 text-c-2" }, "Preview", -1)),
|
|
173
|
+
f(l(F), {
|
|
114
174
|
class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
|
|
115
175
|
variant: "ghost",
|
|
116
|
-
onClick: e[2] || (e[2] = (
|
|
176
|
+
onClick: e[2] || (e[2] = (s) => t.value = "")
|
|
117
177
|
}, {
|
|
118
|
-
default:
|
|
119
|
-
|
|
178
|
+
default: c(() => e[4] || (e[4] = [
|
|
179
|
+
n(" Clear ")
|
|
120
180
|
])),
|
|
121
181
|
_: 1
|
|
122
182
|
})
|
|
123
183
|
]),
|
|
124
|
-
|
|
184
|
+
r.value && !l(k)(t.value) ? (a(), h(l(J), {
|
|
125
185
|
key: 0,
|
|
126
186
|
class: "border max-h-[40dvh] mt-1 bg-b-2 rounded [--scalar-small:--scalar-font-size-4]",
|
|
127
187
|
content: t.value,
|
|
128
188
|
copy: !1,
|
|
129
|
-
lang:
|
|
130
|
-
}, null, 8, ["content", "lang"])) :
|
|
189
|
+
lang: S.value
|
|
190
|
+
}, null, 8, ["content", "lang"])) : N("", !0)
|
|
131
191
|
], 64))
|
|
132
192
|
]),
|
|
133
193
|
_: 1
|
|
@@ -135,5 +195,5 @@ const q = { class: "flex justify-between" }, le = /* @__PURE__ */ $({
|
|
|
135
195
|
}
|
|
136
196
|
});
|
|
137
197
|
export {
|
|
138
|
-
|
|
198
|
+
ve as default
|
|
139
199
|
};
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
declare const _default: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
7
7
|
export default _default;
|
|
8
8
|
export declare const PaletteComponents: {
|
|
9
|
-
readonly 'Import
|
|
9
|
+
readonly 'Import from OpenAPI/Swagger': import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
10
10
|
close: () => any;
|
|
11
11
|
back: (e: KeyboardEvent) => any;
|
|
12
12
|
}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AA2XA;;;;GAIG;;AACH,
|
|
1
|
+
{"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AA2XA;;;;GAIG;;AACH,wBA+eI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAQpB,CAAA;AAEV,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CAAA;AAEzD,MAAM,MAAM,mBAAmB,GAAG;IAChC,8DAA8D;IAC9D,WAAW,CAAC,EAAE,YAAY,CAAA;IAC1B,iEAAiE;IACjE,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAC/B,CACA"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import o from "./TheCommandPalette.vue2.js";
|
|
2
|
-
import { PaletteComponents as
|
|
2
|
+
import { PaletteComponents as f } from "./TheCommandPalette.vue2.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const
|
|
5
|
+
const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-d5ed30d9"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
f as PaletteComponents,
|
|
8
|
+
a as default
|
|
9
9
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useModal as oe, ScalarIcon as
|
|
1
|
+
import { defineComponent as O, ref as c, computed as E, watch as U, onMounted as G, onBeforeUnmount as Q, openBlock as a, createBlock as K, unref as r, withCtx as _, createElementVNode as u, createVNode as f, createTextVNode as M, createElementBlock as m, Fragment as p, withDirectives as T, withKeys as g, withModifiers as A, vModelText as j, renderList as B, toDisplayString as V, vShow as J, normalizeClass as X, createCommentVNode as Y, resolveDynamicComponent as Z, mergeProps as ee, nextTick as W } from "vue";
|
|
2
|
+
import { useModal as oe, ScalarIcon as S } from "@scalar/components";
|
|
3
3
|
import { Dialog as te, DialogPanel as ne, DialogTitle as ae } from "@headlessui/vue";
|
|
4
4
|
import { useRouter as le } from "vue-router";
|
|
5
5
|
import se from "./CommandPaletteCollection.vue.js";
|
|
6
6
|
import re from "./CommandPaletteExample.vue.js";
|
|
7
7
|
import me from "./CommandPaletteImport.vue.js";
|
|
8
|
-
import
|
|
9
|
-
import
|
|
8
|
+
import ie from "./CommandPaletteRequest.vue.js";
|
|
9
|
+
import ce from "./CommandPaletteServer.vue.js";
|
|
10
10
|
import ue from "./CommandPaletteTag.vue.js";
|
|
11
11
|
import de from "./CommandPaletteWorkspace.vue.js";
|
|
12
12
|
import { useWorkspace as fe } from "../../store/store.js";
|
|
@@ -16,17 +16,17 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
16
16
|
}, xe = {
|
|
17
17
|
name: "TheCommandPalette"
|
|
18
18
|
}, be = {
|
|
19
|
-
"Import
|
|
20
|
-
"Create Request":
|
|
19
|
+
"Import from OpenAPI/Swagger": me,
|
|
20
|
+
"Create Request": ie,
|
|
21
21
|
"Create Workspace": de,
|
|
22
22
|
"Add Tag": ue,
|
|
23
|
-
"Add Server":
|
|
23
|
+
"Add Server": ce,
|
|
24
24
|
"Create Collection": se,
|
|
25
25
|
"Add Example": re
|
|
26
|
-
}, Ee = /* @__PURE__ */
|
|
26
|
+
}, Ee = /* @__PURE__ */ O({
|
|
27
27
|
...xe,
|
|
28
|
-
setup(
|
|
29
|
-
const
|
|
28
|
+
setup(we) {
|
|
29
|
+
const D = [
|
|
30
30
|
{
|
|
31
31
|
label: "",
|
|
32
32
|
commands: [
|
|
@@ -35,7 +35,7 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
35
35
|
icon: "ExternalLink"
|
|
36
36
|
},
|
|
37
37
|
{
|
|
38
|
-
name: "Import
|
|
38
|
+
name: "Import from OpenAPI/Swagger",
|
|
39
39
|
icon: "Import"
|
|
40
40
|
},
|
|
41
41
|
{
|
|
@@ -75,23 +75,23 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
75
75
|
}
|
|
76
76
|
]
|
|
77
77
|
}
|
|
78
|
-
], d = oe(), { push: N } = le(), { activeWorkspace: H, events: v } = fe(), x =
|
|
79
|
-
() =>
|
|
78
|
+
], d = oe(), { push: N } = le(), { activeWorkspace: H, events: v } = fe(), x = c(), l = c(""), s = c(null), i = c(-1), P = c([]), C = E(
|
|
79
|
+
() => D.reduce((o, e) => {
|
|
80
80
|
const t = e.commands.filter(
|
|
81
81
|
(n) => n.name.toLowerCase().includes(l.value.toLowerCase())
|
|
82
82
|
);
|
|
83
83
|
return [...o, ...t];
|
|
84
84
|
}, [])
|
|
85
85
|
), h = () => {
|
|
86
|
-
d.hide(), l.value = "", s.value = null,
|
|
86
|
+
d.hide(), l.value = "", s.value = null, i.value = -1;
|
|
87
87
|
}, q = (o) => {
|
|
88
88
|
l.value !== "" && (o == null || o.preventDefault()), s.value = null, W(() => {
|
|
89
89
|
var e;
|
|
90
90
|
return (e = b.value) == null ? void 0 : e.focus();
|
|
91
91
|
});
|
|
92
|
-
},
|
|
92
|
+
}, $ = (o) => {
|
|
93
93
|
"path" in o ? (N(`/workspace/${H.value.uid}${o.path}`), h()) : s.value = o.name;
|
|
94
|
-
}, b =
|
|
94
|
+
}, b = c(), I = ({
|
|
95
95
|
commandName: o,
|
|
96
96
|
metaData: e
|
|
97
97
|
} = {}) => {
|
|
@@ -100,36 +100,36 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
100
100
|
return (t = b.value) == null ? void 0 : t.focus();
|
|
101
101
|
});
|
|
102
102
|
};
|
|
103
|
-
|
|
104
|
-
o && C.value.length > 0 && (
|
|
103
|
+
U(l, (o) => {
|
|
104
|
+
o && C.value.length > 0 && (i.value = 0);
|
|
105
105
|
});
|
|
106
|
-
const
|
|
106
|
+
const L = (o, e) => {
|
|
107
107
|
var k;
|
|
108
108
|
if (!d.open) return;
|
|
109
109
|
e.preventDefault();
|
|
110
110
|
const t = o === "up" ? -1 : 1, n = C.value.length;
|
|
111
|
-
|
|
111
|
+
i.value = (i.value + t + n) % n, (k = P.value[i.value]) == null || k.scrollIntoView({
|
|
112
112
|
behavior: "smooth",
|
|
113
113
|
block: "nearest"
|
|
114
114
|
});
|
|
115
|
-
},
|
|
116
|
-
() => C.value[
|
|
115
|
+
}, w = E(
|
|
116
|
+
() => C.value[i.value]
|
|
117
117
|
), F = (o) => {
|
|
118
|
-
!
|
|
119
|
-
},
|
|
118
|
+
!w.value || s.value || (o.preventDefault(), o.stopPropagation(), $(w.value));
|
|
119
|
+
}, R = (o) => {
|
|
120
120
|
d.open && o != null && o.closeModal && h();
|
|
121
121
|
};
|
|
122
|
-
return
|
|
123
|
-
v.commandPalette.on(
|
|
124
|
-
}),
|
|
125
|
-
v.commandPalette.off(
|
|
122
|
+
return G(() => {
|
|
123
|
+
v.commandPalette.on(I), v.hotKeys.on(R);
|
|
124
|
+
}), Q(() => {
|
|
125
|
+
v.commandPalette.off(I), v.hotKeys.off(R);
|
|
126
126
|
}), (o, e) => (a(), K(r(te), {
|
|
127
127
|
open: r(d).open,
|
|
128
128
|
onClose: e[5] || (e[5] = (t) => h())
|
|
129
129
|
}, {
|
|
130
130
|
default: _(() => [
|
|
131
131
|
e[7] || (e[7] = u("div", { class: "commandmenu-overlay z-overlay" }, null, -1)),
|
|
132
|
-
f(r(ne), { class: "commandmenu z-overlay
|
|
132
|
+
f(r(ne), { class: "commandmenu z-overlay" }, {
|
|
133
133
|
default: _(() => [
|
|
134
134
|
f(r(ae), { class: "sr-only" }, {
|
|
135
135
|
default: _(() => e[6] || (e[6] = [
|
|
@@ -143,7 +143,7 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
143
143
|
type: "button",
|
|
144
144
|
onClick: e[3] || (e[3] = (t) => s.value = null)
|
|
145
145
|
}, [
|
|
146
|
-
f(r(
|
|
146
|
+
f(r(S), {
|
|
147
147
|
icon: "ChevronLeft",
|
|
148
148
|
size: "md",
|
|
149
149
|
thickness: "1.5"
|
|
@@ -156,7 +156,7 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
156
156
|
], 64)) : (a(), m(p, { key: 0 }, [
|
|
157
157
|
u("div", pe, [
|
|
158
158
|
u("label", ve, [
|
|
159
|
-
f(r(
|
|
159
|
+
f(r(S), {
|
|
160
160
|
class: "text-c-2 mr-2.5",
|
|
161
161
|
icon: "Search",
|
|
162
162
|
size: "md",
|
|
@@ -174,20 +174,20 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
174
174
|
placeholder: "Search commands...",
|
|
175
175
|
type: "text",
|
|
176
176
|
onKeydown: [
|
|
177
|
-
e[1] || (e[1] = g(
|
|
178
|
-
g(
|
|
179
|
-
e[2] || (e[2] = g(
|
|
177
|
+
e[1] || (e[1] = g(A((t) => L("down", t), ["stop"]), ["down"])),
|
|
178
|
+
g(A(F, ["stop"]), ["enter"]),
|
|
179
|
+
e[2] || (e[2] = g(A((t) => L("up", t), ["stop"]), ["up"]))
|
|
180
180
|
]
|
|
181
181
|
}, null, 40, Ce), [
|
|
182
|
-
[
|
|
182
|
+
[j, l.value]
|
|
183
183
|
])
|
|
184
184
|
]),
|
|
185
|
-
(a(), m(p, null, B(
|
|
185
|
+
(a(), m(p, null, B(D, (t) => (a(), m(p, {
|
|
186
186
|
key: t.label
|
|
187
187
|
}, [
|
|
188
188
|
T(u("div", { class: "text-c-3 font-medium text-xs px-2 mb-1 mt-2" }, V(t.label), 513), [
|
|
189
189
|
[
|
|
190
|
-
|
|
190
|
+
J,
|
|
191
191
|
t.commands.filter(
|
|
192
192
|
(n) => n.name.toLowerCase().includes(l.value.toLowerCase())
|
|
193
193
|
).length > 0
|
|
@@ -200,15 +200,15 @@ const pe = { class: "bg-b-2 flex items-center rounded-md mb-2.5 pl-2 focus-withi
|
|
|
200
200
|
return a(), m("div", {
|
|
201
201
|
key: n.name,
|
|
202
202
|
ref_for: !0,
|
|
203
|
-
ref: (
|
|
204
|
-
|
|
203
|
+
ref: (y) => {
|
|
204
|
+
y && (P.value[k] = y);
|
|
205
205
|
},
|
|
206
206
|
class: X(["commandmenu-item text-sm flex items-center py-1.5 px-2 rounded hover:bg-b-2 cursor-pointer", {
|
|
207
|
-
"bg-b-2": n.name === ((z =
|
|
207
|
+
"bg-b-2": n.name === ((z = w.value) == null ? void 0 : z.name)
|
|
208
208
|
}]),
|
|
209
|
-
onClick: (
|
|
209
|
+
onClick: (y) => $(n)
|
|
210
210
|
}, [
|
|
211
|
-
f(r(
|
|
211
|
+
f(r(S), {
|
|
212
212
|
class: "text-c-2 mr-2.5",
|
|
213
213
|
icon: n.icon,
|
|
214
214
|
size: "md",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportNowButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportNowButton.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ImportNowButton.vue.d.ts","sourceRoot":"","sources":["../../../src/components/ImportCollection/ImportNowButton.vue"],"names":[],"mappings":";aA2GW,MAAM,GAAG,IAAI;cACZ,QAAQ,GAAG,MAAM;;;;aADlB,MAAM,GAAG,IAAI;cACZ,QAAQ,GAAG,MAAM;;;;AAgL7B,wBASG"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as b, openBlock as s, createElementBlock as v, Fragment as w, createBlock as m, unref as a, withCtx as p, createTextVNode as c, createCommentVNode as g } from "vue";
|
|
2
2
|
import { isUrl as h } from "./utils/isUrl.js";
|
|
3
3
|
import { ScalarButton as l } from "@scalar/components";
|
|
4
4
|
import { useToasts as F } from "@scalar/use-toasts";
|
|
5
5
|
import { useRouter as B } from "vue-router";
|
|
6
6
|
import { useWorkspace as I } from "../../store/store.js";
|
|
7
|
-
const R = /* @__PURE__ */
|
|
7
|
+
const R = /* @__PURE__ */ b({
|
|
8
8
|
__name: "ImportNowButton",
|
|
9
9
|
props: {
|
|
10
10
|
source: {},
|
|
@@ -12,20 +12,18 @@ const R = /* @__PURE__ */ x({
|
|
|
12
12
|
},
|
|
13
13
|
emits: ["importFinished"],
|
|
14
14
|
setup(f, { emit: d }) {
|
|
15
|
-
const o = f, k = d, y = B(), { importSpecFromUrl:
|
|
15
|
+
const o = f, k = d, y = B(), { importSpecFromUrl: C, importSpecFile: x, activeWorkspace: r } = I(), { toast: i } = F();
|
|
16
16
|
async function n() {
|
|
17
17
|
try {
|
|
18
18
|
if (o.source) {
|
|
19
19
|
if (h(o.source)) {
|
|
20
|
-
const t = await
|
|
20
|
+
const [t, e] = await C(
|
|
21
21
|
o.source,
|
|
22
|
-
void 0,
|
|
23
|
-
void 0,
|
|
24
22
|
r.value.uid
|
|
25
23
|
);
|
|
26
|
-
u(
|
|
24
|
+
t || u(e);
|
|
27
25
|
} else {
|
|
28
|
-
const t = await
|
|
26
|
+
const t = await x(
|
|
29
27
|
o.source,
|
|
30
28
|
r.value.uid
|
|
31
29
|
);
|
|
@@ -48,7 +46,7 @@ const R = /* @__PURE__ */ x({
|
|
|
48
46
|
}
|
|
49
47
|
});
|
|
50
48
|
}
|
|
51
|
-
return (t, e) => t.source ? (s(),
|
|
49
|
+
return (t, e) => t.source ? (s(), v(w, { key: 0 }, [
|
|
52
50
|
t.variant === "button" ? (s(), m(a(l), {
|
|
53
51
|
key: 0,
|
|
54
52
|
class: "text-[21px] py-2.5 px-6 rounded-lg font-bold h-fit mt-3 mb-1.5",
|