virtua 0.50.6 → 0.51.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.
Files changed (39) hide show
  1. package/README.md +10 -5
  2. package/lib/angular/Virtualizer.d.ts +2 -2
  3. package/lib/angular/WindowVirtualizer.d.ts +2 -2
  4. package/lib/angular/index.js +245 -270
  5. package/lib/angular/index.js.map +1 -1
  6. package/lib/core/index.cjs +261 -298
  7. package/lib/core/index.cjs.map +1 -1
  8. package/lib/core/index.js +276 -313
  9. package/lib/core/index.js.map +1 -1
  10. package/lib/index.cjs +460 -497
  11. package/lib/index.cjs.map +1 -1
  12. package/lib/index.js +461 -498
  13. package/lib/index.js.map +1 -1
  14. package/lib/react/VGrid.d.ts +3 -3
  15. package/lib/react/Virtualizer.d.ts +2 -2
  16. package/lib/react/WindowVirtualizer.d.ts +2 -2
  17. package/lib/solid/Virtualizer.d.ts +2 -2
  18. package/lib/solid/WindowVirtualizer.d.ts +2 -2
  19. package/lib/solid/index.cjs +262 -289
  20. package/lib/solid/index.cjs.map +1 -1
  21. package/lib/solid/index.js +273 -298
  22. package/lib/solid/index.js.map +1 -1
  23. package/lib/solid/index.jsx +160 -220
  24. package/lib/solid/index.jsx.map +1 -1
  25. package/lib/svelte/ListItem.svelte +1 -1
  26. package/lib/svelte/Virtualizer.svelte +12 -4
  27. package/lib/svelte/Virtualizer.type.d.ts +2 -2
  28. package/lib/svelte/WindowVirtualizer.svelte +12 -4
  29. package/lib/svelte/WindowVirtualizer.type.d.ts +2 -2
  30. package/lib/svelte/utils.d.ts +2 -0
  31. package/lib/svelte/utils.js +4 -1
  32. package/lib/svelte/utils.js.map +1 -1
  33. package/lib/vue/Virtualizer.d.ts +2 -2
  34. package/lib/vue/WindowVirtualizer.d.ts +2 -2
  35. package/lib/vue/index.cjs +365 -415
  36. package/lib/vue/index.cjs.map +1 -1
  37. package/lib/vue/index.js +316 -365
  38. package/lib/vue/index.js.map +1 -1
  39. package/package.json +3 -4
package/README.md CHANGED
@@ -28,7 +28,12 @@ https://inokawa.github.io/virtua/
28
28
  npm install virtua
29
29
  ```
30
30
 
31
- If you use this lib in [legacy browsers which does not have ResizeObserver](https://caniuse.com/?search=resizeobserver), you should use [polyfill](https://github.com/juggle/resize-observer#switching-between-native-and-polyfilled-versions).
31
+ If you want to support legacy browsers, you need polyfills.
32
+
33
+ - [ResizeObserver](https://caniuse.com/?search=resizeobserver) is always required (e.g. [@juggle/resize-observer](https://github.com/juggle/resize-observer#switching-between-native-and-polyfilled-versions)).
34
+ - [Scroll methods on elements](https://caniuse.com/element-scroll-methods) are always required (e.g. [element-scroll-polyfill](https://github.com/idmadj/element-scroll-polyfill)).
35
+ - [CSS scroll-behavior](https://caniuse.com/?search=scroll-behavior) is required only if you call `scrollToIndex` with `smooth: true` (e.g. [scroll-behavior-polyfill](https://github.com/wessberg/scroll-behavior-polyfill)).
36
+ - [CSS inset-inline-start](https://caniuse.com/mdn-css_properties_inset-inline-start) is required only if you set `horizontal: true`. It cannot be polyfilled so use `virtua@<=0.50` instead.
32
37
 
33
38
  ## Getting started
34
39
 
@@ -212,8 +217,8 @@ const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4]);
212
217
  :key="index"
213
218
  :style="{
214
219
  height: item + 'px',
215
- background: 'white',
216
220
  borderBottom: 'solid 1px #ccc',
221
+ background: 'white',
217
222
  }"
218
223
  >
219
224
  {{ index }}
@@ -240,7 +245,7 @@ export const App = () => {
240
245
  style={{
241
246
  height: d + "px",
242
247
  "border-bottom": "solid 1px #ccc",
243
- background: "#fff",
248
+ background: "white",
244
249
  }}
245
250
  >
246
251
  {i()}
@@ -264,13 +269,13 @@ export const App = () => {
264
269
  const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4]);
265
270
  </script>
266
271
 
267
- <VList {data} style="height: 100vh;" getKey={(_, i) => i}>
272
+ <VList {data} style="height: 800px;" getKey={(_, i) => i}>
268
273
  {#snippet children(item, index)}
269
274
  <div
270
275
  style="
271
276
  height: {item}px;
272
- background: white;
273
277
  border-bottom: solid 1px #ccc;
278
+ background: white;
274
279
  "
275
280
  >
276
281
  {index}
@@ -11,7 +11,7 @@ export interface VirtualizerHandle {
11
11
  */
12
12
  readonly cache: CacheSnapshot;
13
13
  /**
14
- * Get current scrollTop, or scrollLeft if horizontal: true.
14
+ * Get current scrollTop, or scrollLeft if horizontal: true. Always positive even in RTL.
15
15
  */
16
16
  readonly scrollOffset: number;
17
17
  /**
@@ -19,7 +19,7 @@ export interface VirtualizerHandle {
19
19
  */
20
20
  readonly scrollSize: number;
21
21
  /**
22
- * Get current offsetHeight, or offsetWidth if horizontal: true.
22
+ * Get current clientHeight, or clientWidth if horizontal: true.
23
23
  */
24
24
  readonly viewportSize: number;
25
25
  /**
@@ -10,11 +10,11 @@ export interface WindowVirtualizerHandle {
10
10
  */
11
11
  readonly cache: CacheSnapshot;
12
12
  /**
13
- * Get current scrollTop, or scrollLeft if horizontal: true.
13
+ * Get current scrollTop, or scrollLeft if horizontal: true. Always positive even in RTL.
14
14
  */
15
15
  readonly scrollOffset: number;
16
16
  /**
17
- * Get current offsetHeight, or offsetWidth if horizontal: true.
17
+ * Get current clientHeight of the document, or clientWidth if horizontal: true.
18
18
  */
19
19
  readonly viewportSize: number;
20
20
  /**