virtua 0.52.9 → 0.53.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 +286 -193
  2. package/lib/angular/VList.d.ts +3 -1
  3. package/lib/angular/VMasonry.d.ts +114 -0
  4. package/lib/angular/Virtualizer.d.ts +3 -1
  5. package/lib/angular/WindowVirtualizer.d.ts +3 -1
  6. package/lib/angular/index.d.ts +1 -0
  7. package/lib/angular/index.js +812 -429
  8. package/lib/angular/index.js.map +1 -1
  9. package/lib/core/index.cjs +215 -137
  10. package/lib/core/index.cjs.map +1 -1
  11. package/lib/core/index.d.ts +1 -0
  12. package/lib/core/index.js +282 -204
  13. package/lib/core/index.js.map +1 -1
  14. package/lib/core/layouts/masonry.d.ts +1 -0
  15. package/lib/index.cjs +595 -423
  16. package/lib/index.cjs.map +1 -1
  17. package/lib/index.js +594 -424
  18. package/lib/index.js.map +1 -1
  19. package/lib/react/VMasonry.d.ts +105 -0
  20. package/lib/react/Virtualizer.d.ts +3 -1
  21. package/lib/react/WindowVirtualizer.d.ts +3 -1
  22. package/lib/react/index.d.ts +2 -0
  23. package/lib/react/types.d.ts +1 -1
  24. package/lib/solid/VMasonry.d.ts +107 -0
  25. package/lib/solid/Virtualizer.d.ts +3 -1
  26. package/lib/solid/WindowVirtualizer.d.ts +3 -1
  27. package/lib/solid/index.cjs +749 -541
  28. package/lib/solid/index.cjs.map +1 -1
  29. package/lib/solid/index.d.ts +2 -0
  30. package/lib/solid/index.js +704 -505
  31. package/lib/solid/index.js.map +1 -1
  32. package/lib/solid/index.jsx +345 -8
  33. package/lib/solid/index.jsx.map +1 -1
  34. package/lib/solid/types.d.ts +1 -1
  35. package/lib/svelte/MasonryItem.svelte +49 -0
  36. package/lib/svelte/VGrid.svelte +1 -1
  37. package/lib/svelte/VList.svelte +1 -1
  38. package/lib/svelte/VMasonry.svelte +182 -0
  39. package/lib/svelte/VMasonry.type.d.ts +104 -0
  40. package/lib/svelte/Virtualizer.svelte +1 -1
  41. package/lib/svelte/Virtualizer.type.d.ts +3 -1
  42. package/lib/svelte/WindowVirtualizer.svelte +1 -1
  43. package/lib/svelte/WindowVirtualizer.type.d.ts +3 -1
  44. package/lib/svelte/index.d.ts +2 -0
  45. package/lib/svelte/index.js +2 -1
  46. package/lib/svelte/types.d.ts +2 -2
  47. package/lib/vue/VMasonry.d.ts +110 -0
  48. package/lib/vue/Virtualizer.d.ts +3 -1
  49. package/lib/vue/WindowVirtualizer.d.ts +3 -1
  50. package/lib/vue/index.cjs +666 -442
  51. package/lib/vue/index.cjs.map +1 -1
  52. package/lib/vue/index.d.ts +2 -0
  53. package/lib/vue/index.js +695 -476
  54. package/lib/vue/index.js.map +1 -1
  55. package/package.json +6 -16
