virtua 0.48.3 → 0.48.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/lib/core/index.cjs.map +1 -1
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs.map +1 -1
- package/lib/index.js.map +1 -1
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx.map +1 -1
- package/lib/svelte/VList.svelte +8 -6
- package/lib/svelte/VList.type.d.ts +1 -1
- package/lib/svelte/Virtualizer.svelte +5 -4
- package/lib/svelte/Virtualizer.type.d.ts +4 -0
- package/lib/svelte/WindowVirtualizer.svelte +2 -2
- package/lib/svelte/utils.js.map +1 -1
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.js.map +1 -1
- package/package.json +6 -2
package/lib/svelte/VList.svelte
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
getKey,
|
|
11
11
|
bufferSize,
|
|
12
12
|
itemSize,
|
|
13
|
+
ssrCount,
|
|
13
14
|
shift,
|
|
14
15
|
horizontal,
|
|
15
16
|
keepMounted,
|
|
@@ -32,27 +33,27 @@
|
|
|
32
33
|
ref.getViewportSize()) satisfies VListHandle["getViewportSize"] as VListHandle["getViewportSize"];
|
|
33
34
|
export const findItemIndex = ((...args) =>
|
|
34
35
|
ref.findItemIndex(
|
|
35
|
-
...args
|
|
36
|
+
...args,
|
|
36
37
|
)) satisfies VListHandle["findItemIndex"] as VListHandle["findItemIndex"];
|
|
37
38
|
export const getItemOffset = ((...args) =>
|
|
38
39
|
ref.getItemOffset(
|
|
39
|
-
...args
|
|
40
|
+
...args,
|
|
40
41
|
)) satisfies VListHandle["getItemOffset"] as VListHandle["getItemOffset"];
|
|
41
42
|
export const getItemSize = ((...args) =>
|
|
42
43
|
ref.getItemSize(
|
|
43
|
-
...args
|
|
44
|
+
...args,
|
|
44
45
|
)) satisfies VListHandle["getItemSize"] as VListHandle["getItemSize"];
|
|
45
46
|
export const scrollToIndex = ((...args) =>
|
|
46
47
|
ref.scrollToIndex(
|
|
47
|
-
...args
|
|
48
|
+
...args,
|
|
48
49
|
)) satisfies VListHandle["scrollToIndex"] as VListHandle["scrollToIndex"];
|
|
49
50
|
export const scrollTo = ((...args) =>
|
|
50
51
|
ref.scrollTo(
|
|
51
|
-
...args
|
|
52
|
+
...args,
|
|
52
53
|
)) satisfies VListHandle["scrollTo"] as VListHandle["scrollTo"];
|
|
53
54
|
export const scrollBy = ((...args) =>
|
|
54
55
|
ref.scrollBy(
|
|
55
|
-
...args
|
|
56
|
+
...args,
|
|
56
57
|
)) satisfies VListHandle["scrollBy"] as VListHandle["scrollBy"];
|
|
57
58
|
|
|
58
59
|
const viewportStyle = styleToString({
|
|
@@ -76,6 +77,7 @@
|
|
|
76
77
|
{getKey}
|
|
77
78
|
{bufferSize}
|
|
78
79
|
{itemSize}
|
|
80
|
+
{ssrCount}
|
|
79
81
|
{shift}
|
|
80
82
|
{horizontal}
|
|
81
83
|
{keepMounted}
|
|
@@ -3,7 +3,7 @@ import type { 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" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted" | "cache">, ViewportComponentAttributes {
|
|
6
|
+
export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "ssrCount" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted" | "cache">, ViewportComponentAttributes {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Methods of {@link VList}.
|
|
@@ -30,6 +30,7 @@
|
|
|
30
30
|
scrollRef,
|
|
31
31
|
bufferSize,
|
|
32
32
|
itemSize,
|
|
33
|
+
ssrCount,
|
|
33
34
|
shift = false,
|
|
34
35
|
horizontal = false,
|
|
35
36
|
keepMounted,
|
|
@@ -43,9 +44,9 @@
|
|
|
43
44
|
const store = createVirtualStore(
|
|
44
45
|
data.length,
|
|
45
46
|
itemSize,
|
|
46
|
-
|
|
47
|
+
ssrCount,
|
|
47
48
|
cache,
|
|
48
|
-
!itemSize
|
|
49
|
+
!itemSize,
|
|
49
50
|
);
|
|
50
51
|
const resizer = createResizer(store, horizontal);
|
|
51
52
|
const scroller = createScroller(store, horizontal);
|
|
@@ -133,7 +134,7 @@
|
|
|
133
134
|
store.$getScrollOffset satisfies VirtualizerHandle["getScrollOffset"] as VirtualizerHandle["getScrollOffset"];
|
|
134
135
|
export const getScrollSize = (() =>
|
|
135
136
|
_getScrollSize(
|
|
136
|
-
store
|
|
137
|
+
store,
|
|
137
138
|
)) satisfies VirtualizerHandle["getScrollSize"] as VirtualizerHandle["getScrollSize"];
|
|
138
139
|
export const getViewportSize =
|
|
139
140
|
store.$getViewportSize satisfies VirtualizerHandle["getViewportSize"] as VirtualizerHandle["getViewportSize"];
|
|
@@ -159,7 +160,7 @@
|
|
|
159
160
|
width: horizontal ? totalSize + "px" : "100%",
|
|
160
161
|
height: horizontal ? "100%" : totalSize + "px",
|
|
161
162
|
"pointer-events": isScrolling ? "none" : undefined,
|
|
162
|
-
})
|
|
163
|
+
}),
|
|
163
164
|
);
|
|
164
165
|
</script>
|
|
165
166
|
|
|
@@ -44,6 +44,10 @@ export interface VirtualizerProps<T> {
|
|
|
44
44
|
* - If set, you can opt out estimation and use the value as initial item size.
|
|
45
45
|
*/
|
|
46
46
|
itemSize?: number;
|
|
47
|
+
/**
|
|
48
|
+
* 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.
|
|
49
|
+
*/
|
|
50
|
+
ssrCount?: number;
|
|
47
51
|
/**
|
|
48
52
|
* 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.
|
|
49
53
|
*/
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
itemSize,
|
|
39
39
|
undefined,
|
|
40
40
|
cache,
|
|
41
|
-
!itemSize
|
|
41
|
+
!itemSize,
|
|
42
42
|
);
|
|
43
43
|
const resizer = createWindowResizer(store, horizontal);
|
|
44
44
|
const scroller = createWindowScroller(store, horizontal);
|
|
@@ -118,7 +118,7 @@
|
|
|
118
118
|
width: horizontal ? totalSize + "px" : "100%",
|
|
119
119
|
height: horizontal ? "100%" : totalSize + "px",
|
|
120
120
|
"pointer-events": isScrolling ? "none" : undefined,
|
|
121
|
-
})
|
|
121
|
+
}),
|
|
122
122
|
);
|
|
123
123
|
</script>
|
|
124
124
|
|
package/lib/svelte/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../src/svelte/utils.ts"],"sourcesContent":["export const styleToString = (\n obj: Record<string, string | undefined
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../src/svelte/utils.ts"],"sourcesContent":["export const styleToString = (\n obj: Record<string, string | undefined>,\n): string => {\n return Object.keys(obj).reduce((acc, k) => {\n const value = obj[k];\n if (value == null) {\n return acc;\n }\n return acc + `${k}:${value};`;\n }, \"\");\n};\n\nexport const defaultGetKey = (_data: unknown, i: number) => \"_\" + i;\n"],"names":[],"mappings":"AAAO,MAAM,aAAa,GAAG,CAC3B,GAAuC,KAC7B;AACV,IAAA,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,KAAI;AACxC,QAAA,MAAM,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC;AACpB,QAAA,IAAI,KAAK,IAAI,IAAI,EAAE;AACjB,YAAA,OAAO,GAAG;QACZ;AACA,QAAA,OAAO,GAAG,GAAG,CAAA,EAAG,CAAC,CAAA,CAAA,EAAI,KAAK,GAAG;IAC/B,CAAC,EAAE,EAAE,CAAC;AACR;AAEO,MAAM,aAAa,GAAG,CAAC,KAAc,EAAE,CAAS,KAAK,GAAG,GAAG;;;;"}
|