@tamagui/core 1.132.2 → 1.132.4

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.
@@ -7190,7 +7190,8 @@ var require_createComponent_native = __commonJS({
7190
7190
  }
7191
7191
  var allGroupContexts = (0, import_react3.useMemo)(function() {
7192
7192
  var _stateRef_current_group;
7193
- if (!groupName || props.passThrough) return groupContextParent;
7193
+ if (!groupName || props.passThrough || // avoids onLayout
7194
+ props.containerType === "normal") return groupContextParent;
7194
7195
  (_stateRef_current_group = stateRef.current.group) === null || _stateRef_current_group === void 0 || _stateRef_current_group.listeners.clear();
7195
7196
  var listeners = /* @__PURE__ */ new Set();
7196
7197
  return stateRef.current.group = {
@@ -11823,18 +11824,7 @@ var require_index_native12 = __commonJS({
11823
11824
  }));
11824
11825
  }
11825
11826
  if (import_constants.isClient && rAF) {
11826
- layoutOnAnimationFrame = function() {
11827
- if (strategy !== "off") {
11828
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
11829
- rAF(layoutOnAnimationFrame);
11830
- return;
11831
- }
11832
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
11833
- updateLayoutIfChanged(node);
11834
- });
11835
- }
11836
- rAF(layoutOnAnimationFrame);
11837
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
11827
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
11838
11828
  async function updateLayoutIfChanged(node) {
11839
11829
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
11840
11830
  var onLayout = LayoutHandlers.get(node);
@@ -11844,8 +11834,8 @@ var require_index_native12 = __commonJS({
11844
11834
  var nodeRect, parentRect;
11845
11835
  if (strategy === "async") {
11846
11836
  var [nr, pr] = await Promise.all([
11847
- getBoundingClientRectAsync(node),
11848
- getBoundingClientRectAsync(parentNode)
11837
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
11838
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
11849
11839
  ]);
11850
11840
  if (nr === !1 || pr === !1) return;
11851
11841
  nodeRect = nr, parentRect = pr;
@@ -11866,8 +11856,56 @@ var require_index_native12 = __commonJS({
11866
11856
  }
11867
11857
  }
11868
11858
  rAF(layoutOnAnimationFrame), frameCount = 0, userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP, RUN_EVERY_X_FRAMES = userSkipVal ? +userSkipVal : 10;
11859
+ async function layoutOnAnimationFrame() {
11860
+ if (strategy !== "off") {
11861
+ if (!Nodes.size || frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
11862
+ rAF(layoutOnAnimationFrame);
11863
+ return;
11864
+ }
11865
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), await new Promise(function(res) {
11866
+ var io = new IntersectionObserver(function(entries) {
11867
+ io.disconnect();
11868
+ var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
11869
+ try {
11870
+ for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
11871
+ var entry = _step2.value;
11872
+ BoundingRects.set(entry.target, entry.boundingClientRect);
11873
+ }
11874
+ } catch (err) {
11875
+ _didIteratorError2 = !0, _iteratorError2 = err;
11876
+ } finally {
11877
+ try {
11878
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
11879
+ } finally {
11880
+ if (_didIteratorError2) throw _iteratorError2;
11881
+ }
11882
+ }
11883
+ res();
11884
+ }, {
11885
+ threshold: 0
11886
+ }), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
11887
+ try {
11888
+ for (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
11889
+ var node = _step.value;
11890
+ node.parentElement instanceof HTMLElement && (io.observe(node), io.observe(node.parentElement));
11891
+ }
11892
+ } catch (err) {
11893
+ _didIteratorError = !0, _iteratorError = err;
11894
+ } finally {
11895
+ try {
11896
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
11897
+ } finally {
11898
+ if (_didIteratorError) throw _iteratorError;
11899
+ }
11900
+ }
11901
+ }), Nodes.forEach(function(node) {
11902
+ updateLayoutIfChanged(node);
11903
+ });
11904
+ }
11905
+ rAF(layoutOnAnimationFrame);
11906
+ }
11869
11907
  }
11870
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
11908
+ var supportsCheckVisibility, BoundingRects, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
11871
11909
  return {
11872
11910
  nativeEvent: {
11873
11911
  layout: getRelativeDimensions(nodeRect, parentRect),