virtua 0.53.1 → 0.53.2
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/lib/angular/VGrid.d.ts +5 -1
- package/lib/angular/VList.d.ts +5 -1
- package/lib/angular/VMasonry.d.ts +5 -1
- package/lib/angular/Virtualizer.d.ts +5 -1
- package/lib/angular/WindowVirtualizer.d.ts +5 -1
- package/lib/angular/index.js +368 -352
- package/lib/angular/index.js.map +1 -1
- package/lib/core/index.cjs +101 -108
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/index.js +193 -200
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs +413 -404
- package/lib/index.cjs.map +1 -1
- package/lib/index.js +416 -408
- package/lib/index.js.map +1 -1
- package/lib/react/VGrid.d.ts +4 -0
- package/lib/react/VList.d.ts +1 -1
- package/lib/react/VMasonry.d.ts +4 -0
- package/lib/react/Virtualizer.d.ts +4 -0
- package/lib/react/WindowVirtualizer.d.ts +4 -0
- package/lib/react/types.d.ts +1 -1
- package/lib/solid/VGrid.d.ts +4 -0
- package/lib/solid/VList.d.ts +1 -1
- package/lib/solid/VMasonry.d.ts +4 -0
- package/lib/solid/Virtualizer.d.ts +4 -0
- package/lib/solid/WindowVirtualizer.d.ts +4 -0
- package/lib/solid/index.cjs +446 -436
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js +410 -400
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +38 -22
- package/lib/solid/index.jsx.map +1 -1
- package/lib/solid/types.d.ts +1 -1
- package/lib/svelte/VGrid.svelte +26 -6
- package/lib/svelte/VGrid.type.d.ts +4 -0
- package/lib/svelte/VList.svelte +2 -0
- package/lib/svelte/VList.type.d.ts +1 -1
- package/lib/svelte/VMasonry.svelte +9 -2
- package/lib/svelte/VMasonry.type.d.ts +4 -0
- package/lib/svelte/Virtualizer.svelte +9 -2
- package/lib/svelte/Virtualizer.type.d.ts +4 -0
- package/lib/svelte/WindowVirtualizer.svelte +9 -2
- package/lib/svelte/WindowVirtualizer.type.d.ts +4 -0
- package/lib/svelte/types.d.ts +1 -1
- package/lib/vue/VGrid.d.ts +4 -0
- package/lib/vue/VList.d.ts +1 -1
- package/lib/vue/VMasonry.d.ts +4 -0
- package/lib/vue/Virtualizer.d.ts +4 -0
- package/lib/vue/WindowVirtualizer.d.ts +4 -0
- package/lib/vue/index.cjs +619 -609
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.js +599 -589
- package/lib/vue/index.js.map +1 -1
- package/package.json +1 -1
package/lib/solid/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { JSX, ParentComponent } from 'solid-js';
|
|
2
|
-
export type ViewportComponentAttributes = Omit<JSX.HTMLAttributes<HTMLDivElement>, "ref" | "children" | "style" | "onScroll" | "onScrollEnd"> & {
|
|
2
|
+
export type ViewportComponentAttributes = Omit<JSX.HTMLAttributes<HTMLDivElement>, "ref" | "children" | "style" | "onScroll" | "onScrollEnd" | "onResize"> & {
|
|
3
3
|
style?: JSX.CSSProperties;
|
|
4
4
|
};
|
|
5
5
|
export interface CustomContainerComponentProps {
|
package/lib/svelte/VGrid.svelte
CHANGED
|
@@ -5,6 +5,8 @@
|
|
|
5
5
|
ACTION_ITEMS_LENGTH_CHANGE,
|
|
6
6
|
ACTION_RELAYOUT,
|
|
7
7
|
UPDATE_SCROLL_END_EVENT,
|
|
8
|
+
UPDATE_SIZE_EVENT,
|
|
9
|
+
microtask,
|
|
8
10
|
UPDATE_SCROLL_EVENT,
|
|
9
11
|
UPDATE_VIRTUAL_STATE,
|
|
10
12
|
createContainerGridDriver,
|
|
@@ -45,6 +47,7 @@
|
|
|
45
47
|
onverticalscroll,
|
|
46
48
|
onhorizontalscroll,
|
|
47
49
|
onscrollend,
|
|
50
|
+
onresize,
|
|
48
51
|
...rest
|
|
49
52
|
}: Props = $props();
|
|
50
53
|
|
|
@@ -86,6 +89,19 @@
|
|
|
86
89
|
};
|
|
87
90
|
rowStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
|
|
88
91
|
colStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
|
|
92
|
+
// Notify once after both stores are updated with the sizes observed together
|
|
93
|
+
let resized: boolean | undefined;
|
|
94
|
+
const notifyResize = () => {
|
|
95
|
+
if (!resized) {
|
|
96
|
+
resized = true;
|
|
97
|
+
microtask(() => {
|
|
98
|
+
resized = false;
|
|
99
|
+
onresize && onresize();
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
rowStore.$subscribe(UPDATE_SIZE_EVENT, notifyResize);
|
|
104
|
+
colStore.$subscribe(UPDATE_SIZE_EVENT, notifyResize);
|
|
89
105
|
|
|
90
106
|
$effect.pre(() => {
|
|
91
107
|
rowLayout.$setPinned(headerRows, footerRows);
|
|
@@ -98,8 +114,14 @@
|
|
|
98
114
|
if (colLength !== colStore.$getItemsLength()) {
|
|
99
115
|
colStore.$update(ACTION_ITEMS_LENGTH_CHANGE, [colLength]);
|
|
100
116
|
}
|
|
101
|
-
rowStore.$update(
|
|
102
|
-
|
|
117
|
+
rowStore.$update(
|
|
118
|
+
ACTION_RELAYOUT,
|
|
119
|
+
rowLayout.$relayout(rowSizes, rowStore.$getVisibleOffset()),
|
|
120
|
+
);
|
|
121
|
+
colStore.$update(
|
|
122
|
+
ACTION_RELAYOUT,
|
|
123
|
+
colLayout.$relayout(colSizes, colStore.$getVisibleOffset()),
|
|
124
|
+
);
|
|
103
125
|
});
|
|
104
126
|
let rowCount = $derived(stateVersion && rowStore.$getItemsLength());
|
|
105
127
|
let colCount = $derived(stateVersion && colStore.$getItemsLength());
|
|
@@ -148,10 +170,8 @@
|
|
|
148
170
|
rowStore.$getViewportSize;
|
|
149
171
|
export const getViewportWidth: VGridHandle["getViewportWidth"] =
|
|
150
172
|
colStore.$getViewportSize;
|
|
151
|
-
export const findRowIndex: VGridHandle["findRowIndex"] =
|
|
152
|
-
|
|
153
|
-
export const findColIndex: VGridHandle["findColIndex"] =
|
|
154
|
-
colStore.$findItemIndex;
|
|
173
|
+
export const findRowIndex: VGridHandle["findRowIndex"] = rowLayout.$findIndex;
|
|
174
|
+
export const findColIndex: VGridHandle["findColIndex"] = colLayout.$findIndex;
|
|
155
175
|
export const getRowOffset: VGridHandle["getRowOffset"] =
|
|
156
176
|
rowStore.$getItemOffset;
|
|
157
177
|
export const getColOffset: VGridHandle["getColOffset"] =
|
|
@@ -102,6 +102,10 @@ export interface VGridProps<R = number, C = number> extends Omit<ViewportCompone
|
|
|
102
102
|
* Callback invoked when scrolling stops.
|
|
103
103
|
*/
|
|
104
104
|
onscrollend?: () => void;
|
|
105
|
+
/**
|
|
106
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
107
|
+
*/
|
|
108
|
+
onresize?: () => void;
|
|
105
109
|
}
|
|
106
110
|
/**
|
|
107
111
|
* Methods of {@link VGrid}.
|
package/lib/svelte/VList.svelte
CHANGED
|
@@ -3,7 +3,7 @@ import { VirtualizerHandle, VirtualizerProps } from './Virtualizer.type.js';
|
|
|
3
3
|
/**
|
|
4
4
|
* Props of {@link VList}.
|
|
5
5
|
*/
|
|
6
|
-
export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "ssrCount" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted" | "cache" | "itemProps">, ViewportComponentAttributes {
|
|
6
|
+
export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "ssrCount" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "onresize" | "keepMounted" | "cache" | "itemProps">, ViewportComponentAttributes {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Methods of {@link VList}.
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
type ItemsRange,
|
|
5
5
|
type StateVersion,
|
|
6
6
|
UPDATE_SCROLL_END_EVENT,
|
|
7
|
+
UPDATE_SIZE_EVENT,
|
|
7
8
|
UPDATE_SCROLL_EVENT,
|
|
8
9
|
UPDATE_VIRTUAL_STATE,
|
|
9
10
|
createContainerDriver,
|
|
@@ -38,6 +39,7 @@
|
|
|
38
39
|
children,
|
|
39
40
|
onscroll,
|
|
40
41
|
onscrollend,
|
|
42
|
+
onresize,
|
|
41
43
|
...rest
|
|
42
44
|
}: Props = $props();
|
|
43
45
|
|
|
@@ -59,6 +61,9 @@
|
|
|
59
61
|
store.$subscribe(UPDATE_SCROLL_END_EVENT, () => {
|
|
60
62
|
onscrollend && onscrollend();
|
|
61
63
|
});
|
|
64
|
+
store.$subscribe(UPDATE_SIZE_EVENT, () => {
|
|
65
|
+
onresize && onresize();
|
|
66
|
+
});
|
|
62
67
|
|
|
63
68
|
let containerRef: HTMLDivElement | undefined = $state();
|
|
64
69
|
|
|
@@ -120,8 +125,10 @@
|
|
|
120
125
|
}
|
|
121
126
|
});
|
|
122
127
|
$effect.pre(() => {
|
|
123
|
-
|
|
124
|
-
|
|
128
|
+
store.$update(
|
|
129
|
+
ACTION_RELAYOUT,
|
|
130
|
+
layout.$relayout(lanesProp, gapProp, store.$getVisibleOffset()),
|
|
131
|
+
);
|
|
125
132
|
});
|
|
126
133
|
|
|
127
134
|
let prevStateVersion: StateVersion | undefined;
|
|
@@ -58,6 +58,10 @@ export interface VMasonryProps<T> extends ViewportComponentAttributes {
|
|
|
58
58
|
* Callback invoked when scrolling stops.
|
|
59
59
|
*/
|
|
60
60
|
onscrollend?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
63
|
+
*/
|
|
64
|
+
onresize?: () => void;
|
|
61
65
|
}
|
|
62
66
|
/**
|
|
63
67
|
* Methods of {@link VMasonry}.
|
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
type ItemsRange,
|
|
7
7
|
type StateVersion,
|
|
8
8
|
UPDATE_SCROLL_END_EVENT,
|
|
9
|
+
UPDATE_SIZE_EVENT,
|
|
9
10
|
UPDATE_SCROLL_EVENT,
|
|
10
11
|
UPDATE_VIRTUAL_STATE,
|
|
11
12
|
createContainerDriver,
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
children,
|
|
45
46
|
onscroll,
|
|
46
47
|
onscrollend,
|
|
48
|
+
onresize,
|
|
47
49
|
}: Props = $props();
|
|
48
50
|
|
|
49
51
|
const layout = createListLayout(data.length, itemSize, cache);
|
|
@@ -58,6 +60,9 @@
|
|
|
58
60
|
store.$subscribe(UPDATE_SCROLL_END_EVENT, () => {
|
|
59
61
|
onscrollend && onscrollend();
|
|
60
62
|
});
|
|
63
|
+
store.$subscribe(UPDATE_SIZE_EVENT, () => {
|
|
64
|
+
onresize && onresize();
|
|
65
|
+
});
|
|
61
66
|
|
|
62
67
|
let isSSR = $state(!!ssrCount);
|
|
63
68
|
|
|
@@ -153,8 +158,10 @@
|
|
|
153
158
|
)) satisfies VirtualizerHandle["getScrollSize"] as VirtualizerHandle["getScrollSize"];
|
|
154
159
|
export const getViewportSize =
|
|
155
160
|
store.$getViewportSize satisfies VirtualizerHandle["getViewportSize"] as VirtualizerHandle["getViewportSize"];
|
|
156
|
-
export const findItemIndex =
|
|
157
|
-
|
|
161
|
+
export const findItemIndex = ((offset) =>
|
|
162
|
+
layout.$findIndex(
|
|
163
|
+
offset - store.$getStartSpacerSize(),
|
|
164
|
+
)) satisfies VirtualizerHandle["findItemIndex"] as VirtualizerHandle["findItemIndex"];
|
|
158
165
|
export const getItemOffset =
|
|
159
166
|
store.$getItemOffset satisfies VirtualizerHandle["getItemOffset"] as VirtualizerHandle["getItemOffset"];
|
|
160
167
|
export const getItemSize =
|
|
@@ -86,6 +86,10 @@ export interface VirtualizerProps<T> {
|
|
|
86
86
|
* Callback invoked when scrolling stops.
|
|
87
87
|
*/
|
|
88
88
|
onscrollend?: () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
91
|
+
*/
|
|
92
|
+
onresize?: () => void;
|
|
89
93
|
}
|
|
90
94
|
/**
|
|
91
95
|
* Methods of {@link Virtualizer}.
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
type ItemsRange,
|
|
6
6
|
type StateVersion,
|
|
7
7
|
UPDATE_SCROLL_END_EVENT,
|
|
8
|
+
UPDATE_SIZE_EVENT,
|
|
8
9
|
UPDATE_SCROLL_EVENT,
|
|
9
10
|
UPDATE_VIRTUAL_STATE,
|
|
10
11
|
createVirtualStore,
|
|
@@ -34,6 +35,7 @@
|
|
|
34
35
|
children,
|
|
35
36
|
onscroll,
|
|
36
37
|
onscrollend,
|
|
38
|
+
onresize,
|
|
37
39
|
}: Props = $props();
|
|
38
40
|
|
|
39
41
|
const layout = createListLayout(data.length, itemSize, cache);
|
|
@@ -49,6 +51,9 @@
|
|
|
49
51
|
store.$subscribe(UPDATE_SCROLL_END_EVENT, () => {
|
|
50
52
|
onscrollend && onscrollend();
|
|
51
53
|
});
|
|
54
|
+
store.$subscribe(UPDATE_SIZE_EVENT, () => {
|
|
55
|
+
onresize && onresize();
|
|
56
|
+
});
|
|
52
57
|
|
|
53
58
|
let isSSR = $state(!!ssrCount);
|
|
54
59
|
|
|
@@ -112,8 +117,10 @@
|
|
|
112
117
|
store.$getScrollOffset satisfies WindowVirtualizerHandle["getScrollOffset"] as WindowVirtualizerHandle["getScrollOffset"];
|
|
113
118
|
export const getViewportSize =
|
|
114
119
|
store.$getViewportSize satisfies WindowVirtualizerHandle["getViewportSize"] as WindowVirtualizerHandle["getViewportSize"];
|
|
115
|
-
export const findItemIndex =
|
|
116
|
-
|
|
120
|
+
export const findItemIndex = ((offset) =>
|
|
121
|
+
layout.$findIndex(
|
|
122
|
+
offset - store.$getStartSpacerSize(),
|
|
123
|
+
)) satisfies WindowVirtualizerHandle["findItemIndex"] as WindowVirtualizerHandle["findItemIndex"];
|
|
117
124
|
export const getItemOffset =
|
|
118
125
|
store.$getItemOffset satisfies WindowVirtualizerHandle["getItemOffset"] as WindowVirtualizerHandle["getItemOffset"];
|
|
119
126
|
export const getItemSize =
|
|
@@ -57,6 +57,10 @@ export interface WindowVirtualizerProps<T> {
|
|
|
57
57
|
* Callback invoked when scrolling stops.
|
|
58
58
|
*/
|
|
59
59
|
onscrollend?: () => void;
|
|
60
|
+
/**
|
|
61
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
62
|
+
*/
|
|
63
|
+
onresize?: () => void;
|
|
60
64
|
}
|
|
61
65
|
/**
|
|
62
66
|
* Methods of {@link WindowVirtualizer}.
|
package/lib/svelte/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { HTMLAttributes } from 'svelte/elements';
|
|
2
|
-
export type ViewportComponentAttributes = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onscroll" | "onscrollend">;
|
|
2
|
+
export type ViewportComponentAttributes = Omit<HTMLAttributes<HTMLDivElement>, "children" | "onscroll" | "onscrollend" | "onresize">;
|
package/lib/vue/VGrid.d.ts
CHANGED
|
@@ -94,6 +94,10 @@ export interface VGridProps<R = number, C = number> extends PublicProps {
|
|
|
94
94
|
* Callback invoked when scrolling stops.
|
|
95
95
|
*/
|
|
96
96
|
onScrollEnd?: () => void;
|
|
97
|
+
/**
|
|
98
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
99
|
+
*/
|
|
100
|
+
onResize?: () => void;
|
|
97
101
|
}
|
|
98
102
|
/**
|
|
99
103
|
* Methods of {@link VGrid}.
|
package/lib/vue/VList.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export interface VListHandle extends VirtualizerHandle {
|
|
|
8
8
|
/**
|
|
9
9
|
* Props of {@link VList}.
|
|
10
10
|
*/
|
|
11
|
-
export interface VListProps<T = unknown> extends PublicProps, Pick<VirtualizerProps<T>, "data" | "bufferSize" | "itemSize" | "shift" | "horizontal" | "cache" | "ssrCount" | "itemProps" | "onScroll" | "onScrollEnd" | "keepMounted"> {
|
|
11
|
+
export interface VListProps<T = unknown> extends PublicProps, Pick<VirtualizerProps<T>, "data" | "bufferSize" | "itemSize" | "shift" | "horizontal" | "cache" | "ssrCount" | "itemProps" | "onScroll" | "onScrollEnd" | "onResize" | "keepMounted"> {
|
|
12
12
|
}
|
|
13
13
|
interface VListInstance<T = unknown> extends VListHandle {
|
|
14
14
|
$props: VListProps<T>;
|
package/lib/vue/VMasonry.d.ts
CHANGED
|
@@ -95,6 +95,10 @@ export interface VMasonryProps<T> extends PublicProps {
|
|
|
95
95
|
* Callback invoked when scrolling stops.
|
|
96
96
|
*/
|
|
97
97
|
onScrollEnd?: () => void;
|
|
98
|
+
/**
|
|
99
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
100
|
+
*/
|
|
101
|
+
onResize?: () => void;
|
|
98
102
|
}
|
|
99
103
|
interface VMasonryInstance<T> extends VMasonryHandle {
|
|
100
104
|
$props: VMasonryProps<T>;
|
package/lib/vue/Virtualizer.d.ts
CHANGED
|
@@ -78,6 +78,10 @@ export interface VirtualizerProps<T = unknown> extends PublicProps {
|
|
|
78
78
|
* Callback invoked when scrolling stops.
|
|
79
79
|
*/
|
|
80
80
|
onScrollEnd?: () => void;
|
|
81
|
+
/**
|
|
82
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
83
|
+
*/
|
|
84
|
+
onResize?: () => void;
|
|
81
85
|
}
|
|
82
86
|
interface VirtualizerInstance<T = unknown> extends VirtualizerHandle {
|
|
83
87
|
$props: VirtualizerProps<T>;
|
|
@@ -58,6 +58,10 @@ export interface WindowVirtualizerProps<T = unknown> extends PublicProps {
|
|
|
58
58
|
* Callback invoked when scrolling stops.
|
|
59
59
|
*/
|
|
60
60
|
onScrollEnd?: () => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback invoked when the size of the viewport or the items changes.
|
|
63
|
+
*/
|
|
64
|
+
onResize?: () => void;
|
|
61
65
|
}
|
|
62
66
|
interface WindowVirtualizerInstance<T = unknown> extends WindowVirtualizerHandle {
|
|
63
67
|
$props: WindowVirtualizerProps<T>;
|