virtua 0.52.0 → 0.52.2

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.
@@ -3,13 +3,13 @@
3
3
  import {
4
4
  type GridCellState,
5
5
  type GridDriver,
6
- type VGridCell,
6
+ type GridCell,
7
7
  gridStyleToString,
8
8
  } from "../core/index.js";
9
9
 
10
10
  interface Props {
11
11
  state: GridCellState;
12
- children: Snippet<[row: R, col: C, cell: Readonly<VGridCell>]>;
12
+ children: Snippet<[row: R, col: C, cell: Readonly<GridCell>]>;
13
13
  row: R;
14
14
  col: C;
15
15
  rowIndex: number;
@@ -5,17 +5,17 @@
5
5
  getAxisLength,
6
6
  type GridDriver,
7
7
  type GridRowState,
8
- type VGridAxis,
9
- type VGridCell,
8
+ type GridAxis,
9
+ type GridCell as GridCellType,
10
10
  gridStyleToString,
11
11
  } from "../core/index.js";
12
12
  import GridCell from "./GridCell.svelte";
13
13
 
14
14
  interface Props {
15
15
  state: GridRowState;
16
- children: Snippet<[row: R, col: C, cell: Readonly<VGridCell>]>;
16
+ children: Snippet<[row: R, col: C, cell: Readonly<GridCellType>]>;
17
17
  row: R;
18
- cols: VGridAxis<C>;
18
+ cols: GridAxis<C>;
19
19
  resizer: GridDriver["$observeItem"];
20
20
  }
21
21
 
@@ -5,17 +5,17 @@
5
5
  getAxisLength,
6
6
  type GridDriver,
7
7
  type GridRowGroupState,
8
- type VGridAxis,
9
- type VGridCell,
8
+ type GridAxis,
9
+ type GridCell,
10
10
  gridStyleToString,
11
11
  } from "../core/index.js";
12
12
  import GridRow from "./GridRow.svelte";
13
13
 
14
14
  interface Props {
15
15
  state: GridRowGroupState;
16
- children: Snippet<[row: R, col: C, cell: Readonly<VGridCell>]>;
17
- rows: VGridAxis<R>;
18
- cols: VGridAxis<C>;
16
+ children: Snippet<[row: R, col: C, cell: Readonly<GridCell>]>;
17
+ rows: GridAxis<R>;
18
+ cols: GridAxis<C>;
19
19
  resizer: GridDriver["$observeItem"];
20
20
  }
21
21
 
@@ -84,10 +84,26 @@
84
84
 
85
85
  // The sizes read from the items are tracked, so the items mutated in place are followed.
86
86
  $effect.pre(() => {
87
- updateGridAxis(rowStore, rowLayout, rows, rowHeight, true);
87
+ updateGridAxis(
88
+ rowStore,
89
+ rowLayout,
90
+ rows,
91
+ rowHeight,
92
+ headerRows,
93
+ footerRows,
94
+ true,
95
+ );
88
96
  });
89
97
  $effect.pre(() => {
90
- updateGridAxis(colStore, colLayout, cols, colWidth, true);
98
+ updateGridAxis(
99
+ colStore,
100
+ colLayout,
101
+ cols,
102
+ colWidth,
103
+ headerCols,
104
+ footerCols,
105
+ true,
106
+ );
91
107
  });
92
108
  let rowCount = $derived(stateVersion && rowStore.$getItemsLength());
93
109
  let colCount = $derived(stateVersion && colStore.$getItemsLength());
@@ -98,11 +114,7 @@
98
114
  colLayout,
99
115
  rowStore.$getRange(bufferSize),
100
116
  colStore.$getRange(bufferSize),
101
- headerRows,
102
117
  sectionRows,
103
- footerRows,
104
- headerCols,
105
- footerCols,
106
118
  spans,
107
119
  keepMounted,
108
120
  ariaSort,
@@ -155,11 +167,9 @@
155
167
  driver,
156
168
  rowStore,
157
169
  colStore,
158
- headerRows,
170
+ rowLayout,
171
+ colLayout,
159
172
  sectionRows,
160
- footerRows,
161
- headerCols,
162
- footerCols,
163
173
  opts,
164
174
  );
165
175
  export const scrollTo: VGridHandle["scrollTo"] = ({ vertical, horizontal }) =>
@@ -1,5 +1,5 @@
1
1
  import { Snippet } from 'svelte';
2
- import { VGridScrollToIndexOpts, VGridAxis, VGridCell, VGridSize, VGridSpan } from '../core/index.js';
2
+ import { GridScrollToIndexOpts, GridAxis, GridCell, GridSize, GridSpan } from '../core/index.js';
3
3
  import { ViewportComponentAttributes } from './types.js';
