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.
@@ -6529,7 +6529,7 @@ var require_getSplitStyles_native = __commonJS({
6529
6529
  var { asChild } = props, { accept } = staticConfig, { noSkip, disableExpandShorthands, noExpand } = styleProps, { webContainerType } = conf.settings, parentVariants = parentStaticConfig == null ? void 0 : parentStaticConfig.variants;
6530
6530
  for (var keyOg in props) _loop(keyOg);
6531
6531
  var avoidNormalize = styleProps.noNormalize === !1;
6532
- if (debug && console.warn("?", avoidNormalize, styleProps.noExpand, styleProps.noMergeStyle, styleState.style), !avoidNormalize) {
6532
+ if (!avoidNormalize) {
6533
6533
  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) {
6534
6534
  var _styleState;
6535
6535
  (_styleState = styleState).style || (_styleState.style = {}), mergeFlatTransforms(styleState.style, styleState.flatTransforms);
@@ -8287,10 +8287,10 @@ var require_createComponent_native = __commonJS({
8287
8287
  } : defaultProps, props = propsIn;
8288
8288
  curDefaultProps && (props = (0, import_mergeProps.mergeProps)(curDefaultProps, propsIn));
8289
8289
  var componentName2 = props.componentName || staticConfig.componentName, 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;
8290
- hasAnimationProp && animationDriver != null && animationDriver.avoidReRenders && (0, import_constants4.useIsomorphicLayoutEffect)(function() {
8290
+ if (hasAnimationProp && animationDriver != null && animationDriver.avoidReRenders) {
8291
8291
  var pendingState = NextState.get(stateRef);
8292
- pendingState && (setStateShallow(pendingState), NextState.set(stateRef, void 0));
8293
- });
8292
+ pendingState && (NextState.set(stateRef, void 0), componentState.setStateShallow(pendingState));
8293
+ }
8294
8294
  var allGroupContexts = (0, import_react3.useMemo)(function() {
8295
8295
  var _stateRef_current_group;
8296
8296
  if (!groupName || props.passThrough) return groupContextParent;
@@ -8377,31 +8377,30 @@ var require_createComponent_native = __commonJS({
8377
8377
  }
8378
8378
  }
8379
8379
  if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8380
- var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
8381
- componentContext.mediaEmit = function(next) {
8382
- NextMedia.set(stateRef, next), updateStyleListener();
8383
- };
8384
- var updateStyleListener = function() {
8380
+ var _componentContext, ogSetStateShallow = setStateShallow;
8381
+ stateRef.current.updateStyleListener = function() {
8385
8382
  var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8386
8383
  groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8387
8384
  var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
8388
8385
  ...styleProps,
8389
8386
  mediaState: mediaState22
8390
- } : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8387
+ } : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), useStyleListener = stateRef.current.useStyleListener;
8391
8388
  useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8392
- };
8393
- stateRef.current.setStateShallow = function(nextOrGetNext) {
8389
+ }, (_componentContext = componentContext).mediaEmit || (_componentContext.mediaEmit = function(next) {
8390
+ var _stateRef_current_updateStyleListener, _stateRef_current;
8391
+ NextMedia.set(stateRef, next), (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
8392
+ }), stateRef.current.setStateShallow = function(nextOrGetNext) {
8394
8393
  var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
8395
8394
  if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
8396
8395
  var canAvoidReRender = Object.keys(next).every(function(key3) {
8397
8396
  return avoidReRenderKeys.has(key3);
8398
8397
  });
8399
8398
  if (canAvoidReRender) {
8400
- var updatedState = {
8399
+ var _stateRef_current_updateStyleListener, _stateRef_current, updatedState = {
8401
8400
  ...prev,
8402
8401
  ...next
8403
8402
  };
8404
- NextState.set(stateRef, updatedState), updateStyleListener();
8403
+ NextState.set(stateRef, updatedState), (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
8405
8404
  } else ogSetStateShallow(next);
8406
8405
  }
8407
8406
  }, setStateShallow = function(state2) {
@@ -12948,18 +12947,7 @@ var require_index_native19 = __commonJS({
12948
12947
  }));
12949
12948
  }
12950
12949
  if (import_constants4.isClient && rAF) {
12951
- layoutOnAnimationFrame = function() {
12952
- if (strategy !== "off") {
12953
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12954
- rAF(layoutOnAnimationFrame);
12955
- return;
12956
- }
12957
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
12958
- updateLayoutIfChanged(node);
12959
- });
12960
- }
12961
- rAF(layoutOnAnimationFrame);
12962
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
12950
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
12963
12951
  async function updateLayoutIfChanged(node) {
12964
12952
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
12965
12953
  var onLayout = LayoutHandlers.get(node);
@@ -12969,8 +12957,8 @@ var require_index_native19 = __commonJS({
12969
12957
  var nodeRect, parentRect;
12970
12958
  if (strategy === "async") {
12971
12959
  var [nr, pr] = await Promise.all([
12972
- getBoundingClientRectAsync(node),
12973
- getBoundingClientRectAsync(parentNode)
12960
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
12961
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
12974
12962
  ]);
12975
12963
  if (nr === !1 || pr === !1) return;
12976
12964
  nodeRect = nr, parentRect = pr;
@@ -12991,8 +12979,56 @@ var require_index_native19 = __commonJS({
12991
12979
  }
12992
12980
  }
12993
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
+ }
12994
13030
  }
12995
- 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) {
12996
13032
  return {
12997
13033
  nativeEvent: {
12998
13034
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -23976,13 +24012,13 @@ var require_Popper_native = __commonJS({
23976
24012
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
23977
24013
  passThrough,
23978
24014
  ref: contentRefs,
24015
+ contain: "layout style",
23979
24016
  ...passThrough ? null : floatingProps,
23980
24017
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperContentFrame, {
23981
24018
  passThrough,
23982
24019
  ...!passThrough && {
23983
24020
  "data-placement": placement,
23984
24021
  "data-strategy": strategy,
23985
- contain: "layout",
23986
24022
  size: size2,
23987
24023
  ...style,
23988
24024
  ...rest