virtua 0.49.3 → 0.50.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 (55) hide show
  1. package/README.md +39 -5
  2. package/lib/angular/ListItem.d.ts +1 -0
  3. package/lib/angular/VList.d.ts +85 -0
  4. package/lib/angular/Virtualizer.d.ts +141 -0
  5. package/lib/angular/WindowVirtualizer.d.ts +103 -0
  6. package/lib/angular/index.d.ts +6 -0
  7. package/lib/angular/index.js +1148 -0
  8. package/lib/angular/index.js.map +1 -0
  9. package/lib/angular/utils.d.ts +19 -0
  10. package/lib/core/index.cjs +237 -233
  11. package/lib/core/index.cjs.map +1 -1
  12. package/lib/core/index.d.ts +6 -6
  13. package/lib/core/index.js +272 -272
  14. package/lib/core/index.js.map +1 -1
  15. package/lib/index.cjs +529 -499
  16. package/lib/index.cjs.map +1 -1
  17. package/lib/index.d.ts +2 -2
  18. package/lib/index.js +321 -315
  19. package/lib/index.js.map +1 -1
  20. package/lib/react/VGrid.d.ts +2 -2
  21. package/lib/react/VList.d.ts +3 -3
  22. package/lib/react/Virtualizer.d.ts +3 -3
  23. package/lib/react/WindowVirtualizer.d.ts +3 -3
  24. package/lib/react/index.d.ts +9 -9
  25. package/lib/react/types.d.ts +1 -1
  26. package/lib/solid/VList.d.ts +3 -6
  27. package/lib/solid/Virtualizer.d.ts +2 -5
  28. package/lib/solid/WindowVirtualizer.d.ts +2 -5
  29. package/lib/solid/index.cjs +331 -323
  30. package/lib/solid/index.cjs.map +1 -1
  31. package/lib/solid/index.d.ts +7 -7
  32. package/lib/solid/index.js +249 -257
  33. package/lib/solid/index.js.map +1 -1
  34. package/lib/solid/index.jsx +1224 -1566
  35. package/lib/solid/index.jsx.map +1 -1
  36. package/lib/solid/types.d.ts +1 -1
  37. package/lib/svelte/VList.type.d.ts +2 -2
  38. package/lib/svelte/Virtualizer.type.d.ts +4 -4
  39. package/lib/svelte/WindowVirtualizer.type.d.ts +2 -2
  40. package/lib/svelte/index.d.ts +6 -6
  41. package/lib/svelte/index.js +4 -4
  42. package/lib/svelte/types.d.ts +1 -1
  43. package/lib/svelte/utils.js +11 -11
  44. package/lib/svelte/utils.js.map +1 -1
  45. package/lib/vue/VList.d.ts +2 -3
  46. package/lib/vue/Virtualizer.d.ts +3 -4
  47. package/lib/vue/WindowVirtualizer.d.ts +2 -3
  48. package/lib/vue/index.cjs +327 -317
  49. package/lib/vue/index.cjs.map +1 -1
  50. package/lib/vue/index.d.ts +6 -6
  51. package/lib/vue/index.js +284 -284
  52. package/lib/vue/index.js.map +1 -1
  53. package/lib/vue/utils.d.ts +1 -1
  54. package/package.json +39 -16
  55. package/lib/svelte/index.js.map +0 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  ![npm](https://img.shields.io/npm/v/virtua) ![npm bundle size](https://img.shields.io/bundlephobia/minzip/virtua) ![npm](https://img.shields.io/npm/dw/virtua) [![Best of JS](https://img.shields.io/endpoint?url=https://bestofjs-serverless.now.sh/api/project-badge?fullName=inokawa%2Fvirtua%26since=daily)](https://bestofjs.org/projects/virtua) [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/inokawa/virtua) [![check](https://github.com/inokawa/virtua/actions/workflows/check.yml/badge.svg)](https://github.com/inokawa/virtua/actions/workflows/check.yml) [![demo](https://github.com/inokawa/virtua/actions/workflows/demo.yml/badge.svg)](https://github.com/inokawa/virtua/actions/workflows/demo.yml)
4
4
 
5
- > A zero-config, fast and small (~3kB) virtual list (and grid) component for [React](https://github.com/facebook/react), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/) and [Svelte](https://svelte.dev/).
5
+ > A zero-config, fast and small (~3kB) virtual list (and grid) component for [React](https://github.com/facebook/react), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/), [Svelte](https://svelte.dev/) and [Angular](https://angular.dev/).
6
6
 
7
7
  ![example](./example.gif)
8
8
 
@@ -16,7 +16,7 @@ This project is a challenge to rethink virtualization. The goals are...
16
16
  - **Fast:** Natural virtual scrolling needs optimization in many aspects (eliminate frame drops by reducing CPU usage and GC, reduce [synchronous layout recalculation](https://gist.github.com/paulirish/5d52fb081b3570c81e3a), reduce visual jumps on repaint, optimize with CSS, optimize for JIT, optimize for frameworks, etc). We are trying to combine the best of them.
17
17
  - **Small:** Its bundle size should be small as much as possible to be friendly with modern web development. Currently each components are ~3kB gzipped and tree-shakeable.
18
18
  - **Flexible:** Aiming to support many usecases - fixed size, dynamic size, horizontal scrolling, reverse scrolling, RTL, mobile, infinite scrolling, scroll restoration, DnD, keyboard navigation, sticky, placeholder and more. See [live demo](#demo).
19
- - **Framework agnostic:** [React](https://react.dev/), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/) and [Svelte](https://svelte.dev/) are supported. We could support other frameworks in the future.
19
+ - **Framework agnostic:** [React](https://react.dev/), [Vue](https://vuejs.org/), [Solid](https://www.solidjs.com/), [Svelte](https://svelte.dev/) and [Angular](https://angular.dev/) are supported. We could support other frameworks in the future.
20
20
 
21
21
  ## Demo
22
22
 
@@ -261,7 +261,7 @@ export const App = () => {
261
261
 
262
262
  const sizes = [20, 40, 180, 77];
263
263
 
264
- const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4] );
264
+ const data = Array.from({ length: 1000 }).map((_, i) => sizes[i % 4]);
265
265
  </script>
266
266
 
267
267
  <VList {data} style="height: 100vh;" getKey={(_, i) => i}>
@@ -279,6 +279,40 @@ export const App = () => {
279
279
  </VList>
280
280
  ```
281
281
 
282
+ ### Angular
283
+
284
+ `@angular/core >= 20` is required. The components are zoneless-ready and work with both zone.js and [`provideZonelessChangeDetection`](https://angular.dev/api/core/provideZonelessChangeDetection).
285
+
286
+ ```ts
287
+ import { Component } from "@angular/core";
288
+ import { VList } from "virtua/angular";
289
+
290
+ const sizes = [20, 40, 180, 77];
291
+
292
+ @Component({
293
+ selector: "app-root",
294
+ imports: [VList],
295
+ template: `
296
+ <virtua-vlist [data]="data" [getKey]="getKey" style="height: 800px;">
297
+ <ng-template let-item let-index="index">
298
+ <div
299
+ [style.height.px]="item"
300
+ style="background: white; border-bottom: solid 1px #ccc;"
301
+ >
302
+ {{ index }}
303
+ </div>
304
+ </ng-template>
305
+ </virtua-vlist>
306
+ `,
307
+ })
308
+ export class App {
309
+ protected readonly data = Array.from({ length: 1000 }).map(
310
+ (_, i) => sizes[i % 4]!,
311
+ );
312
+ protected readonly getKey = (_: number, i: number) => i;
313
+ }
314
+ ```
315
+
282
316
  ### Other bindings
283
317
 
284
318
  - [vanilla-virtua](https://github.com/aabccd021/vanilla-virtua): virtua for vanilla js
@@ -356,9 +390,9 @@ And do not use index of items as `key`, especially when you want to toggle `shif
356
390
 
357
391
  `viewportSize` will be calculated by ResizeObserver so it's 0 until the first measurement.
358
392
 
359
- #### What is `Cannot find module 'virtua/vue(solid|svelte)' or its corresponding type declarations` error?
393
+ #### What is `Cannot find module 'virtua/vue(solid|svelte|angular)' or its corresponding type declarations` error?
360
394
 
361
- This package uses [exports of package.json](https://nodejs.org/api/packages.html#package-entry-points) for entry point of Vue/Solid/Svelte adapter. This field can't be resolved in TypeScript with `moduleResolution: node`. Try `moduleResolution: bundler` or `moduleResolution: nodenext` instead.
395
+ 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.
362
396
 
363
397
  ## Comparison
364
398
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,85 @@
1
+ import { type OnInit } from "@angular/core";
2
+ import { type CacheSnapshot, type ScrollToIndexOpts } from "../core/index.js";
3
+ import { type VirtualizerHandle } from "./Virtualizer.js";
4
+ import { type ItemProps } from "./utils.js";
5
+ import * as i0 from "@angular/core";
6
+ /**
7
+ * Methods of {@link VList}.
8
+ */
9
+ export interface VListHandle extends VirtualizerHandle {
10
+ }
11
+ /**
12
+ * Virtualized list component. See {@link VListHandle}.
13
+ *
14
+ * The host element is the scrollable viewport of the list.
15
+ */
16
+ export declare class VList<T> implements OnInit, VListHandle {
17
+ /**
18
+ * The data items rendered by this component.
19
+ */
20
+ readonly data: import("@angular/core").InputSignal<readonly T[]>;
21
+ /**
22
+ * Function that returns the key of an item in the list. It's recommended to specify whenever possible for performance.
23
+ * @default defaultGetKey (returns index of item)
24
+ */
25
+ readonly getKey: import("@angular/core").InputSignal<(data: T, index: number) => string | number>;
26
+ /**
27
+ * A function that provides properties/attributes for item element
28
+ */
29
+ readonly itemProps: import("@angular/core").InputSignal<ItemProps<T> | undefined>;
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.
32
+ * @defaultValue 200
33
+ */
34
+ readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
35
+ /**
36
+ * Item size hint for unmeasured items in pixels. It will help to reduce scroll jump when items are measured if used properly.
37
+ *
38
+ * - If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
39
+ * - If set, you can opt out estimation and use the value as initial item size.
40
+ */
41
+ readonly itemSize: import("@angular/core").InputSignal<number | undefined>;
42
+ /**
43
+ * A prop for SSR. If set, the specified amount of items will be mounted in the initial rendering regardless of the container size until hydrated. The minimum value is 0.
44
+ */
45
+ readonly ssrCount: import("@angular/core").InputSignal<number | undefined>;
46
+ /**
47
+ * While true is set, scroll position will be maintained from the end not usual start when items are added to/removed from start. It's recommended to set false if you add to/remove from mid/end of the list because it can cause unexpected behavior. This prop is useful for reverse infinite scrolling.
48
+ */
49
+ readonly shift: import("@angular/core").InputSignal<boolean>;
50
+ /**
51
+ * If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.
52
+ */
53
+ readonly horizontal: import("@angular/core").InputSignal<boolean>;
54
+ /**
55
+ * List of indexes that should be always mounted, even when off screen.
56
+ */
57
+ readonly keepMounted: import("@angular/core").InputSignal<readonly number[] | undefined>;
58
+ /**
59
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VListHandle.getCache}.
60
+ *
61
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
62
+ */
63
+ readonly cache: import("@angular/core").InputSignal<CacheSnapshot | undefined>;
64
+ /**
65
+ * Emitted whenever scroll offset changes. The value is current scrollTop, or scrollLeft if horizontal: true.
66
+ */
67
+ readonly scroll: import("@angular/core").OutputEmitterRef<number>;
68
+ /**
69
+ * Emitted when scrolling stops.
70
+ */
71
+ readonly scrollEnd: import("@angular/core").OutputEmitterRef<void>;
72
+ ngOnInit(): void;
73
+ getCache(): CacheSnapshot;
74
+ getScrollOffset(): number;
75
+ getScrollSize(): number;
76
+ getViewportSize(): number;
77
+ findItemIndex(offset: number): number;
78
+ getItemOffset(index: number): number;
79
+ getItemSize(index: number): number;
80
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
81
+ scrollTo(offset: number): void;
82
+ scrollBy(offset: number): void;
83
+ static ɵfac: i0.ɵɵFactoryDeclaration<VList<any>, never>;
84
+ static ɵcmp: i0.ɵɵComponentDeclaration<VList<any>, "virtua-vlist", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "getKey": { "alias": "getKey"; "required": false; "isSignal": true; }; "itemProps": { "alias": "itemProps"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "ssrCount": { "alias": "ssrCount"; "required": false; "isSignal": true; }; "shift": { "alias": "shift"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "keepMounted": { "alias": "keepMounted"; "required": false; "isSignal": true; }; "cache": { "alias": "cache"; "required": false; "isSignal": true; }; }, { "scroll": "scroll"; "scrollEnd": "scrollEnd"; }, ["template"], never, true, never>;
85
+ }
@@ -0,0 +1,141 @@
1
+ import { type OnInit } from "@angular/core";
2
+ import { type CacheSnapshot, type ScrollToIndexOpts } from "../core/index.js";
3
+ import { type ItemProps } from "./utils.js";
4
+ import * as i0 from "@angular/core";
5
+ /**
6
+ * Methods of {@link Virtualizer}.
7
+ */
8
+ export interface VirtualizerHandle {
9
+ /**
10
+ * Get current {@link CacheSnapshot}.
11
+ */
12
+ getCache: () => CacheSnapshot;
13
+ /**
14
+ * Get current scrollTop, or scrollLeft if horizontal: true.
15
+ */
16
+ getScrollOffset: () => number;
17
+ /**
18
+ * Get current scrollHeight, or scrollWidth if horizontal: true.
19
+ */
20
+ getScrollSize: () => number;
21
+ /**
22
+ * Get current offsetHeight, or offsetWidth if horizontal: true.
23
+ */
24
+ getViewportSize: () => number;
25
+ /**
26
+ * Find nearest item index from offset.
27
+ * @param offset offset in pixels from the start of the scroll container
28
+ */
29
+ findItemIndex(offset: number): number;
30
+ /**
31
+ * Get item offset from start.
32
+ * @param index index of item
33
+ */
34
+ getItemOffset(index: number): number;
35
+ /**
36
+ * Get item size.
37
+ * @param index index of item
38
+ */
39
+ getItemSize(index: number): number;
40
+ /**
41
+ * Scroll to the item specified by index.
42
+ * @param index index of item
43
+ * @param opts options
44
+ */
45
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
46
+ /**
47
+ * Scroll to the given offset.
48
+ * @param offset offset from start
49
+ */
50
+ scrollTo(offset: number): void;
51
+ /**
52
+ * Scroll by the given offset.
53
+ * @param offset offset from current position
54
+ */
55
+ scrollBy(offset: number): void;
56
+ }
57
+ /**
58
+ * Customizable list virtualizer for advanced usage. See {@link VirtualizerHandle}.
59
+ *
60
+ * The host element is the container of the items. Use the attribute selector to change its tag,
61
+ * like `<ul virtuaVirtualizer [data]="data">`.
62
+ */
63
+ export declare class Virtualizer<T> implements OnInit, VirtualizerHandle {
64
+ /**
65
+ * The data items rendered by this component.
66
+ */
67
+ readonly data: import("@angular/core").InputSignal<readonly T[]>;
68
+ /**
69
+ * Function that returns the key of an item in the list. It's recommended to specify whenever possible for performance.
70
+ * @default defaultGetKey (returns index of item)
71
+ */
72
+ readonly getKey: import("@angular/core").InputSignal<(data: T, index: number) => string | number>;
73
+ /**
74
+ * A function that provides properties/attributes for item element
75
+ */
76
+ readonly itemProps: import("@angular/core").InputSignal<ItemProps<T> | undefined>;
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.
79
+ * @defaultValue 200
80
+ */
81
+ readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
82
+ /**
83
+ * Reference to the scrollable element. The default will get the direct parent element of virtualizer.
84
+ */
85
+ readonly scrollRef: import("@angular/core").InputSignal<HTMLElement | undefined>;
86
+ /**
87
+ * Item size hint for unmeasured items in pixels. It will help to reduce scroll jump when items are measured if used properly.
88
+ *
89
+ * - If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
90
+ * - If set, you can opt out estimation and use the value as initial item size.
91
+ */
92
+ readonly itemSize: import("@angular/core").InputSignal<number | undefined>;
93
+ /**
94
+ * A prop for SSR. If set, the specified amount of items will be mounted in the initial rendering regardless of the container size until hydrated. The minimum value is 0.
95
+ */
96
+ readonly ssrCount: import("@angular/core").InputSignal<number | undefined>;
97
+ /**
98
+ * While true is set, scroll position will be maintained from the end not usual start when items are added to/removed from start. It's recommended to set false if you add to/remove from mid/end of the list because it can cause unexpected behavior. This prop is useful for reverse infinite scrolling.
99
+ */
100
+ readonly shift: import("@angular/core").InputSignal<boolean>;
101
+ /**
102
+ * If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.
103
+ */
104
+ readonly horizontal: import("@angular/core").InputSignal<boolean>;
105
+ /**
106
+ * List of indexes that should be always mounted, even when off screen.
107
+ */
108
+ readonly keepMounted: import("@angular/core").InputSignal<readonly number[] | undefined>;
109
+ /**
110
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VirtualizerHandle.getCache}.
111
+ *
112
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
113
+ */
114
+ readonly cache: import("@angular/core").InputSignal<CacheSnapshot | undefined>;
115
+ /**
116
+ * The offset to the scrollable parent before virtualizer in pixels. If you put an element before virtualizer, you have to set its height to this prop.
117
+ */
118
+ readonly startMargin: import("@angular/core").InputSignal<number>;
119
+ /**
120
+ * Emitted whenever scroll offset changes. The value is current scrollTop, or scrollLeft if horizontal: true.
121
+ */
122
+ readonly scroll: import("@angular/core").OutputEmitterRef<number>;
123
+ /**
124
+ * Emitted when scrolling stops.
125
+ */
126
+ readonly scrollEnd: import("@angular/core").OutputEmitterRef<void>;
127
+ constructor();
128
+ ngOnInit(): void;
129
+ getCache(): CacheSnapshot;
130
+ getScrollOffset(): number;
131
+ getScrollSize(): number;
132
+ getViewportSize(): number;
133
+ findItemIndex(offset: number): number;
134
+ getItemOffset(index: number): number;
135
+ getItemSize(index: number): number;
136
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
137
+ scrollTo(offset: number): void;
138
+ scrollBy(offset: number): void;
139
+ static ɵfac: i0.ɵɵFactoryDeclaration<Virtualizer<any>, never>;
140
+ static ɵcmp: i0.ɵɵComponentDeclaration<Virtualizer<any>, "virtua-virtualizer, [virtuaVirtualizer]", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "getKey": { "alias": "getKey"; "required": false; "isSignal": true; }; "itemProps": { "alias": "itemProps"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "scrollRef": { "alias": "scrollRef"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "ssrCount": { "alias": "ssrCount"; "required": false; "isSignal": true; }; "shift": { "alias": "shift"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "keepMounted": { "alias": "keepMounted"; "required": false; "isSignal": true; }; "cache": { "alias": "cache"; "required": false; "isSignal": true; }; "startMargin": { "alias": "startMargin"; "required": false; "isSignal": true; }; "itemTemplate": { "alias": "itemTemplate"; "required": false; "isSignal": true; }; }, { "scroll": "scroll"; "scrollEnd": "scrollEnd"; }, ["contentTemplate"], never, true, never>;
141
+ }
@@ -0,0 +1,103 @@
1
+ import { type OnInit } from "@angular/core";
2
+ import { type CacheSnapshot, type ScrollToIndexOpts } from "../core/index.js";
3
+ import * as i0 from "@angular/core";
4
+ /**
5
+ * Methods of {@link WindowVirtualizer}.
6
+ */
7
+ export interface WindowVirtualizerHandle {
8
+ /**
9
+ * Get current {@link CacheSnapshot}.
10
+ */
11
+ getCache: () => CacheSnapshot;
12
+ /**
13
+ * Get current scrollTop, or scrollLeft if horizontal: true.
14
+ */
15
+ getScrollOffset: () => number;
16
+ /**
17
+ * Get current offsetHeight, or offsetWidth if horizontal: true.
18
+ */
19
+ getViewportSize: () => number;
20
+ /**
21
+ * Find nearest item index from offset.
22
+ * @param offset offset in pixels from the start of the scroll container
23
+ */
24
+ findItemIndex(offset: number): number;
25
+ /**
26
+ * Get item offset from start.
27
+ * @param index index of item
28
+ */
29
+ getItemOffset(index: number): number;
30
+ /**
31
+ * Get item size.
32
+ * @param index index of item
33
+ */
34
+ getItemSize(index: number): number;
35
+ /**
36
+ * Scroll to the item specified by index.
37
+ * @param index index of item
38
+ * @param opts options
39
+ */
40
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
41
+ }
42
+ /**
43
+ * {@link Virtualizer} controlled by the window scrolling. See {@link WindowVirtualizerHandle}.
44
+ *
45
+ * The host element is the container of the items. Use the attribute selector to change its tag,
46
+ * like `<ul virtuaWindowVirtualizer [data]="data">`.
47
+ */
48
+ export declare class WindowVirtualizer<T> implements OnInit, WindowVirtualizerHandle {
49
+ /**
50
+ * The data items rendered by this component.
51
+ */
52
+ readonly data: import("@angular/core").InputSignal<readonly T[]>;
53
+ /**
54
+ * Function that returns the key of an item in the list. It's recommended to specify whenever possible for performance.
55
+ * @default defaultGetKey (returns index of item)
56
+ */
57
+ readonly getKey: import("@angular/core").InputSignal<(data: T, index: number) => string | number>;
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.
60
+ * @defaultValue 200
61
+ */
62
+ readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
63
+ /**
64
+ * Item size hint for unmeasured items in pixels. It will help to reduce scroll jump when items are measured if used properly.
65
+ *
66
+ * - If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
67
+ * - If set, you can opt out estimation and use the value as initial item size.
68
+ */
69
+ readonly itemSize: import("@angular/core").InputSignal<number | undefined>;
70
+ /**
71
+ * While true is set, scroll position will be maintained from the end not usual start when items are added to/removed from start. It's recommended to set false if you add to/remove from mid/end of the list because it can cause unexpected behavior. This prop is useful for reverse infinite scrolling.
72
+ */
73
+ readonly shift: import("@angular/core").InputSignal<boolean>;
74
+ /**
75
+ * If true, rendered as a horizontally scrollable list. Otherwise rendered as a vertically scrollable list.
76
+ */
77
+ readonly horizontal: import("@angular/core").InputSignal<boolean>;
78
+ /**
79
+ * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link WindowVirtualizerHandle.getCache}.
80
+ *
81
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
82
+ */
83
+ readonly cache: import("@angular/core").InputSignal<CacheSnapshot | undefined>;
84
+ /**
85
+ * Emitted whenever scroll offset changes.
86
+ */
87
+ readonly scroll: import("@angular/core").OutputEmitterRef<void>;
88
+ /**
89
+ * Emitted when scrolling stops.
90
+ */
91
+ readonly scrollEnd: import("@angular/core").OutputEmitterRef<void>;
92
+ constructor();
93
+ ngOnInit(): void;
94
+ getCache(): CacheSnapshot;
95
+ getScrollOffset(): number;
96
+ getViewportSize(): number;
97
+ findItemIndex(offset: number): number;
98
+ getItemOffset(index: number): number;
99
+ getItemSize(index: number): number;
100
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
101
+ static ɵfac: i0.ɵɵFactoryDeclaration<WindowVirtualizer<any>, never>;
102
+ static ɵcmp: i0.ɵɵComponentDeclaration<WindowVirtualizer<any>, "virtua-window-virtualizer, [virtuaWindowVirtualizer]", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "getKey": { "alias": "getKey"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "shift": { "alias": "shift"; "required": false; "isSignal": true; }; "horizontal": { "alias": "horizontal"; "required": false; "isSignal": true; }; "cache": { "alias": "cache"; "required": false; "isSignal": true; }; }, { "scroll": "scroll"; "scrollEnd": "scrollEnd"; }, ["template"], never, true, never>;
103
+ }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @module angular
3
+ */
4
+ export { VList, type VListHandle } from "./VList.js";
5
+ export { Virtualizer, type VirtualizerHandle } from "./Virtualizer.js";
6
+ export { WindowVirtualizer, type WindowVirtualizerHandle, } from "./WindowVirtualizer.js";