virtua 0.53.0 → 0.53.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.
@@ -81,6 +81,10 @@ export interface VMasonryProps<T> extends ViewportComponentAttributes {
81
81
  * @defaultValue 200
82
82
  */
83
83
  bufferSize?: number;
84
+ /**
85
+ * List of indexes that should be always mounted, even when off screen.
86
+ */
87
+ keepMounted?: readonly number[];
84
88
  /**
85
89
  * 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 VMasonryHandle.cache}.
86
90
  *
@@ -85,6 +85,10 @@ export interface VMasonryProps<T> extends ViewportComponentAttributes {
85
85
  * @defaultValue 200
86
86
  */
87
87
  bufferSize?: number;
88
+ /**
89
+ * List of indexes that should be always mounted, even when off screen.
90
+ */
91
+ keepMounted?: readonly number[];
88
92
  /**
89
93
  * 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 VMasonryHandle.cache}.
90
94
  *
@@ -1089,7 +1089,7 @@ exports.VGrid = r => {
1089
1089
  var s;
1090
1090
  }, exports.VMasonry = r => {
1091
1091
  let n;
1092
- const {itemSize: i, cache: l} = r, [, c] = (0, t.splitProps)(r, [ "ref", "data", "children", "lanes", "gap", "itemSize", "bufferSize", "cache", "onScroll", "onScrollEnd", "style" ]), a = ((e, t, r = 0, n, i) => {
1092
+ const {itemSize: i, cache: l} = r, [, c] = (0, t.splitProps)(r, [ "ref", "data", "children", "lanes", "gap", "itemSize", "bufferSize", "keepMounted", "cache", "onScroll", "onScrollEnd", "style" ]), a = ((e, t, r = 0, n, i) => {
1093
1093
  let l = s(t, 1), c = l, a = r, f = i && i[1] || n || 40, g = -1, d = n ? void 0 : /* @__PURE__ */ new Set, h = !n;
1094
1094
  const p = i && i[0], $ = p ? w(p.slice(0, o(e, p.length)), s(0, e - p.length)) : w([], e), v = [], m = [], x = [], y = e => {
1095
1095
  const t = $[e];
@@ -1214,7 +1214,13 @@ exports.VGrid = r => {
1214
1214
  e !== f.L() && f.A(5, [ e ]);
1215
1215
  });
1216
1216
  const n = [], o = [];
1217
- for (let [e, t] = p(); e <= t; e++) n.push(r.data[e]), o.push(e);
1217
+ if (r.keepMounted) {
1218
+ const t = new Set(r.keepMounted);
1219
+ for (let [e, r] = p(); e <= r; e++) t.add(e);
1220
+ u([ ...t ]).forEach(t => {
1221
+ t < e && (n.push(r.data[t]), o.push(t));
1222
+ });
1223
+ } else for (let [e, t] = p(); e <= t; e++) n.push(r.data[e]), o.push(e);
1218
1224
  return {
1219
1225
  de: n,
1220
1226
  he: o