virtua 0.49.2 → 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.
- package/README.md +39 -5
- package/lib/angular/ListItem.d.ts +1 -0
- package/lib/angular/VList.d.ts +85 -0
- package/lib/angular/Virtualizer.d.ts +141 -0
- package/lib/angular/WindowVirtualizer.d.ts +103 -0
- package/lib/angular/index.d.ts +6 -0
- package/lib/angular/index.js +1148 -0
- package/lib/angular/index.js.map +1 -0
- package/lib/angular/utils.d.ts +19 -0
- package/lib/core/index.cjs +237 -233
- package/lib/core/index.cjs.map +1 -1
- package/lib/core/index.d.ts +6 -6
- package/lib/core/index.js +272 -272
- package/lib/core/index.js.map +1 -1
- package/lib/index.cjs +529 -499
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/index.js +321 -315
- package/lib/index.js.map +1 -1
- package/lib/react/VGrid.d.ts +2 -2
- package/lib/react/VList.d.ts +3 -3
- package/lib/react/Virtualizer.d.ts +3 -3
- package/lib/react/WindowVirtualizer.d.ts +3 -3
- package/lib/react/index.d.ts +9 -9
- package/lib/react/types.d.ts +1 -1
- package/lib/solid/VList.d.ts +3 -6
- package/lib/solid/Virtualizer.d.ts +2 -5
- package/lib/solid/WindowVirtualizer.d.ts +2 -5
- package/lib/solid/index.cjs +331 -323
- package/lib/solid/index.cjs.map +1 -1
- package/lib/solid/index.d.ts +7 -7
- package/lib/solid/index.js +249 -257
- package/lib/solid/index.js.map +1 -1
- package/lib/solid/index.jsx +1224 -1566
- package/lib/solid/index.jsx.map +1 -1
- package/lib/solid/types.d.ts +1 -1
- package/lib/svelte/ListItem.svelte +12 -2
- package/lib/svelte/VList.svelte +2 -0
- package/lib/svelte/VList.type.d.ts +3 -3
- package/lib/svelte/Virtualizer.svelte +2 -0
- package/lib/svelte/Virtualizer.type.d.ts +8 -3
- package/lib/svelte/WindowVirtualizer.type.d.ts +2 -2
- package/lib/svelte/index.d.ts +6 -6
- package/lib/svelte/index.js +4 -4
- package/lib/svelte/types.d.ts +1 -1
- package/lib/svelte/utils.d.ts +7 -0
- package/lib/svelte/utils.js +11 -11
- package/lib/svelte/utils.js.map +1 -1
- package/lib/vue/VList.d.ts +2 -3
- package/lib/vue/Virtualizer.d.ts +3 -4
- package/lib/vue/WindowVirtualizer.d.ts +2 -3
- package/lib/vue/index.cjs +327 -317
- package/lib/vue/index.cjs.map +1 -1
- package/lib/vue/index.d.ts +6 -6
- package/lib/vue/index.js +284 -284
- package/lib/vue/index.js.map +1 -1
- package/lib/vue/utils.d.ts +1 -1
- package/package.json +40 -17
- package/lib/svelte/index.js.map +0 -1
package/lib/svelte/VList.svelte
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { ViewportComponentAttributes } from './types.js';
|
|
2
|
+
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">, ViewportComponentAttributes {
|
|
6
|
+
export interface VListProps<T> extends Pick<VirtualizerProps<T>, "data" | "getKey" | "bufferSize" | "itemSize" | "ssrCount" | "shift" | "horizontal" | "children" | "onscroll" | "onscrollend" | "keepMounted" | "cache" | "itemProps">, ViewportComponentAttributes {
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Methods of {@link VList}.
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
getKey = defaultGetKey,
|
|
28
28
|
as = "div",
|
|
29
29
|
item: itemAs,
|
|
30
|
+
itemProps,
|
|
30
31
|
scrollRef,
|
|
31
32
|
bufferSize,
|
|
32
33
|
itemSize,
|
|
@@ -187,6 +188,7 @@
|
|
|
187
188
|
hide={stateVersion && store.$isUnmeasuredItem(index)}
|
|
188
189
|
{horizontal}
|
|
189
190
|
resizer={resizer.$observeItem}
|
|
191
|
+
itemProps={itemProps?.({ item, index })}
|
|
190
192
|
/>
|
|
191
193
|
{/each}
|
|
192
194
|
</svelte:element>
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
1
|
+
import { Snippet } from 'svelte';
|
|
2
|
+
import { SvelteHTMLElements } from 'svelte/elements';
|
|
3
|
+
import { CacheSnapshot, ScrollToIndexOpts } from '../core/index.js';
|
|
4
|
+
import { ItemProps } from './utils.js';
|
|
4
5
|
/**
|
|
5
6
|
* Props of {@link Virtualizer}.
|
|
6
7
|
*/
|
|
@@ -28,6 +29,10 @@ export interface VirtualizerProps<T> {
|
|
|
28
29
|
* @defaultValue "div"
|
|
29
30
|
*/
|
|
30
31
|
item?: keyof SvelteHTMLElements;
|
|
32
|
+
/**
|
|
33
|
+
* A function that provides properties/attributes for item element
|
|
34
|
+
*/
|
|
35
|
+
itemProps?: ItemProps<T>;
|
|
31
36
|
/**
|
|
32
37
|
* 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.
|
|
33
38
|
* @defaultValue 200
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { Snippet } from 'svelte';
|
|
2
|
+
import { CacheSnapshot, ScrollToIndexOpts } from '../core/index.js';
|
|
3
3
|
/**
|
|
4
4
|
* Props of {@link WindowVirtualizer}.
|
|
5
5
|
*/
|
package/lib/svelte/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @module svelte
|
|
3
3
|
*/
|
|
4
|
-
export { default as VList } from
|
|
5
|
-
export type { VListProps, VListHandle } from
|
|
6
|
-
export { default as Virtualizer } from
|
|
7
|
-
export type { VirtualizerProps, VirtualizerHandle, } from
|
|
8
|
-
export { default as WindowVirtualizer } from
|
|
9
|
-
export type { WindowVirtualizerProps } from
|
|
4
|
+
export { default as VList } from './VList.svelte';
|
|
5
|
+
export type { VListProps, VListHandle } from './VList.type.js';
|
|
6
|
+
export { default as Virtualizer } from './Virtualizer.svelte';
|
|
7
|
+
export type { VirtualizerProps, VirtualizerHandle, } from './Virtualizer.type.js';
|
|
8
|
+
export { default as WindowVirtualizer } from './WindowVirtualizer.svelte';
|
|
9
|
+
export type { WindowVirtualizerProps } from './WindowVirtualizer.type.js';
|
package/lib/svelte/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import VList from "./VList.svelte";
|
|
2
|
+
import Virtualizer from "./Virtualizer.svelte";
|
|
3
|
+
import WindowVirtualizer from "./WindowVirtualizer.svelte";
|
|
4
|
+
export { VList, Virtualizer, WindowVirtualizer };
|
package/lib/svelte/types.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { HTMLAttributes, AriaAttributes } from 'svelte/elements';
|
|
2
2
|
export type ViewportComponentAttributes = Pick<HTMLAttributes<HTMLElement>, "class" | "style" | "id" | "role" | "tabindex"> & AriaAttributes;
|
package/lib/svelte/utils.d.ts
CHANGED
|
@@ -1,2 +1,9 @@
|
|
|
1
1
|
export declare const styleToString: (obj: Record<string, string | undefined>) => string;
|
|
2
2
|
export declare const defaultGetKey: (_data: unknown, i: number) => string;
|
|
3
|
+
/**
|
|
4
|
+
* A function that provides properties/attributes for item element
|
|
5
|
+
*/
|
|
6
|
+
export type ItemProps<T = unknown> = (payload: {
|
|
7
|
+
item: T;
|
|
8
|
+
index: number;
|
|
9
|
+
}) => ItemAttrs | undefined;
|
package/lib/svelte/utils.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}, "");
|
|
1
|
+
//#region src/svelte/utils.ts
|
|
2
|
+
var styleToString = (obj) => {
|
|
3
|
+
return Object.keys(obj).reduce((acc, k) => {
|
|
4
|
+
const value = obj[k];
|
|
5
|
+
if (value == null) return acc;
|
|
6
|
+
return acc + `${k}:${value};`;
|
|
7
|
+
}, "");
|
|
9
8
|
};
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
var defaultGetKey = (_data, i) => "_" + i;
|
|
10
|
+
//#endregion
|
|
12
11
|
export { defaultGetKey, styleToString };
|
|
13
|
-
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=utils.js.map
|
package/lib/svelte/utils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["
|
|
1
|
+
{"version":3,"file":"utils.js","names":[],"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\n/**\n * @internal\n */\nexport type ItemAttrs = {\n [key: string]: any;\n style?: Record<string, string | undefined>;\n class?: string;\n};\n\n/**\n * A function that provides properties/attributes for item element\n */\nexport type ItemProps<T = unknown> = (payload: {\n item: T;\n index: number;\n}) => ItemAttrs | undefined;\n"],"mappings":";AAAA,IAAa,iBACX,QACW;CACX,OAAO,OAAO,KAAK,GAAG,EAAE,QAAQ,KAAK,MAAM;EACzC,MAAM,QAAQ,IAAI;EAClB,IAAI,SAAS,MACX,OAAO;EAET,OAAO,MAAM,GAAG,EAAE,GAAG,MAAM;CAC7B,GAAG,EAAE;AACP;AAEA,IAAa,iBAAiB,OAAgB,MAAc,MAAM"}
|
package/lib/vue/VList.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { VirtualizerProps, type VirtualizerHandle } from "./Virtualizer.js";
|
|
1
|
+
import { VNode, PublicProps } from 'vue';
|
|
2
|
+
import { VirtualizerProps, VirtualizerHandle } from './Virtualizer.js';
|
|
4
3
|
/**
|
|
5
4
|
* Methods of {@link VList}.
|
|
6
5
|
*/
|
package/lib/vue/Virtualizer.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { type ItemProps } from "./utils.js";
|
|
1
|
+
import { VNode, PublicProps, NativeElements } from 'vue';
|
|
2
|
+
import { ScrollToIndexOpts, CacheSnapshot } from '../core/index.js';
|
|
3
|
+
import { ItemProps } from './utils.js';
|
|
5
4
|
/**
|
|
6
5
|
* Props of {@link Virtualizer}.
|
|
7
6
|
*/
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { type ScrollToIndexOpts, type CacheSnapshot } from "../core/index.js";
|
|
1
|
+
import { VNode, NativeElements, PublicProps } from 'vue';
|
|
2
|
+
import { ScrollToIndexOpts, CacheSnapshot } from '../core/index.js';
|
|
4
3
|
/**
|
|
5
4
|
* Props of {@link WindowVirtualizer}.
|
|
6
5
|
*/
|