@virtuoso.dev/message-list
Advanced tools
Comparing version 1.8.0-alpha.14 to 1.8.0-alpha.15
@@ -0,1 +1,8 @@ | ||
# [1.8.0-alpha.15](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.14...v1.8.0-alpha.15) (2024-06-17) | ||
### Bug Fixes | ||
* another take on animation ([318dfdc](https://github.com/virtuoso-dev/message-list/commit/318dfdc91ee3eedba98491e61f1fe0be95b861ba)) | ||
# [1.8.0-alpha.14](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.13...v1.8.0-alpha.14) (2024-06-17) | ||
@@ -2,0 +9,0 @@ |
import { jsxs as Nt, jsx as y, Fragment as Gn } from "react/jsx-runtime"; | ||
import g from "react"; | ||
import { Cell as c, Signal as I, map as a, withLatestFrom as $, filter as v, mapTo as O, debounceTime as de, throttleTime as ce, delayWithMicrotask as At, onNext as Qe, scan as U, useCellValue as B, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx"; | ||
import { Cell as c, Signal as I, map as a, withLatestFrom as T, filter as v, mapTo as O, debounceTime as ge, throttleTime as ve, delayWithMicrotask as Dt, onNext as Qe, scan as U, useCellValue as B, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx"; | ||
function be(e, t) { | ||
@@ -31,6 +31,6 @@ const n = c(e, (o) => { | ||
const [i, l] = Kt(o); | ||
return Ke(T(e, { k: i, l: jt(o), v: l })); | ||
return Ke($(e, { k: i, l: jt(o), v: l })); | ||
} | ||
} else | ||
return t < n ? Ke(T(e, { l: bt(o, t) })) : Ke(T(e, { r: bt(s, t) })); | ||
return t < n ? Ke($(e, { l: bt(o, t) })) : Ke($(e, { r: bt(s, t) })); | ||
} | ||
@@ -49,3 +49,3 @@ function re(e, t, n = "k") { | ||
function C(e, t, n) { | ||
return b(e) ? Yt(t, n, 1) : t === e.k ? T(e, { k: t, v: n }) : t < e.k ? Vt(T(e, { l: C(e.l, t, n) })) : Vt(T(e, { r: C(e.r, t, n) })); | ||
return b(e) ? Yt(t, n, 1) : t === e.k ? $(e, { k: t, v: n }) : t < e.k ? Vt($(e, { l: C(e.l, t, n) })) : Vt($(e, { r: C(e.r, t, n) })); | ||
} | ||
@@ -63,3 +63,3 @@ function mt(e, t, n) { | ||
let s = me(); | ||
for (const { k: i, v: l } of ve(e)) | ||
for (const { k: i, v: l } of de(e)) | ||
i > t && i <= n ? s = C(s, ...o(i, l)) : s = C(s, i, l); | ||
@@ -74,4 +74,4 @@ return s; | ||
} | ||
function ve(e) { | ||
return b(e) ? [] : [...ve(e.l), { k: e.k, v: e.v }, ...ve(e.r)]; | ||
function de(e) { | ||
return b(e) ? [] : [...de(e.l), { k: e.k, v: e.v }, ...de(e.r)]; | ||
} | ||
@@ -82,5 +82,5 @@ function Kt(e) { | ||
function jt(e) { | ||
return b(e.r) ? e.l : Ke(T(e, { r: jt(e.r) })); | ||
return b(e.r) ? e.l : Ke($(e, { r: jt(e.r) })); | ||
} | ||
function T(e, t) { | ||
function $(e, t) { | ||
return Yt(t.k ?? e.k, t.v ?? e.v, t.lvl ?? e.lvl, t.l ?? e.l, t.r ?? e.r); | ||
@@ -100,8 +100,8 @@ } | ||
if (dt(t)) | ||
return Zt(T(e, { lvl: o - 1 })); | ||
return Zt($(e, { lvl: o - 1 })); | ||
if (!b(t) && !b(t.r)) | ||
return T(t.r, { | ||
l: T(t, { r: t.r.l }), | ||
return $(t.r, { | ||
l: $(t, { r: t.r.l }), | ||
lvl: o, | ||
r: T(e, { | ||
r: $(e, { | ||
l: t.r.r, | ||
@@ -114,7 +114,7 @@ lvl: o - 1 | ||
if (dt(e)) | ||
return kt(T(e, { lvl: o - 1 })); | ||
return kt($(e, { lvl: o - 1 })); | ||
if (!b(n) && !b(n.l)) { | ||
const s = n.l, i = dt(s) ? n.lvl - 1 : n.lvl; | ||
return T(s, { | ||
l: T(e, { | ||
return $(s, { | ||
l: $(e, { | ||
lvl: o - 1, | ||
@@ -124,3 +124,3 @@ r: s.l | ||
lvl: s.lvl + 1, | ||
r: kt(T(n, { l: s.r, lvl: i })) | ||
r: kt($(n, { l: s.r, lvl: i })) | ||
}); | ||
@@ -132,3 +132,3 @@ } else | ||
function to(e) { | ||
return Gt(ve(e)); | ||
return Gt(de(e)); | ||
} | ||
@@ -158,7 +158,7 @@ function Ut(e, t, n) { | ||
const { r: t, lvl: n } = e; | ||
return !b(t) && !b(t.r) && t.lvl === n && t.r.lvl === n ? T(t, { l: T(e, { r: t.l }), lvl: n + 1 }) : e; | ||
return !b(t) && !b(t.r) && t.lvl === n && t.r.lvl === n ? $(t, { l: $(e, { r: t.l }), lvl: n + 1 }) : e; | ||
} | ||
function Zt(e) { | ||
const { l: t } = e; | ||
return !b(t) && t.lvl === e.lvl ? T(t, { r: T(e, { l: t.r }) }) : e; | ||
return !b(t) && t.lvl === e.lvl ? $(t, { r: $(e, { l: t.r }) }) : e; | ||
} | ||
@@ -223,3 +223,3 @@ function no(e) { | ||
} | ||
function Dt({ index: e }, t) { | ||
function At({ index: e }, t) { | ||
return t === e ? 0 : t < e ? -1 : 1; | ||
@@ -234,9 +234,9 @@ } | ||
function co(e, t, n, o = 0) { | ||
return o > 0 && (t = Math.max(t, Jt(e, o, Dt).offset)), t = Math.max(0, t), qt(io(e, t, n, lo), ro); | ||
return o > 0 && (t = Math.max(t, Jt(e, o, At).offset)), t = Math.max(0, t), qt(io(e, t, n, lo), ro); | ||
} | ||
const $e = [[], 0, 0, 0]; | ||
const Te = [[], 0, 0, 0]; | ||
function uo(e, [t, n]) { | ||
let o = 0, s = 0, i = 0, l = 0; | ||
if (n !== 0) { | ||
l = et(e, n - 1, Dt), i = e[l].offset; | ||
l = et(e, n - 1, At), i = e[l].offset; | ||
const u = re(t, n - 1); | ||
@@ -255,3 +255,3 @@ o = u[0], s = u[1], e.length && e[l].height === re(t, n)[1] && (l -= 1), e = e.slice(0, l + 1); | ||
return [0, 0]; | ||
const { offset: n, index: o, height: s } = Jt(t, e, Dt); | ||
const { offset: n, index: o, height: s } = Jt(t, e, At); | ||
return [s * (e - o) + n, s]; | ||
@@ -332,3 +332,3 @@ } | ||
on, | ||
$(ke, rt, Fe), | ||
T(ke, rt, Fe), | ||
a(([t, n, o, s]) => { | ||
@@ -347,3 +347,3 @@ let { align: i, behavior: l, offset: r, index: u } = Ct(t, n - 1); | ||
ne, | ||
$( | ||
T( | ||
G, | ||
@@ -382,4 +382,4 @@ rt, | ||
G, | ||
de(0), | ||
$(je, Le), | ||
ge(0), | ||
T(je, Le), | ||
v(([, n, o]) => !n && o !== null), | ||
@@ -389,3 +389,3 @@ a(([, , n]) => n) | ||
ne | ||
), e.sub(e.pipe(Oe, ce(20)), () => { | ||
), e.sub(e.pipe(Oe, ve(20)), () => { | ||
const n = e.getValue(Le); | ||
@@ -400,3 +400,3 @@ n !== null && typeof n != "number" && n.done !== void 0 && n.done(), e.pubIn({ | ||
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by | ||
At(), | ||
Dt(), | ||
v((n) => n !== 0), | ||
@@ -424,8 +424,8 @@ a((n) => ({ top: n })) | ||
e.combine(nt, G), | ||
$(Me), | ||
T(Me), | ||
v(([[n, o], s]) => n !== null && !b(o) && s !== null), | ||
de(10), | ||
ge(10), | ||
a(([[n]]) => n) | ||
); | ||
e.link(e.pipe(t, At()), ne), e.link( | ||
e.link(e.pipe(t, Dt()), ne), e.link( | ||
e.pipe( | ||
@@ -436,3 +436,3 @@ t, | ||
// unset the location after the scroll completes | ||
de(10) | ||
ge(10) | ||
), | ||
@@ -446,3 +446,3 @@ Me | ||
const s = []; | ||
ve(e).forEach(({ k: l, v: r }) => { | ||
de(e).forEach(({ k: l, v: r }) => { | ||
var p, m; | ||
@@ -523,3 +523,3 @@ for (; n.length && n[0] < l; ) | ||
]) => { | ||
var fe; | ||
var pe; | ||
if ((u == null ? void 0 : u.length) === 0) | ||
@@ -546,6 +546,6 @@ return Ne; | ||
0 | ||
), ae = X + o; | ||
if (t.offsetTree === i && t.totalCount === l && t.data === u && X >= t.listTop && ae <= t.listBottom) | ||
), ue = X + o; | ||
if (t.offsetTree === i && t.totalCount === l && t.data === u && X >= t.listTop && ue <= t.listBottom) | ||
return t; | ||
const pe = [], j = l - 1, P = 0, N = co(i, X, ae, P); | ||
const ae = [], j = l - 1, P = 0, N = co(i, X, ue, P); | ||
let K = 0, Pe = 0, E = !1; | ||
@@ -559,3 +559,3 @@ for (const V of N) { | ||
const we = Math.min(V.end, j); | ||
for (let ie = ee; ie <= we && !(K >= ae); ie++) { | ||
for (let ie = ee; ie <= we && !(K >= ue); ie++) { | ||
const ft = { | ||
@@ -570,7 +570,7 @@ data: u == null ? void 0 : u[ie], | ||
}; | ||
E || (E = !0, Pe = K), pe.push(ft), K += se; | ||
E || (E = !0, Pe = K), ae.push(ft), K += se; | ||
} | ||
} | ||
const Q = r - K, pt = ((fe = pe[0]) == null ? void 0 : fe.offset) || 0; | ||
return { items: pe, listBottom: K, listTop: Pe, offsetTree: i, paddingBottom: Q, paddingTop: pt, totalCount: l, data: u }; | ||
const Q = r - K, pt = ((pe = ae[0]) == null ? void 0 : pe.offset) || 0; | ||
return { items: ae, listBottom: K, listTop: Pe, offsetTree: i, paddingBottom: Q, paddingTop: pt, totalCount: l, data: u }; | ||
}, | ||
@@ -613,3 +613,3 @@ Ne | ||
const Ue = c(!1), Io = I((e) => { | ||
e.link(e.pipe(ln, ce(50)), Io); | ||
e.link(e.pipe(ln, ve(50)), Io); | ||
}), rn = c(yo), So = c(ko, (e) => { | ||
@@ -623,6 +623,6 @@ e.link( | ||
); | ||
}), De = c(!1, (e) => { | ||
e.link(e.pipe(x, Bt(1), O(!0)), De), e.link(e.pipe(x, Bt(1), O(!1), de(100)), De); | ||
}), Ae = c(!1, (e) => { | ||
e.link(e.pipe(x, Bt(1), O(!0)), Ae), e.link(e.pipe(x, Bt(1), O(!1), ge(100)), Ae); | ||
}), It = c(!1, (e) => { | ||
e.link(e.pipe(oe, O(!0)), It), e.link(e.pipe(oe, O(!1), de(200)), It); | ||
e.link(e.pipe(oe, O(!0)), It), e.link(e.pipe(oe, O(!1), ge(200)), It); | ||
}), cn = c(!1), qe = c( | ||
@@ -633,3 +633,3 @@ null, | ||
e.pipe( | ||
e.combine(Te, x, Z, gn, rn, ut, G), | ||
e.combine($e, x, Z, gn, rn, ut, G), | ||
v(([, , , , , , t]) => !b(t)), | ||
@@ -664,3 +664,3 @@ U((t, [n, o, s, i, l]) => { | ||
qe, | ||
ce(10), | ||
ve(10), | ||
// withLatestFrom(scrollToInProgress$), | ||
@@ -684,3 +684,3 @@ // filter(([, inProgress]) => !inProgress), | ||
Z, | ||
$(qe), | ||
T(qe), | ||
U( | ||
@@ -703,3 +703,3 @@ (t, [n, o]) => { | ||
e.pipe( | ||
e.combine(x, Te, Z), | ||
e.combine(x, $e, Z), | ||
U( | ||
@@ -747,9 +747,9 @@ (t, [n, o, s]) => { | ||
ot | ||
), e.link(e.pipe(x, ce(50), O(bo)), ot); | ||
), e.link(e.pipe(x, ve(50), O(bo)), ot); | ||
}), Wt = c(0, (e) => { | ||
e.link(e.pipe(De, v(tn), O(0)), Wt), e.link( | ||
e.link(e.pipe(Ae, v(tn), O(0)), Wt), e.link( | ||
e.pipe( | ||
x, | ||
ce(100), | ||
$(De), | ||
ve(100), | ||
T(Ae), | ||
v(([, t]) => !!t), | ||
@@ -765,3 +765,3 @@ U(([, t], [n]) => [t, n], [0, 0]), | ||
He, | ||
$(un, q), | ||
T(un, q), | ||
v(([, , t]) => !t), | ||
@@ -777,3 +777,3 @@ U( | ||
v(([t]) => t !== 0), | ||
$(x, ot, Ve), | ||
T(x, ot, Ve), | ||
v(([, t, n, o]) => !o && t !== 0 && n === sn), | ||
@@ -783,3 +783,3 @@ a(([[t]]) => t) | ||
Ge | ||
), en() ? (e.sub(e.pipe(Ge, $(_, x)), ([t, n]) => { | ||
), en() ? (e.sub(e.pipe(Ge, T(_, x)), ([t, n]) => { | ||
e.pub(_, n - t); | ||
@@ -800,5 +800,5 @@ }), e.sub(e.pipe(e.combine(x, _, q)), ([t, n, o]) => { | ||
e.pipe( | ||
e.combine(De, _, W, q), | ||
e.combine(Ae, _, W, q), | ||
v(([t, n, o, s]) => !t && n !== 0 && !o && !s), | ||
ce(100) | ||
ve(100) | ||
), | ||
@@ -832,16 +832,16 @@ ([, t]) => { | ||
); | ||
}), ge = I((e) => { | ||
e.link(e.pipe(ge, O(!0)), q); | ||
}), he = I((e) => { | ||
e.link(e.pipe(he, O(!0)), q); | ||
const t = en(); | ||
e.link( | ||
e.pipe( | ||
ge, | ||
$(Se), | ||
he, | ||
T(Se), | ||
a(([n, o]) => o * n.length) | ||
), | ||
_ | ||
), e.link(e.pipe(ge, O(t)), W), e.sub( | ||
), e.link(e.pipe(he, O(t)), W), e.sub( | ||
e.pipe( | ||
ge, | ||
$(Se), | ||
he, | ||
T(Se), | ||
a(([n, o]) => ({ | ||
@@ -851,3 +851,3 @@ top: o * n.length, | ||
})), | ||
At() | ||
Dt() | ||
), | ||
@@ -863,9 +863,9 @@ (n) => { | ||
} | ||
), e.changeWith(H, ge, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
), e.changeWith(H, he, (n, o) => n ? [...o, ...n] : o.slice()), e.link( | ||
e.pipe( | ||
ge, | ||
$(G, Se), | ||
he, | ||
T(G, Se), | ||
a(([n, o, s]) => { | ||
const i = n.length, l = s; | ||
return ve(o).reduce( | ||
return de(o).reduce( | ||
(r, { k: u, v: h }) => ({ | ||
@@ -889,3 +889,3 @@ ranges: [...r.ranges, { startIndex: r.prevIndex, endIndex: u + i - 1, size: r.prevSize }], | ||
it, | ||
$(Fe, Tt, Ce, G), | ||
T(Fe, $t, Ce, G), | ||
v(([, , , , o]) => !b(o)), | ||
@@ -912,4 +912,3 @@ a(([{ data: o, scrollToBottom: s }, i, l, r]) => { | ||
return u === !0 && (u = "auto"), { index: "LAST", align: "end", behavior: u }; | ||
}), | ||
ce(50) | ||
}) | ||
); | ||
@@ -944,3 +943,3 @@ e.link( | ||
v((o) => o !== null), | ||
de(1) | ||
ge(1) | ||
), | ||
@@ -952,3 +951,3 @@ ne | ||
}), Ze = I((e) => { | ||
e.changeWith(H, Ze, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ue, Ze, ([t], n) => { | ||
e.changeWith(H, Ze, (t, n) => t ? [...t.slice(0, n.offset), ...n.data, ...t.slice(n.offset)] : n.data.slice()), e.changeWith(ce, Ze, ([t], n) => { | ||
const s = re(t, n.offset, "k")[0], i = n.data.length; | ||
@@ -958,3 +957,3 @@ return [Qn(t, s, 1 / 0, (r, u) => [r + i, u]), s]; | ||
}), xt = I((e) => { | ||
e.changeWith(H, xt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ue, xt, ([t], { offset: n, count: o }) => [eo(t, n, o), n]); | ||
e.changeWith(H, xt, (t, { offset: n, count: o }) => t ? t.slice(0, n).concat(t.slice(n + o)) : []), e.changeWith(ce, xt, ([t], { offset: n, count: o }) => [eo(t, n, o), n]); | ||
}), Je = I((e) => { | ||
@@ -967,3 +966,3 @@ e.changeWith(H, Je, (t, n) => n.data.slice()), e.link( | ||
ne | ||
), e.changeWith(ue, Je, (t, n) => { | ||
), e.changeWith(ce, Je, (t, n) => { | ||
const o = re(t[0], 1 / 0, "k")[1]; | ||
@@ -976,3 +975,3 @@ if (!o) | ||
}), _t = I((e) => { | ||
e.changeWith(H, _t, (t, n) => t ? t.slice(n) : []), e.changeWith(ue, _t, ([t], n) => [ve(t).reduce((s, { k: i, v: l }) => C(s, Math.max(0, i - n), l), me()), 0]); | ||
e.changeWith(H, _t, (t, n) => t ? t.slice(n) : []), e.changeWith(ce, _t, ([t], n) => [de(t).reduce((s, { k: i, v: l }) => C(s, Math.max(0, i - n), l), me()), 0]); | ||
}), Ft = I((e) => { | ||
@@ -982,3 +981,3 @@ e.changeWith(H, Ft, (t, n) => t ? t.slice(0, t.length - n) : []), e.link( | ||
Ft, | ||
$(ke, Se), | ||
T(ke, Se), | ||
a(([, t, n]) => [ | ||
@@ -997,3 +996,3 @@ { | ||
an, | ||
$(H), | ||
T(H), | ||
a(([n, o]) => { | ||
@@ -1008,9 +1007,9 @@ if (!o) | ||
); | ||
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ue, t, ([n], o) => [ho(n, o), 0]); | ||
}), $t = I((e) => { | ||
e.changeWith(H, $t, (t, { mapper: n }) => t ? t.map(n) : []), e.link( | ||
e.changeWith(H, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ce, t, ([n], o) => [ho(n, o), 0]); | ||
}), Tt = I((e) => { | ||
e.changeWith(H, Tt, (t, { mapper: n }) => t ? t.map(n) : []), e.link( | ||
e.pipe( | ||
$t, | ||
ce(40), | ||
$(cn), | ||
Tt, | ||
ve(40), | ||
T(cn), | ||
v(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t), | ||
@@ -1027,3 +1026,3 @@ a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t })) | ||
c(NaN); | ||
const q = c(!1), ue = c(st, (e) => { | ||
const q = c(!1), ce = c(st, (e) => { | ||
e.link( | ||
@@ -1033,6 +1032,6 @@ e.pipe( | ||
v((t) => t.length > 0), | ||
$(G), | ||
T(G), | ||
a(([t, n]) => so(n, [t, []])) | ||
), | ||
ue | ||
ce | ||
); | ||
@@ -1042,3 +1041,3 @@ }), G = c(st[0], (e) => { | ||
e.pipe( | ||
ue, | ||
ce, | ||
a(([t]) => t) | ||
@@ -1051,3 +1050,3 @@ ), | ||
e.pipe( | ||
ue, | ||
ce, | ||
a(([, t]) => t) | ||
@@ -1057,13 +1056,13 @@ ), | ||
); | ||
}), Se = c($e[1]), rt = c($e[0]), Ae = c($e, (e) => { | ||
}), Se = c(Te[1]), rt = c(Te[0]), De = c(Te, (e) => { | ||
e.link( | ||
e.pipe( | ||
G, | ||
$(pn), | ||
U(([t], [n, o]) => uo(t, [n, o]), $e) | ||
T(pn), | ||
U(([t], [n, o]) => uo(t, [n, o]), Te) | ||
), | ||
Ae | ||
De | ||
), e.link( | ||
e.pipe( | ||
Ae, | ||
De, | ||
a(([, t]) => t) | ||
@@ -1074,3 +1073,3 @@ ), | ||
e.pipe( | ||
Ae, | ||
De, | ||
a(([t]) => t) | ||
@@ -1080,6 +1079,6 @@ ), | ||
); | ||
}), fn = c($e[2], (e) => { | ||
}), fn = c(Te[2], (e) => { | ||
e.link( | ||
e.pipe( | ||
Ae, | ||
De, | ||
a(([, , t]) => t) | ||
@@ -1089,6 +1088,6 @@ ), | ||
); | ||
}), hn = c($e[3], (e) => { | ||
}), hn = c(Te[3], (e) => { | ||
e.link( | ||
e.pipe( | ||
Ae, | ||
De, | ||
a(([, , , t]) => t) | ||
@@ -1106,5 +1105,5 @@ ), | ||
); | ||
}), Ve = I(), Tt = c(!1), Oe = I((e) => { | ||
}), Ve = I(), $t = c(!1), Oe = I((e) => { | ||
e.link(e.pipe(Oe, O(!1)), Ve); | ||
}), x = c(0), Z = c(0), gn = c(0), Te = c(0), xo = x, Xe = c(0), Be = c(0), We = c(0), _e = c(0), Ot = c(0), Et = c(null), ct = be(0, (e) => e.pipe( | ||
}), x = c(0), Z = c(0), gn = c(0), $e = c(0), xo = x, Xe = c(0), Be = c(0), We = c(0), _e = c(0), Ot = c(0), Et = c(null), ct = be(0, (e) => e.pipe( | ||
e.combine(Be, We), | ||
@@ -1115,7 +1114,7 @@ a(([t, n]) => t + n) | ||
a(([t, n]) => t + n) | ||
)), $o = be(0, (e) => e.pipe( | ||
)), To = be(0, (e) => e.pipe( | ||
e.combine(Be, We, x), | ||
a(([t, n, o]) => t + Math.max(n - o, 0)) | ||
)), To = be(0, (e) => e.pipe( | ||
e.combine(_e, Ot, x, Z, Te), | ||
)), $o = be(0, (e) => e.pipe( | ||
e.combine(_e, Ot, x, Z, $e), | ||
a(([t, n, o, s, i]) => { | ||
@@ -1126,3 +1125,3 @@ const l = Math.max(n - (i - (o + s)), 0); | ||
)), vn = be(0, (e) => e.pipe( | ||
e.combine(Z, $o, To), | ||
e.combine(Z, To, $o), | ||
a(([t, n, o]) => t - n - o) | ||
@@ -1147,3 +1146,3 @@ )), ut = c(0), bn = c(0, (e) => { | ||
Ee, | ||
$(x), | ||
T(x), | ||
v(([t, n]) => t.top !== n), | ||
@@ -1169,3 +1168,3 @@ O(!0) | ||
vn, | ||
Te, | ||
$e, | ||
ut, | ||
@@ -1207,4 +1206,4 @@ q, | ||
x, | ||
de(0), | ||
$(Fe), | ||
ge(0), | ||
T(Fe), | ||
v(([, t]) => t.scrollHeight > 0), | ||
@@ -1218,3 +1217,3 @@ a(([, t]) => t) | ||
e | ||
] }), yn = ({ index: e }) => e, Lt = c(kn), In = c(yn), Sn = c(null), xn = c(null), $n = c(null), Tn = c(null), En = c(null), Rn = c("div"), Eo = { | ||
] }), yn = ({ index: e }) => e, Lt = c(kn), In = c(yn), Sn = c(null), xn = c(null), Tn = c(null), $n = c(null), En = c(null), Rn = c("div"), Eo = { | ||
position: "sticky", | ||
@@ -1230,5 +1229,5 @@ top: 0, | ||
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Eo, ...e }, ref: n }) | ||
), An = g.forwardRef( | ||
), Dn = g.forwardRef( | ||
({ style: e, ...t }, n) => /* @__PURE__ */ y("div", { ...t, style: { ...Ro, ...e }, ref: n }) | ||
), Dn = c(wn), Cn = c(Mn), On = c(Ln), Hn = c(An), Mt = c("top", (e) => { | ||
), An = c(wn), Cn = c(Mn), On = c(Ln), Hn = c(Dn), Mt = c("top", (e) => { | ||
e.link( | ||
@@ -1255,3 +1254,3 @@ e.pipe( | ||
function wo(e) { | ||
return Lo(Ao(Do(Mo(e), 8 * e.length))).toLowerCase(); | ||
return Lo(Do(Ao(Mo(e), 8 * e.length))).toLowerCase(); | ||
} | ||
@@ -1270,3 +1269,3 @@ function Lo(e) { | ||
} | ||
function Ao(e) { | ||
function Do(e) { | ||
for (var t = "", n = 0; n < 32 * e.length; n += 8) | ||
@@ -1276,3 +1275,3 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255); | ||
} | ||
function Do(e, t) { | ||
function Ao(e, t) { | ||
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t; | ||
@@ -1621,3 +1620,3 @@ for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, l = 0; l < e.length; l += 16) { | ||
now: /* @__PURE__ */ new Date(), | ||
packageTimestamp: 1718623693705 | ||
packageTimestamp: 1718624464026 | ||
}); | ||
@@ -1631,3 +1630,3 @@ return /* @__PURE__ */ y(Wn.Provider, { value: n, children: t }); | ||
prepend: (t) => { | ||
e.pub(ge, t); | ||
e.pub(he, t); | ||
}, | ||
@@ -1647,3 +1646,3 @@ append: (t, n) => { | ||
map: (t, n) => { | ||
e.pub($t, { | ||
e.pub(Tt, { | ||
mapper: t, | ||
@@ -1716,6 +1715,6 @@ autoscrollToBottomBehavior: n | ||
FooterWrapper: Y = Ln, | ||
StickyFooterWrapper: J = An, | ||
StickyFooterWrapper: J = Dn, | ||
ScrollElement: X = "div", | ||
...ae | ||
}, pe) => { | ||
...ue | ||
}, ae) => { | ||
const j = g.useMemo(() => { | ||
@@ -1730,5 +1729,5 @@ const N = new Zn(); | ||
[Sn]: u, | ||
[$n]: p, | ||
[Tn]: p, | ||
[xn]: h, | ||
[Tn]: m, | ||
[$n]: m, | ||
[En]: k, | ||
@@ -1739,7 +1738,7 @@ [Rn]: X, | ||
[On]: Y, | ||
[Dn]: F, | ||
[An]: F, | ||
[Mt]: s | ||
}), N.singletonSub(Rt, i), N.singletonSub(yt, l), N; | ||
}, []); | ||
g.useImperativeHandle(pe, () => _n(j), [j]), g.useEffect(() => { | ||
g.useImperativeHandle(ae, () => _n(j), [j]), g.useEffect(() => { | ||
j.pubIn({ | ||
@@ -1762,3 +1761,3 @@ [Ce]: n, | ||
} | ||
) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ae }) }); | ||
) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ue }) }); | ||
} | ||
@@ -1783,6 +1782,6 @@ ); | ||
xn, | ||
Dn, | ||
An, | ||
Cn, | ||
Tn, | ||
$n, | ||
Tn, | ||
On, | ||
@@ -1797,7 +1796,7 @@ Hn, | ||
return new ResizeObserver((f) => { | ||
const z = f.length, A = []; | ||
const z = f.length, D = []; | ||
let S = {}; | ||
for (let Ie = 0; Ie < z; Ie++) { | ||
const te = f[Ie], D = te.target; | ||
if (D === j.current) { | ||
const te = f[Ie], A = te.target; | ||
if (A === j.current) { | ||
S = { | ||
@@ -1808,3 +1807,3 @@ ...S, | ||
continue; | ||
} else if (D === N.current) { | ||
} else if (A === N.current) { | ||
S = { | ||
@@ -1815,3 +1814,3 @@ ...S, | ||
continue; | ||
} else if (D === J.current) { | ||
} else if (A === J.current) { | ||
S = { | ||
@@ -1822,3 +1821,3 @@ ...S, | ||
continue; | ||
} else if (D === ae.current) { | ||
} else if (A === ue.current) { | ||
S = { | ||
@@ -1829,32 +1828,32 @@ ...S, | ||
continue; | ||
} else if (D === E.current) { | ||
} else if (A === E.current) { | ||
S = { | ||
...S, | ||
[x]: D.scrollTop, | ||
[Te]: D.scrollHeight, | ||
[x]: A.scrollTop, | ||
[$e]: A.scrollHeight, | ||
[Z]: te.contentRect.height, | ||
[gn]: D.clientWidth | ||
[gn]: A.clientWidth | ||
}; | ||
continue; | ||
} else if (D === Q.current) { | ||
} else if (A === Q.current) { | ||
E.current && (S = { | ||
...S, | ||
[Te]: E.current.scrollHeight | ||
[$e]: E.current.scrollHeight | ||
}); | ||
continue; | ||
} | ||
if (D.dataset.index === void 0) | ||
if (A.dataset.index === void 0) | ||
continue; | ||
const ht = parseInt(D.dataset.index), qn = parseFloat(D.dataset.knownSize ?? ""), gt = te.contentRect.height; | ||
const ht = parseInt(A.dataset.index), qn = parseFloat(A.dataset.knownSize ?? ""), gt = te.contentRect.height; | ||
if (gt === qn) | ||
continue; | ||
const Ht = A[A.length - 1]; | ||
A.length === 0 || Ht.size !== gt || Ht.endIndex !== ht - 1 ? A.push({ endIndex: ht, size: gt, startIndex: ht }) : A[A.length - 1].endIndex++; | ||
const Ht = D[D.length - 1]; | ||
D.length === 0 || Ht.size !== gt || Ht.endIndex !== ht - 1 ? D.push({ endIndex: ht, size: gt, startIndex: ht }) : D[D.length - 1].endIndex++; | ||
} | ||
A.length > 0 && (S = { | ||
D.length > 0 && (S = { | ||
...S, | ||
[lt]: A | ||
[lt]: D | ||
}), n.pubIn(S); | ||
}); | ||
}), [Y, J] = Ye(d), [X, ae] = Ye(d), [pe, j] = Ye(d), [P, N] = Ye(d), K = g.useCallback( | ||
}), [Y, J] = Ye(d), [X, ue] = Ye(d), [ae, j] = Ye(d), [P, N] = Ye(d), K = g.useCallback( | ||
(f) => { | ||
@@ -1874,15 +1873,15 @@ d.observe(f); | ||
[d] | ||
), fe = g.useRef(null), V = g.useRef(null); | ||
), pe = g.useRef(null), V = g.useRef(null); | ||
g.useEffect(() => n.sub(tt, () => { | ||
V.current && cancelAnimationFrame(V.current); | ||
V.current && clearTimeout(V.current); | ||
}), [n]); | ||
const ye = g.useCallback((f) => { | ||
var Ie; | ||
V.current && cancelAnimationFrame(V.current); | ||
V.current && clearTimeout(V.current); | ||
const z = ((Ie = E.current) == null ? void 0 : Ie.scrollTop) ?? 0; | ||
let A = 0; | ||
let D = 0; | ||
function S() { | ||
var D; | ||
const te = z + (f - z) * po(A); | ||
(D = E.current) == null || D.scrollTo({ top: te, behavior: "auto" }), A += 0.02, A < 1 ? V.current = requestAnimationFrame(S) : V.current = null; | ||
var A; | ||
const te = z + (f - z) * po(D); | ||
(A = E.current) == null || A.scrollTo({ top: te, behavior: "auto" }), D += 0.02, D < 1 ? V.current = setTimeout(S, 16) : V.current = null; | ||
} | ||
@@ -1892,8 +1891,8 @@ S(); | ||
(f) => { | ||
var z, A, S; | ||
var z, D, S; | ||
if (f.top === ((z = E.current) == null ? void 0 : z.scrollTop)) { | ||
n.pub(Oe, (A = E.current) == null ? void 0 : A.scrollTop); | ||
n.pub(Oe, (D = E.current) == null ? void 0 : D.scrollTop); | ||
return; | ||
} | ||
f.top !== void 0 && (fe.current = f.top, n.pub(Tt, !0)), f.forceBottomSpace !== void 0 && Q.current && (Q.current.style.paddingBottom = `${f.forceBottomSpace}px`), f.behavior === "smooth" ? ye(f.top ?? 0) : (S = E.current) == null || S.scrollTo(f); | ||
f.top !== void 0 && (pe.current = f.top, n.pub($t, !0)), f.forceBottomSpace !== void 0 && Q.current && (Q.current.style.paddingBottom = `${f.forceBottomSpace}px`), f.behavior === "smooth" ? ye(f.top ?? 0) : (S = E.current) == null || S.scrollTo(f); | ||
}, | ||
@@ -1907,5 +1906,5 @@ [n, ye] | ||
if (f !== null) { | ||
if (fe.current !== null) { | ||
if (pe.current !== null) { | ||
const z = f.scrollHeight - f.clientHeight; | ||
Qt(f.scrollTop, Math.min(z, fe.current)) && (fe.current = null, n.pub(Tt, !1), n.pub(Oe, f.scrollTop)); | ||
Qt(f.scrollTop, Math.min(z, pe.current)) && (pe.current = null, n.pub($t, !1), n.pub(Oe, f.scrollTop)); | ||
} | ||
@@ -1921,3 +1920,3 @@ n.pub(x, f.scrollTop); | ||
g.useLayoutEffect(() => n.sub(Ee, se), [se, n]), g.useLayoutEffect(() => n.sub(oe, ee), [ee, n]); | ||
const Fn = B(_), Pn = B(W), Nn = B(wt), zn = B(ut), Yn = B(mn), he = B(Ce), Kn = B(In), jn = B(ke), Un = B(Re); | ||
const Fn = B(_), Pn = B(W), Nn = B(wt), zn = B(ut), Yn = B(mn), fe = B(Ce), Kn = B(In), jn = B(ke), Un = B(Re); | ||
return /* @__PURE__ */ y(Gn, { children: /* @__PURE__ */ Nt( | ||
@@ -1934,6 +1933,6 @@ F, | ||
}, | ||
...F === "div" ? { context: he } : {}, | ||
...F === "div" ? { context: fe } : {}, | ||
children: [ | ||
s && /* @__PURE__ */ y(l, { ref: P, style: ze, children: /* @__PURE__ */ y(s, { context: he }) }), | ||
o && /* @__PURE__ */ y(i, { ref: pe, style: ze, children: /* @__PURE__ */ y(o, { context: he }) }), | ||
s && /* @__PURE__ */ y(l, { ref: P, style: ze, children: /* @__PURE__ */ y(s, { context: fe }) }), | ||
o && /* @__PURE__ */ y(i, { ref: ae, style: ze, children: /* @__PURE__ */ y(o, { context: fe }) }), | ||
jn > 0 ? /* @__PURE__ */ y( | ||
@@ -1962,8 +1961,8 @@ "div", | ||
}, | ||
Kn({ index: f.index, data: f.data, context: he }) | ||
Kn({ index: f.index, data: f.data, context: fe }) | ||
)) | ||
} | ||
) : k ? /* @__PURE__ */ y(k, { context: he }) : null, | ||
r && /* @__PURE__ */ y(h, { ref: Y, style: ze, children: /* @__PURE__ */ y(r, { context: he }) }), | ||
u && /* @__PURE__ */ y(p, { ref: X, style: ze, children: /* @__PURE__ */ y(u, { context: he }) }) | ||
) : k ? /* @__PURE__ */ y(k, { context: fe }) : null, | ||
r && /* @__PURE__ */ y(h, { ref: Y, style: ze, children: /* @__PURE__ */ y(r, { context: fe }) }), | ||
u && /* @__PURE__ */ y(p, { ref: X, style: ze, children: /* @__PURE__ */ y(u, { context: fe }) }) | ||
] | ||
@@ -1970,0 +1969,0 @@ } |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.8.0-alpha.14", | ||
"version": "1.8.0-alpha.15", | ||
"type": "module", | ||
@@ -26,0 +26,0 @@ "module": "dist/index.js", |
82982
2312