4
4
  /**
5
5
  * Props of {@link VGrid}.
@@ -11,23 +11,23 @@ export interface VGridProps<R = number, C = number> extends Omit<ViewportCompone
11
11
  * @param col the item of {@link VGridProps.cols} at the column of the cell, or the column index if {@link VGridProps.cols} is a number
12
12
  * @param cell the row index and the column index of the cell
13
13
  */
14
- children: Snippet<[row: R, col: C, cell: Readonly<VGridCell>]>;
14
+ children: Snippet<[row: R, col: C, cell: Readonly<GridCell>]>;
15
15
  /**
16
- * The rows of the grid. See {@link VGridAxis} for the accepted values.
16
+ * The rows of the grid. See {@link GridAxis} for the accepted values.
17
17
  */
18
- rows: VGridAxis<R>;
18
+ rows: GridAxis<R>;
19
19
  /**
20
- * The columns of the grid. See {@link VGridAxis} for the accepted values.
20
+ * The columns of the grid. See {@link GridAxis} for the accepted values.
21
21
  */
22
- cols: VGridAxis<C>;
22
+ cols: GridAxis<C>;
23
23
  /**
24
- * The heights of the rows. See {@link VGridSize} for the accepted values.
24
+ * The heights of the rows. See {@link GridSize} for the accepted values.
25
25
  */
26
- rowHeight: NoInfer<VGridSize<R>>;
26
+ rowHeight: GridSize<R>;
27
27
  /**
28
- * The widths of the columns. See {@link VGridSize} for the accepted values.
28
+ * The widths of the columns. See {@link GridSize} for the accepted values.
29
29
  */
30
- colWidth: NoInfer<VGridSize<C>>;
30
+ colWidth: GridSize<C>;
31
31
  /**
32
32
  * The number of the leading rows pinned to the start, which are the column headers (`role="columnheader"`).
33
33
  *
@@ -63,15 +63,15 @@ export interface VGridProps<R = number, C = number> extends Omit<ViewportCompone
63
63
  */
64
64
  footerCols?: number;
65
65
  /**
66
- * Cells merged over multiple rows and/or columns. See {@link VGridSpan} for the accepted values.
66
+ * Cells merged over multiple rows and/or columns. See {@link GridSpan} for the accepted values.
67
67
  *
68
68
  * The cell at the origin is stretched over the merged area, and the other cells in it are not rendered. Spans must not overlap each other or cross the boundaries of the pinned rows/columns or the sections. A spanning cell is not measured for `"auto"` sizes on the axes it spans, and doesn't enlarge those tracks.
69
69
  */
70
- spans?: readonly VGridSpan[];
70
+ spans?: readonly GridSpan[];
71
71
  /**
72
72
  * List of cells that should be always mounted, even when off screen.
73
73
  */
74
- keepMounted?: readonly VGridCell[];
74
+ keepMounted?: readonly GridCell[];
75
75
  /**
76
76
  * Extra 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 cells in fast scrolling.
77
77
  * @defaultValue 200
@@ -85,7 +85,7 @@ export interface VGridProps<R = number, C = number> extends Omit<ViewportCompone
85
85
  /**
86
86
  * The header cell of the sorted column or row, and the sort order (`aria-sort`).
87
87
  */
