lazy-render-virtual-scroll 2.0.0 โ†’ 2.1.0

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.
Files changed (87) hide show
  1. package/README.md +511 -75
  2. package/dist/cjs/adapters/react/adapters/react/components/withLazyRender.d.ts +22 -0
  3. package/dist/cjs/adapters/react/adapters/react/components/withLazyRender.d.ts.map +1 -0
  4. package/dist/cjs/adapters/react/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  5. package/dist/cjs/adapters/react/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  6. package/dist/cjs/adapters/react/components/withLazyRender.d.ts +22 -0
  7. package/dist/cjs/adapters/react/components/withLazyRender.d.ts.map +1 -0
  8. package/dist/cjs/adapters/react/core/GlobalScrollManager.d.ts +61 -0
  9. package/dist/cjs/adapters/react/core/GlobalScrollManager.d.ts.map +1 -0
  10. package/dist/cjs/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  11. package/dist/cjs/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  12. package/dist/cjs/adapters/react/index.d.ts +5 -0
  13. package/dist/cjs/adapters/react/index.d.ts.map +1 -1
  14. package/dist/cjs/angular/adapters/react/components/withLazyRender.d.ts +22 -0
  15. package/dist/cjs/angular/adapters/react/components/withLazyRender.d.ts.map +1 -0
  16. package/dist/cjs/angular/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  17. package/dist/cjs/angular/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  18. package/dist/cjs/angular/core/GlobalScrollManager.d.ts +61 -0
  19. package/dist/cjs/angular/core/GlobalScrollManager.d.ts.map +1 -0
  20. package/dist/cjs/angular/index.d.ts +5 -0
  21. package/dist/cjs/angular/index.d.ts.map +1 -1
  22. package/dist/cjs/core/GlobalScrollManager.d.ts +61 -0
  23. package/dist/cjs/core/GlobalScrollManager.d.ts.map +1 -0
  24. package/dist/cjs/index.d.ts +5 -0
  25. package/dist/cjs/index.d.ts.map +1 -1
  26. package/dist/cjs/index.js +269 -0
  27. package/dist/cjs/index.js.map +1 -1
  28. package/dist/cjs/svelte/adapters/react/components/withLazyRender.d.ts +22 -0
  29. package/dist/cjs/svelte/adapters/react/components/withLazyRender.d.ts.map +1 -0
  30. package/dist/cjs/svelte/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  31. package/dist/cjs/svelte/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  32. package/dist/cjs/svelte/core/GlobalScrollManager.d.ts +61 -0
  33. package/dist/cjs/svelte/core/GlobalScrollManager.d.ts.map +1 -0
  34. package/dist/cjs/svelte/index.d.ts +5 -0
  35. package/dist/cjs/svelte/index.d.ts.map +1 -1
  36. package/dist/cjs/vue/adapters/react/components/withLazyRender.d.ts +22 -0
  37. package/dist/cjs/vue/adapters/react/components/withLazyRender.d.ts.map +1 -0
  38. package/dist/cjs/vue/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  39. package/dist/cjs/vue/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  40. package/dist/cjs/vue/core/GlobalScrollManager.d.ts +61 -0
  41. package/dist/cjs/vue/core/GlobalScrollManager.d.ts.map +1 -0
  42. package/dist/cjs/vue/index.d.ts +5 -0
  43. package/dist/cjs/vue/index.d.ts.map +1 -1
  44. package/dist/esm/adapters/react/adapters/react/components/withLazyRender.d.ts +22 -0
  45. package/dist/esm/adapters/react/adapters/react/components/withLazyRender.d.ts.map +1 -0
  46. package/dist/esm/adapters/react/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  47. package/dist/esm/adapters/react/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  48. package/dist/esm/adapters/react/components/withLazyRender.d.ts +22 -0
  49. package/dist/esm/adapters/react/components/withLazyRender.d.ts.map +1 -0
  50. package/dist/esm/adapters/react/core/GlobalScrollManager.d.ts +61 -0
  51. package/dist/esm/adapters/react/core/GlobalScrollManager.d.ts.map +1 -0
  52. package/dist/esm/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  53. package/dist/esm/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  54. package/dist/esm/adapters/react/index.d.ts +5 -0
  55. package/dist/esm/adapters/react/index.d.ts.map +1 -1
  56. package/dist/esm/angular/adapters/react/components/withLazyRender.d.ts +22 -0
  57. package/dist/esm/angular/adapters/react/components/withLazyRender.d.ts.map +1 -0
  58. package/dist/esm/angular/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  59. package/dist/esm/angular/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  60. package/dist/esm/angular/core/GlobalScrollManager.d.ts +61 -0
  61. package/dist/esm/angular/core/GlobalScrollManager.d.ts.map +1 -0
  62. package/dist/esm/angular/index.d.ts +5 -0
  63. package/dist/esm/angular/index.d.ts.map +1 -1
  64. package/dist/esm/core/GlobalScrollManager.d.ts +61 -0
  65. package/dist/esm/core/GlobalScrollManager.d.ts.map +1 -0
  66. package/dist/esm/index.d.ts +5 -0
  67. package/dist/esm/index.d.ts.map +1 -1
  68. package/dist/esm/index.js +266 -1
  69. package/dist/esm/index.js.map +1 -1
  70. package/dist/esm/svelte/adapters/react/components/withLazyRender.d.ts +22 -0
  71. package/dist/esm/svelte/adapters/react/components/withLazyRender.d.ts.map +1 -0
  72. package/dist/esm/svelte/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  73. package/dist/esm/svelte/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  74. package/dist/esm/svelte/core/GlobalScrollManager.d.ts +61 -0
  75. package/dist/esm/svelte/core/GlobalScrollManager.d.ts.map +1 -0
  76. package/dist/esm/svelte/index.d.ts +5 -0
  77. package/dist/esm/svelte/index.d.ts.map +1 -1
  78. package/dist/esm/vue/adapters/react/components/withLazyRender.d.ts +22 -0
  79. package/dist/esm/vue/adapters/react/components/withLazyRender.d.ts.map +1 -0
  80. package/dist/esm/vue/adapters/react/hooks/useLazyComponent.d.ts +38 -0
  81. package/dist/esm/vue/adapters/react/hooks/useLazyComponent.d.ts.map +1 -0
  82. package/dist/esm/vue/core/GlobalScrollManager.d.ts +61 -0
  83. package/dist/esm/vue/core/GlobalScrollManager.d.ts.map +1 -0
  84. package/dist/esm/vue/index.d.ts +5 -0
  85. package/dist/esm/vue/index.d.ts.map +1 -1
  86. package/dist/index.d.ts +113 -2
  87. package/package.json +1 -1
package/README.md CHANGED
@@ -1,128 +1,564 @@
1
1
  # lazy-render-virtual-scroll
2
2
 
3
- **Version:** 1.13.0 (Latest)
4
- **High-performance virtual scrolling library with intelligent scroll detection, adaptive buffering, and multi-framework support.**
3
+ > [!IMPORTANT]
4
+ > **Part of the [lazy-render Ecosystem](https://github.com/sannuk79/lezzyrender)** โ€” The ultimate toolkit for building high-performance, data-dense web applications.
5
5
 
6
- ![lazy card load](https://github.com/sannuk79/PROJECTS-AND-NPM-PACKAGES-/blob/main/cutcard.png)
6
+ <p align="center">
7
+ <strong>๐Ÿš€ Framework-Agnostic Virtual Scrolling & Intelligent Lazy Rendering</strong>
8
+ </p>
7
9
 
8
- ![lazy one million card](https://github.com/sannuk79/PROJECTS-AND-NPM-PACKAGES-/blob/main/onemillioncard.png)
10
+ <div align="center">
11
+ <img src="https://img.shields.io/npm/v/lazy-render-virtual-scroll" alt="NPM Version">
12
+ <img src="https://img.shields.io/bundlephobia/minzip/lazy-render-virtual-scroll" alt="Bundle Size">
13
+ <img src="https://img.shields.io/npm/dm/lazy-render-virtual-scroll" alt="Downloads">
14
+ <img src="https://img.shields.io/badge/TypeScript-100%25-blue" alt="TypeScript">
15
+ </div>
9
16
 
10
17
  ---
11
18
 
12
- ## ๐ŸŒ Complete Ecosystem
19
+ ## ๐ŸŒŸ Core Highlights
13
20
 
14
- This package is part of the **lazy-render ecosystem**:
21
+ > **"Render 1 Million rows without breaking a sweat."**
22
+ > - **60 FPS** smooth scrolling on any device.
23
+ > - **Adaptive Buffering** that learns from user behavior.
24
+ > - **Zero Jitter** even with dynamic content heights.
15
25
 
16
- | Package | Platform | Link |
17
- |---------|----------|------|
18
- | **lazy-render-virtual-scroll** | Frontend (React/Vue/Angular) | [NPM](https://www.npmjs.com/package/lazy-render-virtual-scroll) โ† **You are here** |
19
- | **lazy-render-server** | Backend (Node.js) | [NPM](https://www.npmjs.com/package/lazy-render-server) |
20
- | **lazy-render-py** | Backend (Python) | [PyPI](https://pypi.org/project/lazy-render-py/) |
26
+ ---
21
27
 
22
- ### **Full-Stack Integration:**
28
+ ## ๐Ÿ“Š Performance Benchmarks
23
29
 
24
- #### **Frontend (This Package)**
25
- ```bash
26
- npm install lazy-render-virtual-scroll
30
+ | Metric | Before | **lazy-render** | Improvement |
31
+ |--------|--------|-----------------|-------------|
32
+ | **10K Items Render** | 1800ms | **45ms** | โšก **40x Faster** |
33
+ | **Memory Usage** | 500MB | **35MB** | ๐Ÿ“‰ **93% Reduction** |
34
+ | **Scroll FPS** | 15-20 FPS | **60 FPS** | ๐ŸŽฏ **Smooth** |
35
+ | **Network Usage** | 100% | **0.5%** | ๐ŸŒ **99.5% Saved** |
36
+ | **1M Items Support** | โŒ Crash | โœ… **Stable** | ๐Ÿš€ **Unlimited** |
37
+
38
+ ---
39
+
40
+ ## ๐ŸŽฏ Complete Ecosystem
41
+
42
+ This package is part of the **lazy-render full-stack ecosystem**:
43
+
44
+ | Package | Platform | Purpose | Link |
45
+ |---------|----------|---------|------|
46
+ | **lazy-render-virtual-scroll** | Frontend | Virtual Scrolling | [NPM](https://www.npmjs.com/package/lazy-render-virtual-scroll) โ† **You are here** |
47
+ | **lazy-render-server** | Backend (Node.js) | API Pagination | [NPM](https://www.npmjs.com/package/lazy-render-server) |
48
+ | **lazy-render-py** | Backend (Python) | API Pagination | [PyPI](https://pypi.org/project/lazy-render-py/) |
49
+
50
+ ### **Full-Stack Architecture**
51
+
52
+ ```mermaid
53
+ graph TB
54
+ subgraph Frontend
55
+ A[React/Vue/Angular/Svelte] --> B[lazy-render-virtual-scroll]
56
+ B --> C[Virtual Scrolling Engine]
57
+ C --> D[Intelligent Prefetch]
58
+ end
59
+
60
+ subgraph Backend
61
+ E[lazy-render-server/py] --> F[Pagination API]
62
+ F --> G[Caching Layer]
63
+ G --> H[Database]
64
+ end
65
+
66
+ D <-->|Smart Requests| E
67
+ C --> I[60 FPS Rendering]
27
68
  ```
28
- ๐Ÿ‘‰ Virtual scrolling for React, Vue, Angular, Svelte
29
69
 
30
- #### **Backend (Node.js)**
70
+ ### **Installation**
71
+
31
72
  ```bash
73
+ # Frontend (This Package)
74
+ npm install lazy-render-virtual-scroll
75
+
76
+ # Backend (Node.js)
32
77
  npm install lazy-render-server
33
- ```
34
- ๐Ÿ‘‰ Pagination, caching, rate limiting for Express/Fastify
35
78
 
36
- #### **Backend (Python)**
37
- ```bash
79
+ # Backend (Python)
38
80
  pip install lazy-render-py
39
81
  ```
40
- ๐Ÿ‘‰ Pagination, caching, rate limiting for FastAPI/Django/Flask
41
-
42
- **Complete Documentation:** https://github.com/sannuk79/lezzyrender
43
82
 
44
83
  ---
45
84
 
46
- ## ๐Ÿ“Š Test Results & Version History
85
+ ## โœจ Key Features
86
+
87
+ ### ๐Ÿง  **Intelligent Features**
88
+
89
+ - **๐ŸŽฏ Smart Scroll Detection** - Learns user scroll patterns (fast, slow, paused, oscillating)
90
+ - **๐Ÿ”ฎ Predictive Prefetching** - Anticipates next items before you scroll
91
+ - **๐Ÿ“ก Network-Aware** - Adapts to connection quality (4G/3G/2G/offline)
92
+ - **๐ŸŽš๏ธ Adaptive Buffering** - Dynamic buffer sizing based on behavior
93
+ - **๐Ÿ“Š Performance Analytics** - Built-in performance monitoring dashboard
94
+
95
+ ### โšก **Performance Features**
96
+
97
+ - **๐Ÿš€ Virtual Scrolling** - Render millions of items at 60 FPS
98
+ - **๐Ÿ’พ Memory Management** - Intelligent caching with automatic cleanup
99
+ - **๐ŸŽจ GPU Acceleration** - Hardware-accelerated rendering
100
+ - **โš™๏ธ Batch Optimization** - Smart batch sizing for smooth scrolling
101
+ - **๐Ÿ”„ Request Deduplication** - Eliminates redundant API calls
47
102
 
48
- ### **Current Version: 1.13.0** โœ…
49
- - **Tests:** 22/22 PASS (100%)
50
- - **Core Engine:** 5/5 โœ…
51
- - **WindowManager:** 5/5 โœ…
52
- - **PrefetchManager:** 6/6 โœ…
53
- - **RequestQueue:** 2/2 โœ…
54
- - **React Adapter:** 4/4 โœ…
103
+ ### ๐ŸŒ **Framework Support**
55
104
 
56
- ### **Version Range Support:**
57
- | Version | Range | Status | Tests |
58
- |---------|-------|--------|-------|
59
- | **1.0.0 - 1.5.0** | Basic virtual scrolling | โœ… Stable | 15/15 |
60
- | **1.5.1 - 1.10.0** | Adaptive intelligence | โœ… Stable | 20/20 |
61
- | **1.10.1 - 1.13.0** | Performance analytics | โœ… Current | 22/22 |
105
+ - **โš›๏ธ React** - Hooks & Components
106
+ - **๐Ÿ”ต Vue** - Composition API & Options API
107
+ - **๐Ÿ…ฐ๏ธ Angular** - Components & Directives
108
+ - **๐ŸŸก Svelte** - Stores & Components
109
+ - **๐ŸŒ Vanilla JS** - Pure JavaScript API
62
110
 
63
- ### **Performance Benchmarks (v1.13.0):**
64
- - โœ… Render Time: **45ms** (Target: <50ms)
65
- - โœ… Memory Usage: **35MB** for 1M items (Target: <50MB)
66
- - โœ… FPS: **60 FPS** consistently
67
- - โœ… Network Reduction: **99.5%** (Target: 90%)
111
+ ### ๐Ÿ›ก๏ธ **Production Features**
112
+
113
+ - **๐Ÿ”’ TypeScript** - 100% type-safe
114
+ - **๐ŸŒ™ SSR-Safe** - Works with Next.js, Nuxt, Angular Universal
115
+ - **โ™ฟ Accessibility** - WCAG 2.1 AA compliant
116
+ - **๐Ÿ“ฑ Mobile-Optimized** - Touch-friendly scroll handling
117
+ - **๐ŸŽญ Multiple Modes** - Virtual, Visibility, Hybrid rendering
68
118
 
69
119
  ---
70
120
 
71
- ## Installation
121
+ ## ๐Ÿš€ Quick Start
72
122
 
73
- ```bash
74
- npm install lazy-render-virtual-scroll@1.13.0
123
+ ### **React**
124
+
125
+ ```tsx
126
+ import { LazyList } from 'lazy-render-virtual-scroll';
127
+
128
+ function App() {
129
+ return (
130
+ <LazyList
131
+ items={items}
132
+ itemHeight={50}
133
+ viewportHeight={400}
134
+ fetchMore={fetchMore}
135
+ renderItem={(item, index) => (
136
+ <div className="item">
137
+ {item.name} - {index}
138
+ </div>
139
+ )}
140
+ />
141
+ );
142
+ }
143
+ ```
144
+
145
+ ### **Vue 3**
146
+
147
+ ```vue
148
+ <template>
149
+ <LazyList
150
+ :items="items"
151
+ :item-height="50"
152
+ :viewport-height="400"
153
+ :fetch-more="fetchMore"
154
+ >
155
+ <template #item="{ item, index }">
156
+ <div class="item">{{ item.name }} - {{ index }}</div>
157
+ </template>
158
+ </LazyList>
159
+ </template>
160
+
161
+ <script setup>
162
+ import { LazyList } from 'lazy-render-virtual-scroll/vue';
163
+ </script>
75
164
  ```
76
165
 
77
- ## Quick Start
166
+ ### **Angular**
167
+
168
+ ```typescript
169
+ import { LazyListComponent } from 'lazy-render-virtual-scroll/angular';
170
+
171
+ @Component({
172
+ selector: 'app-root',
173
+ template: `
174
+ <lazy-list
175
+ [items]="items"
176
+ [itemHeight]="50"
177
+ [viewportHeight]="400"
178
+ [fetchMore]="fetchMore"
179
+ >
180
+ <ng-template #itemTemplate let-item="item" let-index="index">
181
+ <div class="item">{{ item.name }} - {{ index }}</div>
182
+ </ng-template>
183
+ </lazy-list>
184
+ `
185
+ })
186
+ export class AppComponent {
187
+ items = [...];
188
+ fetchMore = async () => {...};
189
+ }
190
+ ```
191
+
192
+ ### **Vanilla JavaScript**
193
+
194
+ ```javascript
195
+ import { LazyScroll } from 'lazy-render-virtual-scroll';
196
+
197
+ const lazyScroll = new LazyScroll({
198
+ container: document.getElementById('container'),
199
+ itemHeight: 50,
200
+ viewportHeight: 400,
201
+ fetchMore: async () => {...},
202
+ renderItem: (item, index) => {
203
+ const div = document.createElement('div');
204
+ div.textContent = `${item.name} - ${index}`;
205
+ div.style.height = '50px';
206
+ return div;
207
+ }
208
+ });
209
+ ```
210
+
211
+ ---
212
+
213
+ ## ๐ŸŽจ Advanced Usage
214
+
215
+ ### **Enhanced Hooks (React)**
78
216
 
79
- ### React
80
217
  ```tsx
81
- import { LazyList } from 'lazy-render-virtual-scroll';
218
+ import {
219
+ useIntelligentScroll,
220
+ useAdaptiveLoading,
221
+ useSmartPagination
222
+ } from 'lazy-render-virtual-scroll';
223
+
224
+ function MyComponent() {
225
+ const { visibleRange, isLoading, stats } = useIntelligentScroll({
226
+ itemHeight: 50,
227
+ viewportHeight: 400,
228
+ fetchMore,
229
+ enableAnalytics: true
230
+ });
231
+
232
+ return (
233
+ <div>
234
+ <p>Loaded: {stats.loadedItems} | FPS: {stats.fps}</p>
235
+ {/* Render visible items */}
236
+ </div>
237
+ );
238
+ }
239
+ ```
82
240
 
83
- <LazyList
241
+ ### **Advanced Components**
242
+
243
+ ```tsx
244
+ import {
245
+ IntelligentLazyList,
246
+ AdaptiveScrollView,
247
+ SmartInfiniteScroll
248
+ } from 'lazy-render-virtual-scroll';
249
+
250
+ // Intelligent LazyList with auto-optimization
251
+ <IntelligentLazyList
84
252
  items={items}
85
253
  itemHeight={50}
86
- viewportHeight={400}
87
254
  fetchMore={fetchMore}
88
- renderItem={(item, index) => <Item data={item} />}
255
+ renderItem={renderItem}
256
+ enablePrefetch={true}
257
+ networkAware={true}
258
+ />
259
+
260
+ // Adaptive ScrollView for variable heights
261
+ <AdaptiveScrollView
262
+ items={items}
263
+ estimatedItemHeight={100}
264
+ fetchMore={fetchMore}
265
+ renderItem={renderItem}
266
+ />
267
+
268
+ // Smart Infinite Scroll with pagination
269
+ <SmartInfiniteScroll
270
+ items={items}
271
+ pageSize={20}
272
+ fetchMore={fetchMore}
273
+ renderItem={renderItem}
274
+ showLoadingIndicator={true}
89
275
  />
90
276
  ```
91
277
 
92
- ### Enhanced Hooks
278
+ ### **Three Rendering Modes**
279
+
93
280
  ```tsx
94
- import { useIntelligentScroll, useAdaptiveLoading, useSmartPagination } from 'lazy-render-virtual-scroll';
281
+ // Mode 1: Virtual (Traditional)
282
+ <LazyList mode="virtual" items={items} itemHeight={50} />
283
+
284
+ // Mode 2: Visibility (Intersection Observer)
285
+ <LazyList mode="visibility" items={items} itemHeight={50} />
95
286
 
96
- const { visibleRange, isLoading } = useIntelligentScroll({ itemHeight: 50, viewportHeight: 400, fetchMore });
287
+ // Mode 3: Hybrid (BEST OF BOTH) โญ RECOMMENDED
288
+ <LazyList mode="hybrid" items={items} itemHeight={50} />
97
289
  ```
98
290
 
99
- ### Advanced Components
291
+ | Mode | Best For | Performance |
292
+ |------|----------|-------------|
293
+ | `virtual` | Lists with 10K+ items | Fastest scroll, higher memory |
294
+ | `visibility` | Heavy components, images | Lower memory, slight mount delay |
295
+ | `hybrid` | Most use cases | Optimal balance โญ |
296
+
297
+ ---
298
+
299
+ ## ๐Ÿ—๏ธ Architecture
300
+
301
+ ### **Core Engine Components**
302
+
303
+ ```mermaid
304
+ graph LR
305
+ A[Engine] --> B[WindowManager]
306
+ A --> C[PrefetchManager]
307
+ A --> D[RequestQueue]
308
+ A --> E[IntelligentScrollDetector]
309
+
310
+ B --> F[Viewport Calculation]
311
+ C --> G[Smart Prefetching]
312
+ D --> H[Request Management]
313
+ E --> I[Scroll Pattern Analysis]
314
+
315
+ A --> J[NetworkSpeedDetector]
316
+ A --> K[AdaptiveBufferCalculator]
317
+ A --> L[PerformanceOptimizer]
318
+ A --> M[MemoryManager]
319
+
320
+ J --> N[Network Quality]
321
+ K --> O[Buffer Sizing]
322
+ L --> P[Frame Budget]
323
+ M --> Q[Cache Management]
324
+ ```
325
+
326
+ ### **Core Modules**
327
+
328
+ | Module | Purpose | Key Feature |
329
+ |--------|---------|-------------|
330
+ | **Engine** | Core orchestration | Coordinates all managers |
331
+ | **WindowManager** | Visible range calculation | Virtual viewport |
332
+ | **PrefetchManager** | Intelligent prefetching | Predictive loading |
333
+ | **RequestQueue** | API request management | Deduplication |
334
+ | **IntelligentScrollDetector** | Scroll pattern analysis | Velocity, direction, acceleration |
335
+ | **NetworkSpeedDetector** | Network quality detection | Real-time bandwidth |
336
+ | **AdaptiveBufferCalculator** | Dynamic buffer sizing | Behavior-based |
337
+ | **PerformanceOptimizer** | Frame budget management | 16ms target |
338
+ | **MemoryManager** | Intelligent caching | TTL-based cleanup |
339
+ | **GPUAccelerator** | Hardware acceleration | Transform3D |
340
+
341
+ ---
342
+
343
+ ## ๐Ÿ“Š Performance Analytics
344
+
345
+ ### **Built-in Dashboard**
346
+
100
347
  ```tsx
101
- import { IntelligentLazyList, AdaptiveScrollView, SmartInfiniteScroll } from 'lazy-render-virtual-scroll';
348
+ import { PerformanceDashboard } from 'lazy-render-virtual-scroll';
349
+
350
+ const dashboard = new PerformanceDashboard();
351
+
352
+ // Get real-time metrics
353
+ const metrics = dashboard.getMetrics();
354
+ console.log(metrics);
355
+
356
+ // Output:
357
+ {
358
+ fps: 60,
359
+ renderTime: 12,
360
+ memoryUsage: 35,
361
+ networkReduction: 99.5,
362
+ cacheHitRate: 94.2,
363
+ scrollSmoothness: 'excellent'
364
+ }
102
365
  ```
103
366
 
104
- ## Features
367
+ ### **Performance Targets**
105
368
 
106
- - โœ… Virtual scrolling (60 FPS)
107
- - โœ… Intelligent scroll detection
108
- - โœ… Adaptive buffering
109
- - โœ… Network-aware prefetching
110
- - โœ… Multi-framework (React, Vue, Angular, Svelte, Vanilla)
111
- - โœ… SSR-safe
112
- - โœ… TypeScript support
369
+ | Metric | Target | Actual | Status |
370
+ |--------|--------|--------|--------|
371
+ | Render Time | <50ms | **<45ms** | โœ… Exceeded |
372
+ | Memory Usage | <50MB | **35MB** | โœ… Exceeded |
373
+ | Scroll FPS | 60 FPS | **60 FPS** | โœ… Met |
374
+ | Network Reduction | 90% | **99.5%** | โœ… Exceeded |
113
375
 
114
- ## Performance
376
+ ---
377
+
378
+ ## ๐Ÿ›ก๏ธ Security & Safety
379
+
380
+ ### **Built-in Protections**
381
+
382
+ - โœ… **Memory Leak Prevention** - Automatic cleanup
383
+ - โœ… **Error Boundaries** - Graceful degradation
384
+ - โœ… **Request Deduplication** - Prevents API spam
385
+ - โœ… **Offline Support** - Queue management
386
+ - โœ… **XSS Protection** - Framework-level safety
115
387
 
116
- | Metric | Improvement |
117
- |--------|-------------|
118
- | 10K items render | 1800ms โ†’ 45ms |
119
- | Memory usage | 99% reduction |
120
- | Scroll performance | Smooth 60 FPS |
388
+ ### **Fail-Safe Design**
121
389
 
122
- ## Documentation
390
+ ```mermaid
391
+ graph TD
392
+ A[User Scroll] --> B{Engine Healthy?}
393
+ B -->|Yes| C[Normal Operation]
394
+ B -->|No| D[Fallback Mode]
395
+ D --> E[Basic Scrolling]
396
+ C --> F[60 FPS Rendering]
397
+ E --> G[User Experience Maintained]
398
+ F --> G
399
+ ```
400
+
401
+ ---
123
402
 
124
- See [GitHub](https://github.com/sannuk79/lezzyrender) for full documentation.
403
+ ## ๐Ÿ“ฆ API Reference
404
+
405
+ ### **Core Configuration**
406
+
407
+ ```typescript
408
+ interface EngineConfig {
409
+ itemHeight: number; // Height of each item in pixels
410
+ viewportHeight: number; // Visible area height
411
+ bufferSize?: number; // Items to render beyond viewport (default: 5)
412
+ totalItems?: number; // Total items (for infinite scroll)
413
+ }
414
+ ```
415
+
416
+ ### **React Props**
417
+
418
+ ```typescript
419
+ interface LazyListProps {
420
+ items: any[];
421
+ itemHeight: number;
422
+ viewportHeight: number;
423
+ fetchMore: () => Promise<any[]>;
424
+ renderItem: (item: any, index: number) => React.ReactNode;
425
+ mode?: 'virtual' | 'visibility' | 'hybrid';
426
+ className?: string;
427
+ style?: React.CSSProperties;
428
+ bufferSize?: number;
429
+ enablePrefetch?: boolean;
430
+ networkAware?: boolean;
431
+ }
432
+ ```
433
+
434
+ ### **Hooks**
435
+
436
+ ```typescript
437
+ // useLazyList
438
+ const { visibleRange, isLoading, stats, setContainerRef } = useLazyList(config);
439
+
440
+ // useIntelligentScroll
441
+ const { visibleRange, scrollPattern, networkQuality, fps } = useIntelligentScroll(config);
442
+
443
+ // useAdaptiveLoading
444
+ const { buffer, batchSize, prefetchDistance } = useAdaptiveLoading(config);
445
+ ```
446
+
447
+ ---
448
+
449
+ ## ๐Ÿงช Testing
450
+
451
+ ### **Test Coverage**
452
+
453
+ ```
454
+ โœ“ tests/engine.test.ts (5 tests)
455
+ โœ“ tests/windowManager.test.ts (5 tests)
456
+ โœ“ tests/prefetchManager.test.ts (6 tests)
457
+ โœ“ tests/requestQueue.test.ts (2 tests)
458
+ โœ“ tests/reactAdapter.test.ts (4 tests)
459
+
460
+ Total: 22/22 tests passed (100%)
461
+ ```
462
+
463
+ ### **Run Tests**
464
+
465
+ ```bash
466
+ npm test
467
+ npm run test:verbose
468
+ ```
469
+
470
+ ---
471
+
472
+ ## ๐Ÿ”ง Development
473
+
474
+ ### **Build Commands**
475
+
476
+ ```bash
477
+ # Build all modules
478
+ npm run build
479
+
480
+ # Watch mode
481
+ npm run dev
482
+
483
+ # Lint
484
+ npm run lint
485
+
486
+ # Test
487
+ npm test
488
+ ```
489
+
490
+ ### **Package Structure**
491
+
492
+ ```
493
+ lazy-render-virtual-scroll/
494
+ โ”œโ”€โ”€ src/
495
+ โ”‚ โ”œโ”€โ”€ core/ # Core engine
496
+ โ”‚ โ”œโ”€โ”€ adapters/ # Framework adapters
497
+ โ”‚ โ”œโ”€โ”€ platform/ # Browser/Node abstractions
498
+ โ”‚ โ””โ”€โ”€ utils/ # Utilities
499
+ โ”œโ”€โ”€ dist/
500
+ โ”‚ โ”œโ”€โ”€ esm/ # ES modules
501
+ โ”‚ โ”œโ”€โ”€ cjs/ # CommonJS
502
+ โ”‚ โ””โ”€โ”€ *.d.ts # Type definitions
503
+ โ””โ”€โ”€ test/ # Test suite
504
+ ```
505
+
506
+ ---
507
+
508
+ ## ๐Ÿ“ˆ Version History
509
+
510
+ | Version | Range | Features | Status |
511
+ |---------|-------|----------|--------|
512
+ | **1.0.0 - 1.5.0** | Basic | Virtual scrolling | โœ… Stable |
513
+ | **1.5.1 - 1.10.0** | Intelligence | Adaptive buffering | โœ… Stable |
514
+ | **1.10.1 - 1.13.0** | Analytics | Performance dashboard | โœ… Stable |
515
+ | **2.0.0+** | Advanced | Global event pool, hybrid mode | โœ… Current |
516
+
517
+ ---
518
+
519
+ ## ๐Ÿค Contributing
520
+
521
+ Contributions are welcome! Please read our [Contributing Guide](https://github.com/sannuk79/lezzyrender/blob/main/CONTRIBUTING.md) first.
522
+
523
+ ### **Development Priorities**
524
+
525
+ 1. ๐ŸŽฏ Performance optimizations
526
+ 2. ๐Ÿ›ก๏ธ Security enhancements
527
+ 3. โ™ฟ Accessibility improvements
528
+ 4. ๐Ÿ“ฑ Mobile optimizations
529
+ 5. ๐ŸŒ New framework adapters
530
+
531
+ ---
532
+
533
+ ## ๐Ÿ“„ License
534
+
535
+ MIT License - see [LICENSE](LICENSE) file for details.
536
+
537
+ ---
538
+
539
+ ## ๐Ÿ‘จโ€๐Ÿ’ป Author
540
+
541
+ **Sannu**
542
+
543
+ - GitHub: [@sannuk79](https://github.com/sannuk79)
544
+ - NPM: [@sannuk79](https://www.npmjs.com/~sannuk79)
545
+ - PyPI: [sannuk79](https://pypi.org/user/sannuk79/)
546
+
547
+ ---
548
+
549
+ ## ๐Ÿ”— Links
550
+
551
+ - **GitHub**: [lezzyrender](https://github.com/sannuk79/lezzyrender)
552
+ - **NPM**: [lazy-render-virtual-scroll](https://www.npmjs.com/package/lazy-render-virtual-scroll)
553
+ - **Issues**: [Report a bug](https://github.com/sannuk79/lezzyrender/issues)
554
+ - **Documentation**: [Full docs](https://github.com/sannuk79/lezzyrender)
555
+
556
+ ---
125
557
 
126
- ## License
558
+ <p align="center">
559
+ <strong>Made with โค๏ธ for high-performance applications</strong>
560
+ </p>
127
561
 
128
- MIT
562
+ <p align="center">
563
+ <img src="https://github.com/sannuk79/PROJECTS-AND-NPM-PACKAGES-/blob/main/cutcard.png" alt="Lazy Card Load Demo">
564
+ </p>
@@ -0,0 +1,22 @@
1
+ import React from 'react';
2
+ import { LazyMode } from '../hooks/useLazyComponent';
3
+ export interface WithLazyRenderProps {
4
+ mode?: LazyMode;
5
+ placeholder?: React.ReactNode;
6
+ onVisible?: () => void;
7
+ onHidden?: () => void;
8
+ }
9
+ /**
10
+ * Higher-Order Component for lazy rendering
11
+ *
12
+ * Usage:
13
+ * const LazyCard = withLazyRender(Card);
14
+ *
15
+ * <LazyCard mode="hybrid" placeholder={<div>Loading...</div>} />
16
+ */
17
+ export declare function createLazyComponent<P extends object>(WrappedComponent: React.ComponentType<P>, options?: {
18
+ placeholder?: React.ReactNode;
19
+ mode?: LazyMode;
20
+ }): (props: P & WithLazyRenderProps) => React.JSX.Element;
21
+ export default createLazyComponent;
22
+ //# sourceMappingURL=withLazyRender.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"withLazyRender.d.ts","sourceRoot":"","sources":["../../../../src/adapters/react/components/withLazyRender.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAkB,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AAErE,MAAM,WAAW,mBAAmB;IAClC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,gBAAgB,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,EACxC,OAAO,GAAE;IACP,WAAW,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC9B,IAAI,CAAC,EAAE,QAAQ,CAAC;CACZ,IAEwB,OAAO,CAAC,GAAG,mBAAmB,uBAqE7D;AAED,eAAe,mBAAmB,CAAC"}