@macrulez/vue-command-palette 0.1.2 → 0.2.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.
- package/README.md +420 -14
- package/dist/components/CommandGroup.vue.d.ts +8 -6
- package/dist/components/CommandItem.vue.d.ts +11 -3
- package/dist/components/CommandPalette.test.d.ts +1 -0
- package/dist/components/CommandPalette.vue.d.ts +336 -7
- package/dist/components/VirtualList.vue.d.ts +2 -0
- package/dist/core/CommandStore.d.ts +278 -7
- package/dist/core/CommandStore.test.d.ts +1 -0
- package/dist/core/FuzzySearch.d.ts +13 -1
- package/dist/core/generics.test.d.ts +1 -0
- package/dist/core/useCommandPalette.d.ts +40 -7
- package/dist/core/useCommandPalette.test.d.ts +1 -0
- package/dist/index.d.ts +4 -4
- package/dist/plugin.d.ts +22 -1
- package/dist/plugin.test.d.ts +1 -0
- package/dist/testing.d.ts +281 -10
- package/dist/types.d.ts +122 -10
- package/dist/vue-command-palette.js +1457 -713
- package/dist/vue-command-palette.umd.cjs +1 -1
- package/package.json +5 -1
- package/dist/style.css +0 -1
|
@@ -1,402 +1,682 @@
|
|
|
1
|
-
import { h as
|
|
2
|
-
function
|
|
3
|
-
return
|
|
1
|
+
import { h as Ee, reactive as ht, ref as R, computed as b, inject as pe, watch as re, readonly as Te, onUnmounted as lt, defineComponent as Ke, openBlock as u, createElementBlock as f, normalizeClass as ie, renderSlot as $, createCommentVNode as M, createBlock as te, resolveDynamicComponent as De, withCtx as S, createTextVNode as we, toDisplayString as K, createElementVNode as w, Fragment as P, renderList as q, normalizeStyle as Me, withModifiers as kt, createSlots as ce, mergeProps as D, nextTick as xe, provide as Re, onMounted as Gt, unref as T, Teleport as Bt, createVNode as We, Transition as zt, withDirectives as pt, isRef as Nt, vModelText as Ut, normalizeProps as Xe, guardReactiveProps as Ze, vShow as Yt } from "vue";
|
|
2
|
+
function Vt(n) {
|
|
3
|
+
return n.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
4
4
|
}
|
|
5
|
-
function
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
if (a < n.length) return { score: -1, matches: [] };
|
|
17
|
-
const b = [];
|
|
18
|
-
let w = c[0], g = c[0];
|
|
19
|
-
for (let $ = 1; $ < c.length; $++)
|
|
20
|
-
c[$] === g + 1 || (b.push([w, g]), w = c[$]), g = c[$];
|
|
21
|
-
b.push([w, g]);
|
|
22
|
-
const I = v / (s.length || 1);
|
|
23
|
-
return { score: Math.max(1, 40 - I * 20), matches: b };
|
|
5
|
+
function qt(n) {
|
|
6
|
+
const a = [], s = [];
|
|
7
|
+
let r = 0;
|
|
8
|
+
for (const g of n) {
|
|
9
|
+
const m = r;
|
|
10
|
+
r += g.length;
|
|
11
|
+
const k = g.normalize("NFD").replace(/\p{Diacritic}/gu, "").toLowerCase();
|
|
12
|
+
for (const C of k)
|
|
13
|
+
a.push(C), s.push(m);
|
|
14
|
+
}
|
|
15
|
+
return s.push(n.length), { normalized: a.join(""), map: s };
|
|
24
16
|
}
|
|
25
|
-
function
|
|
26
|
-
return
|
|
17
|
+
function et(n, a) {
|
|
18
|
+
return n.map(([s, r]) => [a[s], a[r + 1] - 1]);
|
|
27
19
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
20
|
+
function Ie(n, a) {
|
|
21
|
+
const s = Vt(n), { normalized: r, map: g } = qt(a);
|
|
22
|
+
if (!s) return { score: 0, matches: [] };
|
|
23
|
+
if (r === s) return { score: 100, matches: [[0, a.length - 1]] };
|
|
24
|
+
if (r.startsWith(s)) return { score: 80, matches: et([[0, s.length - 1]], g) };
|
|
25
|
+
const m = r.indexOf(s);
|
|
26
|
+
if (m !== -1) return { score: 60, matches: et([[m, m + s.length - 1]], g) };
|
|
27
|
+
const k = [];
|
|
28
|
+
let C = 0, y = 0, p = -1;
|
|
29
|
+
for (let h = 0; h < r.length && C < s.length; h++)
|
|
30
|
+
r[h] === s[C] && (k.push(h), p !== -1 && (y += h - p - 1), p = h, C++);
|
|
31
|
+
if (C < s.length) return { score: -1, matches: [] };
|
|
32
|
+
const I = [];
|
|
33
|
+
let L = k[0], c = k[0];
|
|
34
|
+
for (let h = 1; h < k.length; h++)
|
|
35
|
+
k[h] === c + 1 || (I.push([L, c]), L = k[h]), c = k[h];
|
|
36
|
+
I.push([L, c]);
|
|
37
|
+
const d = y / (a.length || 1);
|
|
38
|
+
return { score: Math.max(1, 40 - d * 20), matches: et(I, g) };
|
|
39
|
+
}
|
|
40
|
+
function tt(n) {
|
|
41
|
+
return !(n.disabled || n.enabled && !n.enabled());
|
|
42
|
+
}
|
|
43
|
+
function Ft(n, a, s = !1) {
|
|
44
|
+
if (!n.trim()) return [];
|
|
45
|
+
const r = [];
|
|
46
|
+
for (const g of a) {
|
|
47
|
+
if (!tt(g) && !s) continue;
|
|
48
|
+
const m = Ie(n, g.label);
|
|
49
|
+
let k = m.score, C = "label", y;
|
|
50
|
+
if (g.description) {
|
|
51
|
+
const p = Ie(n, g.description);
|
|
52
|
+
p.score >= 60 && p.score > k && (k = p.score, C = "description");
|
|
53
|
+
}
|
|
54
|
+
for (const p of g.keywords ?? []) {
|
|
55
|
+
const I = Ie(n, p);
|
|
56
|
+
I.score > k && (k = I.score, C = "keyword", y = p);
|
|
37
57
|
}
|
|
38
|
-
for (const
|
|
39
|
-
const
|
|
40
|
-
|
|
58
|
+
for (const p of g.aliases ?? []) {
|
|
59
|
+
const I = Ie(n, p);
|
|
60
|
+
I.score > k && (k = I.score, C = "alias", y = p);
|
|
41
61
|
}
|
|
42
|
-
|
|
62
|
+
k > 0 && r.push({
|
|
63
|
+
command: g,
|
|
64
|
+
score: k,
|
|
65
|
+
matches: m.score > 0 ? m.matches : [],
|
|
66
|
+
matchedField: C,
|
|
67
|
+
matchedText: y
|
|
68
|
+
});
|
|
43
69
|
}
|
|
44
|
-
return
|
|
70
|
+
return r.sort((g, m) => {
|
|
71
|
+
if (s) {
|
|
72
|
+
const k = tt(g.command) ? 1 : 0, C = tt(m.command) ? 1 : 0;
|
|
73
|
+
if (k !== C) return C - k;
|
|
74
|
+
}
|
|
75
|
+
return it(g, m);
|
|
76
|
+
});
|
|
45
77
|
}
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
78
|
+
function it(n, a) {
|
|
79
|
+
const s = n.matches.length ? 1 : 0, r = a.matches.length ? 1 : 0;
|
|
80
|
+
return s !== r ? r - s : a.score - n.score;
|
|
81
|
+
}
|
|
82
|
+
function Se(n, a) {
|
|
83
|
+
const s = Ie(n, a);
|
|
84
|
+
return s.score > 0 ? s.matches : [];
|
|
85
|
+
}
|
|
86
|
+
function nt(n, a) {
|
|
87
|
+
if (!a.length) return Ee("span", n);
|
|
88
|
+
const s = [];
|
|
49
89
|
let r = 0;
|
|
50
|
-
for (const [
|
|
51
|
-
r <
|
|
52
|
-
return r <
|
|
90
|
+
for (const [g, m] of a)
|
|
91
|
+
r < g && s.push(Ee("span", n.slice(r, g))), s.push(Ee("mark", { class: "vcp-match" }, n.slice(g, m + 1))), r = m + 1;
|
|
92
|
+
return r < n.length && s.push(Ee("span", n.slice(r))), Ee("span", s);
|
|
53
93
|
}
|
|
54
|
-
function
|
|
55
|
-
const
|
|
94
|
+
function Jt(n, a = !0, s, r = !1) {
|
|
95
|
+
const g = n ?? ((c, d) => Ft(c, d, r)), m = ht({
|
|
56
96
|
groups: /* @__PURE__ */ new Map(),
|
|
57
97
|
commands: /* @__PURE__ */ new Map()
|
|
58
98
|
});
|
|
59
|
-
function
|
|
60
|
-
for (const
|
|
61
|
-
if (
|
|
62
|
-
const
|
|
63
|
-
|
|
99
|
+
function k(c, d) {
|
|
100
|
+
for (const h of c)
|
|
101
|
+
if (m.commands.set(h.id, h), d && m.groups.has(d)) {
|
|
102
|
+
const _ = m.groups.get(d);
|
|
103
|
+
_.commands.find((x) => x.id === h.id) || _.commands.push(h);
|
|
64
104
|
}
|
|
65
105
|
return () => {
|
|
66
|
-
for (const
|
|
67
|
-
if (
|
|
68
|
-
const
|
|
69
|
-
|
|
106
|
+
for (const h of c)
|
|
107
|
+
if (m.commands.delete(h.id), d && m.groups.has(d)) {
|
|
108
|
+
const _ = m.groups.get(d), x = _.commands.findIndex((E) => E.id === h.id);
|
|
109
|
+
x !== -1 && _.commands.splice(x, 1);
|
|
70
110
|
}
|
|
71
111
|
};
|
|
72
112
|
}
|
|
73
|
-
function
|
|
74
|
-
|
|
75
|
-
for (const
|
|
76
|
-
|
|
113
|
+
function C(c) {
|
|
114
|
+
m.groups.set(c.id, ht(c));
|
|
115
|
+
for (const d of c.commands)
|
|
116
|
+
m.commands.set(d.id, d);
|
|
77
117
|
return () => {
|
|
78
|
-
const
|
|
79
|
-
if (
|
|
80
|
-
for (const
|
|
81
|
-
|
|
118
|
+
const d = m.groups.get(c.id);
|
|
119
|
+
if (d)
|
|
120
|
+
for (const h of d.commands) m.commands.delete(h.id);
|
|
121
|
+
m.groups.delete(c.id);
|
|
82
122
|
};
|
|
83
123
|
}
|
|
84
|
-
function
|
|
85
|
-
return Array.from(
|
|
124
|
+
function y() {
|
|
125
|
+
return Array.from(m.commands.values());
|
|
86
126
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
if (
|
|
90
|
-
const
|
|
91
|
-
for (
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
127
|
+
function p(c) {
|
|
128
|
+
const d = m.commands.get(c);
|
|
129
|
+
if (d) return d;
|
|
130
|
+
const h = Array.from(m.commands.values());
|
|
131
|
+
for (; h.length; ) {
|
|
132
|
+
const _ = h.pop();
|
|
133
|
+
if (_.subCommands?.length)
|
|
134
|
+
for (const x of _.subCommands) {
|
|
135
|
+
if (x.id === c) return x;
|
|
136
|
+
x.subCommands?.length && h.push(x);
|
|
96
137
|
}
|
|
97
|
-
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function I(c) {
|
|
141
|
+
if (!c.trim()) return [];
|
|
142
|
+
let d = y();
|
|
143
|
+
const h = /* @__PURE__ */ new Map();
|
|
144
|
+
if (a) {
|
|
145
|
+
const E = [], B = (O, F) => {
|
|
146
|
+
if (E.push(O), F.length && h.set(O, F), O.subCommands?.length)
|
|
147
|
+
for (const A of O.subCommands) B(A, [...F, O]);
|
|
148
|
+
};
|
|
149
|
+
for (const O of d) B(O, []);
|
|
150
|
+
d = E;
|
|
151
|
+
}
|
|
152
|
+
const _ = g(c, d), x = /* @__PURE__ */ new Map();
|
|
153
|
+
for (const [E, B] of m.groups)
|
|
154
|
+
for (const O of B.commands)
|
|
155
|
+
x.has(O.id) || x.set(O.id, E);
|
|
156
|
+
for (const E of _) {
|
|
157
|
+
const B = h.get(E.command);
|
|
158
|
+
B?.length && (E.parents = B);
|
|
159
|
+
const O = B?.length ? B[0].id : E.command.id, F = x.get(O);
|
|
160
|
+
F && (E.groupId = F), s && (E.score += s(E.command));
|
|
161
|
+
}
|
|
162
|
+
return s && _.sort(it), _;
|
|
98
163
|
}
|
|
99
|
-
function
|
|
100
|
-
return Array.from(
|
|
101
|
-
(
|
|
164
|
+
function L() {
|
|
165
|
+
return Array.from(m.groups.values()).sort(
|
|
166
|
+
(c, d) => (d.priority ?? 0) - (c.priority ?? 0)
|
|
102
167
|
);
|
|
103
168
|
}
|
|
104
|
-
return { state:
|
|
169
|
+
return { state: m, registerCommands: k, registerGroup: C, search: I, getAllCommands: y, findCommand: p, getSortedGroups: L };
|
|
170
|
+
}
|
|
171
|
+
const jt = /* @__PURE__ */ new Set(["shift", "ctrl", "meta", "alt", "$mod"]);
|
|
172
|
+
function Qt(n) {
|
|
173
|
+
return jt.has(n);
|
|
174
|
+
}
|
|
175
|
+
function gt(n) {
|
|
176
|
+
return n.length >= 2 && n.every((a) => !Qt(a));
|
|
105
177
|
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return ze.has(t);
|
|
178
|
+
function Wt(n) {
|
|
179
|
+
return n.some((a) => a === "$mod" || a === "ctrl" || a === "meta");
|
|
109
180
|
}
|
|
110
|
-
function
|
|
111
|
-
|
|
181
|
+
function Xt(n) {
|
|
182
|
+
const a = n.target;
|
|
183
|
+
if (!a) return !1;
|
|
184
|
+
const s = a.tagName;
|
|
185
|
+
if (s === "INPUT" || s === "TEXTAREA" || s === "SELECT" || a.isContentEditable) return !0;
|
|
186
|
+
const r = a.getAttribute?.("contenteditable");
|
|
187
|
+
return r === "" || r === "true";
|
|
112
188
|
}
|
|
113
|
-
function
|
|
114
|
-
return
|
|
189
|
+
function Zt(n, a) {
|
|
190
|
+
return n === "$mod" ? a.metaKey || a.ctrlKey : n === "shift" ? a.shiftKey : n === "alt" ? a.altKey : n === "ctrl" ? a.ctrlKey : n === "meta" ? a.metaKey : a.key.toLowerCase() === n.toLowerCase();
|
|
115
191
|
}
|
|
116
|
-
function
|
|
117
|
-
const
|
|
118
|
-
for (const
|
|
119
|
-
if (!
|
|
120
|
-
return !
|
|
192
|
+
function en(n, a) {
|
|
193
|
+
const s = n.slice(0, -1), r = n[n.length - 1];
|
|
194
|
+
for (const g of s)
|
|
195
|
+
if (!Zt(g, a)) return !1;
|
|
196
|
+
return !s.includes("$mod") && !s.includes("ctrl") && !s.includes("meta") && (a.ctrlKey || a.metaKey) || !s.includes("shift") && a.shiftKey || !s.includes("alt") && a.altKey ? !1 : a.key.toLowerCase() === r.toLowerCase();
|
|
121
197
|
}
|
|
122
|
-
function
|
|
123
|
-
const
|
|
124
|
-
let
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
198
|
+
function tn() {
|
|
199
|
+
const n = [];
|
|
200
|
+
let a = [], s = null, r = !1;
|
|
201
|
+
function g(y) {
|
|
202
|
+
const p = Xt(y);
|
|
203
|
+
for (const { keys: c, handler: d } of n)
|
|
204
|
+
if (!gt(c) && !(p && !Wt(c)) && en(c, y)) {
|
|
205
|
+
y.preventDefault(), d();
|
|
129
206
|
return;
|
|
130
207
|
}
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
208
|
+
if (p) return;
|
|
209
|
+
const I = n.filter((c) => gt(c.keys));
|
|
210
|
+
if (!I.length || y.metaKey || y.ctrlKey || y.altKey) return;
|
|
211
|
+
a.push(y.key.toLowerCase()), s && clearTimeout(s), s = setTimeout(() => {
|
|
212
|
+
a = [];
|
|
135
213
|
}, 500);
|
|
136
|
-
const
|
|
137
|
-
for (const { keys:
|
|
138
|
-
const
|
|
139
|
-
if (
|
|
140
|
-
|
|
214
|
+
const L = a;
|
|
215
|
+
for (const { keys: c, handler: d } of I) {
|
|
216
|
+
const h = c.map((_) => _.toLowerCase());
|
|
217
|
+
if (L.length >= h.length && L.slice(-h.length).every((x, E) => x === h[E])) {
|
|
218
|
+
y.preventDefault(), a = [], d();
|
|
141
219
|
return;
|
|
142
220
|
}
|
|
143
221
|
}
|
|
144
222
|
}
|
|
145
|
-
function
|
|
146
|
-
const
|
|
147
|
-
return
|
|
148
|
-
const
|
|
149
|
-
|
|
223
|
+
function m(y, p) {
|
|
224
|
+
const I = { keys: y, handler: p };
|
|
225
|
+
return n.push(I), () => {
|
|
226
|
+
const L = n.indexOf(I);
|
|
227
|
+
L !== -1 && n.splice(L, 1);
|
|
150
228
|
};
|
|
151
229
|
}
|
|
152
|
-
function
|
|
153
|
-
r || typeof document > "u" || (r = !0, document.addEventListener("keydown",
|
|
230
|
+
function k() {
|
|
231
|
+
r || typeof document > "u" || (r = !0, document.addEventListener("keydown", g));
|
|
154
232
|
}
|
|
155
|
-
function
|
|
156
|
-
typeof document > "u" || (r = !1, document.removeEventListener("keydown",
|
|
233
|
+
function C() {
|
|
234
|
+
typeof document > "u" || (r = !1, document.removeEventListener("keydown", g));
|
|
157
235
|
}
|
|
158
|
-
return { registerShortcut:
|
|
236
|
+
return { registerShortcut: m, start: k, stop: C };
|
|
237
|
+
}
|
|
238
|
+
const at = Symbol("@macrulez/vue-command-palette"), $t = Symbol("@macrulez/vue-command-palette:labels"), Ct = Symbol("@macrulez/vue-command-palette:selection"), wt = Symbol("@macrulez/vue-command-palette:query"), _t = Symbol("@macrulez/vue-command-palette:pinned"), st = Symbol("@macrulez/vue-command-palette:registry");
|
|
239
|
+
function nn(n, a = Date.now()) {
|
|
240
|
+
if (!n) return 0;
|
|
241
|
+
const s = (a - n.lastUsed) / 864e5, r = Math.max(0, 1 - s / 30);
|
|
242
|
+
return n.count * 2 + r * 15;
|
|
159
243
|
}
|
|
160
|
-
|
|
161
|
-
|
|
244
|
+
function Et(n, a = {}) {
|
|
245
|
+
{
|
|
162
246
|
const {
|
|
163
|
-
|
|
164
|
-
|
|
247
|
+
name: s = "default",
|
|
248
|
+
hotkey: r = ["$mod", "k"],
|
|
249
|
+
persistRecent: g = !0,
|
|
165
250
|
maxRecent: m = 5,
|
|
166
|
-
maxRecentPerGroup:
|
|
167
|
-
localStorageKey:
|
|
168
|
-
colorTheme:
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
251
|
+
maxRecentPerGroup: k = 0,
|
|
252
|
+
localStorageKey: C = "vcp:recent",
|
|
253
|
+
colorTheme: y = "system",
|
|
254
|
+
search: p,
|
|
255
|
+
searchNested: I = !0,
|
|
256
|
+
showDisabled: L = !1,
|
|
257
|
+
frecency: c = !1,
|
|
258
|
+
onSearch: d,
|
|
259
|
+
bindShortcuts: h = !1,
|
|
260
|
+
onOpen: _,
|
|
261
|
+
onClose: x,
|
|
262
|
+
onError: E,
|
|
263
|
+
onHighlight: B
|
|
264
|
+
} = a;
|
|
265
|
+
let O = {};
|
|
266
|
+
if (c && g && typeof localStorage < "u")
|
|
267
|
+
try {
|
|
268
|
+
O = JSON.parse(localStorage.getItem(C + ":frecency") ?? "{}");
|
|
269
|
+
} catch {
|
|
270
|
+
}
|
|
271
|
+
const F = R(O), z = Jt(p, I, c ? (fe) => nn(F.value[fe.id]) : void 0, L), H = tn(), X = R(!1), ue = R(""), ae = R(0), W = R([]), N = R(null);
|
|
272
|
+
let Z = [];
|
|
273
|
+
if (g && typeof localStorage < "u")
|
|
175
274
|
try {
|
|
176
|
-
|
|
275
|
+
Z = JSON.parse(localStorage.getItem(C) ?? "[]");
|
|
177
276
|
} catch {
|
|
178
277
|
}
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
278
|
+
const Y = R(Z);
|
|
279
|
+
let J = [];
|
|
280
|
+
if (g && typeof localStorage < "u")
|
|
281
|
+
try {
|
|
282
|
+
J = JSON.parse(localStorage.getItem(C + ":pinned") ?? "[]");
|
|
283
|
+
} catch {
|
|
284
|
+
}
|
|
285
|
+
const ne = R(J), $e = R([]), Ce = b(() => z.search(ue.value)), de = R([]), se = R(null), le = R(y), ge = {
|
|
286
|
+
store: z,
|
|
287
|
+
keyboard: H,
|
|
288
|
+
isOpen: X,
|
|
289
|
+
query: ue,
|
|
290
|
+
activeIndex: ae,
|
|
291
|
+
history: W,
|
|
292
|
+
recentIds: Y,
|
|
293
|
+
loadingCommandId: N,
|
|
294
|
+
results: Ce,
|
|
295
|
+
currentResults: de,
|
|
296
|
+
executeRequest: se,
|
|
297
|
+
colorTheme: le,
|
|
298
|
+
persistRecent: g,
|
|
191
299
|
maxRecent: m,
|
|
192
|
-
maxRecentPerGroup:
|
|
193
|
-
localStorageKey:
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
300
|
+
maxRecentPerGroup: k ?? 0,
|
|
301
|
+
localStorageKey: C,
|
|
302
|
+
frecency: c,
|
|
303
|
+
usage: F,
|
|
304
|
+
pinnedIds: ne,
|
|
305
|
+
queryHistory: $e,
|
|
306
|
+
showDisabled: L,
|
|
307
|
+
globalSearch: d,
|
|
308
|
+
onOpen: _,
|
|
309
|
+
onClose: x,
|
|
310
|
+
onError: E,
|
|
311
|
+
onHighlight: B
|
|
312
|
+
}, v = n.runWithContext(() => pe(st, null)) ?? /* @__PURE__ */ new Map();
|
|
313
|
+
v.set(s, ge), n.provide(st, v);
|
|
314
|
+
const G = n.runWithContext(() => pe(at, null));
|
|
315
|
+
if ((s === "default" || !G) && n.provide(at, ge), H.registerShortcut(r, () => {
|
|
316
|
+
X.value = !X.value, X.value ? (ue.value = "", ae.value = 0, _?.()) : x?.();
|
|
317
|
+
}), H.start(), h) {
|
|
318
|
+
async function fe(V) {
|
|
319
|
+
if (!(V.disabled || V.enabled && !V.enabled())) {
|
|
320
|
+
if (V.subCommands?.length) {
|
|
321
|
+
X.value = !0;
|
|
322
|
+
return;
|
|
323
|
+
}
|
|
324
|
+
N.value = V.id;
|
|
325
|
+
try {
|
|
326
|
+
await V.perform();
|
|
327
|
+
} catch (ye) {
|
|
328
|
+
E ? E(ye, V) : console.error("[@macrulez/vue-command-palette] Command error:", ye);
|
|
329
|
+
} finally {
|
|
330
|
+
N.value = null;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
const j = /* @__PURE__ */ new Map();
|
|
335
|
+
re(
|
|
336
|
+
() => Array.from(z.state.commands.values()),
|
|
337
|
+
(V) => {
|
|
338
|
+
const ye = new Set(V.map((ee) => ee.id));
|
|
339
|
+
for (const [ee, ve] of j)
|
|
340
|
+
ye.has(ee) || (ve(), j.delete(ee));
|
|
341
|
+
for (const ee of V)
|
|
342
|
+
if (ee.shortcut?.length && !j.has(ee.id)) {
|
|
343
|
+
const ve = H.registerShortcut(ee.shortcut, () => {
|
|
344
|
+
const Ae = se.value;
|
|
345
|
+
Ae ? Ae(ee) : fe(ee);
|
|
346
|
+
});
|
|
347
|
+
j.set(ee.id, ve);
|
|
348
|
+
}
|
|
349
|
+
},
|
|
350
|
+
{ immediate: !0 }
|
|
351
|
+
);
|
|
352
|
+
}
|
|
353
|
+
const me = n.unmount.bind(n);
|
|
354
|
+
n.unmount = () => {
|
|
355
|
+
H.stop(), me();
|
|
204
356
|
};
|
|
205
357
|
}
|
|
358
|
+
}
|
|
359
|
+
const mo = {
|
|
360
|
+
install: Et
|
|
206
361
|
};
|
|
207
|
-
function
|
|
362
|
+
function fo(n = {}) {
|
|
363
|
+
return {
|
|
364
|
+
install(a) {
|
|
365
|
+
Et(a, n);
|
|
366
|
+
}
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function ot(n, a) {
|
|
208
370
|
if (!(typeof localStorage > "u"))
|
|
209
371
|
try {
|
|
210
|
-
localStorage.setItem(
|
|
372
|
+
localStorage.setItem(a, JSON.stringify(n));
|
|
211
373
|
} catch {
|
|
212
374
|
}
|
|
213
375
|
}
|
|
214
|
-
function
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
376
|
+
function He(n) {
|
|
377
|
+
if (n) {
|
|
378
|
+
const r = pe(st, null)?.get(n);
|
|
379
|
+
if (!r)
|
|
380
|
+
throw new Error(`[@macrulez/vue-command-palette] No palette instance named "${n}". Install it with app.use(VCommandPalettePlugin, { name: "${n}" }).`);
|
|
381
|
+
return r;
|
|
382
|
+
}
|
|
383
|
+
const a = pe(at);
|
|
384
|
+
if (!a) throw new Error("[@macrulez/vue-command-palette] Plugin not installed. Use app.use(VCommandPalettePlugin).");
|
|
385
|
+
return a;
|
|
386
|
+
}
|
|
387
|
+
function on(n) {
|
|
388
|
+
const a = He(n), {
|
|
218
389
|
store: s,
|
|
219
|
-
isOpen:
|
|
220
|
-
query:
|
|
390
|
+
isOpen: r,
|
|
391
|
+
query: g,
|
|
221
392
|
activeIndex: m,
|
|
222
|
-
history:
|
|
223
|
-
recentIds:
|
|
224
|
-
loadingCommandId:
|
|
225
|
-
results:
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
393
|
+
history: k,
|
|
394
|
+
recentIds: C,
|
|
395
|
+
loadingCommandId: y,
|
|
396
|
+
results: p,
|
|
397
|
+
currentResults: I,
|
|
398
|
+
colorTheme: L,
|
|
399
|
+
persistRecent: c,
|
|
400
|
+
maxRecent: d,
|
|
401
|
+
localStorageKey: h,
|
|
402
|
+
frecency: _,
|
|
403
|
+
usage: x,
|
|
404
|
+
pinnedIds: E,
|
|
405
|
+
queryHistory: B,
|
|
406
|
+
onOpen: O,
|
|
407
|
+
onClose: F,
|
|
408
|
+
onError: A
|
|
409
|
+
} = a;
|
|
410
|
+
function z(v) {
|
|
411
|
+
v && r.value ? (k.value.push({ paletteId: v, query: g.value, activeIndex: m.value }), g.value = "", m.value = 0) : (r.value = !0, g.value = "", m.value = 0, O?.());
|
|
236
412
|
}
|
|
237
|
-
function
|
|
238
|
-
|
|
413
|
+
function H() {
|
|
414
|
+
r.value = !1, g.value = "", m.value = 0, k.value = [], F?.();
|
|
239
415
|
}
|
|
240
|
-
function
|
|
241
|
-
|
|
416
|
+
function X() {
|
|
417
|
+
r.value ? H() : z();
|
|
242
418
|
}
|
|
243
|
-
function
|
|
244
|
-
if (!
|
|
245
|
-
|
|
419
|
+
function ue() {
|
|
420
|
+
if (!k.value.length) {
|
|
421
|
+
H();
|
|
246
422
|
return;
|
|
247
423
|
}
|
|
248
|
-
const
|
|
249
|
-
|
|
424
|
+
const v = k.value.pop();
|
|
425
|
+
g.value = v.query, m.value = v.activeIndex;
|
|
426
|
+
}
|
|
427
|
+
function ae(v) {
|
|
428
|
+
const G = C.value.filter((me) => me !== v);
|
|
429
|
+
G.unshift(v), C.value = G.slice(0, d), c && ot(C.value, h);
|
|
430
|
+
}
|
|
431
|
+
function W(v) {
|
|
432
|
+
return E.value.includes(v);
|
|
433
|
+
}
|
|
434
|
+
function N(v) {
|
|
435
|
+
E.value.includes(v) || (E.value = [...E.value, v], c && ot(E.value, h + ":pinned"));
|
|
436
|
+
}
|
|
437
|
+
function Z(v) {
|
|
438
|
+
E.value = E.value.filter((G) => G !== v), c && ot(E.value, h + ":pinned");
|
|
439
|
+
}
|
|
440
|
+
function Y(v) {
|
|
441
|
+
W(v) ? Z(v) : N(v);
|
|
250
442
|
}
|
|
251
|
-
function
|
|
252
|
-
|
|
253
|
-
const A = a.value.filter((F) => F !== p);
|
|
254
|
-
A.unshift(p), a.value = A.slice(0, g), Ne(a.value, I);
|
|
443
|
+
function J() {
|
|
444
|
+
return E.value.map((v) => s.findCommand(v)).filter((v) => !!v);
|
|
255
445
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
446
|
+
function ne(v) {
|
|
447
|
+
const G = v.trim();
|
|
448
|
+
G && (B.value = [G, ...B.value.filter((me) => me !== G)].slice(0, 25));
|
|
449
|
+
}
|
|
450
|
+
function $e(v) {
|
|
451
|
+
if (!_) return;
|
|
452
|
+
const G = x.value[v];
|
|
453
|
+
if (x.value = { ...x.value, [v]: { count: (G?.count ?? 0) + 1, lastUsed: Date.now() } }, c && typeof localStorage < "u")
|
|
454
|
+
try {
|
|
455
|
+
localStorage.setItem(h + ":frecency", JSON.stringify(x.value));
|
|
456
|
+
} catch {
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
async function Ce(v) {
|
|
460
|
+
if (!(v.disabled || v.enabled && !v.enabled())) {
|
|
461
|
+
if (v.subCommands?.length || v.page) {
|
|
462
|
+
z(v.id);
|
|
260
463
|
return;
|
|
261
464
|
}
|
|
262
|
-
|
|
465
|
+
ae(v.id), $e(v.id), ne(g.value), H(), y.value = v.id;
|
|
263
466
|
try {
|
|
264
|
-
await
|
|
265
|
-
} catch (
|
|
266
|
-
|
|
467
|
+
await v.perform();
|
|
468
|
+
} catch (G) {
|
|
469
|
+
A ? A(G, v) : console.error("[@macrulez/vue-command-palette] Command error:", G);
|
|
267
470
|
} finally {
|
|
268
|
-
|
|
471
|
+
y.value = null;
|
|
269
472
|
}
|
|
270
473
|
}
|
|
271
474
|
}
|
|
272
|
-
async function
|
|
273
|
-
const
|
|
274
|
-
|
|
475
|
+
async function de() {
|
|
476
|
+
const G = (I.value.length ? I.value : p.value)[m.value];
|
|
477
|
+
G && await Ce(G.command);
|
|
275
478
|
}
|
|
276
|
-
function
|
|
277
|
-
|
|
278
|
-
return a.value.map((A) => p.find((F) => F.id === A)).filter((A) => !!A);
|
|
479
|
+
function se() {
|
|
480
|
+
return C.value.map((v) => s.findCommand(v)).filter((v) => !!v);
|
|
279
481
|
}
|
|
280
|
-
function
|
|
281
|
-
return s.registerCommands(
|
|
482
|
+
function le(v) {
|
|
483
|
+
return s.registerCommands(v);
|
|
282
484
|
}
|
|
283
|
-
function
|
|
284
|
-
return s.registerGroup(
|
|
485
|
+
function ge(v) {
|
|
486
|
+
return s.registerGroup(v);
|
|
285
487
|
}
|
|
286
488
|
return {
|
|
287
|
-
isOpen:
|
|
288
|
-
query:
|
|
289
|
-
results:
|
|
489
|
+
isOpen: Te(r),
|
|
490
|
+
query: g,
|
|
491
|
+
results: p,
|
|
290
492
|
activeIndex: m,
|
|
291
|
-
history:
|
|
292
|
-
loadingCommandId:
|
|
293
|
-
colorTheme:
|
|
294
|
-
open:
|
|
295
|
-
close:
|
|
296
|
-
toggle:
|
|
297
|
-
goBack:
|
|
298
|
-
executeActive:
|
|
299
|
-
executeCommand:
|
|
300
|
-
getRecentCommands:
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
493
|
+
history: Te(k),
|
|
494
|
+
loadingCommandId: Te(y),
|
|
495
|
+
colorTheme: L,
|
|
496
|
+
open: z,
|
|
497
|
+
close: H,
|
|
498
|
+
toggle: X,
|
|
499
|
+
goBack: ue,
|
|
500
|
+
executeActive: de,
|
|
501
|
+
executeCommand: Ce,
|
|
502
|
+
getRecentCommands: se,
|
|
503
|
+
getPinnedCommands: J,
|
|
504
|
+
registerCommands: le,
|
|
505
|
+
registerGroup: ge,
|
|
506
|
+
addRecent: ae,
|
|
507
|
+
isPinned: W,
|
|
508
|
+
pin: N,
|
|
509
|
+
unpin: Z,
|
|
510
|
+
togglePin: Y,
|
|
511
|
+
pinnedIds: Te(E),
|
|
512
|
+
queryHistory: Te(B)
|
|
304
513
|
};
|
|
305
514
|
}
|
|
306
|
-
function
|
|
307
|
-
const
|
|
308
|
-
|
|
309
|
-
const n = s.store.registerCommands(t);
|
|
310
|
-
Ie(n);
|
|
515
|
+
function vo(n, a) {
|
|
516
|
+
const r = He(a).store.registerCommands(n);
|
|
517
|
+
lt(r);
|
|
311
518
|
}
|
|
312
|
-
function
|
|
313
|
-
const
|
|
314
|
-
|
|
315
|
-
const n = s.store.registerGroup(t);
|
|
316
|
-
Ie(n);
|
|
519
|
+
function ho(n, a) {
|
|
520
|
+
const r = He(a).store.registerGroup(n);
|
|
521
|
+
lt(r);
|
|
317
522
|
}
|
|
318
|
-
const
|
|
523
|
+
const an = ["id", "aria-selected", "aria-disabled", "title"], sn = {
|
|
319
524
|
key: 0,
|
|
320
525
|
class: "vcp-item__icon"
|
|
321
|
-
},
|
|
526
|
+
}, ln = { class: "vcp-item__body" }, rn = { class: "vcp-item__label" }, cn = {
|
|
322
527
|
key: 0,
|
|
323
|
-
class: "vcp-
|
|
324
|
-
},
|
|
528
|
+
class: "vcp-item__context"
|
|
529
|
+
}, un = {
|
|
530
|
+
key: 1,
|
|
531
|
+
class: "vcp-item__match-hint"
|
|
532
|
+
}, dn = {
|
|
325
533
|
key: 0,
|
|
326
|
-
class: "vcp-
|
|
327
|
-
|
|
328
|
-
}, Xe = {
|
|
534
|
+
class: "vcp-item__description"
|
|
535
|
+
}, mn = ["aria-label"], fn = {
|
|
329
536
|
key: 1,
|
|
330
537
|
class: "vcp-item__shortcut"
|
|
331
|
-
},
|
|
538
|
+
}, vn = {
|
|
539
|
+
key: 2,
|
|
540
|
+
class: "vcp-item__actions-hint",
|
|
541
|
+
"aria-hidden": "true",
|
|
542
|
+
title: "Tab for actions"
|
|
543
|
+
}, hn = ["title"], pn = {
|
|
544
|
+
class: "vcp-item__chevron",
|
|
545
|
+
"aria-hidden": "true"
|
|
546
|
+
}, ke = /* @__PURE__ */ Ke({
|
|
332
547
|
__name: "CommandItem",
|
|
333
548
|
props: {
|
|
334
549
|
command: {},
|
|
335
550
|
active: { type: Boolean },
|
|
336
551
|
matches: {},
|
|
337
552
|
itemId: {},
|
|
338
|
-
loadingCommandId: {}
|
|
553
|
+
loadingCommandId: {},
|
|
554
|
+
parents: {},
|
|
555
|
+
matchedText: {},
|
|
556
|
+
alwaysShowPin: { type: Boolean }
|
|
339
557
|
},
|
|
340
558
|
emits: ["execute", "activate"],
|
|
341
|
-
setup(
|
|
342
|
-
const
|
|
343
|
-
() =>
|
|
344
|
-
), r =
|
|
345
|
-
|
|
346
|
-
return
|
|
559
|
+
setup(n) {
|
|
560
|
+
const a = n, s = b(
|
|
561
|
+
() => a.command.disabled || a.command.enabled != null && !a.command.enabled()
|
|
562
|
+
), r = b(() => a.loadingCommandId === a.command.id), g = b(() => !!a.command.subCommands?.length || !!a.command.page), m = b(() => {
|
|
563
|
+
const A = a.command.badge;
|
|
564
|
+
return typeof A == "string" ? A : A?.text;
|
|
565
|
+
}), k = b(() => typeof a.command.badge == "object" ? a.command.badge.color : void 0), C = pe($t, void 0), y = b(() => C?.value.loading ?? "Loading"), p = pe(Ct, void 0), I = b(() => p?.value.selectable ?? !1), L = b(() => I.value && (p?.value.isSelected(a.command.id) ?? !1)), c = pe(_t, void 0), d = b(() => c?.isPinned(a.command.id) ?? !1), h = b(() => d.value ? C?.value.unpin ?? "Unpin" : C?.value.pin ?? "Pin");
|
|
566
|
+
function _() {
|
|
567
|
+
c?.toggle(a.command.id);
|
|
568
|
+
}
|
|
569
|
+
const x = b(() => nt(a.command.label, a.matches)), E = pe(wt, void 0), B = b(() => {
|
|
570
|
+
const A = a.command.description ?? "", z = (E?.value ?? "").trim();
|
|
571
|
+
if (!A || !z) return nt(A, []);
|
|
572
|
+
const H = A.toLowerCase().indexOf(z.toLowerCase());
|
|
573
|
+
return nt(A, H === -1 ? [] : [[H, H + z.length - 1]]);
|
|
574
|
+
});
|
|
575
|
+
function O() {
|
|
576
|
+
if (typeof navigator > "u") return !1;
|
|
577
|
+
const A = navigator.userAgentData;
|
|
578
|
+
return A?.platform ? /mac/i.test(A.platform) : /mac/i.test(navigator.platform || navigator.userAgent || "");
|
|
579
|
+
}
|
|
580
|
+
function F(A) {
|
|
581
|
+
return A === "$mod" ? O() ? "⌘" : "Ctrl" : A === "shift" ? "⇧" : A === "alt" ? O() ? "⌥" : "Alt" : A.toUpperCase();
|
|
347
582
|
}
|
|
348
|
-
return (
|
|
349
|
-
id:
|
|
350
|
-
class:
|
|
351
|
-
"vcp-item--active":
|
|
352
|
-
"vcp-item--disabled":
|
|
353
|
-
"vcp-item--loading": r.value
|
|
583
|
+
return (A, z) => (u(), f("div", {
|
|
584
|
+
id: n.itemId,
|
|
585
|
+
class: ie(["vcp-item", {
|
|
586
|
+
"vcp-item--active": n.active,
|
|
587
|
+
"vcp-item--disabled": s.value,
|
|
588
|
+
"vcp-item--loading": r.value,
|
|
589
|
+
"vcp-item--selected": L.value
|
|
354
590
|
}]),
|
|
355
591
|
role: "option",
|
|
356
|
-
"aria-selected":
|
|
357
|
-
"aria-disabled":
|
|
358
|
-
|
|
359
|
-
|
|
592
|
+
"aria-selected": n.active,
|
|
593
|
+
"aria-disabled": s.value,
|
|
594
|
+
title: s.value && n.command.disabledReason ? n.command.disabledReason : void 0,
|
|
595
|
+
onClick: z[0] || (z[0] = (H) => !s.value && !r.value && A.$emit("execute")),
|
|
596
|
+
onMouseenter: z[1] || (z[1] = (H) => !s.value && A.$emit("activate"))
|
|
360
597
|
}, [
|
|
361
|
-
|
|
362
|
-
command:
|
|
363
|
-
active:
|
|
364
|
-
matches:
|
|
598
|
+
$(A.$slots, "default", {
|
|
599
|
+
command: n.command,
|
|
600
|
+
active: n.active,
|
|
601
|
+
matches: n.matches,
|
|
602
|
+
parents: n.parents,
|
|
603
|
+
matchedText: n.matchedText
|
|
365
604
|
}, () => [
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
605
|
+
I.value ? (u(), f("span", {
|
|
606
|
+
key: 0,
|
|
607
|
+
class: ie(["vcp-item__checkbox", { "vcp-item__checkbox--on": L.value }]),
|
|
608
|
+
"aria-hidden": "true"
|
|
609
|
+
}, null, 2)) : M("", !0),
|
|
610
|
+
$(A.$slots, "item-icon", { command: n.command }, () => [
|
|
611
|
+
n.command.icon ? (u(), f("span", sn, [
|
|
612
|
+
(u(), te(De(typeof n.command.icon == "string" ? "span" : n.command.icon), null, {
|
|
613
|
+
default: S(() => [
|
|
614
|
+
we(K(typeof n.command.icon == "string" ? n.command.icon : ""), 1)
|
|
371
615
|
]),
|
|
372
616
|
_: 1
|
|
373
617
|
}))
|
|
374
618
|
])) : M("", !0)
|
|
375
619
|
]),
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
(u(),
|
|
620
|
+
w("span", ln, [
|
|
621
|
+
w("span", rn, [
|
|
622
|
+
n.parents?.length ? (u(), f("span", cn, [
|
|
623
|
+
(u(!0), f(P, null, q(n.parents, (H) => (u(), f(P, {
|
|
624
|
+
key: H.id
|
|
625
|
+
}, [
|
|
626
|
+
we(K(H.label) + " › ", 1)
|
|
627
|
+
], 64))), 128))
|
|
628
|
+
])) : M("", !0),
|
|
629
|
+
(u(), te(De(x.value))),
|
|
630
|
+
n.matchedText && !n.matches.length ? (u(), f("span", un, "— " + K(n.matchedText), 1)) : M("", !0)
|
|
379
631
|
]),
|
|
380
|
-
|
|
632
|
+
n.command.description ? (u(), f("span", dn, [
|
|
633
|
+
(u(), te(De(B.value)))
|
|
634
|
+
])) : M("", !0)
|
|
381
635
|
]),
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
636
|
+
m.value ? (u(), f("span", {
|
|
637
|
+
key: 1,
|
|
638
|
+
class: "vcp-item__badge",
|
|
639
|
+
style: Me(k.value ? { background: k.value } : void 0)
|
|
640
|
+
}, K(m.value), 5)) : M("", !0),
|
|
641
|
+
$(A.$slots, "item-shortcut", { command: n.command }, () => [
|
|
642
|
+
r.value ? (u(), f("span", {
|
|
643
|
+
key: 0,
|
|
644
|
+
class: "vcp-item__spinner",
|
|
645
|
+
"aria-label": y.value
|
|
646
|
+
}, null, 8, mn)) : n.command.shortcut?.length ? (u(), f("span", fn, [
|
|
647
|
+
(u(!0), f(P, null, q(n.command.shortcut, (H) => (u(), f("kbd", {
|
|
648
|
+
key: H,
|
|
386
649
|
class: "vcp-kbd"
|
|
387
|
-
},
|
|
388
|
-
])) : M("", !0)
|
|
389
|
-
])
|
|
650
|
+
}, K(F(H)), 1))), 128))
|
|
651
|
+
])) : n.command.actions?.length ? (u(), f("span", vn, "⋯")) : M("", !0)
|
|
652
|
+
]),
|
|
653
|
+
w("span", {
|
|
654
|
+
class: ie(["vcp-item__pin", { "vcp-item__pin--on": d.value, "vcp-item__pin--show": a.alwaysShowPin }]),
|
|
655
|
+
title: h.value,
|
|
656
|
+
"aria-hidden": "true",
|
|
657
|
+
onClick: kt(_, ["stop"])
|
|
658
|
+
}, [...z[2] || (z[2] = [
|
|
659
|
+
w("svg", {
|
|
660
|
+
class: "vcp-item__pin-icon",
|
|
661
|
+
viewBox: "0 0 24 24",
|
|
662
|
+
width: "12",
|
|
663
|
+
height: "12",
|
|
664
|
+
fill: "currentColor"
|
|
665
|
+
}, [
|
|
666
|
+
w("path", { d: "M16 9V4h1a1 1 0 0 0 0-2H7a1 1 0 0 0 0 2h1v5l-2 2v2h5v5l1 1 1-1v-5h5v-2l-2-2z" })
|
|
667
|
+
], -1)
|
|
668
|
+
])], 10, hn),
|
|
669
|
+
w("span", pn, K(g.value ? "›" : ""), 1)
|
|
390
670
|
])
|
|
391
|
-
], 42,
|
|
671
|
+
], 42, an));
|
|
392
672
|
}
|
|
393
|
-
}),
|
|
673
|
+
}), gn = {
|
|
394
674
|
key: 0,
|
|
395
675
|
class: "vcp-group"
|
|
396
|
-
},
|
|
676
|
+
}, yn = {
|
|
397
677
|
class: "vcp-group__header",
|
|
398
678
|
"aria-hidden": "true"
|
|
399
|
-
},
|
|
679
|
+
}, yt = /* @__PURE__ */ Ke({
|
|
400
680
|
__name: "CommandGroup",
|
|
401
681
|
props: {
|
|
402
682
|
group: {},
|
|
@@ -406,611 +686,1071 @@ const Ye = ["id", "aria-selected", "aria-disabled"], Fe = {
|
|
|
406
686
|
loadingCommandId: {}
|
|
407
687
|
},
|
|
408
688
|
emits: ["execute", "activate"],
|
|
409
|
-
setup(
|
|
410
|
-
return (
|
|
411
|
-
|
|
412
|
-
|
|
689
|
+
setup(n) {
|
|
690
|
+
return (a, s) => n.items.length ? (u(), f("div", gn, [
|
|
691
|
+
$(a.$slots, "group-header", { group: n.group }, () => [
|
|
692
|
+
w("div", yn, K(n.group.label), 1)
|
|
413
693
|
]),
|
|
414
|
-
(u(!0),
|
|
694
|
+
(u(!0), f(P, null, q(n.items, (r, g) => (u(), te(ke, {
|
|
415
695
|
key: r.command.id,
|
|
416
696
|
command: r.command,
|
|
417
|
-
active:
|
|
697
|
+
active: n.globalOffset + g === n.activeIndex,
|
|
418
698
|
matches: r.matches,
|
|
699
|
+
parents: r.parents,
|
|
700
|
+
"matched-text": r.matchedText,
|
|
419
701
|
"item-id": `vcp-item-${r.command.id}`,
|
|
420
|
-
"loading-command-id":
|
|
421
|
-
onExecute: (
|
|
422
|
-
onActivate: (
|
|
423
|
-
},
|
|
424
|
-
|
|
702
|
+
"loading-command-id": n.loadingCommandId,
|
|
703
|
+
onExecute: (m) => a.$emit("execute", r.command),
|
|
704
|
+
onActivate: (m) => a.$emit("activate", n.globalOffset + g)
|
|
705
|
+
}, ce({ _: 2 }, [
|
|
706
|
+
a.$slots["item-icon"] ? {
|
|
425
707
|
name: "item-icon",
|
|
426
|
-
fn:
|
|
427
|
-
|
|
708
|
+
fn: S((m) => [
|
|
709
|
+
$(a.$slots, "item-icon", D({ ref_for: !0 }, m))
|
|
428
710
|
]),
|
|
429
711
|
key: "0"
|
|
430
712
|
} : void 0,
|
|
431
|
-
|
|
713
|
+
a.$slots["item-shortcut"] ? {
|
|
432
714
|
name: "item-shortcut",
|
|
433
|
-
fn:
|
|
434
|
-
|
|
715
|
+
fn: S((m) => [
|
|
716
|
+
$(a.$slots, "item-shortcut", D({ ref_for: !0 }, m))
|
|
435
717
|
]),
|
|
436
718
|
key: "1"
|
|
437
719
|
} : void 0,
|
|
438
|
-
|
|
720
|
+
a.$slots.item ? {
|
|
439
721
|
name: "default",
|
|
440
|
-
fn:
|
|
441
|
-
|
|
722
|
+
fn: S((m) => [
|
|
723
|
+
$(a.$slots, "item", D({ ref_for: !0 }, m))
|
|
442
724
|
]),
|
|
443
725
|
key: "2"
|
|
444
726
|
} : void 0
|
|
445
|
-
]), 1032, ["command", "active", "matches", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128))
|
|
727
|
+
]), 1032, ["command", "active", "matches", "parents", "matched-text", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128))
|
|
446
728
|
])) : M("", !0);
|
|
447
729
|
}
|
|
448
|
-
}),
|
|
730
|
+
}), bn = /* @__PURE__ */ Ke({
|
|
449
731
|
__name: "VirtualList",
|
|
450
732
|
props: {
|
|
451
733
|
items: {},
|
|
452
734
|
itemHeight: {},
|
|
453
735
|
containerHeight: {},
|
|
454
|
-
overscan: { default: 3 }
|
|
736
|
+
overscan: { default: 3 },
|
|
737
|
+
activeIndex: { default: -1 }
|
|
455
738
|
},
|
|
456
|
-
setup(
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
const
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
739
|
+
setup(n, { expose: a }) {
|
|
740
|
+
const s = n, r = R(), g = R(0);
|
|
741
|
+
function m(c) {
|
|
742
|
+
if (c < 0) return;
|
|
743
|
+
const d = r.value;
|
|
744
|
+
if (!d) return;
|
|
745
|
+
const h = c * s.itemHeight, _ = h + s.itemHeight;
|
|
746
|
+
h < d.scrollTop ? d.scrollTop = h : _ > d.scrollTop + s.containerHeight && (d.scrollTop = _ - s.containerHeight);
|
|
747
|
+
}
|
|
748
|
+
re(() => s.activeIndex, (c) => {
|
|
749
|
+
xe(() => m(c));
|
|
750
|
+
});
|
|
751
|
+
const k = b(() => s.items.length * s.itemHeight), C = b(
|
|
752
|
+
() => Math.max(0, Math.floor(g.value / s.itemHeight) - s.overscan)
|
|
753
|
+
), y = b(() => {
|
|
754
|
+
const c = Math.ceil(s.containerHeight / s.itemHeight);
|
|
755
|
+
return Math.min(s.items.length - 1, C.value + c + s.overscan * 2);
|
|
756
|
+
}), p = b(() => C.value * s.itemHeight), I = b(
|
|
757
|
+
() => s.items.slice(C.value, y.value + 1).map((c, d) => ({
|
|
758
|
+
data: c,
|
|
759
|
+
index: C.value + d
|
|
466
760
|
}))
|
|
467
761
|
);
|
|
468
|
-
function
|
|
469
|
-
|
|
762
|
+
function L(c) {
|
|
763
|
+
g.value = c.target.scrollTop;
|
|
470
764
|
}
|
|
471
|
-
return
|
|
472
|
-
|
|
473
|
-
}),
|
|
765
|
+
return re(() => s.items, () => {
|
|
766
|
+
g.value = 0, r.value && (r.value.scrollTop = 0);
|
|
767
|
+
}), a({ containerEl: r }), (c, d) => (u(), f("div", {
|
|
474
768
|
ref_key: "containerEl",
|
|
475
769
|
ref: r,
|
|
476
770
|
class: "vcp-virtual",
|
|
477
|
-
style:
|
|
478
|
-
onScrollPassive:
|
|
771
|
+
style: Me({ height: n.containerHeight + "px", overflowY: "auto" }),
|
|
772
|
+
onScrollPassive: L
|
|
479
773
|
}, [
|
|
480
|
-
|
|
481
|
-
style:
|
|
774
|
+
w("div", {
|
|
775
|
+
style: Me({ height: k.value + "px", position: "relative" })
|
|
482
776
|
}, [
|
|
483
|
-
|
|
484
|
-
style:
|
|
777
|
+
w("div", {
|
|
778
|
+
style: Me({ transform: `translateY(${p.value}px)` })
|
|
485
779
|
}, [
|
|
486
|
-
(u(!0),
|
|
487
|
-
key:
|
|
488
|
-
item:
|
|
489
|
-
index:
|
|
780
|
+
(u(!0), f(P, null, q(I.value, (h) => $(c.$slots, "default", {
|
|
781
|
+
key: h.index,
|
|
782
|
+
item: h.data,
|
|
783
|
+
index: h.index
|
|
490
784
|
})), 128))
|
|
491
785
|
], 4)
|
|
492
786
|
], 4)
|
|
493
787
|
], 36));
|
|
494
788
|
}
|
|
495
|
-
}),
|
|
789
|
+
}), kn = ["aria-label"], $n = {
|
|
496
790
|
key: 0,
|
|
497
791
|
class: "vcp-breadcrumb",
|
|
498
792
|
"aria-live": "polite"
|
|
499
|
-
},
|
|
793
|
+
}, Cn = {
|
|
500
794
|
key: 0,
|
|
501
795
|
class: "vcp-breadcrumb__sep",
|
|
502
796
|
"aria-hidden": "true"
|
|
503
|
-
},
|
|
797
|
+
}, wn = {
|
|
504
798
|
key: 1,
|
|
505
799
|
class: "vcp-confirm"
|
|
506
|
-
},
|
|
800
|
+
}, _n = { class: "vcp-confirm__text" }, En = { class: "vcp-confirm__actions" }, Tn = { class: "vcp-actions" }, Sn = { class: "vcp-actions__bar" }, xn = ["title"], In = { class: "vcp-actions__title" }, An = { class: "vcp-actions__hint" }, Ln = ["aria-selected", "onClick", "onMouseenter"], Pn = {
|
|
801
|
+
key: 0,
|
|
802
|
+
class: "vcp-item__icon"
|
|
803
|
+
}, Rn = { class: "vcp-item__body" }, Dn = { class: "vcp-item__label" }, Mn = {
|
|
804
|
+
key: 1,
|
|
805
|
+
class: "vcp-item__shortcut"
|
|
806
|
+
}, Kn = { class: "vcp-input-wrap" }, Hn = {
|
|
807
|
+
key: 0,
|
|
808
|
+
class: "vcp-mode-chip"
|
|
809
|
+
}, On = ["placeholder", "aria-activedescendant"], Gn = ["aria-label"], Bn = {
|
|
507
810
|
class: "vcp-theme-switcher",
|
|
508
811
|
"aria-label": "Color theme"
|
|
509
|
-
},
|
|
812
|
+
}, zn = ["title", "onClick"], Nn = ["title", "aria-label", "aria-pressed"], Un = ["aria-label"], Yn = {
|
|
813
|
+
class: "vcp-group__header",
|
|
814
|
+
"aria-hidden": "true"
|
|
815
|
+
}, Vn = {
|
|
510
816
|
key: 0,
|
|
511
|
-
class: "vcp-
|
|
512
|
-
|
|
817
|
+
class: "vcp-section",
|
|
818
|
+
"aria-hidden": "true"
|
|
819
|
+
}, qn = {
|
|
820
|
+
class: "vcp-group__header",
|
|
821
|
+
"aria-hidden": "true"
|
|
822
|
+
}, Fn = {
|
|
513
823
|
key: 0,
|
|
824
|
+
class: "vcp-group__header vcp-group__header--sub",
|
|
825
|
+
"aria-hidden": "true"
|
|
826
|
+
}, Jn = {
|
|
827
|
+
key: 2,
|
|
514
828
|
class: "vcp-section",
|
|
515
829
|
"aria-hidden": "true"
|
|
516
|
-
},
|
|
830
|
+
}, jn = {
|
|
517
831
|
key: 0,
|
|
518
832
|
class: "vcp-section",
|
|
519
833
|
"aria-hidden": "true"
|
|
520
|
-
},
|
|
834
|
+
}, Qn = {
|
|
521
835
|
key: 0,
|
|
522
836
|
class: "vcp-group__header",
|
|
523
837
|
"aria-hidden": "true"
|
|
524
|
-
},
|
|
838
|
+
}, Wn = {
|
|
525
839
|
key: 1,
|
|
526
840
|
class: "vcp-section",
|
|
527
841
|
"aria-hidden": "true"
|
|
528
|
-
},
|
|
842
|
+
}, Xn = {
|
|
529
843
|
key: 0,
|
|
530
844
|
class: "vcp-section",
|
|
531
845
|
"aria-hidden": "true"
|
|
532
|
-
},
|
|
846
|
+
}, Zn = {
|
|
847
|
+
key: 3,
|
|
848
|
+
class: "vcp-state vcp-state--loading"
|
|
849
|
+
}, eo = {
|
|
533
850
|
key: 4,
|
|
534
851
|
class: "vcp-state vcp-state--empty"
|
|
535
|
-
},
|
|
852
|
+
}, to = ["aria-hidden"], no = { class: "vcp-preview__inner" }, oo = ["innerHTML"], ao = {
|
|
853
|
+
class: "vcp-sr-only",
|
|
854
|
+
role: "status",
|
|
855
|
+
"aria-live": "polite"
|
|
856
|
+
}, so = 50, lo = 40, io = 360, ro = "vcp-input", bt = "vcp-listbox", co = 'a[href],button:not([disabled]),input:not([disabled]),textarea:not([disabled]),select:not([disabled]),[tabindex]:not([tabindex="-1"])', po = /* @__PURE__ */ Ke({
|
|
536
857
|
__name: "CommandPalette",
|
|
537
858
|
props: {
|
|
859
|
+
name: { default: void 0 },
|
|
538
860
|
placeholder: { default: "Search commands…" },
|
|
539
861
|
maxResults: { default: 10 },
|
|
540
862
|
emptyText: { default: "No commands found." },
|
|
541
863
|
loadingText: { default: "Loading…" },
|
|
542
864
|
teleportTo: { default: "body" },
|
|
543
865
|
theme: { default: "default" },
|
|
544
|
-
animationDuration: { default: 150 }
|
|
866
|
+
animationDuration: { default: 150 },
|
|
867
|
+
labels: { default: void 0 },
|
|
868
|
+
groupRecent: { type: Boolean, default: !1 },
|
|
869
|
+
modes: { default: void 0 },
|
|
870
|
+
selectable: { type: Boolean, default: !1 },
|
|
871
|
+
preview: { type: Boolean, default: !1 },
|
|
872
|
+
previewHotkey: { default: () => ["$mod", "i"] }
|
|
545
873
|
},
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
() =>
|
|
874
|
+
emits: ["submit-selection"],
|
|
875
|
+
setup(n, { emit: a }) {
|
|
876
|
+
const s = {
|
|
877
|
+
recent: "Recent",
|
|
878
|
+
pinned: "Pinned",
|
|
879
|
+
pin: "Pin",
|
|
880
|
+
unpin: "Unpin",
|
|
881
|
+
confirmYes: "Yes, proceed",
|
|
882
|
+
confirmCancel: "Cancel",
|
|
883
|
+
themeLight: "Light theme",
|
|
884
|
+
themeDark: "Dark theme",
|
|
885
|
+
themeSystem: "System theme",
|
|
886
|
+
dialogLabel: "Command palette",
|
|
887
|
+
loading: "Loading",
|
|
888
|
+
resultsCount: (e) => `${e} result${e === 1 ? "" : "s"} available`,
|
|
889
|
+
actions: "Actions",
|
|
890
|
+
back: "Back",
|
|
891
|
+
togglePreview: "Toggle preview panel"
|
|
892
|
+
}, r = n, g = a, m = R(!0), k = b(() => r.preview && m.value);
|
|
893
|
+
function C() {
|
|
894
|
+
m.value = !m.value;
|
|
895
|
+
}
|
|
896
|
+
const y = b(() => ({ ...s, ...r.labels }));
|
|
897
|
+
Re($t, y);
|
|
898
|
+
const p = He(r.name), I = on(r.name), { isOpen: L, query: c, activeIndex: d, history: h, loadingCommandId: _, close: x, toggle: E, open: B, executeCommand: O, getRecentCommands: F, getPinnedCommands: A, togglePin: z, pinnedIds: H } = I;
|
|
899
|
+
Re(wt, c), Re(_t, {
|
|
900
|
+
isPinned: (e) => H.value.includes(e),
|
|
901
|
+
toggle: (e) => z(e)
|
|
902
|
+
});
|
|
903
|
+
const X = R(), ue = R(), ae = R(), W = R(!1), N = R(null), Z = R(-1), Y = R(null), J = R(0), ne = R([]);
|
|
904
|
+
function $e(e) {
|
|
905
|
+
return ne.value.includes(e);
|
|
906
|
+
}
|
|
907
|
+
function Ce(e) {
|
|
908
|
+
ne.value = $e(e) ? ne.value.filter((l) => l !== e) : [...ne.value, e];
|
|
909
|
+
}
|
|
910
|
+
Re(Ct, b(() => ({
|
|
911
|
+
selectable: r.selectable,
|
|
912
|
+
isSelected: $e
|
|
913
|
+
})));
|
|
914
|
+
function de(e) {
|
|
915
|
+
return p.showDisabled || !e.disabled && (e.enabled == null || e.enabled());
|
|
916
|
+
}
|
|
917
|
+
const se = b(() => A().filter(de)), le = b(() => {
|
|
918
|
+
const e = F();
|
|
919
|
+
let l = e;
|
|
920
|
+
if (p.maxRecentPerGroup) {
|
|
921
|
+
const t = {};
|
|
922
|
+
l = e.filter((o) => {
|
|
923
|
+
const i = o.group ?? "__none__";
|
|
924
|
+
return t[i] = (t[i] ?? 0) + 1, t[i] <= p.maxRecentPerGroup;
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
if (r.groupRecent) {
|
|
928
|
+
const t = [], o = /* @__PURE__ */ new Map();
|
|
929
|
+
for (const i of l) {
|
|
930
|
+
const U = i.group ?? "";
|
|
931
|
+
o.has(U) || (o.set(U, []), t.push(U)), o.get(U).push(i);
|
|
932
|
+
}
|
|
933
|
+
l = t.flatMap((i) => o.get(i));
|
|
934
|
+
}
|
|
935
|
+
return l;
|
|
936
|
+
}), ge = b(() => {
|
|
937
|
+
if (!r.groupRecent) return null;
|
|
938
|
+
const e = [];
|
|
939
|
+
let l = 0;
|
|
940
|
+
for (const t of le.value) {
|
|
941
|
+
const o = t.group ?? "", i = e[e.length - 1];
|
|
942
|
+
i && i.label === o ? i.commands.push(t) : e.push({ label: o, commands: [t], offset: l }), l++;
|
|
943
|
+
}
|
|
944
|
+
return e;
|
|
945
|
+
}), v = b(() => !r.modes?.length || fe.value ? null : r.modes.find((e) => e.prefix && c.value.startsWith(e.prefix)) ?? null), G = b(() => v.value ? c.value.slice(v.value.prefix.length) : c.value), me = b(() => h.value.length ? p.store.findCommand(h.value[h.value.length - 1].paletteId) ?? null : null), fe = b(() => me.value?.page ?? null), j = b(() => {
|
|
946
|
+
const e = me.value;
|
|
947
|
+
return e ? e.page ? (e.page.items ?? []).filter(de) : e.subCommands?.length ? e.subCommands.filter(de) : null : null;
|
|
948
|
+
}), V = b(
|
|
949
|
+
() => p.store.getSortedGroups().map((e) => ({
|
|
561
950
|
group: e,
|
|
562
|
-
items: e.commands.filter(
|
|
951
|
+
items: e.commands.filter(de).map((l) => ({ command: l, score: 0, matches: [], groupId: e.id }))
|
|
563
952
|
})).filter((e) => e.items.length > 0)
|
|
564
|
-
),
|
|
565
|
-
function
|
|
566
|
-
return
|
|
953
|
+
), ye = b(() => V.value.flatMap((e) => e.items));
|
|
954
|
+
function ee(e) {
|
|
955
|
+
return V.value.slice(0, e).reduce((l, t) => l + t.items.length, 0);
|
|
567
956
|
}
|
|
568
|
-
const
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
957
|
+
const ve = b(() => se.value.length), Ae = b(() => se.value.length + le.value.length), Oe = b(() => [
|
|
958
|
+
...se.value,
|
|
959
|
+
...le.value,
|
|
960
|
+
...ye.value.map((e) => e.command)
|
|
961
|
+
]), Ge = R([]);
|
|
962
|
+
let Be = null;
|
|
963
|
+
re(c, async (e) => {
|
|
964
|
+
Be && clearTimeout(Be);
|
|
965
|
+
const l = p.store.getSortedGroups().filter((o) => o.onSearch), t = typeof p.globalSearch == "function";
|
|
966
|
+
if (!l.length && !t || !e.trim()) {
|
|
967
|
+
Ge.value = [];
|
|
575
968
|
return;
|
|
576
969
|
}
|
|
577
|
-
|
|
578
|
-
|
|
970
|
+
Be = setTimeout(async () => {
|
|
971
|
+
W.value = !0;
|
|
579
972
|
try {
|
|
580
|
-
const
|
|
581
|
-
l.map((
|
|
582
|
-
(
|
|
973
|
+
const i = (await Promise.all(
|
|
974
|
+
l.map((U) => U.onSearch(e).then(
|
|
975
|
+
(Q) => Q.map((Pe) => ({ command: Pe, score: 50, matches: Se(e, Pe.label), groupId: U.id }))
|
|
583
976
|
))
|
|
584
|
-
);
|
|
585
|
-
|
|
977
|
+
)).flat();
|
|
978
|
+
if (p.globalSearch) {
|
|
979
|
+
const U = await p.globalSearch(e);
|
|
980
|
+
for (const Q of U)
|
|
981
|
+
i.find((Pe) => Pe.command.id === Q.id) || i.push({ command: Q, score: 50, matches: Se(e, Q.label), groupId: void 0 });
|
|
982
|
+
}
|
|
983
|
+
Ge.value = i;
|
|
586
984
|
} finally {
|
|
587
|
-
|
|
985
|
+
W.value = !1;
|
|
588
986
|
}
|
|
589
987
|
}, 200);
|
|
590
988
|
});
|
|
591
|
-
const
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
).map((i) => ({ command: i, score: 50, matches: [], groupId: void 0 }));
|
|
989
|
+
const ze = R([]);
|
|
990
|
+
let Ne = null;
|
|
991
|
+
re([c, fe], async ([e, l]) => {
|
|
992
|
+
if (Ne && clearTimeout(Ne), !l?.onSearch || !e.trim()) {
|
|
993
|
+
ze.value = [];
|
|
994
|
+
return;
|
|
598
995
|
}
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
996
|
+
Ne = setTimeout(async () => {
|
|
997
|
+
W.value = !0;
|
|
998
|
+
try {
|
|
999
|
+
const t = await l.onSearch(e);
|
|
1000
|
+
ze.value = t.map((o) => ({ command: o, score: 50, matches: Se(e, o.label), groupId: void 0 }));
|
|
1001
|
+
} finally {
|
|
1002
|
+
W.value = !1;
|
|
1003
|
+
}
|
|
1004
|
+
}, 200);
|
|
1005
|
+
});
|
|
1006
|
+
const Ue = R([]);
|
|
1007
|
+
let Ye = null;
|
|
1008
|
+
re([G, v], async ([e, l]) => {
|
|
1009
|
+
if (Ye && clearTimeout(Ye), !l?.onSearch || !e.trim()) {
|
|
1010
|
+
Ue.value = [];
|
|
1011
|
+
return;
|
|
609
1012
|
}
|
|
610
|
-
|
|
611
|
-
|
|
1013
|
+
Ye = setTimeout(async () => {
|
|
1014
|
+
W.value = !0;
|
|
1015
|
+
try {
|
|
1016
|
+
const t = await l.onSearch(e);
|
|
1017
|
+
Ue.value = t.map((o) => ({ command: o, score: 50, matches: Se(e, o.label), groupId: void 0 }));
|
|
1018
|
+
} finally {
|
|
1019
|
+
W.value = !1;
|
|
1020
|
+
}
|
|
1021
|
+
}, 200);
|
|
1022
|
+
});
|
|
1023
|
+
function rt(e, l) {
|
|
1024
|
+
const t = l.toLowerCase();
|
|
1025
|
+
return e.filter(
|
|
1026
|
+
(o) => o.label.toLowerCase().includes(t) || o.description?.toLowerCase().includes(t) || o.keywords?.some((i) => i.toLowerCase().includes(t))
|
|
1027
|
+
).map((o) => ({ command: o, score: 50, matches: Se(l, o.label), groupId: void 0 }));
|
|
1028
|
+
}
|
|
1029
|
+
const Tt = p.results, be = b(() => {
|
|
1030
|
+
const e = v.value;
|
|
1031
|
+
if (e)
|
|
1032
|
+
return G.value.trim() ? e.onSearch ? Ue.value : p.store.search(G.value).slice(0, r.maxResults) : [];
|
|
1033
|
+
const l = fe.value;
|
|
1034
|
+
if (l)
|
|
1035
|
+
return c.value.trim() ? l.onSearch ? ze.value : rt(l.items ?? [], c.value) : [];
|
|
1036
|
+
const t = j.value;
|
|
1037
|
+
if (t !== null && c.value.trim())
|
|
1038
|
+
return rt(t, c.value);
|
|
1039
|
+
const o = [...Tt.value];
|
|
1040
|
+
for (const i of Ge.value)
|
|
1041
|
+
o.find((U) => U.command.id === i.command.id) || o.push(i);
|
|
1042
|
+
return o.sort(it).slice(0, r.maxResults);
|
|
1043
|
+
}), _e = b(() => {
|
|
1044
|
+
const e = p.store.getSortedGroups().map((t) => {
|
|
1045
|
+
const o = be.value.filter((i) => i.groupId === t.id);
|
|
1046
|
+
return { group: t, items: o, bestIndex: o.length ? be.value.indexOf(o[0]) : 1 / 0 };
|
|
1047
|
+
}).filter((t) => t.items.length > 0).sort((t, o) => t.bestIndex - o.bestIndex);
|
|
1048
|
+
let l = 0;
|
|
1049
|
+
return e.map((t, o) => {
|
|
1050
|
+
const i = { group: t.group, items: t.items, offset: l, section: o > 0 };
|
|
1051
|
+
return l += t.items.length, i;
|
|
1052
|
+
});
|
|
1053
|
+
}), ct = b(() => _e.value.reduce((e, l) => e + l.items.length, 0)), Ve = b(() => be.value.filter((e) => !e.groupId)), Le = b(() => [
|
|
1054
|
+
..._e.value.flatMap((e) => e.items),
|
|
1055
|
+
...Ve.value
|
|
1056
|
+
]), ut = b(() => {
|
|
612
1057
|
const e = [];
|
|
613
1058
|
let l = 0;
|
|
614
|
-
for (let
|
|
615
|
-
const { group:
|
|
616
|
-
U && e.push({ type: "section" }), e.push({ type: "group-header", label:
|
|
617
|
-
for (const
|
|
1059
|
+
for (let t = 0; t < _e.value.length; t++) {
|
|
1060
|
+
const { group: o, items: i, section: U } = _e.value[t];
|
|
1061
|
+
U && e.push({ type: "section" }), e.push({ type: "group-header", label: o.label });
|
|
1062
|
+
for (const Q of i) e.push({ type: "command", result: Q, index: l++ });
|
|
618
1063
|
}
|
|
619
|
-
for (const
|
|
1064
|
+
for (const t of Ve.value) e.push({ type: "command", result: t, index: l++ });
|
|
620
1065
|
return e;
|
|
621
|
-
})
|
|
622
|
-
|
|
1066
|
+
});
|
|
1067
|
+
re(Le, (e) => {
|
|
1068
|
+
p.currentResults.value = e;
|
|
1069
|
+
}, { immediate: !0 });
|
|
1070
|
+
const St = b(
|
|
1071
|
+
() => ut.value.findIndex((e) => e.type === "command" && e.index === d.value)
|
|
1072
|
+
), xt = b(() => {
|
|
1073
|
+
const e = Le.value[d.value];
|
|
623
1074
|
return e ? `vcp-item-${e.command.id}` : void 0;
|
|
1075
|
+
}), he = b(() => {
|
|
1076
|
+
const e = d.value;
|
|
1077
|
+
return c.value.trim() ? Le.value[e]?.command ?? null : j.value ? j.value[e] ?? null : Oe.value[e] ?? null;
|
|
1078
|
+
}), It = b(
|
|
1079
|
+
() => L.value && c.value.trim() ? y.value.resultsCount(be.value.length) : ""
|
|
1080
|
+
);
|
|
1081
|
+
re([he, L], ([e, l]) => {
|
|
1082
|
+
p.onHighlight?.(l ? e : null);
|
|
624
1083
|
});
|
|
625
|
-
function
|
|
626
|
-
return
|
|
1084
|
+
function At(e) {
|
|
1085
|
+
return p.store.findCommand(e)?.label ?? e;
|
|
1086
|
+
}
|
|
1087
|
+
function dt() {
|
|
1088
|
+
d.value = 0, Z.value = -1;
|
|
627
1089
|
}
|
|
628
|
-
function
|
|
629
|
-
|
|
1090
|
+
function Lt() {
|
|
1091
|
+
return ae.value ? Array.from(ae.value.querySelectorAll(co)).filter((e) => e.offsetParent !== null || e === document.activeElement) : [];
|
|
630
1092
|
}
|
|
631
|
-
|
|
1093
|
+
function Pt(e) {
|
|
1094
|
+
const l = Lt();
|
|
1095
|
+
if (!l.length) {
|
|
1096
|
+
e.preventDefault(), X.value?.focus();
|
|
1097
|
+
return;
|
|
1098
|
+
}
|
|
1099
|
+
const t = l[0], o = l[l.length - 1], i = document.activeElement, U = !!i && !!ae.value?.contains(i);
|
|
1100
|
+
e.shiftKey ? (!U || i === t) && (e.preventDefault(), o.focus()) : (!U || i === o) && (e.preventDefault(), t.focus());
|
|
1101
|
+
}
|
|
1102
|
+
async function oe(e) {
|
|
1103
|
+
if (r.selectable) {
|
|
1104
|
+
Ce(e.id);
|
|
1105
|
+
return;
|
|
1106
|
+
}
|
|
632
1107
|
if (e.confirm) {
|
|
633
|
-
|
|
1108
|
+
L.value || B(), N.value = e;
|
|
634
1109
|
return;
|
|
635
1110
|
}
|
|
636
|
-
await
|
|
1111
|
+
(e.subCommands?.length || e.page) && !L.value && B(), await O(e);
|
|
1112
|
+
}
|
|
1113
|
+
async function mt() {
|
|
1114
|
+
if (!N.value) return;
|
|
1115
|
+
const e = N.value;
|
|
1116
|
+
N.value = null, await O(e);
|
|
1117
|
+
}
|
|
1118
|
+
function Rt() {
|
|
1119
|
+
if (!ne.value.length) return;
|
|
1120
|
+
const e = p.store.getAllCommands(), l = ne.value.map((t) => e.find((o) => o.id === t)).filter((t) => !!t);
|
|
1121
|
+
g("submit-selection", l), ne.value = [], x();
|
|
1122
|
+
}
|
|
1123
|
+
function Dt(e) {
|
|
1124
|
+
e.actions?.length && (Y.value = e, J.value = 0);
|
|
1125
|
+
}
|
|
1126
|
+
function qe() {
|
|
1127
|
+
Y.value = null, xe(() => X.value?.focus());
|
|
1128
|
+
}
|
|
1129
|
+
async function Fe(e) {
|
|
1130
|
+
const l = Y.value;
|
|
1131
|
+
Y.value = null, x();
|
|
1132
|
+
try {
|
|
1133
|
+
await e.perform();
|
|
1134
|
+
} catch (t) {
|
|
1135
|
+
p.onError && l ? p.onError(t, l) : console.error("[@macrulez/vue-command-palette] Action error:", t);
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
Gt(() => {
|
|
1139
|
+
p.executeRequest.value = oe;
|
|
1140
|
+
}), lt(() => {
|
|
1141
|
+
p.executeRequest.value === oe && (p.executeRequest.value = null);
|
|
1142
|
+
});
|
|
1143
|
+
function Mt(e, l) {
|
|
1144
|
+
if (!l.length) return !1;
|
|
1145
|
+
const t = l[l.length - 1].toLowerCase(), o = l.slice(0, -1);
|
|
1146
|
+
return (o.includes("$mod") || o.includes("ctrl") || o.includes("meta")) !== (e.metaKey || e.ctrlKey) || o.includes("shift") !== e.shiftKey || o.includes("alt") !== e.altKey ? !1 : e.key.toLowerCase() === t;
|
|
1147
|
+
}
|
|
1148
|
+
let ft = 0, vt = 0;
|
|
1149
|
+
function Kt(e) {
|
|
1150
|
+
const l = e.changedTouches[0];
|
|
1151
|
+
ft = l.clientX, vt = l.clientY;
|
|
637
1152
|
}
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
x.value = null, await I(e);
|
|
1153
|
+
function Ht(e) {
|
|
1154
|
+
const l = e.changedTouches[0], t = l.clientX - ft, o = l.clientY - vt;
|
|
1155
|
+
t > 70 && Math.abs(o) < 50 && h.value.length && je();
|
|
642
1156
|
}
|
|
643
|
-
function
|
|
644
|
-
|
|
645
|
-
|
|
1157
|
+
function Je() {
|
|
1158
|
+
xe(() => {
|
|
1159
|
+
const e = ue.value?.querySelector('[aria-selected="true"]');
|
|
1160
|
+
e && typeof e.scrollIntoView == "function" && e.scrollIntoView({ block: "nearest" });
|
|
646
1161
|
});
|
|
647
1162
|
}
|
|
648
|
-
function
|
|
649
|
-
|
|
650
|
-
|
|
1163
|
+
function je() {
|
|
1164
|
+
I.goBack(), Je();
|
|
1165
|
+
}
|
|
1166
|
+
function Ot(e) {
|
|
1167
|
+
if (N.value) {
|
|
1168
|
+
e.key === "Escape" && (e.preventDefault(), N.value = null), e.key === "Enter" && (e.preventDefault(), mt());
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
if (Y.value) {
|
|
1172
|
+
const t = Y.value.actions ?? [];
|
|
1173
|
+
if (e.key === "Escape" || e.key === "Tab" || e.key === "Backspace")
|
|
1174
|
+
e.preventDefault(), qe();
|
|
1175
|
+
else if (e.key === "ArrowDown")
|
|
1176
|
+
e.preventDefault(), t.length && (J.value = (J.value + 1) % t.length);
|
|
1177
|
+
else if (e.key === "ArrowUp")
|
|
1178
|
+
e.preventDefault(), t.length && (J.value = (J.value - 1 + t.length) % t.length);
|
|
1179
|
+
else if (e.key === "Enter") {
|
|
1180
|
+
e.preventDefault();
|
|
1181
|
+
const o = t[J.value];
|
|
1182
|
+
o && Fe(o);
|
|
1183
|
+
}
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
if (r.preview && Mt(e, r.previewHotkey)) {
|
|
1187
|
+
e.preventDefault(), C();
|
|
1188
|
+
return;
|
|
1189
|
+
}
|
|
1190
|
+
if ((e.metaKey || e.ctrlKey) && e.key.toLowerCase() === "p") {
|
|
1191
|
+
e.preventDefault(), he.value && z(he.value.id);
|
|
1192
|
+
return;
|
|
1193
|
+
}
|
|
1194
|
+
if (r.selectable && (e.metaKey || e.ctrlKey) && e.key === "Enter") {
|
|
1195
|
+
e.preventDefault(), Rt();
|
|
651
1196
|
return;
|
|
652
1197
|
}
|
|
653
|
-
|
|
1198
|
+
if (e.altKey && (e.key === "ArrowUp" || e.key === "ArrowDown")) {
|
|
1199
|
+
const t = p.queryHistory.value;
|
|
1200
|
+
if (!t.length) return;
|
|
1201
|
+
e.preventDefault(), Z.value = e.key === "ArrowUp" ? Math.min(Z.value + 1, t.length - 1) : Math.max(Z.value - 1, -1), c.value = Z.value >= 0 ? t[Z.value] : "", d.value = 0;
|
|
1202
|
+
return;
|
|
1203
|
+
}
|
|
1204
|
+
const l = be.value.length || (c.value.trim() ? 0 : j.value ? j.value.length : Oe.value.length);
|
|
654
1205
|
if (e.key === "ArrowDown")
|
|
655
|
-
e.preventDefault(), l && (
|
|
1206
|
+
e.preventDefault(), l && (d.value = (d.value + 1) % l), Je();
|
|
656
1207
|
else if (e.key === "ArrowUp")
|
|
657
|
-
e.preventDefault(), l && (
|
|
1208
|
+
e.preventDefault(), l && (d.value = (d.value - 1 + l) % l), Je();
|
|
658
1209
|
else if (e.key === "Enter")
|
|
659
1210
|
if (e.preventDefault(), c.value.trim()) {
|
|
660
|
-
const
|
|
661
|
-
|
|
1211
|
+
const t = Le.value[d.value];
|
|
1212
|
+
t?.command && oe(t.command);
|
|
662
1213
|
} else {
|
|
663
|
-
const o =
|
|
664
|
-
|
|
665
|
-
P.value ? i = P.value[o] : i = o < D.value.length ? D.value[o] : B.value[o - D.value.length]?.command, i && _(i);
|
|
1214
|
+
const t = d.value, o = j.value ? j.value[t] : Oe.value[t];
|
|
1215
|
+
o && oe(o);
|
|
666
1216
|
}
|
|
667
|
-
else e.key === "Escape" ? (e.preventDefault(),
|
|
1217
|
+
else e.key === "Escape" ? (e.preventDefault(), h.value.length ? je() : x()) : e.key === "Backspace" && !c.value ? (e.preventDefault(), je()) : e.key === "Tab" && (!e.shiftKey && he.value?.actions?.length ? (e.preventDefault(), Dt(he.value)) : Pt(e));
|
|
668
1218
|
}
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
1219
|
+
let Qe = null;
|
|
1220
|
+
return re(L, async (e) => {
|
|
1221
|
+
typeof document > "u" || (e ? (Qe = document.activeElement, d.value = 0, document.body.style.overflow = "hidden", await xe(), X.value?.focus()) : (document.body.style.overflow = "", N.value = null, Y.value = null, Z.value = -1, ne.value = [], Qe?.focus?.(), Qe = null));
|
|
1222
|
+
}), re([N, Y], async () => {
|
|
1223
|
+
L.value && (await xe(), N.value || Y.value ? ae.value?.focus() : X.value?.focus());
|
|
1224
|
+
}), (e, l) => (u(), f(P, null, [
|
|
1225
|
+
$(e.$slots, "trigger", {
|
|
1226
|
+
open: T(B),
|
|
1227
|
+
toggle: T(E)
|
|
675
1228
|
}),
|
|
676
|
-
(u(),
|
|
677
|
-
|
|
678
|
-
default:
|
|
679
|
-
|
|
1229
|
+
(u(), te(Bt, { to: n.teleportTo }, [
|
|
1230
|
+
We(zt, { name: "vcp-fade" }, {
|
|
1231
|
+
default: S(() => [
|
|
1232
|
+
T(L) ? (u(), f("div", {
|
|
680
1233
|
key: 0,
|
|
681
|
-
class:
|
|
1234
|
+
class: ie(["vcp-overlay", T(p).colorTheme.value !== "system" ? `vcp-theme-${T(p).colorTheme.value}` : ""]),
|
|
682
1235
|
role: "presentation",
|
|
683
|
-
onClick: l[6] || (l[6] =
|
|
1236
|
+
onClick: l[6] || (l[6] = kt(
|
|
684
1237
|
//@ts-ignore
|
|
685
|
-
(...
|
|
1238
|
+
(...t) => T(x) && T(x)(...t),
|
|
686
1239
|
["self"]
|
|
687
1240
|
))
|
|
688
1241
|
}, [
|
|
689
|
-
|
|
690
|
-
|
|
1242
|
+
w("div", {
|
|
1243
|
+
ref_key: "dialogEl",
|
|
1244
|
+
ref: ae,
|
|
1245
|
+
class: ie(["vcp-dialog", [`vcp-dialog--${n.theme}`, { "vcp-dialog--preview": k.value }]]),
|
|
691
1246
|
role: "dialog",
|
|
692
1247
|
"aria-modal": "true",
|
|
693
|
-
|
|
694
|
-
|
|
1248
|
+
tabindex: "-1",
|
|
1249
|
+
"aria-label": y.value.dialogLabel,
|
|
1250
|
+
onKeydown: Ot,
|
|
1251
|
+
onTouchstartPassive: Kt,
|
|
1252
|
+
onTouchendPassive: Ht
|
|
695
1253
|
}, [
|
|
696
|
-
|
|
697
|
-
(u(!0),
|
|
698
|
-
key:
|
|
1254
|
+
T(h).length ? (u(), f("div", $n, [
|
|
1255
|
+
(u(!0), f(P, null, q(T(h), (t, o) => (u(), f("span", {
|
|
1256
|
+
key: t.paletteId,
|
|
699
1257
|
class: "vcp-breadcrumb__item"
|
|
700
1258
|
}, [
|
|
701
|
-
|
|
702
|
-
|
|
1259
|
+
o > 0 ? (u(), f("span", Cn, "›")) : M("", !0),
|
|
1260
|
+
we(" " + K(At(t.paletteId)), 1)
|
|
703
1261
|
]))), 128)),
|
|
704
|
-
l[7] || (l[7] =
|
|
1262
|
+
l[7] || (l[7] = w("span", {
|
|
705
1263
|
class: "vcp-breadcrumb__sep",
|
|
706
1264
|
"aria-hidden": "true"
|
|
707
1265
|
}, "›", -1))
|
|
708
1266
|
])) : M("", !0),
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
1267
|
+
N.value ? (u(), f("div", wn, [
|
|
1268
|
+
w("p", _n, K(N.value.confirm), 1),
|
|
1269
|
+
w("div", En, [
|
|
1270
|
+
w("button", {
|
|
713
1271
|
class: "vcp-confirm__btn vcp-confirm__btn--yes",
|
|
714
|
-
onClick:
|
|
715
|
-
},
|
|
716
|
-
|
|
1272
|
+
onClick: mt
|
|
1273
|
+
}, K(y.value.confirmYes), 1),
|
|
1274
|
+
w("button", {
|
|
717
1275
|
class: "vcp-confirm__btn vcp-confirm__btn--no",
|
|
718
|
-
onClick: l[0] || (l[0] = (
|
|
719
|
-
},
|
|
1276
|
+
onClick: l[0] || (l[0] = (t) => N.value = null)
|
|
1277
|
+
}, K(y.value.confirmCancel), 1)
|
|
720
1278
|
])
|
|
721
|
-
])) : (
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
1279
|
+
])) : Y.value ? $(e.$slots, "actions", {
|
|
1280
|
+
key: 2,
|
|
1281
|
+
command: Y.value,
|
|
1282
|
+
run: Fe,
|
|
1283
|
+
activeIndex: J.value,
|
|
1284
|
+
close: qe
|
|
1285
|
+
}, () => [
|
|
1286
|
+
w("div", Tn, [
|
|
1287
|
+
w("div", Sn, [
|
|
1288
|
+
w("button", {
|
|
1289
|
+
class: "vcp-actions__back",
|
|
1290
|
+
type: "button",
|
|
1291
|
+
title: y.value.back,
|
|
1292
|
+
onClick: qe
|
|
1293
|
+
}, "‹", 8, xn),
|
|
1294
|
+
w("span", In, K(y.value.actions) + " — " + K(Y.value.label), 1),
|
|
1295
|
+
w("span", An, [
|
|
1296
|
+
l[8] || (l[8] = w("kbd", { class: "vcp-kbd" }, "Esc", -1)),
|
|
1297
|
+
we(" " + K(y.value.back), 1)
|
|
1298
|
+
])
|
|
1299
|
+
]),
|
|
1300
|
+
(u(!0), f(P, null, q(Y.value.actions, (t, o) => (u(), f("div", {
|
|
1301
|
+
key: t.id,
|
|
1302
|
+
class: ie(["vcp-item", { "vcp-item--active": o === J.value }]),
|
|
1303
|
+
role: "option",
|
|
1304
|
+
"aria-selected": o === J.value,
|
|
1305
|
+
onClick: (i) => Fe(t),
|
|
1306
|
+
onMouseenter: (i) => J.value = o
|
|
1307
|
+
}, [
|
|
1308
|
+
t.icon ? (u(), f("span", Pn, [
|
|
1309
|
+
(u(), te(De(typeof t.icon == "string" ? "span" : t.icon), null, {
|
|
1310
|
+
default: S(() => [
|
|
1311
|
+
we(K(typeof t.icon == "string" ? t.icon : ""), 1)
|
|
1312
|
+
]),
|
|
1313
|
+
_: 2
|
|
1314
|
+
}, 1024))
|
|
1315
|
+
])) : M("", !0),
|
|
1316
|
+
w("span", Rn, [
|
|
1317
|
+
w("span", Dn, K(t.label), 1)
|
|
1318
|
+
]),
|
|
1319
|
+
t.shortcut?.length ? (u(), f("span", Mn, [
|
|
1320
|
+
(u(!0), f(P, null, q(t.shortcut, (i) => (u(), f("kbd", {
|
|
1321
|
+
key: i,
|
|
1322
|
+
class: "vcp-kbd"
|
|
1323
|
+
}, K(i), 1))), 128))
|
|
1324
|
+
])) : M("", !0)
|
|
1325
|
+
], 42, Ln))), 128))
|
|
1326
|
+
])
|
|
1327
|
+
]) : (u(), f(P, { key: 3 }, [
|
|
1328
|
+
$(e.$slots, "header"),
|
|
1329
|
+
w("div", Kn, [
|
|
1330
|
+
v.value ? (u(), f("span", Hn, K(v.value.label || v.value.prefix), 1)) : M("", !0),
|
|
1331
|
+
$(e.$slots, "input", {
|
|
1332
|
+
query: T(c),
|
|
1333
|
+
onInput: dt
|
|
727
1334
|
}, () => [
|
|
728
|
-
|
|
729
|
-
id:
|
|
1335
|
+
pt(w("input", {
|
|
1336
|
+
id: ro,
|
|
730
1337
|
ref_key: "inputEl",
|
|
731
|
-
ref:
|
|
732
|
-
"onUpdate:modelValue": l[1] || (l[1] = (
|
|
1338
|
+
ref: X,
|
|
1339
|
+
"onUpdate:modelValue": l[1] || (l[1] = (t) => Nt(c) ? c.value = t : null),
|
|
733
1340
|
class: "vcp-input",
|
|
734
1341
|
type: "text",
|
|
735
1342
|
autocomplete: "off",
|
|
736
1343
|
spellcheck: "false",
|
|
737
|
-
placeholder:
|
|
1344
|
+
placeholder: v.value?.placeholder || fe.value?.placeholder || n.placeholder,
|
|
738
1345
|
role: "combobox",
|
|
739
1346
|
"aria-expanded": "true",
|
|
740
|
-
"aria-controls":
|
|
741
|
-
"aria-activedescendant":
|
|
742
|
-
onInput:
|
|
743
|
-
}, null, 40,
|
|
744
|
-
[
|
|
1347
|
+
"aria-controls": bt,
|
|
1348
|
+
"aria-activedescendant": xt.value,
|
|
1349
|
+
onInput: dt
|
|
1350
|
+
}, null, 40, On), [
|
|
1351
|
+
[Ut, T(c)]
|
|
745
1352
|
])
|
|
746
1353
|
]),
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
1354
|
+
W.value ? (u(), f("span", {
|
|
1355
|
+
key: 1,
|
|
1356
|
+
class: "vcp-input-spinner",
|
|
1357
|
+
role: "status",
|
|
1358
|
+
"aria-label": y.value.loading
|
|
1359
|
+
}, null, 8, Gn)) : M("", !0),
|
|
1360
|
+
w("div", Bn, [
|
|
1361
|
+
(u(), f(P, null, q(["light", "system", "dark"], (t) => w("button", {
|
|
1362
|
+
key: t,
|
|
1363
|
+
class: ie(["vcp-theme-btn", { "vcp-theme-btn--active": T(p).colorTheme.value === t }]),
|
|
1364
|
+
title: t === "light" ? y.value.themeLight : t === "dark" ? y.value.themeDark : y.value.themeSystem,
|
|
752
1365
|
type: "button",
|
|
753
|
-
onClick: (
|
|
1366
|
+
onClick: (o) => T(p).colorTheme.value = t
|
|
754
1367
|
}, [
|
|
755
|
-
|
|
756
|
-
class:
|
|
1368
|
+
w("span", {
|
|
1369
|
+
class: ie(["vcp-theme-icon", `vcp-theme-icon--${t}`]),
|
|
757
1370
|
"aria-hidden": "true"
|
|
758
1371
|
}, null, 2)
|
|
759
|
-
], 10,
|
|
760
|
-
])
|
|
761
|
-
|
|
762
|
-
$e(R("div", {
|
|
763
|
-
id: we,
|
|
764
|
-
ref_key: "listEl",
|
|
765
|
-
ref: O,
|
|
766
|
-
class: "vcp-list",
|
|
767
|
-
role: "listbox",
|
|
768
|
-
"aria-label": t.placeholder
|
|
769
|
-
}, [
|
|
770
|
-
K.value ? (u(), h("div", dt, q(t.loadingText), 1)) : k(c).trim() ? p.value.length > $t ? (u(), V(tt, {
|
|
1372
|
+
], 10, zn)), 64))
|
|
1373
|
+
]),
|
|
1374
|
+
n.preview ? (u(), f("button", {
|
|
771
1375
|
key: 2,
|
|
772
|
-
|
|
773
|
-
"
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
e.$slots["item-icon"] ? {
|
|
788
|
-
name: "item-icon",
|
|
789
|
-
fn: C((i) => [
|
|
790
|
-
y(e.$slots, "item-icon", re(le(i)))
|
|
791
|
-
]),
|
|
792
|
-
key: "0"
|
|
793
|
-
} : void 0,
|
|
794
|
-
e.$slots["item-shortcut"] ? {
|
|
795
|
-
name: "item-shortcut",
|
|
796
|
-
fn: C((i) => [
|
|
797
|
-
y(e.$slots, "item-shortcut", re(le(i)))
|
|
798
|
-
]),
|
|
799
|
-
key: "1"
|
|
800
|
-
} : void 0,
|
|
801
|
-
e.$slots.item ? {
|
|
802
|
-
name: "default",
|
|
803
|
-
fn: C((i) => [
|
|
804
|
-
y(e.$slots, "item", re(le(i)))
|
|
805
|
-
]),
|
|
806
|
-
key: "2"
|
|
807
|
-
} : void 0
|
|
808
|
-
]), 1032, ["command", "active", "matches", "item-id", "loading-command-id", "onExecute", "onActivate"]))
|
|
809
|
-
]),
|
|
810
|
-
_: 3
|
|
811
|
-
}, 8, ["items"])) : p.value.length ? (u(), h(T, { key: 3 }, [
|
|
812
|
-
(u(!0), h(T, null, H(A.value, (o) => (u(), h(T, {
|
|
813
|
-
key: o.group.id
|
|
1376
|
+
class: ie(["vcp-preview-toggle", { "vcp-preview-toggle--active": k.value }]),
|
|
1377
|
+
type: "button",
|
|
1378
|
+
title: y.value.togglePreview,
|
|
1379
|
+
"aria-label": y.value.togglePreview,
|
|
1380
|
+
"aria-pressed": k.value,
|
|
1381
|
+
onClick: C
|
|
1382
|
+
}, [...l[9] || (l[9] = [
|
|
1383
|
+
w("svg", {
|
|
1384
|
+
viewBox: "0 0 16 16",
|
|
1385
|
+
width: "15",
|
|
1386
|
+
height: "15",
|
|
1387
|
+
"aria-hidden": "true",
|
|
1388
|
+
fill: "none",
|
|
1389
|
+
stroke: "currentColor",
|
|
1390
|
+
"stroke-width": "1.5"
|
|
814
1391
|
}, [
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
"
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
key:
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
onExecute: (f) => _(o.command),
|
|
863
|
-
onActivate: (f) => a.value = F.value + i
|
|
864
|
-
}, Y({ _: 2 }, [
|
|
865
|
-
e.$slots["item-icon"] ? {
|
|
866
|
-
name: "item-icon",
|
|
867
|
-
fn: C((f) => [
|
|
868
|
-
y(e.$slots, "item-icon", E({ ref_for: !0 }, f))
|
|
869
|
-
]),
|
|
870
|
-
key: "0"
|
|
871
|
-
} : void 0,
|
|
872
|
-
e.$slots["item-shortcut"] ? {
|
|
873
|
-
name: "item-shortcut",
|
|
874
|
-
fn: C((f) => [
|
|
875
|
-
y(e.$slots, "item-shortcut", E({ ref_for: !0 }, f))
|
|
876
|
-
]),
|
|
877
|
-
key: "1"
|
|
878
|
-
} : void 0,
|
|
879
|
-
e.$slots.item ? {
|
|
880
|
-
name: "default",
|
|
881
|
-
fn: C((f) => [
|
|
882
|
-
y(e.$slots, "item", E({ ref_for: !0 }, f))
|
|
883
|
-
]),
|
|
884
|
-
key: "2"
|
|
885
|
-
} : void 0
|
|
886
|
-
]), 1032, ["command", "active", "matches", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128))
|
|
887
|
-
], 64)) : k(c).trim() ? (u(), h("div", yt, [
|
|
888
|
-
y(e.$slots, "empty", { query: k(c) }, () => [
|
|
889
|
-
ue(q(t.emptyText), 1)
|
|
890
|
-
])
|
|
891
|
-
])) : M("", !0) : (u(), h(T, { key: 1 }, [
|
|
892
|
-
P.value ? (u(!0), h(T, { key: 0 }, H(P.value, (o, i) => (u(), V(X, {
|
|
893
|
-
key: o.id,
|
|
894
|
-
command: o,
|
|
895
|
-
active: i === k(a),
|
|
896
|
-
matches: [],
|
|
897
|
-
"item-id": `vcp-item-sub-${o.id}`,
|
|
898
|
-
"loading-command-id": k(d),
|
|
899
|
-
onExecute: (f) => _(o),
|
|
900
|
-
onActivate: (f) => a.value = i
|
|
901
|
-
}, Y({ _: 2 }, [
|
|
902
|
-
e.$slots["item-icon"] ? {
|
|
903
|
-
name: "item-icon",
|
|
904
|
-
fn: C((f) => [
|
|
905
|
-
y(e.$slots, "item-icon", E({ ref_for: !0 }, f))
|
|
906
|
-
]),
|
|
907
|
-
key: "0"
|
|
908
|
-
} : void 0,
|
|
909
|
-
e.$slots["item-shortcut"] ? {
|
|
910
|
-
name: "item-shortcut",
|
|
911
|
-
fn: C((f) => [
|
|
912
|
-
y(e.$slots, "item-shortcut", E({ ref_for: !0 }, f))
|
|
913
|
-
]),
|
|
914
|
-
key: "1"
|
|
915
|
-
} : void 0,
|
|
916
|
-
e.$slots.item ? {
|
|
917
|
-
name: "default",
|
|
918
|
-
fn: C((f) => [
|
|
919
|
-
y(e.$slots, "item", E({ ref_for: !0 }, f))
|
|
920
|
-
]),
|
|
921
|
-
key: "2"
|
|
922
|
-
} : void 0
|
|
923
|
-
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128)) : (u(), h(T, { key: 1 }, [
|
|
924
|
-
D.value.length ? (u(), h(T, { key: 0 }, [
|
|
925
|
-
l[8] || (l[8] = R("div", {
|
|
926
|
-
class: "vcp-group__header",
|
|
927
|
-
"aria-hidden": "true"
|
|
928
|
-
}, "Recent", -1)),
|
|
929
|
-
(u(!0), h(T, null, H(D.value, (o, i) => (u(), V(X, {
|
|
930
|
-
key: o.id,
|
|
931
|
-
command: o,
|
|
932
|
-
active: i === k(a),
|
|
933
|
-
matches: [],
|
|
934
|
-
"item-id": `vcp-item-recent-${o.id}`,
|
|
935
|
-
"loading-command-id": k(d),
|
|
936
|
-
onExecute: (f) => _(o),
|
|
937
|
-
onActivate: (f) => a.value = i
|
|
938
|
-
}, Y({ _: 2 }, [
|
|
1392
|
+
w("rect", {
|
|
1393
|
+
x: "1.5",
|
|
1394
|
+
y: "2.5",
|
|
1395
|
+
width: "13",
|
|
1396
|
+
height: "11",
|
|
1397
|
+
rx: "1.5"
|
|
1398
|
+
}),
|
|
1399
|
+
w("line", {
|
|
1400
|
+
x1: "10",
|
|
1401
|
+
y1: "2.5",
|
|
1402
|
+
x2: "10",
|
|
1403
|
+
y2: "13.5"
|
|
1404
|
+
})
|
|
1405
|
+
], -1)
|
|
1406
|
+
])], 10, Nn)) : M("", !0)
|
|
1407
|
+
]),
|
|
1408
|
+
w("div", {
|
|
1409
|
+
class: ie(["vcp-body", { "vcp-body--with-preview": n.preview }])
|
|
1410
|
+
}, [
|
|
1411
|
+
pt(w("div", {
|
|
1412
|
+
id: bt,
|
|
1413
|
+
ref_key: "listEl",
|
|
1414
|
+
ref: ue,
|
|
1415
|
+
class: "vcp-list",
|
|
1416
|
+
role: "listbox",
|
|
1417
|
+
"aria-label": n.placeholder
|
|
1418
|
+
}, [
|
|
1419
|
+
T(c).trim() ? be.value.length > so ? (u(), te(bn, {
|
|
1420
|
+
key: 1,
|
|
1421
|
+
items: ut.value,
|
|
1422
|
+
"item-height": lo,
|
|
1423
|
+
"container-height": io,
|
|
1424
|
+
"active-index": St.value
|
|
1425
|
+
}, {
|
|
1426
|
+
default: S(({ item: t }) => [
|
|
1427
|
+
t.type === "group-header" ? (u(), f("div", Qn, K(t.label), 1)) : t.type === "section" ? (u(), f("div", Wn)) : (u(), te(ke, {
|
|
1428
|
+
key: 2,
|
|
1429
|
+
command: t.result.command,
|
|
1430
|
+
active: t.index === T(d),
|
|
1431
|
+
matches: t.result.matches,
|
|
1432
|
+
parents: t.result.parents,
|
|
1433
|
+
"matched-text": t.result.matchedText,
|
|
1434
|
+
"item-id": `vcp-item-${t.result.command.id}`,
|
|
1435
|
+
"loading-command-id": T(_),
|
|
1436
|
+
onExecute: (o) => oe(t.result.command),
|
|
1437
|
+
onActivate: (o) => d.value = t.index
|
|
1438
|
+
}, ce({ _: 2 }, [
|
|
939
1439
|
e.$slots["item-icon"] ? {
|
|
940
1440
|
name: "item-icon",
|
|
941
|
-
fn:
|
|
942
|
-
|
|
1441
|
+
fn: S((o) => [
|
|
1442
|
+
$(e.$slots, "item-icon", Xe(Ze(o)))
|
|
943
1443
|
]),
|
|
944
1444
|
key: "0"
|
|
945
1445
|
} : void 0,
|
|
946
1446
|
e.$slots["item-shortcut"] ? {
|
|
947
1447
|
name: "item-shortcut",
|
|
948
|
-
fn:
|
|
949
|
-
|
|
1448
|
+
fn: S((o) => [
|
|
1449
|
+
$(e.$slots, "item-shortcut", Xe(Ze(o)))
|
|
950
1450
|
]),
|
|
951
1451
|
key: "1"
|
|
952
1452
|
} : void 0,
|
|
953
1453
|
e.$slots.item ? {
|
|
954
1454
|
name: "default",
|
|
955
|
-
fn:
|
|
956
|
-
|
|
1455
|
+
fn: S((o) => [
|
|
1456
|
+
$(e.$slots, "item", Xe(Ze(o)))
|
|
957
1457
|
]),
|
|
958
1458
|
key: "2"
|
|
959
1459
|
} : void 0
|
|
960
|
-
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
1460
|
+
]), 1032, ["command", "active", "matches", "parents", "matched-text", "item-id", "loading-command-id", "onExecute", "onActivate"]))
|
|
1461
|
+
]),
|
|
1462
|
+
_: 3
|
|
1463
|
+
}, 8, ["items", "active-index"])) : be.value.length ? (u(), f(P, { key: 2 }, [
|
|
1464
|
+
(u(!0), f(P, null, q(_e.value, (t) => (u(), f(P, {
|
|
1465
|
+
key: t.group.id
|
|
965
1466
|
}, [
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
group:
|
|
969
|
-
items:
|
|
970
|
-
"active-index":
|
|
971
|
-
"global-offset":
|
|
972
|
-
"loading-command-id":
|
|
973
|
-
onExecute: l[
|
|
974
|
-
onActivate: l[
|
|
975
|
-
},
|
|
1467
|
+
t.section ? (u(), f("div", Xn)) : M("", !0),
|
|
1468
|
+
We(yt, {
|
|
1469
|
+
group: t.group,
|
|
1470
|
+
items: t.items,
|
|
1471
|
+
"active-index": T(d),
|
|
1472
|
+
"global-offset": t.offset,
|
|
1473
|
+
"loading-command-id": T(_),
|
|
1474
|
+
onExecute: l[4] || (l[4] = (o) => oe(o)),
|
|
1475
|
+
onActivate: l[5] || (l[5] = (o) => d.value = o)
|
|
1476
|
+
}, ce({ _: 2 }, [
|
|
976
1477
|
e.$slots["group-header"] ? {
|
|
977
1478
|
name: "group-header",
|
|
978
|
-
fn:
|
|
979
|
-
|
|
1479
|
+
fn: S((o) => [
|
|
1480
|
+
$(e.$slots, "group-header", D({ ref_for: !0 }, o))
|
|
980
1481
|
]),
|
|
981
1482
|
key: "0"
|
|
982
1483
|
} : void 0,
|
|
983
1484
|
e.$slots["item-icon"] ? {
|
|
984
1485
|
name: "item-icon",
|
|
985
|
-
fn:
|
|
986
|
-
|
|
1486
|
+
fn: S((o) => [
|
|
1487
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, o))
|
|
987
1488
|
]),
|
|
988
1489
|
key: "1"
|
|
989
1490
|
} : void 0,
|
|
990
1491
|
e.$slots["item-shortcut"] ? {
|
|
991
1492
|
name: "item-shortcut",
|
|
992
|
-
fn:
|
|
993
|
-
|
|
1493
|
+
fn: S((o) => [
|
|
1494
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, o))
|
|
994
1495
|
]),
|
|
995
1496
|
key: "2"
|
|
996
1497
|
} : void 0,
|
|
997
1498
|
e.$slots.item ? {
|
|
998
1499
|
name: "item",
|
|
999
|
-
fn:
|
|
1000
|
-
|
|
1500
|
+
fn: S((o) => [
|
|
1501
|
+
$(e.$slots, "item", D({ ref_for: !0 }, o))
|
|
1001
1502
|
]),
|
|
1002
1503
|
key: "3"
|
|
1003
1504
|
} : void 0
|
|
1004
1505
|
]), 1032, ["group", "items", "active-index", "global-offset", "loading-command-id"])
|
|
1005
|
-
], 64))), 128))
|
|
1506
|
+
], 64))), 128)),
|
|
1507
|
+
(u(!0), f(P, null, q(Ve.value, (t, o) => (u(), te(ke, {
|
|
1508
|
+
key: t.command.id,
|
|
1509
|
+
command: t.command,
|
|
1510
|
+
active: ct.value + o === T(d),
|
|
1511
|
+
matches: t.matches,
|
|
1512
|
+
parents: t.parents,
|
|
1513
|
+
"matched-text": t.matchedText,
|
|
1514
|
+
"item-id": `vcp-item-${t.command.id}`,
|
|
1515
|
+
"loading-command-id": T(_),
|
|
1516
|
+
onExecute: (i) => oe(t.command),
|
|
1517
|
+
onActivate: (i) => d.value = ct.value + o
|
|
1518
|
+
}, ce({ _: 2 }, [
|
|
1519
|
+
e.$slots["item-icon"] ? {
|
|
1520
|
+
name: "item-icon",
|
|
1521
|
+
fn: S((i) => [
|
|
1522
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, i))
|
|
1523
|
+
]),
|
|
1524
|
+
key: "0"
|
|
1525
|
+
} : void 0,
|
|
1526
|
+
e.$slots["item-shortcut"] ? {
|
|
1527
|
+
name: "item-shortcut",
|
|
1528
|
+
fn: S((i) => [
|
|
1529
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, i))
|
|
1530
|
+
]),
|
|
1531
|
+
key: "1"
|
|
1532
|
+
} : void 0,
|
|
1533
|
+
e.$slots.item ? {
|
|
1534
|
+
name: "default",
|
|
1535
|
+
fn: S((i) => [
|
|
1536
|
+
$(e.$slots, "item", D({ ref_for: !0 }, i))
|
|
1537
|
+
]),
|
|
1538
|
+
key: "2"
|
|
1539
|
+
} : void 0
|
|
1540
|
+
]), 1032, ["command", "active", "matches", "parents", "matched-text", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128))
|
|
1541
|
+
], 64)) : W.value ? (u(), f("div", Zn, K(n.loadingText), 1)) : T(c).trim() ? (u(), f("div", eo, [
|
|
1542
|
+
$(e.$slots, "empty", { query: T(c) }, () => [
|
|
1543
|
+
we(K(n.emptyText), 1)
|
|
1544
|
+
])
|
|
1545
|
+
])) : M("", !0) : (u(), f(P, { key: 0 }, [
|
|
1546
|
+
j.value ? (u(!0), f(P, { key: 0 }, q(j.value, (t, o) => (u(), te(ke, {
|
|
1547
|
+
key: t.id,
|
|
1548
|
+
command: t,
|
|
1549
|
+
active: o === T(d),
|
|
1550
|
+
matches: [],
|
|
1551
|
+
"item-id": `vcp-item-sub-${t.id}`,
|
|
1552
|
+
"loading-command-id": T(_),
|
|
1553
|
+
onExecute: (i) => oe(t),
|
|
1554
|
+
onActivate: (i) => d.value = o
|
|
1555
|
+
}, ce({ _: 2 }, [
|
|
1556
|
+
e.$slots["item-icon"] ? {
|
|
1557
|
+
name: "item-icon",
|
|
1558
|
+
fn: S((i) => [
|
|
1559
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, i))
|
|
1560
|
+
]),
|
|
1561
|
+
key: "0"
|
|
1562
|
+
} : void 0,
|
|
1563
|
+
e.$slots["item-shortcut"] ? {
|
|
1564
|
+
name: "item-shortcut",
|
|
1565
|
+
fn: S((i) => [
|
|
1566
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, i))
|
|
1567
|
+
]),
|
|
1568
|
+
key: "1"
|
|
1569
|
+
} : void 0,
|
|
1570
|
+
e.$slots.item ? {
|
|
1571
|
+
name: "default",
|
|
1572
|
+
fn: S((i) => [
|
|
1573
|
+
$(e.$slots, "item", D({ ref_for: !0 }, i))
|
|
1574
|
+
]),
|
|
1575
|
+
key: "2"
|
|
1576
|
+
} : void 0
|
|
1577
|
+
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128)) : (u(), f(P, { key: 1 }, [
|
|
1578
|
+
se.value.length ? (u(), f(P, { key: 0 }, [
|
|
1579
|
+
w("div", Yn, K(y.value.pinned), 1),
|
|
1580
|
+
(u(!0), f(P, null, q(se.value, (t, o) => (u(), te(ke, {
|
|
1581
|
+
key: t.id,
|
|
1582
|
+
command: t,
|
|
1583
|
+
active: o === T(d),
|
|
1584
|
+
matches: [],
|
|
1585
|
+
"item-id": `vcp-item-pinned-${t.id}`,
|
|
1586
|
+
"loading-command-id": T(_),
|
|
1587
|
+
"always-show-pin": "",
|
|
1588
|
+
onExecute: (i) => oe(t),
|
|
1589
|
+
onActivate: (i) => d.value = o
|
|
1590
|
+
}, ce({ _: 2 }, [
|
|
1591
|
+
e.$slots["item-icon"] ? {
|
|
1592
|
+
name: "item-icon",
|
|
1593
|
+
fn: S((i) => [
|
|
1594
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, i))
|
|
1595
|
+
]),
|
|
1596
|
+
key: "0"
|
|
1597
|
+
} : void 0,
|
|
1598
|
+
e.$slots["item-shortcut"] ? {
|
|
1599
|
+
name: "item-shortcut",
|
|
1600
|
+
fn: S((i) => [
|
|
1601
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, i))
|
|
1602
|
+
]),
|
|
1603
|
+
key: "1"
|
|
1604
|
+
} : void 0,
|
|
1605
|
+
e.$slots.item ? {
|
|
1606
|
+
name: "default",
|
|
1607
|
+
fn: S((i) => [
|
|
1608
|
+
$(e.$slots, "item", D({ ref_for: !0 }, i))
|
|
1609
|
+
]),
|
|
1610
|
+
key: "2"
|
|
1611
|
+
} : void 0
|
|
1612
|
+
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128)),
|
|
1613
|
+
le.value.length || V.value.length ? (u(), f("div", Vn)) : M("", !0)
|
|
1614
|
+
], 64)) : M("", !0),
|
|
1615
|
+
le.value.length ? (u(), f(P, { key: 1 }, [
|
|
1616
|
+
w("div", qn, K(y.value.recent), 1),
|
|
1617
|
+
ge.value ? (u(!0), f(P, { key: 0 }, q(ge.value, (t, o) => (u(), f(P, {
|
|
1618
|
+
key: `vcp-recsec-${o}`
|
|
1619
|
+
}, [
|
|
1620
|
+
t.label ? (u(), f("div", Fn, K(t.label), 1)) : M("", !0),
|
|
1621
|
+
(u(!0), f(P, null, q(t.commands, (i, U) => (u(), te(ke, {
|
|
1622
|
+
key: i.id,
|
|
1623
|
+
command: i,
|
|
1624
|
+
active: ve.value + t.offset + U === T(d),
|
|
1625
|
+
matches: [],
|
|
1626
|
+
"item-id": `vcp-item-recent-${i.id}`,
|
|
1627
|
+
"loading-command-id": T(_),
|
|
1628
|
+
onExecute: (Q) => oe(i),
|
|
1629
|
+
onActivate: (Q) => d.value = ve.value + t.offset + U
|
|
1630
|
+
}, ce({ _: 2 }, [
|
|
1631
|
+
e.$slots["item-icon"] ? {
|
|
1632
|
+
name: "item-icon",
|
|
1633
|
+
fn: S((Q) => [
|
|
1634
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, Q))
|
|
1635
|
+
]),
|
|
1636
|
+
key: "0"
|
|
1637
|
+
} : void 0,
|
|
1638
|
+
e.$slots["item-shortcut"] ? {
|
|
1639
|
+
name: "item-shortcut",
|
|
1640
|
+
fn: S((Q) => [
|
|
1641
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, Q))
|
|
1642
|
+
]),
|
|
1643
|
+
key: "1"
|
|
1644
|
+
} : void 0,
|
|
1645
|
+
e.$slots.item ? {
|
|
1646
|
+
name: "default",
|
|
1647
|
+
fn: S((Q) => [
|
|
1648
|
+
$(e.$slots, "item", D({ ref_for: !0 }, Q))
|
|
1649
|
+
]),
|
|
1650
|
+
key: "2"
|
|
1651
|
+
} : void 0
|
|
1652
|
+
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128))
|
|
1653
|
+
], 64))), 128)) : (u(!0), f(P, { key: 1 }, q(le.value, (t, o) => (u(), te(ke, {
|
|
1654
|
+
key: t.id,
|
|
1655
|
+
command: t,
|
|
1656
|
+
active: ve.value + o === T(d),
|
|
1657
|
+
matches: [],
|
|
1658
|
+
"item-id": `vcp-item-recent-${t.id}`,
|
|
1659
|
+
"loading-command-id": T(_),
|
|
1660
|
+
onExecute: (i) => oe(t),
|
|
1661
|
+
onActivate: (i) => d.value = ve.value + o
|
|
1662
|
+
}, ce({ _: 2 }, [
|
|
1663
|
+
e.$slots["item-icon"] ? {
|
|
1664
|
+
name: "item-icon",
|
|
1665
|
+
fn: S((i) => [
|
|
1666
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, i))
|
|
1667
|
+
]),
|
|
1668
|
+
key: "0"
|
|
1669
|
+
} : void 0,
|
|
1670
|
+
e.$slots["item-shortcut"] ? {
|
|
1671
|
+
name: "item-shortcut",
|
|
1672
|
+
fn: S((i) => [
|
|
1673
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, i))
|
|
1674
|
+
]),
|
|
1675
|
+
key: "1"
|
|
1676
|
+
} : void 0,
|
|
1677
|
+
e.$slots.item ? {
|
|
1678
|
+
name: "default",
|
|
1679
|
+
fn: S((i) => [
|
|
1680
|
+
$(e.$slots, "item", D({ ref_for: !0 }, i))
|
|
1681
|
+
]),
|
|
1682
|
+
key: "2"
|
|
1683
|
+
} : void 0
|
|
1684
|
+
]), 1032, ["command", "active", "item-id", "loading-command-id", "onExecute", "onActivate"]))), 128)),
|
|
1685
|
+
V.value.length ? (u(), f("div", Jn)) : M("", !0)
|
|
1686
|
+
], 64)) : M("", !0),
|
|
1687
|
+
(u(!0), f(P, null, q(V.value, (t, o) => (u(), f(P, {
|
|
1688
|
+
key: t.group.id
|
|
1689
|
+
}, [
|
|
1690
|
+
o > 0 ? (u(), f("div", jn)) : M("", !0),
|
|
1691
|
+
We(yt, {
|
|
1692
|
+
group: t.group,
|
|
1693
|
+
items: t.items,
|
|
1694
|
+
"active-index": T(d),
|
|
1695
|
+
"global-offset": Ae.value + ee(o),
|
|
1696
|
+
"loading-command-id": T(_),
|
|
1697
|
+
onExecute: l[2] || (l[2] = (i) => oe(i)),
|
|
1698
|
+
onActivate: l[3] || (l[3] = (i) => d.value = i)
|
|
1699
|
+
}, ce({ _: 2 }, [
|
|
1700
|
+
e.$slots["group-header"] ? {
|
|
1701
|
+
name: "group-header",
|
|
1702
|
+
fn: S((i) => [
|
|
1703
|
+
$(e.$slots, "group-header", D({ ref_for: !0 }, i))
|
|
1704
|
+
]),
|
|
1705
|
+
key: "0"
|
|
1706
|
+
} : void 0,
|
|
1707
|
+
e.$slots["item-icon"] ? {
|
|
1708
|
+
name: "item-icon",
|
|
1709
|
+
fn: S((i) => [
|
|
1710
|
+
$(e.$slots, "item-icon", D({ ref_for: !0 }, i))
|
|
1711
|
+
]),
|
|
1712
|
+
key: "1"
|
|
1713
|
+
} : void 0,
|
|
1714
|
+
e.$slots["item-shortcut"] ? {
|
|
1715
|
+
name: "item-shortcut",
|
|
1716
|
+
fn: S((i) => [
|
|
1717
|
+
$(e.$slots, "item-shortcut", D({ ref_for: !0 }, i))
|
|
1718
|
+
]),
|
|
1719
|
+
key: "2"
|
|
1720
|
+
} : void 0,
|
|
1721
|
+
e.$slots.item ? {
|
|
1722
|
+
name: "item",
|
|
1723
|
+
fn: S((i) => [
|
|
1724
|
+
$(e.$slots, "item", D({ ref_for: !0 }, i))
|
|
1725
|
+
]),
|
|
1726
|
+
key: "3"
|
|
1727
|
+
} : void 0
|
|
1728
|
+
]), 1032, ["group", "items", "active-index", "global-offset", "loading-command-id"])
|
|
1729
|
+
], 64))), 128))
|
|
1730
|
+
], 64))
|
|
1006
1731
|
], 64))
|
|
1007
|
-
],
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1732
|
+
], 8, Un), [
|
|
1733
|
+
[Yt, W.value || j.value != null || se.value.length || le.value.length || T(c).trim() || ye.value.length]
|
|
1734
|
+
]),
|
|
1735
|
+
n.preview ? (u(), f("aside", {
|
|
1736
|
+
key: 0,
|
|
1737
|
+
class: ie(["vcp-preview", { "vcp-preview--collapsed": !m.value }]),
|
|
1738
|
+
"aria-hidden": !m.value
|
|
1739
|
+
}, [
|
|
1740
|
+
w("div", no, [
|
|
1741
|
+
$(e.$slots, "preview", { command: he.value }),
|
|
1742
|
+
he.value?.info ? (u(), f("div", {
|
|
1743
|
+
key: 0,
|
|
1744
|
+
class: "vcp-preview__info",
|
|
1745
|
+
innerHTML: he.value.info
|
|
1746
|
+
}, null, 8, oo)) : M("", !0)
|
|
1747
|
+
])
|
|
1748
|
+
], 10, to)) : M("", !0)
|
|
1749
|
+
], 2),
|
|
1750
|
+
$(e.$slots, "footer"),
|
|
1751
|
+
w("div", ao, K(It.value), 1)
|
|
1012
1752
|
], 64))
|
|
1013
|
-
],
|
|
1753
|
+
], 42, kn)
|
|
1014
1754
|
], 2)) : M("", !0)
|
|
1015
1755
|
]),
|
|
1016
1756
|
_: 3
|
|
@@ -1020,16 +1760,20 @@ const Ye = ["id", "aria-selected", "aria-disabled"], Fe = {
|
|
|
1020
1760
|
}
|
|
1021
1761
|
});
|
|
1022
1762
|
export {
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1763
|
+
yt as CommandGroup,
|
|
1764
|
+
ke as CommandItem,
|
|
1765
|
+
po as CommandPalette,
|
|
1766
|
+
mo as VCommandPalettePlugin,
|
|
1767
|
+
bn as VirtualList,
|
|
1768
|
+
fo as createCommandPalette,
|
|
1769
|
+
Jt as createCommandStore,
|
|
1770
|
+
tn as createKeyboardManager,
|
|
1771
|
+
Ft as fuzzySearch,
|
|
1772
|
+
Se as getMatchRanges,
|
|
1773
|
+
nt as highlightMatches,
|
|
1774
|
+
Et as installPalette,
|
|
1775
|
+
He as resolvePaletteContext,
|
|
1776
|
+
on as useCommandPalette,
|
|
1777
|
+
vo as useRegisterCommands,
|
|
1778
|
+
ho as useRegisterGroup
|
|
1035
1779
|
};
|