tamagui 1.132.1 → 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
@@ -6894,7 +6894,7 @@ var require_getSplitStyles_native = __commonJS({
6894
6894
  for (var keyOg in props) _loop(keyOg);
6895
6895
  process.env.NODE_ENV === "development" && debug === "profile" && time`split-styles-propsend`;
6896
6896
  var avoidNormalize = styleProps.noNormalize === !1;
6897
- if (debug && console.warn("?", avoidNormalize, styleProps.noExpand, styleProps.noMergeStyle, styleState.style), !avoidNormalize) {
6897
+ if (!avoidNormalize) {
6898
6898
  if (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), !styleProps.noExpand && !styleProps.noMergeStyle && import_constants4.isWeb && (!isReactNative || !animationDriver.supportsCSS) && (0, import_getCSSStylesAtomic.styleToCSS)(styleState.style)), styleState.flatTransforms) {
6899
6899
  var _styleState;
6900
6900
  (_styleState = styleState).style || (_styleState.style = {}), mergeFlatTransforms(styleState.style, styleState.flatTransforms);
@@ -8739,10 +8739,10 @@ var require_createComponent_native = __commonJS({
8739
8739
  componentName2
8740
8740
  ]);
8741
8741
  var componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), groupContextParent = import_react3.default.useContext(import_GroupContext.GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = (0, import_useComponentState.useComponentState)(props, animationDriver, staticConfig, config), { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, supportsCSS, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
8742
- hasAnimationProp && animationDriver != null && animationDriver.avoidReRenders && (0, import_constants4.useIsomorphicLayoutEffect)(function() {
8742
+ if (hasAnimationProp && animationDriver != null && animationDriver.avoidReRenders) {
8743
8743
  var pendingState = NextState.get(stateRef);
8744
- pendingState && (setStateShallow(pendingState), NextState.set(stateRef, void 0));
8745
- });
8744
+ pendingState && (NextState.set(stateRef, void 0), componentState.setStateShallow(pendingState));
8745
+ }
8746
8746
  var allGroupContexts = (0, import_react3.useMemo)(function() {
8747
8747
  var _stateRef_current_group;
8748
8748
  if (!groupName || props.passThrough) return groupContextParent;
@@ -8859,34 +8859,33 @@ var require_createComponent_native = __commonJS({
8859
8859
  }
8860
8860
  }
8861
8861
  if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8862
- var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
8863
- componentContext.mediaEmit = function(next) {
8864
- NextMedia.set(stateRef, next), updateStyleListener();
8865
- };
8866
- var updateStyleListener = function() {
8862
+ var _componentContext, ogSetStateShallow = setStateShallow;
8863
+ stateRef.current.updateStyleListener = function() {
8867
8864
  var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8868
8865
  groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8869
8866
  var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
8870
8867
  ...styleProps,
8871
8868
  mediaState: mediaState22
8872
- } : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8869
+ } : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), useStyleListener = stateRef.current.useStyleListener;
8873
8870
  useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8874
- };
8875
- stateRef.current.setStateShallow = function(nextOrGetNext) {
8871
+ }, (_componentContext = componentContext).mediaEmit || (_componentContext.mediaEmit = function(next) {
8872
+ var _stateRef_current_updateStyleListener, _stateRef_current;
8873
+ NextMedia.set(stateRef, next), (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
8874
+ }), stateRef.current.setStateShallow = function(nextOrGetNext) {
8876
8875
  var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
8877
8876
  if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
8878
8877
  var canAvoidReRender = Object.keys(next).every(function(key3) {
8879
8878
  return avoidReRenderKeys.has(key3);
8880
8879
  });
8881
8880
  if (canAvoidReRender) {
8882
- var updatedState = {
8881
+ var _stateRef_current_updateStyleListener, _stateRef_current, updatedState = {
8883
8882
  ...prev,
8884
8883
  ...next
8885
8884
  };
8886
8885
  NextState.set(stateRef, updatedState), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed("[\u26A1\uFE0F] avoid setState", next, {
8887
8886
  updatedState,
8888
8887
  props
8889
- }), console.info(stateRef.current.host), console.groupEnd()), updateStyleListener();
8888
+ }), console.info(stateRef.current.host), console.groupEnd()), (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
8890
8889
  } else process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && console.info("[\u{1F40C}] re-render", {
8891
8890
  canAvoidReRender,
8892
8891
  next
@@ -13519,18 +13518,7 @@ var require_index_native19 = __commonJS({
13519
13518
  }));
13520
13519
  }
13521
13520
  if (import_constants4.isClient) if (rAF) {
13522
- layoutOnAnimationFrame = function() {
13523
- if (strategy !== "off") {
13524
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
13525
- rAF(layoutOnAnimationFrame);
13526
- return;
13527
- }
13528
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
13529
- updateLayoutIfChanged(node);
13530
- });
13531
- }
13532
- rAF(layoutOnAnimationFrame);
13533
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
13521
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
13534
13522
  async function updateLayoutIfChanged(node) {
13535
13523
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
13536
13524
  var onLayout = LayoutHandlers.get(node);
@@ -13540,8 +13528,8 @@ var require_index_native19 = __commonJS({
13540
13528
  var nodeRect, parentRect;
13541
13529
  if (strategy === "async") {
13542
13530
  var [nr, pr] = await Promise.all([
13543
- getBoundingClientRectAsync(node),
13544
- getBoundingClientRectAsync(parentNode)
13531
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
13532
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
13545
13533
  ]);
13546
13534
  if (nr === !1 || pr === !1) return;
13547
13535
  nodeRect = nr, parentRect = pr;
@@ -13562,8 +13550,56 @@ var require_index_native19 = __commonJS({
13562
13550
  }
13563
13551
  }
13564
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
+ }
13565
13601
  } else process.env.NODE_ENV === "development" && console.warn("No requestAnimationFrame - please polyfill for onLayout to work correctly");
13566
- 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) {
13567
13603
  return {
13568
13604
  nativeEvent: {
13569
13605
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -24662,13 +24698,13 @@ var require_Popper_native = __commonJS({
24662
24698
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
24663
24699
  passThrough,
24664
24700
  ref: contentRefs,
24701
+ contain: "layout style",
24665
24702
  ...passThrough ? null : floatingProps,
24666
24703
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperContentFrame, {
24667
24704
  passThrough,
24668
24705
  ...!passThrough && {
24669
24706
  "data-placement": placement,
24670
24707
  "data-strategy": strategy,
24671
- contain: "layout",
24672
24708
  size: size2,
24673
24709
  ...style,
24674
24710
  ...rest