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.
package/dist/native.js CHANGED
@@ -13518,18 +13518,7 @@ var require_index_native19 = __commonJS({
13518
13518
  }));
13519
13519
  }
13520
13520
  if (import_constants4.isClient) if (rAF) {
13521
- layoutOnAnimationFrame = function() {
13522
- if (strategy !== "off") {
13523
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
13524
- rAF(layoutOnAnimationFrame);
13525
- return;
13526
- }
13527
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
13528
- updateLayoutIfChanged(node);
13529
- });
13530
- }
13531
- rAF(layoutOnAnimationFrame);
13532
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
13521
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
13533
13522
  async function updateLayoutIfChanged(node) {
13534
13523
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
13535
13524
  var onLayout = LayoutHandlers.get(node);
@@ -13539,8 +13528,8 @@ var require_index_native19 = __commonJS({
13539
13528
  var nodeRect, parentRect;
13540
13529
  if (strategy === "async") {
13541
13530
  var [nr, pr] = await Promise.all([
13542
- getBoundingClientRectAsync(node),
13543
- getBoundingClientRectAsync(parentNode)
13531
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
13532
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
13544
13533
  ]);
13545
13534
  if (nr === !1 || pr === !1) return;
13546
13535
  nodeRect = nr, parentRect = pr;
@@ -13561,8 +13550,56 @@ var require_index_native19 = __commonJS({
13561
13550
  }
13562
13551
  }
13563
13552
  rAF(layoutOnAnimationFrame), frameCount = 0, userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP, RUN_EVERY_X_FRAMES = userSkipVal ? +userSkipVal : 10;
13553
+ async function layoutOnAnimationFrame() {
13554
+ if (strategy !== "off") {
13555
+ if (!Nodes.size || frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
13556
+ rAF(layoutOnAnimationFrame);
13557
+ return;
13558
+ }
13559
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), await new Promise(function(res) {
13560
+ var io = new IntersectionObserver(function(entries) {
13561
+ io.disconnect();
13562
+ var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
13563
+ try {
13564
+ for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
13565
+ var entry = _step2.value;
13566
+ BoundingRects.set(entry.target, entry.boundingClientRect);
13567
+ }
13568
+ } catch (err) {
13569
+ _didIteratorError2 = !0, _iteratorError2 = err;
13570
+ } finally {
13571
+ try {
13572
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
13573
+ } finally {
13574
+ if (_didIteratorError2) throw _iteratorError2;
13575
+ }
13576
+ }
13577
+ res();
13578
+ }, {
13579
+ threshold: 0
13580
+ }), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
13581
+ try {
13582
+ for (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
13583
+ var node = _step.value;
13584
+ node.parentElement instanceof HTMLElement && (io.observe(node), io.observe(node.parentElement));
13585
+ }
13586
+ } catch (err) {
13587
+ _didIteratorError = !0, _iteratorError = err;
13588
+ } finally {
13589
+ try {
13590
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
13591
+ } finally {
13592
+ if (_didIteratorError) throw _iteratorError;
13593
+ }
13594
+ }
13595
+ }), Nodes.forEach(function(node) {
13596
+ updateLayoutIfChanged(node);
13597
+ });
13598
+ }
13599
+ rAF(layoutOnAnimationFrame);
13600
+ }
13564
13601
  } else process.env.NODE_ENV === "development" && console.warn("No requestAnimationFrame - please polyfill for onLayout to work correctly");
13565
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
13602
+ var supportsCheckVisibility, BoundingRects, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
13566
13603
  return {
13567
13604
  nativeEvent: {
13568
13605
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -24661,13 +24698,13 @@ var require_Popper_native = __commonJS({
24661
24698
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
24662
24699
  passThrough,
24663
24700
  ref: contentRefs,
24701
+ contain: "layout style",
24664
24702
  ...passThrough ? null : floatingProps,
24665
24703
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperContentFrame, {
24666
24704
  passThrough,
24667
24705
  ...!passThrough && {
24668
24706
  "data-placement": placement,
24669
24707
  "data-strategy": strategy,
24670
- contain: "layout",
24671
24708
  size: size2,
24672
24709
  ...style,
24673
24710
  ...rest