virtua 0.5.0 → 0.6.1
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 +2 -2
- package/lib/core/cache.d.ts +1 -2
- package/lib/core/store.d.ts +2 -1
- package/lib/index.d.ts +1 -8
- package/lib/index.js +1 -1
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +1 -1
- package/lib/index.mjs.map +1 -1
- package/lib/react/VGrid.d.ts +15 -10
- package/lib/react/VList.d.ts +17 -12
- package/lib/react/{Window.d.ts → Viewport.d.ts} +5 -5
- package/lib/react/WVList.d.ts +16 -11
- package/lib/react/index.d.ts +8 -0
- package/lib/react/useLatestRef.d.ts +2 -0
- package/lib/react/utils.d.ts +1 -0
- package/package.json +11 -11
- package/lib/react/useRefWithUpdate.d.ts +0 -2
package/lib/react/VGrid.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CSSProperties, ReactNode } from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { CustomViewportComponent, ViewportComponentAttributes } from "..";
|
|
3
3
|
/**
|
|
4
4
|
* Props of customized cell component for {@link VGrid}.
|
|
5
5
|
*/
|
|
@@ -47,7 +47,7 @@ export interface VGridHandle {
|
|
|
47
47
|
/**
|
|
48
48
|
* Props of {@link VGrid}.
|
|
49
49
|
*/
|
|
50
|
-
export interface VGridProps extends
|
|
50
|
+
export interface VGridProps extends ViewportComponentAttributes {
|
|
51
51
|
/**
|
|
52
52
|
* A function to create elements rendered by this component.
|
|
53
53
|
*/
|
|
@@ -97,15 +97,20 @@ export interface VGridProps extends WindowComponentAttributes {
|
|
|
97
97
|
*/
|
|
98
98
|
rtl?: boolean;
|
|
99
99
|
/**
|
|
100
|
-
* Customized
|
|
101
|
-
* @defaultValue {@link Window}
|
|
100
|
+
* Customized components for advanced usage.
|
|
102
101
|
*/
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
102
|
+
components?: {
|
|
103
|
+
/**
|
|
104
|
+
* Component for scrollable element. This component will get {@link CustomViewportComponentProps} as props.
|
|
105
|
+
* @defaultValue {@link DefaultViewport}
|
|
106
|
+
*/
|
|
107
|
+
Root?: CustomViewportComponent;
|
|
108
|
+
/**
|
|
109
|
+
* Component or element type for cell element. This component will get {@link CustomCellComponentProps} as props.
|
|
110
|
+
* @defaultValue "div"
|
|
111
|
+
*/
|
|
112
|
+
Cell?: CustomCellComponentOrElement;
|
|
113
|
+
};
|
|
109
114
|
}
|
|
110
115
|
/**
|
|
111
116
|
* Virtualized grid component. See {@link VGridProps} and {@link VGridHandle}.
|
package/lib/react/VList.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { ViewportComponentAttributes } from "..";
|
|
3
|
+
import { CustomViewportComponent } from "./Viewport";
|
|
4
4
|
import { CustomItemComponent } from "./ListItem";
|
|
5
5
|
import { CacheSnapshot } from "../core/types";
|
|
6
6
|
export type ScrollMode = "reverse" | "rtl";
|
|
@@ -44,7 +44,7 @@ export interface VListHandle {
|
|
|
44
44
|
/**
|
|
45
45
|
* Props of {@link VList}.
|
|
46
46
|
*/
|
|
47
|
-
export interface VListProps extends
|
|
47
|
+
export interface VListProps extends ViewportComponentAttributes {
|
|
48
48
|
/**
|
|
49
49
|
* Elements rendered by this component.
|
|
50
50
|
*/
|
|
@@ -81,15 +81,20 @@ export interface VListProps extends WindowComponentAttributes {
|
|
|
81
81
|
*/
|
|
82
82
|
cache?: CacheSnapshot;
|
|
83
83
|
/**
|
|
84
|
-
* Customized
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
84
|
+
* Customized components for advanced usage.
|
|
85
|
+
*/
|
|
86
|
+
components?: {
|
|
87
|
+
/**
|
|
88
|
+
* Component for scrollable element. This component will get {@link CustomViewportComponentProps} as props.
|
|
89
|
+
* @defaultValue {@link DefaultViewport}
|
|
90
|
+
*/
|
|
91
|
+
Root?: CustomViewportComponent;
|
|
92
|
+
/**
|
|
93
|
+
* Component or element type for item element. This component will get {@link CustomItemComponentProps} as props.
|
|
94
|
+
* @defaultValue "div"
|
|
95
|
+
*/
|
|
96
|
+
Item?: CustomItemComponentOrElement;
|
|
97
|
+
};
|
|
93
98
|
/**
|
|
94
99
|
* Callback invoked whenever scroll offset changes.
|
|
95
100
|
* @param offset Current scrollTop or scrollLeft.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
export type
|
|
2
|
+
export type ViewportComponentAttributes = Pick<React.HTMLAttributes<HTMLElement>, "className" | "style" | "id" | "role" | "tabIndex"> & React.AriaAttributes;
|
|
3
3
|
/**
|
|
4
4
|
* Props of customized scrollable component.
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface CustomViewportComponentProps {
|
|
7
7
|
/**
|
|
8
8
|
* Renderable item elements.
|
|
9
9
|
*/
|
|
@@ -11,7 +11,7 @@ export interface CustomWindowComponentProps {
|
|
|
11
11
|
/**
|
|
12
12
|
* Attributes that should be passed to the scrollable element.
|
|
13
13
|
*/
|
|
14
|
-
attrs:
|
|
14
|
+
attrs: ViewportComponentAttributes;
|
|
15
15
|
/**
|
|
16
16
|
* Total height of items. It's undefined if component is not vertically scrollable.
|
|
17
17
|
*/
|
|
@@ -25,5 +25,5 @@ export interface CustomWindowComponentProps {
|
|
|
25
25
|
*/
|
|
26
26
|
scrolling: boolean;
|
|
27
27
|
}
|
|
28
|
-
export declare const
|
|
29
|
-
export type
|
|
28
|
+
export declare const Viewport: import("react").ForwardRefExoticComponent<CustomViewportComponentProps & import("react").RefAttributes<any>>;
|
|
29
|
+
export type CustomViewportComponent = typeof Viewport;
|
package/lib/react/WVList.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from "react";
|
|
2
|
-
import { CacheSnapshot,
|
|
3
|
-
import {
|
|
2
|
+
import { CacheSnapshot, ViewportComponentAttributes } from "..";
|
|
3
|
+
import { CustomViewportComponent } from "./Viewport";
|
|
4
4
|
import { CustomItemComponent } from "./ListItem";
|
|
5
5
|
type CustomItemComponentOrElement = keyof JSX.IntrinsicElements | CustomItemComponent;
|
|
6
6
|
/**
|
|
@@ -15,7 +15,7 @@ export interface WVListHandle {
|
|
|
15
15
|
/**
|
|
16
16
|
* Props of {@link WVList}.
|
|
17
17
|
*/
|
|
18
|
-
export interface WVListProps extends
|
|
18
|
+
export interface WVListProps extends ViewportComponentAttributes {
|
|
19
19
|
/**
|
|
20
20
|
* Elements rendered by this component.
|
|
21
21
|
*/
|
|
@@ -45,15 +45,20 @@ export interface WVListProps extends WindowComponentAttributes {
|
|
|
45
45
|
*/
|
|
46
46
|
cache?: CacheSnapshot;
|
|
47
47
|
/**
|
|
48
|
-
* Customized
|
|
49
|
-
* @defaultValue {@link Window}
|
|
48
|
+
* Customized components for advanced usage.
|
|
50
49
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
50
|
+
components?: {
|
|
51
|
+
/**
|
|
52
|
+
* Component for scrollable element. This component will get {@link CustomViewportComponentProps} as props.
|
|
53
|
+
* @defaultValue {@link DefaultViewport}
|
|
54
|
+
*/
|
|
55
|
+
Root?: CustomViewportComponent;
|
|
56
|
+
/**
|
|
57
|
+
* Component or element type for item element. This component will get {@link CustomItemComponentProps} as props.
|
|
58
|
+
* @defaultValue "div"
|
|
59
|
+
*/
|
|
60
|
+
Item?: CustomItemComponentOrElement;
|
|
61
|
+
};
|
|
57
62
|
/**
|
|
58
63
|
* Callback invoked when scrolling stops.
|
|
59
64
|
*/
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { VList } from "./VList";
|
|
2
|
+
export type { VListProps, VListHandle, ScrollMode } from "./VList";
|
|
3
|
+
export { VGrid } from "./VGrid";
|
|
4
|
+
export type { VGridProps, VGridHandle, CustomCellComponent, CustomCellComponentProps, } from "./VGrid";
|
|
5
|
+
export { WVList } from "./WVList";
|
|
6
|
+
export type { WVListProps, WVListHandle } from "./WVList";
|
|
7
|
+
export type { ViewportComponentAttributes, CustomViewportComponent, CustomViewportComponentProps, } from "./Viewport";
|
|
8
|
+
export type { CustomItemComponent, CustomItemComponentProps } from "./ListItem";
|
package/lib/react/utils.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ReactElement, ReactFragment, ReactNode } from "react";
|
|
2
2
|
export declare const refKey = "current";
|
|
3
|
+
export declare const emptyComponents: {};
|
|
3
4
|
export declare const flattenChildren: (children: ReactNode) => (string | number | ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactFragment)[];
|
|
4
5
|
export type MayHaveKey = {
|
|
5
6
|
key?: React.Key;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "virtua",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"description": "A zero-config, fast and small (~3kB) virtual list and grid component for React.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.mjs",
|
|
@@ -29,24 +29,24 @@
|
|
|
29
29
|
"@emotion/react": "11.10.8",
|
|
30
30
|
"@emotion/styled": "11.10.8",
|
|
31
31
|
"@faker-js/faker": "8.0.2",
|
|
32
|
-
"@mui/material": "5.
|
|
32
|
+
"@mui/material": "5.14.2",
|
|
33
33
|
"@playwright/test": "^1.36.2",
|
|
34
34
|
"@rollup/plugin-babel": "6.0.3",
|
|
35
35
|
"@rollup/plugin-terser": "0.4.3",
|
|
36
36
|
"@rollup/plugin-typescript": "11.1.2",
|
|
37
37
|
"@size-limit/preset-small-lib": "^8.2.6",
|
|
38
|
-
"@storybook/addon-storysource": "7.
|
|
39
|
-
"@storybook/react": "7.
|
|
40
|
-
"@storybook/react-vite": "^7.
|
|
38
|
+
"@storybook/addon-storysource": "7.2.0",
|
|
39
|
+
"@storybook/react": "7.2.0",
|
|
40
|
+
"@storybook/react-vite": "^7.2.0",
|
|
41
41
|
"@storybook/test-runner": "0.12.0",
|
|
42
42
|
"@tanstack/react-virtual": "3.0.0-alpha.0",
|
|
43
43
|
"@testing-library/react": "14.0.0",
|
|
44
|
-
"@types/react": "18.2.
|
|
44
|
+
"@types/react": "18.2.18",
|
|
45
45
|
"@types/react-virtualized": "9.21.22",
|
|
46
46
|
"@types/react-window": "1.8.5",
|
|
47
47
|
"@typescript-eslint/parser": "6.2.0",
|
|
48
48
|
"concurrently": "8.2.0",
|
|
49
|
-
"eslint": "8.
|
|
49
|
+
"eslint": "8.46.0",
|
|
50
50
|
"eslint-plugin-react-hooks": "4.6.0",
|
|
51
51
|
"jest": "29.6.1",
|
|
52
52
|
"jest-environment-jsdom": "29.6.1",
|
|
@@ -63,16 +63,16 @@
|
|
|
63
63
|
"react-virtuoso": "4.4.2",
|
|
64
64
|
"react-window": "1.8.9",
|
|
65
65
|
"rimraf": "5.0.1",
|
|
66
|
-
"rollup": "3.
|
|
66
|
+
"rollup": "3.27.0",
|
|
67
67
|
"rollup-plugin-banner2": "1.2.2",
|
|
68
68
|
"size-limit": "^8.2.6",
|
|
69
|
-
"storybook": "^7.
|
|
69
|
+
"storybook": "^7.2.0",
|
|
70
70
|
"ts-jest": "29.1.1",
|
|
71
71
|
"typedoc": "0.24.8",
|
|
72
72
|
"typedoc-plugin-markdown": "3.15.4",
|
|
73
73
|
"typescript": "5.1.6",
|
|
74
|
-
"virtua": "^0.
|
|
75
|
-
"vite": "4.4.
|
|
74
|
+
"virtua": "^0.6.0",
|
|
75
|
+
"vite": "4.4.8",
|
|
76
76
|
"wait-on": "7.0.1"
|
|
77
77
|
},
|
|
78
78
|
"peerDependencies": {
|