virtua 0.6.0 → 0.7.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.
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
2
2
  import { ViewportComponentAttributes } from "..";
3
3
  import { CustomViewportComponent } from "./Viewport";
4
4
  import { CustomItemComponent } from "./ListItem";
5
- import { CacheSnapshot } from "../core/types";
5
+ import { CacheSnapshot, ScrollToIndexAlign } from "../core/types";
6
6
  export type ScrollMode = "reverse" | "rtl";
7
7
  type CustomItemComponentOrElement = keyof JSX.IntrinsicElements | CustomItemComponent;
8
8
  /**
@@ -28,8 +28,9 @@ export interface VListHandle {
28
28
  /**
29
29
  * Scroll to the item specified by index.
30
30
  * @param index index of item
31
+ * @param align alignment of item
31
32
  */
32
- scrollToIndex(index: number): void;
33
+ scrollToIndex(index: number, align?: ScrollToIndexAlign): void;
33
34
  /**
34
35
  * Scroll to the given offset.
35
36
  * @param offset offset from start
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const useLatestRef: <T>(value: T) => import("react").MutableRefObject<T>;
@@ -1,7 +1,9 @@
1
1
  import { ReactElement, ReactFragment, ReactNode } from "react";
2
2
  export declare const refKey = "current";
3
3
  export declare const emptyComponents: {};
4
- export declare const flattenChildren: (children: ReactNode) => (string | number | ReactElement<any, string | import("react").JSXElementConstructor<any>> | ReactFragment)[];
4
+ type ItemElement = ReactElement | ReactFragment | string | number;
5
+ export declare const flattenChildren: (children: ReactNode) => ItemElement[];
5
6
  export type MayHaveKey = {
6
7
  key?: React.Key;
7
8
  };
9
+ export {};
package/package.json CHANGED
@@ -1,10 +1,18 @@
1
1
  {
2
2
  "name": "virtua",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
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",
7
7
  "types": "lib/index.d.ts",
8
+ "exports": {
9
+ "./package.json": "./package.json",
10
+ ".": {
11
+ "types": "./lib/index.d.ts",
12
+ "import": "./lib/index.mjs",
13
+ "default": "./lib/index.js"
14
+ }
15
+ },
8
16
  "files": [
9
17
  "lib"
10
18
  ],
@@ -35,18 +43,18 @@
35
43
  "@rollup/plugin-terser": "0.4.3",
36
44
  "@rollup/plugin-typescript": "11.1.2",
37
45
  "@size-limit/preset-small-lib": "^8.2.6",
38
- "@storybook/addon-storysource": "7.1.1",
39
- "@storybook/react": "7.1.1",
40
- "@storybook/react-vite": "^7.1.1",
46
+ "@storybook/addon-storysource": "7.2.0",
47
+ "@storybook/react": "7.2.0",
48
+ "@storybook/react-vite": "^7.2.0",
41
49
  "@storybook/test-runner": "0.12.0",
42
50
  "@tanstack/react-virtual": "3.0.0-alpha.0",
43
51
  "@testing-library/react": "14.0.0",
44
- "@types/react": "18.2.17",
52
+ "@types/react": "18.2.18",
45
53
  "@types/react-virtualized": "9.21.22",
46
54
  "@types/react-window": "1.8.5",
47
55
  "@typescript-eslint/parser": "6.2.0",
48
56
  "concurrently": "8.2.0",
49
- "eslint": "8.45.0",
57
+ "eslint": "8.46.0",
50
58
  "eslint-plugin-react-hooks": "4.6.0",
51
59
  "jest": "29.6.1",
52
60
  "jest-environment-jsdom": "29.6.1",
@@ -63,16 +71,16 @@
63
71
  "react-virtuoso": "4.4.2",
64
72
  "react-window": "1.8.9",
65
73
  "rimraf": "5.0.1",
66
- "rollup": "3.26.3",
74
+ "rollup": "3.27.0",
67
75
  "rollup-plugin-banner2": "1.2.2",
68
76
  "size-limit": "^8.2.6",
69
- "storybook": "^7.1.1",
77
+ "storybook": "^7.2.0",
70
78
  "ts-jest": "29.1.1",
71
79
  "typedoc": "0.24.8",
72
80
  "typedoc-plugin-markdown": "3.15.4",
73
81
  "typescript": "5.1.6",
74
- "virtua": "^0.4.5",
75
- "vite": "4.4.7",
82
+ "virtua": "^0.6.0",
83
+ "vite": "4.4.8",
76
84
  "wait-on": "7.0.1"
77
85
  },
78
86
  "peerDependencies": {
@@ -1,2 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const useRefWithUpdate: <T>(value: T) => import("react").MutableRefObject<T>;