virtua 0.53.3 → 0.53.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.
Files changed (49) hide show
  1. package/README.md +37 -32
  2. package/lib/angular/VGrid.d.ts +1 -1
  3. package/lib/angular/VList.d.ts +1 -1
  4. package/lib/angular/VMasonry.d.ts +1 -1
  5. package/lib/angular/Virtualizer.d.ts +1 -1
  6. package/lib/angular/WindowVirtualizer.d.ts +1 -1
  7. package/lib/angular/index.js +586 -586
  8. package/lib/angular/index.js.map +1 -1
  9. package/lib/core/index.cjs +405 -404
  10. package/lib/core/index.cjs.map +1 -1
  11. package/lib/core/index.d.ts +1 -1
  12. package/lib/core/index.js +416 -415
  13. package/lib/core/index.js.map +1 -1
  14. package/lib/index.cjs +645 -645
  15. package/lib/index.cjs.map +1 -1
  16. package/lib/index.js +639 -639
  17. package/lib/index.js.map +1 -1
  18. package/lib/react/VGrid.d.ts +1 -1
  19. package/lib/react/VMasonry.d.ts +1 -1
  20. package/lib/react/Virtualizer.d.ts +1 -1
  21. package/lib/react/WindowVirtualizer.d.ts +1 -1
  22. package/lib/solid/VGrid.d.ts +1 -1
  23. package/lib/solid/VMasonry.d.ts +1 -1
  24. package/lib/solid/Virtualizer.d.ts +1 -1
  25. package/lib/solid/WindowVirtualizer.d.ts +1 -1
  26. package/lib/solid/index.cjs +672 -671
  27. package/lib/solid/index.cjs.map +1 -1
  28. package/lib/solid/index.js +671 -671
  29. package/lib/solid/index.js.map +1 -1
  30. package/lib/solid/index.jsx +165 -214
  31. package/lib/solid/index.jsx.map +1 -1
  32. package/lib/svelte/VGrid.svelte +15 -20
  33. package/lib/svelte/VGrid.type.d.ts +1 -1
  34. package/lib/svelte/VMasonry.svelte +10 -13
  35. package/lib/svelte/VMasonry.type.d.ts +1 -1
  36. package/lib/svelte/Virtualizer.svelte +8 -8
  37. package/lib/svelte/Virtualizer.type.d.ts +1 -1
  38. package/lib/svelte/WindowVirtualizer.svelte +5 -7
  39. package/lib/svelte/WindowVirtualizer.type.d.ts +1 -1
  40. package/lib/vue/VGrid.d.ts +1 -1
  41. package/lib/vue/VMasonry.d.ts +1 -1
  42. package/lib/vue/Virtualizer.d.ts +1 -1
  43. package/lib/vue/WindowVirtualizer.d.ts +1 -1
  44. package/lib/vue/index.cjs +800 -797
  45. package/lib/vue/index.cjs.map +1 -1
  46. package/lib/vue/index.js +771 -768
  47. package/lib/vue/index.js.map +1 -1
  48. package/package.json +1 -1
  49. package/lib/core/observer.d.ts +0 -1
