@virtuoso.dev/message-list
Advanced tools
Comparing version 1.9.4 to 1.9.5
@@ -0,1 +1,9 @@ | ||
## [1.9.5](https://github.com/virtuoso-dev/message-list/compare/v1.9.4...v1.9.5) (2024-11-08) | ||
### Bug Fixes | ||
* experimental fix for mobile safari ([7cd5353](https://github.com/virtuoso-dev/message-list/commit/7cd535363ab8e167d035b0bd87483294e889c407)) | ||
* limit the currently rendered items ([80bcbed](https://github.com/virtuoso-dev/message-list/commit/80bcbed6e80f4daa62c2ca72b2958ec32b81a90f)) | ||
## [1.9.4](https://github.com/virtuoso-dev/message-list/compare/v1.9.3...v1.9.4) (2024-11-07) | ||
@@ -2,0 +10,0 @@ |
1071
dist/index.js
@@ -1,4 +0,4 @@ | ||
import { jsxs as en, jsx as T, Fragment as po } from "react/jsx-runtime"; | ||
import { jsxs as tn, jsx as T, Fragment as fo } from "react/jsx-runtime"; | ||
import g from "react"; | ||
import { Cell as u, Signal as S, throttleTime as Ht, map as f, mapTo as V, debounceTime as be, filter as d, scan as te, withLatestFrom as k, delayWithMicrotask as Vt, onNext as tn, Action as Ft, useRealm as _t, useCellValue as H, Realm as fo, RealmContext as ho, useCellValues as go } from "@mdxeditor/gurx"; | ||
import { Cell as u, Signal as S, throttleTime as Vt, map as f, mapTo as V, debounceTime as be, filter as d, scan as G, withLatestFrom as I, delayWithMicrotask as Ft, onNext as nn, Action as _t, useRealm as Wt, useCellValue as B, Realm as ho, RealmContext as go, useCellValues as vo } from "@mdxeditor/gurx"; | ||
function ke(e, t) { | ||
@@ -10,30 +10,30 @@ const n = u(e, (o) => { | ||
} | ||
const ye = { lvl: 0 }; | ||
function nn(e, t, n, o = ye, s = ye) { | ||
const Te = { lvl: 0 }; | ||
function on(e, t, n, o = Te, s = Te) { | ||
return { k: e, l: o, lvl: n, r: s, v: t }; | ||
} | ||
function I(e) { | ||
return e === ye; | ||
function k(e) { | ||
return e === Te; | ||
} | ||
function Re() { | ||
return ye; | ||
function Me() { | ||
return Te; | ||
} | ||
function yt(e, t) { | ||
if (I(e)) | ||
return ye; | ||
function Tt(e, t) { | ||
if (k(e)) | ||
return Te; | ||
const { k: n, l: o, r: s } = e; | ||
if (t === n) { | ||
if (I(o)) | ||
if (k(o)) | ||
return s; | ||
if (I(s)) | ||
if (k(s)) | ||
return o; | ||
{ | ||
const [i, r] = on(o); | ||
return tt(R(e, { k: i, l: sn(o), v: r })); | ||
const [i, r] = sn(o); | ||
return tt(R(e, { k: i, l: rn(o), v: r })); | ||
} | ||
} else | ||
return t < n ? tt(R(e, { l: yt(o, t) })) : tt(R(e, { r: yt(s, t) })); | ||
return t < n ? tt(R(e, { l: Tt(o, t) })) : tt(R(e, { r: Tt(s, t) })); | ||
} | ||
function ce(e, t, n = "k") { | ||
if (I(e)) | ||
if (k(e)) | ||
return [-1 / 0, void 0]; | ||
@@ -49,15 +49,15 @@ if (e[n] === t) | ||
function F(e, t, n) { | ||
return I(e) ? nn(t, n, 1) : t === e.k ? R(e, { k: t, v: n }) : t < e.k ? qt(R(e, { l: F(e.l, t, n) })) : qt(R(e, { r: F(e.r, t, n) })); | ||
return k(e) ? on(t, n, 1) : t === e.k ? R(e, { k: t, v: n }) : t < e.k ? Gt(R(e, { l: F(e.l, t, n) })) : Gt(R(e, { r: F(e.r, t, n) })); | ||
} | ||
function Tt(e, t, n) { | ||
if (I(e)) | ||
function $t(e, t, n) { | ||
if (k(e)) | ||
return []; | ||
const { k: o, v: s, l: i, r } = e; | ||
let l = []; | ||
return o > t && (l = l.concat(Tt(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat(Tt(r, t, n))), l; | ||
return o > t && (l = l.concat($t(i, t, n))), o >= t && o <= n && l.push({ k: o, v: s }), o <= n && (l = l.concat($t(r, t, n))), l; | ||
} | ||
function vo(e, t, n, o) { | ||
if (I(e)) | ||
return ye; | ||
let s = Re(); | ||
function bo(e, t, n, o) { | ||
if (k(e)) | ||
return Te; | ||
let s = Me(); | ||
for (const { k: i, v: r } of me(e)) | ||
@@ -67,5 +67,5 @@ i > t && i <= n ? s = F(s, ...o(i, r)) : s = F(s, i, r); | ||
} | ||
function bo(e, t, n) { | ||
let o = Re(), s = -1; | ||
for (const { start: i, end: r, value: l } of mo(e)) | ||
function mo(e, t, n) { | ||
let o = Me(), s = -1; | ||
for (const { start: i, end: r, value: l } of Io(e)) | ||
i < t ? (o = F(o, i, l), s = l) : i > t + n ? o = F(o, i - n, l) : r >= t + n && s !== l && (o = F(o, t, l)); | ||
@@ -75,18 +75,18 @@ return o; | ||
function me(e) { | ||
return I(e) ? [] : [...me(e.l), { k: e.k, v: e.v }, ...me(e.r)]; | ||
return k(e) ? [] : [...me(e.l), { k: e.k, v: e.v }, ...me(e.r)]; | ||
} | ||
function on(e) { | ||
return I(e.r) ? [e.k, e.v] : on(e.r); | ||
} | ||
function sn(e) { | ||
return I(e.r) ? e.l : tt(R(e, { r: sn(e.r) })); | ||
return k(e.r) ? [e.k, e.v] : sn(e.r); | ||
} | ||
function rn(e) { | ||
return k(e.r) ? e.l : tt(R(e, { r: rn(e.r) })); | ||
} | ||
function R(e, t) { | ||
return nn(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r); | ||
return on(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r); | ||
} | ||
function It(e) { | ||
return I(e) || e.lvl > e.r.lvl; | ||
function xt(e) { | ||
return k(e) || e.lvl > e.r.lvl; | ||
} | ||
function qt(e) { | ||
return $t(cn(e)); | ||
function Gt(e) { | ||
return Et(an(e)); | ||
} | ||
@@ -98,5 +98,5 @@ function tt(e) { | ||
if (o > n.lvl + 1) { | ||
if (It(t)) | ||
return cn(R(e, { lvl: o - 1 })); | ||
if (!I(t) && !I(t.r)) | ||
if (xt(t)) | ||
return an(R(e, { lvl: o - 1 })); | ||
if (!k(t) && !k(t.r)) | ||
return R(t.r, { | ||
@@ -112,6 +112,6 @@ l: R(t, { r: t.r.l }), | ||
} else { | ||
if (It(e)) | ||
return $t(R(e, { lvl: o - 1 })); | ||
if (!I(n) && !I(n.l)) { | ||
const s = n.l, i = It(s) ? n.lvl - 1 : n.lvl; | ||
if (xt(e)) | ||
return Et(R(e, { lvl: o - 1 })); | ||
if (!k(n) && !k(n.l)) { | ||
const s = n.l, i = xt(s) ? n.lvl - 1 : n.lvl; | ||
return R(s, { | ||
@@ -123,3 +123,3 @@ l: R(e, { | ||
lvl: s.lvl + 1, | ||
r: $t(R(n, { l: s.r, lvl: i })) | ||
r: Et(R(n, { l: s.r, lvl: i })) | ||
}); | ||
@@ -130,12 +130,12 @@ } else | ||
} | ||
function mo(e) { | ||
return un(me(e)); | ||
function Io(e) { | ||
return cn(me(e)); | ||
} | ||
function rn(e, t, n) { | ||
if (I(e)) | ||
function ln(e, t, n) { | ||
if (k(e)) | ||
return []; | ||
const o = ce(e, t)[0]; | ||
return un(Tt(e, o, n)); | ||
return cn($t(e, o, n)); | ||
} | ||
function ln(e, t) { | ||
function un(e, t) { | ||
const n = e.length; | ||
@@ -152,12 +152,12 @@ if (n === 0) | ||
} | ||
function un(e) { | ||
return ln(e, ({ k: t, v: n }) => ({ index: t, value: n })); | ||
function cn(e) { | ||
return un(e, ({ k: t, v: n }) => ({ index: t, value: n })); | ||
} | ||
function $t(e) { | ||
function Et(e) { | ||
const { r: t, lvl: n } = e; | ||
return !I(t) && !I(t.r) && t.lvl === n && t.r.lvl === n ? R(t, { l: R(e, { r: t.l }), lvl: n + 1 }) : e; | ||
return !k(t) && !k(t.r) && t.lvl === n && t.r.lvl === n ? R(t, { l: R(e, { r: t.l }), lvl: n + 1 }) : e; | ||
} | ||
function cn(e) { | ||
function an(e) { | ||
const { l: t } = e; | ||
return !I(t) && t.lvl === e.lvl ? R(t, { r: R(e, { l: t.r }) }) : e; | ||
return !k(t) && t.lvl === e.lvl ? R(t, { r: R(e, { l: t.r }) }) : e; | ||
} | ||
@@ -168,11 +168,11 @@ function ko(e) { | ||
} | ||
function Io(e, t) { | ||
let n = I(e) ? 0 : 1 / 0; | ||
function xo(e, t) { | ||
let n = k(e) ? 0 : 1 / 0; | ||
for (const o of t) { | ||
const { size: s, startIndex: i, endIndex: r } = o; | ||
if (n = Math.min(n, i), I(e)) { | ||
if (n = Math.min(n, i), k(e)) { | ||
e = F(e, 0, s); | ||
continue; | ||
} | ||
const l = rn(e, i - 1, r + 1); | ||
const l = ln(e, i - 1, r + 1); | ||
if (l.some(ko(o))) | ||
@@ -182,3 +182,3 @@ continue; | ||
for (const { start: p, end: v, value: m } of l) | ||
c ? (r >= p || s === m) && (e = yt(e, p)) : (a = m !== s, c = !0), v > r && r >= p && m !== s && (e = F(e, r + 1, m)); | ||
c ? (r >= p || s === m) && (e = Tt(e, p)) : (a = m !== s, c = !0), v > r && r >= p && m !== s && (e = F(e, r + 1, m)); | ||
a && (e = F(e, i, s)); | ||
@@ -188,14 +188,14 @@ } | ||
} | ||
const ft = [Re(), 0]; | ||
function xo(e, [t, n]) { | ||
if (n.length > 0 && I(e) && t.length === 2) { | ||
const ht = [Me(), 0]; | ||
function So(e, [t, n]) { | ||
if (n.length > 0 && k(e) && t.length === 2) { | ||
const o = t[0].size, s = t[1].size; | ||
return [ | ||
n.reduce((i, r) => F(F(i, r, o), r + 1, s), Re()), | ||
n.reduce((i, r) => F(F(i, r, o), r + 1, s), Me()), | ||
0 | ||
]; | ||
} else | ||
return Io(e, t); | ||
return xo(e, t); | ||
} | ||
function ut(e, t, n, o = 0) { | ||
function ct(e, t, n, o = 0) { | ||
let s = e.length - 1; | ||
@@ -218,26 +218,26 @@ for (; o <= s; ) { | ||
} | ||
function an(e, t, n) { | ||
return e[ut(e, t, n)]; | ||
function pn(e, t, n) { | ||
return e[ct(e, t, n)]; | ||
} | ||
function So(e, t, n, o) { | ||
const s = ut(e, t, o), i = ut(e, n, o, s); | ||
function yo(e, t, n, o) { | ||
const s = ct(e, t, o), i = ct(e, n, o, s); | ||
return e.slice(s, i + 1); | ||
} | ||
function Wt({ index: e }, t) { | ||
function Pt({ index: e }, t) { | ||
return t === e ? 0 : t < e ? -1 : 1; | ||
} | ||
function yo({ offset: e }, t) { | ||
function To({ offset: e }, t) { | ||
return t === e ? 0 : t < e ? -1 : 1; | ||
} | ||
function To(e) { | ||
function $o(e) { | ||
return { index: e.index, value: e }; | ||
} | ||
function $o(e, t, n, o = 0) { | ||
return o > 0 && (t = Math.max(t, an(e, o, Wt).offset)), t = Math.max(0, t), ln(So(e, t, n, yo), To); | ||
function Eo(e, t, n, o = 0) { | ||
return o > 0 && (t = Math.max(t, pn(e, o, Pt).offset)), t = Math.max(0, t), un(yo(e, t, n, To), $o); | ||
} | ||
const Te = [[], 0, 0, 0]; | ||
function Eo(e, [t, n]) { | ||
const $e = [[], 0, 0, 0]; | ||
function wo(e, [t, n]) { | ||
let o = 0, s = 0, i = 0, r = 0; | ||
if (n !== 0) { | ||
r = ut(e, n - 1, Wt), i = e[r].offset; | ||
r = ct(e, n - 1, Pt), i = e[r].offset; | ||
const c = ce(t, n - 1); | ||
@@ -247,3 +247,3 @@ o = c[0], s = c[1], e.length && e[r].height === ce(t, n)[1] && (r -= 1), e = e.slice(0, r + 1); | ||
e = []; | ||
for (const { start: l, value: c } of rn(t, n, 1 / 0)) { | ||
for (const { start: l, value: c } of ln(t, n, 1 / 0)) { | ||
const a = (l - o) * s + i; | ||
@@ -254,18 +254,18 @@ e.push({ height: c, index: l, offset: a }), o = l, i = a, s = c; | ||
} | ||
function pn(e, t) { | ||
function fn(e, t) { | ||
if (t.length === 0) | ||
return [0, 0]; | ||
const { offset: n, index: o, height: s } = an(t, e, Wt); | ||
const { offset: n, index: o, height: s } = pn(t, e, Pt); | ||
return [s * (e - o) + n, s]; | ||
} | ||
function Et(e, t) { | ||
return pn(e, t)[0]; | ||
function wt(e, t) { | ||
return fn(e, t)[0]; | ||
} | ||
function fn(e, t) { | ||
function hn(e, t) { | ||
return Math.abs(e - t) < 1.01; | ||
} | ||
function wo() { | ||
function gn() { | ||
return typeof navigator > "u" ? !1 : /Macintosh/i.test(navigator.userAgent) && navigator.maxTouchPoints && navigator.maxTouchPoints > 1 || /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent); | ||
} | ||
function hn(e) { | ||
function dn(e) { | ||
return !e; | ||
@@ -276,3 +276,3 @@ } | ||
} | ||
function gn(e = 1) { | ||
function vn(e = 1) { | ||
return (t, n) => { | ||
@@ -289,3 +289,3 @@ const o = n.signalInstance(); | ||
} | ||
const dn = "up", xt = "down", Ro = "none", Mo = { | ||
const bn = "up", St = "down", Ro = "none", Mo = { | ||
atBottom: !1, | ||
@@ -301,3 +301,3 @@ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM", | ||
}, Ao = 0, Co = 4; | ||
function Gt(e) { | ||
function Zt(e) { | ||
return (t, n) => { | ||
@@ -311,7 +311,7 @@ const o = n.signalInstance(); | ||
u(!1); | ||
const vn = u(!0); | ||
const mn = u(!0); | ||
S(); | ||
const ge = u(!1), Do = S((e) => { | ||
e.link(e.pipe(vn, Ht(50)), Do); | ||
}), bn = u(Co), Oo = u(Ao, (e) => { | ||
e.link(e.pipe(mn, Vt(50)), Do); | ||
}), In = u(Co), Oo = u(Ao, (e) => { | ||
e.link( | ||
@@ -322,9 +322,9 @@ e.pipe( | ||
), | ||
vn | ||
mn | ||
); | ||
}), Ne = u(!1, (e) => { | ||
e.link(e.pipe($, Gt(1), V(!0)), Ne), e.link(e.pipe($, Gt(1), V(!1), be(100)), Ne); | ||
}), wt = u(!1, (e) => { | ||
e.link(e.pipe(se, V(!0)), wt), e.link(e.pipe(se, V(!1), be(200)), wt); | ||
}), mn = u(!1), nt = u( | ||
e.link(e.pipe($, Zt(1), V(!0)), Ne), e.link(e.pipe($, Zt(1), V(!1), be(100)), Ne); | ||
}), Lt = u(!1, (e) => { | ||
e.link(e.pipe(se, V(!0)), Lt), e.link(e.pipe(se, V(!1), be(200)), Lt); | ||
}), kn = u(!1), nt = u( | ||
null, | ||
@@ -335,13 +335,13 @@ (e) => { | ||
e.combine( | ||
U, | ||
K, | ||
$, | ||
G, | ||
En, | ||
bn, | ||
pt, | ||
dt, | ||
q | ||
J, | ||
Ln, | ||
In, | ||
ft, | ||
vt, | ||
Z | ||
), | ||
d(([, , , , , , , t]) => !I(t)), | ||
te((t, [n, o, s, i, r, l]) => { | ||
d(([, , , , , , , t]) => !k(t)), | ||
G((t, [n, o, s, i, r, l]) => { | ||
const a = o + s - n + l > -r, p = { | ||
@@ -375,3 +375,3 @@ viewportWidth: i, | ||
nt, | ||
te( | ||
G( | ||
({ prev: t }, n) => { | ||
@@ -388,8 +388,8 @@ const o = !!(t && n && t.atBottom && !n.atBottom && n.notAtBottomBecause === "SIZE_INCREASED"); | ||
), | ||
mn | ||
kn | ||
), e.sub( | ||
e.pipe( | ||
G, | ||
k(nt), | ||
te( | ||
J, | ||
I(nt), | ||
G( | ||
(t, [n, o]) => { | ||
@@ -408,9 +408,9 @@ let s = 0; | ||
(e, t) => !e || e.atBottom !== (t == null ? void 0 : t.atBottom) ? !1 : !e.atBottom && !t.atBottom ? e.notAtBottomBecause === t.notAtBottomBecause : !0 | ||
), kn = u(0, (e) => { | ||
), xn = u(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine($, U, G), | ||
te( | ||
e.combine($, K, J), | ||
G( | ||
(t, [n, o, s]) => { | ||
if (fn(t.scrollHeight, o)) | ||
if (hn(t.scrollHeight, o)) | ||
return { | ||
@@ -442,30 +442,30 @@ scrollTop: n, | ||
), | ||
kn | ||
xn | ||
); | ||
}), Lt = u(xt, (e) => { | ||
}), Rt = u(St, (e) => { | ||
e.link( | ||
e.pipe( | ||
$, | ||
te( | ||
(t, n) => e.getValue(wt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? dn : xt, prevScrollTop: n }, | ||
{ direction: xt, prevScrollTop: 0 } | ||
G( | ||
(t, n) => e.getValue(Lt) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? bn : St, prevScrollTop: n }, | ||
{ direction: St, prevScrollTop: 0 } | ||
), | ||
f((t) => t.direction) | ||
), | ||
Lt | ||
), e.link(e.pipe($, be(100), V(Ro)), Lt); | ||
}), Zt = u(0, (e) => { | ||
e.link(e.pipe(Ne, d(hn), V(0)), Zt), e.link( | ||
Rt | ||
), e.link(e.pipe($, be(100), V(Ro)), Rt); | ||
}), Jt = u(0, (e) => { | ||
e.link(e.pipe(Ne, d(dn), V(0)), Jt), e.link( | ||
e.pipe( | ||
$, | ||
Ht(100), | ||
k(Ne), | ||
Vt(100), | ||
I(Ne), | ||
d(([, t]) => !!t), | ||
te(([, t], [n]) => [t, n], [0, 0]), | ||
G(([, t], [n]) => [t, n], [0, 0]), | ||
f(([t, n]) => n - t) | ||
), | ||
Zt | ||
Jt | ||
); | ||
}); | ||
function Pt(e, t) { | ||
function Nt(e, t) { | ||
if (typeof e == "number") | ||
@@ -486,3 +486,3 @@ return { | ||
} | ||
function In({ | ||
function Sn({ | ||
location: e, | ||
@@ -498,3 +498,3 @@ sizeTree: t, | ||
}) { | ||
const { align: a, behavior: p, offset: v, index: m } = Pt(e, s - 1); | ||
const { align: a, behavior: p, offset: v, index: m } = Nt(e, s - 1); | ||
function y() { | ||
@@ -507,3 +507,3 @@ const P = ce(t, m)[1]; | ||
i -= l + c; | ||
let x = Et(m, n) + r - l; | ||
let x = wt(m, n) + r - l; | ||
a === "end" ? x = x - i + y() : a === "center" && (x = x - i / 2 + y() / 2), v && (x += v); | ||
@@ -513,6 +513,6 @@ let b = 0; | ||
} | ||
const He = u(null), Bo = u(!1), ot = u(!0), Rt = S((e) => { | ||
const Be = u(null), Ho = u(!1), ot = u(!0), Mt = S((e) => { | ||
e.link( | ||
e.pipe( | ||
Rt, | ||
Mt, | ||
f(() => !0) | ||
@@ -523,15 +523,15 @@ ), | ||
e.pipe( | ||
Rt, | ||
Mt, | ||
f(() => null) | ||
), | ||
He | ||
Be | ||
); | ||
}), xn = S((e) => { | ||
}), yn = S((e) => { | ||
e.link( | ||
e.pipe( | ||
xn, | ||
k(Ie, we, Ge), | ||
yn, | ||
I(xe, Le, Ge), | ||
f(([t, n, o, s]) => { | ||
let { align: i, behavior: r, offset: l, index: c } = Pt(t, n - 1); | ||
const a = typeof t != "number" ? t.done : void 0, [p, v] = pn(c, o); | ||
let { align: i, behavior: r, offset: l, index: c } = Nt(t, n - 1); | ||
const a = typeof t != "number" ? t.done : void 0, [p, v] = fn(c, o); | ||
return p < -s.listOffset ? ((typeof t == "number" || t.align === void 0) && (i = "start-no-overflow"), { index: c, align: i, behavior: r, offset: l, done: a }) : p + v > -s.listOffset + s.visibleListHeight ? ((typeof t == "number" || t.align === void 0) && (i = "end"), { index: c, align: i, behavior: r, offset: l, done: a }) : null; | ||
@@ -542,16 +542,16 @@ }), | ||
// @ts-expect-error contra variance | ||
ee | ||
ne | ||
); | ||
}), ee = S((e) => { | ||
}), ne = S((e) => { | ||
const t = e.pipe( | ||
ee, | ||
k( | ||
q, | ||
we, | ||
Ie, | ||
G, | ||
gt, | ||
je, | ||
ne, | ||
I( | ||
Z, | ||
Le, | ||
xe, | ||
J, | ||
dt, | ||
Ke, | ||
qe, | ||
Ae | ||
Ie | ||
), | ||
@@ -561,3 +561,3 @@ f( | ||
try { | ||
return In({ | ||
return Sn({ | ||
location: n, | ||
@@ -580,5 +580,5 @@ totalHeight: p, | ||
); | ||
e.link(ee, He), e.link(t, Le), e.link( | ||
e.link(ne, Be), e.link(t, Re), e.link( | ||
e.pipe( | ||
ee, | ||
ne, | ||
d((n) => typeof n != "number" && n.index === "LAST"), | ||
@@ -588,16 +588,16 @@ V(!0) | ||
ge | ||
), e.link(e.pipe(t, V(!1)), ot), e.link(e.pipe(t, V(!1)), Bo), e.link( | ||
), e.link(e.pipe(t, V(!1)), ot), e.link(e.pipe(t, V(!1)), Ho), e.link( | ||
e.pipe( | ||
q, | ||
Z, | ||
// wait for the list to render with the specified sizeTree, so that enough space is available to scroll by | ||
be(0), | ||
k(ot, He), | ||
I(ot, Be), | ||
d(([, n, o]) => !n && o !== null), | ||
f(([, , n]) => n) | ||
), | ||
ee | ||
), e.sub(e.pipe(Ke, be(10)), () => { | ||
const n = e.getValue(He); | ||
ne | ||
), e.sub(e.pipe(je, be(10)), () => { | ||
const n = e.getValue(Be); | ||
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({ | ||
[He]: null, | ||
[Be]: null, | ||
[ot]: !0 | ||
@@ -609,3 +609,3 @@ }); | ||
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by | ||
Vt(), | ||
Ft(), | ||
d((n) => n !== 0) | ||
@@ -617,3 +617,3 @@ ), | ||
rt, | ||
tn($), | ||
nn($), | ||
f(() => 0) | ||
@@ -623,6 +623,6 @@ ), | ||
); | ||
}), Fe = u(null), $e = u(null, (e) => { | ||
}), Fe = u(null), Ee = u(null, (e) => { | ||
e.link( | ||
e.pipe( | ||
$e, | ||
Ee, | ||
d((n) => n !== null) | ||
@@ -633,11 +633,11 @@ ), | ||
const t = e.pipe( | ||
e.combine($e, q), | ||
k(Fe), | ||
d(([[n, o], s]) => n !== null && !I(o) && s !== null), | ||
e.combine(Ee, Z), | ||
I(Fe), | ||
d(([[n, o], s]) => n !== null && !k(o) && s !== null), | ||
f(([[n]]) => n) | ||
); | ||
e.link(e.pipe(t, Vt()), ee), e.link( | ||
e.link(e.pipe(t, Ft()), ne), e.link( | ||
e.pipe( | ||
t, | ||
tn(e.pipe(Ye, d(hn))), | ||
nn(e.pipe(Ye, d(dn))), | ||
V(null) | ||
@@ -649,3 +649,3 @@ // unset the location after the scroll completes | ||
}); | ||
function Ho(e, t) { | ||
function Bo(e, t) { | ||
const n = t.slice(); | ||
@@ -661,3 +661,3 @@ let o = 0; | ||
}); | ||
let i = Re(); | ||
let i = Me(); | ||
return s.forEach(({ k: r, v: l }) => { | ||
@@ -689,3 +689,3 @@ i = F(i, r, l); | ||
data: null | ||
}, Me = u(Ve, (e) => { | ||
}, Ae = u(Ve, (e) => { | ||
e.link( | ||
@@ -695,17 +695,17 @@ e.pipe( | ||
_o, | ||
Rn, | ||
q, | ||
we, | ||
An, | ||
Z, | ||
Le, | ||
xe, | ||
Ie, | ||
Ae, | ||
E, | ||
w, | ||
rt, | ||
$e, | ||
Ee, | ||
Fe, | ||
Ue, | ||
je, | ||
Ke, | ||
qe, | ||
W, | ||
ve, | ||
j | ||
q | ||
), | ||
@@ -716,3 +716,3 @@ d((t) => { | ||
}), | ||
te( | ||
G( | ||
(t, [ | ||
@@ -737,8 +737,8 @@ n, | ||
return Ve; | ||
if (I(s)) { | ||
if (k(s)) { | ||
let z = 0; | ||
return p !== null && (z = Pt(p, r - 1).index), { ...Ve, items: Vo(z, c), offsetTree: i, totalCount: r, data: c }; | ||
return p !== null && (z = Nt(p, r - 1).index), { ...Ve, items: Vo(z, c), offsetTree: i, totalCount: r, data: c }; | ||
} | ||
let P = 0; | ||
v !== null && n === 0 && (P = In({ | ||
v !== null && n === 0 && (P = Sn({ | ||
totalHeight: l, | ||
@@ -749,23 +749,23 @@ location: v, | ||
totalCount: r, | ||
viewportHeight: e.getValue(G), | ||
headerHeight: e.getValue(gt), | ||
viewportHeight: e.getValue(J), | ||
headerHeight: e.getValue(dt), | ||
stickyHeaderHeight: y, | ||
stickyFooterHeight: x | ||
}).top ?? 0); | ||
const K = Math.min( | ||
const U = Math.min( | ||
Math.max(n + P + a - b - m, 0), | ||
l - o | ||
), Z = K + o; | ||
if (t.offsetTree === i && t.totalCount === r && t.data === c && K >= t.listTop && Z <= t.listBottom) | ||
), X = U + o; | ||
if (t.offsetTree === i && t.totalCount === r && t.data === c && U >= t.listTop && X <= t.listBottom) | ||
return t; | ||
const J = [], X = r - 1, N = 0, M = $o(i, K, Z, N); | ||
const Q = [], ee = r - 1, N = 0, M = Eo(i, U, X, N); | ||
let A = 0, pe = 0, Ze = !1; | ||
for (const z of M) { | ||
const { | ||
value: { offset: xe, height: ie } | ||
value: { offset: Se, height: ie } | ||
} = z; | ||
let Q = z.start; | ||
A = xe, xe < K && (Q += Math.floor((K - xe) / ie), A += (Q - z.start) * ie), Q < N && (A += (N - Q) * ie, Q = N); | ||
const Ce = Math.min(z.end, X); | ||
for (let re = Q; re <= Ce && !(A >= Z); re++) { | ||
let te = z.start; | ||
A = Se, Se < U && (te += Math.floor((U - Se) / ie), A += (te - z.start) * ie), te < N && (A += (N - te) * ie, te = N); | ||
const Ce = Math.min(z.end, ee); | ||
for (let re = te; re <= Ce && !(A >= X); re++) { | ||
const De = { | ||
@@ -780,7 +780,7 @@ data: c == null ? void 0 : c[re], | ||
}; | ||
Ze || (Ze = !0, pe = A), J.push(De), A += ie; | ||
Ze || (Ze = !0, pe = A), Q.push(De), A += ie; | ||
} | ||
} | ||
const w = l - A, ne = ((Je = J[0]) == null ? void 0 : Je.offset) || 0; | ||
return { items: J, listBottom: A, listTop: pe, offsetTree: i, paddingBottom: w, paddingTop: ne, totalCount: r, data: c }; | ||
const E = l - A, oe = ((Je = Q[0]) == null ? void 0 : Je.offset) || 0; | ||
return { items: Q, listBottom: A, listTop: pe, offsetTree: i, paddingBottom: E, paddingTop: oe, totalCount: r, data: c }; | ||
}, | ||
@@ -790,14 +790,19 @@ Ve | ||
), | ||
Me | ||
Ae | ||
); | ||
}), ct = ke([], (e) => e.pipe( | ||
e.combine(Me, $), | ||
f(([t]) => t.items.slice().map((o) => o.data)) | ||
)), j = u(!1), _e = u(!1), st = S((e) => { | ||
}), at = ke([], (e) => e.pipe( | ||
e.combine(Ae, $), | ||
f(([t, n]) => { | ||
const o = t.items.slice(); | ||
for (; o.length > 0 && o[0].offset + o[0].height < n; ) | ||
o.shift(); | ||
return o.map((s) => s.data); | ||
}) | ||
)), q = u(!1), _e = u(!1), st = S((e) => { | ||
e.link( | ||
e.pipe( | ||
Me, | ||
k(kn, ve), | ||
Ae, | ||
I(xn, ve), | ||
d(([, , t]) => !t), | ||
te( | ||
G( | ||
([, t, n, o], [{ items: s, totalCount: i, listBottom: r, paddingBottom: l }, c]) => { | ||
@@ -811,8 +816,8 @@ const a = r + l; | ||
d(([t]) => t !== 0), | ||
k($, Lt, Ye), | ||
d(([, t, n, o]) => !o && t !== 0 && n === dn), | ||
I($, Rt, Ye), | ||
d(([, t, n, o]) => !o && t !== 0 && n === bn), | ||
f(([[t]]) => t) | ||
), | ||
st | ||
), wo() ? (e.sub(e.pipe(st, k(W, $)), ([t, n]) => { | ||
), gn() ? (e.sub(e.pipe(st, I(W, $)), ([t, n]) => { | ||
e.pub(W, n - t); | ||
@@ -822,12 +827,12 @@ }), e.sub( | ||
([t, n, o, s]) => { | ||
o || s || (n > 0 && t < n ? (e.pub(j, !0), e.pub(Le, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
o || s || (n > 0 && t < n ? (e.pub(q, !0), e.pub(Re, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
e.pubIn({ | ||
[j]: !1, | ||
[q]: !1, | ||
[W]: 0 | ||
}); | ||
})) : n < 0 && t <= 0 && (e.pubIn({ | ||
[j]: !0, | ||
[q]: !0, | ||
[W]: 0 | ||
}), setTimeout(() => { | ||
e.pub(Le, { top: 0, behavior: "instant" }), e.pub(j, !1); | ||
e.pub(Re, { top: 0, behavior: "instant" }), e.pub(q, !1); | ||
}))); | ||
@@ -837,16 +842,16 @@ } | ||
e.pipe( | ||
e.combine(Ne, W, j, ve, _e), | ||
e.combine(Ne, W, q, ve, _e), | ||
d( | ||
([t, n, o, s, i]) => !t && n !== 0 && !o && !s && !i | ||
), | ||
Ht(100) | ||
Vt(100) | ||
), | ||
([, t]) => { | ||
e.pub(j, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(q, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(se, -t), e.pub(W, 0), requestAnimationFrame(() => { | ||
e.pub(j, !1); | ||
e.pub(q, !1); | ||
}); | ||
}) : requestAnimationFrame(() => { | ||
e.pub(se, -t), e.pub(W, 0), requestAnimationFrame(() => { | ||
e.pub(j, !1); | ||
e.pub(q, !1); | ||
}); | ||
@@ -856,29 +861,29 @@ }); | ||
)) : e.link(st, se); | ||
}), Ie = u(0), ze = u(null), E = u(null, (e) => { | ||
}), xe = u(0), ze = u(null), w = u(null, (e) => { | ||
e.link( | ||
e.pipe( | ||
E, | ||
w, | ||
d((t) => t !== null), | ||
f((t) => t.length) | ||
), | ||
Ie | ||
xe | ||
); | ||
}), Be = u(null), le = S((e) => { | ||
}), He = u(null), le = S((e) => { | ||
e.link( | ||
e.pipe( | ||
le, | ||
k(Ee), | ||
I(we), | ||
f(([n, o]) => -(o * n.length)) | ||
), | ||
W | ||
), e.link(e.pipe(le, V(!0)), _e), e.link(e.pipe(le, Vt()), Be); | ||
), e.link(e.pipe(le, V(!0)), _e), e.link(e.pipe(le, Ft()), He); | ||
function t(n, o) { | ||
e.pubIn({ | ||
[se]: n, | ||
[lt]: n | ||
[ut]: n | ||
}), o ? requestAnimationFrame(() => { | ||
e.pubIn({ | ||
[W]: 0, | ||
[lt]: 0, | ||
[Be]: null, | ||
[ut]: 0, | ||
[He]: null, | ||
[_e]: !1 | ||
@@ -888,4 +893,4 @@ }); | ||
[W]: 0, | ||
[lt]: 0, | ||
[Be]: null, | ||
[ut]: 0, | ||
[He]: null, | ||
[_e]: !1 | ||
@@ -896,4 +901,4 @@ }); | ||
e.pipe( | ||
we, | ||
k(Be), | ||
Le, | ||
I(He), | ||
d(([, n]) => n !== null), | ||
@@ -903,3 +908,3 @@ f(([n, o]) => { | ||
throw new Error("Unexpected null items"); | ||
return Et(o.length, n); | ||
return wt(o.length, n); | ||
}) | ||
@@ -913,6 +918,6 @@ ), | ||
le, | ||
gn(2), | ||
k(we, Be), | ||
vn(2), | ||
I(Le, He), | ||
d(([, , n]) => n !== null), | ||
f(([n, o]) => Et(n.length, o)) | ||
f(([n, o]) => wt(n.length, o)) | ||
), | ||
@@ -922,6 +927,6 @@ (n) => { | ||
} | ||
), e.changeWith(E, le, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
), e.changeWith(w, le, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
e.pipe( | ||
le, | ||
k(q, Ee), | ||
I(Z, we), | ||
f(([n, o, s]) => { | ||
@@ -945,7 +950,7 @@ const i = n.length, r = s; | ||
); | ||
}), ht = S((e) => { | ||
}), gt = S((e) => { | ||
const t = e.pipe( | ||
ht, | ||
k(Ge, Nt, ze, q), | ||
d(([, , , , o]) => !I(o)), | ||
gt, | ||
I(Ge, zt, ze, Z), | ||
d(([, , , , o]) => !k(o)), | ||
f(([{ data: o, scrollToBottom: s }, i, r, l]) => { | ||
@@ -982,4 +987,4 @@ if (s === !1 || s === void 0) | ||
e.pipe( | ||
Ke, | ||
k(ge), | ||
je, | ||
I(ge), | ||
d(([o, s]) => s), | ||
@@ -991,4 +996,4 @@ f(() => !1) | ||
const n = e.pipe( | ||
Yt, | ||
k(ge), | ||
jt, | ||
I(ge), | ||
d(([o, s]) => o === "up" && s) | ||
@@ -1002,3 +1007,3 @@ ); | ||
ge | ||
), e.link(e.pipe(n, V(!0)), Rt), e.link( | ||
), e.link(e.pipe(n, V(!0)), Mt), e.link( | ||
e.pipe( | ||
@@ -1009,18 +1014,18 @@ t, | ||
), | ||
ee | ||
ne | ||
); | ||
}), at = S((e) => { | ||
e.changeWith(E, at, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(at, ht); | ||
}), pt = S((e) => { | ||
e.changeWith(w, pt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(pt, gt); | ||
}), it = S((e) => { | ||
e.changeWith(E, it, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ae, it, ([t], n) => { | ||
e.changeWith(w, it, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ae, it, ([t], n) => { | ||
const s = ce(t, n.offset, "k")[0], i = n.data.length; | ||
return [vo(t, s, 1 / 0, (l, c) => [l + i, c]), s]; | ||
}), e.link(it, ht); | ||
}), Mt = S((e) => { | ||
e.changeWith(E, Mt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ae, Mt, ([t], { offset: n, count: o }) => [bo(t, n, o), n]); | ||
}), St = u(null), We = S((e) => { | ||
return [bo(t, s, 1 / 0, (l, c) => [l + i, c]), s]; | ||
}), e.link(it, gt); | ||
}), At = S((e) => { | ||
e.changeWith(w, At, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ae, At, ([t], { offset: n, count: o }) => [mo(t, n, o), n]); | ||
}), yt = u(null), We = S((e) => { | ||
e.sub( | ||
e.pipe( | ||
We, | ||
k(E), | ||
I(w), | ||
d(([{ purgeItemSizes: t }, n]) => !!t || n === null || n.length === 0) | ||
@@ -1030,9 +1035,9 @@ ), | ||
n === null || n.length === 0 ? e.pubIn({ | ||
...t.initialLocation ? { [$e]: t.initialLocation } : {}, | ||
[E]: t.data.slice() | ||
...t.initialLocation ? { [Ee]: t.initialLocation } : {}, | ||
[w]: t.data.slice() | ||
}) : e.pubIn({ | ||
...t.initialLocation ? { [$e]: t.initialLocation } : {}, | ||
[ae]: ft, | ||
[Me]: Ve, | ||
[St]: t.data.slice() | ||
...t.initialLocation ? { [Ee]: t.initialLocation } : {}, | ||
[ae]: ht, | ||
[Ae]: Ve, | ||
[yt]: t.data.slice() | ||
}); | ||
@@ -1042,4 +1047,4 @@ } | ||
e.pipe( | ||
Dn, | ||
k(St), | ||
On, | ||
I(yt), | ||
d(([, t]) => t !== null) | ||
@@ -1049,4 +1054,4 @@ ), | ||
e.pubIn({ | ||
[E]: t, | ||
[St]: null | ||
[w]: t, | ||
[yt]: null | ||
}); | ||
@@ -1058,3 +1063,3 @@ } | ||
d(({ purgeItemSizes: t }) => !t), | ||
k(Ee), | ||
I(we), | ||
d(([, t]) => t > 0), | ||
@@ -1077,19 +1082,19 @@ f(([{ data: t }, n]) => [ | ||
requestAnimationFrame(() => { | ||
o || e.pub(Cn), requestAnimationFrame(() => { | ||
o || e.pub(Dn), requestAnimationFrame(() => { | ||
n && e.pubIn({ | ||
[ee]: n | ||
[ne]: n | ||
}); | ||
}); | ||
}), e.pubIn({ | ||
[E]: t.slice() | ||
[w]: t.slice() | ||
}); | ||
} | ||
); | ||
}), Jt = S((e) => { | ||
e.changeWith(E, Jt, (t, n) => t ? t.slice(n) : []), e.changeWith(ae, Jt, ([t], n) => [me(t).reduce((s, { k: i, v: r }) => F(s, Math.max(0, i - n), r), Re()), 0]); | ||
}), Xt = S((e) => { | ||
e.changeWith(E, Xt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link( | ||
e.changeWith(w, Xt, (t, n) => t ? t.slice(n) : []), e.changeWith(ae, Xt, ([t], n) => [me(t).reduce((s, { k: i, v: r }) => F(s, Math.max(0, i - n), r), Me()), 0]); | ||
}), Qt = S((e) => { | ||
e.changeWith(w, Qt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link( | ||
e.pipe( | ||
Xt, | ||
k(Ie, Ee), | ||
Qt, | ||
I(xe, we), | ||
f(([, t, n]) => [ | ||
@@ -1105,6 +1110,6 @@ { | ||
); | ||
}), Sn = S((e) => { | ||
}), Tn = S((e) => { | ||
const t = e.pipe( | ||
Sn, | ||
k(E), | ||
Tn, | ||
I(w), | ||
f(([n, o]) => { | ||
@@ -1119,9 +1124,9 @@ if (!o) | ||
); | ||
e.changeWith(E, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ae, t, ([n], o) => [Ho(n, o), 0]); | ||
}), At = S((e) => { | ||
e.changeWith(E, At, (t, { mapper: n }) => t ? t.map(n) : []), e.link( | ||
e.changeWith(w, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ae, t, ([n], o) => [Bo(n, o), 0]); | ||
}), Ct = S((e) => { | ||
e.changeWith(w, Ct, (t, { mapper: n }) => t ? t.map(n) : []), e.link( | ||
e.pipe( | ||
At, | ||
gn(3), | ||
k(mn), | ||
Ct, | ||
vn(3), | ||
I(kn), | ||
d(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t), | ||
@@ -1131,3 +1136,3 @@ f(([{ autoscrollToBottomBehavior: t }]) => typeof t == "object" ? t.location() : { index: "LAST", align: "end", behavior: t }), | ||
), | ||
ee | ||
ne | ||
); | ||
@@ -1140,3 +1145,3 @@ }), de = S(); | ||
u(NaN); | ||
const ve = u(!1), ae = u(ft, (e) => { | ||
const ve = u(!1), ae = u(ht, (e) => { | ||
e.link( | ||
@@ -1146,8 +1151,8 @@ e.pipe( | ||
d((t) => t.length > 0), | ||
k(q), | ||
f(([t, n]) => xo(n, [t, []])) | ||
I(Z), | ||
f(([t, n]) => So(n, [t, []])) | ||
), | ||
ae | ||
); | ||
}), q = u(ft[0], (e) => { | ||
}), Z = u(ht[0], (e) => { | ||
e.link( | ||
@@ -1158,5 +1163,5 @@ e.pipe( | ||
), | ||
q | ||
Z | ||
); | ||
}), yn = u(ft[1], (e) => { | ||
}), $n = u(ht[1], (e) => { | ||
e.link( | ||
@@ -1167,10 +1172,10 @@ e.pipe( | ||
), | ||
yn | ||
$n | ||
); | ||
}), Ee = u(Te[1]), we = u(Te[0]), Pe = u(Te, (e) => { | ||
}), we = u($e[1]), Le = u($e[0]), Pe = u($e, (e) => { | ||
e.link( | ||
e.pipe( | ||
q, | ||
k(yn), | ||
te(([t], [n, o]) => Eo(t, [n, o]), Te) | ||
Z, | ||
I($n), | ||
G(([t], [n, o]) => wo(t, [n, o]), $e) | ||
), | ||
@@ -1183,3 +1188,3 @@ Pe | ||
), | ||
Ee | ||
we | ||
), e.link( | ||
@@ -1190,5 +1195,5 @@ e.pipe( | ||
), | ||
we | ||
Le | ||
); | ||
}), Tn = u(Te[2], (e) => { | ||
}), En = u($e[2], (e) => { | ||
e.link( | ||
@@ -1199,5 +1204,5 @@ e.pipe( | ||
), | ||
Tn | ||
En | ||
); | ||
}), $n = u(Te[3], (e) => { | ||
}), wn = u($e[3], (e) => { | ||
e.link( | ||
@@ -1208,25 +1213,25 @@ e.pipe( | ||
), | ||
$n | ||
wn | ||
); | ||
}), Ae = u(0, (e) => { | ||
}), Ie = u(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(Ie, $n, Tn, Ee), | ||
e.combine(xe, wn, En, we), | ||
f(([t, n, o, s]) => o + (t - n) * s) | ||
), | ||
Ae | ||
Ie | ||
); | ||
}), Ye = S(), Nt = u(!1), Ke = S((e) => { | ||
e.link(e.pipe(Ke, V(!1)), Ye); | ||
}, !1), $ = u(0), G = u(0), En = u(0), U = u(0), _o = $, rt = u(0), je = u(0), Ue = u(0), qe = u(0), zt = u(0), Ct = u(null), wn = Ft(), Wo = Lo, Po = 50, gt = ke(0, (e) => e.pipe( | ||
e.combine(je, Ue), | ||
}), Ye = S(), zt = u(!1), je = S((e) => { | ||
e.link(e.pipe(je, V(!1)), Ye); | ||
}, !1), $ = u(0), J = u(0), Ln = u(0), K = u(0), _o = $, rt = u(0), Ke = u(0), Ue = u(0), qe = u(0), Yt = u(0), Dt = u(null), Rn = _t(), Wo = Lo, Po = 50, dt = ke(0, (e) => e.pipe( | ||
e.combine(Ke, Ue), | ||
f(([t, n]) => t + n) | ||
)), Ln = ke(0, (e) => e.pipe( | ||
e.combine(qe, zt), | ||
)), Mn = ke(0, (e) => e.pipe( | ||
e.combine(qe, Yt), | ||
f(([t, n]) => t + n) | ||
)), No = ke(0, (e) => e.pipe( | ||
e.combine(je, Ue, $), | ||
e.combine(Ke, Ue, $), | ||
f(([t, n, o]) => t + Math.max(n - o, 0)) | ||
)), zo = ke(0, (e) => e.pipe( | ||
e.combine(qe, zt, $, G, U), | ||
e.combine(qe, Yt, $, J, K), | ||
f(([t, n, o, s, i]) => { | ||
@@ -1237,24 +1242,40 @@ o = Math.min(o, i - s); | ||
}) | ||
)), Rn = ke(0, (e) => e.pipe( | ||
e.combine(G, No, zo), | ||
)), An = ke(0, (e) => e.pipe( | ||
e.combine(J, No, zo), | ||
f(([t, n, o]) => t - n - o) | ||
)), dt = u(0), Mn = u(0, (e) => { | ||
)), vt = u(0), lt = u(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(Mn, Ae, G), | ||
Ie, | ||
I(lt), | ||
G( | ||
(t, [n, o]) => { | ||
if (t.prevTotalHeight === null) | ||
return { prevTotalHeight: n, adjustedMinScrollTop: o }; | ||
const s = n - t.prevTotalHeight, i = o === 0 ? 0 : o + s; | ||
return { prevTotalHeight: n, adjustedMinScrollTop: i }; | ||
}, | ||
{ prevTotalHeight: null, adjustedMinScrollTop: 0 } | ||
), | ||
f(({ adjustedMinScrollTop: t }) => t) | ||
), | ||
lt | ||
), e.link( | ||
e.pipe( | ||
e.combine(lt, Ie, J), | ||
f(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o)))) | ||
), | ||
dt | ||
vt | ||
); | ||
}), Le = S((e) => { | ||
}), Re = S((e) => { | ||
e.link( | ||
e.pipe( | ||
Le, | ||
Re, | ||
f((t) => t.align === "start" ? t.top ?? 0 : 0) | ||
), | ||
Mn | ||
lt | ||
), e.link( | ||
e.pipe( | ||
Le, | ||
k($), | ||
Re, | ||
I($), | ||
d(([t, n]) => t.top !== n), | ||
@@ -1276,11 +1297,11 @@ V(!0) | ||
$, | ||
gt, | ||
Ln, | ||
dt, | ||
Mn, | ||
Ue, | ||
Rn, | ||
U, | ||
dt, | ||
An, | ||
K, | ||
vt, | ||
ve, | ||
Fe, | ||
j, | ||
q, | ||
ge | ||
@@ -1303,3 +1324,3 @@ ), | ||
]) => { | ||
const m = e.getValue(bn), y = r - n - o, x = -t + s, b = l === 0 ? y + Math.min(0, x) - i : -l; | ||
const m = e.getValue(In), y = r - n - o, x = -t + s, b = l === 0 ? y + Math.min(0, x) - i : -l; | ||
return { | ||
@@ -1315,3 +1336,3 @@ scrollHeight: y, | ||
) | ||
), Dt = S((e) => { | ||
), Ot = S((e) => { | ||
e.link( | ||
@@ -1321,12 +1342,12 @@ e.pipe( | ||
be(0), | ||
k(Ge), | ||
I(Ge), | ||
d(([, t]) => t.scrollHeight > 0), | ||
f(([, t]) => t) | ||
), | ||
Dt | ||
Ot | ||
); | ||
}), se = S(), W = u(0), lt = u(0), pt = u(0), An = u(""), Yt = S(), Cn = Ft(), Dn = Ft(), On = ({ index: e }) => /* @__PURE__ */ en("div", { children: [ | ||
}), se = S(), W = u(0), ut = u(0), ft = u(0), Cn = u(""), jt = S(), Dn = _t(), On = _t(), Hn = ({ index: e }) => /* @__PURE__ */ tn("div", { children: [ | ||
"Item ", | ||
e | ||
] }), Bn = ({ index: e }) => e, Ot = u(On), Hn = u(Bn), Vn = u(null), Fn = u(null), _n = u(null), Wn = u(null), Pn = u(null), Nn = u("div"), Yo = { | ||
] }), Bn = ({ index: e }) => e, Ht = u(Hn), Vn = u(Bn), Fn = u(null), _n = u(null), Wn = u(null), Pn = u(null), Nn = u(null), zn = u("div"), Yo = { | ||
position: "sticky", | ||
@@ -1337,22 +1358,22 @@ top: 0, | ||
overflowAnchor: "none" | ||
}, Ko = { | ||
}, jo = { | ||
position: "sticky", | ||
bottom: 0 | ||
}, zn = g.forwardRef((e, t) => /* @__PURE__ */ T("div", { style: { zIndex: 1 }, ...e, ref: t })), Yn = g.forwardRef((e, t) => /* @__PURE__ */ T("div", { ...e, ref: t })), Kn = g.forwardRef( | ||
}, Yn = g.forwardRef((e, t) => /* @__PURE__ */ T("div", { style: { zIndex: 1 }, ...e, ref: t })), jn = g.forwardRef((e, t) => /* @__PURE__ */ T("div", { ...e, ref: t })), Kn = g.forwardRef( | ||
({ style: e, ...t }, n) => /* @__PURE__ */ T("div", { ...t, style: { ...Yo, ...e }, ref: n }) | ||
), jn = g.forwardRef( | ||
({ style: e, ...t }, n) => /* @__PURE__ */ T("div", { ...t, style: { ...Ko, ...e }, ref: n }) | ||
), Un = u(zn), qn = u(Kn), Gn = u(Yn), Zn = u(jn), Bt = u("top", (e) => { | ||
), Un = g.forwardRef( | ||
({ style: e, ...t }, n) => /* @__PURE__ */ T("div", { ...t, style: { ...jo, ...e }, ref: n }) | ||
), qn = u(Yn), Gn = u(Kn), Zn = u(jn), Jn = u(Un), Bt = u("top", (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(Bt, Ae, G, gt, Ln), | ||
e.combine(Bt, Ie, J, dt, Mn), | ||
d(([t]) => t === "bottom" || t === "bottom-smooth"), | ||
f(([, t, n, o, s]) => Math.max(0, n - t - o - s)) | ||
), | ||
pt | ||
ft | ||
), e.link( | ||
e.pipe( | ||
e.combine(pt, Bt), | ||
e.combine(ft, Bt), | ||
d(([, t]) => t === "bottom-smooth"), | ||
te( | ||
G( | ||
(t, [n]) => [t[1], n], | ||
@@ -1363,6 +1384,6 @@ [0, 0] | ||
), | ||
An | ||
Cn | ||
); | ||
}); | ||
function jo(e) { | ||
function Ko(e) { | ||
return Uo(Go(Zo(qo(e), 8 * e.length))).toLowerCase(); | ||
@@ -1391,6 +1412,6 @@ } | ||
const l = n, c = o, a = s, p = i; | ||
o = B( | ||
o = B( | ||
o = B( | ||
o = B( | ||
o = H( | ||
o = H( | ||
o = H( | ||
o = H( | ||
o = O( | ||
@@ -1589,5 +1610,5 @@ o = O( | ||
), | ||
s = B( | ||
s = H( | ||
s, | ||
i = B(i, n = B(n, o, s, i, e[r + 0], 6, -198630844), o, s, e[r + 7], 10, 1126891415), | ||
i = H(i, n = H(n, o, s, i, e[r + 0], 6, -198630844), o, s, e[r + 7], 10, 1126891415), | ||
n, | ||
@@ -1605,5 +1626,5 @@ o, | ||
), | ||
s = B( | ||
s = H( | ||
s, | ||
i = B(i, n = B(n, o, s, i, e[r + 12], 6, 1700485571), o, s, e[r + 3], 10, -1894986606), | ||
i = H(i, n = H(n, o, s, i, e[r + 12], 6, 1700485571), o, s, e[r + 3], 10, -1894986606), | ||
n, | ||
@@ -1621,5 +1642,5 @@ o, | ||
), | ||
s = B( | ||
s = H( | ||
s, | ||
i = B(i, n = B(n, o, s, i, e[r + 8], 6, 1873313359), o, s, e[r + 15], 10, -30611744), | ||
i = H(i, n = H(n, o, s, i, e[r + 8], 6, 1873313359), o, s, e[r + 15], 10, -30611744), | ||
n, | ||
@@ -1637,5 +1658,5 @@ o, | ||
), | ||
s = B( | ||
s = H( | ||
s, | ||
i = B(i, n = B(n, o, s, i, e[r + 4], 6, -145523070), o, s, e[r + 11], 10, -1120210379), | ||
i = H(i, n = H(n, o, s, i, e[r + 4], 6, -145523070), o, s, e[r + 11], 10, -1120210379), | ||
n, | ||
@@ -1656,16 +1677,16 @@ o, | ||
} | ||
function vt(e, t, n, o, s, i) { | ||
function bt(e, t, n, o, s, i) { | ||
return ue(Jo(ue(ue(t, e), ue(o, i)), s), n); | ||
} | ||
function C(e, t, n, o, s, i, r) { | ||
return vt(t & n | ~t & o, e, t, s, i, r); | ||
return bt(t & n | ~t & o, e, t, s, i, r); | ||
} | ||
function D(e, t, n, o, s, i, r) { | ||
return vt(t & o | n & ~o, e, t, s, i, r); | ||
return bt(t & o | n & ~o, e, t, s, i, r); | ||
} | ||
function O(e, t, n, o, s, i, r) { | ||
return vt(t ^ n ^ o, e, t, s, i, r); | ||
return bt(t ^ n ^ o, e, t, s, i, r); | ||
} | ||
function B(e, t, n, o, s, i, r) { | ||
return vt(n ^ (t | ~o), e, t, s, i, r); | ||
function H(e, t, n, o, s, i, r) { | ||
return bt(n ^ (t | ~o), e, t, s, i, r); | ||
} | ||
@@ -1679,7 +1700,7 @@ function ue(e, t) { | ||
} | ||
const Jn = Symbol("INVALID_KEY"); | ||
const Xn = Symbol("INVALID_KEY"); | ||
function Xo(e) { | ||
const t = e.slice(0, 32), n = e.slice(32), o = atob(n); | ||
if (t !== jo(n)) | ||
return Jn; | ||
if (t !== Ko(n)) | ||
return Xn; | ||
const [s, i] = o.split(";"), r = s.slice(2), l = new Date(Number(i.slice(2))); | ||
@@ -1699,3 +1720,3 @@ return { orderNumber: r, expiryDate: l }; | ||
consoleMessage: "Your VirtuosoMessageListLicense component is missing a license key - this component will not work if deployed in production. Purchase a key from https://virtuoso.dev/pricing/ before you deploy to production." | ||
}, Xn = { | ||
}, Qn = { | ||
valid: !0 | ||
@@ -1714,3 +1735,3 @@ }, ns = { | ||
watermarkMessage: "You have installed a version of `@virtuoso.dev/message-list` that is newer than the period of your license key. Either downgrade to a supported version, or purchase a new license from https://virtuoso.dev/pricing/" | ||
}, is = Xn, rs = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0|.+\.local)$/, ls = ["virtuoso.dev", "csb.app", "codesandbox.io"]; | ||
}, is = Qn, rs = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0|.+\.local)$/, ls = ["virtuoso.dev", "csb.app", "codesandbox.io"]; | ||
function us({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) { | ||
@@ -1720,3 +1741,3 @@ const s = n.match(rs), i = ls.some((r) => n.endsWith(r)); | ||
const r = Xo(e); | ||
if (r === Jn) | ||
if (r === Xn) | ||
return ns; | ||
@@ -1731,5 +1752,5 @@ if (r.expiryDate.getTime() < t.getTime()) { | ||
return i ? is : s ? ts : es; | ||
return Xn; | ||
return Qn; | ||
} | ||
const Qn = g.createContext(Qo), cs = ({ | ||
const eo = g.createContext(Qo), cs = ({ | ||
licenseKey: e, | ||
@@ -1742,5 +1763,5 @@ children: t | ||
now: /* @__PURE__ */ new Date(), | ||
packageTimestamp: 1731007746899 | ||
packageTimestamp: 1731049492519 | ||
}); | ||
return /* @__PURE__ */ T(Qn.Provider, { value: n, children: t }); | ||
return /* @__PURE__ */ T(eo.Provider, { value: n, children: t }); | ||
}; | ||
@@ -1750,9 +1771,9 @@ cs.displayName = Math.random().toString(36).slice(2, 8); | ||
function ps(e, t, n) { | ||
const o = _t(), s = g.useRef(null), i = g.useRef(null); | ||
const o = Wt(), s = g.useRef(null), i = g.useRef(null); | ||
function r() { | ||
s.current && (cancelAnimationFrame(s.current), s.current = null, i.current = null); | ||
} | ||
g.useEffect(() => o.sub(Yt, (a) => { | ||
g.useEffect(() => o.sub(jt, (a) => { | ||
a !== i.current && r(); | ||
}), [o]), g.useEffect(() => o.sub(wn, r), [o]); | ||
}), [o]), g.useEffect(() => o.sub(Rn, r), [o]); | ||
const l = g.useCallback( | ||
@@ -1766,5 +1787,5 @@ (a, p, v) => { | ||
function b() { | ||
var Z, J; | ||
const K = m + (a - m) * p(y); | ||
(Z = e.current) == null || Z.scrollTo({ top: K, behavior: "instant" }), y += 1 / v, x += 1, x < v ? s.current = requestAnimationFrame(b) : ((J = e.current) == null || J.scrollTo({ top: a, behavior: "instant" }), s.current = null, i.current = null); | ||
var X, Q; | ||
const U = m + (a - m) * p(y); | ||
(X = e.current) == null || X.scrollTo({ top: U, behavior: "instant" }), y += 1 / v, x += 1, x < v ? s.current = requestAnimationFrame(b) : ((Q = e.current) == null || Q.scrollTo({ top: a, behavior: "instant" }), s.current = null, i.current = null); | ||
} | ||
@@ -1779,6 +1800,6 @@ b(); | ||
if (a.top === ((p = e.current) == null ? void 0 : p.scrollTop)) { | ||
o.pub(Ke, (v = e.current) == null ? void 0 : v.scrollTop); | ||
o.pub(je, (v = e.current) == null ? void 0 : v.scrollTop); | ||
return; | ||
} | ||
if (a.top !== void 0 && (n.current = a.top, o.pub(Nt, !0)), a.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${a.forceBottomSpace}px`), a.behavior === "smooth") | ||
if (a.top !== void 0 && (n.current = a.top, o.pub(zt, !0)), a.forceBottomSpace !== void 0 && t.current && (t.current.style.paddingBottom = `${a.forceBottomSpace}px`), a.behavior === "smooth") | ||
l(a.top ?? 0, Wo, Po); | ||
@@ -1795,3 +1816,3 @@ else if (a.behavior === "auto" || a.behavior === "instant" || a.behavior === void 0) | ||
} | ||
function eo(e) { | ||
function to(e) { | ||
return { | ||
@@ -1803,3 +1824,3 @@ data: { | ||
append: (t, n) => { | ||
e.pub(at, { | ||
e.pub(pt, { | ||
data: t, | ||
@@ -1816,3 +1837,3 @@ scrollToBottom: n | ||
map: (t, n) => { | ||
e.pub(At, { | ||
e.pub(Ct, { | ||
mapper: t, | ||
@@ -1823,6 +1844,6 @@ autoscrollToBottomBehavior: n | ||
findAndDelete: (t) => { | ||
e.pub(Sn, t); | ||
e.pub(Tn, t); | ||
}, | ||
findIndex: (t) => e.getValue(E).findIndex(t), | ||
find: (t) => e.getValue(E).find(t), | ||
findIndex: (t) => e.getValue(w).findIndex(t), | ||
find: (t) => e.getValue(w).find(t), | ||
insert: function(t, n, o) { | ||
@@ -1836,3 +1857,3 @@ e.pub(it, { | ||
deleteRange: function(t, n) { | ||
e.pub(Mt, { | ||
e.pub(At, { | ||
offset: t, | ||
@@ -1843,14 +1864,14 @@ count: n | ||
batch: (t, n) => { | ||
e.pub(ve, !0), t(), e.pub(ve, !1), e.pub(ht, { data: [], scrollToBottom: n }); | ||
e.pub(ve, !0), t(), e.pub(ve, !1), e.pub(gt, { data: [], scrollToBottom: n }); | ||
}, | ||
get: () => e.getValue(E).slice(), | ||
getCurrentlyRendered: () => e.getValue(ct) | ||
get: () => e.getValue(w).slice(), | ||
getCurrentlyRendered: () => e.getValue(at) | ||
}, | ||
scrollToItem: (t) => { | ||
e.pub(ee, t); | ||
e.pub(ne, t); | ||
}, | ||
scrollIntoView: (t) => { | ||
e.pub(xn, t); | ||
e.pub(yn, t); | ||
}, | ||
scrollerElement: () => e.getValue(Ct), | ||
scrollerElement: () => e.getValue(Dt), | ||
getScrollLocation() { | ||
@@ -1860,10 +1881,10 @@ return e.getValue(Ge); | ||
cancelSmoothScroll() { | ||
e.pub(wn); | ||
e.pub(Rn); | ||
}, | ||
height: (t) => { | ||
var s; | ||
const n = ((s = e.getValue(E)) == null ? void 0 : s.indexOf(t)) ?? -1; | ||
const n = ((s = e.getValue(w)) == null ? void 0 : s.indexOf(t)) ?? -1; | ||
if (n === -1) | ||
return 0; | ||
const o = e.getValue(q); | ||
const o = e.getValue(Z); | ||
return ce(o, n)[1] ?? 0; | ||
@@ -1874,3 +1895,3 @@ } | ||
const fs = ({ item: e, ItemContent: t, mount: n, unmount: o }) => { | ||
const s = H(ze), i = g.useRef(null), r = g.useCallback( | ||
const s = B(ze), i = g.useRef(null), r = g.useCallback( | ||
(l) => { | ||
@@ -1906,3 +1927,3 @@ l ? (i.current = l, n(l)) : i.current && (o(i.current), i.current = null); | ||
} | ||
let Qt = !1; | ||
let en = !1; | ||
const hs = g.forwardRef( | ||
@@ -1917,3 +1938,3 @@ ({ | ||
onRenderedDataChange: r, | ||
ItemContent: l = On, | ||
ItemContent: l = Hn, | ||
Header: c = null, | ||
@@ -1924,39 +1945,39 @@ StickyHeader: a = null, | ||
EmptyPlaceholder: m = null, | ||
HeaderWrapper: y = zn, | ||
HeaderWrapper: y = Yn, | ||
StickyHeaderWrapper: x = Kn, | ||
FooterWrapper: b = Yn, | ||
StickyFooterWrapper: P = jn, | ||
ScrollElement: K = "div", | ||
...Z | ||
}, J) => { | ||
const X = g.useMemo(() => { | ||
const M = new fo(); | ||
return M.register(Me), M.register(Ye), M.register(st), M.register(nt), M.register(at), M.register(le), M.register(We), M.pubIn({ | ||
[E]: e.slice(), | ||
FooterWrapper: b = jn, | ||
StickyFooterWrapper: P = Un, | ||
ScrollElement: U = "div", | ||
...X | ||
}, Q) => { | ||
const ee = g.useMemo(() => { | ||
const M = new ho(); | ||
return M.register(Ae), M.register(Ye), M.register(st), M.register(nt), M.register(pt), M.register(le), M.register(We), M.pubIn({ | ||
[w]: e.slice(), | ||
[ze]: n, | ||
[Hn]: t, | ||
[$e]: o, | ||
[Ot]: l, | ||
[Vn]: c, | ||
[_n]: p, | ||
[Fn]: a, | ||
[Wn]: v, | ||
[Pn]: m, | ||
[Nn]: K, | ||
[Zn]: P, | ||
[qn]: x, | ||
[Gn]: b, | ||
[Un]: y, | ||
[Vn]: t, | ||
[Ee]: o, | ||
[Ht]: l, | ||
[Fn]: c, | ||
[Wn]: p, | ||
[_n]: a, | ||
[Pn]: v, | ||
[Nn]: m, | ||
[zn]: U, | ||
[Jn]: P, | ||
[Gn]: x, | ||
[Zn]: b, | ||
[qn]: y, | ||
[Bt]: s | ||
}), M.singletonSub(Dt, i), M.singletonSub(ct, r), M; | ||
}), M.singletonSub(Ot, i), M.singletonSub(at, r), M; | ||
}, []); | ||
g.useImperativeHandle(J, () => eo(X), [X]), g.useEffect(() => { | ||
X.pubIn({ | ||
g.useImperativeHandle(Q, () => to(ee), [ee]), g.useEffect(() => { | ||
ee.pubIn({ | ||
[ze]: n, | ||
[Ot]: l | ||
}), X.singletonSub(Dt, i), X.singletonSub(ct, r); | ||
[Ht]: l | ||
}), ee.singletonSub(Ot, i), ee.singletonSub(at, r); | ||
}); | ||
const N = g.useContext(Qn); | ||
const N = g.useContext(eo); | ||
return g.useEffect(() => { | ||
N.consoleMessage && (Qt || (Qt = !0, console.error(N.consoleMessage))); | ||
N.consoleMessage && (en || (en = !0, console.error(N.consoleMessage))); | ||
}, [N]), g.useEffect(() => { | ||
@@ -1979,3 +2000,3 @@ const M = (A) => { | ||
} | ||
) : /* @__PURE__ */ T(ho.Provider, { value: X, children: /* @__PURE__ */ T(gs, { ...Z }) }); | ||
) : /* @__PURE__ */ T(go.Provider, { value: ee, children: /* @__PURE__ */ T(gs, { ...X }) }); | ||
} | ||
@@ -1985,3 +2006,3 @@ ); | ||
const gs = ({ style: e, ...t }) => { | ||
const n = _t(), o = g.useContext(as), [ | ||
const n = Wt(), o = g.useContext(as), [ | ||
s, | ||
@@ -1998,14 +2019,14 @@ i, | ||
x | ||
] = go( | ||
Vn, | ||
] = vo( | ||
Fn, | ||
Un, | ||
_n, | ||
qn, | ||
_n, | ||
Gn, | ||
Wn, | ||
Gn, | ||
Pn, | ||
Zn, | ||
Ot, | ||
Pn, | ||
Nn | ||
Jn, | ||
Ht, | ||
Nn, | ||
zn | ||
), [b] = g.useState(() => { | ||
@@ -2015,58 +2036,58 @@ if (typeof ResizeObserver > "u") | ||
return new ResizeObserver((h) => { | ||
var Xe, Se, Oe, jt; | ||
const oe = h.length, _ = []; | ||
var Xe, ye, Oe, Ut; | ||
const Y = h.length, _ = []; | ||
let L = {}; | ||
for (let bt = 0; bt < oe; bt++) { | ||
const he = h[bt], Y = he.target; | ||
if (Y === N.current) { | ||
for (let mt = 0; mt < Y; mt++) { | ||
const he = h[mt], j = he.target; | ||
if (j === N.current) { | ||
L = { | ||
...L, | ||
[Ue]: he.contentRect.height, | ||
[U]: (Xe = w.current) == null ? void 0 : Xe.scrollHeight | ||
[K]: (Xe = E.current) == null ? void 0 : Xe.scrollHeight | ||
}; | ||
continue; | ||
} else if (Y === A.current) { | ||
} else if (j === A.current) { | ||
L = { | ||
...L, | ||
[je]: he.contentRect.height, | ||
[U]: (Se = w.current) == null ? void 0 : Se.scrollHeight | ||
[Ke]: he.contentRect.height, | ||
[K]: (ye = E.current) == null ? void 0 : ye.scrollHeight | ||
}; | ||
continue; | ||
} else if (Y === K.current) { | ||
} else if (j === U.current) { | ||
L = { | ||
...L, | ||
[zt]: he.contentRect.height, | ||
[U]: (Oe = w.current) == null ? void 0 : Oe.scrollHeight | ||
[Yt]: he.contentRect.height, | ||
[K]: (Oe = E.current) == null ? void 0 : Oe.scrollHeight | ||
}; | ||
continue; | ||
} else if (Y === J.current) { | ||
} else if (j === Q.current) { | ||
L = { | ||
...L, | ||
[qe]: he.contentRect.height, | ||
[U]: (jt = w.current) == null ? void 0 : jt.scrollHeight | ||
[K]: (Ut = E.current) == null ? void 0 : Ut.scrollHeight | ||
}; | ||
continue; | ||
} else if (Y === w.current) { | ||
} else if (j === E.current) { | ||
L = { | ||
...L, | ||
[$]: Y.scrollTop, | ||
[U]: Y.scrollHeight, | ||
[G]: he.contentRect.height, | ||
[En]: Y.clientWidth | ||
[$]: j.scrollTop, | ||
[K]: j.scrollHeight, | ||
[J]: he.contentRect.height, | ||
[Ln]: j.clientWidth | ||
}; | ||
continue; | ||
} else if (Y === ne.current) { | ||
w.current && (L = { | ||
} else if (j === oe.current) { | ||
E.current && (L = { | ||
...L, | ||
[U]: w.current.scrollHeight | ||
[K]: E.current.scrollHeight | ||
}); | ||
continue; | ||
} | ||
if (Y.dataset.index === void 0) | ||
if (j.dataset.index === void 0) | ||
continue; | ||
const mt = parseInt(Y.dataset.index), ao = parseFloat(Y.dataset.knownSize ?? ""), kt = he.contentRect.height; | ||
if (kt === ao) | ||
const It = parseInt(j.dataset.index), po = parseFloat(j.dataset.knownSize ?? ""), kt = he.contentRect.height; | ||
if (kt === po) | ||
continue; | ||
const Ut = _[_.length - 1]; | ||
_.length === 0 || Ut.size !== kt || Ut.endIndex !== mt - 1 ? _.push({ endIndex: mt, size: kt, startIndex: mt }) : _[_.length - 1].endIndex++; | ||
const qt = _[_.length - 1]; | ||
_.length === 0 || qt.size !== kt || qt.endIndex !== It - 1 ? _.push({ endIndex: It, size: kt, startIndex: It }) : _[_.length - 1].endIndex++; | ||
} | ||
@@ -2078,10 +2099,10 @@ _.length > 0 && (L = { | ||
}); | ||
}), [P, K] = et(b), [Z, J] = et(b), [X, N] = et(b), [M, A] = et(b), pe = g.useCallback( | ||
}), [P, U] = et(b), [X, Q] = et(b), [ee, N] = et(b), [M, A] = et(b), pe = g.useCallback( | ||
(h) => { | ||
if (o) { | ||
const oe = parseInt(h.dataset.index ?? ""); | ||
const Y = parseInt(h.dataset.index ?? ""); | ||
n.pub(de, [ | ||
{ | ||
startIndex: oe, | ||
endIndex: oe, | ||
startIndex: Y, | ||
endIndex: Y, | ||
size: o.itemHeight | ||
@@ -2099,15 +2120,15 @@ } | ||
[b] | ||
), w = g.useRef(null), ne = g.useRef(null), Je = g.useCallback( | ||
), E = g.useRef(null), oe = g.useRef(null), Je = g.useCallback( | ||
(h) => { | ||
h ? (ne.current = h, b.observe(h, { box: "border-box" })) : ne.current && (b.unobserve(ne.current), ne.current = null); | ||
h ? (oe.current = h, b.observe(h, { box: "border-box" })) : oe.current && (b.unobserve(oe.current), oe.current = null); | ||
}, | ||
[b] | ||
), z = g.useRef(null), xe = ps(w, ne, z), ie = g.useCallback((h) => { | ||
w.current && (w.current.scrollTop += h); | ||
}, []), Q = g.useCallback(() => { | ||
const h = w.current; | ||
), z = g.useRef(null), Se = ps(E, oe, z), ie = g.useCallback((h) => { | ||
E.current && (E.current.scrollTop += h); | ||
}, []), te = g.useCallback(() => { | ||
const h = E.current; | ||
if (h !== null) { | ||
if (z.current !== null) { | ||
const oe = h.scrollHeight - h.clientHeight; | ||
fn(h.scrollTop, Math.min(oe, z.current)) && (z.current = null, n.pub(Nt, !1), n.pub(Ke, h.scrollTop)); | ||
const Y = h.scrollHeight - h.clientHeight; | ||
hn(h.scrollTop, Math.min(Y, z.current)) && (z.current = null, n.pub(zt, !1), n.pub(je, h.scrollTop)); | ||
} | ||
@@ -2118,3 +2139,3 @@ n.pub($, h.scrollTop); | ||
(h) => { | ||
n.pub(Yt, h.deltaY > 0 ? "down" : "up"); | ||
n.pub(jt, h.deltaY > 0 ? "down" : "up"); | ||
}, | ||
@@ -2124,30 +2145,40 @@ [n] | ||
(h) => { | ||
h ? (n.pub(Ct, h), w.current = h, h.addEventListener("scroll", Q), h.addEventListener("wheel", Ce), o && n.pubIn({ | ||
[G]: o.viewportHeight, | ||
[U]: o.viewportHeight, | ||
h ? (n.pub(Dt, h), E.current = h, h.addEventListener("scroll", te), h.addEventListener("wheel", Ce), o && n.pubIn({ | ||
[J]: o.viewportHeight, | ||
[K]: o.viewportHeight, | ||
[$]: 0 | ||
}), b.observe(h, { box: "border-box" })) : w.current && (w.current.removeEventListener("scroll", Q), w.current.removeEventListener("wheel", Ce), n.pub(Ct, null), b.unobserve(w.current), w.current = null); | ||
}), b.observe(h, { box: "border-box" })) : E.current && (E.current.removeEventListener("scroll", te), E.current.removeEventListener("wheel", Ce), n.pub(Dt, null), b.unobserve(E.current), E.current = null); | ||
}, | ||
[b, n, Q, Ce, o] | ||
), { items: De } = H(Me); | ||
g.useLayoutEffect(() => n.sub(Le, xe), [xe, n]), g.useLayoutEffect(() => n.sub(se, ie), [ie, n]); | ||
[b, n, te, Ce, o] | ||
), { items: De } = B(Ae); | ||
g.useLayoutEffect(() => { | ||
if (!gn()) | ||
return; | ||
const h = setInterval(() => { | ||
var Y; | ||
n.pub(K, (Y = E.current) == null ? void 0 : Y.scrollHeight); | ||
}, 1e3); | ||
return () => { | ||
clearInterval(h); | ||
}; | ||
}, [n]), g.useLayoutEffect(() => n.sub(Re, Se), [Se, n]), g.useLayoutEffect(() => n.sub(se, ie), [ie, n]); | ||
const Kt = g.useCallback(() => { | ||
var oe; | ||
var Y; | ||
const h = []; | ||
for (const _ of ((oe = ne.current) == null ? void 0 : oe.children) ?? []) { | ||
for (const _ of ((Y = oe.current) == null ? void 0 : Y.children) ?? []) { | ||
if (_.dataset.index === void 0) | ||
continue; | ||
const L = parseInt(_.dataset.index), Xe = parseFloat(_.dataset.knownSize ?? ""), Se = _.getBoundingClientRect().height; | ||
if (Se === Xe) | ||
const L = parseInt(_.dataset.index), Xe = parseFloat(_.dataset.knownSize ?? ""), ye = _.getBoundingClientRect().height; | ||
if (ye === Xe) | ||
continue; | ||
const Oe = h[h.length - 1]; | ||
h.length === 0 || Oe.size !== Se || Oe.endIndex !== L - 1 ? h.push({ endIndex: L, size: Se, startIndex: L }) : h[h.length - 1].endIndex++; | ||
h.length === 0 || Oe.size !== ye || Oe.endIndex !== L - 1 ? h.push({ endIndex: L, size: ye, startIndex: L }) : h[h.length - 1].endIndex++; | ||
} | ||
n.pub(de, h); | ||
}, [n]); | ||
g.useLayoutEffect(() => n.sub(Cn, Kt), [Kt, n]); | ||
const to = H(W), no = H(lt), oo = H(j), so = H(pt), io = H(dt), ro = H(An), fe = H(ze), lo = H(Hn), uo = H(Ie), co = H(Ae); | ||
g.useLayoutEffect(() => n.sub(Dn, Kt), [Kt, n]); | ||
const no = B(W), oo = B(ut), so = B(q), io = B(ft), ro = B(vt), lo = B(Cn), fe = B(ze), uo = B(Vn), co = B(xe), ao = B(Ie); | ||
return g.useLayoutEffect(() => { | ||
De.length === 0 && n.pub(Dn); | ||
}, [De, n]), /* @__PURE__ */ T(po, { children: /* @__PURE__ */ en( | ||
De.length === 0 && n.pub(On); | ||
}, [De, n]), /* @__PURE__ */ T(fo, { children: /* @__PURE__ */ tn( | ||
x, | ||
@@ -2159,3 +2190,3 @@ { | ||
style: { | ||
overflowY: oo ? "hidden" : "scroll", | ||
overflowY: so ? "hidden" : "scroll", | ||
boxSizing: "border-box", | ||
@@ -2167,4 +2198,4 @@ ...e | ||
i && /* @__PURE__ */ T(l, { ref: M, style: Qe, children: /* @__PURE__ */ T(i, { context: fe }) }), | ||
s && /* @__PURE__ */ T(r, { ref: X, style: Qe, children: /* @__PURE__ */ T(s, { context: fe }) }), | ||
uo > 0 ? /* @__PURE__ */ T( | ||
s && /* @__PURE__ */ T(r, { ref: ee, style: Qe, children: /* @__PURE__ */ T(s, { context: fe }) }), | ||
co > 0 ? /* @__PURE__ */ T( | ||
"div", | ||
@@ -2176,9 +2207,9 @@ { | ||
boxSizing: "content-box", | ||
height: co, | ||
paddingBottom: io, | ||
height: ao, | ||
paddingBottom: ro, | ||
overflowAnchor: "none", | ||
marginTop: so, | ||
transition: ro, | ||
marginTop: io, | ||
transition: lo, | ||
position: "relative", | ||
transform: `translateY(${to + no}px)` | ||
transform: `translateY(${no + oo}px)` | ||
}, | ||
@@ -2193,3 +2224,3 @@ children: De.map((h) => /* @__PURE__ */ T( | ||
}, | ||
lo({ index: h.index, data: h.data, context: fe }) | ||
uo({ index: h.index, data: h.data, context: fe }) | ||
)) | ||
@@ -2199,3 +2230,3 @@ } | ||
c && /* @__PURE__ */ T(p, { ref: P, style: Qe, children: /* @__PURE__ */ T(c, { context: fe }) }), | ||
a && /* @__PURE__ */ T(v, { ref: Z, style: Qe, children: /* @__PURE__ */ T(a, { context: fe }) }) | ||
a && /* @__PURE__ */ T(v, { ref: X, style: Qe, children: /* @__PURE__ */ T(a, { context: fe }) }) | ||
] | ||
@@ -2206,11 +2237,11 @@ } | ||
function ms() { | ||
return H(Ge); | ||
return B(Ge); | ||
} | ||
function Is() { | ||
return B(at); | ||
} | ||
function ks() { | ||
return H(ct); | ||
const e = Wt(); | ||
return g.useMemo(() => to(e), [e]); | ||
} | ||
function Is() { | ||
const e = _t(); | ||
return g.useMemo(() => eo(e), [e]); | ||
} | ||
export { | ||
@@ -2220,5 +2251,5 @@ hs as VirtuosoMessageList, | ||
as as VirtuosoMessageListTestingContext, | ||
ks as useCurrentlyRenderedData, | ||
Is as useCurrentlyRenderedData, | ||
ms as useVirtuosoLocation, | ||
Is as useVirtuosoMethods | ||
ks as useVirtuosoMethods | ||
}; |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.9.4", | ||
"version": "1.9.5", | ||
"type": "module", | ||
@@ -26,0 +26,0 @@ "module": "dist/index.js", |
100750
2564