@tanstack/virtual-core 3.19.5 → 3.19.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.
@@ -5,8 +5,8 @@ const utils = require("./utils.cjs");
5
5
  const scrollClassifier = require("./scroll-classifier.cjs");
6
6
  const iosGesture = require("./ios-gesture.cjs");
7
7
  const getRect = (element) => {
8
- const { offsetWidth, offsetHeight } = element;
9
- return { width: offsetWidth, height: offsetHeight };
8
+ const { clientWidth, clientHeight } = element;
9
+ return { width: clientWidth, height: clientHeight };
10
10
  };
11
11
  const createFrameQueue = (targetWindow) => {
12
12
  const ids = /* @__PURE__ */ new Set();
@@ -55,21 +55,13 @@ const observeElementRect = (instance, cb) => {
55
55
  };
56
56
  }
57
57
  const frames = createFrameQueue(targetWindow);
58
- const observer = new targetWindow.ResizeObserver((entries) => {
58
+ const observer = new targetWindow.ResizeObserver(() => {
59
59
  const run = () => {
60
- const entry = entries[0];
61
- if (entry == null ? void 0 : entry.borderBoxSize) {
62
- const box = entry.borderBoxSize[0];
63
- if (box) {
64
- handler({ width: box.inlineSize, height: box.blockSize });
65
- return;
66
- }
67
- }
68
60
  handler(getRect(element));
69
61
  };
70
62
  instance.options.useAnimationFrameWithResizeObserver ? frames.schedule(run) : run();
71
63
  });
72
- observer.observe(element, { box: "border-box" });
64
+ observer.observe(element, { box: "content-box" });
73
65
  return () => {
74
66
  observer.unobserve(element);
75
67
  frames.cancel();
@@ -248,6 +240,7 @@ class Virtualizer {
248
240
  }
249
241
  this._flushHoldIfReady(true);
250
242
  this._writeAwaitingCommand();
243
+ this._retryClampedAdjustment();
251
244
  }
252
245
  });
253
246
  this._lastElementOffset = null;
@@ -626,7 +619,7 @@ class Virtualizer {
626
619
  });
627
620
  };
628
621
  this._retryClampedAdjustment = () => {
629
- if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled) {
622
+ if (this._clampedAdjustment === null || !this.scrollElement || !this.options.enabled || !this._canWriteScroll()) {
630
623
  return;
631
624
  }
632
625
  const { target, maxAtWrite } = this._clampedAdjustment;
@@ -1494,6 +1487,8 @@ class Virtualizer {
1494
1487
  // scroll as landed; an offset target never does, so its first scroll
1495
1488
  // event is read as the user's (see the scroll handler in `_willUpdate`).
1496
1489
  _startScroll(target, offset, behavior, kind) {
1490
+ this.pendingScrollAnchor = null;
1491
+ this._clampedAdjustment = null;
1497
1492
  const tail = this._iosGesture.tail();
1498
1493
  if (kind === "absolute" && tail !== null) {
1499
1494
  if (tail === "fling" && iosGesture.iosMomentumOverridesWrites()) {