@virtuoso.dev/message-list
Advanced tools
Comparing version 1.8.3 to 1.8.4
@@ -0,1 +1,8 @@ | ||
## [1.8.4](https://github.com/virtuoso-dev/message-list/compare/v1.8.3...v1.8.4) (2024-08-08) | ||
### Bug Fixes | ||
* check if message is present ([8d7c2e7](https://github.com/virtuoso-dev/message-list/commit/8d7c2e79f97400ca359816014619677fe15177f5)) | ||
## [1.8.3](https://github.com/virtuoso-dev/message-list/compare/v1.8.2...v1.8.3) (2024-07-17) | ||
@@ -2,0 +9,0 @@ |
import { jsxs as Jt, jsx as y, Fragment as io } from "react/jsx-runtime"; | ||
import h from "react"; | ||
import { Cell as c, Signal as x, throttleTime as ve, map as f, mapTo as W, debounceTime as ce, filter as g, scan as Q, withLatestFrom as S, delayWithMicrotask as Ot, onNext as Xt, Action as ro, useRealm as Ct, useCellValue as V, Realm as lo, RealmContext as co, useCellValues as uo } from "@mdxeditor/gurx"; | ||
function be(e, t) { | ||
import { Cell as c, Signal as x, throttleTime as be, map as f, mapTo as W, debounceTime as ce, filter as g, scan as Q, withLatestFrom as S, delayWithMicrotask as Ot, onNext as Xt, Action as ro, useRealm as Ct, useCellValue as V, Realm as lo, RealmContext as co, useCellValues as uo } from "@mdxeditor/gurx"; | ||
function me(e, t) { | ||
const n = c(e, (o) => { | ||
@@ -10,15 +10,15 @@ o.link(t(o), n); | ||
} | ||
const Se = { lvl: 0 }; | ||
function Qt(e, t, n, o = Se, s = Se) { | ||
const xe = { lvl: 0 }; | ||
function Qt(e, t, n, o = xe, s = xe) { | ||
return { k: e, l: o, lvl: n, r: s, v: t }; | ||
} | ||
function k(e) { | ||
return e === Se; | ||
return e === xe; | ||
} | ||
function $e() { | ||
return Se; | ||
function Ee() { | ||
return xe; | ||
} | ||
function kt(e, t) { | ||
if (k(e)) | ||
return Se; | ||
return xe; | ||
const { k: n, l: o, r: s } = e; | ||
@@ -37,3 +37,3 @@ if (t === n) { | ||
} | ||
function ge(e, t, n = "k") { | ||
function de(e, t, n = "k") { | ||
if (k(e)) | ||
@@ -44,6 +44,6 @@ return [-1 / 0, void 0]; | ||
if (e[n] < t) { | ||
const o = ge(e.r, t, n); | ||
const o = de(e.r, t, n); | ||
return o[0] === -1 / 0 ? [e.k, e.v] : o; | ||
} | ||
return ge(e.l, t, n); | ||
return de(e.l, t, n); | ||
} | ||
@@ -62,5 +62,5 @@ function _(e, t, n) { | ||
if (k(e)) | ||
return Se; | ||
let s = $e(); | ||
for (const { k: i, v: r } of de(e)) | ||
return xe; | ||
let s = Ee(); | ||
for (const { k: i, v: r } of ve(e)) | ||
i > t && i <= n ? s = _(s, ...o(i, r)) : s = _(s, i, r); | ||
@@ -70,3 +70,3 @@ return s; | ||
function po(e, t, n) { | ||
let o = $e(), s = -1; | ||
let o = Ee(), s = -1; | ||
for (const { start: i, end: r, value: l } of fo(e)) | ||
@@ -76,4 +76,4 @@ i < t ? (o = _(o, i, l), s = l) : i > t + n ? o = _(o, i - n, l) : r >= t + n && s !== l && (o = _(o, t, l)); | ||
} | ||
function de(e) { | ||
return k(e) ? [] : [...de(e.l), { k: e.k, v: e.v }, ...de(e.r)]; | ||
function ve(e) { | ||
return k(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)]; | ||
} | ||
@@ -130,3 +130,3 @@ function en(e) { | ||
function fo(e) { | ||
return sn(de(e)); | ||
return sn(ve(e)); | ||
} | ||
@@ -136,3 +136,3 @@ function nn(e, t, n) { | ||
return []; | ||
const o = ge(e, t)[0]; | ||
const o = de(e, t)[0]; | ||
return sn(It(e, o, n)); | ||
@@ -185,3 +185,3 @@ } | ||
} | ||
const ct = [$e(), 0]; | ||
const ct = [Ee(), 0]; | ||
function vo(e, [t, n]) { | ||
@@ -191,3 +191,3 @@ if (n.length > 0 && k(e) && t.length === 2) { | ||
return [ | ||
n.reduce((i, r) => _(_(i, r, o), r + 1, s), $e()), | ||
n.reduce((i, r) => _(_(i, r, o), r + 1, s), Ee()), | ||
0 | ||
@@ -235,3 +235,3 @@ ]; | ||
} | ||
const xe = [[], 0, 0, 0]; | ||
const ye = [[], 0, 0, 0]; | ||
function So(e, [t, n]) { | ||
@@ -241,4 +241,4 @@ let o = 0, s = 0, i = 0, r = 0; | ||
r = it(e, n - 1, Ht), i = e[r].offset; | ||
const u = ge(t, n - 1); | ||
o = u[0], s = u[1], e.length && e[r].height === ge(t, n)[1] && (r -= 1), e = e.slice(0, r + 1); | ||
const u = de(t, n - 1); | ||
o = u[0], s = u[1], e.length && e[r].height === de(t, n)[1] && (r -= 1), e = e.slice(0, r + 1); | ||
} else | ||
@@ -295,4 +295,4 @@ e = []; | ||
x(); | ||
const fe = c(!1), Lo = x((e) => { | ||
e.link(e.pipe(fn, ve(50)), Lo); | ||
const he = c(!1), Lo = x((e) => { | ||
e.link(e.pipe(fn, be(50)), Lo); | ||
}), hn = c(wo), Ro = c(Eo, (e) => { | ||
@@ -306,4 +306,4 @@ e.link( | ||
); | ||
}), Ve = c(!1, (e) => { | ||
e.link(e.pipe(T, jt(1), W(!0)), Ve), e.link(e.pipe(T, jt(1), W(!1), ce(100)), Ve); | ||
}), We = c(!1, (e) => { | ||
e.link(e.pipe(T, jt(1), W(!0)), We), e.link(e.pipe(T, jt(1), W(!1), ce(100)), We); | ||
}), yt = c(!1, (e) => { | ||
@@ -346,3 +346,3 @@ e.link(e.pipe(te, W(!0)), yt), e.link(e.pipe(te, W(!1), ce(200)), yt); | ||
Qe, | ||
ve(10), | ||
be(10), | ||
// withLatestFrom(scrollToInProgress$), | ||
@@ -429,7 +429,7 @@ // filter(([, inProgress]) => !inProgress), | ||
}), Ut = c(0, (e) => { | ||
e.link(e.pipe(Ve, g(an), W(0)), Ut), e.link( | ||
e.link(e.pipe(We, g(an), W(0)), Ut), e.link( | ||
e.pipe( | ||
T, | ||
ve(100), | ||
S(Ve), | ||
be(100), | ||
S(We), | ||
g(([, t]) => !!t), | ||
@@ -471,3 +471,3 @@ Q(([, t], [n]) => [t, n], [0, 0]), | ||
function w() { | ||
const F = ge(t, m)[1]; | ||
const F = de(t, m)[1]; | ||
if (F === void 0) | ||
@@ -483,3 +483,3 @@ throw new Error(`Item at index ${m} not found`); | ||
} | ||
const Me = c(null), Mo = c(!1), et = c(!0), $t = x((e) => { | ||
const De = c(null), Mo = c(!1), et = c(!0), $t = x((e) => { | ||
e.link( | ||
@@ -496,3 +496,3 @@ e.pipe( | ||
), | ||
Me | ||
De | ||
); | ||
@@ -503,3 +503,3 @@ }), bn = x((e) => { | ||
bn, | ||
S(me, ye, je), | ||
S(ke, Te, Ue), | ||
f(([t, n, o, s]) => { | ||
@@ -520,9 +520,9 @@ let { align: i, behavior: r, offset: l, index: u } = Vt(t, n - 1); | ||
ee, | ||
ye, | ||
me, | ||
Te, | ||
ke, | ||
U, | ||
at, | ||
ze, | ||
Ke, | ||
we | ||
Ye, | ||
je, | ||
Le | ||
), | ||
@@ -550,3 +550,3 @@ f( | ||
); | ||
e.link(X, Me), e.link(t, Te), e.link( | ||
e.link(X, De), e.link(t, $e), e.link( | ||
e.pipe( | ||
@@ -557,3 +557,3 @@ X, | ||
), | ||
fe | ||
he | ||
), e.link(e.pipe(t, W(!1)), et), e.link(e.pipe(t, W(!1)), Mo), e.link( | ||
@@ -563,3 +563,3 @@ e.pipe( | ||
ce(0), | ||
S(et, Me), | ||
S(et, De), | ||
g(([, n, o]) => !n && o !== null), | ||
@@ -569,6 +569,6 @@ f(([, , n]) => n) | ||
X | ||
), e.sub(e.pipe(Ne, ve(20)), () => { | ||
const n = e.getValue(Me); | ||
), e.sub(e.pipe(ze, be(20)), () => { | ||
const n = e.getValue(De); | ||
n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({ | ||
[Me]: null, | ||
[De]: null, | ||
[et]: !0 | ||
@@ -592,13 +592,13 @@ }); | ||
); | ||
}), Ae = c(null), We = c(null, (e) => { | ||
}), Oe = c(null), _e = c(null, (e) => { | ||
e.link( | ||
e.pipe( | ||
We, | ||
_e, | ||
g((n) => n !== null) | ||
), | ||
Ae | ||
Oe | ||
); | ||
const t = e.pipe( | ||
e.combine(We, ee), | ||
S(Ae), | ||
e.combine(_e, ee), | ||
S(Oe), | ||
g(([[n, o], s]) => n !== null && !k(o) && s !== null), | ||
@@ -611,3 +611,3 @@ ce(10), | ||
t, | ||
Xt(e.pipe(Pe, g(an))), | ||
Xt(e.pipe(Ne, g(an))), | ||
W(null), | ||
@@ -617,3 +617,3 @@ // unset the location after the scroll completes | ||
), | ||
Ae | ||
Oe | ||
); | ||
@@ -625,3 +625,3 @@ }); | ||
const s = []; | ||
de(e).forEach(({ k: r, v: l }) => { | ||
ve(e).forEach(({ k: r, v: l }) => { | ||
var p, v; | ||
@@ -633,3 +633,3 @@ for (; n.length && n[0] < r; ) | ||
}); | ||
let i = $e(); | ||
let i = Ee(); | ||
return s.forEach(({ k: r, v: l }) => { | ||
@@ -652,3 +652,3 @@ i = _(i, r, l); | ||
} | ||
const Oo = [], De = { | ||
const Oo = [], Ae = { | ||
items: Oo, | ||
@@ -662,3 +662,3 @@ listBottom: 0, | ||
data: null | ||
}, Ee = c(De, (e) => { | ||
}, we = c(Ae, (e) => { | ||
e.link( | ||
@@ -670,14 +670,14 @@ e.pipe( | ||
ee, | ||
ye, | ||
me, | ||
we, | ||
Te, | ||
ke, | ||
Le, | ||
C, | ||
ot, | ||
We, | ||
Ae, | ||
_e, | ||
Oe, | ||
Ke, | ||
Ye, | ||
ze, | ||
Ke, | ||
je, | ||
B, | ||
he, | ||
ge, | ||
K | ||
@@ -708,6 +708,6 @@ ), | ||
if ((u == null ? void 0 : u.length) === 0) | ||
return De; | ||
return Ae; | ||
if (k(s)) { | ||
let N = 0; | ||
return p !== null && (N = Vt(p, r - 1).index), { ...De, items: Ao(N, u), offsetTree: i, totalCount: r, data: u }; | ||
return p !== null && (N = Vt(p, r - 1).index), { ...Ae, items: Ao(N, u), offsetTree: i, totalCount: r, data: u }; | ||
} | ||
@@ -733,11 +733,11 @@ let F = 0; | ||
const G = [], Z = r - 1, P = 0, L = Io(i, Y, q, P); | ||
let R = 0, Ue = 0, qe = !1; | ||
let R = 0, ae = 0, qe = !1; | ||
for (const N of L) { | ||
const { | ||
value: { offset: ke, height: oe } | ||
value: { offset: Ie, height: oe } | ||
} = N; | ||
let J = N.start; | ||
R = ke, ke < Y && (J += Math.floor((Y - ke) / oe), R += (J - N.start) * oe), J < P && (R += (P - J) * oe, J = P); | ||
const Le = Math.min(N.end, Z); | ||
for (let se = J; se <= Le && !(R >= q); se++) { | ||
R = Ie, Ie < Y && (J += Math.floor((Y - Ie) / oe), R += (J - N.start) * oe), J < P && (R += (P - J) * oe, J = P); | ||
const Re = Math.min(N.end, Z); | ||
for (let se = J; se <= Re && !(R >= q); se++) { | ||
const ht = { | ||
@@ -752,15 +752,15 @@ data: u == null ? void 0 : u[se], | ||
}; | ||
qe || (qe = !0, Ue = R), G.push(ht), R += oe; | ||
qe || (qe = !0, ae = R), G.push(ht), R += oe; | ||
} | ||
} | ||
const $ = l - R, ne = ((Ge = G[0]) == null ? void 0 : Ge.offset) || 0; | ||
return { items: G, listBottom: R, listTop: Ue, offsetTree: i, paddingBottom: $, paddingTop: ne, totalCount: r, data: u }; | ||
return { items: G, listBottom: R, listTop: ae, offsetTree: i, paddingBottom: $, paddingTop: ne, totalCount: r, data: u }; | ||
}, | ||
De | ||
Ae | ||
) | ||
), | ||
Ee | ||
we | ||
); | ||
}), rt = be([], (e) => e.pipe( | ||
e.combine(Ee, T), | ||
}), rt = me([], (e) => e.pipe( | ||
e.combine(we, T), | ||
f(([t, n]) => { | ||
@@ -772,7 +772,7 @@ const o = t.items.slice(); | ||
}) | ||
)), K = c(!1), Oe = c(!1), tt = x((e) => { | ||
)), K = c(!1), Ce = c(!1), tt = x((e) => { | ||
e.link( | ||
e.pipe( | ||
Ee, | ||
S(dn, he), | ||
we, | ||
S(dn, ge), | ||
g(([, , t]) => !t), | ||
@@ -788,3 +788,3 @@ Q( | ||
g(([t]) => t !== 0), | ||
S(T, Tt, Pe), | ||
S(T, Tt, Ne), | ||
g(([, t, n, o]) => !o && t !== 0 && n === pn), | ||
@@ -797,5 +797,5 @@ f(([[t]]) => t) | ||
}), e.sub( | ||
e.pipe(e.combine(T, B, he, Oe)), | ||
e.pipe(e.combine(T, B, ge, Ce)), | ||
([t, n, o, s]) => { | ||
o || s || (n > 0 && t < n ? (e.pub(K, !0), e.pub(Te, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
o || s || (n > 0 && t < n ? (e.pub(K, !0), e.pub($e, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
e.pubIn({ | ||
@@ -809,3 +809,3 @@ [K]: !1, | ||
}), setTimeout(() => { | ||
e.pub(Te, { top: 0, behavior: "instant" }), e.pub(K, !1); | ||
e.pub($e, { top: 0, behavior: "instant" }), e.pub(K, !1); | ||
}))); | ||
@@ -815,7 +815,7 @@ } | ||
e.pipe( | ||
e.combine(Ve, B, K, he, Oe), | ||
e.combine(We, B, K, ge, Ce), | ||
g( | ||
([t, n, o, s, i]) => !t && n !== 0 && !o && !s && !i | ||
), | ||
ve(100) | ||
be(100) | ||
), | ||
@@ -834,3 +834,3 @@ ([, t]) => { | ||
)) : e.link(tt, te); | ||
}), me = c(0), _e = c(null), C = c(null, (e) => { | ||
}), ke = c(0), Be = c(null), C = c(null, (e) => { | ||
e.link( | ||
@@ -842,13 +842,13 @@ e.pipe( | ||
), | ||
me | ||
ke | ||
); | ||
}), Re = c(null), re = x((e) => { | ||
}), Me = c(null), re = x((e) => { | ||
e.link( | ||
e.pipe( | ||
re, | ||
S(Fe), | ||
S(Pe), | ||
f(([n, o]) => -(o * n.length)) | ||
), | ||
B | ||
), e.link(e.pipe(re, W(!0)), Oe), e.link(e.pipe(re, Ot()), Re); | ||
), e.link(e.pipe(re, W(!0)), Ce), e.link(e.pipe(re, Ot()), Me); | ||
function t(n, o) { | ||
@@ -862,4 +862,4 @@ e.pubIn({ | ||
[st]: 0, | ||
[Re]: null, | ||
[Oe]: !1 | ||
[Me]: null, | ||
[Ce]: !1 | ||
}); | ||
@@ -869,4 +869,4 @@ }) : e.pubIn({ | ||
[st]: 0, | ||
[Re]: null, | ||
[Oe]: !1 | ||
[Me]: null, | ||
[Ce]: !1 | ||
}); | ||
@@ -876,4 +876,4 @@ } | ||
e.pipe( | ||
ye, | ||
S(Re), | ||
Te, | ||
S(Me), | ||
g(([, n]) => n !== null), | ||
@@ -893,3 +893,3 @@ f(([n, o]) => { | ||
Co(2), | ||
S(ye, Re), | ||
S(Te, Me), | ||
g(([, , n]) => n !== null), | ||
@@ -904,6 +904,6 @@ f(([n, o]) => xt(n.length, o)) | ||
re, | ||
S(ee, Fe), | ||
S(ee, Pe), | ||
f(([n, o, s]) => { | ||
const i = n.length, r = s; | ||
return de(o).reduce( | ||
return ve(o).reduce( | ||
(u, { k: a, v: p }) => ({ | ||
@@ -922,3 +922,3 @@ ranges: [...u.ranges, { startIndex: u.prevIndex, endIndex: a + i - 1, size: u.prevSize }], | ||
), | ||
Be | ||
Fe | ||
); | ||
@@ -928,3 +928,3 @@ }), ut = x((e) => { | ||
ut, | ||
S(je, Wt, _e, ee), | ||
S(Ue, Wt, Be, ee), | ||
g(([, , , , o]) => !k(o)), | ||
@@ -959,15 +959,15 @@ f(([{ data: o, scrollToBottom: s }, i, r, l]) => { | ||
), | ||
fe | ||
he | ||
), e.link( | ||
e.pipe( | ||
Ne, | ||
S(fe), | ||
ze, | ||
S(he), | ||
g(([o, s]) => s), | ||
f(() => !1) | ||
), | ||
fe | ||
he | ||
); | ||
const n = e.pipe( | ||
Bt, | ||
S(fe), | ||
S(he), | ||
g(([o, s]) => o === "up" && s) | ||
@@ -980,3 +980,3 @@ ); | ||
), | ||
fe | ||
he | ||
), e.link(e.pipe(n, W(!0)), $t), e.link( | ||
@@ -994,3 +994,3 @@ e.pipe( | ||
e.changeWith(C, nt, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, nt, ([t], n) => { | ||
const s = ge(t, n.offset, "k")[0], i = n.data.length; | ||
const s = de(t, n.offset, "k")[0], i = n.data.length; | ||
return [ao(t, s, 1 / 0, (l, u) => [l + i, u]), s]; | ||
@@ -1000,18 +1000,18 @@ }), e.link(nt, ut); | ||
e.changeWith(C, Et, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, Et, ([t], { offset: n, count: o }) => [po(t, n, o), n]); | ||
}), Ce = x((e) => { | ||
}), He = x((e) => { | ||
e.link( | ||
e.pipe( | ||
Ce, | ||
He, | ||
g(({ purgeItemSizes: t }) => !!t), | ||
f(({ initialLocation: t }) => t) | ||
), | ||
We | ||
_e | ||
), e.changeWith( | ||
Ee, | ||
we, | ||
e.pipe( | ||
Ce, | ||
He, | ||
g((t) => !!t.purgeItemSizes) | ||
), | ||
() => De | ||
), e.sub(e.pipe(Ce, ve(0)), ({ data: t, purgeItemSizes: n, initialLocation: o }) => { | ||
() => Ae | ||
), e.sub(e.pipe(He, be(0)), ({ data: t, purgeItemSizes: n, initialLocation: o }) => { | ||
e.pubIn({ | ||
@@ -1023,3 +1023,3 @@ [C]: t.slice(), | ||
}), qt = x((e) => { | ||
e.changeWith(C, qt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, qt, ([t], n) => [de(t).reduce((s, { k: i, v: r }) => _(s, Math.max(0, i - n), r), $e()), 0]); | ||
e.changeWith(C, qt, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, qt, ([t], n) => [ve(t).reduce((s, { k: i, v: r }) => _(s, Math.max(0, i - n), r), Ee()), 0]); | ||
}), Gt = x((e) => { | ||
@@ -1029,3 +1029,3 @@ e.changeWith(C, Gt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link( | ||
Gt, | ||
S(me, Fe), | ||
S(ke, Pe), | ||
f(([, t, n]) => [ | ||
@@ -1039,3 +1039,3 @@ { | ||
), | ||
Be | ||
Fe | ||
); | ||
@@ -1060,3 +1060,3 @@ }), mn = x((e) => { | ||
wt, | ||
ve(40), | ||
be(40), | ||
S(gn), | ||
@@ -1081,3 +1081,3 @@ g(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t), | ||
} | ||
const Be = x(); | ||
const Fe = x(); | ||
c([]); | ||
@@ -1088,6 +1088,6 @@ c([]); | ||
c(NaN); | ||
const he = c(!1), ue = c(ct, (e) => { | ||
const ge = c(!1), ue = c(ct, (e) => { | ||
e.link( | ||
e.pipe( | ||
Be, | ||
Fe, | ||
g((t) => t.length > 0), | ||
@@ -1115,3 +1115,3 @@ S(ee), | ||
); | ||
}), Fe = c(xe[1]), ye = c(xe[0]), He = c(xe, (e) => { | ||
}), Pe = c(ye[1]), Te = c(ye[0]), Ve = c(ye, (e) => { | ||
e.link( | ||
@@ -1121,22 +1121,22 @@ e.pipe( | ||
S(kn), | ||
Q(([t], [n, o]) => So(t, [n, o]), xe) | ||
Q(([t], [n, o]) => So(t, [n, o]), ye) | ||
), | ||
He | ||
Ve | ||
), e.link( | ||
e.pipe( | ||
He, | ||
Ve, | ||
f(([, t]) => t) | ||
), | ||
Fe | ||
Pe | ||
), e.link( | ||
e.pipe( | ||
He, | ||
Ve, | ||
f(([t]) => t) | ||
), | ||
ye | ||
Te | ||
); | ||
}), In = c(xe[2], (e) => { | ||
}), In = c(ye[2], (e) => { | ||
e.link( | ||
e.pipe( | ||
He, | ||
Ve, | ||
f(([, , t]) => t) | ||
@@ -1146,6 +1146,6 @@ ), | ||
); | ||
}), Sn = c(xe[3], (e) => { | ||
}), Sn = c(ye[3], (e) => { | ||
e.link( | ||
e.pipe( | ||
He, | ||
Ve, | ||
f(([, , , t]) => t) | ||
@@ -1155,23 +1155,23 @@ ), | ||
); | ||
}), we = c(0, (e) => { | ||
}), Le = c(0, (e) => { | ||
e.link( | ||
e.pipe( | ||
e.combine(me, Sn, In, Fe), | ||
e.combine(ke, Sn, In, Pe), | ||
f(([t, n, o, s]) => o + (t - n) * s) | ||
), | ||
we | ||
Le | ||
); | ||
}), Pe = x(), Wt = c(!1), Ne = x((e) => { | ||
e.link(e.pipe(Ne, W(!1)), Pe); | ||
}, !1), T = c(0), U = c(0), xn = c(0), j = c(0), Ho = T, ot = c(0), ze = c(0), Ye = c(0), Ke = c(0), _t = c(0), Lt = c(null), yn = ro(), Vo = yo, Wo = 50, at = be(0, (e) => e.pipe( | ||
e.combine(ze, Ye), | ||
}), Ne = x(), Wt = c(!1), ze = x((e) => { | ||
e.link(e.pipe(ze, W(!1)), Ne); | ||
}, !1), T = c(0), U = c(0), xn = c(0), j = c(0), Ho = T, ot = c(0), Ye = c(0), Ke = c(0), je = c(0), _t = c(0), Lt = c(null), yn = ro(), Vo = yo, Wo = 50, at = me(0, (e) => e.pipe( | ||
e.combine(Ye, Ke), | ||
f(([t, n]) => t + n) | ||
)), Tn = be(0, (e) => e.pipe( | ||
e.combine(Ke, _t), | ||
)), Tn = me(0, (e) => e.pipe( | ||
e.combine(je, _t), | ||
f(([t, n]) => t + n) | ||
)), _o = be(0, (e) => e.pipe( | ||
e.combine(ze, Ye, T), | ||
)), _o = me(0, (e) => e.pipe( | ||
e.combine(Ye, Ke, T), | ||
f(([t, n, o]) => t + Math.max(n - o, 0)) | ||
)), Bo = be(0, (e) => e.pipe( | ||
e.combine(Ke, _t, T, U, j), | ||
)), Bo = me(0, (e) => e.pipe( | ||
e.combine(je, _t, T, U, j), | ||
f(([t, n, o, s, i]) => { | ||
@@ -1181,3 +1181,3 @@ const r = Math.max(n - (i - (o + s)), 0); | ||
}) | ||
)), $n = be(0, (e) => e.pipe( | ||
)), $n = me(0, (e) => e.pipe( | ||
e.combine(U, _o, Bo), | ||
@@ -1188,3 +1188,3 @@ f(([t, n, o]) => t - n - o) | ||
e.pipe( | ||
e.combine(En, we, U), | ||
e.combine(En, Le, U), | ||
f(([t, n, o]) => t === 0 ? 0 : Math.max(0, Math.min(t - (n - o)))) | ||
@@ -1194,6 +1194,6 @@ ), | ||
); | ||
}), Te = x((e) => { | ||
}), $e = x((e) => { | ||
e.link( | ||
e.pipe( | ||
Te, | ||
$e, | ||
f((t) => t.align === "start" ? t.top ?? 0 : 0) | ||
@@ -1204,3 +1204,3 @@ ), | ||
e.pipe( | ||
Te, | ||
$e, | ||
S(T), | ||
@@ -1210,5 +1210,5 @@ g(([t, n]) => t.top !== n), | ||
), | ||
Pe | ||
Ne | ||
); | ||
}), je = be( | ||
}), Ue = me( | ||
{ | ||
@@ -1226,10 +1226,10 @@ listOffset: 0, | ||
Tn, | ||
Ye, | ||
Ke, | ||
$n, | ||
j, | ||
pt, | ||
he, | ||
Ae, | ||
ge, | ||
Oe, | ||
K, | ||
fe | ||
he | ||
), | ||
@@ -1267,3 +1267,3 @@ g(([, , , , , , , t, n, o]) => !t && n === null && !o), | ||
ce(0), | ||
S(je), | ||
S(Ue), | ||
g(([, t]) => t.scrollHeight > 0), | ||
@@ -1293,3 +1293,3 @@ f(([, t]) => t) | ||
e.pipe( | ||
e.combine(At, we, U, at, Tn), | ||
e.combine(At, Le, U, at, Tn), | ||
g(([t]) => t === "bottom" || t === "bottom-smooth"), | ||
@@ -1676,3 +1676,3 @@ f(([, t, n, o, s]) => Math.max(0, n - t - o - s)) | ||
now: /* @__PURE__ */ new Date(), | ||
packageTimestamp: 1721218568120 | ||
packageTimestamp: 1723094551826 | ||
}); | ||
@@ -1711,3 +1711,3 @@ return /* @__PURE__ */ y(Un.Provider, { value: n, children: t }); | ||
if (a.top === ((p = e.current) == null ? void 0 : p.scrollTop)) { | ||
o.pub(Ne, (v = e.current) == null ? void 0 : v.scrollTop); | ||
o.pub(ze, (v = e.current) == null ? void 0 : v.scrollTop); | ||
return; | ||
@@ -1740,3 +1740,3 @@ } | ||
replace: (t, n) => { | ||
e.pub(Ce, { | ||
e.pub(He, { | ||
...n, | ||
@@ -1771,3 +1771,3 @@ data: t | ||
batch: (t, n) => { | ||
e.pub(he, !0), t(), e.pub(he, !1), e.pub(ut, { data: [], scrollToBottom: n }); | ||
e.pub(ge, !0), t(), e.pub(ge, !1), e.pub(ut, { data: [], scrollToBottom: n }); | ||
}, | ||
@@ -1785,3 +1785,3 @@ get: () => e.getValue(C).slice(), | ||
getScrollLocation() { | ||
return e.getValue(je); | ||
return e.getValue(Ue); | ||
}, | ||
@@ -1794,3 +1794,3 @@ cancelSmoothScroll() { | ||
const cs = ({ item: e, ItemContent: t, mount: n, unmount: o }) => { | ||
const s = V(_e), i = h.useRef(null), r = h.useCallback( | ||
const s = V(Be), i = h.useRef(null), r = h.useCallback( | ||
(l) => { | ||
@@ -1851,7 +1851,7 @@ l ? (i.current = l, n(l)) : i.current && (o(i.current), i.current = null); | ||
const L = new lo(); | ||
return L.register(Ee), L.register(Pe), L.register(tt), L.register(Qe), L.register(lt), L.register(re), L.register(Ce), L.pubIn({ | ||
return L.register(we), L.register(Ne), L.register(tt), L.register(Qe), L.register(lt), L.register(re), L.register(He), L.pubIn({ | ||
[C]: e.slice(), | ||
[_e]: n, | ||
[Be]: n, | ||
[Mn]: t, | ||
[We]: o, | ||
[_e]: o, | ||
[Dt]: l, | ||
@@ -1873,3 +1873,3 @@ [Dn]: u, | ||
Z.pubIn({ | ||
[_e]: n, | ||
[Be]: n, | ||
[Dt]: l | ||
@@ -1883,3 +1883,4 @@ }), Z.singletonSub(Rt, i), Z.singletonSub(rt, r); | ||
const L = (R) => { | ||
R.message.includes("ResizeObserver loop") && (R.preventDefault(), R.stopPropagation(), R.stopImmediatePropagation()); | ||
var ae; | ||
(ae = R.message) != null && ae.includes("ResizeObserver loop") && (R.preventDefault(), R.stopPropagation(), R.stopImmediatePropagation()); | ||
}; | ||
@@ -1932,10 +1933,10 @@ return window.addEventListener("error", L, { capture: !0 }), () => { | ||
var Ft, Pt, Nt, zt; | ||
const Ie = d.length, ie = []; | ||
const Se = d.length, ie = []; | ||
let H = {}; | ||
for (let gt = 0; gt < Ie; gt++) { | ||
const pe = d[gt], z = pe.target; | ||
for (let gt = 0; gt < Se; gt++) { | ||
const fe = d[gt], z = fe.target; | ||
if (z === P.current) { | ||
H = { | ||
...H, | ||
[Ye]: pe.contentRect.height, | ||
[Ke]: fe.contentRect.height, | ||
[j]: (Ft = $.current) == null ? void 0 : Ft.scrollHeight | ||
@@ -1947,3 +1948,3 @@ }; | ||
...H, | ||
[ze]: pe.contentRect.height, | ||
[Ye]: fe.contentRect.height, | ||
[j]: (Pt = $.current) == null ? void 0 : Pt.scrollHeight | ||
@@ -1955,3 +1956,3 @@ }; | ||
...H, | ||
[_t]: pe.contentRect.height, | ||
[_t]: fe.contentRect.height, | ||
[j]: (Nt = $.current) == null ? void 0 : Nt.scrollHeight | ||
@@ -1963,3 +1964,3 @@ }; | ||
...H, | ||
[Ke]: pe.contentRect.height, | ||
[je]: fe.contentRect.height, | ||
[j]: (zt = $.current) == null ? void 0 : zt.scrollHeight | ||
@@ -1973,3 +1974,3 @@ }; | ||
[j]: z.scrollHeight, | ||
[U]: pe.contentRect.height, | ||
[U]: fe.contentRect.height, | ||
[xn]: z.clientWidth | ||
@@ -1987,3 +1988,3 @@ }; | ||
continue; | ||
const dt = parseInt(z.dataset.index), so = parseFloat(z.dataset.knownSize ?? ""), vt = pe.contentRect.height; | ||
const dt = parseInt(z.dataset.index), so = parseFloat(z.dataset.knownSize ?? ""), vt = fe.contentRect.height; | ||
if (vt === so) | ||
@@ -1996,13 +1997,13 @@ continue; | ||
...H, | ||
[Be]: ie | ||
[Fe]: ie | ||
}), n.pubIn(H); | ||
}); | ||
}), [F, Y] = Je(b), [q, G] = Je(b), [Z, P] = Je(b), [L, R] = Je(b), Ue = h.useCallback( | ||
}), [F, Y] = Je(b), [q, G] = Je(b), [Z, P] = Je(b), [L, R] = Je(b), ae = h.useCallback( | ||
(d) => { | ||
if (o) { | ||
const Ie = parseInt(d.dataset.index ?? ""); | ||
n.pub(Be, [ | ||
const Se = parseInt(d.dataset.index ?? ""); | ||
n.pub(Fe, [ | ||
{ | ||
startIndex: Ie, | ||
endIndex: Ie, | ||
startIndex: Se, | ||
endIndex: Se, | ||
size: o.itemHeight | ||
@@ -2025,3 +2026,3 @@ } | ||
[b] | ||
), N = h.useRef(null), ke = ls($, ne, N), oe = h.useCallback((d) => { | ||
), N = h.useRef(null), Ie = ls($, ne, N), oe = h.useCallback((d) => { | ||
$.current && ($.current.scrollTop += d); | ||
@@ -2032,8 +2033,8 @@ }, []), J = h.useCallback(() => { | ||
if (N.current !== null) { | ||
const Ie = d.scrollHeight - d.clientHeight; | ||
un(d.scrollTop, Math.min(Ie, N.current)) && (N.current = null, n.pub(Wt, !1), n.pub(Ne, d.scrollTop)); | ||
const Se = d.scrollHeight - d.clientHeight; | ||
un(d.scrollTop, Math.min(Se, N.current)) && (N.current = null, n.pub(Wt, !1), n.pub(ze, d.scrollTop)); | ||
} | ||
n.pub(T, d.scrollTop); | ||
} | ||
}, [n]), Le = h.useCallback( | ||
}, [n]), Re = h.useCallback( | ||
(d) => { | ||
@@ -2045,12 +2046,12 @@ n.pub(Bt, d.deltaY > 0 ? "down" : "up"); | ||
(d) => { | ||
d ? (n.pub(Lt, d), $.current = d, d.addEventListener("scroll", J), d.addEventListener("wheel", Le), o && n.pubIn({ | ||
d ? (n.pub(Lt, d), $.current = d, d.addEventListener("scroll", J), d.addEventListener("wheel", Re), o && n.pubIn({ | ||
[U]: o.viewportHeight, | ||
[j]: o.viewportHeight, | ||
[T]: 0 | ||
}), b.observe(d, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", J), $.current.removeEventListener("wheel", Le), n.pub(Lt, null), b.unobserve($.current), $.current = null); | ||
}), b.observe(d, { box: "border-box" })) : $.current && ($.current.removeEventListener("scroll", J), $.current.removeEventListener("wheel", Re), n.pub(Lt, null), b.unobserve($.current), $.current = null); | ||
}, | ||
[b, n, J, Le, o] | ||
), { items: ht } = V(Ee); | ||
h.useLayoutEffect(() => n.sub(Te, ke), [ke, n]), h.useLayoutEffect(() => n.sub(te, oe), [oe, n]); | ||
const Gn = V(B), Zn = V(st), Jn = V(K), Xn = V(Mt), Qn = V(pt), eo = V(wn), ae = V(_e), to = V(Mn), no = V(me), oo = V(we); | ||
[b, n, J, Re, o] | ||
), { items: ht } = V(we); | ||
h.useLayoutEffect(() => n.sub($e, Ie), [Ie, n]), h.useLayoutEffect(() => n.sub(te, oe), [oe, n]); | ||
const Gn = V(B), Zn = V(st), Jn = V(K), Xn = V(Mt), Qn = V(pt), eo = V(wn), pe = V(Be), to = V(Mn), no = V(ke), oo = V(Le); | ||
return /* @__PURE__ */ y(io, { children: /* @__PURE__ */ Jt( | ||
@@ -2067,6 +2068,6 @@ I, | ||
}, | ||
...I === "div" ? { context: ae } : {}, | ||
...I === "div" ? { context: pe } : {}, | ||
children: [ | ||
i && /* @__PURE__ */ y(l, { ref: L, style: Ze, children: /* @__PURE__ */ y(i, { context: ae }) }), | ||
s && /* @__PURE__ */ y(r, { ref: Z, style: Ze, children: /* @__PURE__ */ y(s, { context: ae }) }), | ||
i && /* @__PURE__ */ y(l, { ref: L, style: Ze, children: /* @__PURE__ */ y(i, { context: pe }) }), | ||
s && /* @__PURE__ */ y(r, { ref: Z, style: Ze, children: /* @__PURE__ */ y(s, { context: pe }) }), | ||
no > 0 ? /* @__PURE__ */ y( | ||
@@ -2090,3 +2091,3 @@ "div", | ||
{ | ||
mount: Ue, | ||
mount: ae, | ||
unmount: qe, | ||
@@ -2096,8 +2097,8 @@ item: d, | ||
}, | ||
to({ index: d.index, data: d.data, context: ae }) | ||
to({ index: d.index, data: d.data, context: pe }) | ||
)) | ||
} | ||
) : w ? /* @__PURE__ */ y(w, { context: ae }) : null, | ||
u && /* @__PURE__ */ y(p, { ref: F, style: Ze, children: /* @__PURE__ */ y(u, { context: ae }) }), | ||
a && /* @__PURE__ */ y(v, { ref: q, style: Ze, children: /* @__PURE__ */ y(a, { context: ae }) }) | ||
) : w ? /* @__PURE__ */ y(w, { context: pe }) : null, | ||
u && /* @__PURE__ */ y(p, { ref: F, style: Ze, children: /* @__PURE__ */ y(u, { context: pe }) }), | ||
a && /* @__PURE__ */ y(v, { ref: q, style: Ze, children: /* @__PURE__ */ y(a, { context: pe }) }) | ||
] | ||
@@ -2108,3 +2109,3 @@ } | ||
function gs() { | ||
return V(je); | ||
return V(Ue); | ||
} | ||
@@ -2111,0 +2112,0 @@ function ds() { |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.8.3", | ||
"version": "1.8.4", | ||
"type": "module", | ||
@@ -26,0 +26,0 @@ "module": "dist/index.js", |
95150
2452