From 3fb3b3a8d5ef354dab462d934ec9faa118ff050c Mon Sep 17 00:00:00 2001 From: Elijah Fowler Date: Tue, 8 Oct 2024 17:16:13 -0500 Subject: [PATCH] Added missing background color to flyout --- dist/MultiSelect.min.js | 382 ++++++++++++++++++++-------------------- dist/style.css | 2 +- src/MultiSelect.svelte | 2 +- 3 files changed, 193 insertions(+), 193 deletions(-) diff --git a/dist/MultiSelect.min.js b/dist/MultiSelect.min.js index f90db2b..eda9d69 100644 --- a/dist/MultiSelect.min.js +++ b/dist/MultiSelect.min.js @@ -1,19 +1,19 @@ -const Yn = "5"; -typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Yn); -const Ve = 1, Be = 2, vn = 4, Kn = 8, Wn = 16, Gn = 1, Jn = 2, Zn = 4, jn = 8, zn = 16, Xn = 1, Qn = 2, N = Symbol(), $n = !1; -var be = Array.isArray, He = Array.from, et = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, dn = Object.prototype, nt = Array.prototype, hn = Object.getPrototypeOf; +const Un = "5"; +typeof window < "u" && (window.__svelte || (window.__svelte = { v: /* @__PURE__ */ new Set() })).v.add(Un); +const Ve = 1, je = 2, vn = 4, Yn = 8, Kn = 16, Wn = 1, Gn = 2, Jn = 4, Zn = 8, zn = 16, Xn = 1, Qn = 2, N = Symbol(), $n = !1; +var be = Array.isArray, Be = Array.from, et = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, dn = Object.prototype, nt = Array.prototype, hn = Object.getPrototypeOf; function tt(e) { for (var n = 0; n < e.length; n++) e[n](); } -const q = 2, pn = 4, ue = 8, mn = 16, W = 32, Se = 64, J = 128, de = 256, P = 512, K = 1024, ie = 2048, L = 4096, fe = 8192, rt = 16384, Ue = 32768, lt = 65536, ut = 1 << 18, wn = 1 << 19, Ce = Symbol("$state"); +const q = 2, pn = 4, ue = 8, mn = 16, K = 32, Se = 64, G = 128, de = 256, P = 512, Y = 1024, ie = 2048, L = 4096, fe = 8192, rt = 16384, He = 32768, lt = 65536, ut = 1 << 18, wn = 1 << 19, Ce = Symbol("$state"); function En(e) { return e === this.v; } function it(e, n) { return e != e ? n == n : e !== n || e !== null && typeof e == "object" || typeof e == "function"; } -function Ye(e) { +function Ue(e) { return !it(e, this.v); } function ft(e) { @@ -28,10 +28,10 @@ function ot(e) { function st() { throw new Error("effect_update_depth_exceeded"); } -function ct(e) { +function _t(e) { throw new Error("props_invalid_value"); } -function _t() { +function ct() { throw new Error("state_descriptors_fixed"); } function vt() { @@ -60,7 +60,7 @@ function Ae(e) { function gn(e) { var t; const n = D(e); - return n.equals = Ye, x !== null && x.l !== null && ((t = x.l).s ?? (t.s = [])).push(n), n; + return n.equals = Ue, x !== null && x.l !== null && ((t = x.l).s ?? (t.s = [])).push(n), n; } // @__NO_SIDE_EFFECTS__ function pt(e) { @@ -69,14 +69,14 @@ function pt(e) { function C(e, n) { return b !== null && ge() && b.f & q && // If the source was created locally within the current derived, then // we allow the mutation. - (M === null || !M.includes(e)) && ht(), e.equals(n) || (e.v = n, e.version = Dn(), yn(e, K), ge() && w !== null && w.f & P && !(w.f & W) && (I !== null && I.includes(e) ? (F(w, K), Te(w)) : Y === null ? xt([e]) : Y.push(e))), n; + (M === null || !M.includes(e)) && ht(), e.equals(n) || (e.v = n, e.version = Dn(), yn(e, Y), ge() && w !== null && w.f & P && !(w.f & K) && (I !== null && I.includes(e) ? (F(w, Y), Te(w)) : U === null ? xt([e]) : U.push(e))), n; } function yn(e, n) { var t = e.reactions; if (t !== null) for (var r = ge(), l = t.length, u = 0; u < l; u++) { - var i = t[u], c = i.f; - c & K || !r && i === w || (F(i, n), c & (P | J) && (c & q ? yn( + var i = t[u], _ = i.f; + _ & Y || !r && i === w || (F(i, n), _ & (P | G) && (_ & q ? yn( /** @type {Derived} */ i, ie @@ -87,7 +87,7 @@ function yn(e, n) { } } function mt(e) { - w === null && b === null && ot(), b !== null && b.f & J && at(), We && ft(); + w === null && b === null && ot(), b !== null && b.f & G && at(), Ke && ft(); } function wt(e, n) { var t = n.last; @@ -99,7 +99,7 @@ function ae(e, n, t, r = !0) { deps: null, nodes_start: null, nodes_end: null, - f: e | K, + f: e | Y, first: null, fn: n, last: null, @@ -111,13 +111,13 @@ function ae(e, n, t, r = !0) { version: 0 }; if (t) { - var c = $; + var _ = $; try { Qe(!0), ke(i), i.f |= rt; } catch (a) { throw ee(i), a; } finally { - Qe(c); + Qe(_); } } else n !== null && Te(i); var s = t && i.deps === null && i.first === null && i.nodes_start === null && i.teardown === null && (i.f & wn) === 0; @@ -161,19 +161,19 @@ function bn(e) { function Sn(e) { return ae(ue, e, !0); } -function Z(e) { +function J(e) { return Sn(e); } function kn(e, n = 0) { return ae(ue | mn | n, e, !0); } function re(e, n = !0) { - return ae(ue | W, e, !0, n); + return ae(ue | K, e, !0, n); } function Tn(e) { var n = e.teardown; if (n !== null) { - const t = We, r = b; + const t = Ke, r = b; $e(!0), we(null); try { n.call(null); @@ -200,8 +200,8 @@ function ee(e, n = !0) { for (const s of i) s.stop(); Tn(e); - var c = e.parent; - c !== null && c.first !== null && xn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.parent = e.fn = e.nodes_start = e.nodes_end = null; + var _ = e.parent; + _ !== null && _.first !== null && xn(e), e.next = e.prev = e.teardown = e.ctx = e.deps = e.parent = e.fn = e.nodes_start = e.nodes_end = null; } function xn(e) { var n = e.parent, t = e.prev, r = e.next; @@ -209,7 +209,7 @@ function xn(e) { } function Pe(e, n) { var t = []; - Ke(e, t, !0), Cn(t, () => { + Ye(e, t, !0), Cn(t, () => { ee(e), n && n(); }); } @@ -222,14 +222,14 @@ function Cn(e, n) { } else n(); } -function Ke(e, n, t) { +function Ye(e, n, t) { if (!(e.f & L)) { if (e.f ^= L, e.transitions !== null) for (const i of e.transitions) (i.is_global || t) && n.push(i); for (var r = e.first; r !== null; ) { - var l = r.next, u = (r.f & Ue) !== 0 || (r.f & W) !== 0; - Ke(r, n, u ? t : !1), r = l; + var l = r.next, u = (r.f & He) !== 0 || (r.f & K) !== 0; + Ye(r, n, u ? t : !1), r = l; } } } @@ -240,7 +240,7 @@ function An(e, n) { if (e.f & L) { e.f ^= L, oe(e) && ke(e); for (var t = e.first; t !== null; ) { - var r = t.next, l = (t.f & Ue) !== 0 || (t.f & W) !== 0; + var r = t.next, l = (t.f & He) !== 0 || (t.f & K) !== 0; An(t, l ? n : !1), t = r; } if (e.transitions !== null) @@ -259,8 +259,8 @@ function bt(e) { } // @__NO_SIDE_EFFECTS__ function pe(e) { - let n = q | K; - w === null ? n |= J : w.f |= wn; + let n = q | Y; + w === null ? n |= G : w.f |= wn; const t = { children: null, deps: null, @@ -287,7 +287,7 @@ function pe(e) { // @__NO_SIDE_EFFECTS__ function St(e) { const n = /* @__PURE__ */ pe(e); - return n.equals = Ye, n; + return n.equals = Ue, n; } function In(e) { var n = e.children; @@ -313,19 +313,19 @@ function Nn(e) { } finally { Ee(t); } - var r = (X || e.f & J) && e.deps !== null ? ie : P; + var r = (X || e.f & G) && e.deps !== null ? ie : P; F(e, r), e.equals(n) || (e.v = n, e.version = Dn()); } function kt(e) { In(e), le(e, 0), F(e, fe), e.children = e.deps = e.reactions = // @ts-expect-error `signal.fn` cannot be `null` while the signal is alive e.fn = null; } -let me = !1, $ = !1, We = !1; +let me = !1, $ = !1, Ke = !1; function Qe(e) { $ = e; } function $e(e) { - We = e; + Ke = e; } let Le = [], te = 0; let b = null; @@ -340,9 +340,9 @@ let M = null; function Tt(e) { M = e; } -let I = null, O = 0, Y = null; +let I = null, O = 0, U = null; function xt(e) { - Y = e; + U = e; } let On = 0, X = !1, x = null; function Dn() { @@ -352,12 +352,12 @@ function ge() { return x !== null && x.l === null; } function oe(e) { - var i, c; + var i, _; var n = e.f; - if (n & K) + if (n & Y) return !0; if (n & ie) { - var t = e.deps, r = (n & J) !== 0; + var t = e.deps, r = (n & G) !== 0; if (t !== null) { var l; if (n & de) { @@ -373,7 +373,7 @@ function oe(e) { ) && Nn( /** @type {Derived} */ u - ), r && w !== null && !X && !((c = u == null ? void 0 : u.reactions) != null && c.includes(e)) && (u.reactions ?? (u.reactions = [])).push(e), u.version > e.version) + ), r && w !== null && !X && !((_ = u == null ? void 0 : u.reactions) != null && _.includes(e)) && (u.reactions ?? (u.reactions = [])).push(e), u.version > e.version) return !0; } } @@ -386,11 +386,11 @@ function Ct(e, n, t) { } function Pn(e) { var a; - var n = I, t = O, r = Y, l = b, u = X, i = M; + var n = I, t = O, r = U, l = b, u = X, i = M; I = /** @type {null | Value[]} */ - null, O = 0, Y = null, b = e.f & (W | Se) ? null : e, X = !$ && (e.f & J) !== 0, M = null; + null, O = 0, U = null, b = e.f & (K | Se) ? null : e, X = !$ && (e.f & G) !== 0, M = null; try { - var c = ( + var _ = ( /** @type {Function} */ (0, e.fn)() ), s = e.deps; @@ -405,9 +405,9 @@ function Pn(e) { for (f = O; f < s.length; f++) ((a = s[f]).reactions ?? (a.reactions = [])).push(e); } else s !== null && O < s.length && (le(e, O), s.length = O); - return c; + return _; } finally { - I = n, O = t, Y = r, b = l, X = u, M = i; + I = n, O = t, U = r, b = l, X = u, M = i; } } function At(e, n) { @@ -422,7 +422,7 @@ function At(e, n) { t === null && n.f & q && // Destroying a child effect while updating a parent effect can cause a dependency to appear // to be unused, when in fact it is used by the currently-updating parent. Checking `new_deps` // allows us to skip the expensive work of disconnecting and immediately reconnecting it - (I === null || !I.includes(n)) && (F(n, ie), n.f & (J | de) || (n.f ^= de), le( + (I === null || !I.includes(n)) && (F(n, ie), n.f & (G | de) || (n.f ^= de), le( /** @type {Derived} **/ n, 0 @@ -501,7 +501,7 @@ function Te(e) { for (var n = e; n.parent !== null; ) { n = n.parent; var t = n.f; - if (t & (Se | W)) { + if (t & (Se | K)) { if (!(t & P)) return; n.f ^= P; } @@ -511,13 +511,13 @@ function Te(e) { function Mn(e, n) { var t = e.first, r = []; e: for (; t !== null; ) { - var l = t.f, u = (l & W) !== 0, i = u && (l & P) !== 0; + var l = t.f, u = (l & K) !== 0, i = u && (l & P) !== 0; if (!i && !(l & L)) if (l & ue) { u ? t.f ^= P : oe(t) && ke(t); - var c = t.first; - if (c !== null) { - t = c; + var _ = t.first; + if (_ !== null) { + t = _; continue; } } else l & pn && r.push(t); @@ -538,7 +538,7 @@ function Mn(e, n) { t = s; } for (var a = 0; a < r.length; a++) - c = r[a], n.push(c), Mn(c, n); + _ = r[a], n.push(_), Mn(_, n); } function g(e) { var n = e.f; @@ -547,7 +547,7 @@ function g(e) { if (b !== null) { M !== null && M.includes(e) && dt(); var t = b.deps; - I === null && t !== null && t[O] === e ? O++ : I === null ? I = [e] : I.push(e), Y !== null && w !== null && w.f & P && !(w.f & W) && Y.includes(e) && (F(w, K), Te(w)); + I === null && t !== null && t[O] === e ? O++ : I === null ? I = [e] : I.push(e), U !== null && w !== null && w.f & P && !(w.f & K) && U.includes(e) && (F(w, Y), Te(w)); } if (n & q) { var r = ( @@ -566,7 +566,7 @@ function Pt(e) { b = n; } } -const Rt = ~(K | ie | P); +const Rt = ~(Y | ie | P); function F(e, n) { e.f = e.f & Rt | n; } @@ -609,7 +609,7 @@ function qn(e) { {} ); } -function U(e, n = null, t) { +function H(e, n = null, t) { if (typeof e != "object" || e === null || Ce in e) return e; const r = hn(e); @@ -620,15 +620,15 @@ function U(e, n = null, t) { /** @type {any[]} */ e.length )); - var c; + var _; return new Proxy( /** @type {any} */ e, { defineProperty(s, f, a) { - (!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && _t(); + (!("value" in a) || a.configurable === !1 || a.enumerable === !1 || a.writable === !1) && ct(); var o = l.get(f); - return o === void 0 ? (o = D(a.value), l.set(f, o)) : C(o, U(a.value, c)), !0; + return o === void 0 ? (o = D(a.value), l.set(f, o)) : C(o, H(a.value, _)), !0; }, deleteProperty(s, f) { var a = l.get(f); @@ -639,9 +639,9 @@ function U(e, n = null, t) { if (f === Ce) return e; var o = l.get(f), v = f in s; - if (o === void 0 && (!v || (h = Q(s, f)) != null && h.writable) && (o = D(U(v ? s[f] : N, c)), l.set(f, o)), o !== void 0) { - var _ = g(o); - return _ === N ? void 0 : _; + if (o === void 0 && (!v || (h = Q(s, f)) != null && h.writable) && (o = D(H(v ? s[f] : N, _)), l.set(f, o)), o !== void 0) { + var c = g(o); + return c === N ? void 0 : c; } return Reflect.get(s, f, a); }, @@ -651,24 +651,24 @@ function U(e, n = null, t) { var o = l.get(f); o && (a.value = g(o)); } else if (a === void 0) { - var v = l.get(f), _ = v == null ? void 0 : v.v; - if (v !== void 0 && _ !== N) + var v = l.get(f), c = v == null ? void 0 : v.v; + if (v !== void 0 && c !== N) return { enumerable: !0, configurable: !0, - value: _, + value: c, writable: !0 }; } return a; }, has(s, f) { - var _; + var c; if (f === Ce) return !0; var a = l.get(f), o = a !== void 0 && a.v !== N || Reflect.has(s, f); - if (a !== void 0 || w !== null && (!o || (_ = Q(s, f)) != null && _.writable)) { - a === void 0 && (a = D(o ? U(s[f], c) : N), l.set(f, a)); + if (a !== void 0 || w !== null && (!o || (c = Q(s, f)) != null && c.writable)) { + a === void 0 && (a = D(o ? H(s[f], _) : N), l.set(f, a)); var v = g(a); if (v === N) return !1; @@ -677,16 +677,16 @@ function U(e, n = null, t) { }, set(s, f, a, o) { var d; - var v = l.get(f), _ = f in s; + var v = l.get(f), c = f in s; if (u && f === "length") for (var h = a; h < /** @type {Source} */ v.v; h += 1) { var E = l.get(h + ""); E !== void 0 ? C(E, N) : h in s && (E = D(N), l.set(h + "", E)); } - v === void 0 ? (!_ || (d = Q(s, f)) != null && d.writable) && (v = D(void 0), C(v, U(a, c)), l.set(f, v)) : (_ = v.v !== N, C(v, U(a, c))); + v === void 0 ? (!c || (d = Q(s, f)) != null && d.writable) && (v = D(void 0), C(v, H(a, _)), l.set(f, v)) : (c = v.v !== N, C(v, H(a, _))); var S = Reflect.getOwnPropertyDescriptor(s, f); - if (S != null && S.set && S.set.call(o, a), !_) { + if (S != null && S.set && S.set.call(o, a), !c) { if (u && typeof f == "string") { var k = ( /** @type {Source} */ @@ -701,8 +701,8 @@ function U(e, n = null, t) { ownKeys(s) { g(i); var f = Reflect.ownKeys(s).filter((v) => { - var _ = l.get(v); - return _ === void 0 || _.v !== N; + var c = l.get(v); + return c === void 0 || c.v !== N; }); for (var [a, o] of l) o.v !== N && !(a in s) && f.push(a); @@ -725,7 +725,7 @@ function Mt() { Fn = Q(n, "firstChild").get, Vn = Q(n, "nextSibling").get, e.__click = void 0, e.__className = "", e.__attributes = null, e.__e = void 0, Text.prototype.__t = void 0; } } -function Ge(e = "") { +function We(e = "") { return document.createTextNode(e); } // @__NO_SIDE_EFFECTS__ @@ -736,7 +736,7 @@ function ye(e) { function xe(e) { return Vn.call(e); } -function G(e) { +function W(e) { return /* @__PURE__ */ ye(e); } function tn(e, n) { @@ -761,15 +761,15 @@ function Ie(e, n = 1, t = !1) { function Lt(e) { e.textContent = ""; } -let Bn = !1; -const Hn = /* @__PURE__ */ new Set(), qe = /* @__PURE__ */ new Set(); +let jn = !1; +const Bn = /* @__PURE__ */ new Set(), qe = /* @__PURE__ */ new Set(); function qt(e) { for (var n = 0; n < e.length; n++) - Hn.add(e[n]); + Bn.add(e[n]); for (var t of qe) t(e); } -function ce(e) { +function _e(e) { var S; var n = this, t = ( /** @type {Node} */ @@ -777,9 +777,9 @@ function ce(e) { ), r = e.type, l = ((S = e.composedPath) == null ? void 0 : S.call(e)) || [], u = ( /** @type {null | Element} */ l[0] || e.target - ), i = 0, c = e.__root; - if (c) { - var s = l.indexOf(c); + ), i = 0, _ = e.__root; + if (_) { + var s = l.indexOf(_); if (s !== -1 && (n === document || n === /** @type {any} */ window)) { e.__root = n; @@ -803,14 +803,14 @@ function ce(e) { var v = u.assignedSlot || u.parentNode || /** @type {any} */ u.host || null; try { - var _ = u["__" + r]; - if (_ !== void 0 && !/** @type {any} */ + var c = u["__" + r]; + if (c !== void 0 && !/** @type {any} */ u.disabled) - if (be(_)) { - var [h, ...E] = _; + if (be(c)) { + var [h, ...E] = c; h.apply(u, [e, ...E]); } else - _.call(u, e); + c.call(u, e); } catch (k) { a ? o.push(k) : a = k; } @@ -852,57 +852,57 @@ function se(e, n) { r ? document.importNode(l, !0) : l.cloneNode(!0) ); if (t) { - var c = ( + var _ = ( /** @type {TemplateNode} */ /* @__PURE__ */ ye(i) ), s = ( /** @type {TemplateNode} */ i.lastChild ); - Fe(c, s); + Fe(_, s); } else Fe(i, i); return i; }; } function Vt() { - var e = document.createDocumentFragment(), n = document.createComment(""), t = Ge(); + var e = document.createDocumentFragment(), n = document.createComment(""), t = We(); return e.append(n, t), Fe(n, t), e; } -function j(e, n) { +function Z(e, n) { e !== null && e.before( /** @type {Node} */ n ); } -const Bt = ["touchstart", "touchmove"]; -function Ht(e) { - return Bt.includes(e); +const jt = ["touchstart", "touchmove"]; +function Bt(e) { + return jt.includes(e); } function Ne(e, n) { n !== (e.__t ?? (e.__t = e.nodeValue)) && (e.__t = n, e.nodeValue = n == null ? "" : n + ""); } function fr(e, n) { - return Ut(e, n); + return Ht(e, n); } const z = /* @__PURE__ */ new Map(); -function Ut(e, { target: n, anchor: t, props: r = {}, events: l, context: u, intro: i = !0 }) { +function Ht(e, { target: n, anchor: t, props: r = {}, events: l, context: u, intro: i = !0 }) { Mt(); - var c = /* @__PURE__ */ new Set(), s = (o) => { + var _ = /* @__PURE__ */ new Set(), s = (o) => { for (var v = 0; v < o.length; v++) { - var _ = o[v]; - if (!c.has(_)) { - c.add(_); - var h = Ht(_); - n.addEventListener(_, ce, { passive: h }); - var E = z.get(_); - E === void 0 ? (document.addEventListener(_, ce, { passive: h }), z.set(_, 1)) : z.set(_, E + 1); + var c = o[v]; + if (!_.has(c)) { + _.add(c); + var h = Bt(c); + n.addEventListener(c, _e, { passive: h }); + var E = z.get(c); + E === void 0 ? (document.addEventListener(c, _e, { passive: h }), z.set(c, 1)) : z.set(c, E + 1); } } }; - s(He(Hn)), qe.add(s); + s(Be(Bn)), qe.add(s); var f = void 0, a = gt(() => { - var o = t ?? n.appendChild(Ge()); + var o = t ?? n.appendChild(We()); return re(() => { if (u) { Ln({}); @@ -915,13 +915,13 @@ function Ut(e, { target: n, anchor: t, props: r = {}, events: l, context: u, int l && (r.$$events = l), f = e(o, r) || {}, u && qn(); }), () => { var h; - for (var v of c) { - n.removeEventListener(v, ce); - var _ = ( + for (var v of _) { + n.removeEventListener(v, _e); + var c = ( /** @type {number} */ z.get(v) ); - --_ === 0 ? (document.removeEventListener(v, ce), z.delete(v)) : z.set(v, _); + --c === 0 ? (document.removeEventListener(v, _e), z.delete(v)) : z.set(v, c); } qe.delete(s), rn.delete(f), o !== t && ((h = o.parentNode) == null || h.removeChild(o)); }; @@ -950,8 +950,8 @@ function ve(e, n, t, r) { [] ); n.set(e, i); - for (let c = 0; c < e.length; c += 1) - i.push(ve(e[c], n)); + for (let _ = 0; _ < e.length; _ += 1) + i.push(ve(e[_], n)); return i; } if (hn(e) === dn) { @@ -992,11 +992,11 @@ function ve(e, n, t, r) { } } function un(e, n, t, r = null, l = !1) { - var u = e, i = null, c = null, s = null, f = l ? Ue : 0; + var u = e, i = null, _ = null, s = null, f = l ? He : 0; kn(() => { - s !== (s = !!n()) && (s ? (i ? he(i) : i = re(() => t(u)), c && Pe(c, () => { - c = null; - })) : (c ? he(c) : r && (c = re(() => r(u))), i && Pe(i, () => { + s !== (s = !!n()) && (s ? (i ? he(i) : i = re(() => t(u)), _ && Pe(_, () => { + _ = null; + })) : (_ ? he(_) : r && (_ = re(() => r(u))), i && Pe(i, () => { i = null; }))); }, f); @@ -1005,11 +1005,11 @@ let Oe = null; function fn(e, n) { return n; } -function Yt(e, n, t, r) { +function Ut(e, n, t, r) { for (var l = [], u = n.length, i = 0; i < u; i++) - Ke(n[i].e, l, !0); - var c = u > 0 && l.length === 0 && t !== null; - if (c) { + Ye(n[i].e, l, !0); + var _ = u > 0 && l.length === 0 && t !== null; + if (_) { var s = ( /** @type {Element} */ /** @type {Element} */ @@ -1018,70 +1018,70 @@ function Yt(e, n, t, r) { Lt(s), s.append( /** @type {Element} */ t - ), r.clear(), H(e, n[0].prev, n[u - 1].next); + ), r.clear(), B(e, n[0].prev, n[u - 1].next); } Cn(l, () => { for (var f = 0; f < u; f++) { var a = n[f]; - c || (r.delete(a.k), H(e, a.prev, a.next)), ee(a.e, !c); + _ || (r.delete(a.k), B(e, a.prev, a.next)), ee(a.e, !_); } }); } function an(e, n, t, r, l, u = null) { - var i = e, c = { flags: n, items: /* @__PURE__ */ new Map(), first: null }, s = (n & vn) !== 0; + var i = e, _ = { flags: n, items: /* @__PURE__ */ new Map(), first: null }, s = (n & vn) !== 0; if (s) { var f = ( /** @type {Element} */ e ); - i = f.appendChild(Ge()); + i = f.appendChild(We()); } var a = null; kn(() => { - var o = t(), v = be(o) ? o : o == null ? [] : He(o), _ = v.length; - Kt(v, c, i, l, n, r), u !== null && (_ === 0 ? a ? he(a) : a = re(() => u(i)) : a !== null && Pe(a, () => { + var o = t(), v = be(o) ? o : o == null ? [] : Be(o), c = v.length; + Yt(v, _, i, l, n, r), u !== null && (c === 0 ? a ? he(a) : a = re(() => u(i)) : a !== null && Pe(a, () => { a = null; })); }); } -function Kt(e, n, t, r, l, u) { - var Je, Ze, je, ze; - var i = (l & Kn) !== 0, c = (l & (Ve | Be)) !== 0, s = e.length, f = n.items, a = n.first, o = a, v, _ = null, h, E = [], S = [], k, p, d, m; +function Yt(e, n, t, r, l, u) { + var Ge, Je, Ze, ze; + var i = (l & Yn) !== 0, _ = (l & (Ve | je)) !== 0, s = e.length, f = n.items, a = n.first, o = a, v, c = null, h, E = [], S = [], k, p, d, m; if (i) for (m = 0; m < s; m += 1) - k = e[m], p = u(k, m), d = f.get(p), d !== void 0 && ((Je = d.a) == null || Je.measure(), (h ?? (h = /* @__PURE__ */ new Set())).add(d)); + k = e[m], p = u(k, m), d = f.get(p), d !== void 0 && ((Ge = d.a) == null || Ge.measure(), (h ?? (h = /* @__PURE__ */ new Set())).add(d)); for (m = 0; m < s; m += 1) { if (k = e[m], p = u(k, m), d = f.get(p), d === void 0) { var y = o ? ( /** @type {TemplateNode} */ o.e.nodes_start ) : t; - _ = Gt( + c = Wt( y, n, - _, - _ === null ? n.first : _.next, + c, + c === null ? n.first : c.next, k, p, m, r, l - ), f.set(p, _), E = [], S = [], o = _.next; + ), f.set(p, c), E = [], S = [], o = c.next; continue; } - if (c && Wt(d, k, m, l), d.e.f & L && (he(d.e), i && ((Ze = d.a) == null || Ze.unfix(), (h ?? (h = /* @__PURE__ */ new Set())).delete(d))), d !== o) { + if (_ && Kt(d, k, m, l), d.e.f & L && (he(d.e), i && ((Je = d.a) == null || Je.unfix(), (h ?? (h = /* @__PURE__ */ new Set())).delete(d))), d !== o) { if (v !== void 0 && v.has(d)) { if (E.length < S.length) { var A = S[0], T; - _ = A.prev; + c = A.prev; var R = E[0], V = E[E.length - 1]; for (T = 0; T < E.length; T += 1) on(E[T], A, t); for (T = 0; T < S.length; T += 1) v.delete(S[T]); - H(n, R.prev, V.next), H(n, _, R), H(n, V, A), o = A, _ = V, m -= 1, E = [], S = []; + B(n, R.prev, V.next), B(n, c, R), B(n, V, A), o = A, c = V, m -= 1, E = [], S = []; } else - v.delete(d), on(d, o, t), H(n, d.prev, d.next), H(n, d, _ === null ? n.first : _.next), H(n, _, d), _ = d; + v.delete(d), on(d, o, t), B(n, d.prev, d.next), B(n, d, c === null ? n.first : c.next), B(n, c, d), c = d; continue; } for (E = [], S = []; o !== null && o.k !== p; ) @@ -1090,21 +1090,21 @@ function Kt(e, n, t, r, l, u) { continue; d = o; } - E.push(d), _ = d, o = d.next; + E.push(d), c = d, o = d.next; } if (o !== null || v !== void 0) { - for (var B = v === void 0 ? [] : He(v); o !== null; ) - o.e.f & L || B.push(o), o = o.next; - var ne = B.length; + for (var j = v === void 0 ? [] : Be(v); o !== null; ) + o.e.f & L || j.push(o), o = o.next; + var ne = j.length; if (ne > 0) { - var Un = l & vn && s === 0 ? t : null; + var Hn = l & vn && s === 0 ? t : null; if (i) { for (m = 0; m < ne; m += 1) - (je = B[m].a) == null || je.measure(); + (Ze = j[m].a) == null || Ze.measure(); for (m = 0; m < ne; m += 1) - (ze = B[m].a) == null || ze.fix(); + (ze = j[m].a) == null || ze.fix(); } - Yt(n, B, Un, f); + Ut(n, j, Hn, f); } } i && bt(() => { @@ -1112,20 +1112,20 @@ function Kt(e, n, t, r, l, u) { if (h !== void 0) for (d of h) (Xe = d.a) == null || Xe.apply(); - }), w.first = n.first && n.first.e, w.last = _ && _.e; + }), w.first = n.first && n.first.e, w.last = c && c.e; } -function Wt(e, n, t, r) { - r & Ve && C(e.v, n), r & Be ? C( +function Kt(e, n, t, r) { + r & Ve && C(e.v, n), r & je ? C( /** @type {Value} */ e.i, t ) : e.i = t; } -function Gt(e, n, t, r, l, u, i, c, s) { +function Wt(e, n, t, r, l, u, i, _, s) { var f = Oe; try { - var a = (s & Ve) !== 0, o = (s & Wn) === 0, v = a ? o ? /* @__PURE__ */ gn(l) : D(l) : l, _ = s & Be ? D(i) : i, h = { - i: _, + var a = (s & Ve) !== 0, o = (s & Kn) === 0, v = a ? o ? /* @__PURE__ */ gn(l) : D(l) : l, c = s & je ? D(i) : i, h = { + i: c, v, k: u, a: null, @@ -1134,7 +1134,7 @@ function Gt(e, n, t, r, l, u, i, c, s) { prev: t, next: r }; - return Oe = h, h.e = re(() => c(e, v, _), Bn), h.e.prev = t && t.e, h.e.next = r && r.e, t === null ? n.first = h : (t.next = h, t.e.next = h.e), r !== null && (r.prev = h, r.e.prev = h.e), h; + return Oe = h, h.e = re(() => _(e, v, c), jn), h.e.prev = t && t.e, h.e.next = r && r.e, t === null ? n.first = h : (t.next = h, t.e.next = h.e), r !== null && (r.prev = h, r.e.prev = h.e), h; } finally { Oe = f; } @@ -1157,11 +1157,11 @@ function on(e, n, t) { l.before(u), u = i; } } -function H(e, n, t) { +function B(e, n, t) { n === null ? e.first = t : (n.next = t, n.e.next = t && t.e), t !== null && (t.prev = n, t.e.prev = n && n.e); } let sn = !1; -function Jt() { +function Gt() { sn || (sn = !0, document.addEventListener( "reset", (e) => { @@ -1181,50 +1181,50 @@ function Jt() { )); } function De(e, n) { - var t = e.__className, r = Zt(n); - (t !== r || Bn) && (n == null ? e.removeAttribute("class") : e.className = r, e.__className = r); + var t = e.__className, r = Jt(n); + (t !== r || jn) && (n == null ? e.removeAttribute("class") : e.className = r, e.__className = r); } -function Zt(e) { +function Jt(e) { return e ?? ""; } -function jt(e, n, t, r = t) { +function Zt(e, n, t, r = t) { e.addEventListener(n, t); const l = e.__on_r; l ? e.__on_r = () => { l(), r(); - } : e.__on_r = r, Jt(); + } : e.__on_r = r, Gt(); } function zt(e, n, t = n) { var r = ge(); - jt(e, "input", () => { - var l = cn(e) ? _n(e.value) : e.value; + Zt(e, "input", () => { + var l = _n(e) ? cn(e.value) : e.value; t(l), r && l !== (l = n()) && (e.value = l ?? ""); }), Sn(() => { var l = n(); - cn(e) && l === _n(e.value) || e.type === "date" && !l && !e.value || (e.value = l ?? ""); + _n(e) && l === cn(e.value) || e.type === "date" && !l && !e.value || (e.value = l ?? ""); }); } -function cn(e) { +function _n(e) { var n = e.type; return n === "number" || n === "range"; } -function _n(e) { +function cn(e) { return e === "" ? null : +e; } -function _e(e, n, t, r) { +function ce(e, n, t, r) { var m; - var l = (t & Gn) !== 0, u = (t & Jn) !== 0, i = (t & jn) !== 0, c = (t & zn) !== 0, s = ( + var l = (t & Wn) !== 0, u = (t & Gn) !== 0, i = (t & Zn) !== 0, _ = (t & zn) !== 0, s = ( /** @type {V} */ e[n] ), f = (m = Q(e, n)) == null ? void 0 : m.set, a = ( /** @type {V} */ r - ), o = !0, v = !1, _ = () => (v = !0, o && (o = !1, c ? a = Pt( + ), o = !0, v = !1, c = () => (v = !0, o && (o = !1, _ ? a = Pt( /** @type {() => V} */ r ) : a = /** @type {V} */ r), a); - s === void 0 && r !== void 0 && (f && u && ct(), s = _(), f && f(s)); + s === void 0 && r !== void 0 && (f && u && _t(), s = c(), f && f(s)); var h; if (u) h = () => { @@ -1232,7 +1232,7 @@ function _e(e, n, t, r) { /** @type {V} */ e[n] ); - return y === void 0 ? _() : (o = !0, v = !1, y); + return y === void 0 ? c() : (o = !0, v = !1, y); }; else { var E = (l ? pe : St)( @@ -1247,7 +1247,7 @@ function _e(e, n, t, r) { void 0), y === void 0 ? a : y; }; } - if (!(t & Zn)) + if (!(t & Jn)) return h; if (f) { var S = e.$$legacy; @@ -1259,10 +1259,10 @@ function _e(e, n, t, r) { var y = h(), A = g(p); return k ? (k = !1, A) : p.v = y; }); - return l || (d.equals = Ye), function(y, A) { + return l || (d.equals = Ue), function(y, A) { var T = g(d); if (arguments.length > 0) { - const R = A ? g(d) : u && i ? U(y) : y; + const R = A ? g(d) : u && i ? H(y) : y; return d.equals(R) || (k = !0, C(p, R), v && a !== void 0 && (a = R), g(d)), y; } return T; @@ -1272,13 +1272,13 @@ function Xt(e) { e.key === "ArrowDown" && (e.preventDefault(), e.stopPropagation()); } var Qt = (e, n) => n(), $t = () => { -}, er = (e, n, t) => n(e, g(t)), nr = /* @__PURE__ */ se(' '), tr = /* @__PURE__ */ se(' '), rr = (e, n, t) => n(g(t)), lr = /* @__PURE__ */ se('
  • '), ur = /* @__PURE__ */ se('
      '), ir = /* @__PURE__ */ se('
      ', 1); +}, er = (e, n, t) => n(e, g(t)), nr = /* @__PURE__ */ se(' '), tr = /* @__PURE__ */ se(' '), rr = (e, n, t) => n(g(t)), lr = /* @__PURE__ */ se('
    • '), ur = /* @__PURE__ */ se('
        '), ir = /* @__PURE__ */ se('
        ', 1); function ar(e, n) { Ln(n, !0); - let t = _e(n, "options", 19, () => []), r = _e(n, "inputCssClass", 3, "form-control"), l = _e(n, "selectedOptionCssClass", 3, "badge"), u = _e(n, "placeholder", 3, "Select an option"), i = Ae(U([])), c = Ae(""), s = /* @__PURE__ */ pe(() => t().filter((p) => !g(i).some((d) => d == p)).filter((p) => g(c).trim() === "" || p.includes(g(c)))), f = Ae(!1); + let t = ce(n, "options", 19, () => []), r = ce(n, "inputCssClass", 3, "form-control"), l = ce(n, "selectedOptionCssClass", 3, "badge"), u = ce(n, "placeholder", 3, "Select an option"), i = Ae(H([])), _ = Ae(""), s = /* @__PURE__ */ pe(() => t().filter((p) => !g(i).some((d) => d == p)).filter((p) => g(_).trim() === "" || p.includes(g(_)))), f = Ae(!1); function a(p, d) { var m; - p.preventDefault(), p.stopPropagation(), C(i, U(g(i).filter((y) => y !== d))), (m = n.oninput) == null || m.call(n, ln(g(i))), C(f, !1); + p.preventDefault(), p.stopPropagation(), C(i, H(g(i).filter((y) => y !== d))), (m = n.oninput) == null || m.call(n, ln(g(i))), C(f, !1); } function o(p) { var d; @@ -1287,17 +1287,17 @@ function ar(e, n) { function v() { g(s).length !== 0 && C(f, !0); } - function _(p = null) { + function c(p = null) { if (p === null) { C(f, !1); return; } g(f) === !1 || p.target.closest(".multi-select__items") !== null || p.target.closest(".form-control") !== null || C(f, !1); } - Et(() => (document.addEventListener("click", _), () => document.removeEventListener("click", _))); + Et(() => (document.addEventListener("click", c), () => document.removeEventListener("click", c))); var h = ir(), E = tn(h); - Z(() => De(E, `${(r() + " multi-select").trim() ?? ""} svelte-19g5cm2`)), E.__click = [Qt, v], E.__keydown = [$t]; - var S = G(E); + J(() => De(E, `${(r() + " multi-select").trim() ?? ""} svelte-7bij7h`)), E.__click = [Qt, v], E.__keydown = [$t]; + var S = W(E); un( S, () => g(i).length, @@ -1305,28 +1305,28 @@ function ar(e, n) { var d = Vt(), m = tn(d); an(m, 17, () => g(i), fn, (y, A) => { var T = nr(); - Z(() => De(T, `${(l() + " multi-select__selected").trim() ?? ""} svelte-19g5cm2`)); - var R = G(T), V = Ie(R); - V.__click = [er, a, A], Z(() => Ne(R, `${g(A) ?? ""} `)), j(y, T); - }), j(p, d); + J(() => De(T, `${(l() + " multi-select__selected").trim() ?? ""} svelte-7bij7h`)); + var R = W(T), V = Ie(R); + V.__click = [er, a, A], J(() => Ne(R, `${g(A) ?? ""} `)), Z(y, T); + }), Z(p, d); }, (p) => { - var d = tr(), m = G(d); - Z(() => Ne(m, u())), j(p, d); + var d = tr(), m = W(d); + J(() => Ne(m, u())), Z(p, d); } ); var k = Ie(E, 2); un(k, () => g(f), (p) => { - var d = ur(), m = G(d), y = G(m); - Z(() => De(y, `${(r() + " multi-select__search").trim() ?? ""} svelte-19g5cm2`)), y.__keydown = [Xt]; + var d = ur(), m = W(d), y = W(m); + J(() => De(y, `${(r() + " multi-select__search").trim() ?? ""} svelte-7bij7h`)), y.__keydown = [Xt]; var A = Ie(m, 2); an(A, 21, () => g(s), fn, (T, R) => { - var V = lr(), B = G(V); - B.__click = [rr, o, R]; - var ne = G(B); - Z(() => Ne(ne, g(R))), j(T, V); - }), zt(y, () => g(c), (T) => C(c, T)), j(p, d); - }), j(e, h), qn(); + var V = lr(), j = W(V); + j.__click = [rr, o, R]; + var ne = W(j); + J(() => Ne(ne, g(R))), Z(T, V); + }), zt(y, () => g(_), (T) => C(_, T)), Z(p, d); + }), Z(e, h), qn(); } qt(["click", "keydown"]); export { diff --git a/dist/style.css b/dist/style.css index e1c245a..9eb6a80 100644 --- a/dist/style.css +++ b/dist/style.css @@ -1 +1 @@ -.multi-select.svelte-19g5cm2{display:flex;flex-flow:row wrap;gap:4px;anchor-name:--multiselect;height:auto;-webkit-user-select:none;user-select:none}.multi-select.svelte-19g5cm2 .multi-select__selected:where(.svelte-19g5cm2){cursor:default}.multi-select.svelte-19g5cm2 .multi-select__remove:where(.svelte-19g5cm2){all:unset;cursor:pointer;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:400;line-height:.6}.multi-select__placeholder.svelte-19g5cm2{color:#999}.multi-select__items.svelte-19g5cm2{box-sizing:border-box;border:1px solid #ccc;display:grid;grid-template-rows:min-content fit-content(78%);position-anchor:--multiselect;position:fixed;top:anchor(bottom);left:anchor(left);right:anchor(right);max-height:200px}.multi-select__items.svelte-19g5cm2 ul:where(.svelte-19g5cm2){all:unset;background-color:#fff;box-sizing:border-box;list-style:none outside none;overflow:auto}.multi-select__items.svelte-19g5cm2 ul:where(.svelte-19g5cm2) button:where(.svelte-19g5cm2){all:unset;display:block;cursor:pointer;width:100%;padding:2px 5px;box-sizing:border-box;text-align:left}.multi-select__items.svelte-19g5cm2 ul:where(.svelte-19g5cm2) button:where(.svelte-19g5cm2):hover,.multi-select__items.svelte-19g5cm2 ul:where(.svelte-19g5cm2) button:where(.svelte-19g5cm2):focus{background-color:#ccc}.multi-select__search-box.svelte-19g5cm2{border-bottom:1px solid #ccc;padding:5px}.multi-select__search.svelte-19g5cm2{border:1px solid #ccc;border-radius:3px;background-color:#fff;display:block;width:100%} +.multi-select.svelte-7bij7h{display:flex;flex-flow:row wrap;gap:4px;anchor-name:--multiselect;height:auto;-webkit-user-select:none;user-select:none}.multi-select.svelte-7bij7h .multi-select__selected:where(.svelte-7bij7h){cursor:default}.multi-select.svelte-7bij7h .multi-select__remove:where(.svelte-7bij7h){all:unset;cursor:pointer;display:inline-flex;font-family:inherit;font-size:inherit;font-weight:400;line-height:.6}.multi-select__placeholder.svelte-7bij7h{color:#999}.multi-select__items.svelte-7bij7h{background-color:#fff;box-sizing:border-box;border:1px solid #ccc;display:grid;grid-template-rows:min-content fit-content(78%);position-anchor:--multiselect;position:fixed;top:anchor(bottom);left:anchor(left);right:anchor(right);max-height:200px}.multi-select__items.svelte-7bij7h ul:where(.svelte-7bij7h){all:unset;box-sizing:border-box;list-style:none outside none;overflow:auto}.multi-select__items.svelte-7bij7h ul:where(.svelte-7bij7h) button:where(.svelte-7bij7h){all:unset;display:block;cursor:pointer;width:100%;padding:2px 5px;box-sizing:border-box;text-align:left}.multi-select__items.svelte-7bij7h ul:where(.svelte-7bij7h) button:where(.svelte-7bij7h):hover,.multi-select__items.svelte-7bij7h ul:where(.svelte-7bij7h) button:where(.svelte-7bij7h):focus{background-color:#ccc}.multi-select__search-box.svelte-7bij7h{border-bottom:1px solid #ccc;padding:5px}.multi-select__search.svelte-7bij7h{border:1px solid #ccc;border-radius:3px;background-color:#fff;display:block;width:100%} diff --git a/src/MultiSelect.svelte b/src/MultiSelect.svelte index a9f9e11..1b5e5f6 100644 --- a/src/MultiSelect.svelte +++ b/src/MultiSelect.svelte @@ -135,6 +135,7 @@ } .multi-select__items { + background-color: #fff; box-sizing: border-box; border: 1px solid #ccc; display: grid; @@ -148,7 +149,6 @@ ul { all: unset; - background-color: #fff; box-sizing: border-box; list-style: none outside none; overflow: auto;