New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@virtuoso.dev/message-list

Package Overview
Dependencies
Maintainers
2
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@virtuoso.dev/message-list - npm Package Compare versions

Comparing version 1.4.0 to 1.4.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [1.4.1](https://github.com/virtuoso-dev/message-list/compare/v1.4.0...v1.4.1) (2024-05-02)
### Bug Fixes
* avoid double onScroll call ([bc88563](https://github.com/virtuoso-dev/message-list/commit/bc88563365d4680799211ceec562fd46085267e5))
# [1.4.0](https://github.com/virtuoso-dev/message-list/compare/v1.3.1...v1.4.0) (2024-04-24)

@@ -2,0 +9,0 @@

557

dist/index.js

@@ -1,4 +0,4 @@

import { jsxs as Tt, jsx as b, Fragment as yn } from "react/jsx-runtime";
import { jsxs as Tt, jsx as b, Fragment as In } from "react/jsx-runtime";
import k from "react";
import { Cell as l, Signal as $, withLatestFrom as S, map as a, mapTo as C, delayWithMicrotask as he, filter as m, throttleTime as oe, onNext as Ze, once as bt, debounceTime as Fe, scan as _, useRealm as at, useCellValue as V, Realm as In, RealmContext as Sn, useCellValues as xn } from "@mdxeditor/gurx";
import { Cell as l, Signal as $, withLatestFrom as S, map as a, mapTo as C, delayWithMicrotask as he, filter as m, throttleTime as oe, onNext as Ze, once as bt, debounceTime as me, scan as _, useRealm as at, useCellValue as V, Realm as Sn, RealmContext as xn, useCellValues as $n } from "@mdxeditor/gurx";
function se(e, t) {

@@ -17,3 +17,3 @@ const n = l(e, (o) => {

}
function me() {
function be() {
return ge;

@@ -32,6 +32,6 @@ }

const [i, r] = Mt(o);
return De(I(e, { k: i, l: Lt(o), v: r }));
return Re(I(e, { k: i, l: Lt(o), v: r }));
}
} else
return t < n ? De(I(e, { l: Je(o, t) })) : De(I(e, { r: Je(s, t) }));
return t < n ? Re(I(e, { l: Je(o, t) })) : Re(I(e, { r: Je(s, t) }));
}

@@ -66,3 +66,3 @@ function re(e, t, n = "k") {

function Lt(e) {
return v(e.r) ? e.l : De(I(e, { r: Lt(e.r) }));
return v(e.r) ? e.l : Re(I(e, { r: Lt(e.r) }));
}

@@ -78,3 +78,3 @@ function I(e, t) {

}
function De(e) {
function Re(e) {
const { l: t, r: n, lvl: o } = e;

@@ -117,3 +117,3 @@ if (n.lvl >= o - 1 && t.lvl >= o - 1)

const o = re(e, t)[0];
return $n(Xe(e, o, n));
return Tn(Xe(e, o, n));
}

@@ -132,3 +132,3 @@ function Dt(e, t) {

}
function $n(e) {
function Tn(e) {
return Dt(e, ({ k: t, v: n }) => ({ index: t, value: n }));

@@ -144,7 +144,7 @@ }

}
function Tn(e) {
function En(e) {
const { size: t, startIndex: n, endIndex: o } = e;
return (s) => s.start === n && (s.end === o || s.end === 1 / 0) && s.value === t;
}
function En(e, t) {
function Mn(e, t) {
let n = v(e) ? 0 : 1 / 0;

@@ -158,3 +158,3 @@ for (const o of t) {

const u = wt(e, i - 1, r + 1);
if (u.some(Tn(o)))
if (u.some(En(o)))
continue;

@@ -168,14 +168,14 @@ let c = !1, f = !1;

}
const pt = [me(), 0];
function Mn(e, [t, n]) {
const pt = [be(), 0];
function Ln(e, [t, n]) {
if (n.length > 0 && v(e) && t.length === 2) {
const o = t[0].size, s = t[1].size;
return [
n.reduce((i, r) => U(U(i, r, o), r + 1, s), me()),
n.reduce((i, r) => U(U(i, r, o), r + 1, s), be()),
0
];
} else
return En(e, t);
return Mn(e, t);
}
function He(e, t, n, o = 0) {
function Be(e, t, n, o = 0) {
let s = e.length - 1;

@@ -199,6 +199,6 @@ for (; o <= s; ) {

function At(e, t, n) {
return e[He(e, t, n)];
return e[Be(e, t, n)];
}
function Ln(e, t, n, o) {
const s = He(e, t, o), i = He(e, n, o, s);
function wn(e, t, n, o) {
const s = Be(e, t, o), i = Be(e, n, o, s);
return e.slice(s, i + 1);

@@ -209,16 +209,16 @@ }

}
function wn({ offset: e }, t) {
function Dn({ offset: e }, t) {
return t === e ? 0 : t < e ? -1 : 1;
}
function Dn(e) {
function Rn(e) {
return { index: e.index, value: e };
}
function Rn(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, At(e, o, ft).offset)), t = Math.max(0, t), Dt(Ln(e, t, n, wn), Dn);
function An(e, t, n, o = 0) {
return o > 0 && (t = Math.max(t, At(e, o, ft).offset)), t = Math.max(0, t), Dt(wn(e, t, n, Dn), Rn);
}
const le = [[], 0, 0, 0];
function An(e, [t, n]) {
function Cn(e, [t, n]) {
let o = 0, s = 0, i = 0, r = 0;
if (n !== 0) {
r = He(e, n - 1, ft), i = e[r].offset;
r = Be(e, n - 1, ft), i = e[r].offset;
const c = re(t, n - 1);

@@ -234,3 +234,3 @@ o = c[0], s = c[1], e.length && e[r].height === re(t, n)[1] && (r -= 1), e = e.slice(0, r + 1);

}
function Cn(e, t) {
function Hn(e, t) {
if (t.length === 0)

@@ -241,6 +241,15 @@ return [0, 0];

}
function Hn(e, t) {
return Cn(e, t)[0];
function Bn(e, t) {
return Hn(e, t)[0];
}
function Ct(e, t) {
return Math.abs(e - t) < 1.01;
}
function Ht() {
return typeof navigator > "u" ? !1 : /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
}
function Bt(e) {
return !e;
}
function Ot(e, t) {
if (typeof e == "number")

@@ -261,3 +270,3 @@ return {

}
function Ht({
function Vt({
location: e,

@@ -273,3 +282,3 @@ sizeTree: t,

}) {
const { align: f, behavior: h, offset: p, index: g } = Ct(e, s - 1);
const { align: f, behavior: h, offset: p, index: g } = Ot(e, s - 1);
function w() {

@@ -282,3 +291,3 @@ const B = re(t, g)[1];

i -= u + c;
let x = Hn(g, n) + r - u;
let x = Bn(g, n) + r - u;
f === "end" ? x = x - i + w() : f === "center" && (x = x - i / 2 + w() / 2), p && (x += p);

@@ -288,3 +297,3 @@ let H = 0;

}
const qe = l(null), Bn = l(!1), Ue = l(!0), q = $((e) => {
const qe = l(null), On = l(!1), Ue = l(!0), q = $((e) => {
e.link(q, qe), e.link(

@@ -299,4 +308,4 @@ e.pipe(

dt,
xe,
Te,
$e,
Ee,
ae

@@ -315,3 +324,3 @@ ),

f
]) => Ht({
]) => Vt({
location: t,

@@ -330,3 +339,3 @@ totalHeight: f,

ce
), e.link(e.pipe(q, C(!1)), Ue), e.link(e.pipe(q, C(!1)), Bn), e.link(
), e.link(e.pipe(q, C(!1)), Ue), e.link(e.pipe(q, C(!1)), On), e.link(
e.pipe(

@@ -340,3 +349,3 @@ P,

q
), e.sub(e.pipe(We, oe(20)), () => {
), e.sub(e.pipe(Fe, oe(20)), () => {
e.pubIn({

@@ -348,3 +357,3 @@ [qe]: null,

e.pipe(
Ce,
He,
// wait for the list to render with the specified scrollOffset, so that enough space is available to scroll by

@@ -358,22 +367,22 @@ he(),

e.pipe(
Ce,
He,
Ze(y),
a(() => 0)
),
Ce
He
);
}), Be = l(null), Oe = l(null, (e) => {
}), Oe = l(null), Ve = l(null, (e) => {
e.link(
e.pipe(
Oe,
Ve,
m((n) => n !== null),
bt()
),
Be
Oe
);
const t = e.pipe(
e.combine(Oe, P),
e.combine(Ve, P),
m(([n, o]) => n !== null && !v(o)),
bt(),
Ze(zt),
Ze(Yt),
he(),

@@ -385,16 +394,11 @@ a(([[n]]) => n)

t,
Ze(
e.pipe(
Ie,
m((n) => !n)
)
),
Ze(e.pipe(Se, m(Bt))),
C(null),
// unset the location after the scroll completes
Fe(10)
me(10)
),
Be
Oe
);
});
function On(e, t) {
function Vn(e, t) {
const n = t.slice();

@@ -410,3 +414,3 @@ let o = 0;

});
let i = me();
let i = be();
return s.forEach(({ k: r, v: u }) => {

@@ -416,3 +420,3 @@ i = U(i, r, u);

}
function Vn(e, t) {
function Wn(e, t) {
return [

@@ -430,4 +434,4 @@ {

}
const Wn = [], we = {
items: Wn,
const Fn = [], De = {
items: Fn,
listBottom: 0,

@@ -440,7 +444,7 @@ listTop: 0,

data: null
}, be = l(we, (e) => {
}, ke = l(De, (e) => {
e.link(
e.pipe(
e.combine(
qn,
Un,
vt,

@@ -452,8 +456,8 @@ P,

W,
Ce,
He,
Ve,
Oe,
Be,
Te,
$e,
xe,
Te,
Ee,
A,

@@ -484,11 +488,11 @@ ee,

]) => {
var Le;
var we;
if ((c == null ? void 0 : c.length) === 0)
return we;
return De;
if (v(s)) {
let K = 0;
return h !== null && (K = Ct(h, r - 1).index), { ...we, items: Vn(K, c), offsetTree: i, totalCount: r, data: c };
return h !== null && (K = Ot(h, r - 1).index), { ...De, items: Wn(K, c), offsetTree: i, totalCount: r, data: c };
}
let B = 0;
p !== null && n === 0 && (B = Ht({
p !== null && n === 0 && (B = Vt({
totalHeight: u,

@@ -510,4 +514,4 @@ location: p,

return t;
const O = [], N = r - 1, D = 0, Ne = Rn(i, Y, J, D);
let F = 0, Ee = 0, Me = !1;
const O = [], N = r - 1, D = 0, Ne = An(i, Y, J, D);
let F = 0, Me = 0, Le = !1;
for (const K of Ne) {

@@ -530,15 +534,15 @@ const {

};
Me || (Me = !0, Ee = F), O.push(Ke), F += te;
Le || (Le = !0, Me = F), O.push(Ke), F += te;
}
}
const z = u - F, ze = ((Le = O[0]) == null ? void 0 : Le.offset) || 0;
return { items: O, listBottom: F, listTop: Ee, offsetTree: i, paddingBottom: z, paddingTop: ze, totalCount: r, data: c };
const z = u - F, ze = ((we = O[0]) == null ? void 0 : we.offset) || 0;
return { items: O, listBottom: F, listTop: Me, offsetTree: i, paddingBottom: z, paddingTop: ze, totalCount: r, data: c };
},
we
De
)
),
be
ke
);
}), Fn = se([], (e) => e.pipe(
e.combine(be, y),
}), _n = se([], (e) => e.pipe(
e.combine(ke, y),
a(([t, n]) => {

@@ -550,10 +554,3 @@ const o = t.items.slice();

})
));
function Bt(e, t) {
return Math.abs(e - t) < 1.01;
}
function Ot() {
return typeof navigator > "u" ? !1 : /iP(ad|od|hone)/i.test(navigator.userAgent) && /WebKit/i.test(navigator.userAgent);
}
const Vt = "up", Ge = "down", _n = "none", Pn = {
)), Wt = "up", Ge = "down", Pn = "none", Nn = {
atBottom: !1,

@@ -568,3 +565,3 @@ notAtBottomBecause: "NOT_SHOWING_LAST_ITEM",

}
}, Nn = 0;
}, zn = 0;
function yt(e) {

@@ -579,19 +576,19 @@ return (t, n) => {

l(!1);
const Wt = l(!0);
const Ft = l(!0);
$();
const zn = $((e) => {
e.link(e.pipe(Wt, oe(50)), zn);
}), Yn = l(4), Kn = l(Nn, (e) => {
const Yn = $((e) => {
e.link(e.pipe(Ft, oe(50)), Yn);
}), Kn = l(4), jn = l(zn, (e) => {
e.link(
e.pipe(
e.combine(y, Kn),
e.combine(y, jn),
a(([t, n]) => t <= n)
),
Wt
Ft
);
}), ve = l(!1, (e) => {
e.link(e.pipe(y, yt(1), C(!0)), ve), e.link(e.pipe(y, yt(1), C(!1), Fe(100)), ve);
e.link(e.pipe(y, yt(1), C(!0)), ve), e.link(e.pipe(y, yt(1), C(!1), me(100)), ve);
}), et = l(!1, (e) => {
e.link(e.pipe(G, C(!0)), et), e.link(e.pipe(G, C(!1), Fe(200)), et);
}), Ft = l(!1), Re = l(
e.link(e.pipe(G, C(!0)), et), e.link(e.pipe(G, C(!1), me(200)), et);
}), _t = l(!1), Ae = l(
null,

@@ -601,3 +598,3 @@ (e) => {

e.pipe(
e.combine(Se, y, Z, qt, Yn, _e, P),
e.combine(xe, y, Z, Ut, Kn, _e, P),
m(([, , , , , , t]) => !v(t)),

@@ -626,8 +623,8 @@ _((t, [n, o, s, i, r]) => {

};
}, Pn)
}, Nn)
),
Re
Ae
), e.link(
e.pipe(
Re,
Ae,
oe(10),

@@ -648,7 +645,7 @@ // withLatestFrom(scrollToInProgress$),

),
Ft
_t
), e.sub(
e.pipe(
Z,
S(Re),
S(Ae),
_(

@@ -668,9 +665,9 @@ (t, [n, o]) => {

(e, t) => e ? e.atBottom === (t == null ? void 0 : t.atBottom) : !1
), _t = l(0, (e) => {
), Pt = l(0, (e) => {
e.link(
e.pipe(
e.combine(y, Se, Z),
e.combine(y, xe, Z),
_(
(t, [n, o, s]) => {
if (Bt(t.scrollHeight, o))
if (Ct(t.scrollHeight, o))
return {

@@ -702,3 +699,3 @@ scrollTop: n,

),
_t
Pt
);

@@ -710,3 +707,3 @@ }), tt = l(Ge, (e) => {

_(
(t, n) => e.getValue(et) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? Vt : Ge, prevScrollTop: n },
(t, n) => e.getValue(et) ? { direction: t.direction, prevScrollTop: n } : { direction: n < t.prevScrollTop ? Wt : Ge, prevScrollTop: n },
{ direction: Ge, prevScrollTop: 0 }

@@ -717,13 +714,6 @@ ),

tt
), e.link(e.pipe(y, oe(50), C(_n)), tt);
), e.link(e.pipe(y, oe(50), C(Pn)), tt);
}), It = l(0, (e) => {
e.link(
e.link(e.pipe(ve, m(Bt), C(0)), It), e.link(
e.pipe(
ve,
m((t) => !t),
C(0)
),
It
), e.link(
e.pipe(
y,

@@ -738,7 +728,7 @@ oe(100),

);
}), R = l(!1), Ae = $((e) => {
}), R = l(!1), Ce = $((e) => {
e.link(
e.pipe(
be,
S(_t, ee),
ke,
S(Pt, ee),
m(([, , t]) => !t),

@@ -754,8 +744,8 @@ _(

m(([t]) => t !== 0),
S(y, tt, Ie),
m(([, t, n, o]) => !o && t !== 0 && n === Vt),
S(y, tt, Se),
m(([, t, n, o]) => !o && t !== 0 && n === Wt),
a(([[t]]) => t)
),
Ae
), Ot() ? (e.sub(e.pipe(Ae, S(A, y)), ([t, n]) => {
Ce
), Ht() ? (e.sub(e.pipe(Ce, S(A, y)), ([t, n]) => {
e.pub(A, n - t);

@@ -793,3 +783,3 @@ }), e.sub(e.pipe(e.combine(y, A, ee)), ([t, n, o]) => {

e.pipe(
Ae,
Ce,
a((t) => ({ top: t, behavior: "auto" }))

@@ -799,3 +789,3 @@ ),

);
}), ue = l(0), Ve = l(null), W = l(null, (e) => {
}), ue = l(0), We = l(null), W = l(null, (e) => {
e.link(

@@ -809,5 +799,5 @@ e.pipe(

);
}), jn = 4, ne = $((e) => {
}), qn = 4, ne = $((e) => {
e.link(e.pipe(ne, C(!0)), ee);
const t = Ot();
const t = Ht();
e.link(

@@ -859,9 +849,9 @@ e.pipe(

),
ke
ye
);
}), Pt = $((e) => {
}), Nt = $((e) => {
e.link(
e.pipe(
Pt,
S(mt, st, Ve, P),
Nt,
S(mt, st, We, P),
m(([, , , , t]) => !v(t)),

@@ -872,3 +862,3 @@ a(([{ data: t, scrollToBottom: n }, o, s, i]) => {

let r = "auto";
const u = o.bottomOffset < jn;
const u = o.bottomOffset < qn;
if (typeof n == "function") {

@@ -891,3 +881,3 @@ const c = n({ data: t, scrollLocation: o, scrollInProgress: s, context: i, atBottom: u });

m((t) => t !== null),
Fe(1)
me(1)
),

@@ -897,5 +887,5 @@ q

}), nt = $((e) => {
e.changeWith(W, nt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(nt, Pt);
e.changeWith(W, nt, (t, n) => t ? [...t, ...n.data] : n.data.slice()), e.link(nt, Nt);
}), St = $((e) => {
e.changeWith(W, St, (t, n) => t ? t.slice(n) : []), e.changeWith(ye, St, ([t], n) => [de(t).reduce((s, { k: i, v: r }) => U(s, Math.max(0, i - n), r), me()), 0]);
e.changeWith(W, St, (t, n) => t ? t.slice(n) : []), e.changeWith(Ie, St, ([t], n) => [de(t).reduce((s, { k: i, v: r }) => U(s, Math.max(0, i - n), r), be()), 0]);
}), xt = $((e) => {

@@ -914,7 +904,7 @@ e.changeWith(W, xt, (t, n) => t ? t.slice(0, t.length - n) : []), e.link(

),
ke
ye
);
}), Nt = $((e) => {
}), zt = $((e) => {
const t = e.pipe(
Nt,
zt,
S(W),

@@ -930,3 +920,3 @@ a(([n, o]) => {

);
e.changeWith(W, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(ye, t, ([n], o) => [On(n, o), 0]);
e.changeWith(W, t, (n, o) => n ? n.filter((s, i) => !o.includes(i)) : []), e.changeWith(Ie, t, ([n], o) => [Vn(n, o), 0]);
}), ot = $((e) => {

@@ -937,3 +927,3 @@ e.changeWith(W, ot, (t, { mapper: n }) => t ? t.map(n) : []), e.link(

oe(40),
S(Ft),
S(_t),
m(([{ autoscrollToBottomBehavior: t }, n]) => n && !!t),

@@ -944,18 +934,18 @@ a(([{ autoscrollToBottomBehavior: t }]) => ({ index: "LAST", align: "end", behavior: t }))

);
}), ke = $();
}), ye = $();
l([]);
l([]);
l(0);
const zt = $();
const Yt = $();
l(null);
l(NaN);
const ee = l(!1), ye = l(pt, (e) => {
const ee = l(!1), Ie = l(pt, (e) => {
e.link(
e.pipe(
ke,
ye,
m((t) => t.length > 0),
S(P),
a(([t, n]) => Mn(n, [t, []]))
a(([t, n]) => Ln(n, [t, []]))
),
ye
Ie
);

@@ -965,3 +955,3 @@ }), P = l(pt[0], (e) => {

e.pipe(
ye,
Ie,
a(([t]) => t)

@@ -972,3 +962,3 @@ ),

e.pipe(
ke,
ye,
S(P),

@@ -980,15 +970,15 @@ _(

}),
{ changed: !1, sizeTree: me() }
{ changed: !1, sizeTree: be() }
),
a((t) => t.changed)
),
zt
Yt
);
}), Yt = l(pt[1], (e) => {
}), Kt = l(pt[1], (e) => {
e.link(
e.pipe(
ye,
Ie,
a(([, t]) => t)
),
Yt
Kt
);

@@ -999,4 +989,4 @@ }), ie = l(le[1]), ht = l(le[0]), fe = l(le, (e) => {

P,
S(Yt),
_(([t], [n, o]) => An(t, [n, o]), le)
S(Kt),
_(([t], [n, o]) => Cn(t, [n, o]), le)
),

@@ -1017,3 +1007,3 @@ fe

);
}), Kt = l(le[2], (e) => {
}), jt = l(le[2], (e) => {
e.link(

@@ -1024,5 +1014,5 @@ e.pipe(

),
Kt
jt
);
}), jt = l(le[3], (e) => {
}), qt = l(le[3], (e) => {
e.link(

@@ -1033,3 +1023,3 @@ e.pipe(

),
jt
qt
);

@@ -1039,3 +1029,3 @@ }), ae = l(0, (e) => {

e.pipe(
e.combine(ue, jt, Kt, ie),
e.combine(ue, qt, jt, ie),
a(([t, n, o, s]) => o + (t - n) * s)

@@ -1045,15 +1035,15 @@ ),

);
}), Ie = $(), st = l(!1), We = $((e) => {
e.link(e.pipe(We, C(!1)), Ie);
}), y = l(0), Z = l(0), qt = l(0), Se = l(0), qn = y, Ce = l(0), xe = l(0), $e = l(0), Te = l(0), gt = l(0), it = l(null), dt = se(0, (e) => e.pipe(
e.combine(xe, $e),
}), Se = $(), st = l(!1), Fe = $((e) => {
e.link(e.pipe(Fe, C(!1)), Se);
}), y = l(0), Z = l(0), Ut = l(0), xe = l(0), Un = y, He = l(0), $e = l(0), Te = l(0), Ee = l(0), gt = l(0), it = l(null), dt = se(0, (e) => e.pipe(
e.combine($e, Te),
a(([t, n]) => t + n)
)), Un = se(0, (e) => e.pipe(
e.combine(Te, gt),
)), Gn = se(0, (e) => e.pipe(
e.combine(Ee, gt),
a(([t, n]) => t + n)
)), Gn = se(0, (e) => e.pipe(
e.combine(xe, $e, y),
)), Zn = se(0, (e) => e.pipe(
e.combine($e, Te, y),
a(([t, n, o]) => t + Math.max(n - o, 0))
)), Zn = se(0, (e) => e.pipe(
e.combine(Te, gt, y, Z, Se),
)), Jn = se(0, (e) => e.pipe(
e.combine(Ee, gt, y, Z, xe),
a(([t, n, o, s, i]) => {

@@ -1064,8 +1054,8 @@ const r = Math.max(n - (i - (o + s)), 0);

)), vt = se(0, (e) => e.pipe(
e.combine(Z, Gn, Zn),
e.combine(Z, Zn, Jn),
a(([t, n, o]) => t - n - o)
)), _e = l(0), Ut = l(0, (e) => {
)), _e = l(0), Gt = l(0, (e) => {
e.link(
e.pipe(
e.combine(Ut, ae, Z),
e.combine(Gt, ae, Z),
a(([t, n, o]) => Math.max(0, Math.min(t - (n - o))))

@@ -1081,3 +1071,3 @@ ),

),
Ut
Gt
), e.link(

@@ -1090,3 +1080,3 @@ e.pipe(

),
Ie
Se
);

@@ -1104,9 +1094,9 @@ }), mt = se(

dt,
Un,
$e,
Gn,
Te,
vt,
Se,
xe,
_e,
ee,
Be,
Oe,
R

@@ -1129,2 +1119,3 @@ ),

y,
me(0),
S(mt),

@@ -1136,4 +1127,4 @@ m(([, t]) => t.scrollHeight > 0),

);
}), G = $(), A = l(0), lt = l(0), Gt = l("");
function Jn(e) {
}), G = $(), A = l(0), lt = l(0), Zt = l("");
function Xn(e) {
const t = k.useRef(null), n = k.useRef(null), o = at(), s = k.useCallback(

@@ -1145,3 +1136,3 @@ (p) => {

const w = g.scrollHeight - g.clientHeight;
Bt(g.scrollTop, Math.min(w, n.current)) && (n.current = null, o.pub(st, !1), o.pub(We, g.scrollTop));
Ct(g.scrollTop, Math.min(w, n.current)) && (n.current = null, o.pub(st, !1), o.pub(Fe, g.scrollTop));
}

@@ -1175,3 +1166,3 @@ e(g, p);

if (p.top === ((g = t.current) == null ? void 0 : g.scrollTop)) {
o.pub(We, (w = t.current) == null ? void 0 : w.scrollTop);
o.pub(Fe, (w = t.current) == null ? void 0 : w.scrollTop);
return;

@@ -1192,3 +1183,3 @@ }

}
function Xn(e) {
function Qn(e) {
const t = e.length, n = [];

@@ -1207,13 +1198,13 @@ for (let o = 0; o < t; o++) {

}
const Zt = ({ index: e }) => /* @__PURE__ */ Tt("div", { children: [
const Jt = ({ index: e }) => /* @__PURE__ */ Tt("div", { children: [
"Item ",
e
] }), Jt = ({ index: e }) => e, ct = l(Zt), Xt = l(Jt), Qt = l(null), en = l(null), tn = l(null), nn = l(null), on = l(null), sn = l("div"), Qn = {
] }), Xt = ({ index: e }) => e, ct = l(Jt), Qt = l(Xt), en = l(null), tn = l(null), nn = l(null), on = l(null), sn = l(null), rn = l("div"), eo = {
position: "sticky",
top: 0,
zIndex: 1
}, eo = {
}, to = {
position: "sticky",
bottom: 0
}, rn = (e) => /* @__PURE__ */ b("div", { style: { zIndex: 1 }, ...e }), ln = (e) => /* @__PURE__ */ b("div", { ...e }), cn = (e) => /* @__PURE__ */ b("div", { ...e, style: Qn }), un = (e) => /* @__PURE__ */ b("div", { ...e, style: eo }), an = l(rn), pn = l(cn), fn = l(ln), hn = l(un), ut = l("top", (e) => {
}, ln = (e) => /* @__PURE__ */ b("div", { style: { zIndex: 1 }, ...e }), cn = (e) => /* @__PURE__ */ b("div", { ...e }), un = (e) => /* @__PURE__ */ b("div", { ...e, style: eo }), an = (e) => /* @__PURE__ */ b("div", { ...e, style: to }), pn = l(ln), fn = l(un), hn = l(cn), gn = l(an), ut = l("top", (e) => {
e.link(

@@ -1236,9 +1227,9 @@ e.pipe(

),
Gt
Zt
);
});
function to(e) {
return no(so(io(oo(e), 8 * e.length))).toLowerCase();
function no(e) {
return oo(io(ro(so(e), 8 * e.length))).toLowerCase();
}
function no(e) {
function oo(e) {
for (var t, n = "0123456789ABCDEF", o = "", s = 0; s < e.length; s++)

@@ -1248,3 +1239,3 @@ t = e.charCodeAt(s), o += n.charAt(t >>> 4 & 15) + n.charAt(15 & t);

}
function oo(e) {
function so(e) {
for (var t = Array(e.length >> 2), n = 0; n < t.length; n++)

@@ -1256,3 +1247,3 @@ t[n] = 0;

}
function so(e) {
function io(e) {
for (var t = "", n = 0; n < 32 * e.length; n += 8)

@@ -1262,3 +1253,3 @@ t += String.fromCharCode(e[n >> 5] >>> n % 32 & 255);

}
function io(e, t) {
function ro(e, t) {
e[t >> 5] |= 128 << t % 32, e[14 + (t + 64 >>> 9 << 4)] = t;

@@ -1528,3 +1519,3 @@ for (var n = 1732584193, o = -271733879, s = -1732584194, i = 271733878, r = 0; r < e.length; r += 16) {

function Pe(e, t, n, o, s, i) {
return Q(ro(Q(Q(t, e), Q(o, i)), s), n);
return Q(lo(Q(Q(t, e), Q(o, i)), s), n);
}

@@ -1547,69 +1538,69 @@ function T(e, t, n, o, s, i, r) {

}
function ro(e, t) {
function lo(e, t) {
return e << t | e >>> 32 - t;
}
const gn = Symbol("INVALID_KEY");
function lo(e) {
const dn = Symbol("INVALID_KEY");
function co(e) {
const t = e.slice(0, 32), n = e.slice(32), o = atob(n);
if (t !== to(n))
return gn;
if (t !== no(n))
return dn;
const [s, i] = o.split(";"), r = s.slice(2), u = new Date(Number(i.slice(2)));
return { orderNumber: r, expiryDate: u };
}
const co = {
const uo = {
valid: !1,
consoleMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property.",
watermarkMessage: "The VirtuosoMessageList license wrapper component is missing. Enclose the VirtuosoMessageList with VirtuosoMessageListLicense and add your key at the lisenceKey property."
}, uo = {
}, ao = {
valid: !1,
consoleMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/",
watermarkMessage: "Your VirtuosoMessageListLicense is missing a license key. Purchase one from https://virtuoso.dev/pricing/"
}, ao = {
}, po = {
valid: !1,
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."
}, dn = {
}, vn = {
valid: !0
}, po = {
}, fo = {
valid: !1,
consoleMessage: "Your Virtuoso Message List license key is invalid. Ensure that you have copy-pasted the key from the purchase email correctly.",
watermarkMessage: "Your Virtuoso Message List license key is invalid"
}, fo = {
}, ho = {
valid: !1,
consoleMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/",
watermarkMessage: "Your annual license key to use Virtuoso Message List in non-production environments has expired. You can still use it in production. To keep using it in development, purchase a new key from https://virtuoso.dev/pricing/"
}, ho = {
}, go = {
valid: !1,
consoleMessage: "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/",
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/"
}, go = dn, vo = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, mo = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function bo({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(vo), i = mo.some((r) => n.endsWith(r));
}, vo = vn, mo = /^(?:127\.0\.0\.1|localhost|0\.0\.0\.0)$/, bo = ["virtuoso.dev", "csb.app", "codesandbox.io"];
function ko({ licenseKey: e, now: t, hostname: n, packageTimestamp: o }) {
const s = n.match(mo), i = bo.some((r) => n.endsWith(r));
if (e) {
const r = lo(e);
if (r === gn)
return po;
const r = co(e);
if (r === dn)
return fo;
if (r.expiryDate.getTime() < t.getTime()) {
if (s)
return fo;
return ho;
if (r.expiryDate.getTime() < o)
return ho;
return go;
}
} else
return i ? go : s ? ao : uo;
return dn;
return i ? vo : s ? po : ao;
return vn;
}
const vn = k.createContext(co), ko = ({
const mn = k.createContext(uo), yo = ({
licenseKey: e,
children: t
}) => {
const n = bo({
const n = ko({
licenseKey: e,
hostname: typeof window < "u" ? window.location.hostname : "localhost",
now: /* @__PURE__ */ new Date(),
packageTimestamp: 1713936485532
packageTimestamp: 1714630276458
});
return /* @__PURE__ */ b(vn.Provider, { value: n, children: t });
return /* @__PURE__ */ b(mn.Provider, { value: n, children: t });
};
ko.displayName = Math.random().toString(36).slice(2, 8);
function mn(e) {
yo.displayName = Math.random().toString(36).slice(2, 8);
function bn(e) {
return {

@@ -1633,3 +1624,3 @@ data: {

findAndDelete: (t) => {
e.pub(Nt, t);
e.pub(zt, t);
},

@@ -1645,17 +1636,17 @@ findIndex: (t) => e.getValue(W).findIndex(t),

}
function To() {
function Eo() {
return V(mt);
}
function Eo() {
return V(Fn);
function Mo() {
return V(_n);
}
function Mo() {
function Lo() {
const e = at();
return k.useMemo(() => mn(e), [e]);
return k.useMemo(() => bn(e), [e]);
}
let $t = !1;
const yo = k.forwardRef(
const Io = k.forwardRef(
({
initialData: e = [],
computeItemKey: t = Jt,
computeItemKey: t = Xt,
context: n = null,

@@ -1665,3 +1656,3 @@ initialLocation: o = null,

onScroll: i,
ItemContent: r = Zt,
ItemContent: r = Jt,
Header: u = null,

@@ -1672,6 +1663,6 @@ StickyHeader: c = null,

EmptyPlaceholder: p = null,
HeaderWrapper: g = rn,
StickyHeaderWrapper: w = cn,
FooterWrapper: x = ln,
StickyFooterWrapper: H = un,
HeaderWrapper: g = ln,
StickyHeaderWrapper: w = un,
FooterWrapper: x = cn,
StickyFooterWrapper: H = an,
ScrollElement: B = "div",

@@ -1681,29 +1672,29 @@ ...Y

const O = k.useMemo(() => {
const D = new In();
return D.register(be), D.register(Ie), D.register(Ae), D.register(Re), D.pubIn({
const D = new Sn();
return D.register(ke), D.register(Se), D.register(Ce), D.register(Ae), D.pubIn({
[W]: e.slice(),
[Ve]: n,
[Xt]: t,
[Oe]: o,
[We]: n,
[Qt]: t,
[Ve]: o,
[ct]: r,
[Qt]: u,
[tn]: f,
[en]: c,
[nn]: h,
[on]: p,
[sn]: B,
[hn]: H,
[pn]: w,
[fn]: x,
[an]: g,
[en]: u,
[nn]: f,
[tn]: c,
[on]: h,
[sn]: p,
[rn]: B,
[gn]: H,
[fn]: w,
[hn]: x,
[pn]: g,
[ut]: s
}), D.singletonSub(rt, i), D;
}, []);
k.useImperativeHandle(J, () => mn(O), [O]), k.useEffect(() => {
k.useImperativeHandle(J, () => bn(O), [O]), k.useEffect(() => {
O.pubIn({
[Ve]: n,
[We]: n,
[ct]: r
}), O.singletonSub(rt, i);
});
const N = k.useContext(vn);
const N = k.useContext(mn);
return k.useEffect(() => {

@@ -1720,10 +1711,10 @@ N.consoleMessage && ($t || ($t = !0, console.error(N.consoleMessage)));

}
) : /* @__PURE__ */ b(Sn.Provider, { value: O, children: /* @__PURE__ */ b(Io, { ...Y }) });
) : /* @__PURE__ */ b(xn.Provider, { value: O, children: /* @__PURE__ */ b(So, { ...Y }) });
}
);
yo.displayName = "VirtuosoMessageList";
Io.displayName = "VirtuosoMessageList";
function pe(e) {
return e ? e.getBoundingClientRect().height : 0;
}
const Io = ({ style: e, ...t }) => {
const So = ({ style: e, ...t }) => {
const n = at(), [

@@ -1741,31 +1732,31 @@ o,

w
] = xn(
Qt,
] = $n(
en,
an,
tn,
pn,
tn,
fn,
nn,
fn,
on,
hn,
gn,
ct,
on,
sn
sn,
rn
), x = k.useCallback(
(d, te) => {
const j = d.querySelector('[data-role="virtuoso-list"]'), Ye = d.querySelector('[data-role="virtuoso-header"]'), X = d.querySelector('[data-role="virtuoso-sticky-header"]'), Ke = d.querySelector('[data-role="virtuoso-footer"]'), bn = d.querySelector('[data-role="virtuoso-sticky-footer"]'), kn = j && te === "resize" ? Xn(j.children) : [];
const j = d.querySelector('[data-role="virtuoso-list"]'), Ye = d.querySelector('[data-role="virtuoso-header"]'), X = d.querySelector('[data-role="virtuoso-sticky-header"]'), Ke = d.querySelector('[data-role="virtuoso-footer"]'), kn = d.querySelector('[data-role="virtuoso-sticky-footer"]'), yn = j && te === "resize" ? Qn(j.children) : [];
n.pubIn({
[ke]: kn,
[ye]: yn,
[y]: d.scrollTop,
[Se]: d.scrollHeight,
[xe]: d.scrollHeight,
[Z]: pe(d),
[qt]: d.clientWidth,
[$e]: pe(Ye),
[xe]: pe(X),
[Ut]: d.clientWidth,
[Te]: pe(Ye),
[$e]: pe(X),
[gt]: pe(Ke),
[Te]: pe(bn)
[Ee]: pe(kn)
});
},
[n]
), { elRef: H, callbackRef: B, listCallbackRef: Y, scrollBy: J, scrollTo: O } = Jn(x), { items: N } = V(be);
), { elRef: H, callbackRef: B, listCallbackRef: Y, scrollBy: J, scrollTo: O } = Xn(x), { items: N } = V(ke);
k.useLayoutEffect(() => {

@@ -1775,4 +1766,4 @@ const d = H.current;

}, [N, H, x, p]), k.useLayoutEffect(() => n.sub(ce, O), [O, n]), k.useLayoutEffect(() => n.sub(G, J), [J, n]);
const D = V(A), Ne = V(R), F = V(lt), Ee = V(_e), Me = V(Gt), z = V(Ve), ze = V(Xt), Le = V(ue), K = V(ae);
return /* @__PURE__ */ b(yn, { children: /* @__PURE__ */ Tt(
const D = V(A), Ne = V(R), F = V(lt), Me = V(_e), Le = V(Zt), z = V(We), ze = V(Qt), we = V(ue), K = V(ae);
return /* @__PURE__ */ b(In, { children: /* @__PURE__ */ Tt(
w,

@@ -1792,3 +1783,3 @@ {

o && /* @__PURE__ */ b(i, { "data-role": "virtuoso-header", children: /* @__PURE__ */ b(o, { context: z }) }),
Le > 0 ? /* @__PURE__ */ b(
we > 0 ? /* @__PURE__ */ b(
"div",

@@ -1802,6 +1793,6 @@ {

height: K,
paddingBottom: Ee,
paddingBottom: Me,
overflowAnchor: "none",
marginTop: F,
transition: Me,
transition: Le,
position: "relative",

@@ -1834,7 +1825,7 @@ transform: `translateY(${D}px)`

export {
yo as VirtuosoMessageList,
ko as VirtuosoMessageListLicense,
Eo as useCurrentlyRenderedData,
To as useVirtuosoLocation,
Mo as useVirtuosoMethods
Io as VirtuosoMessageList,
yo as VirtuosoMessageListLicense,
Mo as useCurrentlyRenderedData,
Eo as useVirtuosoLocation,
Lo as useVirtuosoMethods
};

@@ -23,3 +23,3 @@ {

},
"version": "1.4.0",
"version": "1.4.1",
"type": "module",

@@ -26,0 +26,0 @@ "module": "dist/index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc