@virtuoso.dev/message-list
Advanced tools
Comparing version 1.8.0-alpha.16 to 1.8.0-alpha.17
@@ -0,1 +1,8 @@ | ||
# [1.8.0-alpha.17](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.16...v1.8.0-alpha.17) (2024-06-17) | ||
### Bug Fixes | ||
* testing something ([2f62e4f](https://github.com/virtuoso-dev/message-list/commit/2f62e4f1bba26f9bdfd5194819e5a10e4cc15e97)) | ||
# [1.8.0-alpha.16](https://github.com/virtuoso-dev/message-list/compare/v1.8.0-alpha.15...v1.8.0-alpha.16) (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 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"; | ||
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 V, useRealm as zt, Realm as Zn, RealmContext as Jn, useCellValues as Xn } from "@mdxeditor/gurx"; | ||
function be(e, t) { | ||
@@ -289,3 +289,3 @@ const n = c(e, (o) => { | ||
const { align: h, behavior: p, offset: m, index: k } = Ct(e, s - 1); | ||
function F() { | ||
function _() { | ||
const J = re(t, k)[1]; | ||
@@ -298,3 +298,3 @@ if (J === void 0) | ||
let d = ao(k, n) + l - r; | ||
h === "end" ? d = d - i + F() : h === "center" && (d = d - i / 2 + F() / 2), m && (d += m); | ||
h === "end" ? d = d - i + _() : h === "center" && (d = d - i / 2 + _() / 2), m && (d += m); | ||
let Y = 0; | ||
@@ -479,5 +479,5 @@ return h === "start" && (Y = Math.max(0, Math.min(d - (o - i)))), d = Math.max(0, d), { top: d, behavior: p, align: h, forceBottomSpace: Y }; | ||
_e, | ||
_, | ||
W, | ||
q, | ||
W | ||
B | ||
), | ||
@@ -501,3 +501,3 @@ v((t) => { | ||
k, | ||
F, | ||
_, | ||
d, | ||
@@ -510,4 +510,4 @@ Y | ||
if (b(s)) { | ||
let V = 0; | ||
return p !== null && (V = Ct(p, l - 1).index), { ...Ne, items: go(V, u), offsetTree: i, totalCount: l, data: u }; | ||
let N = 0; | ||
return p !== null && (N = Ct(p, l - 1).index), { ...Ne, items: go(N, u), offsetTree: i, totalCount: l, data: u }; | ||
} | ||
@@ -523,3 +523,3 @@ let J = 0; | ||
headerHeight: e.getValue(ct), | ||
stickyHeaderHeight: F, | ||
stickyHeaderHeight: _, | ||
stickyFooterHeight: d | ||
@@ -533,11 +533,11 @@ }).top ?? 0); | ||
return t; | ||
const ae = [], j = l - 1, P = 0, N = co(i, X, ue, P); | ||
const ae = [], j = l - 1, F = 0, P = co(i, X, ue, F); | ||
let K = 0, Pe = 0, E = !1; | ||
for (const V of N) { | ||
for (const N of P) { | ||
const { | ||
value: { offset: ye, height: se } | ||
} = V; | ||
let ee = V.start; | ||
K = ye, ye < X && (ee += Math.floor((X - ye) / se), K += (ee - V.start) * se), ee < P && (K += (P - ee) * se, ee = P); | ||
const we = Math.min(V.end, j); | ||
} = N; | ||
let ee = N.start; | ||
K = ye, ye < X && (ee += Math.floor((X - ye) / se), K += (ee - N.start) * se), ee < F && (K += (F - ee) * se, ee = F); | ||
const we = Math.min(N.end, j); | ||
for (let ie = ee; ie <= we && !(K >= ue); ie++) { | ||
@@ -736,3 +736,3 @@ const ft = { | ||
); | ||
}), W = c(!1), Ge = I((e) => { | ||
}), B = c(!1), Ge = I((e) => { | ||
e.link( | ||
@@ -757,19 +757,19 @@ e.pipe( | ||
Ge | ||
), en() ? (e.sub(e.pipe(Ge, T(_, x)), ([t, n]) => { | ||
e.pub(_, n - t); | ||
}), e.sub(e.pipe(e.combine(x, _, q)), ([t, n, o]) => { | ||
o || (n > 0 && t < n ? (e.pub(W, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
), en() ? (e.sub(e.pipe(Ge, T(W, x)), ([t, n]) => { | ||
e.pub(W, n - t); | ||
}), e.sub(e.pipe(e.combine(x, W, q)), ([t, n, o]) => { | ||
o || (n > 0 && t < n ? (e.pub(B, !0), e.pub(Ee, { top: 0, behavior: "instant" }), setTimeout(() => { | ||
e.pubIn({ | ||
[W]: !1, | ||
[_]: 0 | ||
[B]: !1, | ||
[W]: 0 | ||
}); | ||
})) : n < 0 && t <= 0 && (e.pubIn({ | ||
[W]: !0, | ||
[_]: 0 | ||
[B]: !0, | ||
[W]: 0 | ||
}), setTimeout(() => { | ||
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(W, !1); | ||
e.pub(Ee, { top: 0, behavior: "instant" }), e.pub(B, !1); | ||
}))); | ||
}), e.sub( | ||
e.pipe( | ||
e.combine(Ae, _, W, q), | ||
e.combine(Ae, W, B, q), | ||
v(([t, n, o, s]) => !t && n !== 0 && !o && !s), | ||
@@ -779,9 +779,9 @@ ve(100) | ||
([, t]) => { | ||
e.pub(W, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => { | ||
e.pub(W, !1); | ||
e.pub(B, !0), t < 0 ? requestAnimationFrame(() => { | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => { | ||
e.pub(B, !1); | ||
}); | ||
}) : requestAnimationFrame(() => { | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(_, 0), requestAnimationFrame(() => { | ||
e.pub(W, !1); | ||
e.pub(oe, { top: -t, behavior: "instant" }), e.pub(W, 0), requestAnimationFrame(() => { | ||
e.pub(B, !1); | ||
}); | ||
@@ -815,4 +815,4 @@ }); | ||
), | ||
_ | ||
), e.link(e.pipe(he, O(t)), W), e.sub( | ||
W | ||
), e.link(e.pipe(he, O(t)), B), e.sub( | ||
e.pipe( | ||
@@ -831,5 +831,5 @@ he, | ||
}), t ? setTimeout(() => { | ||
e.pub(_, 0), e.pub(q, !1), e.pub(W, !1); | ||
e.pub(W, 0), e.pub(q, !1), e.pub(B, !1); | ||
}, 100) : requestAnimationFrame(() => { | ||
e.pub(_, 0), e.pub(q, !1); | ||
e.pub(W, 0), e.pub(q, !1); | ||
}); | ||
@@ -1123,3 +1123,3 @@ } | ||
Me, | ||
W, | ||
B, | ||
Ue | ||
@@ -1142,5 +1142,5 @@ ), | ||
]) => { | ||
const k = e.getValue(rn), F = l - n - o, d = -t + s, Y = r === 0 ? F + Math.min(0, d) - i : -r; | ||
const k = e.getValue(rn), _ = l - n - o, d = -t + s, Y = r === 0 ? _ + Math.min(0, d) - i : -r; | ||
return { | ||
scrollHeight: F, | ||
scrollHeight: _, | ||
listOffset: d, | ||
@@ -1165,3 +1165,3 @@ visibleListHeight: i, | ||
); | ||
}), oe = I(), _ = c(0), wt = c(0), mn = c(""), kn = ({ index: e }) => /* @__PURE__ */ Nt("div", { children: [ | ||
}), oe = I(), W = c(0), wt = c(0), mn = c(""), kn = ({ index: e }) => /* @__PURE__ */ Nt("div", { children: [ | ||
"Item ", | ||
@@ -1567,3 +1567,3 @@ e | ||
now: /* @__PURE__ */ new Date(), | ||
packageTimestamp: 1718631524724 | ||
packageTimestamp: 1718636708266 | ||
}); | ||
@@ -1632,6 +1632,6 @@ return /* @__PURE__ */ y(Wn.Provider, { value: n, children: t }); | ||
function Xo() { | ||
return B(Fe); | ||
return V(Fe); | ||
} | ||
function Qo() { | ||
return B(yt); | ||
return V(yt); | ||
} | ||
@@ -1658,3 +1658,3 @@ function es() { | ||
EmptyPlaceholder: k = null, | ||
HeaderWrapper: F = wn, | ||
HeaderWrapper: _ = wn, | ||
StickyHeaderWrapper: d = Mn, | ||
@@ -1667,4 +1667,4 @@ FooterWrapper: Y = Ln, | ||
const j = g.useMemo(() => { | ||
const N = new Zn(); | ||
return N.register(He), N.register(Ve), N.register(Ge), N.register(qe), N.pubIn({ | ||
const P = new Zn(); | ||
return P.register(He), P.register(Ve), P.register(Ge), P.register(qe), P.pubIn({ | ||
[H]: e.slice(), | ||
@@ -1684,5 +1684,5 @@ [Ce]: n, | ||
[On]: Y, | ||
[An]: F, | ||
[An]: _, | ||
[Mt]: s | ||
}), N.singletonSub(Rt, i), N.singletonSub(yt, l), N; | ||
}), P.singletonSub(Rt, i), P.singletonSub(yt, l), P; | ||
}, []); | ||
@@ -1695,6 +1695,6 @@ g.useImperativeHandle(ae, () => _n(j), [j]), g.useEffect(() => { | ||
}); | ||
const P = g.useContext(Wn); | ||
const F = g.useContext(Wn); | ||
return g.useEffect(() => { | ||
P.consoleMessage && (Pt || (Pt = !0, console.error(P.consoleMessage))); | ||
}, [P]), typeof window < "u" && P.watermarkMessage ? /* @__PURE__ */ y( | ||
F.consoleMessage && (Pt || (Pt = !0, console.error(F.consoleMessage))); | ||
}, [F]), typeof window < "u" && F.watermarkMessage ? /* @__PURE__ */ y( | ||
"div", | ||
@@ -1706,3 +1706,3 @@ { | ||
}, | ||
children: P.watermarkMessage | ||
children: F.watermarkMessage | ||
} | ||
@@ -1725,3 +1725,3 @@ ) : /* @__PURE__ */ y(Jn.Provider, { value: j, children: /* @__PURE__ */ y(Uo, { ...ue }) }); | ||
k, | ||
F | ||
_ | ||
] = Xn( | ||
@@ -1753,3 +1753,3 @@ Sn, | ||
continue; | ||
} else if (A === N.current) { | ||
} else if (A === P.current) { | ||
S = { | ||
@@ -1801,3 +1801,3 @@ ...S, | ||
}); | ||
}), [Y, J] = Ye(d), [X, ue] = Ye(d), [ae, j] = Ye(d), [P, N] = Ye(d), K = g.useCallback( | ||
}), [Y, J] = Ye(d), [X, ue] = Ye(d), [ae, j] = Ye(d), [F, P] = Ye(d), K = g.useCallback( | ||
(f) => { | ||
@@ -1817,9 +1817,8 @@ d.observe(f); | ||
[d] | ||
), pe = g.useRef(null), V = g.useRef(null); | ||
), pe = g.useRef(null), N = g.useRef(null); | ||
g.useEffect(() => n.sub(tt, () => { | ||
V.current && clearTimeout(V.current); | ||
}), [n]); | ||
const ye = g.useCallback((f) => { | ||
var Ie; | ||
V.current && clearTimeout(V.current); | ||
N.current && clearTimeout(N.current); | ||
const z = ((Ie = E.current) == null ? void 0 : Ie.scrollTop) ?? 0; | ||
@@ -1830,3 +1829,3 @@ let D = 0; | ||
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; | ||
(A = E.current) == null || A.scrollTo({ top: te, behavior: "auto" }), D += 0.02, D < 1 ? N.current = setTimeout(S, 16) : N.current = null; | ||
} | ||
@@ -1861,7 +1860,7 @@ S(); | ||
[d, n, we] | ||
), { items: ft } = B(He); | ||
), { items: ft } = V(He); | ||
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), fe = B(Ce), Kn = B(In), jn = B(ke), Un = B(Re); | ||
const Fn = V(W), Pn = V(B), Nn = V(wt), zn = V(ut), Yn = V(mn), fe = V(Ce), Kn = V(In), jn = V(ke), Un = V(Re); | ||
return /* @__PURE__ */ y(Gn, { children: /* @__PURE__ */ Nt( | ||
F, | ||
_, | ||
{ | ||
@@ -1876,5 +1875,5 @@ ...t, | ||
}, | ||
...F === "div" ? { context: fe } : {}, | ||
..._ === "div" ? { context: fe } : {}, | ||
children: [ | ||
s && /* @__PURE__ */ y(l, { ref: P, style: ze, children: /* @__PURE__ */ y(s, { context: fe }) }), | ||
s && /* @__PURE__ */ y(l, { ref: F, style: ze, children: /* @__PURE__ */ y(s, { context: fe }) }), | ||
o && /* @__PURE__ */ y(i, { ref: ae, style: ze, children: /* @__PURE__ */ y(o, { context: fe }) }), | ||
@@ -1914,3 +1913,3 @@ jn > 0 ? /* @__PURE__ */ y( | ||
}, qo = ({ item: e, ItemContent: t, mount: n, unmount: o }) => { | ||
const s = B(Ce), i = g.useRef(null), l = g.useCallback( | ||
const s = V(Ce), i = g.useRef(null), l = g.useCallback( | ||
(r) => { | ||
@@ -1917,0 +1916,0 @@ r ? (i.current = r, n(r)) : i.current && (o(i.current), i.current = null); |
@@ -23,3 +23,3 @@ { | ||
}, | ||
"version": "1.8.0-alpha.16", | ||
"version": "1.8.0-alpha.17", | ||
"type": "module", | ||
@@ -26,0 +26,0 @@ "module": "dist/index.js", |
83474
2311