tamagui 1.130.1 → 1.130.2

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
@@ -7401,7 +7401,9 @@ var require_useThemeState_native = __commonJS({
7401
7401
  var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0, { debug } = props, parentState = states.get(parentId);
7402
7402
  if (props.passThrough) return [
7403
7403
  !1,
7404
- lastState ?? parentState
7404
+ lastState || parentState || {
7405
+ name: ""
7406
+ }
7405
7407
  ];
7406
7408
  themes || (themes = (0, import_config.getConfig)().themes);
7407
7409
  var name = !propsKey && (!lastState || !(lastState != null && lastState.isNew)) ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate === "force" ? !0 : !!needsUpdate), isSameAsParent = parentState && (!name || name === parentState.name), shouldRerender = !!(needsUpdate && (pendingUpdate || (lastState == null ? void 0 : lastState.name) !== (parentState == null ? void 0 : parentState.name)));
@@ -7748,10 +7750,10 @@ var require_useTheme_native = __commonJS({
7748
7750
  return res;
7749
7751
  }, useThemeWithState = function(props) {
7750
7752
  var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, keys = (0, import_react3.useRef)(null), themeState = (0, import_useThemeState.useThemeState)(props, isRoot, keys);
7751
- process.env.NODE_ENV === "development" && (themeState != null && themeState.theme || process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.error(`[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(props)}).
7753
+ process.env.NODE_ENV === "development" && !props.passThrough && !(themeState != null && themeState.theme) && process.env.TAMAGUI_DISABLE_NO_THEME_WARNING !== "1" && console.error(`[tamagui] No theme found, this could be due to an invalid theme name (given theme props ${JSON.stringify(props)}).
7752
7754
 
7753
- If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`));
7754
- var themeProxied = (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
7755
+ If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`);
7756
+ var themeProxied = props.passThrough ? {} : (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
7755
7757
  return [
7756
7758
  themeProxied,
7757
7759
  themeState
@@ -7915,7 +7917,7 @@ var require_Theme_native = __commonJS({
7915
7917
  })) : child;
7916
7918
  });
7917
7919
  }
7918
- if (process.env.NODE_ENV === "development" && props.debug && console.warn(" getThemedChildren", {
7920
+ if (process.env.NODE_ENV === "development" && !passThrough && props.debug && console.warn(" getThemedChildren", {
7919
7921
  requiresExtraWrapper,
7920
7922
  forceClassName,
7921
7923
  themeState,
@@ -7923,7 +7925,7 @@ var require_Theme_native = __commonJS({
7923
7925
  ...getThemeClassNameAndStyle(themeState, props, isRoot)
7924
7926
  }), forceClassName === !1) return children;
7925
7927
  if (import_constants4.isWeb) {
7926
- var { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
7928
+ var { className = "", style } = passThrough ? {} : getThemeClassNameAndStyle(themeState, props, isRoot);
7927
7929
  if (children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {
7928
7930
  className: `${className} _dsp_contents is_Theme`,
7929
7931
  style: passThrough ? void 0 : style,
@@ -8787,7 +8789,7 @@ var require_createComponent_native = __commonJS({
8787
8789
  });
8788
8790
  }
8789
8791
  }
8790
- if (splitStyles && (!hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8792
+ if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8791
8793
  var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
8792
8794
  stateRef.current.setStateShallow = function(nextOrGetNext) {
8793
8795
  var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
@@ -8805,9 +8807,9 @@ var require_createComponent_native = __commonJS({
8805
8807
  props
8806
8808
  }), console.info(stateRef.current.host), console.groupEnd());
8807
8809
  var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8808
- if (groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState), !hasAnimationProp || !useStyleListener) return;
8810
+ groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8809
8811
  var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8810
- useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8812
+ useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8811
8813
  } else process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && console.info("[\u{1F40C}] re-render", {
8812
8814
  canAvoidReRender,
8813
8815
  next
@@ -13407,7 +13409,7 @@ var require_index_native19 = __commonJS({
13407
13409
  }
13408
13410
  });
13409
13411
  module2.exports = __toCommonJS2(index_exports2);
13410
- var import_constants4 = require_index_native6(), import_is_equal_shallow = require_index_native12(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), strategy = "async";
13412
+ var import_constants4 = require_index_native6(), import_is_equal_shallow = require_index_native12(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), IntersectionState = /* @__PURE__ */ new WeakMap(), globalIntersectionObserver = null, strategy = "async";
13411
13413
  function setOnLayoutStrategy3(state) {
13412
13414
  strategy = state;
13413
13415
  }
@@ -13418,52 +13420,64 @@ var require_index_native19 = __commonJS({
13418
13420
  }), queuedUpdates.clear()));
13419
13421
  }
13420
13422
  var expectedFrameTime = 16.67, numDroppedFramesUntilPause = 10;
13423
+ function startGlobalIntersectionObserver() {
13424
+ !import_constants4.isClient || globalIntersectionObserver || (globalIntersectionObserver = new IntersectionObserver(function(entries) {
13425
+ entries.forEach(function(entry) {
13426
+ var node = entry.target;
13427
+ IntersectionState.get(node) !== entry.isIntersecting && IntersectionState.set(node, entry.isIntersecting);
13428
+ });
13429
+ }, {
13430
+ threshold: 0
13431
+ }));
13432
+ }
13421
13433
  if (import_constants4.isClient) if (rAF) {
13422
13434
  layoutOnAnimationFrame = function() {
13423
13435
  var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
13424
- if (lastFrameAt = now, frameCount < runEveryXFrames) {
13425
- frameCount++, rAF(layoutOnAnimationFrame);
13436
+ if (lastFrameAt = now, frameCount++, frameCount % RUN_EVERY_X_FRAMES === 0) {
13437
+ frameCount = 0, rAF(layoutOnAnimationFrame);
13426
13438
  return;
13427
13439
  }
13428
- if (frameCount = 0, strategy !== "off") {
13440
+ if (strategy !== "off") {
13429
13441
  var hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
13430
13442
  hasRecentSyncWork || Nodes.forEach(function(node) {
13431
13443
  updateLayoutIfChanged(node, lastFrameAt);
13432
13444
  });
13433
13445
  }
13434
13446
  rAF(layoutOnAnimationFrame);
13435
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, lastFrameAt = Date.now();
13447
+ }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
13436
13448
  async function updateLayoutIfChanged(node, frameId) {
13437
- var onLayout = LayoutHandlers.get(node);
13438
- if (typeof onLayout == "function") {
13439
- var parentNode = node.parentElement;
13440
- if (parentNode) {
13441
- var nodeRect, parentRect;
13442
- if (strategy === "async") {
13443
- var [nr, pr] = await Promise.all([
13444
- getBoundingClientRectAsync(node),
13445
- getBoundingClientRectAsync(parentNode)
13446
- ]);
13447
- if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
13448
- nodeRect = nr, parentRect = pr;
13449
- } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
13450
- var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
13451
- if (!cachedRect || // has changed one rect
13452
- // @ts-expect-error DOMRectReadOnly can go into object
13453
- !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && // @ts-expect-error DOMRectReadOnly can go into object
13454
- (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
13455
- NodeRectCache.set(node, nodeRect), ParentRectCache.set(parentNode, parentRect);
13456
- var event = getElementLayoutEvent(nodeRect, parentRect);
13457
- avoidUpdates ? queuedUpdates.set(node, function() {
13458
- return onLayout(event);
13459
- }) : onLayout(event);
13449
+ if (!(supportsCheckVisibility && !node.checkVisibility()) && IntersectionState.get(node) !== !1) {
13450
+ var onLayout = LayoutHandlers.get(node);
13451
+ if (typeof onLayout == "function") {
13452
+ var parentNode = node.parentElement;
13453
+ if (parentNode) {
13454
+ var nodeRect, parentRect;
13455
+ if (strategy === "async") {
13456
+ var [nr, pr] = await Promise.all([
13457
+ getBoundingClientRectAsync(node),
13458
+ getBoundingClientRectAsync(parentNode)
13459
+ ]);
13460
+ if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
13461
+ nodeRect = nr, parentRect = pr;
13462
+ } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
13463
+ var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
13464
+ if (!cachedRect || // has changed one rect
13465
+ // @ts-expect-error DOMRectReadOnly can go into object
13466
+ !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && // @ts-expect-error DOMRectReadOnly can go into object
13467
+ (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
13468
+ NodeRectCache.set(node, nodeRect), ParentRectCache.set(parentNode, parentRect);
13469
+ var event = getElementLayoutEvent(nodeRect, parentRect);
13470
+ avoidUpdates ? queuedUpdates.set(node, function() {
13471
+ return onLayout(event);
13472
+ }) : onLayout(event);
13473
+ }
13460
13474
  }
13461
13475
  }
13462
13476
  }
13463
13477
  }
13464
- rAF(layoutOnAnimationFrame), frameCount = 0, runEveryXFrames = 6;
13478
+ rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 4;
13465
13479
  } else process.env.NODE_ENV === "development" && console.warn("No requestAnimationFrame - please polyfill for onLayout to work correctly");
13466
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, frameCount, runEveryXFrames, getElementLayoutEvent = function(nodeRect, parentRect) {
13480
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, lastFrameAt, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
13467
13481
  return {
13468
13482
  nativeEvent: {
13469
13483
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -13528,10 +13542,10 @@ var require_index_native19 = __commonJS({
13528
13542
  if (onLayout) {
13529
13543
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
13530
13544
  if (node2) {
13531
- LayoutHandlers.set(node2, onLayout), Nodes.add(node2);
13545
+ LayoutHandlers.set(node2, onLayout), Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
13532
13546
  var parentNode = node2.parentNode;
13533
13547
  return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
13534
- Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2);
13548
+ Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2), IntersectionState.delete(node2), globalIntersectionObserver && globalIntersectionObserver.unobserve(node2);
13535
13549
  };
13536
13550
  }
13537
13551
  }
@@ -13545,14 +13559,13 @@ var require_index_native19 = __commonJS({
13545
13559
  }
13546
13560
  var getBoundingClientRectAsync = function(node) {
13547
13561
  return new Promise(function(res) {
13548
- if (!(!node || node.nodeType !== 1)) {
13549
- var io = new IntersectionObserver(function(entries) {
13550
- return entries[0].isIntersecting ? (io.disconnect(), res(entries[0].boundingClientRect)) : res(!1);
13551
- }, {
13552
- threshold: 0
13553
- });
13554
- io.observe(node);
13555
- }
13562
+ if (!node || node.nodeType !== 1) return res(!1);
13563
+ var io = new IntersectionObserver(function(entries) {
13564
+ return io.disconnect(), res(entries[0].boundingClientRect);
13565
+ }, {
13566
+ threshold: 0
13567
+ });
13568
+ io.observe(node);
13556
13569
  });
13557
13570
  }, getBoundingClientRect = function(node) {
13558
13571
  var _node_getBoundingClientRect;
@@ -18637,7 +18650,7 @@ var require_SheetImplementationCustom_native = __commonJS({
18637
18650
  }, previouslyScrolling = !1, onMoveShouldSet = function(e, param) {
18638
18651
  var { dy } = param;
18639
18652
  function getShouldSet() {
18640
- if (e.target === providerProps.handleRef.current || !scrollEnabled.current) return !0;
18653
+ if (e.target === providerProps.handleRef.current) return !0;
18641
18654
  if (scrollBridge.scrollLock) return !1;
18642
18655
  var isScrolled = scrollBridge.y !== 0, isDraggingUp = dy < 0, isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
18643
18656
  return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 10;
@@ -19221,7 +19234,7 @@ var require_createSheet_native = __commonJS({
19221
19234
  element
19222
19235
  ]), context.onlyShowFrame, null;
19223
19236
  })), SheetFrame = Frame.extractable(/* @__PURE__ */ (0, import_react3.forwardRef)(function(param2, forwardedRef) {
19224
- var { __scopeSheet, adjustPaddingForOffscreenContent, disableHideBottomOverflow, children, ...props } = param2, context = (0, import_SheetContext.useSheetContext)(import_constants22.SHEET_NAME, __scopeSheet), { hasFit, removeScrollEnabled, frameSize, contentRef, open } = context, composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context), sheetContents = (0, import_react3.useMemo)(function() {
19237
+ var { __scopeSheet, adjustPaddingForOffscreenContent, disableHideBottomOverflow, children, ...props } = param2, context = (0, import_SheetContext.useSheetContext)(import_constants22.SHEET_NAME, __scopeSheet), { hasFit, removeScrollEnabled = !0, frameSize, contentRef, open } = context, composedContentRef = (0, import_compose_refs.useComposedRefs)(forwardedRef, contentRef), offscreenSize = (0, import_useSheetOffscreenSize.useSheetOffscreenSize)(context), sheetContents = (0, import_react3.useMemo)(function() {
19225
19238
  return (
19226
19239
  // @ts-expect-error
19227
19240
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Frame, {
@@ -24937,23 +24950,20 @@ var require_Popover_native = __commonJS({
24937
24950
  }));
24938
24951
  function PopoverRepropagateContext(props) {
24939
24952
  var popperContext = (0, import_popper.usePopperContext)(props.scope || POPOVER_SCOPE);
24940
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.Portal, {
24941
- zIndex: props.zIndex,
24942
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.PopperContext.Provider, {
24943
- scope: props.scope,
24944
- ...popperContext,
24945
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, {
24946
- ...props.context,
24947
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.ProvideAdaptContext, {
24948
- ...props.adaptContext,
24949
- children: props.children
24950
- })
24953
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.PopperContext.Provider, {
24954
+ scope: props.scope,
24955
+ ...popperContext,
24956
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, {
24957
+ ...props.context,
24958
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.ProvideAdaptContext, {
24959
+ ...props.adaptContext,
24960
+ children: props.children
24951
24961
  })
24952
24962
  })
24953
24963
  });
24954
24964
  }
24955
24965
  function PopoverContentPortal(props) {
24956
- var { __scopePopover } = props, zIndex = props.zIndex, context = usePopoverContext(__scopePopover), themeName = (0, import_core12.useThemeName)(), adaptContext = (0, import_adapt.useAdaptContext)(), contents = props.children;
24966
+ var { __scopePopover } = props, zIndex = props.zIndex, context = usePopoverContext(__scopePopover), themeName = (0, import_core12.useThemeName)(), adaptContext = (0, import_adapt.useAdaptContext)(), contents = props.children, isPopover = !context.breakpointActive, isSheet = context.breakpointActive;
24957
24967
  return needsRepropagation && (contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverRepropagateContext, {
24958
24968
  scope: __scopePopover || POPOVER_SCOPE,
24959
24969
  context,
@@ -24967,10 +24977,11 @@ var require_Popover_native = __commonJS({
24967
24977
  /* forceClassName avoids forced re-mount renders for some reason... see the HeadMenu as you change tints a few times */
24968
24978
  /* without this you'll see the site menu re-rendering. It must be something in wrapping children in Theme */
24969
24979
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core12.Theme, {
24980
+ passThrough: isPopover,
24970
24981
  forceClassName: !0,
24971
24982
  name: themeName,
24972
24983
  children: [
24973
- !!context.open && !context.breakpointActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
24984
+ !!context.open && isSheet && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
24974
24985
  fullscreen: !0,
24975
24986
  onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.onOpenToggle)
24976
24987
  }),