88
- ariaSort?: VGridCell & {
88
+ ariaSort?: GridCell & {
89
89
  order: "ascending" | "descending" | "other";
90
90
  };
91
91
  /**
@@ -163,9 +163,9 @@ export interface VGridHandle {
163
163
  getColSize(index: number): number;
164
164
  /**
165
165
  * Scroll to the cell specified by the indexes. The cell is not hidden behind the rows and the columns sticking over it.
166
- * @param opts the indexes of the cell and the options. See {@link VGridScrollToIndexOpts}.
166
+ * @param opts the indexes of the cell and the options. See {@link GridScrollToIndexOpts}.
167
167
  */
168
- scrollToIndex(opts: VGridScrollToIndexOpts): void;
168
+ scrollToIndex(opts: GridScrollToIndexOpts): void;
169
169
  /**
170
170
  * Scroll to the given offsets from the top/start of the scroll container.
171
171
  * @param offset the offsets. The axis whose offset is omitted is not scrolled.
@@ -9,4 +9,4 @@ export { default as WindowVirtualizer } from './WindowVirtualizer.svelte';
9
9
  export type { WindowVirtualizerProps, WindowVirtualizerHandle, } from './WindowVirtualizer.type.js';
10
10
  export { default as VGrid } from './VGrid.svelte';
11
11
  export type { VGridProps, VGridHandle } from './VGrid.type.js';
12
- export type { VGridSize, VGridSpan } from '../core/index.js';
12
+ export type { GridSize, GridSpan } from '../core/index.js';
@@ -1,25 +1,25 @@
1
1
  import { VNode, PublicProps } from 'vue';
2
- import { VGridScrollToIndexOpts, VGridAxis, VGridCell, VGridSize, VGridSpan } from '../core/index.js';
2
+ import { GridScrollToIndexOpts, GridAxis, GridCell as GridCellType, GridSize, GridSpan } from '../core/index.js';
3
3
  /**
4
4
  * Props of {@link VGrid}.
5
5
  */
6
6
  export interface VGridProps<R = number, C = number> extends PublicProps {
7
7
  /**
8
- * The rows of the grid. See {@link VGridAxis} for the accepted values.
8
+ * The rows of the grid. See {@link GridAxis} for the accepted values.
9
9
  */
10
- rows: VGridAxis<R>;
10
+ rows: GridAxis<R>;
11
11
  /**
12
- * The columns of the grid. See {@link VGridAxis} for the accepted values.
12
+ * The columns of the grid. See {@link GridAxis} for the accepted values.
13
13
  */
14
- cols: VGridAxis<C>;
14
+ cols: GridAxis<C>;
15
15
  /**
16
- * The heights of the rows. See {@link VGridSize} for the accepted values.
16
+ * The heights of the rows. See {@link GridSize} for the accepted values.
17
17
  */
18
- rowHeight: NoInfer<VGridSize<R>>;
18
+ rowHeight: GridSize<R>;
19
19
  /**
20
- * The widths of the columns. See {@link VGridSize} for the accepted values.
20
+ * The widths of the columns. See {@link GridSize} for the accepted values.
21
21
  */
22
- colWidth: NoInfer<VGridSize<C>>;
22
+ colWidth: GridSize<C>;
23
23
  /**
24
24
  * The number of the leading rows pinned to the start, which are the column headers (`role="columnheader"`).
25
25
  *
@@ -55,15 +55,15 @@ export interface VGridProps<R = number, C = number> extends PublicProps {
55
55
  */
56
56
  footerCols?: number;
57
57
  /**
58
- * Cells merged over multiple rows and/or columns. See {@link VGridSpan} for the accepted values.
58
+ * Cells merged over multiple rows and/or columns. See {@link GridSpan} for the accepted values.
59
59
  *
60
60
  * The cell at the origin is stretched over the merged area, and the other cells in it are not rendered. Spans must not overlap each other or cross the boundaries of the pinned rows/columns or the sections. A spanning cell is not measured for `"auto"` sizes on the axes it spans, and doesn't enlarge those tracks.
61
61
  */
62
- spans?: readonly VGridSpan[];
62
+ spans?: readonly GridSpan[];
63
63
  /**
64
64
  * List of cells that should be always mounted, even when off screen.
65
65
  */
66
- keepMounted?: readonly VGridCell[];
66
+ keepMounted?: readonly GridCellType[];
67
67
  /**
68
68
  * Extra 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 cells in fast scrolling.
69
69
  * @defaultValue 200
@@ -77,7 +77,7 @@ export interface VGridProps<R = number, C = number> extends PublicProps {
77
77
  /**
78
78
  * The header cell of the sorted column or row, and the sort order (`aria-sort`).
79
79
  */
80
- ariaSort?: VGridCell & {
80
+ ariaSort?: GridCellType & {
81
81
  order: "ascending" | "descending" | "other";
82
82
  };
83
83
  /**
@@ -155,9 +155,9 @@ export interface VGridHandle {
155
155
  getColSize(index: number): number;
156
156
  /**
157
157
  * Scroll to the cell specified by the indexes. The cell is not hidden behind the rows and the columns sticking over it.
158
- * @param opts the indexes of the cell and the options. See {@link VGridScrollToIndexOpts}.
158
+ * @param opts the indexes of the cell and the options. See {@link GridScrollToIndexOpts}.
159
159
  */
160
- scrollToIndex(opts: VGridScrollToIndexOpts): void;
160
+ scrollToIndex(opts: GridScrollToIndexOpts): void;
161
161
  /**
162
162
  * Scroll to the given offsets from the top/start of the scroll container.
163
163
  * @param offset the offsets. The axis whose offset is omitted is not scrolled.
@@ -181,7 +181,7 @@ interface VGridInstance<R = number, C = number> extends VGridHandle {
181
181
  default: (arg: {
182
182
  row: R;
183
183
  col: C;
184
- cell: Readonly<VGridCell>;
184
+ cell: Readonly<GridCellType>;
185
185
  }) => VNode[];
186
186
  };
187
187
  }