react-virtual-renderer 1.1.2 → 1.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/App.d.ts.map +1 -1
- package/dist/App.js +65 -3
- package/dist/App.js.map +1 -1
- package/dist/components/VirtualGrid.d.ts +30 -0
- package/dist/components/VirtualGrid.d.ts.map +1 -1
- package/dist/components/VirtualGrid.js +147 -117
- package/dist/components/VirtualGrid.js.map +1 -1
- package/dist/components/VirtualList.d.ts +0 -4
- package/dist/components/VirtualList.d.ts.map +1 -1
- package/dist/components/VirtualList.js +66 -47
- package/dist/components/VirtualList.js.map +1 -1
- package/dist/components/VirtualLiveRegion.d.ts +12 -0
- package/dist/components/VirtualLiveRegion.d.ts.map +1 -0
- package/dist/components/VirtualLiveRegion.js +27 -0
- package/dist/components/VirtualLiveRegion.js.map +1 -0
- package/dist/core/FenwickTree.d.ts +47 -0
- package/dist/core/FenwickTree.d.ts.map +1 -0
- package/dist/core/FenwickTree.js +206 -0
- package/dist/core/FenwickTree.js.map +1 -0
- package/dist/core/GridLayoutEngine.d.ts +64 -0
- package/dist/core/GridLayoutEngine.d.ts.map +1 -0
- package/dist/core/GridLayoutEngine.js +153 -0
- package/dist/core/GridLayoutEngine.js.map +1 -0
- package/dist/core/GroupedListEngine.d.ts +21 -0
- package/dist/core/GroupedListEngine.d.ts.map +1 -0
- package/dist/core/GroupedListEngine.js +22 -0
- package/dist/core/GroupedListEngine.js.map +1 -0
- package/dist/core/ListController.d.ts +31 -0
- package/dist/core/ListController.d.ts.map +1 -0
- package/dist/core/ListController.js +71 -0
- package/dist/core/ListController.js.map +1 -0
- package/dist/core/MeasurementSystem.d.ts +54 -6
- package/dist/core/MeasurementSystem.d.ts.map +1 -1
- package/dist/core/MeasurementSystem.js +113 -9
- package/dist/core/MeasurementSystem.js.map +1 -1
- package/dist/core/VirtualizationEngine.d.ts +28 -5
- package/dist/core/VirtualizationEngine.d.ts.map +1 -1
- package/dist/core/VirtualizationEngine.js +58 -52
- package/dist/core/VirtualizationEngine.js.map +1 -1
- package/dist/examples/DynamicHeightLists.d.ts +2 -0
- package/dist/examples/DynamicHeightLists.d.ts.map +1 -0
- package/dist/examples/DynamicHeightLists.js +42 -0
- package/dist/examples/DynamicHeightLists.js.map +1 -0
- package/dist/examples/FixedGrid.d.ts +2 -0
- package/dist/examples/FixedGrid.d.ts.map +1 -0
- package/dist/examples/FixedGrid.js +40 -0
- package/dist/examples/FixedGrid.js.map +1 -0
- package/dist/examples/GroupedContactList.d.ts +2 -0
- package/dist/examples/GroupedContactList.d.ts.map +1 -0
- package/dist/examples/GroupedContactList.js +20 -0
- package/dist/examples/GroupedContactList.js.map +1 -0
- package/dist/examples/InfiniteScrollLists.d.ts +2 -0
- package/dist/examples/InfiniteScrollLists.d.ts.map +1 -0
- package/dist/examples/InfiniteScrollLists.js +93 -0
- package/dist/examples/InfiniteScrollLists.js.map +1 -0
- package/dist/examples/MasonaryGrid.d.ts +2 -0
- package/dist/examples/MasonaryGrid.d.ts.map +1 -0
- package/dist/examples/MasonaryGrid.js +36 -0
- package/dist/examples/MasonaryGrid.js.map +1 -0
- package/dist/examples/PerfHarness.d.ts +2 -0
- package/dist/examples/PerfHarness.d.ts.map +1 -0
- package/dist/examples/PerfHarness.js +131 -0
- package/dist/examples/PerfHarness.js.map +1 -0
- package/dist/hooks/useBidirectionalInfiniteScroll.d.ts +32 -0
- package/dist/hooks/useBidirectionalInfiniteScroll.d.ts.map +1 -0
- package/dist/hooks/useBidirectionalInfiniteScroll.js +89 -0
- package/dist/hooks/useBidirectionalInfiniteScroll.js.map +1 -0
- package/dist/hooks/useInfiniteScroll.d.ts +37 -14
- package/dist/hooks/useInfiniteScroll.d.ts.map +1 -1
- package/dist/hooks/useInfiniteScroll.js +48 -38
- package/dist/hooks/useInfiniteScroll.js.map +1 -1
- package/dist/hooks/useRevoingTabIndex.d.ts +11 -0
- package/dist/hooks/useRevoingTabIndex.d.ts.map +1 -0
- package/dist/hooks/useRevoingTabIndex.js +28 -0
- package/dist/hooks/useRevoingTabIndex.js.map +1 -0
- package/dist/hooks/useVirtualAllyProps.d.ts +23 -0
- package/dist/hooks/useVirtualAllyProps.d.ts.map +1 -0
- package/dist/hooks/useVirtualAllyProps.js +25 -0
- package/dist/hooks/useVirtualAllyProps.js.map +1 -0
- package/dist/hooks/useVirtualList.d.ts +82 -4
- package/dist/hooks/useVirtualList.d.ts.map +1 -1
- package/dist/hooks/useVirtualList.js +220 -92
- package/dist/hooks/useVirtualList.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/App.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.d.ts","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":"AA2CA,iBAAS,GAAG,4CAoDX;AAED,eAAe,GAAG,CAAC"}
|
package/dist/App.js
CHANGED
|
@@ -1,7 +1,69 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
// Components
|
|
4
|
+
import DynamicHeightLists from "./examples/DynamicHeightLists";
|
|
5
|
+
import MasonryGrid from "./examples/MasonaryGrid";
|
|
6
|
+
import InfiniteScroll from "./examples/InfiniteScrollLists";
|
|
7
|
+
import FixedGrid from "./examples/FixedGrid";
|
|
8
|
+
import PerformanceHarness from "./examples/PerfHarness";
|
|
9
|
+
import GroupedContactListExample from "./examples/GroupedContactList";
|
|
10
|
+
const tabs = [
|
|
11
|
+
{
|
|
12
|
+
id: "dynamic-height",
|
|
13
|
+
label: "Dynamic Height",
|
|
14
|
+
component: _jsx(DynamicHeightLists, {}),
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: "masonry-grid",
|
|
18
|
+
label: "Masonry Grid",
|
|
19
|
+
component: _jsx(MasonryGrid, {}),
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
id: "infinite-scroll",
|
|
23
|
+
label: "Infinite Scroll",
|
|
24
|
+
component: _jsx(InfiniteScroll, {}),
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: "fixed-grid",
|
|
28
|
+
label: "Fixed Grid",
|
|
29
|
+
component: _jsx(FixedGrid, {}),
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: "performance-harness",
|
|
33
|
+
label: "Performance Harness",
|
|
34
|
+
component: _jsx(PerformanceHarness, {}),
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: "grouped",
|
|
38
|
+
label: "Grouped Contact List",
|
|
39
|
+
component: _jsx(GroupedContactListExample, {}),
|
|
40
|
+
}
|
|
41
|
+
];
|
|
3
42
|
function App() {
|
|
4
|
-
|
|
43
|
+
const [activeTab, setActiveTab] = useState(tabs[0].id);
|
|
44
|
+
const activeComponent = tabs.find(tab => tab.id === activeTab)?.component;
|
|
45
|
+
return (_jsxs("div", { style: {
|
|
46
|
+
maxWidth: "1400px",
|
|
47
|
+
margin: "0 auto",
|
|
48
|
+
padding: "24px",
|
|
49
|
+
fontFamily: "sans-serif",
|
|
50
|
+
}, children: [_jsx("h1", { children: "React Virtual Renderer Demos" }), _jsx("div", { style: {
|
|
51
|
+
display: "flex",
|
|
52
|
+
gap: "8px",
|
|
53
|
+
borderBottom: "1px solid #ddd",
|
|
54
|
+
marginBottom: "24px",
|
|
55
|
+
flexWrap: "wrap",
|
|
56
|
+
}, children: tabs.map(tab => (_jsx("button", { onClick: () => setActiveTab(tab.id), style: {
|
|
57
|
+
padding: "12px 18px",
|
|
58
|
+
cursor: "pointer",
|
|
59
|
+
border: "none",
|
|
60
|
+
borderBottom: activeTab === tab.id
|
|
61
|
+
? "3px solid #2563eb"
|
|
62
|
+
: "3px solid transparent",
|
|
63
|
+
background: "transparent",
|
|
64
|
+
fontWeight: activeTab === tab.id ? 600 : 400,
|
|
65
|
+
fontSize: "15px",
|
|
66
|
+
}, children: tab.label }, tab.id))) }), _jsx("div", { children: activeComponent })] }));
|
|
5
67
|
}
|
|
6
68
|
export default App;
|
|
7
69
|
//# sourceMappingURL=App.js.map
|
package/dist/App.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"App.js","sourceRoot":"","sources":["../src/App.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEjC,aAAa;AACb,OAAO,kBAAkB,MAAM,+BAA+B,CAAC;AAC/D,OAAO,WAAW,MAAM,yBAAyB,CAAC;AAClD,OAAO,cAAc,MAAM,gCAAgC,CAAC;AAC5D,OAAO,SAAS,MAAM,sBAAsB,CAAC;AAC7C,OAAO,kBAAkB,MAAM,wBAAwB,CAAC;AACxD,OAAO,yBAAyB,MAAM,+BAA+B,CAAC;AAEtE,MAAM,IAAI,GAAG;IACT;QACI,EAAE,EAAE,gBAAgB;QACpB,KAAK,EAAE,gBAAgB;QACvB,SAAS,EAAE,KAAC,kBAAkB,KAAG;KACpC;IACD;QACI,EAAE,EAAE,cAAc;QAClB,KAAK,EAAE,cAAc;QACrB,SAAS,EAAE,KAAC,WAAW,KAAG;KAC7B;IACD;QACI,EAAE,EAAE,iBAAiB;QACrB,KAAK,EAAE,iBAAiB;QACxB,SAAS,EAAE,KAAC,cAAc,KAAG;KAChC;IACD;QACI,EAAE,EAAE,YAAY;QAChB,KAAK,EAAE,Y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AC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG;wBAC5C,QAAQ,EAAE,MAAM;qBACnB,YAEA,GAAG,CAAC,KAAK,IAfL,GAAG,CAAC,EAAE,CAgBN,CACZ,CAAC,GACA,EAGN,wBAAM,eAAe,GAAO,IAC1B,CACT,CAAC;AACN,CAAC;AAED,eAAe,GAAG,CAAC"}
|
|
@@ -1,4 +1,34 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { VirtualGridProps } from "../types";
|
|
3
|
+
/**
|
|
4
|
+
* PERFORMANCE (read this before touching the position math below):
|
|
5
|
+
*
|
|
6
|
+
* There are two genuinely different cost profiles here, and this file
|
|
7
|
+
* intentionally keeps them on separate code paths instead of forcing
|
|
8
|
+
* everything through one "general" algorithm:
|
|
9
|
+
*
|
|
10
|
+
* 1. FAST PATH - layout="grid" with a numeric rowHeight (by far the
|
|
11
|
+
* most common real-world case: photo grids, product grids, etc).
|
|
12
|
+
* Every item's position is pure arithmetic from its index - no
|
|
13
|
+
* array is ever allocated, and the visible range is computed with
|
|
14
|
+
* O(1) division, not a scan. This is the single biggest win here:
|
|
15
|
+
* the previous version paid O(n) to build a positions array for
|
|
16
|
+
* this case even though it never needed one.
|
|
17
|
+
*
|
|
18
|
+
* 2. GENERAL PATH - masonry, or layout="grid" with a per-index
|
|
19
|
+
* rowHeight function. These genuinely need to remember prior
|
|
20
|
+
* layout state (column heights / row offsets), so they go through
|
|
21
|
+
* GridLayoutEngine, which appends incrementally (O(k) for k new
|
|
22
|
+
* items, not O(n)) rather than recomputing from scratch. Finding
|
|
23
|
+
* the visible range over that array is done with binary search
|
|
24
|
+
* (O(log n)) instead of the previous linear scan (O(n)).
|
|
25
|
+
*
|
|
26
|
+
* Caveat worth stating plainly: masonry's y-position isn't
|
|
27
|
+
* perfectly monotonic in index order (an item can land in a
|
|
28
|
+
* shorter column than the item before it), so binary search over
|
|
29
|
+
* it is an approximation, same trade-off every masonry-virtualizer
|
|
30
|
+
* makes. Overscan is widened by a column's worth of rows in
|
|
31
|
+
* masonry mode specifically to absorb that.
|
|
32
|
+
*/
|
|
3
33
|
export declare const VirtualGrid: React.ForwardRefExoticComponent<VirtualGridProps<any> & React.RefAttributes<HTMLDivElement>>;
|
|
4
34
|
//# sourceMappingURL=VirtualGrid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualGrid.d.ts","sourceRoot":"","sources":["../../src/components/VirtualGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAiC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualGrid.d.ts","sourceRoot":"","sources":["../../src/components/VirtualGrid.tsx"],"names":[],"mappings":"AAAA,OAAO,KAQN,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,gBAAgB,EAAiC,MAAM,UAAU,CAAC;AAG3E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,eAAO,MAAM,WAAW,8FAmTvB,CAAC"}
|
|
@@ -1,162 +1,194 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, useMemo, useState, useRef, useEffect, useImperativeHandle, useCallback, } from "react";
|
|
3
|
-
|
|
3
|
+
import { GridLayoutEngine } from "../core/GridLayoutEngine";
|
|
4
|
+
/**
|
|
5
|
+
* PERFORMANCE (read this before touching the position math below):
|
|
6
|
+
*
|
|
7
|
+
* There are two genuinely different cost profiles here, and this file
|
|
8
|
+
* intentionally keeps them on separate code paths instead of forcing
|
|
9
|
+
* everything through one "general" algorithm:
|
|
10
|
+
*
|
|
11
|
+
* 1. FAST PATH - layout="grid" with a numeric rowHeight (by far the
|
|
12
|
+
* most common real-world case: photo grids, product grids, etc).
|
|
13
|
+
* Every item's position is pure arithmetic from its index - no
|
|
14
|
+
* array is ever allocated, and the visible range is computed with
|
|
15
|
+
* O(1) division, not a scan. This is the single biggest win here:
|
|
16
|
+
* the previous version paid O(n) to build a positions array for
|
|
17
|
+
* this case even though it never needed one.
|
|
18
|
+
*
|
|
19
|
+
* 2. GENERAL PATH - masonry, or layout="grid" with a per-index
|
|
20
|
+
* rowHeight function. These genuinely need to remember prior
|
|
21
|
+
* layout state (column heights / row offsets), so they go through
|
|
22
|
+
* GridLayoutEngine, which appends incrementally (O(k) for k new
|
|
23
|
+
* items, not O(n)) rather than recomputing from scratch. Finding
|
|
24
|
+
* the visible range over that array is done with binary search
|
|
25
|
+
* (O(log n)) instead of the previous linear scan (O(n)).
|
|
26
|
+
*
|
|
27
|
+
* Caveat worth stating plainly: masonry's y-position isn't
|
|
28
|
+
* perfectly monotonic in index order (an item can land in a
|
|
29
|
+
* shorter column than the item before it), so binary search over
|
|
30
|
+
* it is an approximation, same trade-off every masonry-virtualizer
|
|
31
|
+
* makes. Overscan is widened by a column's worth of rows in
|
|
32
|
+
* masonry mode specifically to absorb that.
|
|
33
|
+
*/
|
|
34
|
+
export const VirtualGrid = forwardRef(({ items, renderItem, itemKey, height = 600, width = "100%", columnCount = 3, rowHeight = 200, columnWidth, layout = "grid", overscan = 5, gap = 16, onScroll, onVisibleRangeChange, innerClassName, innerStyle, containerClassName, containerStyle, itemClassName, itemStyle, }, ref) => {
|
|
4
35
|
const containerRef = useRef(null);
|
|
5
36
|
useImperativeHandle(ref, () => containerRef.current);
|
|
6
37
|
const [scrollTop, setScrollTop] = useState(0);
|
|
7
38
|
const [isScrolling, setIsScrolling] = useState(false);
|
|
8
39
|
const [containerWidth, setContainerWidth] = useState(0);
|
|
9
40
|
const scrollTimeout = useRef(null);
|
|
10
|
-
// ✅ FIX 1: Proper ResizeObserver with validation
|
|
11
41
|
useEffect(() => {
|
|
12
42
|
if (!containerRef.current)
|
|
13
43
|
return;
|
|
14
44
|
const el = containerRef.current;
|
|
15
45
|
const observer = new ResizeObserver((entries) => {
|
|
16
46
|
for (const entry of entries) {
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
setContainerWidth(
|
|
20
|
-
}
|
|
47
|
+
const w = entry.contentRect.width;
|
|
48
|
+
if (w > 0)
|
|
49
|
+
setContainerWidth(w);
|
|
21
50
|
}
|
|
22
51
|
});
|
|
23
52
|
observer.observe(el);
|
|
24
53
|
return () => observer.disconnect();
|
|
25
54
|
}, []);
|
|
26
|
-
// ✅ FIX 2: Cleanup timeout on unmount
|
|
27
55
|
useEffect(() => {
|
|
28
56
|
return () => {
|
|
29
|
-
if (scrollTimeout.current)
|
|
57
|
+
if (scrollTimeout.current)
|
|
30
58
|
clearTimeout(scrollTimeout.current);
|
|
31
|
-
}
|
|
32
59
|
};
|
|
33
60
|
}, []);
|
|
34
|
-
// ✅ FIX 3: Better ready check
|
|
35
61
|
const isReady = containerWidth > 0 && items.length > 0;
|
|
36
|
-
// ✅ FIX 4: Proper column calculation with gap
|
|
37
62
|
const cols = useMemo(() => {
|
|
38
63
|
if (columnCount === "auto") {
|
|
39
64
|
const minColWidth = 200;
|
|
40
|
-
|
|
41
|
-
return calculatedCols;
|
|
65
|
+
return Math.max(1, Math.floor(containerWidth / (minColWidth + gap)));
|
|
42
66
|
}
|
|
43
67
|
return Math.max(1, Number(columnCount));
|
|
44
68
|
}, [columnCount, containerWidth, gap]);
|
|
45
69
|
const colWidth = useMemo(() => {
|
|
46
|
-
if (typeof columnWidth === "number")
|
|
70
|
+
if (typeof columnWidth === "number")
|
|
47
71
|
return columnWidth;
|
|
48
|
-
}
|
|
49
72
|
const totalGapWidth = gap * Math.max(0, cols - 1);
|
|
50
|
-
return Math.max(0, (containerWidth - totalGapWidth) /
|
|
51
|
-
|
|
73
|
+
return Math.max(0, (containerWidth - totalGapWidth) / cols);
|
|
74
|
+
}, [containerWidth, cols, gap, columnWidth]);
|
|
75
|
+
const isFastPath = layout === "grid" && typeof rowHeight === "number";
|
|
76
|
+
const heightNumForRange = typeof height === "string" ? parseInt(height) : Number(height);
|
|
77
|
+
// ---------- FAST PATH: pure O(1) math, no array ----------
|
|
78
|
+
const fastRowStep = rowHeight + gap;
|
|
79
|
+
const fastTotalHeight = useMemo(() => {
|
|
80
|
+
if (!isFastPath || !isReady)
|
|
81
|
+
return 0;
|
|
82
|
+
const numRows = Math.ceil(items.length / cols);
|
|
83
|
+
return numRows > 0 ? numRows * fastRowStep - gap : 0;
|
|
84
|
+
}, [isFastPath, isReady, items.length, cols, fastRowStep, gap]);
|
|
85
|
+
const fastVisibleRange = useMemo(() => {
|
|
86
|
+
if (!isFastPath || !isReady)
|
|
87
|
+
return { start: 0, end: -1 };
|
|
88
|
+
const startRow = Math.max(0, Math.floor(scrollTop / fastRowStep));
|
|
89
|
+
const endRow = Math.max(0, Math.floor((scrollTop + heightNumForRange) / fastRowStep));
|
|
90
|
+
const overscanRows = Math.ceil(overscan / cols);
|
|
91
|
+
const start = Math.max(0, (startRow - overscanRows) * cols);
|
|
92
|
+
const end = Math.min(items.length - 1, (endRow + overscanRows + 1) * cols - 1);
|
|
93
|
+
return { start, end };
|
|
52
94
|
}, [
|
|
53
|
-
|
|
95
|
+
isFastPath,
|
|
96
|
+
isReady,
|
|
97
|
+
scrollTop,
|
|
98
|
+
heightNumForRange,
|
|
99
|
+
fastRowStep,
|
|
100
|
+
overscan,
|
|
54
101
|
cols,
|
|
55
|
-
|
|
56
|
-
columnWidth,
|
|
102
|
+
items.length,
|
|
57
103
|
]);
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
104
|
+
const fastPositionOf = useCallback((index) => {
|
|
105
|
+
const row = Math.floor(index / cols);
|
|
106
|
+
const col = index % cols;
|
|
107
|
+
return {
|
|
108
|
+
x: col * (colWidth + gap),
|
|
109
|
+
y: row * fastRowStep,
|
|
110
|
+
width: colWidth,
|
|
111
|
+
height: rowHeight,
|
|
112
|
+
};
|
|
113
|
+
}, [cols, colWidth, gap, fastRowStep, rowHeight]);
|
|
114
|
+
// ---------- GENERAL PATH: incremental engine + binary search ----------
|
|
115
|
+
const gridEngineRef = useRef(null);
|
|
116
|
+
if (gridEngineRef.current === null) {
|
|
117
|
+
gridEngineRef.current = new GridLayoutEngine();
|
|
118
|
+
}
|
|
119
|
+
const generalPositions = useMemo(() => {
|
|
120
|
+
if (isFastPath || !isReady)
|
|
61
121
|
return [];
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
122
|
+
return gridEngineRef.current.sync(items.length, {
|
|
123
|
+
cols,
|
|
124
|
+
colWidth,
|
|
125
|
+
gap,
|
|
126
|
+
layout,
|
|
127
|
+
rowHeight,
|
|
128
|
+
});
|
|
129
|
+
}, [isFastPath, isReady, items.length, cols, colWidth, gap, layout, rowHeight]);
|
|
130
|
+
const generalTotalHeight = useMemo(() => {
|
|
131
|
+
if (isFastPath || !isReady)
|
|
132
|
+
return 0;
|
|
133
|
+
return gridEngineRef.current.getTotalHeight();
|
|
134
|
+
}, [isFastPath, isReady, generalPositions]);
|
|
135
|
+
const generalVisibleRange = useMemo(() => {
|
|
136
|
+
if (isFastPath || !generalPositions.length)
|
|
137
|
+
return { start: 0, end: -1 };
|
|
138
|
+
const scrollBottom = scrollTop + heightNumForRange;
|
|
139
|
+
const n = generalPositions.length;
|
|
140
|
+
// widen overscan for masonry to absorb its non-strict y-monotonicity
|
|
141
|
+
const effectiveOverscan = layout === "masonry" ? overscan + cols : overscan;
|
|
142
|
+
let lo = 0, hi = n - 1, startIdx = 0;
|
|
143
|
+
while (lo <= hi) {
|
|
144
|
+
const mid = (lo + hi) >> 1;
|
|
145
|
+
if (generalPositions[mid].y + generalPositions[mid].height >= scrollTop) {
|
|
146
|
+
startIdx = mid;
|
|
147
|
+
hi = mid - 1;
|
|
82
148
|
}
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
// Grid: Standard rows and columns
|
|
86
|
-
for (let i = 0; i < items.length; i++) {
|
|
87
|
-
const row = Math.floor(i / cols);
|
|
88
|
-
const col = i % cols;
|
|
89
|
-
const itemHeight = typeof rowHeight === "function"
|
|
90
|
-
? rowHeight(i)
|
|
91
|
-
: Number(rowHeight);
|
|
92
|
-
pos.push({
|
|
93
|
-
x: col * (colWidth + gap),
|
|
94
|
-
y: row * (itemHeight + gap),
|
|
95
|
-
width: colWidth,
|
|
96
|
-
height: itemHeight,
|
|
97
|
-
});
|
|
149
|
+
else {
|
|
150
|
+
lo = mid + 1;
|
|
98
151
|
}
|
|
99
152
|
}
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
let startIndex = 0;
|
|
109
|
-
for (let i = 0; i < positions.length; i++) {
|
|
110
|
-
if (positions[i].y + positions[i].height >= scrollTop) {
|
|
111
|
-
startIndex = i;
|
|
112
|
-
break;
|
|
153
|
+
lo = 0;
|
|
154
|
+
hi = n - 1;
|
|
155
|
+
let endIdx = n - 1;
|
|
156
|
+
while (lo <= hi) {
|
|
157
|
+
const mid = (lo + hi) >> 1;
|
|
158
|
+
if (generalPositions[mid].y <= scrollBottom) {
|
|
159
|
+
endIdx = mid;
|
|
160
|
+
lo = mid + 1;
|
|
113
161
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
for (let i = positions.length - 1; i >= 0; i--) {
|
|
117
|
-
if (positions[i].y <= scrollTop + heightNum) {
|
|
118
|
-
endIndex = i;
|
|
119
|
-
break;
|
|
162
|
+
else {
|
|
163
|
+
hi = mid - 1;
|
|
120
164
|
}
|
|
121
165
|
}
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const maxHeight = Math.max(...positions.map((p) => p.y + p.height));
|
|
131
|
-
return maxHeight || 0;
|
|
132
|
-
}, [positions]);
|
|
133
|
-
// ✅ FIX 9: Better scroll handler
|
|
166
|
+
return {
|
|
167
|
+
start: Math.max(0, startIdx - effectiveOverscan),
|
|
168
|
+
end: Math.min(n - 1, endIdx + effectiveOverscan),
|
|
169
|
+
};
|
|
170
|
+
}, [isFastPath, generalPositions, scrollTop, heightNumForRange, overscan, layout, cols]);
|
|
171
|
+
// ---------- unify the two paths ----------
|
|
172
|
+
const totalHeight = isFastPath ? fastTotalHeight : generalTotalHeight;
|
|
173
|
+
const visibleRange = isFastPath ? fastVisibleRange : generalVisibleRange;
|
|
134
174
|
const handleScroll = useCallback((e) => {
|
|
135
175
|
const target = e.currentTarget;
|
|
136
|
-
|
|
137
|
-
const left = target.scrollLeft;
|
|
138
|
-
setScrollTop(top);
|
|
176
|
+
setScrollTop(target.scrollTop);
|
|
139
177
|
setIsScrolling(true);
|
|
140
|
-
onScroll?.(
|
|
141
|
-
|
|
142
|
-
if (scrollTimeout.current) {
|
|
178
|
+
onScroll?.(target.scrollTop, target.scrollLeft);
|
|
179
|
+
if (scrollTimeout.current)
|
|
143
180
|
clearTimeout(scrollTimeout.current);
|
|
144
|
-
|
|
145
|
-
// Set new timeout
|
|
146
|
-
scrollTimeout.current = setTimeout(() => {
|
|
147
|
-
setIsScrolling(false);
|
|
148
|
-
}, 120);
|
|
181
|
+
scrollTimeout.current = setTimeout(() => setIsScrolling(false), 120);
|
|
149
182
|
}, [onScroll]);
|
|
150
|
-
// ✅ FIX 10: Notify visible range change
|
|
151
183
|
useEffect(() => {
|
|
152
184
|
onVisibleRangeChange?.(visibleRange.start, visibleRange.end);
|
|
153
185
|
}, [visibleRange, onVisibleRangeChange]);
|
|
154
|
-
|
|
155
|
-
const
|
|
156
|
-
const
|
|
186
|
+
const heightCss = typeof height === "string" ? height : `${height}px`;
|
|
187
|
+
const widthCss = typeof width === "string" ? width : `${width}px`;
|
|
188
|
+
const cx = (...parts) => parts.filter(Boolean).join(" ").trim();
|
|
157
189
|
const containerStyleComputed = {
|
|
158
|
-
height:
|
|
159
|
-
width:
|
|
190
|
+
height: heightCss,
|
|
191
|
+
width: widthCss,
|
|
160
192
|
overflowY: "auto",
|
|
161
193
|
overflowX: "hidden",
|
|
162
194
|
position: "relative",
|
|
@@ -168,26 +200,24 @@ export const VirtualGrid = forwardRef(({ items, renderItem, itemKey, height = 60
|
|
|
168
200
|
width: "100%",
|
|
169
201
|
...innerStyle,
|
|
170
202
|
};
|
|
171
|
-
// ✅ FIX 12: Complete render logic
|
|
172
203
|
if (!isReady) {
|
|
173
|
-
return (_jsx("div", { ref: containerRef, className: containerClassName, style: containerStyleComputed, onScroll: handleScroll, children: _jsx("div", { className: innerClassName, style: innerStyleComputed }) }));
|
|
204
|
+
return (_jsx("div", { ref: containerRef, className: cx("virtualize-grid-container", containerClassName), style: containerStyleComputed, onScroll: handleScroll, children: _jsx("div", { className: cx("virtualize-grid-inner", innerClassName), style: innerStyleComputed }) }));
|
|
174
205
|
}
|
|
175
|
-
// ✅ FIX 13: Render visible items properly
|
|
176
206
|
const visibleItems = [];
|
|
177
207
|
for (let i = visibleRange.start; i <= visibleRange.end; i++) {
|
|
178
208
|
if (i >= 0 && i < items.length) {
|
|
179
|
-
visibleItems.push({
|
|
180
|
-
index: i,
|
|
181
|
-
key: itemKey?.(i, items[i]) ?? i,
|
|
182
|
-
});
|
|
209
|
+
visibleItems.push({ index: i, key: itemKey?.(i, items[i]) ?? i });
|
|
183
210
|
}
|
|
184
211
|
}
|
|
185
|
-
return (_jsx("div", { ref: containerRef, className: containerClassName, style: containerStyleComputed, onScroll: handleScroll, children: _jsx("div", { className: innerClassName, style: innerStyleComputed, children: visibleItems.map((vItem) => {
|
|
212
|
+
return (_jsx("div", { ref: containerRef, className: cx("virtualize-grid-container", containerClassName), style: containerStyleComputed, onScroll: handleScroll, children: _jsx("div", { className: cx("virtualize-grid-inner", innerClassName), style: innerStyleComputed, children: visibleItems.map((vItem) => {
|
|
186
213
|
const item = items[vItem.index];
|
|
187
|
-
const pos =
|
|
214
|
+
const pos = isFastPath
|
|
215
|
+
? fastPositionOf(vItem.index)
|
|
216
|
+
: generalPositions[vItem.index];
|
|
188
217
|
if (!item || !pos)
|
|
189
218
|
return null;
|
|
190
|
-
const
|
|
219
|
+
const computedItemStyle = {
|
|
220
|
+
...itemStyle,
|
|
191
221
|
position: "absolute",
|
|
192
222
|
top: `${pos.y}px`,
|
|
193
223
|
left: `${pos.x}px`,
|
|
@@ -195,7 +225,7 @@ export const VirtualGrid = forwardRef(({ items, renderItem, itemKey, height = 60
|
|
|
195
225
|
height: `${pos.height}px`,
|
|
196
226
|
boxSizing: "border-box",
|
|
197
227
|
};
|
|
198
|
-
return (_jsx("div", { style:
|
|
228
|
+
return (_jsx("div", { "data-virtualize-index": vItem.index, className: cx("virtualize-grid-item", itemClassName), style: computedItemStyle, children: renderItem({
|
|
199
229
|
item,
|
|
200
230
|
index: vItem.index,
|
|
201
231
|
isScrolling,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualGrid.js","sourceRoot":"","sources":["../../src/components/VirtualGrid.tsx"],"names":[],"mappings":";AAAA,OAAc,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,mBAAmB,EACnB,WAAW,GACd,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"VirtualGrid.js","sourceRoot":"","sources":["../../src/components/VirtualGrid.tsx"],"names":[],"mappings":";AAAA,OAAc,EACV,UAAU,EACV,OAAO,EACP,QAAQ,EACR,MAAM,EACN,SAAS,EACT,mBAAmB,EACnB,WAAW,GACd,MAAM,OAAO,CAAC;AAGf,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,UAAU,CACjC,CACI,EACI,KAAK,EACL,U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,KAAK,CAAC,KAAK,CAAC;oBAC7B,CAAC,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAEpC,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG;oBAAE,OAAO,IAAI,CAAC;gBAE/B,MAAM,iBAAiB,GAAwB;oBAC3C,GAAG,SAAS;oBACZ,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI;oBACjB,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,IAAI;oBAClB,KAAK,EAAE,GAAG,GAAG,CAAC,KAAK,IAAI;oBACvB,MAAM,EAAE,GAAG,GAAG,CAAC,MAAM,IAAI;oBACzB,SAAS,EAAE,YAAY;iBAC1B,CAAC;gBAEF,OAAO,CACH,uCAE2B,KAAK,CAAC,KAAK,EAClC,SAAS,EAAE,EAAE,CAAC,sBAAsB,EAAE,aAAa,CAAC,EACpD,KAAK,EAAE,iBAAiB,YAEvB,UAAU,CAAC;wBACR,IAAI;wBACJ,KAAK,EAAE,KAAK,CAAC,KAAK;wBAClB,WAAW;qBACd,CAAC,IATG,KAAK,CAAC,GAAG,CAUZ,CACT,CAAC;YACN,CAAC,CAAC,GACA,GACJ,CACT,CAAC;AACN,CAAC,CACJ,CAAC;AAEF,WAAW,CAAC,WAAW,GAAG,aAAa,CAAC"}
|
|
@@ -1,8 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { VirtualListProps } from '../types';
|
|
3
|
-
/**
|
|
4
|
-
* VirtualList Component
|
|
5
|
-
* Drop-in replacement for long lists with virtualization support
|
|
6
|
-
*/
|
|
7
3
|
export declare const VirtualList: React.ForwardRefExoticComponent<VirtualListProps<any> & React.RefAttributes<HTMLDivElement>>;
|
|
8
4
|
//# sourceMappingURL=VirtualList.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../src/components/VirtualList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,EACH,gBAAgB,EAEnB,MAAM,UAAU,CAAC;AAElB
|
|
1
|
+
{"version":3,"file":"VirtualList.d.ts","sourceRoot":"","sources":["../../src/components/VirtualList.tsx"],"names":[],"mappings":"AAAA,OAAO,KAKN,MAAM,OAAO,CAAC;AAGf,OAAO,EACH,gBAAgB,EAEnB,MAAM,UAAU,CAAC;AAElB,eAAO,MAAM,WAAW,8FA4RvB,CAAC"}
|