@af-utils/react-virtual-headless
Advanced tools
Comparing version 0.0.7 to 0.0.8
@@ -1,4 +0,4 @@ | ||
export const raw = 9087; | ||
export const min = 4881; | ||
export const minGz = 2084; | ||
export const minBrotli = 1893; | ||
export const raw = 9161; | ||
export const min = 4894; | ||
export const minGz = 2088; | ||
export const minBrotli = 1902; |
@@ -14,5 +14,5 @@ import { jsx as t } from "react/jsx-runtime"; | ||
return c; | ||
}, c = (t, s) => t.i === s.i && t.data === s.data, l = (t, s) => t.length ? Math.round(s / t.length) : 40, u = [], a = 0, f = 1, d = 2, m = [ 0, 1, 2 ], p = { | ||
}, c = (t, s) => t.i === s.i && t.data === s.data, l = [], u = 0, a = 1, f = 2, d = [ 0, 1, 2 ], m = { | ||
timeout: 500 | ||
}, g = globalThis.requestIdleCallback || (t => setTimeout(t, 500)), w = globalThis.cancelIdleCallback || clearTimeout, _ = globalThis.ResizeObserver || class { | ||
}, p = globalThis.requestIdleCallback || (t => setTimeout(t, 500)), g = globalThis.cancelIdleCallback || clearTimeout, w = (t, s) => t.length ? Math.round(s / t.length) : 40, _ = globalThis.ResizeObserver || class { | ||
observe() {} | ||
@@ -63,6 +63,6 @@ unobserve() {} | ||
}, h = () => { | ||
0 === s && (s = g(i, p)); | ||
0 === s && (s = p(i, m)); | ||
}; | ||
return h.A = () => { | ||
w(s), s = 0; | ||
g(s), s = 0; | ||
}, h; | ||
@@ -166,4 +166,4 @@ })((() => { | ||
scrollTo(t, s) { | ||
this.S || (this.on(this.L, m), this.v = setTimeout((() => { | ||
this.off(this.L, m), this.S = null; | ||
this.S || (this.on(this.L, d), this.v = setTimeout((() => { | ||
this.off(this.L, d), this.S = null; | ||
}), 500)), this.S = [ t || 0, s || 0 ], this.L(); | ||
@@ -181,4 +181,4 @@ } | ||
setItemCount(t, s) { | ||
t !== this.itemCount && (this.itemCount = t, this.u(), this.k(t, s), this.to > t ? this.q() : this.N(), | ||
this.W(), this.m()); | ||
void 0 === s && (s = w), t !== this.itemCount && (this.itemCount = t, this.u(), | ||
this.k(t, s), this.to > t ? this.q() : this.N(), this.W(), this.m()); | ||
} | ||
@@ -197,3 +197,5 @@ setOverscan(t) { | ||
}, C = t => { | ||
let {itemCount: s = 0, getEstimatedItemSize: h = l, estimatedWidgetSize: e = 200, overscanCount: o = 3, horizontal: r = !1} = t; | ||
let {itemCount: s = 0, getEstimatedItemSize: | ||
// setItemCount already has default callback set | ||
h, estimatedWidgetSize: e = 200, overscanCount: o = 3, horizontal: r = !1} = t; | ||
const n = T((() => { | ||
@@ -204,3 +206,3 @@ const t = new b; | ||
})); | ||
return n.setOverscan(o), i((() => () => n.D()), u), n; | ||
return n.setOverscan(o), i((() => () => n.D()), l), n; | ||
}, S = t => { | ||
@@ -213,7 +215,7 @@ const s = C(t); | ||
*/ | ||
s.u(), s.setHorizontal(t.horizontal), s.setItemCount(t.itemCount, t.getEstimatedItemSize || l), | ||
s.u(), s.setHorizontal(t.horizontal), s.setItemCount(t.itemCount, t.getEstimatedItemSize), | ||
s.m(); | ||
})), s; | ||
}, v = "undefined" != typeof window ? h : i, z = (t, s, i, h, e) => v((() => (t.on(s, i), | ||
h && s(), () => t.off(s, i))), e || u) | ||
h && s(), () => t.off(s, i))), e || l) | ||
/* | ||
@@ -225,3 +227,3 @@ Increment just x + 1 may result in NaN theoretically, so modulo should be used. | ||
*/ , E = t => t + 1 & 65535, M = /*#__PURE__*/ e((t => { | ||
let {model: i, children: h, events: e = m} = t; | ||
let {model: i, children: h, events: e = d} = t; | ||
const [r, n] = o(E, 1), c = s(0), l = s(null); | ||
@@ -232,3 +234,3 @@ return z(i, n, e), c.current !== r ? (c.current = r, l.current = h(i)) : i.h.add(n), | ||
export { m as EVT_ALL, a as EVT_FROM, d as EVT_SCROLL_SIZE, f as EVT_TO, M as Subscription, c as areItemPropsEqual, n as mapVisibleRange, T as useOnce, z as useSubscription, S as useVirtual, C as useVirtualModel }; | ||
export { d as EVT_ALL, u as EVT_FROM, f as EVT_SCROLL_SIZE, a as EVT_TO, M as Subscription, c as areItemPropsEqual, n as mapVisibleRange, T as useOnce, z as useSubscription, S as useVirtual, C as useVirtualModel }; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@af-utils/react-virtual-headless", | ||
"private": false, | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "React components for rendering large scrollable data", | ||
@@ -46,15 +46,15 @@ "repository": "https://github.com/nowaalex/af-virtual-scroll.git", | ||
"devDependencies": { | ||
"@babel/core": "^7.17.9", | ||
"@babel/plugin-transform-runtime": "^7.17.0", | ||
"@babel/preset-env": "^7.16.11", | ||
"@babel/preset-react": "^7.16.7", | ||
"@babel/core": "^7.18.5", | ||
"@babel/plugin-transform-runtime": "^7.18.5", | ||
"@babel/preset-env": "^7.18.2", | ||
"@babel/preset-react": "^7.17.12", | ||
"@rollup/plugin-babel": "^5.3.1", | ||
"@rollup/plugin-commonjs": "^22.0.0", | ||
"@rollup/plugin-export-bundle-size": "^0.0.1", | ||
"babel-jest": "^28.0.0", | ||
"babel-jest": "^28.1.1", | ||
"babel-plugin-module-resolver": "^4.1.0", | ||
"babel-plugin-transform-react-remove-prop-types": "^0.4.24", | ||
"jest": "^28.0.0", | ||
"jest": "^28.1.1", | ||
"lodash": "^4.17.21", | ||
"rollup": "^2.70.2", | ||
"rollup": "^2.75.6", | ||
"rollup-plugin-terser": "^7.0.2" | ||
@@ -61,0 +61,0 @@ }, |
Sorry, the diff of this file is not supported yet
38869
225