Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@af-utils/react-virtual-headless

Package Overview
Dependencies
Maintainers
1
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@af-utils/react-virtual-headless - npm Package Compare versions

Comparing version 0.0.35 to 0.0.36

8

lib/bundlesize.index.js

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

export const raw = 7990;
export const min = 4333;
export const minGz = 1976;
export const minBrotli = 1800;
export const raw = 7911;
export const min = 4392;
export const minGz = 2014;
export const minBrotli = 1828;

@@ -10,12 +10,25 @@ import { useRef as t, useEffect as s, useLayoutEffect as i, useCallback as h } from "react";

return h;
}, o = 3, n = 200, c = 40, l = 0, a = 1, u = 2, f = [ 0, 1, 2 ], m = Uint32Array, p = ResizeObserver, d = t => {
const s = t.length + 1, i = new m(s);
}, o = 3, n = 200, l = 40, c = 0, u = 1, a = 2, f = [ 0, 1, 2 ], m = t => t(), p = new Set, d = {
t: 0,
i() {
this.t++;
},
h() {
0 == --this.t && (
/*
calls must not call _startBatch from inside.
*/
p.forEach(m), p.clear());
},
o: t => p.add(t)
}, w = Uint32Array, g = ResizeObserver, M = t => {
const s = t.length + 1, i = new w(s);
i.set(t, 1);
for (let t, h = 1; s > h; h++) t = h + (h & -h), s > t && (i[t] += i[h]);
return i;
}, w = (t, s, i, h) => {
}, z = (t, s, i, h) => {
for (;h > s; s += s & -s) t[s] += i;
}, g = t => t();
};
class z {
class v {
/*

@@ -25,13 +38,11 @@ most significant bit of this._itemCount;

*/
/* Queue of callbacks, that should run after batch end */
/* depth of batch */
constructor(t) {
this.horizontal = !1, this.t = "top", this.i = "scrollTop", this.h = "offsetHeight",
this.o = 0, this.l = 0, this.u = 0, this.m = 0, this.p = o, this.g = null, this.M = new m(0),
this.v = new m(0), this.S = 0, this.scrollSize = 0, this.from = 0, this.to = 0,
this.sizesHash = 0, this.C = new WeakMap, this.T = new p((t => {
this.horizontal = !1, this.l = "top", this.u = "scrollTop", this.m = "offsetHeight",
this.p = 0, this.g = 0, this.M = 0, this.v = 0, this._ = o, this.S = null, this.C = new w(0),
this.T = new w(0), this.H = 0, this.scrollSize = 0, this.from = 0, this.to = 0,
this.sizesHash = 0, this.I = new Map, this.F = new Map, this.O = new g((t => {
let s = 0, i = 0, h = 0, e = !1, r = this.from + 1;
for (;r < this.to; r += r & -r) ;
r = Math.min(r, this.v.length);
for (const {target: o} of t) s = this.C.get(o),
r = Math.min(r, this.T.length);
for (const {target: o} of t) s = this.I.get(o),
/*

@@ -42,7 +53,5 @@ ResizeObserver may give us elements, which are not in visible range => will be unmounted soon.

*/
s >= this.from && s < this.to && (i = o[this.h] - this.M[s], i && (e = !0, this.M[s] += i,
h += i, w(this.v, s + 1, i, r)));
e && (
/*@__INLINE__*/
this._++, 0 !== h && (w(this.v, r, h, this.v.length), this.scrollSize += h, this.H(1),
s >= this.from && s < this.to && (i = o[this.m] - this.C[s], i && (e = !0, this.C[s] += i,
h += i, z(this.T, s + 1, i, r)));
e && (d.i(), 0 !== h && (z(this.T, r, h, this.T.length), this.scrollSize += h, this.R(1),
0 > h &&

@@ -53,3 +62,3 @@ /*

*/
this.I())
this.W())
/*

@@ -59,120 +68,111 @@ Modulo is used to prevent sizesHash from growing too much.

5 % 2 === 5 & 1 && 9 % 4 === 9 & 3
*/ , this.sizesHash = this.sizesHash + 1 & 1073741823, this.H(2), this.F());
})), this.O = f.map((() => [])), this.R = new Set, this._ = 0, this.W = () => {
const t = this.g[this.h];
t !== this.B && (this.B = t, this.I());
}, this.k = new p(this.W), this.A = t => this.R.add(t), this.G = t => {
const s = this.m, i = this.g[this.i];
i !== s && (this.m = i, this.l = t.timeStamp, i > s ? this.I() : this.L());
*/ , this.sizesHash = this.sizesHash + 1 & 1073741823, this.R(2), d.h());
})), this.q = f.map((() => [])), this.A = () => {
const t = this.S[this.m];
t !== this.G && (this.G = t, this.W());
}, this.L = new g(this.A), this.U = t => {
const s = this.v, i = this.S[this.u];
i !== s && (this.v = i, this.g = t.timeStamp, i > s ? this.W() : this.$());
}, this.setOuterNode = t => {
this.g && (this.k.unobserve(this.g), this.g.removeEventListener("scroll", this.G)),
(this.g = t) ? (this.k.observe(t), t.addEventListener("scroll", this.G, {
this.S && (this.L.unobserve(this.S), this.S.removeEventListener("scroll", this.U)),
(this.S = t) ? (this.L.observe(t), t.addEventListener("scroll", this.U, {
passive: !0
})) : (this.T.disconnect(), clearTimeout(this.u));
}, this.B = t ?? n;
})) : (this.O.disconnect(), clearTimeout(this.M));
}, this.G = t ?? n;
}
on(t, s) {
return s.forEach((s => this.O[s].push(t))), () => s.forEach((s => this.O[s].splice(this.O[s].indexOf(t), 1)));
return s.forEach((s => this.q[s].push(t))), () => s.forEach((s => this.q[s].splice(this.q[s].indexOf(t), 1)));
}
H(t) {
this.O[t].forEach(0 === this._ ? g : this.A);
R(t) {
this.q[t].forEach(0 === d.t ? m : d.o);
}
/* inspired by mobx */ U() {
this._++;
}
F() {
0 == --this._ && (
/*
calls must not call _startBatch from inside.
*/
this.R.forEach(g), this.R.clear());
}
getIndex(t) {
let s = 0;
t = Math.min(t, this.scrollSize);
for (let i = this.S, h = 0; i > 0; i >>= 1) (h = s + i) <= this.o && t > this.v[h] && (s = h,
t -= this.v[h]);
for (let i = this.H, h = 0; i > 0; i >>= 1) (h = s + i) <= this.p && t > this.T[h] && (s = h,
t -= this.T[h]);
return s;
}
getOffset(t) {
if ("production" !== process.env.NODE_ENV && t > this.o) throw Error("index must not be > itemCount");
if ("production" !== process.env.NODE_ENV && t > this.p) throw Error("index must not be > itemCount");
let s = 0;
for (;t > 0; t -= t & -t) s += this.v[t];
for (;t > 0; t -= t & -t) s += this.T[t];
return s;
}
getSize(t) {
if ("production" !== process.env.NODE_ENV && t >= this.M.length) throw Error("itemIndex must be < itemCount in getSize");
return this.M[t];
if ("production" !== process.env.NODE_ENV && t >= this.C.length) throw Error("itemIndex must be < itemCount in getSize");
return this.C[t];
}
get visibleFrom() {
const t = this.getIndex(this.m);
return t + (this.m - this.getOffset(t)) / this.M[t];
const t = this.getIndex(this.v);
return t + (this.v - this.getOffset(t)) / this.C[t];
}
el(t, s) {
s && (this.C.set(s, t), this.T.observe(s));
s ? (this.I.set(s, t), this.F.set(t, s), this.O.observe(s)) : (s = this.F.get(t)) && (this.F.delete(t),
this.I.delete(s), this.O.unobserve(s));
}
I() {
W() {
/*
zero itemCount check is not needed here, it is done inside folowing if block
*/
const t = 1 + this.getIndex(this.m + this.B);
t > this.to && (this.to = Math.min(this.o, t + this.p), this.from = this.getIndex(this.m),
this.H(0));
const t = 1 + this.getIndex(this.v + this.G);
t > this.to && (this.to = Math.min(this.p, t + this._), this.from = this.getIndex(this.v),
this.R(0));
}
L() {
const t = this.getIndex(this.m);
t < this.from && (this.from = Math.max(0, t - this.p), this.to = this.o && 1 + this.getIndex(this.m + this.B),
this.H(0));
$() {
const t = this.getIndex(this.v);
t < this.from && (this.from = Math.max(0, t - this._), this.to = this.p && 1 + this.getIndex(this.v + this.G),
this.R(0));
}
scrollTo(t, s, i) {
if (clearTimeout(this.u), this.g) {
const h = 0 | t, e = Math.min(this.scrollSize - this.B, this.getOffset(h) + Math.round(this.M[h] * (t - h)));
e !== this.m && (i ||= 5, s && 128 >= performance.now() - this.l || (this.g.scroll({
[this.t]: e,
if (clearTimeout(this.M), this.S) {
const h = 0 | t, e = Math.min(this.scrollSize - this.G, this.getOffset(h) + Math.round(this.C[h] * (t - h)));
e !== this.v && (i ||= 5, s && 128 >= performance.now() - this.g || (this.S.scroll({
[this.l]: e,
behavior: s ? "smooth" : "instant"
}), i--), i && (this.u = setTimeout((() => this.scrollTo(t, s, i)), s ? 512 : 32)));
}), i--), i && (this.M = setTimeout((() => this.scrollTo(t, s, i)), s ? 512 : 32)));
}
}
setHorizontal(t) {
t !== this.horizontal && (this.t = (this.horizontal = t) ? "left" : "top", this.i = t ? "scrollLeft" : "scrollTop",
this.h = t ? "offsetWidth" : "offsetHeight", this.g &&
t !== this.horizontal && (this.l = (this.horizontal = t) ? "left" : "top", this.u = t ? "scrollLeft" : "scrollTop",
this.m = t ? "offsetWidth" : "offsetHeight", this.S &&
/* TODO: Needs testing */
this.W(), this.scrollTo(0));
this.A(), this.scrollTo(0));
}
setItemCount(t, s) {
if (t > 2147483647) throw Error(`itemCount must be <= 2147483647. Got: ${t}.`);
if (t !== this.o) {
this.S = (this.o = t) && 1 << 31 - Math.clz32(t);
const i = this.M, h = i.length;
t > h && (this.M = new m(Math.min(t + 32, 2147483647)), this.M.set(i), this.v =
if (t !== this.p) {
this.H = (this.p = t) && 1 << 31 - Math.clz32(t);
const i = this.C, h = i.length;
t > h && (this.C = new w(Math.min(t + 32, 2147483647)), this.C.set(i), this.T =
/*@__NOINLINE__*/
d(this.M.fill(s || c, h)))
/*@__INLINE__*/ , this._++, this.scrollSize = this.getOffset(t), this.H(1), this.to > t && (
M(this.C.fill(s || l, h))), d.i(), this.scrollSize = this.getOffset(t), this.R(1),
this.to > t && (
// Forcing shift range to end
this.to = -1), this.I(), this.F();
this.to = -1), this.W(), d.h();
}
}
setOverscan(t) {
this.p = t;
this._ = t;
}
}
const M = s => {
const _ = s => {
const i = t();
return i.current ||= s();
}, v = t => {
let {itemCount: s = 0, estimatedItemSize: i = c, estimatedWidgetSize: h = n, overscanCount: e = o, horizontal: r} = t;
return M((() => {
const t = new z(h);
}, S = t => {
let {itemCount: s = 0, estimatedItemSize: i = l, estimatedWidgetSize: h = n, overscanCount: e = o, horizontal: r} = t;
return _((() => {
const t = new v(h);
return t.setOverscan(e), t.setHorizontal(!!r), t.setItemCount(s, i), t;
}));
}, S = i, b = t => {
const s = v(t);
}, b = i, C = t => {
const s = S(t);
/*
overscanCount can't be subscribed, so no sense to update it in effect.
*/ return s.setOverscan(t.overscanCount ?? o), S((() => {
s.U(), s.setHorizontal(!!t.horizontal), s.setItemCount(t.itemCount, t.estimatedItemSize || c),
s.F();
*/ return s.setOverscan(t.overscanCount ?? o), b((() => {
d.i(), s.setHorizontal(!!t.horizontal), s.setItemCount(t.itemCount, t.estimatedItemSize || l),
d.h();
})), s;
}, C = (t, i, h) => s((() => {
}, T = (t, i, h) => s((() => {
if (h) return h(), t.on(h, i);

@@ -184,12 +184,12 @@ }), [ h, i ])

only 'to' is safe to use for EVT_RANGE, because from is never changed without 'to'
*/ , T = [ "to", "scrollSize", "sizesHash" ], _ = (t, s) => {
*/ , x = [ "to", "scrollSize", "sizesHash" ], E = (t, s) => {
s ||= f;
const i = () => s.reduce(((s, i) => s + t[T[i]] + "_"), "");
const i = () => s.reduce(((s, i) => s + t[x[i]] + "_"), "");
e(h((i => t.on(i, s)), [ s ]), i, i);
}, x = t => {
}, H = t => {
let {model: s, children: i, events: h} = t;
return _(s, h), i();
return E(s, h), i();
};
export { f as EVT_ALL, l as EVT_RANGE, a as EVT_SCROLL_SIZE, u as EVT_SIZES, x as Subscription, r as mapVisibleRange, _ as useComponentSubscription, M as useOnce, C as useSubscription, b as useVirtual, v as useVirtualModel };
export { f as EVT_ALL, c as EVT_RANGE, u as EVT_SCROLL_SIZE, a as EVT_SIZES, H as Subscription, r as mapVisibleRange, E as useComponentSubscription, _ as useOnce, T as useSubscription, C as useVirtual, S as useVirtualModel };
//# sourceMappingURL=index.js.map

@@ -10,16 +10,29 @@ import { useRef as t, useEffect as s, useLayoutEffect as i, useCallback as h } from "react";

return h;
}, r = 3, n = 200, c = 40, l = 0, a = 1, u = 2, f = [ 0, 1, 2 ], m = Uint32Array, d = class {
}, r = 3, n = 200, c = 40, l = 0, u = 1, a = 2, f = [ 0, 1, 2 ], m = t => t(), p = new Set, d = {
t: 0,
i() {
this.t++;
},
h() {
0 == --this.t && (
/*
calls must not call _startBatch from inside.
*/
p.forEach(m), p.clear());
},
o: t => p.add(t)
}, w = Uint32Array, g = class {
observe() {}
unobserve() {}
disconnect() {}
}, p = t => {
const s = t.length + 1, i = new m(s);
}, M = t => {
const s = t.length + 1, i = new w(s);
i.set(t, 1);
for (let t, h = 1; s > h; h++) t = h + (h & -h), s > t && (i[t] += i[h]);
return i;
}, w = (t, s, i, h) => {
}, v = (t, s, i, h) => {
for (;h > s; s += s & -s) t[s] += i;
}, g = t => t();
};
class M {
class z {
/*

@@ -29,13 +42,11 @@ most significant bit of this._itemCount;

*/
/* Queue of callbacks, that should run after batch end */
/* depth of batch */
constructor(t) {
this.horizontal = !1, this.t = "top", this.i = "scrollTop", this.h = "offsetHeight",
this.o = 0, this.l = 0, this.u = 0, this.m = 0, this.p = r, this.g = null, this.M = new m(0),
this.v = new m(0), this.S = 0, this.scrollSize = 0, this.from = 0, this.to = 0,
this.sizesHash = 0, this.C = new WeakMap, this.T = new d((t => {
this.horizontal = !1, this.l = "top", this.u = "scrollTop", this.m = "offsetHeight",
this.p = 0, this.g = 0, this.M = 0, this.v = 0, this._ = r, this.S = null, this.C = new w(0),
this.T = new w(0), this.H = 0, this.scrollSize = 0, this.from = 0, this.to = 0,
this.sizesHash = 0, this.I = new Map, this.F = new Map, this.O = new g((t => {
let s = 0, i = 0, h = 0, e = !1, o = this.from + 1;
for (;o < this.to; o += o & -o) ;
o = Math.min(o, this.v.length);
for (const {target: r} of t) s = this.C.get(r),
o = Math.min(o, this.T.length);
for (const {target: r} of t) s = this.I.get(r),
/*

@@ -46,7 +57,5 @@ ResizeObserver may give us elements, which are not in visible range => will be unmounted soon.

*/
s >= this.from && s < this.to && (i = r[this.h] - this.M[s], i && (e = !0, this.M[s] += i,
h += i, w(this.v, s + 1, i, o)));
e && (
/*@__INLINE__*/
this._++, 0 !== h && (w(this.v, o, h, this.v.length), this.scrollSize += h, this.H(1),
s >= this.from && s < this.to && (i = r[this.m] - this.C[s], i && (e = !0, this.C[s] += i,
h += i, v(this.T, s + 1, i, o)));
e && (d.i(), 0 !== h && (v(this.T, o, h, this.T.length), this.scrollSize += h, this.R(1),
0 > h &&

@@ -57,3 +66,3 @@ /*

*/
this.I())
this.W())
/*

@@ -63,120 +72,111 @@ Modulo is used to prevent sizesHash from growing too much.

5 % 2 === 5 & 1 && 9 % 4 === 9 & 3
*/ , this.sizesHash = this.sizesHash + 1 & 1073741823, this.H(2), this.F());
})), this.W = f.map((() => [])), this.B = new Set, this._ = 0, this.O = () => {
const t = this.g[this.h];
t !== this.R && (this.R = t, this.I());
}, this.k = new d(this.O), this.A = t => this.B.add(t), this.G = t => {
const s = this.m, i = this.g[this.i];
i !== s && (this.m = i, this.l = t.timeStamp, i > s ? this.I() : this.L());
*/ , this.sizesHash = this.sizesHash + 1 & 1073741823, this.R(2), d.h());
})), this.q = f.map((() => [])), this.A = () => {
const t = this.S[this.m];
t !== this.G && (this.G = t, this.W());
}, this.L = new g(this.A), this.U = t => {
const s = this.v, i = this.S[this.u];
i !== s && (this.v = i, this.g = t.timeStamp, i > s ? this.W() : this.$());
}, this.setOuterNode = t => {
this.g && (this.k.unobserve(this.g), this.g.removeEventListener("scroll", this.G)),
(this.g = t) ? (this.k.observe(t), t.addEventListener("scroll", this.G, {
this.S && (this.L.unobserve(this.S), this.S.removeEventListener("scroll", this.U)),
(this.S = t) ? (this.L.observe(t), t.addEventListener("scroll", this.U, {
passive: !0
})) : (this.T.disconnect(), clearTimeout(this.u));
}, this.R = t ?? n;
})) : (this.O.disconnect(), clearTimeout(this.M));
}, this.G = t ?? n;
}
on(t, s) {
return s.forEach((s => this.W[s].push(t))), () => s.forEach((s => this.W[s].splice(this.W[s].indexOf(t), 1)));
return s.forEach((s => this.q[s].push(t))), () => s.forEach((s => this.q[s].splice(this.q[s].indexOf(t), 1)));
}
H(t) {
this.W[t].forEach(0 === this._ ? g : this.A);
R(t) {
this.q[t].forEach(0 === d.t ? m : d.o);
}
/* inspired by mobx */ U() {
this._++;
}
F() {
0 == --this._ && (
/*
calls must not call _startBatch from inside.
*/
this.B.forEach(g), this.B.clear());
}
getIndex(t) {
let s = 0;
t = Math.min(t, this.scrollSize);
for (let i = this.S, h = 0; i > 0; i >>= 1) (h = s + i) <= this.o && t > this.v[h] && (s = h,
t -= this.v[h]);
for (let i = this.H, h = 0; i > 0; i >>= 1) (h = s + i) <= this.p && t > this.T[h] && (s = h,
t -= this.T[h]);
return s;
}
getOffset(t) {
if ("production" !== process.env.NODE_ENV && t > this.o) throw Error("index must not be > itemCount");
if ("production" !== process.env.NODE_ENV && t > this.p) throw Error("index must not be > itemCount");
let s = 0;
for (;t > 0; t -= t & -t) s += this.v[t];
for (;t > 0; t -= t & -t) s += this.T[t];
return s;
}
getSize(t) {
if ("production" !== process.env.NODE_ENV && t >= this.M.length) throw Error("itemIndex must be < itemCount in getSize");
return this.M[t];
if ("production" !== process.env.NODE_ENV && t >= this.C.length) throw Error("itemIndex must be < itemCount in getSize");
return this.C[t];
}
get visibleFrom() {
const t = this.getIndex(this.m);
return t + (this.m - this.getOffset(t)) / this.M[t];
const t = this.getIndex(this.v);
return t + (this.v - this.getOffset(t)) / this.C[t];
}
el(t, s) {
s && (this.C.set(s, t), this.T.observe(s));
s ? (this.I.set(s, t), this.F.set(t, s), this.O.observe(s)) : (s = this.F.get(t)) && (this.F.delete(t),
this.I.delete(s), this.O.unobserve(s));
}
I() {
W() {
/*
zero itemCount check is not needed here, it is done inside folowing if block
*/
const t = 1 + this.getIndex(this.m + this.R);
t > this.to && (this.to = Math.min(this.o, t + this.p), this.from = this.getIndex(this.m),
this.H(0));
const t = 1 + this.getIndex(this.v + this.G);
t > this.to && (this.to = Math.min(this.p, t + this._), this.from = this.getIndex(this.v),
this.R(0));
}
L() {
const t = this.getIndex(this.m);
t < this.from && (this.from = Math.max(0, t - this.p), this.to = this.o && 1 + this.getIndex(this.m + this.R),
this.H(0));
$() {
const t = this.getIndex(this.v);
t < this.from && (this.from = Math.max(0, t - this._), this.to = this.p && 1 + this.getIndex(this.v + this.G),
this.R(0));
}
scrollTo(t, s, i) {
if (clearTimeout(this.u), this.g) {
const h = 0 | t, e = Math.min(this.scrollSize - this.R, this.getOffset(h) + Math.round(this.M[h] * (t - h)));
e !== this.m && (i ||= 5, s && 128 >= performance.now() - this.l || (this.g.scroll({
[this.t]: e,
if (clearTimeout(this.M), this.S) {
const h = 0 | t, e = Math.min(this.scrollSize - this.G, this.getOffset(h) + Math.round(this.C[h] * (t - h)));
e !== this.v && (i ||= 5, s && 128 >= performance.now() - this.g || (this.S.scroll({
[this.l]: e,
behavior: s ? "smooth" : "instant"
}), i--), i && (this.u = setTimeout((() => this.scrollTo(t, s, i)), s ? 512 : 32)));
}), i--), i && (this.M = setTimeout((() => this.scrollTo(t, s, i)), s ? 512 : 32)));
}
}
setHorizontal(t) {
t !== this.horizontal && (this.t = (this.horizontal = t) ? "left" : "top", this.i = t ? "scrollLeft" : "scrollTop",
this.h = t ? "offsetWidth" : "offsetHeight", this.g &&
t !== this.horizontal && (this.l = (this.horizontal = t) ? "left" : "top", this.u = t ? "scrollLeft" : "scrollTop",
this.m = t ? "offsetWidth" : "offsetHeight", this.S &&
/* TODO: Needs testing */
this.O(), this.scrollTo(0));
this.A(), this.scrollTo(0));
}
setItemCount(t, s) {
if (t > 2147483647) throw Error(`itemCount must be <= 2147483647. Got: ${t}.`);
if (t !== this.o) {
this.S = (this.o = t) && 1 << 31 - Math.clz32(t);
const i = this.M, h = i.length;
t > h && (this.M = new m(Math.min(t + 32, 2147483647)), this.M.set(i), this.v =
if (t !== this.p) {
this.H = (this.p = t) && 1 << 31 - Math.clz32(t);
const i = this.C, h = i.length;
t > h && (this.C = new w(Math.min(t + 32, 2147483647)), this.C.set(i), this.T =
/*@__NOINLINE__*/
p(this.M.fill(s || c, h)))
/*@__INLINE__*/ , this._++, this.scrollSize = this.getOffset(t), this.H(1), this.to > t && (
M(this.C.fill(s || c, h))), d.i(), this.scrollSize = this.getOffset(t), this.R(1),
this.to > t && (
// Forcing shift range to end
this.to = -1), this.I(), this.F();
this.to = -1), this.W(), d.h();
}
}
setOverscan(t) {
this.p = t;
this._ = t;
}
}
const v = s => {
const _ = s => {
const i = t();
return i.current ||= s();
}, z = t => {
}, b = t => {
let {itemCount: s = 0, estimatedItemSize: i = c, estimatedWidgetSize: h = n, overscanCount: e = r, horizontal: o} = t;
return v((() => {
const t = new M(h);
return _((() => {
const t = new z(h);
return t.setOverscan(e), t.setHorizontal(!!o), t.setItemCount(s, i), t;
}));
}, b = s, S = t => {
const s = z(t);
}, S = s, C = t => {
const s = b(t);
/*
overscanCount can't be subscribed, so no sense to update it in effect.
*/ return s.setOverscan(t.overscanCount ?? r), b((() => {
s.U(), s.setHorizontal(!!t.horizontal), s.setItemCount(t.itemCount, t.estimatedItemSize || c),
s.F();
*/ return s.setOverscan(t.overscanCount ?? r), S((() => {
d.i(), s.setHorizontal(!!t.horizontal), s.setItemCount(t.itemCount, t.estimatedItemSize || c),
d.h();
})), s;
}, C = (t, i, h) => s((() => {
}, T = (t, i, h) => s((() => {
if (h) return h(), t.on(h, i);

@@ -188,11 +188,11 @@ }), [ h, i ])

only 'to' is safe to use for EVT_RANGE, because from is never changed without 'to'
*/ , T = [ "to", "scrollSize", "sizesHash" ], _ = (t, s) => {
*/ , x = [ "to", "scrollSize", "sizesHash" ], E = (t, s) => {
s ||= f;
const i = () => s.reduce(((s, i) => s + t[T[i]] + "_"), "");
const i = () => s.reduce(((s, i) => s + t[x[i]] + "_"), "");
e(h((i => t.on(i, s)), [ s ]), i, i);
}, x = t => {
}, H = t => {
let {model: s, children: i, events: h} = t;
return _(s, h), i();
return E(s, h), i();
};
export { f as EVT_ALL, l as EVT_RANGE, a as EVT_SCROLL_SIZE, u as EVT_SIZES, x as Subscription, o as mapVisibleRange, _ as useComponentSubscription, v as useOnce, C as useSubscription, S as useVirtual, z as useVirtualModel };
export { f as EVT_ALL, l as EVT_RANGE, u as EVT_SCROLL_SIZE, a as EVT_SIZES, H as Subscription, o as mapVisibleRange, E as useComponentSubscription, _ as useOnce, T as useSubscription, C as useVirtual, b as useVirtualModel };
{
"name": "@af-utils/react-virtual-headless",
"private": false,
"version": "0.0.35",
"version": "0.0.36",
"description": "React components for rendering large scrollable data",

@@ -6,0 +6,0 @@ "repository": "https://github.com/nowaalex/af-virtual-scroll.git",

Sorry, the diff of this file is not supported yet

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