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.
@@ -7011,7 +7011,9 @@ var require_useThemeState_native = __commonJS({
7011
7011
  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);
7012
7012
  if (props.passThrough) return [
7013
7013
  !1,
7014
- lastState ?? parentState
7014
+ lastState || parentState || {
7015
+ name: ""
7016
+ }
7015
7017
  ];
7016
7018
  themes || (themes = (0, import_config.getConfig)().themes);
7017
7019
  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)));
@@ -7345,7 +7347,7 @@ var require_useTheme_native = __commonJS({
7345
7347
  var props = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {}, [theme] = useThemeWithState(props), res = theme;
7346
7348
  return res;
7347
7349
  }, useThemeWithState = function(props) {
7348
- 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), themeProxied = (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
7350
+ 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), themeProxied = props.passThrough ? {} : (0, import_getThemeProxied.getThemeProxied)(props, themeState, keys);
7349
7351
  return [
7350
7352
  themeProxied,
7351
7353
  themeState
@@ -7507,7 +7509,7 @@ var require_Theme_native = __commonJS({
7507
7509
  }
7508
7510
  if (forceClassName === !1) return children;
7509
7511
  if (import_constants4.isWeb) {
7510
- var { className, style } = getThemeClassNameAndStyle(themeState, props, isRoot);
7512
+ var { className = "", style } = passThrough ? {} : getThemeClassNameAndStyle(themeState, props, isRoot);
7511
7513
  if (children = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", {
7512
7514
  className: `${className} _dsp_contents is_Theme`,
7513
7515
  style: passThrough ? void 0 : style,
@@ -8305,7 +8307,7 @@ var require_createComponent_native = __commonJS({
8305
8307
  });
8306
8308
  }
8307
8309
  }
8308
- if (splitStyles && (!hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8310
+ if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8309
8311
  var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
8310
8312
  stateRef.current.setStateShallow = function(nextOrGetNext) {
8311
8313
  var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
@@ -8320,9 +8322,9 @@ var require_createComponent_native = __commonJS({
8320
8322
  };
8321
8323
  NextState.set(stateRef, updatedState);
8322
8324
  var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8323
- if (groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState), !hasAnimationProp || !useStyleListener) return;
8325
+ groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8324
8326
  var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8325
- useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8327
+ useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8326
8328
  } else ogSetStateShallow(next);
8327
8329
  }
8328
8330
  }, setStateShallow = function(state2) {
@@ -12835,7 +12837,7 @@ var require_index_native19 = __commonJS({
12835
12837
  }
12836
12838
  });
12837
12839
  module2.exports = __toCommonJS2(index_exports2);
12838
- var import_constants4 = require_index_native6(), import_is_equal_shallow = require_index_native12(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), Nodes = /* @__PURE__ */ new Set(), strategy = "async";
12840
+ 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";
12839
12841
  function setOnLayoutStrategy3(state) {
12840
12842
  strategy = state;
12841
12843
  }
@@ -12846,52 +12848,64 @@ var require_index_native19 = __commonJS({
12846
12848
  }), queuedUpdates.clear()));
12847
12849
  }
12848
12850
  var expectedFrameTime = 16.67, numDroppedFramesUntilPause = 10;
