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.
- package/README.md +37 -32
- package/lib/angular/VGrid.d.ts +1 -1
- package/lib/angular/VList.d.ts +1 -1
- package/lib/angular/VMasonry.d.ts +1 -1
- package/lib/angular/Virtualizer.d.ts +1 -1
- package/lib/angular/WindowVirtualizer.d.ts +1 -1
- package/lib/angular/index.js +586 -586
- package/lib/angular/index.js.map +1 -1
- package/lib/core/index.cjs +405 -404
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +416 -415
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs +645 -645
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +639 -639
- package/lib/index.js.map +1 -1
- package/lib/react/VGrid.d.ts +1 -1
- package/lib/react/VMasonry.d.ts +1 -1
- package/lib/react/Virtualizer.d.ts +1 -1
- package/lib/react/WindowVirtualizer.d.ts +1 -1
- package/lib/solid/VGrid.d.ts +1 -1
- package/lib/solid/VMasonry.d.ts +1 -1
- package/lib/solid/Virtualizer.d.ts +1 -1
- package/lib/solid/WindowVirtualizer.d.ts +1 -1
- package/lib/solid/index.cjs +672 -671
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js +671 -671
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +165 -214
- package/lib/solid/index.jsx.map +1 -1
- package/lib/svelte/VGrid.svelte +15 -20
- package/lib/svelte/VGrid.type.d.ts +1 -1
- package/lib/svelte/VMasonry.svelte +10 -13
- package/lib/svelte/VMasonry.type.d.ts +1 -1
- package/lib/svelte/Virtualizer.svelte +8 -8
- package/lib/svelte/Virtualizer.type.d.ts +1 -1
- package/lib/svelte/WindowVirtualizer.svelte +5 -7
- package/lib/svelte/WindowVirtualizer.type.d.ts +1 -1
- package/lib/vue/VGrid.d.ts +1 -1
- package/lib/vue/VMasonry.d.ts +1 -1
- package/lib/vue/Virtualizer.d.ts +1 -1
- package/lib/vue/WindowVirtualizer.d.ts +1 -1
- package/lib/vue/index.cjs +800 -797
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.js +771 -768
- package/lib/vue/index.js.map +1 -1
- package/package.json +1 -1
- 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
|
-
####
|
|
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
|
package/lib/angular/VGrid.d.ts
CHANGED
|
@@ -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
|
|
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>;
|
package/lib/angular/VList.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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>;
|