@scalar/api-client 2.0.32 → 2.0.34
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 +31 -0
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +39 -31
- package/dist/components/CommandPalette/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +65 -55
- package/dist/components/CommandPalette/CommandPaletteFolder.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteFolder.vue.js +53 -44
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +42 -34
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteRequest.vue.js +126 -70
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +37 -29
- 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 +97 -85
- package/dist/components/CommandPalette/handleKeyDown.d.ts +2 -0
- package/dist/components/CommandPalette/handleKeyDown.d.ts.map +1 -0
- package/dist/components/CommandPalette/handleKeyDown.js +7 -0
- package/dist/components/Form/Form.vue.js +1 -1
- package/dist/components/Search/SearchButton.vue.d.ts.map +1 -1
- package/dist/components/Search/SearchButton.vue.js +14 -16
- package/dist/components/Sidebar/SidebarButton.vue.js +1 -1
- package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarList.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue2.js +9 -9
- package/dist/constants.d.ts +0 -4
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/hooks/useDarkModeState.d.ts.map +1 -1
- package/dist/hooks/useDarkModeState.js +5 -5
- package/dist/layouts/App/create-api-client-app.d.ts +1 -1
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +9 -9
- package/dist/layouts/Modal/api-client-modal.d.ts +2 -2
- package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/api-client-modal.js +2 -2
- package/dist/libs/create-client.d.ts +2 -2
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +68 -68
- package/dist/libs/sendRequest.d.ts +2 -1
- package/dist/libs/sendRequest.d.ts.map +1 -1
- package/dist/libs/sendRequest.js +54 -45
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +2 -2
- package/dist/views/Request/Request.vue2.js +102 -103
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.js +37 -37
- package/package.json +6 -6
|
@@ -1,102 +1,158 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import { useWorkspace as
|
|
4
|
-
import { ScalarListbox as
|
|
5
|
-
import { useRouter as
|
|
6
|
-
|
|
1
|
+
import { defineComponent as T, ref as d, computed as v, onMounted as W, onBeforeUnmount as $, openBlock as V, createElementBlock as G, createElementVNode as u, withDirectives as K, vModelText as O, createVNode as o, unref as s, withCtx as r, normalizeClass as U, toDisplayString as S, createBlock as P, createCommentVNode as A, createTextVNode as H } from "vue";
|
|
2
|
+
import J from "../HttpMethod/HttpMethod.vue.js";
|
|
3
|
+
import { useWorkspace as Q } from "../../store/workspace.js";
|
|
4
|
+
import { ScalarListbox as M, ScalarButton as h, ScalarIcon as N } from "@scalar/components";
|
|
5
|
+
import { useRouter as X } from "vue-router";
|
|
6
|
+
import { handleKeyDown as R } from "./handleKeyDown.js";
|
|
7
|
+
const Y = { class: "flex w-full flex-col gap-3" }, Z = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, ee = /* @__PURE__ */ u("label", {
|
|
7
8
|
class: "absolute w-full h-full opacity-0 cursor-text",
|
|
8
9
|
for: "requestname"
|
|
9
|
-
}, null, -1),
|
|
10
|
+
}, null, -1), te = { class: "flex" }, le = { class: "flex flex-1 gap-2 max-h-8" }, re = /* @__PURE__ */ T({
|
|
10
11
|
__name: "CommandPaletteRequest",
|
|
11
12
|
emits: ["close"],
|
|
12
|
-
setup(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
setup(ae, { emit: E }) {
|
|
14
|
+
var g, q;
|
|
15
|
+
const I = E, { push: B } = X(), {
|
|
16
|
+
activeCollection: D,
|
|
17
|
+
activeWorkspace: j,
|
|
18
|
+
activeWorkspaceCollections: x,
|
|
19
|
+
requestMutators: z,
|
|
20
|
+
activeRequest: F,
|
|
21
|
+
folders: b
|
|
22
|
+
} = Q(), i = d(""), m = d("GET"), c = d(((g = D.value) == null ? void 0 : g.uid) ?? ""), w = v(
|
|
23
|
+
() => x.value.map((e) => {
|
|
24
|
+
var t;
|
|
25
|
+
return {
|
|
26
|
+
id: e.uid,
|
|
27
|
+
label: ((t = e.spec.info) == null ? void 0 : t.title) ?? "Unititled Collection"
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
), n = v({
|
|
31
|
+
get: () => w.value.find(({ id: e }) => e === c.value),
|
|
32
|
+
set: (e) => {
|
|
33
|
+
e != null && e.id && (c.value = e.id);
|
|
34
|
+
}
|
|
35
|
+
}), f = v(
|
|
36
|
+
() => x.value.flatMap(
|
|
37
|
+
(e) => e.uid === c.value ? e.childUids.flatMap((t) => {
|
|
38
|
+
const l = b[t];
|
|
39
|
+
return l ? [
|
|
24
40
|
{
|
|
25
|
-
id:
|
|
26
|
-
label:
|
|
41
|
+
id: l.uid,
|
|
42
|
+
label: l.name
|
|
27
43
|
}
|
|
28
44
|
] : [];
|
|
29
|
-
})
|
|
45
|
+
}) : []
|
|
30
46
|
)
|
|
31
|
-
),
|
|
32
|
-
|
|
47
|
+
), _ = d(
|
|
48
|
+
((q = Object.values(b).find(
|
|
49
|
+
(e) => {
|
|
50
|
+
var t;
|
|
51
|
+
return e.childUids.includes((t = F.value) == null ? void 0 : t.uid);
|
|
52
|
+
}
|
|
53
|
+
)) == null ? void 0 : q.uid) ?? ""
|
|
54
|
+
), a = v({
|
|
55
|
+
get: () => f.value.find(({ id: e }) => e === _.value),
|
|
33
56
|
set: (e) => {
|
|
34
|
-
e != null && e.id && (
|
|
57
|
+
e != null && e.id && (_.value = e.id);
|
|
35
58
|
}
|
|
36
59
|
});
|
|
37
|
-
function
|
|
38
|
-
|
|
60
|
+
function L(e) {
|
|
61
|
+
m.value = e;
|
|
39
62
|
}
|
|
40
|
-
const
|
|
41
|
-
var
|
|
42
|
-
if (!c.value) return;
|
|
43
|
-
const e = ((
|
|
63
|
+
const p = () => {
|
|
64
|
+
var l, k, y;
|
|
65
|
+
if (!c.value && !((l = a.value) != null && l.id)) return;
|
|
66
|
+
const e = ((k = a.value) == null ? void 0 : k.id) ?? ((y = n.value) == null ? void 0 : y.id), t = z.add(
|
|
44
67
|
{
|
|
45
68
|
path: "",
|
|
46
|
-
method:
|
|
47
|
-
description:
|
|
48
|
-
operationId:
|
|
49
|
-
summary:
|
|
69
|
+
method: m.value.toUpperCase(),
|
|
70
|
+
description: i.value,
|
|
71
|
+
operationId: i.value,
|
|
72
|
+
summary: i.value,
|
|
50
73
|
tags: ["default"]
|
|
51
74
|
},
|
|
52
75
|
e
|
|
53
76
|
);
|
|
54
|
-
|
|
55
|
-
},
|
|
56
|
-
return
|
|
77
|
+
B(`/workspace/${j.value.uid}/request/${t.uid}`), I("close");
|
|
78
|
+
}, C = d(null);
|
|
79
|
+
return W(() => {
|
|
57
80
|
var e;
|
|
58
|
-
(e =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
81
|
+
(e = C.value) == null || e.focus(), window.addEventListener(
|
|
82
|
+
"keydown",
|
|
83
|
+
(t) => R(t, p),
|
|
84
|
+
!0
|
|
85
|
+
);
|
|
86
|
+
}), $(() => {
|
|
87
|
+
window.removeEventListener(
|
|
88
|
+
"keydown",
|
|
89
|
+
(e) => R(e, p),
|
|
90
|
+
!0
|
|
91
|
+
);
|
|
92
|
+
}), (e, t) => (V(), G("div", Y, [
|
|
93
|
+
u("div", Z, [
|
|
94
|
+
ee,
|
|
95
|
+
K(u("input", {
|
|
66
96
|
id: "requestname",
|
|
67
97
|
ref_key: "requestInput",
|
|
68
|
-
ref:
|
|
69
|
-
"onUpdate:modelValue":
|
|
98
|
+
ref: C,
|
|
99
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => i.value = l),
|
|
70
100
|
class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
|
|
71
101
|
label: "Request Name",
|
|
72
102
|
placeholder: "Request Name"
|
|
73
103
|
}, null, 512), [
|
|
74
|
-
[
|
|
104
|
+
[O, i.value]
|
|
75
105
|
])
|
|
76
106
|
]),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
107
|
+
u("div", te, [
|
|
108
|
+
u("div", le, [
|
|
109
|
+
o(J, {
|
|
80
110
|
isEditable: !0,
|
|
81
111
|
isSquare: "",
|
|
82
|
-
method:
|
|
83
|
-
onChange:
|
|
112
|
+
method: m.value,
|
|
113
|
+
onChange: L
|
|
84
114
|
}, null, 8, ["method"]),
|
|
85
|
-
|
|
115
|
+
o(s(M), {
|
|
116
|
+
modelValue: n.value,
|
|
117
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => n.value = l),
|
|
118
|
+
options: w.value
|
|
119
|
+
}, {
|
|
120
|
+
default: r(() => [
|
|
121
|
+
o(s(h), {
|
|
122
|
+
class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
|
|
123
|
+
variant: "outlined"
|
|
124
|
+
}, {
|
|
125
|
+
default: r(() => [
|
|
126
|
+
u("span", {
|
|
127
|
+
class: U(n.value ? "text-c-1" : "text-c-3")
|
|
128
|
+
}, S(n.value ? n.value.label : "Select Collection"), 3),
|
|
129
|
+
o(s(N), {
|
|
130
|
+
class: "text-c-3",
|
|
131
|
+
icon: "ChevronDown",
|
|
132
|
+
size: "xs"
|
|
133
|
+
})
|
|
134
|
+
]),
|
|
135
|
+
_: 1
|
|
136
|
+
})
|
|
137
|
+
]),
|
|
138
|
+
_: 1
|
|
139
|
+
}, 8, ["modelValue", "options"]),
|
|
140
|
+
f.value.length ? (V(), P(s(M), {
|
|
141
|
+
key: 0,
|
|
86
142
|
modelValue: a.value,
|
|
87
|
-
"onUpdate:modelValue":
|
|
143
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => a.value = l),
|
|
88
144
|
options: f.value
|
|
89
145
|
}, {
|
|
90
|
-
default:
|
|
91
|
-
|
|
146
|
+
default: r(() => [
|
|
147
|
+
o(s(h), {
|
|
92
148
|
class: "justify-between p-2 max-h-8 w-full gap-1 text-xs hover:bg-b-2",
|
|
93
149
|
variant: "outlined"
|
|
94
150
|
}, {
|
|
95
|
-
default:
|
|
96
|
-
|
|
97
|
-
class:
|
|
98
|
-
},
|
|
99
|
-
|
|
151
|
+
default: r(() => [
|
|
152
|
+
u("span", {
|
|
153
|
+
class: U(a.value ? "text-c-1" : "text-c-3")
|
|
154
|
+
}, S(a.value ? a.value.label : "Select Folder"), 3),
|
|
155
|
+
o(s(N), {
|
|
100
156
|
class: "text-c-3",
|
|
101
157
|
icon: "ChevronDown",
|
|
102
158
|
size: "xs"
|
|
@@ -106,21 +162,21 @@ const G = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow
|
|
|
106
162
|
})
|
|
107
163
|
]),
|
|
108
164
|
_: 1
|
|
109
|
-
}, 8, ["modelValue", "options"])
|
|
165
|
+
}, 8, ["modelValue", "options"])) : A("", !0)
|
|
110
166
|
]),
|
|
111
|
-
|
|
167
|
+
o(s(h), {
|
|
112
168
|
class: "max-h-8 text-xs p-0 px-3",
|
|
113
|
-
|
|
169
|
+
onClick: p
|
|
114
170
|
}, {
|
|
115
|
-
default:
|
|
116
|
-
|
|
171
|
+
default: r(() => [
|
|
172
|
+
H(" Create Request ")
|
|
117
173
|
]),
|
|
118
174
|
_: 1
|
|
119
175
|
})
|
|
120
176
|
])
|
|
121
|
-
]
|
|
177
|
+
]));
|
|
122
178
|
}
|
|
123
179
|
});
|
|
124
180
|
export {
|
|
125
|
-
|
|
181
|
+
re as default
|
|
126
182
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPaletteWorkspace.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteWorkspace.vue"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"CommandPaletteWorkspace.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteWorkspace.vue"],"names":[],"mappings":";;;;;AAgOA,wBAMG"}
|
|
@@ -1,55 +1,63 @@
|
|
|
1
|
-
import { defineComponent as m, ref as l, onMounted as
|
|
1
|
+
import { defineComponent as m, ref as l, onMounted as f, onBeforeUnmount as w, openBlock as h, createElementBlock as k, createElementVNode as o, withDirectives as _, vModelText as x, createVNode as v, unref as b, withCtx as y, createTextVNode as N } from "vue";
|
|
2
2
|
import { useWorkspace as g } from "../../store/workspace.js";
|
|
3
|
-
import { ScalarButton as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
|
|
3
|
+
import { ScalarButton as C } from "@scalar/components";
|
|
4
|
+
import { useRouter as B } from "vue-router";
|
|
5
|
+
import { handleKeyDown as r } from "./handleKeyDown.js";
|
|
6
|
+
const E = { class: "flex w-full flex-col gap-3" }, V = { class: "gap-3 rounded bg-b-2 focus-within:bg-b-1 focus-within:shadow-border min-h-20 relative" }, W = /* @__PURE__ */ o("label", {
|
|
6
7
|
class: "absolute w-full h-full opacity-0 cursor-text",
|
|
7
8
|
for: "workspacename"
|
|
8
|
-
}, null, -1),
|
|
9
|
+
}, null, -1), M = { class: "flex" }, D = /* @__PURE__ */ o("div", { class: "flex flex-1 gap-2 max-h-8" }, null, -1), P = /* @__PURE__ */ m({
|
|
9
10
|
__name: "CommandPaletteWorkspace",
|
|
10
11
|
emits: ["close"],
|
|
11
|
-
setup(
|
|
12
|
-
const
|
|
13
|
-
const e =
|
|
14
|
-
name:
|
|
12
|
+
setup(I, { emit: c }) {
|
|
13
|
+
const u = c, { push: i } = B(), { workspaceMutators: d } = g(), s = l(""), n = () => {
|
|
14
|
+
const e = d.add({
|
|
15
|
+
name: s.value
|
|
15
16
|
});
|
|
16
|
-
|
|
17
|
-
},
|
|
18
|
-
return
|
|
17
|
+
i(`/workspace/${e.uid}`), u("close");
|
|
18
|
+
}, a = l(null);
|
|
19
|
+
return f(() => {
|
|
19
20
|
var e;
|
|
20
|
-
(e =
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
(e = a.value) == null || e.focus(), window.addEventListener(
|
|
22
|
+
"keydown",
|
|
23
|
+
(t) => r(t, n),
|
|
24
|
+
!0
|
|
25
|
+
);
|
|
26
|
+
}), w(() => {
|
|
27
|
+
window.removeEventListener(
|
|
28
|
+
"keydown",
|
|
29
|
+
(e) => r(e, n),
|
|
30
|
+
!0
|
|
31
|
+
);
|
|
32
|
+
}), (e, t) => (h(), k("div", E, [
|
|
33
|
+
o("div", V, [
|
|
34
|
+
W,
|
|
35
|
+
_(o("input", {
|
|
28
36
|
id: "workspacename",
|
|
29
37
|
ref_key: "workspaceInput",
|
|
30
|
-
ref:
|
|
31
|
-
"onUpdate:modelValue":
|
|
38
|
+
ref: a,
|
|
39
|
+
"onUpdate:modelValue": t[0] || (t[0] = (p) => s.value = p),
|
|
32
40
|
autofocus: "",
|
|
33
41
|
class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
|
|
34
42
|
label: "Workspace Name",
|
|
35
43
|
placeholder: "Workspace Name"
|
|
36
44
|
}, null, 512), [
|
|
37
|
-
[
|
|
45
|
+
[x, s.value]
|
|
38
46
|
])
|
|
39
47
|
]),
|
|
40
|
-
o("div",
|
|
41
|
-
|
|
42
|
-
|
|
48
|
+
o("div", M, [
|
|
49
|
+
D,
|
|
50
|
+
v(b(C), {
|
|
43
51
|
class: "max-h-8 text-xs p-0 px-3",
|
|
44
|
-
|
|
52
|
+
onClick: n
|
|
45
53
|
}, {
|
|
46
|
-
default:
|
|
54
|
+
default: y(() => [
|
|
47
55
|
N(" Continue ")
|
|
48
56
|
]),
|
|
49
57
|
_: 1
|
|
50
58
|
})
|
|
51
59
|
])
|
|
52
|
-
]
|
|
60
|
+
]));
|
|
53
61
|
}
|
|
54
62
|
});
|
|
55
63
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/TheCommandPalette.vue"],"names":[],"mappings":"AAkYA;;;;GAIG;;AACH,wBA2ZI;AAEJ,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAOpB,CAAA;AAEV,yCAAyC;AACzC,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,iBAAiB,CACxD"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import o from "./TheCommandPalette.vue2.js";
|
|
2
|
-
import { PaletteComponents as
|
|
2
|
+
import { PaletteComponents as s } 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-84799061"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
s as PaletteComponents,
|
|
8
|
+
a as default
|
|
9
9
|
};
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useModal as
|
|
3
|
-
import { useMagicKeys as
|
|
4
|
-
import { useRouter as
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
import { defineComponent as K, ref as u, computed as F, onMounted as q, onBeforeUnmount as I, openBlock as l, createElementBlock as m, Fragment as d, withDirectives as h, createElementVNode as c, vShow as L, unref as p, createVNode as S, vModelText as N, renderList as B, toDisplayString as M, normalizeClass as T, createTextVNode as U, createBlock as G, resolveDynamicComponent as H } from "vue";
|
|
2
|
+
import { useModal as O, ScalarIcon as A } from "@scalar/components";
|
|
3
|
+
import { useMagicKeys as Q, whenever as k } from "@vueuse/core";
|
|
4
|
+
import { useRouter as j } from "vue-router";
|
|
5
|
+
import { isMacOS as J } from "@scalar/use-tooltip";
|
|
6
|
+
import { commandPaletteBus as P } from "../../libs/eventBusses/command-palette.js";
|
|
7
|
+
import { useWorkspace as X } from "../../store/workspace.js";
|
|
8
|
+
import Y from "./CommandPaletteCollection.vue.js";
|
|
9
|
+
import Z from "./CommandPaletteExample.vue.js";
|
|
10
|
+
import ee from "./CommandPaletteFolder.vue.js";
|
|
11
|
+
import oe from "./CommandPaletteImport.vue.js";
|
|
12
|
+
import te from "./CommandPaletteRequest.vue.js";
|
|
13
|
+
import ne from "./CommandPaletteWorkspace.vue.js";
|
|
14
|
+
const ae = { class: "commandmenu" }, re = { class: "bg-b-2 flex items-center rounded mb-2 pl-2 focus-within:bg-b-1 focus-within:shadow-border" }, le = { for: "commandmenu" }, se = ["onClick"], me = {
|
|
14
15
|
name: "TheCommandPalette"
|
|
15
|
-
},
|
|
16
|
-
"Import Collection":
|
|
17
|
-
"Create Request":
|
|
18
|
-
"Create Workspace":
|
|
19
|
-
"Add Folder":
|
|
20
|
-
"Create Collection":
|
|
21
|
-
"Add Example":
|
|
22
|
-
},
|
|
23
|
-
...
|
|
24
|
-
setup(
|
|
16
|
+
}, ce = {
|
|
17
|
+
"Import Collection": oe,
|
|
18
|
+
"Create Request": te,
|
|
19
|
+
"Create Workspace": ne,
|
|
20
|
+
"Add Folder": ee,
|
|
21
|
+
"Create Collection": Y,
|
|
22
|
+
"Add Example": Z
|
|
23
|
+
}, Ee = /* @__PURE__ */ K({
|
|
24
|
+
...me,
|
|
25
|
+
setup(ie) {
|
|
25
26
|
const b = [
|
|
26
27
|
{
|
|
27
28
|
label: "Add to Request Sidebar",
|
|
@@ -72,127 +73,138 @@ const ee = { class: "commandmenu" }, oe = { class: "bg-b-2 flex items-center rou
|
|
|
72
73
|
}
|
|
73
74
|
]
|
|
74
75
|
}
|
|
75
|
-
],
|
|
76
|
-
() => b.reduce((e,
|
|
77
|
-
const
|
|
78
|
-
(
|
|
76
|
+
], f = Q(), a = O(), { push: V } = j(), { activeWorkspace: W } = X(), $ = u(), i = u(""), s = u(null), t = u(0), w = u([]), _ = F(
|
|
77
|
+
() => b.reduce((e, n) => {
|
|
78
|
+
const o = n.commands.filter(
|
|
79
|
+
(C) => C.name.toLowerCase().includes(i.value.toLowerCase())
|
|
79
80
|
);
|
|
80
|
-
return [...e, ...
|
|
81
|
+
return [...e, ...o];
|
|
81
82
|
}, [])
|
|
82
|
-
),
|
|
83
|
-
a.hide(),
|
|
83
|
+
), v = () => {
|
|
84
|
+
a.hide(), i.value = "", s.value = null, window.removeEventListener("keydown", y, !0);
|
|
84
85
|
};
|
|
85
|
-
|
|
86
|
-
a.open &&
|
|
87
|
-
}),
|
|
86
|
+
k(f.escape, () => {
|
|
87
|
+
a.open && v();
|
|
88
|
+
}), k(f.enter, () => {
|
|
88
89
|
if (!a.open) return;
|
|
89
|
-
const e = _.value[
|
|
90
|
-
|
|
91
|
-
}),
|
|
90
|
+
const e = _.value[t.value];
|
|
91
|
+
g(e);
|
|
92
|
+
}), k(f.ArrowDown, () => {
|
|
92
93
|
var e;
|
|
93
|
-
a.open && (
|
|
94
|
+
a.open && (t.value < _.value.length - 1 ? t.value++ : t.value = 0, (e = w.value[t.value]) == null || e.scrollIntoView({
|
|
94
95
|
behavior: "smooth",
|
|
95
96
|
block: "center"
|
|
96
97
|
}));
|
|
97
|
-
}),
|
|
98
|
+
}), k(f.ArrowUp, () => {
|
|
98
99
|
var e;
|
|
99
|
-
a.open && (
|
|
100
|
+
a.open && (t.value > 0 ? t.value-- : t.value = _.value.length - 1, (e = w.value[t.value]) == null || e.scrollIntoView({
|
|
100
101
|
behavior: "smooth",
|
|
101
102
|
block: "center"
|
|
102
103
|
}));
|
|
103
104
|
});
|
|
104
|
-
const
|
|
105
|
-
"path" in e ? (V(`/workspace/${W.value.uid}${e.path}`),
|
|
106
|
-
}, D = ({
|
|
105
|
+
const g = (e) => {
|
|
106
|
+
"path" in e ? (V(`/workspace/${W.value.uid}${e.path}`), v()) : s.value = e.name;
|
|
107
|
+
}, D = u(), R = ({
|
|
107
108
|
commandName: e,
|
|
108
|
-
metaData:
|
|
109
|
+
metaData: n
|
|
109
110
|
} = {}) => {
|
|
110
|
-
|
|
111
|
+
var o;
|
|
112
|
+
s.value = e ?? null, $.value = n, a.show(), (o = D.value) == null || o.focus(), window.addEventListener("keydown", y, !0);
|
|
111
113
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
+
q(() => P.on(R)), I(() => P.off(R));
|
|
115
|
+
const z = (e) => J() ? e.metaKey && e.key === "Enter" : e.ctrlKey && e.key === "Enter", y = (e) => {
|
|
116
|
+
z(e) && !s.value && (e.stopPropagation(), e.preventDefault());
|
|
117
|
+
};
|
|
118
|
+
return I(() => {
|
|
119
|
+
window.removeEventListener("keydown", y, !0);
|
|
120
|
+
}), (e, n) => (l(), m(d, null, [
|
|
121
|
+
h(c("div", {
|
|
114
122
|
class: "commandmenu-clickout",
|
|
115
|
-
onClick:
|
|
123
|
+
onClick: n[0] || (n[0] = (o) => v())
|
|
116
124
|
}, null, 512), [
|
|
117
|
-
[
|
|
125
|
+
[L, p(a).open]
|
|
118
126
|
]),
|
|
119
|
-
h(
|
|
120
|
-
|
|
121
|
-
|
|
127
|
+
h(c("div", ae, [
|
|
128
|
+
s.value ? (l(), m(d, { key: 1 }, [
|
|
129
|
+
c("button", {
|
|
122
130
|
class: "absolute p-1 hover:bg-b-3 rounded text-c-3 active:text-c-1 m-1.5 z-10",
|
|
123
131
|
type: "button",
|
|
124
|
-
onClick:
|
|
132
|
+
onClick: n[2] || (n[2] = (o) => s.value = null)
|
|
125
133
|
}, [
|
|
126
|
-
|
|
134
|
+
S(p(A), {
|
|
127
135
|
icon: "ChevronLeft",
|
|
128
136
|
size: "sm"
|
|
129
137
|
})
|
|
130
138
|
]),
|
|
131
|
-
(
|
|
132
|
-
metaData:
|
|
133
|
-
onClose:
|
|
139
|
+
(l(), G(H(ce[s.value]), {
|
|
140
|
+
metaData: $.value,
|
|
141
|
+
onClose: v
|
|
134
142
|
}, null, 40, ["metaData"]))
|
|
135
|
-
], 64)) : (
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
143
|
+
], 64)) : (l(), m(d, { key: 0 }, [
|
|
144
|
+
c("div", re, [
|
|
145
|
+
c("label", le, [
|
|
146
|
+
S(p(A), {
|
|
139
147
|
class: "text-c-1 mr-2.5",
|
|
140
148
|
icon: "Search",
|
|
141
149
|
size: "sm",
|
|
142
150
|
thickness: "1.5"
|
|
143
151
|
})
|
|
144
152
|
]),
|
|
145
|
-
h(
|
|
153
|
+
h(c("input", {
|
|
146
154
|
id: "commandmenu",
|
|
147
|
-
|
|
155
|
+
ref_key: "commandInputRef",
|
|
156
|
+
ref: D,
|
|
157
|
+
"onUpdate:modelValue": n[1] || (n[1] = (o) => i.value = o),
|
|
158
|
+
autocomplete: "off",
|
|
159
|
+
autofocus: "",
|
|
148
160
|
class: "w-full rounded bg-none border-none py-1.5 text-sm focus:outline-none",
|
|
149
161
|
placeholder: "Search commands...",
|
|
150
162
|
type: "text"
|
|
151
163
|
}, null, 512), [
|
|
152
|
-
[
|
|
164
|
+
[N, i.value]
|
|
153
165
|
])
|
|
154
166
|
]),
|
|
155
|
-
(
|
|
156
|
-
key:
|
|
167
|
+
(l(), m(d, null, B(b, (o, C) => (l(), m(d, {
|
|
168
|
+
key: o.label
|
|
157
169
|
}, [
|
|
158
|
-
h(
|
|
170
|
+
h(c("div", { class: "text-c-3 font-medium text-xs mt-2" }, M(o.label), 513), [
|
|
159
171
|
[
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
(
|
|
172
|
+
L,
|
|
173
|
+
o.commands.filter(
|
|
174
|
+
(r) => r.name.toLowerCase().includes(i.value.toLowerCase())
|
|
163
175
|
).length > 0
|
|
164
176
|
]
|
|
165
177
|
]),
|
|
166
|
-
(
|
|
167
|
-
(
|
|
168
|
-
), (
|
|
169
|
-
key:
|
|
178
|
+
(l(!0), m(d, null, B(o.commands.filter(
|
|
179
|
+
(r) => r.name.toLowerCase().includes(i.value.toLowerCase())
|
|
180
|
+
), (r, x) => (l(), m("div", {
|
|
181
|
+
key: r.name,
|
|
170
182
|
ref_for: !0,
|
|
171
|
-
ref: (
|
|
172
|
-
|
|
183
|
+
ref: (E) => {
|
|
184
|
+
E && (w.value[x] = E);
|
|
173
185
|
},
|
|
174
|
-
class:
|
|
175
|
-
"bg-b-2":
|
|
186
|
+
class: T(["commandmenu-item text-sm flex items-center py-1.5 px-2 rounded hover:bg-b-2 cursor-pointer", {
|
|
187
|
+
"bg-b-2": C > 0 ? t.value === x + b[C - 1].commands.length : t.value === x
|
|
176
188
|
}]),
|
|
177
|
-
onClick: (
|
|
189
|
+
onClick: (E) => g(r)
|
|
178
190
|
}, [
|
|
179
|
-
|
|
191
|
+
S(p(A), {
|
|
180
192
|
class: "text-c-1 mr-2.5",
|
|
181
|
-
icon:
|
|
193
|
+
icon: r.icon,
|
|
182
194
|
size: "md",
|
|
183
195
|
thickness: "1.5"
|
|
184
196
|
}, null, 8, ["icon"]),
|
|
185
|
-
|
|
186
|
-
], 10,
|
|
197
|
+
U(" " + M(r.name), 1)
|
|
198
|
+
], 10, se))), 128))
|
|
187
199
|
], 64))), 64))
|
|
188
200
|
], 64))
|
|
189
201
|
], 512), [
|
|
190
|
-
[
|
|
202
|
+
[L, p(a).open]
|
|
191
203
|
])
|
|
192
204
|
], 64));
|
|
193
205
|
}
|
|
194
206
|
});
|
|
195
207
|
export {
|
|
196
|
-
|
|
197
|
-
|
|
208
|
+
ce as PaletteComponents,
|
|
209
|
+
Ee as default
|
|
198
210
|
};
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|