@af-utils/react-virtual-headless
Advanced tools
Comparing version 0.0.47 to 0.0.48
@@ -1,4 +0,4 @@ | ||
export const raw = 8487; | ||
export const min = 4663; | ||
export const minGz = 2101; | ||
export const minBrotli = 1907; | ||
export const raw = 8496; | ||
export const min = 4672; | ||
export const minGz = 2107; | ||
export const minBrotli = 1898; |
import { useRef as t, useLayoutEffect as s, useEffect as i, useMemo as h } from "react"; | ||
import { useSyncExternalStore as e } from "use-sync-external-store/shim"; | ||
import { useSyncExternalStore as e } from "use-sync-external-store/shim/index.js"; | ||
@@ -21,6 +21,6 @@ const o = (t, s, i) => { | ||
for (;h > s; s += s & -s) t[s] += i; | ||
}, p = (t, s, i) => { | ||
}, d = (t, s, i) => { | ||
for (;i > s; s += s & -s) ; | ||
return Math.min(s, t.length); | ||
}, d = new Set, w = { | ||
}, p = new Set, w = { | ||
t: 0, | ||
@@ -31,5 +31,5 @@ i() { | ||
h() { | ||
0 == --this.t && (d.forEach(a), d.clear()); | ||
0 == --this.t && (p.forEach(a), p.clear()); | ||
}, | ||
o: t => d.add(t) | ||
o: t => p.add(t) | ||
}, v = Uint32Array, g = new v(0); | ||
@@ -50,12 +50,12 @@ | ||
this.S = 0, this.u = 0, this.T = 0, this.C = 0, this.k = 0, this.F = 0, this.H = 3, | ||
this.I = 40, this.O = null, this.R = g, this.q = g, this.A = 0, this.scrollSize = 0, | ||
this.from = 0, this.to = 0, this.sizesHash = 0, this.G = new Map, this.L = new Map, | ||
this.U = [ null, null ], this.W = [ 0, 0 ], this.$ = new u((t => { | ||
this.I = 40, this.O = null, this.R = g, this.j = g, this.q = 0, this.scrollSize = 0, | ||
this.from = 0, this.to = 0, this.sizesHash = 0, this.A = new Map, this.G = new Map, | ||
this.L = [ null, null ], this.U = [ 0, 0 ], this.W = new u((t => { | ||
let s = 0, i = 0, h = 0; | ||
for (const {target: e} of t) s = this.U.indexOf(e), -1 !== s && (i = e[this._] - this.W[s], | ||
i && (this.W[s] += i, h += i)); | ||
for (const {target: e} of t) s = this.L.indexOf(e), -1 !== s && (i = e[this._] - this.U[s], | ||
i && (this.U[s] += i, h += i)); | ||
this.l(h); | ||
})), this.j = new u((t => { | ||
let s = 0, i = 0, h = 0, e = !1, o = /*@__NOINLINE__*/ p(this.q, this.from + 1, this.to); | ||
for (const {target: r} of t) s = this.G.get(r), | ||
})), this.$ = new u((t => { | ||
let s = 0, i = 0, h = 0, e = !1, o = /*@__NOINLINE__*/ d(this.j, this.from + 1, this.to); | ||
for (const {target: r} of t) s = this.A.get(r), | ||
/* | ||
@@ -66,4 +66,4 @@ ResizeObserver may give us elements, which are not in visible range => will be unmounted soon. | ||
*/ | ||
o > s && (i = r[this._] - this.R[s], i && (e = !0, this.R[s] += i, h += i, m(this.q, s + 1, i, o))); | ||
e && (w.i(), 0 !== h && (m(this.q, o, h, this.q.length), this.S += h, this.scrollSize += h, | ||
o > s && (i = r[this._] - this.R[s], i && (e = !0, this.R[s] += i, h += i, m(this.j, s + 1, i, o))); | ||
e && (w.i(), 0 !== h && (m(this.j, o, h, this.j.length), this.S += h, this.scrollSize += h, | ||
this.p(1), 0 > h && | ||
@@ -87,3 +87,3 @@ /* | ||
passive: !0 | ||
})) : (this.j.disconnect(), this.$.disconnect(), clearTimeout(this.k)); | ||
})) : (this.$.disconnect(), this.W.disconnect(), clearTimeout(this.k)); | ||
}, | ||
@@ -102,4 +102,4 @@ // stickyOffset is included; | ||
t = Math.min(t, this.S); | ||
for (let i = this.A, h = 0; i > 0; i >>= 1) (h = s + i) <= this.T && t > this.q[h] && (s = h, | ||
t -= this.q[h]); | ||
for (let i = this.q, h = 0; i > 0; i >>= 1) (h = s + i) <= this.T && t > this.j[h] && (s = h, | ||
t -= this.j[h]); | ||
return s; | ||
@@ -110,3 +110,3 @@ } | ||
let s = 0; | ||
for (;t > 0; t -= t & -t) s += this.q[t]; | ||
for (;t > 0; t -= t & -t) s += this.j[t]; | ||
return s; | ||
@@ -132,10 +132,10 @@ } | ||
*/ el(t, s) { | ||
const i = this.L.get(t); | ||
i && (this.L.delete(t), this.G.delete(i), this.j.unobserve(i)), s && (this.G.set(s, t), | ||
this.L.set(t, s), this.j.observe(s)); | ||
const i = this.G.get(t); | ||
i && (this.G.delete(t), this.A.delete(i), this.$.unobserve(i)), s && (this.A.set(s, t), | ||
this.G.set(t, s), this.$.observe(s)); | ||
} | ||
N(t, s) { | ||
const i = this.U[t]; | ||
i && (this.$.unobserve(i), this.l(-this.W[t]), this.U[t] = null, this.W[t] = 0), | ||
s && this.$.observe(this.U[t] = s); | ||
const i = this.L[t]; | ||
i && (this.W.unobserve(i), this.l(-this.U[t]), this.L[t] = null, this.U[t] = 0), | ||
s && this.W.observe(this.L[t] = s); | ||
} | ||
@@ -176,5 +176,5 @@ setStickyHeader(t) { | ||
if (h > 2147483647) throw Error(`itemCount must be <= 2147483647. Got: ${h}.`); | ||
this.A = (this.T = h) && 1 << 31 - Math.clz32(h); | ||
this.q = (this.T = h) && 1 << 31 - Math.clz32(h); | ||
const t = this.R, s = t.length; | ||
h > s && (this.R = new v(Math.min(h + 32, 2147483647)), this.R.set(t), this.q = /*@__NOINLINE__*/ f(this.R.fill(this.I || 40, s), v)), | ||
h > s && (this.R = new v(Math.min(h + 32, 2147483647)), this.R.set(t), this.j = /*@__NOINLINE__*/ f(this.R.fill(this.I || 40, s), v)), | ||
this.scrollSize = (this.S = this.getOffset(h)) + this.u, this.p(1), this.to > h && ( | ||
@@ -195,5 +195,5 @@ // Forcing shift range to end | ||
return b((() => s.set(t))), s; | ||
}, y = (t, s, h) => i((() => { | ||
}, x = (t, s, h) => i((() => { | ||
if (h) return h(), t.on(h, s); | ||
}), [ h, s ]), E = (t, s) => { | ||
}), [ h, s ]), y = (t, s) => { | ||
s ||= l; | ||
@@ -203,5 +203,5 @@ // szudzik pair | ||
e(i, o, o); | ||
}, T = t => (E(t.model, t.events), t.children()); | ||
}, E = t => (y(t.model, t.events), t.children()); | ||
export { l as EVT_ALL, r as EVT_RANGE, n as EVT_SCROLL_SIZE, c as EVT_SIZES, T as Subscription, o as mapVisibleRange, E as useComponentSubscription, y as useSubscription, S as useVirtual, _ as useVirtualModel }; | ||
export { l as EVT_ALL, r as EVT_RANGE, n as EVT_SCROLL_SIZE, c as EVT_SIZES, E as Subscription, o as mapVisibleRange, y as useComponentSubscription, x as useSubscription, S as useVirtual, _ as useVirtualModel }; | ||
//# sourceMappingURL=index.js.map |
import { useRef as t, useEffect as s, useMemo as i } from "react"; | ||
import { useSyncExternalStore as h } from "use-sync-external-store/shim"; | ||
import { useSyncExternalStore as h } from "use-sync-external-store/shim/index.js"; | ||
@@ -48,12 +48,12 @@ const e = (t, s, i) => { | ||
this.S = 0, this.u = 0, this.T = 0, this.C = 0, this.k = 0, this.F = 0, this.H = 3, | ||
this.I = 40, this.O = null, this.R = g, this.q = g, this.A = 0, this.scrollSize = 0, | ||
this.from = 0, this.to = 0, this.sizesHash = 0, this.G = new Map, this.L = new Map, | ||
this.U = [ null, null ], this.W = [ 0, 0 ], this.$ = new l((t => { | ||
this.I = 40, this.O = null, this.R = g, this.j = g, this.q = 0, this.scrollSize = 0, | ||
this.from = 0, this.to = 0, this.sizesHash = 0, this.A = new Map, this.G = new Map, | ||
this.L = [ null, null ], this.U = [ 0, 0 ], this.W = new l((t => { | ||
let s = 0, i = 0, h = 0; | ||
for (const {target: e} of t) s = this.U.indexOf(e), -1 !== s && (i = e[this._] - this.W[s], | ||
i && (this.W[s] += i, h += i)); | ||
for (const {target: e} of t) s = this.L.indexOf(e), -1 !== s && (i = e[this._] - this.U[s], | ||
i && (this.U[s] += i, h += i)); | ||
this.l(h); | ||
})), this.j = new l((t => { | ||
let s = 0, i = 0, h = 0, e = !1, o = /*@__NOINLINE__*/ m(this.q, this.from + 1, this.to); | ||
for (const {target: r} of t) s = this.G.get(r), | ||
})), this.$ = new l((t => { | ||
let s = 0, i = 0, h = 0, e = !1, o = /*@__NOINLINE__*/ m(this.j, this.from + 1, this.to); | ||
for (const {target: r} of t) s = this.A.get(r), | ||
/* | ||
@@ -64,4 +64,4 @@ ResizeObserver may give us elements, which are not in visible range => will be unmounted soon. | ||
*/ | ||
o > s && (i = r[this._] - this.R[s], i && (e = !0, this.R[s] += i, h += i, f(this.q, s + 1, i, o))); | ||
e && (p.i(), 0 !== h && (f(this.q, o, h, this.q.length), this.S += h, this.scrollSize += h, | ||
o > s && (i = r[this._] - this.R[s], i && (e = !0, this.R[s] += i, h += i, f(this.j, s + 1, i, o))); | ||
e && (p.i(), 0 !== h && (f(this.j, o, h, this.j.length), this.S += h, this.scrollSize += h, | ||
this.p(1), 0 > h && | ||
@@ -85,3 +85,3 @@ /* | ||
passive: !0 | ||
})) : (this.j.disconnect(), this.$.disconnect(), clearTimeout(this.k)); | ||
})) : (this.$.disconnect(), this.W.disconnect(), clearTimeout(this.k)); | ||
}, | ||
@@ -100,4 +100,4 @@ // stickyOffset is included; | ||
t = Math.min(t, this.S); | ||
for (let i = this.A, h = 0; i > 0; i >>= 1) (h = s + i) <= this.T && t > this.q[h] && (s = h, | ||
t -= this.q[h]); | ||
for (let i = this.q, h = 0; i > 0; i >>= 1) (h = s + i) <= this.T && t > this.j[h] && (s = h, | ||
t -= this.j[h]); | ||
return s; | ||
@@ -108,3 +108,3 @@ } | ||
let s = 0; | ||
for (;t > 0; t -= t & -t) s += this.q[t]; | ||
for (;t > 0; t -= t & -t) s += this.j[t]; | ||
return s; | ||
@@ -130,10 +130,10 @@ } | ||
*/ el(t, s) { | ||
const i = this.L.get(t); | ||
i && (this.L.delete(t), this.G.delete(i), this.j.unobserve(i)), s && (this.G.set(s, t), | ||
this.L.set(t, s), this.j.observe(s)); | ||
const i = this.G.get(t); | ||
i && (this.G.delete(t), this.A.delete(i), this.$.unobserve(i)), s && (this.A.set(s, t), | ||
this.G.set(t, s), this.$.observe(s)); | ||
} | ||
N(t, s) { | ||
const i = this.U[t]; | ||
i && (this.$.unobserve(i), this.l(-this.W[t]), this.U[t] = null, this.W[t] = 0), | ||
s && this.$.observe(this.U[t] = s); | ||
const i = this.L[t]; | ||
i && (this.W.unobserve(i), this.l(-this.U[t]), this.L[t] = null, this.U[t] = 0), | ||
s && this.W.observe(this.L[t] = s); | ||
} | ||
@@ -174,5 +174,5 @@ setStickyHeader(t) { | ||
if (h > 2147483647) throw Error(`itemCount must be <= 2147483647. Got: ${h}.`); | ||
this.A = (this.T = h) && 1 << 31 - Math.clz32(h); | ||
this.q = (this.T = h) && 1 << 31 - Math.clz32(h); | ||
const t = this.R, s = t.length; | ||
h > s && (this.R = new w(Math.min(h + 32, 2147483647)), this.R.set(t), this.q = /*@__NOINLINE__*/ a(this.R.fill(this.I || 40, s), w)), | ||
h > s && (this.R = new w(Math.min(h + 32, 2147483647)), this.R.set(t), this.j = /*@__NOINLINE__*/ a(this.R.fill(this.I || 40, s), w)), | ||
this.scrollSize = (this.S = this.getOffset(h)) + this.u, this.p(1), this.to > h && ( | ||
@@ -195,3 +195,3 @@ // Forcing shift range to end | ||
if (h) return h(), t.on(h, i); | ||
}), [ h, i ]), y = (t, s) => { | ||
}), [ h, i ]), x = (t, s) => { | ||
s ||= c; | ||
@@ -201,5 +201,5 @@ // szudzik pair | ||
h(e, o, o); | ||
}, E = t => (y(t.model, t.events), t.children()); | ||
}, y = t => (x(t.model, t.events), t.children()); | ||
export { c as EVT_ALL, o as EVT_RANGE, r as EVT_SCROLL_SIZE, n as EVT_SIZES, E as Subscription, e as mapVisibleRange, y as useComponentSubscription, b as useSubscription, S as useVirtual, M as useVirtualModel }; | ||
export { c as EVT_ALL, o as EVT_RANGE, r as EVT_SCROLL_SIZE, n as EVT_SIZES, y as Subscription, e as mapVisibleRange, x as useComponentSubscription, b as useSubscription, S as useVirtual, M as useVirtualModel }; | ||
//# sourceMappingURL=index.server.js.map |
{ | ||
"name": "@af-utils/react-virtual-headless", | ||
"private": false, | ||
"version": "0.0.47", | ||
"version": "0.0.48", | ||
"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
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
77964