@@ -44,7 +44,9 @@ export declare class VList<T> implements OnInit, VListHandle {
44
44
  */
45
45
  readonly ssrCount: import("@angular/core").InputSignal<number | undefined>;
46
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.
47
+ * Set true only when items are added to or removed from the start of the list, such as when older items are loaded in reverse infinite scrolling. In that case, the scroll position is maintained from the end of the list instead of the start.
48
+ *
49
+ * **Do not set true in any other case, as it can cause unexpected behavior.**
48
50
  */
49
51
  readonly shift: import("@angular/core").InputSignal<boolean>;
50
52
  /**
@@ -0,0 +1,114 @@
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 VMasonry}.
6
+ */
7
+ export interface VMasonryHandle {
8
+ /**
9
+ * Get current {@link CacheSnapshot}.
10
+ */
11
+ readonly cache: CacheSnapshot;
12
+ /**
13
+ * Get current scrollTop.
14
+ */
15
+ readonly scrollOffset: number;
16
+ /**
17
+ * Get current scrollHeight.
18
+ */
19
+ readonly scrollSize: number;
20
+ /**
21
+ * Get current clientHeight.
22
+ */
23
+ readonly viewportSize: number;
24
+ /**
25
+ * Get item offset from start.
26
+ * @param index index of item
27
+ */
28
+ getItemOffset(index: number): number;
29
+ /**
30
+ * Get item size.
31
+ * @param index index of item
32
+ */
33
+ getItemSize(index: number): number;
34
+ /**
35
+ * Scroll to the item specified by index.
36
+ * @param index index of item
37
+ * @param opts options
38
+ */
39
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
40
+ /**
41
+ * Scroll to the given offset.
42
+ * @param offset offset from start
43
+ */
44
+ scrollTo(offset: number): void;
45
+ /**
46
+ * Scroll by the given offset.
47
+ * @param offset offset from current position
48
+ */
49
+ scrollBy(offset: number): void;
50
+ }
51
+ /**
52
+ * Virtualized masonry component. See {@link VMasonryHandle}.
53
+ *
54
+ * The host element is the scrollable viewport of the masonry.
55
+ */
56
+ export declare class VMasonry<T> implements OnInit, VMasonryHandle {
57
+ /**
58
+ * The data items rendered by this component.
59
+ */
60
+ readonly data: import("@angular/core").InputSignal<readonly T[]>;
61
+ /**
62
+ * Function that returns the key of an item in the list. It's recommended to specify whenever possible for performance.
63
+ * @default defaultGetKey (returns index of item)
64
+ */
65
+ readonly getKey: import("@angular/core").InputSignal<(data: T, index: number) => string | number>;
66
+ /**
67
+ * The number of lanes (columns) which items are laid out into. Each item is placed into the shortest lane in order. It must be an integer and the minimum value is 1.
68
+ */
69
+ readonly lanes: import("@angular/core").InputSignal<number>;
70
+ /**
71
+ * The gap between the items and the lanes in pixels, which is not included in the sizes.
72
+ * @defaultValue 0
73
+ */
74
+ readonly gap: import("@angular/core").InputSignal<number | undefined>;
75
+ /**
76
+ * Item size hint for unmeasured items in pixels. It will help to reduce scroll jump when items are measured if used properly.
77
+ *
78
+ * - If not set, initial item sizes will be automatically estimated from measured sizes. This is recommended for most cases.
79
+ * - If set, you can opt out estimation and use the value as initial item size.
80
+ */
81
+ readonly itemSize: import("@angular/core").InputSignal<number | undefined>;
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.
84
+ * @defaultValue 200
85
+ */
86
+ readonly bufferSize: import("@angular/core").InputSignal<number | undefined>;
87
+ /**
88
+ * 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 VMasonryHandle.cache}.
89
+ *
90
+ * **The length of items should be the same as when you take the snapshot, otherwise restoration may not work as expected.**
91
+ */
92
+ readonly cacheProp: import("@angular/core").InputSignal<CacheSnapshot | undefined>;
93
+ /**
94
+ * Emitted whenever scroll offset changes. The value is current scrollTop.
95
+ */
96
+ readonly scrolled: import("@angular/core").OutputEmitterRef<number>;
97
+ /**
98
+ * Emitted when scrolling stops.
99
+ */
100
+ readonly scrollEnded: import("@angular/core").OutputEmitterRef<void>;
101
+ constructor();
102
+ ngOnInit(): void;
103
+ get cache(): CacheSnapshot;
104
+ get scrollOffset(): number;
105
+ get scrollSize(): number;
106
+ get viewportSize(): number;
107
+ getItemOffset(index: number): number;
108
+ getItemSize(index: number): number;
109
+ scrollToIndex(index: number, opts?: ScrollToIndexOpts): void;
110
+ scrollTo(offset: number): void;
111
+ scrollBy(offset: number): void;
112
+ static ɵfac: i0.ɵɵFactoryDeclaration<VMasonry<any>, never>;
113
+ static ɵcmp: i0.ɵɵComponentDeclaration<VMasonry<any>, "virtua-vmasonry", never, { "data": { "alias": "data"; "required": true; "isSignal": true; }; "getKey": { "alias": "getKey"; "required": false; "isSignal": true; }; "lanes": { "alias": "lanes"; "required": true; "isSignal": true; }; "gap": { "alias": "gap"; "required": false; "isSignal": true; }; "itemSize": { "alias": "itemSize"; "required": false; "isSignal": true; }; "bufferSize": { "alias": "bufferSize"; "required": false; "isSignal": true; }; "cacheProp": { "alias": "cache"; "required": false; "isSignal": true; }; }, { "scrolled": "scrolled"; "scrollEnded": "scrollEnded"; }, ["template"], never, true, never>;
114
+ }
@@ -95,7 +95,9 @@ export declare class Virtualizer<T> implements OnInit, VirtualizerHandle {
95
95
  */
96
96
  readonly ssrCount: import("@angular/core").InputSignal<number | undefined>;
97
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.
98
+ * Set true only when items are added to or removed from the start of the list, such as when older items are loaded in reverse infinite scrolling. In that case, the scroll position is maintained from the end of the list instead of the start.
99
+ *
100
+ * **Do not set true in any other case, as it can cause unexpected behavior.**
99
101
  */
100
102
  readonly shift: import("@angular/core").InputSignal<boolean>;
101
103
  /**
@@ -72,7 +72,9 @@ export declare class WindowVirtualizer<T> implements OnInit, WindowVirtualizerHa
72
72
  */
73
73
  readonly ssrCount: import("@angular/core").InputSignal<number | undefined>;
74
74
  /**
75
- * 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.
75
+ * Set true only when items are added to or removed from the start of the list, such as when older items are loaded in reverse infinite scrolling. In that case, the scroll position is maintained from the end of the list instead of the start.
76
+ *
77
+ * **Do not set true in any other case, as it can cause unexpected behavior.**
76
78
  */
77
79
  readonly shift: import("@angular/core").InputSignal<boolean>;
78
80
  /**
@@ -6,3 +6,4 @@ export { Virtualizer, type VirtualizerHandle } from "./Virtualizer.js";
6
6
  export { WindowVirtualizer, type WindowVirtualizerHandle, } from "./WindowVirtualizer.js";
7
7
  export { VGrid, type VGridHandle } from "./VGrid.js";
8
8
  export type { GridSize, GridSpan } from "../core/index.js";
9
+ export { VMasonry, type VMasonryHandle } from "./VMasonry.js";