tamagui 1.132.2 → 1.132.3

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.
@@ -12947,18 +12947,7 @@ var require_index_native19 = __commonJS({
12947
12947
  }));
12948
12948
  }
12949
12949
  if (import_constants4.isClient && rAF) {
12950
- layoutOnAnimationFrame = function() {
12951
- if (strategy !== "off") {
12952
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12953
- rAF(layoutOnAnimationFrame);
12954
- return;
12955
- }
12956
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
12957
- updateLayoutIfChanged(node);
12958
- });
12959
- }
12960
- rAF(layoutOnAnimationFrame);
12961
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
12950
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
12962
12951
  async function updateLayoutIfChanged(node) {
12963
12952
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
12964
12953
  var onLayout = LayoutHandlers.get(node);
@@ -12968,8 +12957,8 @@ var require_index_native19 = __commonJS({
12968
12957
  var nodeRect, parentRect;
12969
12958
  if (strategy === "async") {
12970
12959
  var [nr, pr] = await Promise.all([
12971
- getBoundingClientRectAsync(node),
12972
- getBoundingClientRectAsync(parentNode)
12960
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
12961
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
12973
12962
  ]);
12974
12963
  if (nr === !1 || pr === !1) return;
12975
12964
  nodeRect = nr, parentRect = pr;
@@ -12990,8 +12979,56 @@ var require_index_native19 = __commonJS({
12990
12979
  }
12991
12980
  }
12992
12981
  rAF(layoutOnAnimationFrame), frameCount = 0, userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP, RUN_EVERY_X_FRAMES = userSkipVal ? +userSkipVal : 10;
12982
+ async function layoutOnAnimationFrame() {
12983
+ if (strategy !== "off") {
12984
+ if (!Nodes.size || frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12985
+ rAF(layoutOnAnimationFrame);
12986
+ return;
12987
+ }
12988
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), await new Promise(function(res) {
12989
+ var io = new IntersectionObserver(function(entries) {
12990
+ io.disconnect();
12991
+ var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
12992
+ try {
12993
+ for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
12994
+ var entry = _step2.value;
12995
+ BoundingRects.set(entry.target, entry.boundingClientRect);
12996
+ }
12997
+ } catch (err) {
12998
+ _didIteratorError2 = !0, _iteratorError2 = err;
12999
+ } finally {
13000
+ try {
13001
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
13002
+ } finally {
13003
+ if (_didIteratorError2) throw _iteratorError2;
13004
+ }
13005
+ }
13006
+ res();
13007
+ }, {
13008
+ threshold: 0
13009
+ }), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
13010
+ try {
13011
+ for (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
13012
+ var node = _step.value;
13013
+ node.parentElement instanceof HTMLElement && (io.observe(node), io.observe(node.parentElement));
13014
+ }
13015
+ } catch (err) {
13016
+ _didIteratorError = !0, _iteratorError = err;
13017
+ } finally {
13018
+ try {
13019
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
13020
+ } finally {
13021
+ if (_didIteratorError) throw _iteratorError;
13022
+ }
13023
+ }
13024
+ }), Nodes.forEach(function(node) {
13025
+ updateLayoutIfChanged(node);
13026
+ });
13027
+ }
13028
+ rAF(layoutOnAnimationFrame);
13029
+ }
12993
13030
  }
12994
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
13031
+ var supportsCheckVisibility, BoundingRects, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
12995
13032
  return {
12996
13033
  nativeEvent: {
12997
13034
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -23975,13 +24012,13 @@ var require_Popper_native = __commonJS({
23975
24012
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
23976
24013
  passThrough,
23977
24014
  ref: contentRefs,
24015
+ contain: "layout style",
23978
24016
  ...passThrough ? null : floatingProps,
23979
24017
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperContentFrame, {
23980
24018
  passThrough,
23981
24019
  ...!passThrough && {
23982
24020
  "data-placement": placement,
23983
24021
  "data-strategy": strategy,
23984
- contain: "layout",
23985
24022
  size: size2,
23986
24023
  ...style,
23987
24024
  ...rest