virtua 0.52.5 → 0.52.7

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.
@@ -8,6 +8,7 @@
8
8
  createContainerGridDriver,
9
9
  createGridLayout,
10
10
  createGridPlan,
11
+ createGridSpanIndex,
11
12
  createVirtualStore,
12
13
  getAxisItem,
13
14
  getAxisLength,
@@ -48,6 +49,9 @@
48
49
 
49
50
  const rowLayout = createGridLayout(rows, rowHeight, gap);
50
51
  const colLayout = createGridLayout(cols, colWidth, gap);
52
+ let rowSizes = $derived(rowLayout.$getSizes(rows, rowHeight));
53
+ let colSizes = $derived(colLayout.$getSizes(cols, colWidth));
54
+ let spanIndex = $derived(createGridSpanIndex(spans));
51
55
  const rowStore = createVirtualStore(rowLayout);
52
56
  const colStore = createVirtualStore(colLayout);
53
57
  const driver = createContainerGridDriver(rowStore, colStore);
@@ -82,28 +86,11 @@
82
86
  rowStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
83
87
  colStore.$subscribe(UPDATE_SCROLL_END_EVENT, notifyScrollEnd);
84
88
 
85
- // The sizes read from the items are tracked, so the items mutated in place are followed.
86
89
  $effect.pre(() => {
87
- updateGridAxis(
88
- rowStore,
89
- rowLayout,
90
- rows,
91
- rowHeight,
92
- headerRows,
93
- footerRows,
94
- true,
95
- );
90
+ updateGridAxis(rowStore, rowLayout, rows, rowSizes, headerRows, footerRows);
96
91
  });
97
92
  $effect.pre(() => {
98
- updateGridAxis(
99
- colStore,
100
- colLayout,
101
- cols,
102
- colWidth,
103
- headerCols,
104
- footerCols,
105
- true,
106
- );
93
+ updateGridAxis(colStore, colLayout, cols, colSizes, headerCols, footerCols);
107
94
  });
108
95
  let rowCount = $derived(stateVersion && rowStore.$getItemsLength());
109
96
  let colCount = $derived(stateVersion && colStore.$getItemsLength());
@@ -114,8 +101,8 @@
114
101
  colLayout,
115
102
  rowStore.$getRange(bufferSize),
116
103
  colStore.$getRange(bufferSize),
104
+ spanIndex,
117
105
  sectionRows,
118
- spans,
119
106
  keepMounted,
120
107
  ariaSort,
121
108
  );