Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vue-command-palette

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue-command-palette - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

854

lib/vue-command-palette.js

@@ -1,10 +0,10 @@

import { ref as $, watch as se, getCurrentScope as ut, onScopeDispose as ht, unref as O, reactive as de, computed as T, toRefs as dt, defineComponent as x, provide as ft, nextTick as te, onMounted as mt, openBlock as K, createElementBlock as Q, normalizeClass as pt, createElementVNode as V, renderSlot as z, onBeforeUnmount as Me, createBlock as Re, Teleport as gt, createVNode as _t, Transition as vt, withCtx as Ce, createCommentVNode as fe, withDirectives as Ue, toDisplayString as yt, vShow as Be, watchEffect as be, h as ce } from "vue";
var $e;
const He = typeof window < "u", Et = (s) => typeof s == "string", ie = () => {
import { ref as N, watch as ee, getCurrentScope as lt, onScopeDispose as ut, unref as R, reactive as de, computed as P, toRefs as ht, defineComponent as x, provide as dt, nextTick as Z, onMounted as ft, openBlock as F, createElementBlock as Q, normalizeClass as mt, createElementVNode as j, renderSlot as z, onBeforeUnmount as Me, createBlock as Le, Teleport as pt, createVNode as gt, Transition as _t, withCtx as Re, createCommentVNode as fe, withDirectives as Ve, toDisplayString as vt, vShow as Ue, watchEffect as be, h as ce } from "vue";
var Ce;
const Be = typeof window < "u", yt = (s) => typeof s == "string", ie = () => {
};
He && (($e = window == null ? void 0 : window.navigator) == null ? void 0 : $e.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
Be && ((Ce = window == null ? void 0 : window.navigator) == null ? void 0 : Ce.userAgent) && /iP(ad|hone|od)/.test(window.navigator.userAgent);
function me(s) {
return typeof s == "function" ? s() : O(s);
return typeof s == "function" ? s() : R(s);
}
function It(s, e) {
function Et(s, e) {
function t(...n) {

@@ -15,3 +15,3 @@ s(() => e.apply(this, n), { fn: e, thisArg: this, args: n });

}
function St(s, e = {}) {
function It(s, e = {}) {
let t, n;

@@ -29,10 +29,10 @@ return (o) => {

}
function wt(s) {
function St(s) {
return s;
}
function Mt(s) {
return ut() ? (ht(s), !0) : !1;
function wt(s) {
return lt() ? (ut(s), !0) : !1;
}
function We(s, e = 200, t = {}) {
return It(St(e, t), s);
function He(s, e = 200, t = {}) {
return Et(It(e, t), s);
}

@@ -42,13 +42,13 @@ function ue(s, e = 200, t = {}) {

return s;
const n = $(s.value), r = We(() => {
const n = N(s.value), r = He(() => {
n.value = s.value;
}, e, t);
return se(s, () => r()), n;
return ee(s, () => r()), n;
}
function ze(s, e, t) {
return se(s, (n, r, o) => {
function We(s, e, t) {
return ee(s, (n, r, o) => {
n && e(n, r, o);
}, t);
}
function bt(s) {
function Mt(s) {
var e;

@@ -58,9 +58,9 @@ const t = me(s);

}
const Qe = He ? window : void 0;
const ze = Be ? window : void 0;
function re(...s) {
let e, t, n, r;
if (Et(s[0]) ? ([t, n, r] = s, e = Qe) : [e, t, n, r] = s, !e)
if (yt(s[0]) ? ([t, n, r] = s, e = ze) : [e, t, n, r] = s, !e)
return ie;
let o = ie;
const i = se(() => bt(e), (c) => {
const i = ee(() => Mt(e), (c) => {
o(), c && (c.addEventListener(t, n, r), o = () => {

@@ -72,3 +72,3 @@ c.removeEventListener(t, n, r), o = ie;

};
return Mt(a), a;
return wt(a), a;
}

@@ -78,3 +78,3 @@ const pe = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, ge = "__vueuse_ssr_handlers__";

pe[ge];
const xt = {
const bt = {
ctrl: "control",

@@ -89,7 +89,7 @@ command: "meta",

};
function At(s = {}) {
function xt(s = {}) {
const {
reactive: e = !1,
target: t = Qe,
aliasMap: n = xt,
target: t = ze,
aliasMap: n = bt,
passive: r = !0,

@@ -100,32 +100,32 @@ onEventFired: o = ie

}, current: i }, c = e ? de(a) : a, u = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
function d(f, g) {
f in c && (e ? c[f] = g : c[f].value = g);
function f(d, g) {
d in c && (e ? c[d] = g : c[d].value = g);
}
function p() {
for (const f of h)
d(f, !1);
for (const d of h)
f(d, !1);
}
function _(f, g) {
function v(d, g) {
var I, M;
const S = (I = f.key) == null ? void 0 : I.toLowerCase(), B = [(M = f.code) == null ? void 0 : M.toLowerCase(), S].filter(Boolean);
const S = (I = d.key) == null ? void 0 : I.toLowerCase(), U = [(M = d.code) == null ? void 0 : M.toLowerCase(), S].filter(Boolean);
S && (g ? i.add(S) : i.delete(S));
for (const A of B)
h.add(A), d(A, g);
S === "meta" && !g ? (u.forEach((A) => {
i.delete(A), d(A, !1);
}), u.clear()) : typeof f.getModifierState == "function" && f.getModifierState("Meta") && g && [...i, ...B].forEach((A) => u.add(A));
for (const O of U)
h.add(O), f(O, g);
S === "meta" && !g ? (u.forEach((O) => {
i.delete(O), f(O, !1);
}), u.clear()) : typeof d.getModifierState == "function" && d.getModifierState("Meta") && g && [...i, ...U].forEach((O) => u.add(O));
}
re(t, "keydown", (f) => (_(f, !0), o(f)), { passive: r }), re(t, "keyup", (f) => (_(f, !1), o(f)), { passive: r }), re("blur", p, { passive: !0 }), re("focus", p, { passive: !0 });
re(t, "keydown", (d) => (v(d, !0), o(d)), { passive: r }), re(t, "keyup", (d) => (v(d, !1), o(d)), { passive: r }), re("blur", p, { passive: !0 }), re("focus", p, { passive: !0 });
const y = new Proxy(c, {
get(f, g, I) {
get(d, g, I) {
if (typeof g != "string")
return Reflect.get(f, g, I);
return Reflect.get(d, g, I);
if (g = g.toLowerCase(), g in n && (g = n[g]), !(g in c))
if (/[+_-]/.test(g)) {
const S = g.split(/[+_-]/g).map((C) => C.trim());
c[g] = T(() => S.every((C) => O(y[C])));
const S = g.split(/[+_-]/g).map(($) => $.trim());
c[g] = P(() => S.every(($) => R(y[$])));
} else
c[g] = $(!1);
const M = Reflect.get(f, g, I);
return e ? O(M) : M;
c[g] = N(!1);
const M = Reflect.get(d, g, I);
return e ? R(M) : M;
}

@@ -135,15 +135,15 @@ });

}
var Te;
var $e;
(function(s) {
s.UP = "UP", s.RIGHT = "RIGHT", s.DOWN = "DOWN", s.LEFT = "LEFT", s.NONE = "NONE";
})(Te || (Te = {}));
var kt = Object.defineProperty, Ne = Object.getOwnPropertySymbols, Lt = Object.prototype.hasOwnProperty, Ot = Object.prototype.propertyIsEnumerable, Pe = (s, e, t) => e in s ? kt(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Rt = (s, e) => {
})($e || ($e = {}));
var At = Object.defineProperty, Te = Object.getOwnPropertySymbols, kt = Object.prototype.hasOwnProperty, Ot = Object.prototype.propertyIsEnumerable, Ne = (s, e, t) => e in s ? At(s, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[e] = t, Lt = (s, e) => {
for (var t in e || (e = {}))
Lt.call(e, t) && Pe(s, t, e[t]);
if (Ne)
for (var t of Ne(e))
Ot.call(e, t) && Pe(s, t, e[t]);
kt.call(e, t) && Ne(s, t, e[t]);
if (Te)
for (var t of Te(e))
Ot.call(e, t) && Ne(s, t, e[t]);
return s;
};
const Ct = {
const Rt = {
easeInSine: [0.12, 0, 0.39, 0],

@@ -174,17 +174,17 @@ easeOutSine: [0.61, 1, 0.88, 1],

};
Rt({
linear: wt
}, Ct);
function G(s) {
return Array.isArray ? Array.isArray(s) : Xe(s) === "[object Array]";
Lt({
linear: St
}, Rt);
function K(s) {
return Array.isArray ? Array.isArray(s) : Je(s) === "[object Array]";
}
const $t = 1 / 0;
function Tt(s) {
const Ct = 1 / 0;
function $t(s) {
if (typeof s == "string")
return s;
let e = s + "";
return e == "0" && 1 / s == -$t ? "-0" : e;
return e == "0" && 1 / s == -Ct ? "-0" : e;
}
function Nt(s) {
return s == null ? "" : Tt(s);
function Tt(s) {
return s == null ? "" : $t(s);
}

@@ -194,15 +194,15 @@ function D(s) {

}
function Ye(s) {
function Qe(s) {
return typeof s == "number";
}
function Pt(s) {
return s === !0 || s === !1 || Dt(s) && Xe(s) == "[object Boolean]";
function Nt(s) {
return s === !0 || s === !1 || Pt(s) && Je(s) == "[object Boolean]";
}
function Je(s) {
function Ye(s) {
return typeof s == "object";
}
function Dt(s) {
return Je(s) && s !== null;
function Pt(s) {
return Ye(s) && s !== null;
}
function R(s) {
function C(s) {
return s != null;

@@ -213,7 +213,7 @@ }

}
function Xe(s) {
function Je(s) {
return s == null ? s === void 0 ? "[object Undefined]" : "[object Null]" : Object.prototype.toString.call(s);
}
const Ft = "Incorrect 'index' type", Kt = (s) => `Invalid value for key ${s}`, Gt = (s) => `Pattern length exceeds max of ${s}.`, jt = (s) => `Missing ${s} property in key`, Vt = (s) => `Property 'weight' in key '${s}' must be a positive integer`, De = Object.prototype.hasOwnProperty;
class Ut {
const Dt = "Incorrect 'index' type", Ft = (s) => `Invalid value for key ${s}`, Kt = (s) => `Pattern length exceeds max of ${s}.`, Gt = (s) => `Missing ${s} property in key`, jt = (s) => `Property 'weight' in key '${s}' must be a positive integer`, Pe = Object.prototype.hasOwnProperty;
class Vt {
constructor(e) {

@@ -223,3 +223,3 @@ this._keys = [], this._keyMap = {};

e.forEach((n) => {
let r = qe(n);
let r = Xe(n);
t += r.weight, this._keys.push(r), this._keyMap[r.id] = r, t += r.weight;

@@ -240,26 +240,26 @@ }), this._keys.forEach((n) => {

}
function qe(s) {
function Xe(s) {
let e = null, t = null, n = null, r = 1, o = null;
if (D(s) || G(s))
n = s, e = Fe(s), t = _e(s);
if (D(s) || K(s))
n = s, e = De(s), t = _e(s);
else {
if (!De.call(s, "name"))
throw new Error(jt("name"));
if (!Pe.call(s, "name"))
throw new Error(Gt("name"));
const i = s.name;
if (n = i, De.call(s, "weight") && (r = s.weight, r <= 0))
throw new Error(Vt(i));
e = Fe(i), t = _e(i), o = s.getFn;
if (n = i, Pe.call(s, "weight") && (r = s.weight, r <= 0))
throw new Error(jt(i));
e = De(i), t = _e(i), o = s.getFn;
}
return { path: e, id: t, weight: r, src: n, getFn: o };
}
function Fe(s) {
return G(s) ? s : s.split(".");
function De(s) {
return K(s) ? s : s.split(".");
}
function _e(s) {
return G(s) ? s.join(".") : s;
return K(s) ? s.join(".") : s;
}
function Bt(s, e) {
function Ut(s, e) {
let t = [], n = !1;
const r = (o, i, a) => {
if (!!R(o))
if (!!C(o))
if (!i[a])

@@ -270,9 +270,9 @@ t.push(o);

const u = o[c];
if (!R(u))
if (!C(u))
return;
if (a === i.length - 1 && (D(u) || Ye(u) || Pt(u)))
t.push(Nt(u));
else if (G(u)) {
if (a === i.length - 1 && (D(u) || Qe(u) || Nt(u)))
t.push(Tt(u));
else if (K(u)) {
n = !0;
for (let h = 0, d = u.length; h < d; h += 1)
for (let h = 0, f = u.length; h < f; h += 1)
r(u[h], i, a + 1);

@@ -285,7 +285,7 @@ } else

}
const Ht = {
const Bt = {
includeMatches: !1,
findAllMatches: !1,
minMatchCharLength: 1
}, Wt = {
}, Ht = {
isCaseSensitive: !1,

@@ -296,9 +296,9 @@ includeScore: !1,

sortFn: (s, e) => s.score === e.score ? s.idx < e.idx ? -1 : 1 : s.score < e.score ? -1 : 1
}, zt = {
}, Wt = {
location: 0,
threshold: 0.6,
distance: 100
}, Qt = {
}, zt = {
useExtendedSearch: !1,
getFn: Bt,
getFn: Ut,
ignoreLocation: !1,

@@ -309,13 +309,13 @@ ignoreFieldNorm: !1,

var m = {
...Ht,
...Bt,
...Wt,
...Ht,
...zt,
...Qt
...zt
};
const Yt = /[^ ]+/g;
function Jt(s = 1, e = 3) {
const Qt = /[^ ]+/g;
function Yt(s = 1, e = 3) {
const t = /* @__PURE__ */ new Map(), n = Math.pow(10, e);
return {
get(r) {
const o = r.match(Yt).length;
const o = r.match(Qt).length;
if (t.has(o))

@@ -336,3 +336,3 @@ return t.get(o);

} = {}) {
this.norm = Jt(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
this.norm = Yt(t, 3), this.getFn = e, this.isCreated = !1, this.setIndexRecords();
}

@@ -373,3 +373,3 @@ setSources(e = []) {

_addString(e, t) {
if (!R(e) || he(e))
if (!C(e) || he(e))
return;

@@ -387,4 +387,4 @@ let n = {

let i = r.getFn ? r.getFn(e) : this.getFn(e, r.path);
if (!!R(i)) {
if (G(i)) {
if (!!C(i)) {
if (K(i)) {
let a = [];

@@ -394,5 +394,5 @@ const c = [{ nestedArrIndex: -1, value: i }];

const { nestedArrIndex: u, value: h } = c.pop();
if (!!R(h))
if (!!C(h))
if (D(h) && !he(h)) {
let d = {
let f = {
v: h,

@@ -402,8 +402,8 @@ i: u,

};
a.push(d);
a.push(f);
} else
G(h) && h.forEach((d, p) => {
K(h) && h.forEach((f, p) => {
c.push({
nestedArrIndex: p,
value: d
value: f
});

@@ -430,7 +430,7 @@ });

}
function Ze(s, e, { getFn: t = m.getFn, fieldNormWeight: n = m.fieldNormWeight } = {}) {
function qe(s, e, { getFn: t = m.getFn, fieldNormWeight: n = m.fieldNormWeight } = {}) {
const r = new xe({ getFn: t, fieldNormWeight: n });
return r.setKeys(s.map(qe)), r.setSources(e), r.create(), r;
return r.setKeys(s.map(Xe)), r.setSources(e), r.create(), r;
}
function Xt(s, { getFn: e = m.getFn, fieldNormWeight: t = m.fieldNormWeight } = {}) {
function Jt(s, { getFn: e = m.getFn, fieldNormWeight: t = m.fieldNormWeight } = {}) {
const { keys: n, records: r } = s, o = new xe({ getFn: e, fieldNormWeight: t });

@@ -452,3 +452,3 @@ return o.setKeys(n), o.setIndexRecords(r), o;

}
function qt(s = [], e = m.minMatchCharLength) {
function Xt(s = [], e = m.minMatchCharLength) {
let t = [], n = -1, r = -1, o = 0;

@@ -462,3 +462,3 @@ for (let i = s.length; o < i; o += 1) {

const W = 32;
function Zt(s, e, t, {
function qt(s, e, t, {
location: n = m.location,

@@ -473,9 +473,9 @@ distance: r = m.distance,

if (e.length > W)
throw new Error(Gt(W));
const h = e.length, d = s.length, p = Math.max(0, Math.min(n, d));
let _ = o, y = p;
const f = a > 1 || c, g = f ? Array(d) : [];
throw new Error(Kt(W));
const h = e.length, f = s.length, p = Math.max(0, Math.min(n, f));
let v = o, y = p;
const d = a > 1 || c, g = d ? Array(f) : [];
let I;
for (; (I = s.indexOf(e, y)) > -1; ) {
let k = oe(e, {
let A = oe(e, {
currentLocation: I,

@@ -486,28 +486,28 @@ expectedLocation: p,

});
if (_ = Math.min(k, _), y = I + h, f) {
let N = 0;
for (; N < h; )
g[I + N] = 1, N += 1;
if (v = Math.min(A, v), y = I + h, d) {
let L = 0;
for (; L < h; )
g[I + L] = 1, L += 1;
}
}
y = -1;
let M = [], S = 1, C = h + d;
const B = 1 << h - 1;
for (let k = 0; k < h; k += 1) {
let N = 0, L = C;
for (; N < L; )
let M = [], S = 1, $ = h + f;
const U = 1 << h - 1;
for (let A = 0; A < h; A += 1) {
let L = 0, b = $;
for (; L < b; )
oe(e, {
errors: k,
currentLocation: p + L,
errors: A,
currentLocation: p + b,
expectedLocation: p,
distance: r,
ignoreLocation: u
}) <= _ ? N = L : C = L, L = Math.floor((C - N) / 2 + N);
C = L;
let F = Math.max(1, p - L + 1), q = i ? d : Math.min(p + L, d) + h, P = Array(q + 2);
P[q + 1] = (1 << k) - 1;
for (let b = q; b >= F; b -= 1) {
let H = b - 1, ee = t[s.charAt(H)];
if (f && (g[H] = +!!ee), P[b] = (P[b + 1] << 1 | 1) & ee, k && (P[b] |= (M[b + 1] | M[b]) << 1 | 1 | M[b + 1]), P[b] & B && (S = oe(e, {
errors: k,
}) <= v ? L = b : $ = b, b = Math.floor(($ - L) / 2 + L);
$ = b;
let te = Math.max(1, p - b + 1), B = i ? f : Math.min(p + b, f) + h, T = Array(B + 2);
T[B + 1] = (1 << A) - 1;
for (let k = B; k >= te; k -= 1) {
let H = k - 1, q = t[s.charAt(H)];
if (d && (g[H] = +!!q), T[k] = (T[k + 1] << 1 | 1) & q, A && (T[k] |= (M[k + 1] | M[k]) << 1 | 1 | M[k + 1]), T[k] & U && (S = oe(e, {
errors: A,
currentLocation: H,

@@ -517,10 +517,10 @@ expectedLocation: p,

ignoreLocation: u
}), S <= _)) {
if (_ = S, y = H, y <= p)
}), S <= v)) {
if (v = S, y = H, y <= p)
break;
F = Math.max(1, 2 * p - y);
te = Math.max(1, 2 * p - y);
}
}
if (oe(e, {
errors: k + 1,
errors: A + 1,
currentLocation: p,

@@ -530,17 +530,17 @@ expectedLocation: p,

ignoreLocation: u
}) > _)
}) > v)
break;
M = P;
M = T;
}
const A = {
const O = {
isMatch: y >= 0,
score: Math.max(1e-3, S)
};
if (f) {
const k = qt(g, a);
k.length ? c && (A.indices = k) : A.isMatch = !1;
if (d) {
const A = Xt(g, a);
A.length ? c && (O.indices = A) : O.isMatch = !1;
}
return A;
return O;
}
function es(s) {
function Zt(s) {
let e = {};

@@ -553,3 +553,3 @@ for (let t = 0, n = s.length; t < n; t += 1) {

}
class et {
class Ze {
constructor(e, {

@@ -576,17 +576,17 @@ location: t = m.location,

return;
const h = (p, _) => {
const h = (p, v) => {
this.chunks.push({
pattern: p,
alphabet: es(p),
startIndex: _
alphabet: Zt(p),
startIndex: v
});
}, d = this.pattern.length;
if (d > W) {
}, f = this.pattern.length;
if (f > W) {
let p = 0;
const _ = d % W, y = d - _;
const v = f % W, y = f - v;
for (; p < y; )
h(this.pattern.substr(p, W), p), p += W;
if (_) {
const f = d - W;
h(this.pattern.substr(f), f);
if (v) {
const d = f - W;
h(this.pattern.substr(d), d);
}

@@ -613,5 +613,5 @@ } else

} = this.options;
let h = [], d = 0, p = !1;
this.chunks.forEach(({ pattern: y, alphabet: f, startIndex: g }) => {
const { isMatch: I, score: M, indices: S } = Zt(e, y, f, {
let h = [], f = 0, p = !1;
this.chunks.forEach(({ pattern: y, alphabet: d, startIndex: g }) => {
const { isMatch: I, score: M, indices: S } = qt(e, y, d, {
location: r + g,

@@ -625,12 +625,12 @@ distance: o,

});
I && (p = !0), d += M, I && S && (h = [...h, ...S]);
I && (p = !0), f += M, I && S && (h = [...h, ...S]);
});
let _ = {
let v = {
isMatch: p,
score: p ? d / this.chunks.length : 1
score: p ? f / this.chunks.length : 1
};
return p && n && (_.indices = h), _;
return p && n && (v.indices = h), v;
}
}
class U {
class V {
constructor(e) {

@@ -640,6 +640,6 @@ this.pattern = e;

static isMultiMatch(e) {
return Ke(e, this.multiRegex);
return Fe(e, this.multiRegex);
}
static isSingleMatch(e) {
return Ke(e, this.singleRegex);
return Fe(e, this.singleRegex);
}

@@ -649,7 +649,7 @@ search() {

}
function Ke(s, e) {
function Fe(s, e) {
const t = s.match(e);
return t ? t[1] : null;
}
class ts extends U {
class es extends V {
constructor(e) {

@@ -676,3 +676,3 @@ super(e);

}
class ss extends U {
class ts extends V {
constructor(e) {

@@ -699,3 +699,3 @@ super(e);

}
class ns extends U {
class ss extends V {
constructor(e) {

@@ -722,3 +722,3 @@ super(e);

}
class rs extends U {
class ns extends V {
constructor(e) {

@@ -745,3 +745,3 @@ super(e);

}
class os extends U {
class rs extends V {
constructor(e) {

@@ -768,3 +768,3 @@ super(e);

}
class is extends U {
class os extends V {
constructor(e) {

@@ -791,3 +791,3 @@ super(e);

}
class tt extends U {
class et extends V {
constructor(e, {

@@ -803,3 +803,3 @@ location: t = m.location,

} = {}) {
super(e), this._bitapSearch = new et(e, {
super(e), this._bitapSearch = new Ze(e, {
location: t,

@@ -828,3 +828,3 @@ threshold: n,

}
class st extends U {
class tt extends V {
constructor(e) {

@@ -856,28 +856,28 @@ super(e);

const ve = [
ts,
st,
es,
tt,
ss,
ns,
os,
rs,
is,
os,
ss,
tt
], Ge = ve.length, cs = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, as = "|";
function ls(s, e = {}) {
return s.split(as).map((t) => {
let n = t.trim().split(cs).filter((o) => o && !!o.trim()), r = [];
ts,
et
], Ke = ve.length, is = / +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/, cs = "|";
function as(s, e = {}) {
return s.split(cs).map((t) => {
let n = t.trim().split(is).filter((o) => o && !!o.trim()), r = [];
for (let o = 0, i = n.length; o < i; o += 1) {
const a = n[o];
let c = !1, u = -1;
for (; !c && ++u < Ge; ) {
for (; !c && ++u < Ke; ) {
const h = ve[u];
let d = h.isMultiMatch(a);
d && (r.push(new h(d, e)), c = !0);
let f = h.isMultiMatch(a);
f && (r.push(new h(f, e)), c = !0);
}
if (!c)
for (u = -1; ++u < Ge; ) {
for (u = -1; ++u < Ke; ) {
const h = ve[u];
let d = h.isSingleMatch(a);
if (d) {
r.push(new h(d, e));
let f = h.isSingleMatch(a);
if (f) {
r.push(new h(f, e));
break;

@@ -890,4 +890,4 @@ }

}
const us = /* @__PURE__ */ new Set([tt.type, st.type]);
class hs {
const ls = /* @__PURE__ */ new Set([et.type, tt.type]);
class us {
constructor(e, {

@@ -912,3 +912,3 @@ isCaseSensitive: t = m.isCaseSensitive,

distance: u
}, this.pattern = t ? e : e.toLowerCase(), this.query = ls(this.pattern, this.options);
}, this.pattern = t ? e : e.toLowerCase(), this.query = as(this.pattern, this.options);
}

@@ -931,8 +931,8 @@ static condition(e, t) {

i.length = 0, o = 0;
for (let d = 0, p = h.length; d < p; d += 1) {
const _ = h[d], { isMatch: y, indices: f, score: g } = _.search(e);
for (let f = 0, p = h.length; f < p; f += 1) {
const v = h[f], { isMatch: y, indices: d, score: g } = v.search(e);
if (y) {
if (o += 1, a += g, n) {
const I = _.constructor.type;
us.has(I) ? i = [...i, ...f] : i.push(f);
const I = v.constructor.type;
ls.has(I) ? i = [...i, ...d] : i.push(d);
}

@@ -945,7 +945,7 @@ } else {

if (o) {
let d = {
let f = {
isMatch: !0,
score: a / o
};
return n && (d.indices = i), d;
return n && (f.indices = i), f;
}

@@ -960,3 +960,3 @@ }

const ye = [];
function ds(...s) {
function hs(...s) {
ye.push(...s);

@@ -970,3 +970,3 @@ }

}
return new et(s, e);
return new Ze(s, e);
}

@@ -979,3 +979,3 @@ const ae = {

PATTERN: "$val"
}, Se = (s) => !!(s[ae.AND] || s[ae.OR]), fs = (s) => !!s[Ie.PATH], ms = (s) => !G(s) && Je(s) && !Se(s), je = (s) => ({
}, Se = (s) => !!(s[ae.AND] || s[ae.OR]), ds = (s) => !!s[Ie.PATH], fs = (s) => !K(s) && Ye(s) && !Se(s), Ge = (s) => ({
[ae.AND]: Object.keys(s).map((e) => ({

@@ -985,12 +985,12 @@ [e]: s[e]

});
function nt(s, e, { auto: t = !0 } = {}) {
function st(s, e, { auto: t = !0 } = {}) {
const n = (r) => {
let o = Object.keys(r);
const i = fs(r);
const i = ds(r);
if (!i && o.length > 1 && !Se(r))
return n(je(r));
if (ms(r)) {
return n(Ge(r));
if (fs(r)) {
const c = i ? r[Ie.PATH] : o[0], u = i ? r[Ie.PATTERN] : r[c];
if (!D(u))
throw new Error(Kt(c));
throw new Error(Ft(c));
const h = {

@@ -1008,3 +1008,3 @@ keyId: _e(c),

const u = r[c];
G(u) && u.forEach((h) => {
K(u) && u.forEach((h) => {
a.children.push(n(h));

@@ -1014,5 +1014,5 @@ });

};
return Se(s) || (s = je(s)), n(s);
return Se(s) || (s = Ge(s)), n(s);
}
function ps(s, { ignoreFieldNorm: e = m.ignoreFieldNorm }) {
function ms(s, { ignoreFieldNorm: e = m.ignoreFieldNorm }) {
s.forEach((t) => {

@@ -1029,6 +1029,6 @@ let n = 1;

}
function gs(s, e) {
function ps(s, e) {
const t = s.matches;
e.matches = [], R(t) && t.forEach((n) => {
if (!R(n.indices) || !n.indices.length)
e.matches = [], C(t) && t.forEach((n) => {
if (!C(n.indices) || !n.indices.length)
return;

@@ -1043,6 +1043,6 @@ const { indices: r, value: o } = n;

}
function _s(s, e) {
function gs(s, e) {
e.score = s.score;
}
function vs(s, e, {
function _s(s, e, {
includeMatches: t = m.includeMatches,

@@ -1052,3 +1052,3 @@ includeScore: n = m.includeScore

const r = [];
return t && r.push(gs), n && r.push(_s), s.map((o) => {
return t && r.push(ps), n && r.push(gs), s.map((o) => {
const { idx: i } = o, a = {

@@ -1065,8 +1065,8 @@ item: e[i],

constructor(e, t = {}, n) {
this.options = { ...m, ...t }, this.options.useExtendedSearch, this._keyStore = new Ut(this.options.keys), this.setCollection(e, n);
this.options = { ...m, ...t }, this.options.useExtendedSearch, this._keyStore = new Vt(this.options.keys), this.setCollection(e, n);
}
setCollection(e, t) {
if (this._docs = e, t && !(t instanceof xe))
throw new Error(Ft);
this._myIndex = t || Ze(this.options.keys, this._docs, {
throw new Error(Dt);
this._myIndex = t || qe(this.options.keys, this._docs, {
getFn: this.options.getFn,

@@ -1077,3 +1077,3 @@ fieldNormWeight: this.options.fieldNormWeight

add(e) {
!R(e) || (this._docs.push(e), this._myIndex.add(e));
!C(e) || (this._docs.push(e), this._myIndex.add(e));
}

@@ -1103,3 +1103,3 @@ remove(e = () => !1) {

let c = D(e) ? D(this._docs[0]) ? this._searchStringList(e) : this._searchObjectList(e) : this._searchLogical(e);
return ps(c, { ignoreFieldNorm: a }), o && c.sort(i), Ye(t) && t > -1 && (c = c.slice(0, t)), vs(c, this._docs, {
return ms(c, { ignoreFieldNorm: a }), o && c.sort(i), Qe(t) && t > -1 && (c = c.slice(0, t)), _s(c, this._docs, {
includeMatches: n,

@@ -1112,3 +1112,3 @@ includeScore: r

return n.forEach(({ v: o, i, n: a }) => {
if (!R(o))
if (!C(o))
return;

@@ -1124,14 +1124,14 @@ const { isMatch: c, score: u, indices: h } = t.searchIn(o);

_searchLogical(e) {
const t = nt(e, this.options), n = (a, c, u) => {
const t = st(e, this.options), n = (a, c, u) => {
if (!a.children) {
const { keyId: d, searcher: p } = a, _ = this._findMatches({
key: this._keyStore.get(d),
value: this._myIndex.getValueForItemAtKeyId(c, d),
const { keyId: f, searcher: p } = a, v = this._findMatches({
key: this._keyStore.get(f),
value: this._myIndex.getValueForItemAtKeyId(c, f),
searcher: p
});
return _ && _.length ? [
return v && v.length ? [
{
idx: u,
item: c,
matches: _
matches: v
}

@@ -1141,4 +1141,4 @@ ] : [];

const h = [];
for (let d = 0, p = a.children.length; d < p; d += 1) {
const _ = a.children[d], y = n(_, c, u);
for (let f = 0, p = a.children.length; f < p; f += 1) {
const v = a.children[f], y = n(v, c, u);
if (y.length)

@@ -1152,3 +1152,3 @@ h.push(...y);

return r.forEach(({ $: a, i: c }) => {
if (R(a)) {
if (C(a)) {
let u = n(t, a, c);

@@ -1164,3 +1164,3 @@ u.length && (o[c] || (o[c] = { idx: c, item: a, matches: [] }, i.push(o[c])), u.forEach(({ matches: h }) => {

return r.forEach(({ $: i, i: a }) => {
if (!R(i))
if (!C(i))
return;

@@ -1184,8 +1184,8 @@ let c = [];

_findMatches({ key: e, value: t, searcher: n }) {
if (!R(t))
if (!C(t))
return [];
let r = [];
if (G(t))
if (K(t))
t.forEach(({ v: o, i, n: a }) => {
if (!R(o))
if (!C(o))
return;

@@ -1210,8 +1210,8 @@ const { isMatch: c, score: u, indices: h } = n.searchIn(o);

Y.version = "6.6.2";
Y.createIndex = Ze;
Y.parseIndex = Xt;
Y.createIndex = qe;
Y.parseIndex = Jt;
Y.config = m;
Y.parseQuery = nt;
ds(hs);
const Ve = de({
Y.parseQuery = st;
hs(us);
const je = de({
selectedNode: "",

@@ -1227,6 +1227,6 @@ selectedGroup: "",

}), J = () => ({
isSearching: T(() => Ve.search !== ""),
...dt(Ve)
isSearching: P(() => je.search !== ""),
...ht(je)
});
function ys(s) {
function vs(s) {
return { all: s = s || /* @__PURE__ */ new Map(), on: function(e, t) {

@@ -1247,6 +1247,6 @@ var n = s.get(e);

}
const Es = ys(), le = () => ({
emitter: Es
const ys = vs(), le = () => ({
emitter: ys
});
function Is(s, e) {
function Es(s, e) {
let t = s.nextElementSibling;

@@ -1259,3 +1259,3 @@ for (; t; ) {

}
function Ss(s, e) {
function Is(s, e) {
let t = s.previousElementSibling;

@@ -1268,6 +1268,6 @@ for (; t; ) {

}
const ws = ["command-theme"], Ms = { "command-root": "" }, bs = x({
const Ss = ["command-theme"], ws = { "command-root": "" }, Ms = x({
name: "Command"
}), xs = /* @__PURE__ */ x({
...bs,
}), bs = /* @__PURE__ */ x({
...Ms,
props: {

@@ -1277,2 +1277,9 @@ theme: {

default: "default"
},
fuseOptions: {
type: Object,
default: () => ({
threshold: 0.2,
keys: ["label"]
})
}

@@ -1282,26 +1289,23 @@ },

setup(s, { emit: e }) {
const t = s, n = '[command-item=""]', r = "command-item-key", o = '[command-group=""]', i = "command-group-key", a = '[command-group-heading=""]', c = `${n}:not([aria-disabled="true"])`, u = `${n}[aria-selected="true"]`, h = "command-item-select", d = "data-value", p = {
threshold: 0.2,
keys: ["label"]
};
ft("theme", t.theme || "default");
const { selectedNode: _, search: y, dataValue: f, filtered: g } = J(), { emitter: I } = le(), M = $(), S = ue($(/* @__PURE__ */ new Map()), 333), C = ue($(/* @__PURE__ */ new Set()), 333), B = ue($(/* @__PURE__ */ new Map())), A = T(() => {
const t = s, n = '[command-item=""]', r = "command-item-key", o = '[command-group=""]', i = "command-group-key", a = '[command-group-heading=""]', c = `${n}:not([aria-disabled="true"])`, u = `${n}[aria-selected="true"]`, h = "command-item-select", f = "data-value";
dt("theme", t.theme || "default");
const { selectedNode: p, search: v, dataValue: y, filtered: d } = J(), { emitter: g } = le(), I = N(), M = ue(N(/* @__PURE__ */ new Map()), 333), S = ue(N(/* @__PURE__ */ new Set()), 333), $ = ue(N(/* @__PURE__ */ new Map())), U = P(() => {
const l = [];
for (const [E, v] of S.value.entries())
for (const [E, _] of M.value.entries())
l.push({
key: E,
label: v
label: _
});
return l;
}), k = T(() => {
const l = Y.createIndex(p.keys, A.value);
return new Y(A.value, p, l);
}), N = () => {
var E, v, w;
}), O = P(() => {
const l = Y.createIndex(t.fuseOptions.keys, U.value);
return new Y(U.value, t.fuseOptions, l);
}), A = () => {
var E, _, w;
const l = L();
l && (((E = l.parentElement) == null ? void 0 : E.firstElementChild) === l && ((w = (v = l.closest(o)) == null ? void 0 : v.querySelector(a)) == null || w.scrollIntoView({ block: "nearest" })), l.scrollIntoView({ block: "nearest" }));
l && (((E = l.parentElement) == null ? void 0 : E.firstElementChild) === l && ((w = (_ = l.closest(o)) == null ? void 0 : _.querySelector(a)) == null || w.scrollIntoView({ block: "nearest" })), l.scrollIntoView({ block: "nearest" }));
}, L = () => {
var l;
return (l = M.value) == null ? void 0 : l.querySelector(u);
}, F = (l = M.value) => {
return (l = I.value) == null ? void 0 : l.querySelector(u);
}, b = (l = I.value) => {
const E = l == null ? void 0 : l.querySelectorAll(

@@ -1311,36 +1315,36 @@ c

return E ? Array.from(E) : [];
}, q = () => {
}, te = () => {
var E;
const l = (E = M.value) == null ? void 0 : E.querySelectorAll(
const l = (E = I.value) == null ? void 0 : E.querySelectorAll(
o
);
return l ? Array.from(l) : [];
}, P = () => {
const [l] = F();
l && l.getAttribute(r) && (_.value = l.getAttribute(r) || "");
}, Z = (l) => {
const v = F()[l];
v && (_.value = v.getAttribute(r) || "");
}, b = (l) => {
const E = L(), v = F(), w = v.findIndex((ne) => ne === E), j = v[w + l];
j ? _.value = j.getAttribute(r) || "" : l > 0 ? Z(0) : Z(v.length - 1);
}, H = (l) => {
}, B = () => {
const [l] = b();
l && l.getAttribute(r) && (p.value = l.getAttribute(r) || "");
}, T = (l) => {
const _ = b()[l];
_ && (p.value = _.getAttribute(r) || "");
}, se = (l) => {
const E = L(), _ = b(), w = _.findIndex((ne) => ne === E), G = _[w + l];
G ? p.value = G.getAttribute(r) || "" : l > 0 ? T(0) : T(_.length - 1);
}, k = (l) => {
const E = L();
let v = E == null ? void 0 : E.closest(o), w = null;
for (; v && !w; )
v = l > 0 ? Is(v, o) : Ss(v, o), w = v == null ? void 0 : v.querySelector(c);
w ? _.value = w.getAttribute(r) || "" : b(l);
}, ee = () => Z(0), Ae = () => Z(F().length - 1), ke = (l) => {
l.preventDefault(), l.metaKey ? Ae() : l.altKey ? H(1) : b(1);
}, Le = (l) => {
l.preventDefault(), l.metaKey ? ee() : l.altKey ? H(-1) : b(-1);
}, ot = (l) => {
let _ = E == null ? void 0 : E.closest(o), w = null;
for (; _ && !w; )
_ = l > 0 ? Es(_, o) : Is(_, o), w = _ == null ? void 0 : _.querySelector(c);
w ? p.value = w.getAttribute(r) || "" : se(l);
}, H = () => T(0), q = () => T(b().length - 1), Ae = (l) => {
l.preventDefault(), l.metaKey ? q() : l.altKey ? k(1) : se(1);
}, ke = (l) => {
l.preventDefault(), l.metaKey ? H() : l.altKey ? k(-1) : se(-1);
}, rt = (l) => {
switch (l.key) {
case "n":
case "j": {
l.ctrlKey && ke(l);
l.ctrlKey && Ae(l);
break;
}
case "ArrowDown": {
ke(l);
Ae(l);
break;

@@ -1350,15 +1354,15 @@ }

case "k": {
l.ctrlKey && Le(l);
l.ctrlKey && ke(l);
break;
}
case "ArrowUp": {
Le(l);
ke(l);
break;
}
case "Home": {
ee();
H();
break;
}
case "End": {
Ae();
q();
break;

@@ -1369,67 +1373,67 @@ }

if (E) {
const v = new Event(h);
E.dispatchEvent(v);
const _ = new Event(h);
E.dispatchEvent(_);
}
}
}
}, it = () => {
if (!y.value) {
g.value.count = C.value.size;
}, ot = () => {
if (!v.value) {
d.value.count = S.value.size;
return;
}
g.value.groups = new Set("");
const l = /* @__PURE__ */ new Map(), E = k.value.search(y.value).map((v) => v.item);
for (const { key: v, label: w } of E)
l.set(v, w);
for (const [v, w] of B.value)
for (const j of w)
l.get(j) && g.value.groups.add(v);
te(() => {
g.value.count = l.size, g.value.items = l;
d.value.groups = new Set("");
const l = /* @__PURE__ */ new Map(), E = O.value.search(v.value).map((_) => _.item);
for (const { key: _, label: w } of E)
l.set(_, w);
for (const [_, w] of $.value)
for (const G of w)
l.get(G) && d.value.groups.add(_);
Z(() => {
d.value.count = l.size, d.value.items = l;
});
}, Oe = () => {
const l = F(), E = q();
for (const v of l) {
const w = v.getAttribute(r) || "", j = v.getAttribute(d) || "";
C.value.add(w), S.value.set(w, j), g.value.count = S.value.size;
const l = b(), E = te();
for (const _ of l) {
const w = _.getAttribute(r) || "", G = _.getAttribute(f) || "";
S.value.add(w), M.value.set(w, G), d.value.count = M.value.size;
}
for (const v of E) {
const w = F(v), j = v.getAttribute(i) || "", ne = new Set("");
for (const at of w) {
const lt = at.getAttribute(r) || "";
ne.add(lt);
for (const _ of E) {
const w = b(_), G = _.getAttribute(i) || "", ne = new Set("");
for (const ct of w) {
const at = ct.getAttribute(r) || "";
ne.add(at);
}
B.value.set(j, ne);
$.value.set(G, ne);
}
};
se(
() => _.value,
ee(
() => p.value,
(l) => {
l && te(N);
l && Z(A);
},
{ deep: !0 }
), se(
() => y.value,
), ee(
() => v.value,
(l) => {
it(), te(P);
ot(), Z(B);
}
), I.on("selectItem", (l) => {
), g.on("selectItem", (l) => {
e("select-item", l);
});
const ct = We((l) => {
l && (Oe(), te(P));
const it = He((l) => {
l && (Oe(), Z(B));
}, 100);
return I.on("rerenderList", ct), mt(() => {
Oe(), P();
}), (l, E) => (K(), Q("div", {
class: pt(s.theme),
onKeydown: ot,
return g.on("rerenderList", it), ft(() => {
Oe(), B();
}), (l, E) => (F(), Q("div", {
class: mt(s.theme),
onKeydown: rt,
ref_key: "commandRef",
ref: M,
ref: I,
"command-theme": s.theme
}, [
V("div", Ms, [
j("div", ws, [
z(l.$slots, "default")
])
], 42, ws));
], 42, Ss));
}

@@ -1441,9 +1445,9 @@ }), X = (s, e) => {

return t;
}, we = /* @__PURE__ */ X(xs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/Command.vue"]]), As = { "command-dialog": "" }, ks = { "command-dialog-mask": "" }, Ls = { "command-dialog-wrapper": "" }, Os = { "command-dialog-header": "" }, Rs = { "command-dialog-body": "" }, Cs = {
}, we = /* @__PURE__ */ X(bs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/Command.vue"]]), xs = { "command-dialog": "" }, As = { "command-dialog-mask": "" }, ks = { "command-dialog-wrapper": "" }, Os = { "command-dialog-header": "" }, Ls = { "command-dialog-body": "" }, Rs = {
key: 0,
"command-dialog-footer": ""
}, $s = x({
}, Cs = x({
name: "Command.Dialog"
}), Ts = /* @__PURE__ */ x({
...$s,
}), $s = /* @__PURE__ */ x({
...Cs,
props: {

@@ -1455,3 +1459,3 @@ visible: { type: Boolean, required: !0 },

setup(s, { emit: e }) {
const t = s, { search: n, filtered: r } = J(), { emitter: o } = le(), i = $();
const t = s, { search: n, filtered: r } = J(), { emitter: o } = le(), i = N();
o.on("selectItem", (c) => {

@@ -1463,3 +1467,3 @@ e("select-item", c);

};
return ze(() => t.visible, a), Me(a), (c, u) => (K(), Re(gt, {
return We(() => t.visible, a), Me(a), (c, u) => (F(), Le(pt, {
to: "body",

@@ -1469,22 +1473,22 @@ ref_key: "dialogRef",

}, [
_t(vt, {
gt(_t, {
name: "command-dialog",
appear: ""
}, {
default: Ce(() => [
s.visible ? (K(), Re(we, {
default: Re(() => [
s.visible ? (F(), Le(we, {
key: 0,
theme: s.theme
}, {
default: Ce(() => [
V("div", As, [
V("div", ks, [
V("div", Ls, [
V("div", Os, [
default: Re(() => [
j("div", xs, [
j("div", As, [
j("div", ks, [
j("div", Os, [
z(c.$slots, "header")
]),
V("div", Rs, [
j("div", Ls, [
z(c.$slots, "body")
]),
c.$slots.footer ? (K(), Q("div", Cs, [
c.$slots.footer ? (F(), Q("div", Rs, [
z(c.$slots, "footer")

@@ -1503,14 +1507,14 @@ ])) : fe("v-if", !0)

}
}), Ns = /* @__PURE__ */ X(Ts, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/CommandDialog.vue"]]);
let rt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), "");
const Ps = ["command-group-key", "data-value"], Ds = {
}), Ts = /* @__PURE__ */ X($s, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/CommandDialog.vue"]]);
let nt = (s = 21) => crypto.getRandomValues(new Uint8Array(s)).reduce((e, t) => (t &= 63, t < 36 ? e += t.toString(36) : t < 62 ? e += (t - 26).toString(36).toUpperCase() : t > 62 ? e += "-" : e += "_", e), "");
const Ns = ["command-group-key", "data-value"], Ps = {
key: 0,
"command-group-heading": ""
}, Fs = {
}, Ds = {
"command-group-items": "",
role: "group"
}, Ks = x({
}, Fs = x({
name: "Command.Group"
}), Gs = /* @__PURE__ */ x({
...Ks,
}), Ks = /* @__PURE__ */ x({
...Fs,
props: {

@@ -1520,24 +1524,24 @@ heading: { type: String, required: !0 }

setup(s) {
const e = T(() => `command-group-${rt()}`), { filtered: t, isSearching: n } = J(), r = T(
const e = P(() => `command-group-${nt()}`), { filtered: t, isSearching: n } = J(), r = P(
() => n.value ? t.value.groups.has(e.value) : !0
);
return (o, i) => Ue((K(), Q("div", {
return (o, i) => Ve((F(), Q("div", {
"command-group": "",
role: "presentation",
key: O(e),
"command-group-key": O(e),
key: R(e),
"command-group-key": R(e),
"data-value": s.heading
}, [
s.heading ? (K(), Q("div", Ds, yt(s.heading), 1)) : fe("v-if", !0),
V("div", Fs, [
s.heading ? (F(), Q("div", Ps, vt(s.heading), 1)) : fe("v-if", !0),
j("div", Ds, [
z(o.$slots, "default")
])
], 8, Ps)), [
[Be, O(r)]
], 8, Ns)), [
[Ue, R(r)]
]);
}
}), js = /* @__PURE__ */ X(Gs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/CommandGroup.vue"]]), Vs = ["placeholder", "value"], Us = x({
}), Gs = /* @__PURE__ */ X(Ks, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/CommandGroup.vue"]]), js = ["placeholder", "value"], Vs = x({
name: "Command.Input"
}), Bs = /* @__PURE__ */ x({
...Us,
}), Us = /* @__PURE__ */ x({
...Vs,
props: {

@@ -1549,3 +1553,3 @@ placeholder: { type: String, required: !0 },

setup(s, { emit: e }) {
const t = $(null), { search: n } = J(), r = T(() => n.value), o = (i) => {
const t = N(null), { search: n } = J(), r = P(() => n.value), o = (i) => {
const a = i, c = i.target;

@@ -1557,3 +1561,3 @@ n.value = c == null ? void 0 : c.value, e("input", a), e("update:value", n.value);

(i = t.value) == null || i.focus();
}), (i, a) => (K(), Q("input", {
}), (i, a) => (F(), Q("input", {
ref_key: "inputRef",

@@ -1570,10 +1574,10 @@ ref: t,

placeholder: s.placeholder,
value: O(r),
value: R(r),
onInput: o
}, null, 40, Vs));
}, null, 40, js));
}
}), Hs = /* @__PURE__ */ X(Bs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/CommandInput.vue"]]), Ws = ["aria-selected", "aria-disabled", "command-item-key"], zs = x({
}), Bs = /* @__PURE__ */ X(Us, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/CommandInput.vue"]]), Hs = ["aria-selected", "aria-disabled", "command-item-key"], Ws = x({
name: "Command.Item"
}), Qs = /* @__PURE__ */ x({
...zs,
}), zs = /* @__PURE__ */ x({
...Ws,
props: {

@@ -1585,22 +1589,22 @@ shortcut: { type: Array, required: !1 },

setup(s, { emit: e }) {
const t = s, n = "command-item-select", r = "data-value", { current: o } = At(), { selectedNode: i, filtered: a, isSearching: c } = J(), { emitter: u } = le(), h = $(), d = T(() => `command-item-${rt()}`), p = T(() => {
const f = a.value.items.get(d.value);
return c.value ? f !== void 0 : !0;
}), _ = T(() => Array.from(o)), y = () => {
const t = s, n = "command-item-select", r = "data-value", { current: o } = xt(), { selectedNode: i, filtered: a, isSearching: c } = J(), { emitter: u } = le(), h = N(), f = P(() => `command-item-${nt()}`), p = P(() => {
const d = a.value.items.get(f.value);
return c.value ? d !== void 0 : !0;
}), v = P(() => Array.from(o)), y = () => {
var g;
const f = {
key: d.value,
const d = {
key: f.value,
value: ((g = h.value) == null ? void 0 : g.getAttribute(r)) || ""
};
e("select", f), u.emit("selectItem", f);
e("select", d), u.emit("selectItem", d);
};
return ze(_, (f) => {
return We(v, (d) => {
t.shortcut && t.shortcut.length > 0 && t.shortcut.every((I) => o.has(I.toLowerCase())) && t.perform && t.perform();
}), be(() => {
var f;
(f = h.value) == null || f.addEventListener(n, y);
var d;
(d = h.value) == null || d.addEventListener(n, y);
}), Me(() => {
var f;
(f = h.value) == null || f.removeEventListener(n, y);
}), (f, g) => Ue((K(), Q("div", {
var d;
(d = h.value) == null || d.removeEventListener(n, y);
}), (d, g) => Ve((F(), Q("div", {
ref_key: "itemRef",

@@ -1610,19 +1614,19 @@ ref: h,

role: "option",
"aria-selected": O(i) === O(d),
"aria-disabled": !O(p),
key: O(d),
"command-item-key": O(d),
"aria-selected": R(i) === R(f),
"aria-disabled": !R(p),
key: R(f),
"command-item-key": R(f),
onClick: y
}, [
z(f.$slots, "default")
], 8, Ws)), [
[Be, O(p)]
z(d.$slots, "default")
], 8, Hs)), [
[Ue, R(p)]
]);
}
}), Ys = /* @__PURE__ */ X(Qs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/CommandItem.vue"]]), Js = x({
}), Qs = /* @__PURE__ */ X(zs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/CommandItem.vue"]]), Ys = x({
name: "Command.List"
}), Xs = /* @__PURE__ */ x({
...Js,
}), Js = /* @__PURE__ */ x({
...Ys,
setup(s) {
const { emitter: e } = le(), t = $(), n = $();
const { emitter: e } = le(), t = N(), n = N();
let r = null, o;

@@ -1633,3 +1637,3 @@ return be(() => {

o && i && (r = new ResizeObserver((a) => {
te(() => {
Z(() => {
const c = o == null ? void 0 : o.offsetHeight;

@@ -1644,3 +1648,3 @@ i == null || i.style.setProperty(

r !== null && o && r.unobserve(o);
}), (i, a) => (K(), Q("div", {
}), (i, a) => (F(), Q("div", {
"command-list": "",

@@ -1652,3 +1656,3 @@ role: "listbox",

}, [
V("div", {
j("div", {
"command-list-sizer": "",

@@ -1662,6 +1666,6 @@ ref_key: "heightRef",

}
}), qs = /* @__PURE__ */ X(Xs, [["__file", "/Users/xiaoyunwei/Documents/GitHub/private/vue-command-palette/packages/CommandList.vue"]]), Zs = x({
}), Xs = /* @__PURE__ */ X(Js, [["__file", "/Users/xiaoyunwei/Documents/GitHub/oss/vue-command-palette/packages/CommandList.vue"]]), qs = x({
name: "Command.Empty",
setup(s, { attrs: e, slots: t }) {
const { filtered: n } = J(), r = T(() => n.value.count === 0);
const { filtered: n } = J(), r = P(() => n.value.count === 0);
return () => r.value ? ce(

@@ -1684,3 +1688,3 @@ "div",

}
}), en = x({
}), Zs = x({
name: "Command.Loading",

@@ -1698,3 +1702,3 @@ setup(s, { attrs: e, slots: t }) {

}
}), tn = x({
}), en = x({
name: "Command.Separator",

@@ -1708,15 +1712,15 @@ setup(s, { attrs: e, slots: t }) {

}
}), nn = Object.assign(we, {
Dialog: Ns,
Empty: Zs,
Group: js,
Input: Hs,
Item: Ys,
List: qs,
Loading: en,
Separator: tn,
}), sn = Object.assign(we, {
Dialog: Ts,
Empty: qs,
Group: Gs,
Input: Bs,
Item: Qs,
List: Xs,
Loading: Zs,
Separator: en,
Root: we
});
export {
nn as Command
sn as Command
};
{
"name": "vue-command-palette",
"version": "0.1.3",
"version": "0.1.4",
"type": "module",

@@ -10,3 +10,4 @@ "author": "xiaoluoboding <xiaoluoboding@gmail.com>",

"build:lib": "vue-tsc --noEmit && vite build --mode lib",
"preview": "vite preview"
"preview": "vite preview",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0"
},

@@ -13,0 +14,0 @@ "repository": {

@@ -12,5 +12,11 @@ # Command Palette for Vue

## Concepts
Command palette interfaces are used to create a web experience where users can quickly get in charge with keyboard shortcuts, rather than using the mouse.
With macOS's `Spotlight` and `Raycast`'s command palette experience in mind, `vue-command-palette` is designed to provide a fast, composable, unstyled command palette to your site.
## Features
- 🧩 [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) Design
- 🧩 [Compound Component](https://kentcdodds.com/blog/compound-components-with-react-hooks) + [Namespaced Components](https://vuejs.org/api/sfc-script-setup.html#using-components) Design
- 💄 Completely unstyled, but more customizable

@@ -24,3 +30,3 @@ - 🔍 Fuzzy search support to find relevant command

yarn add vue-command-palette
//
# or
pnpm add vue-command-palette

@@ -101,28 +107,162 @@ ```

### <kbd>Command</kbd> + <kbd>K</kbd> or ?
Do I have to use command + K? No, it's just a convention that you can use any key binding to perform the Command Palette.
> Tips, we use `@vueuse/core` to bind the keybindings
```html
<script lang="ts" setup>
import { watch } from 'vue'
import { useMagicKeys } from '@vueuse/core'
const keys = useMagicKeys()
const CmdK = keys['Meta+K']
watch(CmdK, (v) => {
if (v) {
console.log('Meta + K has been pressed')
// do your own logic, maybe make dialog visible
}
})
</script>
```
### Events
| Name | Description | Parameters |
| :-----------: | --------------------------------------------------------------------- | :--------------- |
| `select-item` | Every time an item is being selected in `Command` or `Command.Dialog` | `(item) => void` |
### Styling
All namespaced components have a specific `data-attribute` starting with `command-` that can be used for styling.
eg:
```css
div[command-root=''] {
background: #ffffff;
}
```
### Animation
## Compound components
#### Command.Dialog
### Command
`Command.Dialog` wraped by built-in components [Transition](https://vuejs.org/guide/built-ins/transition.html), you can customize the animation using the name `command-dialog` .
### Command.Dialog
[Example Code](https://github.com/xiaoluoboding/vue-command-palette/blob/main/src/assets/scss/algolia.scss#L193)
### Command.Input
#### List Item Height
### Command.List
Animate height using the `--command-list-height` CSS variable.
### Command.Group
[Example Code](https://github.com/xiaoluoboding/vue-command-palette/blob/main/src/assets/scss/algolia.scss#L26)
### Command.Item
## Namespaced components
### Command.Separator
With [Namespaced components](https://vuejs.org/api/sfc-script-setup.html#using-components), You can use component tags with dots like `<Foo.Bar>` to refer to components nested under object properties. This is useful when you import multiple components from a single file.
### Command.Empty
### Command `[command-root=""]`
### Command.Loading
The root component, Passes the `theme` props to set your own style.
```vue
<Command theme="custom">
<!-- Contains other namespaced components -->
</Command>
```
### Command.Dialog `[command-dialog=""]`
The root component with a dialog interface, [Teleport](https://vuejs.org/guide/built-ins/teleport.html) dialog to `body` tag. Passes the `theme` props to set your own style, and `visible` props control whether render it.
```vue
<Command.Dialog :visible="visible" theme="custom">
<!-- Contains other namespaced components -->
<template #header></template>
<template #body></template>
<template #footer></template>
</Command.Dialog>
```
`data-attribute` within dialog
- `[command-dialog-mask]` - the mask is always rendered.
- `[command-dialog-wrapper]` - the wrapper on top of mask.
- `[command-dialog-header]` - the parent of dialog header slot.
- `[command-dialog-body]` - the parent of dialog body slot.
- `[command-dialog-footer]` - the parent of dialog footer slot.
### Command.Input `[command-input=""]`
Usually we need a input in the command palette to search sth.
```vue
<Command.Input
placeholder="Type a command or search..."
v-model:value="inputValue"
/>
```
### Command.List `[command-list=""]`
Contains items and groups. Animate height using the `--command-list-height` CSS variable.
```css
[command-list] {
min-height: 300px;
height: var(--command-list-height);
max-height: 500px;
transition: height 100ms ease;
}
```
```vue
<Command.List>
<!-- Contains Group, Item, Empty -->
</Command.List>
```
### Command.Group `[command-group=""]`
Group items (`[command-group-items]`) together with the given `heading` (`[command-group-heading]`)
```vue
<Command.Group heading="Perference">
<Command.Item>Toggle Dark Mode</Command.Item>
<Command.Item>Change Language</Command.Item>
</Command.Group>
```
### Command.Item `[command-item=""]`
Passed the `data-value`, we use `data-value` to fetch the value.
```vue
<Command.Item
v-for="item in items"
:data-value="item.label"
:shortcut="item.shortcut"
:perform="item.perform"
@select="(itemInfo) => console.log('selected', itemInfo)"
// the itemInfo.value is some as `data-value`
>
{{ item.label }}
</Command.Item>
```
### Command.Separator `[command-separator=""]`
Usually used to distinguish between different groups
### Command.Empty `[command-empty=""]`
Automatically renders when there are no results for the search query.
### Command.Loading `[command-loading=""]`
Your should manually control `loading`
## Inspiration

@@ -129,0 +269,0 @@

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc