@oxog/scrollex 1.0.3 → 1.1.1

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/CHANGELOG.md CHANGED
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [1.1.1] - 2026-12-01
11
+
12
+ ### Fixed
13
+ - `useVirtualList({ getItemHeight })` lays out every item at its height up front: `totalSize`, item offsets, the visible range and `scrollToIndex` use it from the first render, with or without `measureElement` (it used to be read only when `measureElement` attached a row, so a list of 100 rows of 100px reported a `totalSize` of 5000 with the default estimate). A new `getItemHeight` function re-lays out the items it sizes; the layout is only re-announced when a height actually changed, so an inline function is fine. `VirtualList` with a numeric `itemHeight` gets the same treatment.
14
+ - `useVirtualList({ scrollMargin })` is no longer ignored: it is the space above the list inside the same scroll container (a header, say). The visible range, `scrollToIndex`, the scroll controller, the infinite loader and scroll restoration account for it; `virtualItems[i].start` and `totalSize` stay relative to the list element, so rows are positioned exactly as before. The kernel accepts it as `scrollMargin` too (`getItemOffset` then includes it).
15
+ - README and LLMS.md: the bundle size is the measured ~11.7 KB min+gzip for any single import of `@oxog/scrollex` (the entries share one chunk), not "~5KB core"; the unmeasured "60fps" claims are gone.
16
+
17
+ ### Added
18
+ - `KernelOptions.getItemSize` (the kernel side of `getItemHeight`) and `KernelOptions.scrollMargin`.
19
+
20
+ ## [1.1.0] - 2026-11-30
21
+
22
+ ### Fixed
23
+ - `VirtualList`, `VirtualGrid` and `VirtualMasonry`: an `onLoadMore` started by scrolling that rejects (or throws) is logged as `[Scrollex] Error in onLoadMore:` instead of becoming an unhandled promise rejection, the same as a load started for a list that does not fill its viewport.
24
+ - `bidirectional` passed inline (`plugins={[bidirectional(...)]}`) keeps following the bottom when new items arrive: the instance that saw the new items was replaced in the same commit and its scroll to the bottom was dropped.
25
+ - `scrollRestoration` no longer stops saving for good when the saved position is past the end of a list that stays shorter: once the reader scrolls, the wait for more data ends and the position is saved on unmount again.
26
+ - `kernel.destroy()` (and the event bus's `clear` / `clearEvent`) called from inside an event handler stops the handlers it removed from running for the rest of that event, as `off()` already did.
27
+
28
+ ### Changed
29
+ - `@oxog/scrollex` and `@oxog/scrollex/plugins` are built together with code splitting: the core plugins exported by both entry points are now the same functions and share their per-kernel state (each entry used to bundle its own copy).
30
+ - `react-dom` is an optional peer dependency (`peerDependenciesMeta`): the package never imports it.
31
+ - `exports` lists `./package.json`.
32
+ - Releases are published by a manually started `Publish` workflow (npm trusted publishing with provenance) instead of on a pushed `v*` tag; `npm run prepublishOnly` runs lint, typecheck, tests with coverage, the build and a check of the packed archive.
33
+
34
+ ### Internal
35
+ - ESLint 9 with `typescript-eslint` covers `src` and `tests` with no warnings allowed; `typecheck` also checks the tests (`tsconfig.test.json`).
36
+ - `npm run test:package` packs the archive, installs it with React into a scratch project, imports both entry points through ESM and CommonJS, type-checks them under `NodeNext` and runs smoke tests (including server rendering in plain Node). CI runs it on Node 18, 20, 22 and 24; lint, typecheck, tests and build run on Node 22 and 24.
37
+ - The documented-browser-versions test matched no version at all (its pattern lost its backslashes in a template literal) and a masonry gap test asserted nothing; both now check what they describe.
38
+
10
39
  ## [1.0.3] - 2026-11-27
11
40
 
12
41
  ### Changed
@@ -122,7 +151,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
122
151
 
123
152
  ---
124
153
 
125
- [Unreleased]: https://github.com/ersinkoc/Scrollex/compare/v1.0.3...HEAD
154
+ [Unreleased]: https://github.com/ersinkoc/Scrollex/compare/v1.1.1...HEAD
155
+ [1.1.1]: https://github.com/ersinkoc/Scrollex/compare/v1.1.0...v1.1.1
156
+ [1.1.0]: https://github.com/ersinkoc/Scrollex/compare/v1.0.3...v1.1.0
126
157
  [1.0.3]: https://github.com/ersinkoc/Scrollex/compare/v1.0.2...v1.0.3
127
158
  [1.0.2]: https://github.com/ersinkoc/Scrollex/compare/v1.0.1...v1.0.2
128
159
  [1.0.1]: https://github.com/ersinkoc/Scrollex/compare/v1.0.0...v1.0.1
package/README.md CHANGED
@@ -18,8 +18,8 @@
18
18
  ## Features
19
19
 
20
20
  - **Zero Dependencies** - No runtime dependencies, React is a peer dependency
21
- - **High Performance** - 100k+ items at 60fps with RAF-based rendering
22
- - **Micro-Kernel Architecture** - Small core (~5KB) with tree-shakeable plugins
21
+ - **High Performance** - Renders only the visible rows of 100k+ item lists, with RAF-throttled scroll handling
22
+ - **Micro-Kernel Architecture** - Plugin-based kernel, ~12KB min+gzip for the core (see [Bundle size](#bundle-size))
23
23
  - **Variable Heights** - Auto-measurement for dynamic content
24
24
  - **Infinite Scroll** - Built-in bidirectional infinite loading
25
25
  - **Multiple Layouts** - List, Grid, and Masonry components
@@ -185,6 +185,12 @@ function MyList({ items }) {
185
185
  }
186
186
  ```
187
187
 
188
+ - `getItemHeight: (index) => number` gives known row heights: every row is laid out at its height up front
189
+ (`totalSize`, offsets, `scrollToIndex`), with or without `measureElement`. Unknown heights use
190
+ `estimatedItemHeight` until rows are measured.
191
+ - `scrollMargin` is the space above the list inside the same scroll container (a header, say). The visible range
192
+ and `scrollToIndex` account for it; `virtualItem.start` and `totalSize` stay relative to the list element.
193
+
188
194
  ## Plugins
189
195
 
190
196
  Extend functionality with optional plugins:
@@ -281,11 +287,22 @@ Scrollex is designed for maximum performance:
281
287
 
282
288
  - **Binary Search** - O(log n) visible range calculation
283
289
  - **Measurement Caching** - Efficient variable height handling
284
- - **RAF Batching** - Smooth 60fps rendering
290
+ - **RAF Batching** - Scroll handling is throttled to animation frames
285
291
  - **CSS Containment** - Optimized paint and layout
286
- - **Tree Shaking** - Import only what you need
287
292
 
288
- Tested with **100,000+ items** at consistent 60fps.
293
+ The kernel is tested with lists of 100,000+ items; only the rows in view (plus `overscan`) are mounted.
294
+
295
+ ### Bundle size
296
+
297
+ Measured for 1.1.1 with esbuild (minified, `react` external):
298
+
299
+ | Import | min | min+gzip |
300
+ |--------|-----|----------|
301
+ | any single export of `@oxog/scrollex` (`useVirtualList`, `VirtualList`, `createKernel`) | ~41KB | ~11.7KB |
302
+ | everything from `@oxog/scrollex` | ~50KB | ~14.2KB |
303
+ | everything from `@oxog/scrollex/plugins` | ~30KB | ~10.0KB |
304
+
305
+ The entries share one chunk, so importing a single export costs about as much as the core.
289
306
 
290
307
  ## Browser Support
291
308