12851
+ function startGlobalIntersectionObserver() {
12852
+ !import_constants4.isClient || globalIntersectionObserver || (globalIntersectionObserver = new IntersectionObserver(function(entries) {
12853
+ entries.forEach(function(entry) {
12854
+ var node = entry.target;
12855
+ IntersectionState.get(node) !== entry.isIntersecting && IntersectionState.set(node, entry.isIntersecting);
12856
+ });
12857
+ }, {
12858
+ threshold: 0
12859
+ }));
12860
+ }
12849
12861
  if (import_constants4.isClient && rAF) {
12850
12862
  layoutOnAnimationFrame = function() {
12851
12863
  var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
12852
- if (lastFrameAt = now, frameCount < runEveryXFrames) {
12853
- frameCount++, rAF(layoutOnAnimationFrame);
12864
+ if (lastFrameAt = now, frameCount++, frameCount % RUN_EVERY_X_FRAMES === 0) {
12865
+ frameCount = 0, rAF(layoutOnAnimationFrame);
12854
12866
  return;
12855
12867
  }
12856
- if (frameCount = 0, strategy !== "off") {
12868
+ if (strategy !== "off") {
12857
12869
  var hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
12858
12870
  hasRecentSyncWork || Nodes.forEach(function(node) {
12859
12871
  updateLayoutIfChanged(node, lastFrameAt);
12860
12872
  });
12861
12873
  }
12862
12874
  rAF(layoutOnAnimationFrame);
12863
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, lastFrameAt = Date.now();
12875
+ }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
12864
12876
  async function updateLayoutIfChanged(node, frameId) {
12865
- var onLayout = LayoutHandlers.get(node);
12866
- if (typeof onLayout == "function") {
12867
- var parentNode = node.parentElement;
12868
- if (parentNode) {
12869
- var nodeRect, parentRect;
12870
- if (strategy === "async") {
12871
- var [nr, pr] = await Promise.all([
12872
- getBoundingClientRectAsync(node),
12873
- getBoundingClientRectAsync(parentNode)
12874
- ]);
12875
- if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
12876
- nodeRect = nr, parentRect = pr;
12877
- } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
12878
- var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
12879
- if (!cachedRect || // has changed one rect
12880
- // @ts-expect-error DOMRectReadOnly can go into object
12881
- !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && // @ts-expect-error DOMRectReadOnly can go into object
12882
- (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
12883
- NodeRectCache.set(node, nodeRect), ParentRectCache.set(parentNode, parentRect);
12884
- var event = getElementLayoutEvent(nodeRect, parentRect);
12885
- avoidUpdates ? queuedUpdates.set(node, function() {
12886
- return onLayout(event);
12887
- }) : onLayout(event);
12877
+ if (!(supportsCheckVisibility && !node.checkVisibility()) && IntersectionState.get(node) !== !1) {
12878
+ var onLayout = LayoutHandlers.get(node);
12879
+ if (typeof onLayout == "function") {
12880
+ var parentNode = node.parentElement;
12881
+ if (parentNode) {
12882
+ var nodeRect, parentRect;
12883
+ if (strategy === "async") {
12884
+ var [nr, pr] = await Promise.all([
12885
+ getBoundingClientRectAsync(node),
12886
+ getBoundingClientRectAsync(parentNode)
12887
+ ]);
12888
+ if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
12889
+ nodeRect = nr, parentRect = pr;
12890
+ } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
12891
+ var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
12892
+ if (!cachedRect || // has changed one rect
12893
+ // @ts-expect-error DOMRectReadOnly can go into object
12894
+ !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && // @ts-expect-error DOMRectReadOnly can go into object
12895
+ (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
12896
+ NodeRectCache.set(node, nodeRect), ParentRectCache.set(parentNode, parentRect);
12897
+ var event = getElementLayoutEvent(nodeRect, parentRect);
12898
+ avoidUpdates ? queuedUpdates.set(node, function() {
12899
+ return onLayout(event);
12900
+ }) : onLayout(event);
12901
+ }
12888
12902
  }
12889
12903
  }
12890
12904
  }
12891
12905
  }
12892
- rAF(layoutOnAnimationFrame), frameCount = 0, runEveryXFrames = 6;
12906
+ rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 4;
12893
12907
  }
12894
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, frameCount, runEveryXFrames, getElementLayoutEvent = function(nodeRect, parentRect) {
12908
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, lastFrameAt, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
12895
12909
  return {
12896
12910
  nativeEvent: {
12897
12911
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -12956,10 +12970,10 @@ var require_index_native19 = __commonJS({
12956
12970
  if (onLayout) {
12957
12971
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
12958
12972
  if (node2) {
12959
- LayoutHandlers.set(node2, onLayout), Nodes.add(node2);
12973
+ LayoutHandlers.set(node2, onLayout), Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
12960
12974
  var parentNode = node2.parentNode;
12961
12975
  return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
12962
- Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2);
12976
+ Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2), IntersectionState.delete(node2), globalIntersectionObserver && globalIntersectionObserver.unobserve(node2);
12963
12977
  };
12964
12978
  }
12965
12979
  }
@@ -12973,14 +12987,13 @@ var require_index_native19 = __commonJS({
12973
12987
  }
12974
12988
  var getBoundingClientRectAsync = function(node) {
12975
12989
  return new Promise(function(res) {
12976
- if (!(!node || node.nodeType !== 1)) {
12977
- var io = new IntersectionObserver(function(entries) {
12978
- return entries[0].isIntersecting ? (io.disconnect(), res(entries[0].boundingClientRect)) : res(!1);
12979
- }, {
12980
- threshold: 0
12981
- });
12982
- io.observe(node);
12983
- }
12990
+ if (!node || node.nodeType !== 1) return res(!1);
12991
+ var io = new IntersectionObserver(function(entries) {
12992
+ return io.disconnect(), res(entries[0].boundingClientRect);
12993
+ }, {
12994
+ threshold: 0
12995
+ });
12996
+ io.observe(node);
12984
12997
  });
12985
12998
  }, getBoundingClientRect = function(node) {
12986
12999
  var _node_getBoundingClientRect;
@@ -18037,7 +18050,7 @@ var require_SheetImplementationCustom_native = __commonJS({
18037
18050
  }, previouslyScrolling = !1, onMoveShouldSet = function(e, param) {
18038
18051
  var { dy } = param;
18039
18052
  function getShouldSet() {
18040
- if (e.target === providerProps.handleRef.current || !scrollEnabled.current) return !0;
18053
+ if (e.target === providerProps.handleRef.current) return !0;
18041
18054
  if (scrollBridge.scrollLock) return !1;
18042
18055
  var isScrolled = scrollBridge.y !== 0, isDraggingUp = dy < 0, isNearTop = scrollBridge.paneY - 5 <= scrollBridge.paneMinY;
18043
18056
  return isScrolled ? (previouslyScrolling = !0, !1) : isNearTop && hasScrollView.current && isDraggingUp ? !1 : Math.abs(dy) > 10;
@@ -18621,7 +18634,7 @@ var require_createSheet_native = __commonJS({
18621
18634
  element
18622
18635
  ]), context.onlyShowFrame, null;
18623
18636
  })), SheetFrame = Frame.extractable(/* @__PURE__ */ (0, import_react3.forwardRef)(function(param2, forwardedRef) {
18624
- 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() {
18637
+ 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() {
18625
18638
  return (
18626
18639
  // @ts-expect-error
18627
18640
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(Frame, {
@@ -24250,23 +24263,20 @@ var require_Popover_native = __commonJS({
24250
24263
  }));
24251
24264
  function PopoverRepropagateContext(props) {
24252
24265
  var popperContext = (0, import_popper.usePopperContext)(props.scope || POPOVER_SCOPE);
24253
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_portal2.Portal, {
24254
- zIndex: props.zIndex,
24255
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.PopperContext.Provider, {
24256
- scope: props.scope,
24257
- ...popperContext,
24258
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, {
24259
- ...props.context,
24260
- children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.ProvideAdaptContext, {
24261
- ...props.adaptContext,
24262
- children: props.children
24263
- })
24266
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_popper.PopperContext.Provider, {
24267
+ scope: props.scope,
24268
+ ...popperContext,
24269
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverContext.Provider, {
24270
+ ...props.context,
24271
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_adapt.ProvideAdaptContext, {
24272
+ ...props.adaptContext,
24273
+ children: props.children
24264
24274
  })
24265
24275
  })
24266
24276
  });
24267
24277
  }
24268
24278
  function PopoverContentPortal(props) {
24269
- var { __scopePopover } = props, zIndex = props.zIndex, context = usePopoverContext(__scopePopover), themeName = (0, import_core12.useThemeName)(), adaptContext = (0, import_adapt.useAdaptContext)(), contents = props.children;
24279
+ 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;
24270
24280
  return needsRepropagation && (contents = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopoverRepropagateContext, {
24271
24281
  scope: __scopePopover || POPOVER_SCOPE,
24272
24282
  context,
@@ -24280,10 +24290,11 @@ var require_Popover_native = __commonJS({
24280
24290
  /* forceClassName avoids forced re-mount renders for some reason... see the HeadMenu as you change tints a few times */
24281
24291
  /* without this you'll see the site menu re-rendering. It must be something in wrapping children in Theme */
24282
24292
  /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_core12.Theme, {
24293
+ passThrough: isPopover,
24283
24294
  forceClassName: !0,
24284
24295
  name: themeName,
24285
24296
  children: [
24286
- !!context.open && !context.breakpointActive && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
24297
+ !!context.open && isSheet && /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_stacks3.YStack, {
24287
24298
  fullscreen: !0,
24288
24299
  onPress: (0, import_helpers.composeEventHandlers)(props.onPress, context.onOpenToggle)
24289
24300
  }),