({
clampEnabled,
liveBounds,
previousStableBounds,
reusedPreviousBounds,
}: VirtualScrollClampPersistenceInput)
| 257 | } |
| 258 | |
| 259 | export function resolveVirtualScrollClampBounds({ |
| 260 | clampEnabled, |
| 261 | liveBounds, |
| 262 | previousStableBounds, |
| 263 | reusedPreviousBounds, |
| 264 | }: VirtualScrollClampPersistenceInput): VirtualScrollClampPersistenceResult { |
| 265 | const emptyBounds = { |
| 266 | clampMin: undefined, |
| 267 | clampMax: undefined, |
| 268 | } satisfies VirtualScrollClampBounds |
| 269 | |
| 270 | if (!clampEnabled) { |
| 271 | return { |
| 272 | appliedBounds: emptyBounds, |
| 273 | nextStableBounds: emptyBounds, |
| 274 | reusedPreviousBounds: false, |
| 275 | } |
| 276 | } |
| 277 | |
| 278 | if (hasVirtualScrollClampBounds(liveBounds)) { |
| 279 | return { |
| 280 | appliedBounds: liveBounds, |
| 281 | nextStableBounds: liveBounds, |
| 282 | reusedPreviousBounds: false, |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | if ( |
| 287 | hasVirtualScrollClampBounds(previousStableBounds) && |
| 288 | !reusedPreviousBounds |
| 289 | ) { |
| 290 | return { |
| 291 | appliedBounds: previousStableBounds, |
| 292 | nextStableBounds: previousStableBounds, |
| 293 | reusedPreviousBounds: true, |
| 294 | } |
| 295 | } |
| 296 | |
| 297 | return { |
| 298 | appliedBounds: emptyBounds, |
| 299 | nextStableBounds: emptyBounds, |
| 300 | reusedPreviousBounds: false, |
| 301 | } |
| 302 | } |
| 303 | |
| 304 | export function computeVirtualScrollOffsets( |
| 305 | itemKeys: readonly string[], |
no test coverage detected