package/README.md CHANGED
@@ -420,7 +420,43 @@ See [demo](https://inokawa.github.io/virtua/) and [its source code](./stories).
420
420
 
421
421
  ### FAQs
422
422
 
423
- #### Is there any way to improve performance further?
423
+ #### What is `ResizeObserver loop completed with undelivered notifications.` error?
424
+
425
+ It may be dispatched by ResizeObserver in this lib [as described in spec](https://www.w3.org/TR/resize-observer/#deliver-resize-error), and [this is a common problem with ResizeObserver](https://github.com/w3c/csswg-drafts/issues/5488). If it bothers you,
426
+ [you can safely ignore it](https://github.com/DevExpress/testcafe/issues/4857#issuecomment-598775956).
427
+
428
+ Especially for `webpack-dev-server`, [you can filter out the specific error with `devServer.client.overlay.runtimeErrors` option](https://webpack.js.org/configuration/dev-server/#overlay).
429
+
430
+ #### Why do my items jump when images or other async content inside them are rendered?
431
+
432
+ Item sizes are measured from the DOM. If content inside an item is rendered asynchronously, such as images, videos, or components that render their content after mount, the item resizes after it's displayed. Items are also unmounted when they are out of view, so the same resize happens again every time they are mounted again.
433
+
434
+ To avoid it, make the content take its final size from the first render:
435
+
436
+ - Reserve the size of the content before it's rendered, for example with `width`/`height` or `aspect-ratio` of images and videos.
437
+ - Keep items mounted with `keepMounted` prop if their content can't be restored, such as a playing video.
438
+
439
+ #### Why are my items squashed, overlapped or rendered inconsistently on resize/add/remove/reorder?
440
+
441
+ Check that each item has a unique key, such as the id of your data, not its index.
442
+
443
+ - React: `key` of the element of each item
444
+ - Vue: `key` of the root element in the default slot
445
+ - Solid: the item of `data` itself, so keep the same reference for the same item
446
+ - Svelte: `getKey` prop
447
+ - Angular: `getKey` input
448
+
449
+ If it still happens, the `shift` prop may be misused.
450
+
451
+ #### Why `VListHandle.viewportSize` is 0 on mount?
452
+
453
+ `viewportSize` will be calculated by ResizeObserver so it's 0 until the first measurement.
454
+
455
+ #### What is `Cannot find module 'virtua/vue(solid|svelte|angular)' or its corresponding type declarations` error?
456
+
457
+ This package uses [exports of package.json](https://nodejs.org/api/packages.html#package-entry-points) for entry point of Vue/Solid/Svelte/Angular adapter. This field can't be resolved in TypeScript with `moduleResolution: node`. Try `moduleResolution: bundler` or `moduleResolution: nodenext` instead.
458
+
459
+ #### How can I improve performance in React?
424
460
 
425
461
  In complex usage, especially if you re-render frequently the parent of virtual scroller or the children are tons of items, children element creation can be a performance bottle neck. That's because creating React elements is fast enough but not free and new React element instances break some of memoization inside virtual scroller.
426
462
 
@@ -464,37 +500,6 @@ const Component = memo(HeavyItem);
464
500
  </VList>;
465
501
  ```
466
502
 
467
- Decreasing `bufferSize` prop may also improve perf in case that components are large and heavy.
468
-
469
- Virtua try to suppress glitch caused by resize as much as possible, but it will also require additional work. If your item contains something resized often, such as lazy loaded image, we recommend to set height or min-height to it if possible.
470
-
471
- #### What is `ResizeObserver loop completed with undelivered notifications.` error?
472
-
473
- It may be dispatched by ResizeObserver in this lib [as described in spec](https://www.w3.org/TR/resize-observer/#deliver-resize-error), and [this is a common problem with ResizeObserver](https://github.com/w3c/csswg-drafts/issues/5488). If it bothers you,
474
- [you can safely ignore it](https://github.com/DevExpress/testcafe/issues/4857#issuecomment-598775956).
475
-
476
- Especially for `webpack-dev-server`, [you can filter out the specific error with `devServer.client.overlay.runtimeErrors` option](https://webpack.js.org/configuration/dev-server/#overlay).
477
-
478
- #### Why are my items squashed, overlapped or rendered inconsistently on resize/add/remove/reorder?
479
-
480
- Check that each item has a unique key, such as the id of your data, not its index.
481
-
482
- - React: `key` of the element of each item
483
- - Vue: `key` of the root element in the default slot
484
- - Solid: the item of `data` itself, so keep the same reference for the same item
485
- - Svelte: `getKey` prop
486
- - Angular: `getKey` input
487
-
488
- If it still happens, the `shift` prop may be misused.
489
-
490
- #### Why `VListHandle.viewportSize` is 0 on mount?
491
-
492
- `viewportSize` will be calculated by ResizeObserver so it's 0 until the first measurement.
493
-
494
- #### What is `Cannot find module 'virtua/vue(solid|svelte|angular)' or its corresponding type declarations` error?
495
-
496
- This package uses [exports of package.json](https://nodejs.org/api/packages.html#package-entry-points) for entry point of Vue/Solid/Svelte/Angular adapter. This field can't be resolved in TypeScript with `moduleResolution: node`. Try `moduleResolution: bundler` or `moduleResolution: nodenext` instead.
497
-
498
503
  ## Comparison
499
504
 
500
505
  ### Features
@@ -194,7 +194,7 @@ export declare class VGrid<R = number, C = number> implements OnInit, VGridHandl
194
194
  */
195
195
  readonly keepMounted: import("@angular/core").InputSignal<readonly GridCellType[] | undefined>;
196
196
  /**
197
- * Extra space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank cells in fast scrolling.
197
+ * Extra space in pixels to render before/after the viewport. The default value is recommended for most cases. A smaller value gives better performance, and a larger value avoids showing blank cells in fast scrolling.
198
198
  * @defaultValue 200
199
199
  */
200
200
  readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
@@ -28,7 +28,7 @@ export declare class VList<T> implements OnInit, VListHandle {
28
28
  */
29
29
  readonly itemProps: import("@angular/core").InputSignal<ItemProps<T> | undefined>;
30
30
  /**
31
- * Extra item space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
31
+ * Extra space in pixels to render before/after the viewport. The default value is recommended for most cases. A smaller value gives better performance, and a larger value avoids showing blank items in fast scrolling.
32
32
  * @defaultValue 200
33
33
  */
34
34
  readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
@@ -80,7 +80,7 @@ export declare class VMasonry<T> implements OnInit, VMasonryHandle {
80
80
  */
81
81
  readonly itemSize: import("@angular/core").InputSignal<number | undefined>;
82
82
  /**
83
- * Extra item space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
83
+ * Extra space in pixels to render before/after the viewport. The default value is recommended for most cases. A smaller value gives better performance, and a larger value avoids showing blank items in fast scrolling.
84
84
  * @defaultValue 200
85
85
  */
86
86
  readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
@@ -75,7 +75,7 @@ export declare class Virtualizer<T> implements OnInit, VirtualizerHandle {
75
75
  */
76
76
  readonly itemProps: import("@angular/core").InputSignal<ItemProps<T> | undefined>;
77
77
  /**
78
- * Extra item space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
78
+ * Extra space in pixels to render before/after the viewport. The default value is recommended for most cases. A smaller value gives better performance, and a larger value avoids showing blank items in fast scrolling.
79
79
  * @defaultValue 200
80
80
  */
81
81
  readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
@@ -56,7 +56,7 @@ export declare class WindowVirtualizer<T> implements OnInit, WindowVirtualizerHa
56
56
  */
57
57
  readonly getKey: import("@angular/core").InputSignal<(data: T, index: number) => string | number>;
58
58
  /**
59
- * Extra item space in pixels to render before/after the viewport. The minimum value is 0. Lower value will give better performance but you can increase to avoid showing blank items in fast scrolling.
59
+ * Extra space in pixels to render before/after the viewport. The default value is recommended for most cases. A smaller value gives better performance, and a larger value avoids showing blank items in fast scrolling.
60
60
  * @defaultValue 200
61
61
  */
62
62
  readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;