@af-utils/react-virtual-headless
Advanced tools
Comparing version 0.0.11 to 0.0.12
@@ -1,4 +0,4 @@ | ||
export const raw = 7929; | ||
export const min = 4590; | ||
export const minGz = 1948; | ||
export const minBrotli = 1769; | ||
export const raw = 7862; | ||
export const min = 4494; | ||
export const minGz = 1909; | ||
export const minBrotli = 1739; |
@@ -7,4 +7,5 @@ import { jsx as t } from "react/jsx-runtime"; | ||
const r = t => t, n = function(s, i, h, e) { | ||
void 0 === e && (e = r); | ||
const r = t => t, n = (s, i, h, e) => { | ||
// default arguments are transpiled non-compact way | ||
e || (e = r); | ||
const o = []; | ||
@@ -17,19 +18,15 @@ for (let r = s.from, n = s.to; n > r; r++) o.push(/*#__PURE__*/ t(i, { | ||
return o; | ||
}, c = (t, s) => t.i === s.i && t.data === s.data, a = (t, s) => t.length ? Math.round(s / t.length) : 40, u = "undefined" == typeof ResizeObserver ? class { | ||
observe() {} | ||
unobserve() {} | ||
disconnect() {} | ||
} : ResizeObserver, l = [], f = 0, d = 1, m = 2, p = [ 0, 1, 2 ]; | ||
}, c = (t, s) => t.i === s.i && t.data === s.data, a = (t, s) => t.length ? Math.round(s / t.length) : 40, u = [], l = 0, f = 1, m = 2, d = [ 0, 1, 2 ], p = ResizeObserver; | ||
class w { | ||
constructor() { | ||
this.horizontal = !1, this.t = "scrollTop", this.h = "offsetHeight", this.o = new u((() => this.setWidgetSize(this.u[this.h]))), | ||
this.horizontal = !1, this.t = "scrollTop", this.h = "offsetHeight", this.o = new p((() => this.setWidgetSize(this.u[this.h]))), | ||
this.scrollPos = 0, this.l = 0, this.m = null, this.p = 0, this.u = null, this.g = 0, | ||
this._ = [], this.v = [], this.S = 0, this.scrollSize = 0, this.itemCount = 0, this.from = 0, | ||
this.to = 0, this.C = new Map, this.M = new Map, this.T = new u((t => { | ||
this._ = [], this.S = [], this.C = 0, this.scrollSize = 0, this.itemCount = 0, this.from = 0, | ||
this.to = 0, this.M = new Map, this.v = new Map, this.T = new p((t => { | ||
let s = this.from, i = 0, h = 0, e = s + 1; | ||
for (;e < this.to; e += e & -e) ; | ||
for (const {target: o} of t) s = this.C.get(o), i = o[this.h] - this._[s], i && (this._[s] += i, | ||
for (const {target: o} of t) s = this.M.get(o), i = o[this.h] - this._[s], i && (this._[s] += i, | ||
h += i, this.H(s + 1, i, e)); | ||
0 !== h && (this.I(), this.H(e, h, this.v.length), this.R(this.scrollSize + h), | ||
0 !== h && (this.I(), this.H(e, h, this.S.length), this.R(this.scrollSize + h), | ||
this.O(), this.W()); | ||
@@ -79,6 +76,6 @@ })), this.A = [ [], [], [] ], this.B = new Set, this.F = 0, this.U = () => { | ||
throw new Error("itemCount must be 0 - 2_147_483_647. Got: " + t + "."); | ||
this.S = t && 1 << 31 - Math.clz32(t); | ||
this.C = t && 1 << 31 - Math.clz32(t); | ||
const i = this._, h = i.length; | ||
if (t > h) { | ||
this._ = new Uint32Array(t), this.v = new Uint32Array(t + 1), this._.fill(s(i, this.scrollSize, t), h).set(i), | ||
this._ = new Uint32Array(t), this.S = new Uint32Array(t + 1), this._.fill(s(i, this.scrollSize, t), h).set(i), | ||
/* | ||
@@ -88,4 +85,4 @@ Creating fenwick tree from an array in linear time; | ||
*/ | ||
this.v.set(this._, 1); | ||
for (let s, i = 1; t >= i; i++) s = i + (i & -i), s > t || (this.v[s] += this.v[i]); | ||
this.S.set(this._, 1); | ||
for (let s, i = 1; t >= i; i++) s = i + (i & -i), s > t || (this.S[s] += this.S[i]); | ||
} | ||
@@ -96,5 +93,5 @@ this.R(this.getOffset(t)); | ||
let s = 0; | ||
for (let i = this.S, h = 0; i > 0; i >>= 1) if (h = s + i, h <= this.itemCount) { | ||
if (t === this.v[h]) return h; | ||
t > this.v[h] && (t -= this.v[h], s = h); | ||
for (let i = this.C, h = 0; i > 0; i >>= 1) if (h = s + i, h <= this.itemCount) { | ||
if (t === this.S[h]) return h; | ||
t > this.S[h] && (t -= this.S[h], s = h); | ||
} | ||
@@ -106,3 +103,3 @@ return s; | ||
let s = 0; | ||
for (;t > 0; t -= t & -t) s += this.v[t]; | ||
for (;t > 0; t -= t & -t) s += this.S[t]; | ||
return s; | ||
@@ -115,7 +112,7 @@ } | ||
/* i starts from 1 here; */ H(t, s, i) { | ||
for (;i > t; t += t & -t) this.v[t] += s; | ||
for (;i > t; t += t & -t) this.S[t] += s; | ||
} | ||
el(t, s) { | ||
s ? (this.M.set(t, s), this.C.set(s, t), this.T.observe(s)) : (s = this.M.get(t)) && (this.M.delete(t), | ||
this.C.delete(s), this.T.unobserve(s)); | ||
s ? (this.v.set(t, s), this.M.set(s, t), this.T.observe(s)) : (s = this.v.get(t)) && (this.v.delete(t), | ||
this.M.delete(s), this.T.unobserve(s)); | ||
} | ||
@@ -145,3 +142,3 @@ O() { | ||
if (!this.m) { | ||
const t = this.on(this.G, p); | ||
const t = this.on(this.G, d); | ||
this.p = setTimeout((() => { | ||
@@ -184,3 +181,3 @@ t(), this.m = null; | ||
return r.setOverscan(e), r; | ||
}, v = t => { | ||
}, S = t => { | ||
const s = _(t); | ||
@@ -195,8 +192,8 @@ return i((() => { | ||
})), s; | ||
}, z = (t, s, h, e) => i((() => (s(), t.on(s, h))), e || l), S = /*#__PURE__*/ h((t => { | ||
let {model: s, children: i, getHash: h, events: r = p} = t; | ||
}, z = (t, s, h, e) => i((() => (s(), t.on(s, h))), e || u), C = /*#__PURE__*/ h((t => { | ||
let {model: s, children: i, getHash: h, events: r = d} = t; | ||
return o(e((t => s.on(t, r)[r])), h, h), i(s); | ||
})); | ||
export { p as EVT_ALL, f as EVT_FROM, m as EVT_SCROLL_SIZE, d as EVT_TO, S as Subscription, c as areItemPropsEqual, n as mapVisibleRange, g as useOnce, z as useSubscription, v as useVirtual, _ as useVirtualModel }; | ||
export { d as EVT_ALL, l as EVT_FROM, m as EVT_SCROLL_SIZE, f as EVT_TO, C as Subscription, c as areItemPropsEqual, n as mapVisibleRange, g as useOnce, z as useSubscription, S as useVirtual, _ as useVirtualModel }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@af-utils/react-virtual-headless", | ||
"private": false, | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "React components for rendering large scrollable data", | ||
@@ -25,4 +25,4 @@ "repository": "https://github.com/nowaalex/af-virtual-scroll.git", | ||
], | ||
"main": "lib/index.js", | ||
"module": "lib/index.js", | ||
"main": "lib/index.server.js", | ||
"browser": "lib/index.js", | ||
"keywords": [ | ||
@@ -54,2 +54,3 @@ "react", | ||
"@rollup/plugin-export-bundle-size": "^0.0.1", | ||
"@rollup/plugin-replace": "^4.0.0", | ||
"babel-jest": "^28.1.1", | ||
@@ -64,5 +65,5 @@ "babel-plugin-module-resolver": "^4.1.0", | ||
"peerDependencies": { | ||
"use-sync-external-store": "^1.2.0", | ||
"prop-types": "^15.8.0", | ||
"react": "^17.0.0 || ^18.1.0" | ||
"react": "^17.0.0 || ^18.1.0", | ||
"use-sync-external-store": "^1.2.0" | ||
}, | ||
@@ -69,0 +70,0 @@ "publishConfig": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
42267
5
372
0
15
9