New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.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.2 to 0.0.3

8

lib/bundlesize.index.js

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

export const raw = 8419;
export const min = 4529;
export const minGz = 1981;
export const minBrotli = 1783;
export const raw = 8445;
export const min = 4506;
export const minGz = 1955;
export const minBrotli = 1758;

@@ -8,3 +8,3 @@ import { jsx as t } from "react/jsx-runtime";

const r = [];
for (;e < o; e++) r.push(/*#__PURE__*/ t(i, {
for (;o > e; e++) r.push(/*#__PURE__*/ t(i, {
i: e,

@@ -16,3 +16,3 @@ data: h

timeout: 2e3
}, u = globalThis.requestIdleCallback || (t => setTimeout(t, 500)), l = globalThis.cancelIdleCallback || clearTimeout, a = globalThis.ResizeObserver || class {
}, l = globalThis.requestIdleCallback || (t => setTimeout(t, 500)), u = globalThis.cancelIdleCallback || clearTimeout, a = globalThis.ResizeObserver || class {
observe() {}

@@ -26,13 +26,13 @@ unobserve() {}

}
sub(t, s) {
on(t, s) {
for (const i of s) this.t[i].push(t);
}
unsub(t, s) {
off(t, s) {
for (const i of s) this.t[i].splice(this.t[i].indexOf(t) >>> 0, 1);
}
u(t) {
l(t) {
if ("production" !== process.env.NODE_ENV && 0 === this.o) throw new Error("Can't run actions while not in batch");
for (const s of this.t[t]) this.h.add(s);
}
/* inspired by mobx */ l() {
/* inspired by mobx */ u() {
this.o++;

@@ -57,30 +57,44 @@ }

super(), this.horizontal = !1, this.p = "scrollTop", this.g = "offsetHeight", this._ = new a((() => this.setWidgetSize(this.S[this.g]))),
this.C = 0, this.T = 0, this.v = 0, this.I = null, this.S = null, this.M = 0, this.H = [],
this.C = 0, this.T = 0, this.v = 0, this.M = null, this.S = null, this.I = 0, this.H = [],
this.R = [], this.W = 0, this.scrollSize = 0, this.itemCount = 0, this.from = 0,
this.to = 0, this.A = ((t, s) => {
let i = 0;
const h = t.bind(s), e = () => {
i = 0, h();
}, o = () => {
0 === i && (i = u(e, c));
this.to = 0, this.A = (t => {
let s = 0;
const i = () => {
s = 0, t();
}, h = () => {
0 === s && (s = l(i, c));
};
return o.B = () => {
l(i), i = 0;
}, o;
})(this.F, this), this.N = () => {
const t = this.S[this.p], s = t - this.C;
this.C = t, s > 0 ? this.O() : s < 0 && this.U();
return h.B = () => {
u(s), s = 0;
}, h;
})((() => {
/*
Babel still transpiles optional chaining little ugly
*/
let t = this.M && this.M.nextElementSibling;
if (t) {
let s = this.from, i = 0, h = s + 1, e = 0;
/* We can batch-update fenwick tree, if we know updated indexes range */ for (;h < this.to; h += h & -h) ;
do {
i = t[this.g] - this.H[s], i && (this.H[s] += i, e += i, this.F(s + 1, i, h));
} while (++s < this.to && (t = t.nextElementSibling));
0 !== e && (this.u(), this.F(h, e, this.R.length), this.N(this.scrollSize + e),
this.O(), this.m());
}
})), this.U = () => {
const t = this.S[this.p];
t > this.C ? (this.C = t, this.O()) : t < this.C && (this.C = t, this.j());
}, this.setOuterNode = t => {
this.j(), this.S = t, t && (this._.observe(t), t.addEventListener("scroll", this.N, {
this.G(), this.S = t, t && (this._.observe(t), t.addEventListener("scroll", this.U, {
passive: !0
}));
}, this.setZeroChildNode = t => {
this.I = t, t && this.A();
}, this.sub(this.A, [ 0, 1 ]);
this.M = t, t && this.A();
}, this.on(this.A, [ 0, 1 ]);
}
setWidgetSize(t) {
t !== this.M && (this.M = t, this.O());
t !== this.I && (this.I = t, this.O());
}
G(t) {
if (t < 0 || t > 2147483647)
L(t) {
if (0 > t || t > 2147483647)
/*

@@ -90,3 +104,3 @@ 0x7fffffff - maximum 32bit integer.

*/
throw new Error(`itemCount must be 0 - 2_147_483_647. Got: ${t}.`);
throw new Error("itemCount must be 0 - 2_147_483_647. Got: " + t + ".");
this.W = t && 1 << 31 - Math.clz32(t);

@@ -101,9 +115,9 @@ const s = this.H, i = s.length;

this.R.set(this.H, 1);
for (let s, i = 1; i <= t; i++) s = i + (i & -i), s <= t && (this.R[s] += this.R[i]);
for (let s, i = 1; t >= i; i++) s = i + (i & -i), s > t || (this.R[s] += this.R[i]);
}
this.L(this.getOffset(t));
this.N(this.getOffset(t));
}
getIndex(t) {
let s = 0;
for (let i = this.W, h = 0; 0 !== i; i >>= 1) if (h = s + i, !(h > this.itemCount)) {
for (let i = this.W, h = 0; i > 0; i >>= 1) if (h = s + i, h <= this.itemCount) {
if (t === this.R[h]) return h;

@@ -124,46 +138,31 @@ t > this.R[h] && (t -= this.R[h], s = h);

}
/* i starts from 1 here; */ P(t, s, i) {
for (;t < i; t += t & -t) this.R[t] += s;
/* i starts from 1 here; */ F(t, s, i) {
for (;i > t; t += t & -t) this.R[t] += s;
}
F() {
/*
Babel still transpiles optional chaining little ugly
*/
let t = this.I && this.I.nextElementSibling;
if (t) {
let s = this.from, i = 0, h = s + 1, e = 0;
/* We can batch-update fenwick tree, if we know updated indexes range */ for (;h < this.to; h += h & -h) ;
do {
i = t[this.g] - this.H[s], i && (this.H[s] += i, e += i, this.P(s + 1, i, h));
} while (++s < this.to && (t = t.nextElementSibling));
0 !== e && (this.l(), this.P(h, e, this.R.length), this.L(this.scrollSize + e),
this.O(), this.m());
}
G() {
this.S && (this._.unobserve(this.S), this.S.removeEventListener("scroll", this.U));
}
j() {
this.S && (this._.unobserve(this.S), this.S.removeEventListener("scroll", this.N));
}
/* will ne used as callback, so => */ O() {
const t = Math.min(this.itemCount, 1 + this.getIndex(this.C + this.M));
const t = Math.min(this.itemCount, 1 + this.getIndex(this.C + this.I));
if (t > this.to) {
this.l(), this.to = Math.min(this.itemCount, t + this.T), this.u(1);
this.u(), this.to = Math.min(this.itemCount, t + this.T), this.l(1);
const s = this.getIndex(this.C);
s !== this.from && (this.from = s, this.u(0)), this.m();
s !== this.from && (this.from = s, this.l(0)), this.m();
}
}
U() {
j() {
const t = this.getIndex(this.C);
if (t < this.from) {
this.l(), this.from = Math.max(0, t - this.T), this.u(0);
const s = Math.min(this.itemCount, 1 + this.getIndex(this.C + this.M));
s !== this.to && (this.to = s, this.u(1)), this.m();
this.u(), this.from = Math.max(0, t - this.T), this.l(0);
const s = Math.min(this.itemCount, 1 + this.getIndex(this.C + this.I));
s !== this.to && (this.to = s, this.l(1)), this.m();
}
}
$() {
this.to = this.itemCount, this.u(1);
const t = this.getIndex(Math.max(0, this.scrollSize - this.M));
t !== this.from && (this.from = t, this.u(0));
P() {
this.to = this.itemCount, this.l(1);
const t = this.getIndex(Math.max(0, this.scrollSize - this.I));
t !== this.from && (this.from = t, this.l(0));
}
k() {
this.j(), this.A.B();
this.G(), this.A.B();
}

@@ -173,13 +172,13 @@ scrollTo(t) {

}
L(t) {
this.scrollSize !== t && (this.scrollSize = t, this.u(2));
N(t) {
this.scrollSize !== t && (this.scrollSize = t, this.l(2));
}
setHorizontal(t) {
t !== this.horizontal && (this.l(), this.horizontal = t, this.p = t ? "scrollLeft" : "scrollTop",
t !== this.horizontal && (this.u(), this.horizontal = t, this.p = t ? "scrollLeft" : "scrollTop",
this.g = t ? "offsetWidth" : "offsetHeight", this.S && (
/* TODO: Needs testing */
this.C = 0, this.setWidgetSize(this.S[this.g]), this.U()), this.m());
this.C = 0, this.setWidgetSize(this.S[this.g]), this.j()), this.m());
}
setItemCount(t) {
t !== this.itemCount && (this.itemCount = t, this.l(), this.G(t), this.to > t ? this.$() : this.O(),
t !== this.itemCount && (this.itemCount = t, this.u(), this.L(t), this.to > t ? this.P() : this.O(),
this.A(), this.m());

@@ -213,10 +212,10 @@ }

*/
s.l(), s.setHorizontal(t.horizontal), s.setItemCount(t.itemCount), s.m();
s.u(), s.setHorizontal(t.horizontal), s.setItemCount(t.itemCount), s.m();
})), s;
}, S = "undefined" != typeof window ? h : i, C = (t, s, i, h, e) => S((() => (t.sub(s, i),
h && s(), () => t.unsub(s, i))), e || f), T = [ 0, 1, 2 ], z = t => t + 1 & 65535, v = /*#__PURE__*/ e((t => {
}, S = "undefined" != typeof window ? h : i, C = (t, s, i, h, e) => S((() => (t.on(s, i),
h && s(), () => t.off(s, i))), e || f), T = [ 0, 1, 2 ], z = t => t + 1 & 65535, v = /*#__PURE__*/ e((t => {
let {model: i, children: h, events: e = T} = t;
const [r, n] = o(z, 1), c = s(0), u = s(null);
return C(i, n, e), c.current !== r ? (c.current = r, u.current = h(i)) : i.h.add(n),
u.current;
const [r, n] = o(z, 1), c = s(0), l = s(null);
return C(i, n, e), c.current !== r ? (c.current = r, l.current = h(i)) : i.h.add(n),
l.current;
}));

@@ -223,0 +222,0 @@

{
"name": "@af-utils/react-virtual-headless",
"private": false,
"version": "0.0.2",
"description": "React components for rendering large scrollable data",
"repository": "https://github.com/nowaalex/af-virtual-scroll.git",
"bugs": "https://github.com/nowaalex/af-virtual-scroll/issues",
"homepage": "https://af-virtual-scroll.vercel.app/",
"author": "Alex Fomin <nowaalex@gmail.com> (https://github.com/nowaalex/)",
"license": "MIT",
"sideEffects": false,
"scripts": {
"dev": "rollup --watch --config rollup.config.js",
"build": "rollup --config rollup.config.js",
"prepare": "npm run build",
"test": "jest"
},
"engines": {
"node": ">=14.0.0",
"npm": ">=6.0.0"
},
"files": [
"lib/*"
],
"main": "lib/index.js",
"module": "lib/index.js",
"keywords": [
"react",
"reactjs",
"virtual",
"table",
"list",
"recycle",
"dom-recycle",
"dynamic-size",
"scroll",
"scrolling",
"infinite",
"virtualized",
"virtual",
"virtualization",
"sortable",
"windowing"
],
"devDependencies": {
"@babel/core": "^7.17.8",
"@babel/plugin-proposal-class-properties": "^7.16.7",
"@babel/plugin-proposal-object-rest-spread": "^7.17.3",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-export-bundle-size": "^0.0.1",
"babel-jest": "^27.5.1",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"jest": "^27.5.1",
"lodash": "^4.17.21",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2"
},
"peerDependencies": {
"@babel/runtime": "^7.16.0",
"prop-types": "^15.8.0",
"react": "^17.0.0"
},
"publishConfig": {
"access": "public"
}
"name": "@af-utils/react-virtual-headless",
"private": false,
"version": "0.0.3",
"description": "React components for rendering large scrollable data",
"repository": "https://github.com/nowaalex/af-virtual-scroll.git",
"bugs": "https://github.com/nowaalex/af-virtual-scroll/issues",
"homepage": "https://af-virtual-scroll.vercel.app/",
"author": "Alex Fomin <nowaalex@gmail.com> (https://github.com/nowaalex/)",
"license": "MIT",
"sideEffects": false,
"scripts": {
"dev": "rollup --watch --config rollup.config.js",
"build": "rollup --config rollup.config.js",
"prepare": "npm run build",
"test": "jest"
},
"engines": {
"node": ">=14.0.0",
"npm": ">=6.0.0"
},
"files": [
"lib/*"
],
"main": "lib/index.js",
"module": "lib/index.js",
"keywords": [
"react",
"reactjs",
"virtual",
"table",
"list",
"recycle",
"dom-recycle",
"dynamic-size",
"scroll",
"scrolling",
"infinite",
"virtualized",
"virtual",
"virtualization",
"sortable",
"windowing"
],
"devDependencies": {
"@babel/core": "^7.17.8",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/plugin-transform-runtime": "^7.17.0",
"@rollup/plugin-babel": "^5.3.1",
"@rollup/plugin-commonjs": "^21.0.2",
"@rollup/plugin-export-bundle-size": "^0.0.1",
"babel-jest": "^27.5.1",
"babel-plugin-module-resolver": "^4.1.0",
"babel-plugin-transform-react-remove-prop-types": "^0.4.24",
"jest": "^27.5.1",
"lodash": "^4.17.21",
"rollup": "^2.70.1",
"rollup-plugin-terser": "^7.0.2"
},
"peerDependencies": {
"prop-types": "^15.8.0",
"react": "^17.0.0"
},
"publishConfig": {
"access": "public"
}
}

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