virtua 0.10.0 → 0.12.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.
@@ -16,7 +16,6 @@ type ListItemProps = {
16
16
  _index: number;
17
17
  _element: "div";
18
18
  _isHorizontal: boolean;
19
- _isRtl: boolean;
20
19
  };
21
- export declare const ListItem: import("react").MemoExoticComponent<({ _children: children, _resizer: resizer, _store: store, _index: index, _element: Element, _isHorizontal: isHorizontal, _isRtl: isRtl, }: ListItemProps) => ReactElement>;
20
+ export declare const ListItem: import("react").MemoExoticComponent<({ _children: children, _resizer: resizer, _store: store, _index: index, _element: Element, _isHorizontal: isHorizontal, }: ListItemProps) => ReactElement>;
22
21
  export {};
@@ -92,10 +92,6 @@ export interface VGridProps extends ViewportComponentAttributes {
92
92
  * If set, the specified amount of cols will be mounted in the initial rendering regardless of the container size. This prop is mostly for SSR.
93
93
  */
94
94
  initialColCount?: number;
95
- /**
96
- * You have to set true if you use this component under `direction: rtl` style.
97
- */
98
- rtl?: boolean;
99
95
  /**
100
96
  * Customized components for advanced usage.
101
97
  */
@@ -3,7 +3,6 @@ import { ViewportComponentAttributes } from "..";
3
3
  import { CustomViewportComponent } from "./Viewport";
4
4
  import { CustomItemComponent } from "./ListItem";
5
5
  import { CacheSnapshot, ScrollToIndexAlign } from "../core/types";
6
- export type ScrollMode = "reverse" | "rtl";
7
6
  type CustomItemComponentOrElement = keyof JSX.IntrinsicElements | CustomItemComponent;
8
7
  /**
9
8
  * Methods of {@link VList}.
@@ -75,12 +74,9 @@ export interface VListProps extends ViewportComponentAttributes {
75
74
  */
76
75
  horizontal?: boolean;
77
76
  /**
78
- * Scroll modes that should be set in certain situations.
79
- *
80
- * - `reverse`: This mode will adjust some styles to be suitable for bottom-to-top scrolling.
81
- * - `rtl`: You have to set this mode if you use this component under `direction: rtl` style.
77
+ * If true, some styles will be adjusted to be suitable for bottom-to-top scrolling.
82
78
  */
83
- mode?: ScrollMode;
79
+ reverse?: boolean;
84
80
  /**
85
81
  * You can restore cache by passing a {@link CacheSnapshot} on mount. This is useful when you want to restore scroll position after navigation. The snapshot can be obtained from {@link VListHandle.cache}.
86
82
  */
@@ -1,5 +1,5 @@
1
1
  export { VList } from "./VList";
2
- export type { VListProps, VListHandle, ScrollMode } from "./VList";
2
+ export type { VListProps, VListHandle } from "./VList";
3
3
  export { VGrid } from "./VGrid";
4
4
  export type { VGridProps, VGridHandle, CustomCellComponent, CustomCellComponentProps, } from "./VGrid";
5
5
  export { WVList } from "./WVList";
@@ -1,4 +1,5 @@
1
1
  import { ReactElement, ReactFragment, ReactNode } from "react";
2
+ import { ScrollDirection } from "../core/store";
2
3
  export declare const refKey = "current";
3
4
  export declare const emptyComponents: {};
4
5
  type ItemElement = ReactElement | ReactFragment | string | number;
@@ -6,4 +7,6 @@ export declare const flattenChildren: (children: ReactNode) => ItemElement[];
6
7
  export type MayHaveKey = {
7
8
  key?: React.Key;
8
9
  };
10
+ export declare const clampStartIndex: (startIndex: number, overscan: number, scrollDirection: ScrollDirection) => number;
11
+ export declare const clampEndIndex: (endIndex: number, overscan: number, scrollDirection: ScrollDirection, count: number) => number;
9
12
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "virtua",
3
- "version": "0.10.0",
3
+ "version": "0.12.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",
@@ -23,6 +23,7 @@
23
23
  "test": "jest --silent",
24
24
  "lint": "eslint 'src/**/*.{js,jsx,ts,tsx}'",
25
25
  "storybook": "storybook dev -p 6006",
26
+ "storybook:rtl": "STORYBOOK_RTL=1 npm run storybook",
26
27
  "storybook:build": "storybook build",
27
28
  "storybook:test": "concurrently -k -s first -n \"SB,TEST\" -c \"magenta,blue\" \"npm run storybook -- --quiet --no-open\" \"wait-on tcp:6006 && test-storybook\"",
28
29
  "e2e": "npx playwright test",
@@ -36,28 +37,28 @@
36
37
  "@dnd-kit/sortable": "7.0.2",
37
38
  "@emotion/react": "11.10.8",
38
39
  "@emotion/styled": "11.10.8",
39
- "@faker-js/faker": "8.0.2",
40
- "@mui/material": "5.14.7",
40
+ "@faker-js/faker": "8.1.0",
41
+ "@mui/material": "5.14.11",
41
42
  "@playwright/test": "^1.37.0",
42
43
  "@radix-ui/colors": "2.1.0",
43
- "@radix-ui/react-scroll-area": "1.0.4",
44
+ "@radix-ui/react-scroll-area": "1.0.5",
44
45
  "@rollup/plugin-babel": "6.0.3",
45
46
  "@rollup/plugin-terser": "0.4.3",
46
- "@rollup/plugin-typescript": "11.1.3",
47
- "@size-limit/preset-small-lib": "^8.2.6",
48
- "@storybook/addon-storysource": "7.2.3",
49
- "@storybook/react": "7.2.3",
50
- "@storybook/react-vite": "^7.2.3",
47
+ "@rollup/plugin-typescript": "11.1.4",
48
+ "@size-limit/preset-small-lib": "^9.0.0",
49
+ "@storybook/addon-storysource": "7.4.5",
50
+ "@storybook/react": "7.4.5",
51
+ "@storybook/react-vite": "^7.4.5",
51
52
  "@storybook/test-runner": "0.13.0",
52
53
  "@tanstack/react-virtual": "3.0.0-alpha.0",
53
54
  "@testing-library/react": "14.0.0",
54
- "@types/react": "18.2.21",
55
+ "@types/react": "18.2.23",
55
56
  "@types/react-beautiful-dnd": "13.1.4",
56
57
  "@types/react-virtualized": "9.21.22",
57
58
  "@types/react-window": "1.8.5",
58
- "@typescript-eslint/parser": "6.3.0",
59
+ "@typescript-eslint/parser": "6.7.4",
59
60
  "concurrently": "8.2.0",
60
- "eslint": "8.47.0",
61
+ "eslint": "8.50.0",
61
62
  "eslint-plugin-react-hooks": "4.6.0",
62
63
  "jest": "29.6.2",
63
64
  "jest-environment-jsdom": "29.6.2",
@@ -72,18 +73,18 @@
72
73
  "react-pull-to-refresh": "2.0.1",
73
74
  "react-select": "5.7.4",
74
75
  "react-virtualized": "9.22.5",
75
- "react-virtuoso": "4.5.0",
76
+ "react-virtuoso": "4.6.0",
76
77
  "react-window": "1.8.9",
77
78
  "rimraf": "5.0.1",
78
- "rollup": "3.28.0",
79
+ "rollup": "3.29.4",
79
80
  "rollup-plugin-banner2": "1.2.2",
80
- "size-limit": "^8.2.6",
81
- "storybook": "^7.2.3",
81
+ "size-limit": "^9.0.0",
82
+ "storybook": "^7.4.5",
82
83
  "ts-jest": "29.1.1",
83
84
  "typedoc": "0.24.8",
84
85
  "typedoc-plugin-markdown": "3.15.4",
85
86
  "typescript": "5.1.6",
86
- "virtua": "^0.7.0",
87
+ "virtua": "^0.11.0",
87
88
  "vite": "4.4.9",
88
89
  "wait-on": "7.0.1"
89
90
  },