tamagui 2.2.0 → 2.3.1

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.
@@ -1,5 +1,4 @@
1
-
2
- $ tamagui-build
3
- built tamagui in 1777 ms
4
- Running afterBuild script...
5
- afterBuild completed in 409 ms
1
+ $ tamagui-build
2
+ built tamagui in 958 ms
3
+ Running afterBuild script...
4
+ afterBuild completed in 261 ms
package/dist/native.cjs CHANGED
@@ -1021,7 +1021,7 @@ var init_index_native$11 = __esmMin((() => {
1021
1021
  avoidUpdates = true;
1022
1022
  queuedUpdates = /* @__PURE__ */ new Map();
1023
1023
  if (ENABLE) {
1024
- let ensureRectFetchObserver = function() {
1024
+ let ensureRectFetchObserver2 = function() {
1025
1025
  if (rectFetchObserver) return rectFetchObserver;
1026
1026
  rectFetchObserver = new IntersectionObserver(function(entries) {
1027
1027
  lastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);
@@ -1118,7 +1118,7 @@ var init_index_native$11 = __esmMin((() => {
1118
1118
  }
1119
1119
  }
1120
1120
  if (visibleNodes.length > 0) {
1121
- var io = ensureRectFetchObserver();
1121
+ var io = ensureRectFetchObserver2();
1122
1122
  rectFetchStartTime = performance.now();
1123
1123
  for (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[i]);
1124
1124
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
@@ -11838,9 +11838,19 @@ var init_constants_native$1 = __esmMin((() => {
11838
11838
  }[Platform.OS] : void 0) || "native";
11839
11839
  }));
11840
11840
  //#endregion
11841
+ //#region ../../core/constants/dist/esm/platformDriver.native.js
11842
+ function getPlatformDriver() {
11843
+ return platformDriver;
11844
+ }
11845
+ var platformDriver;
11846
+ var init_platformDriver_native = __esmMin((() => {
11847
+ platformDriver = null;
11848
+ }));
11849
+ //#endregion
11841
11850
  //#region ../../core/constants/dist/esm/index.native.js
11842
11851
  var init_index_native$7 = __esmMin((() => {
11843
11852
  init_constants_native$1();
11853
+ init_platformDriver_native();
11844
11854
  }));
11845
11855
  //#endregion
11846
11856
  //#region ../../core/web/dist/esm/constants/constants.native.js
@@ -11922,6 +11932,7 @@ var init_config_native = __esmMin((() => {
11922
11932
  };
11923
11933
  updateConfig = function(key, value) {
11924
11934
  var config = getConfigFromGlobalOrLocal();
11935
+ if (!config || !Object.prototype.hasOwnProperty.call(config, key)) return;
11925
11936
  Object.assign(config[key], value);
11926
11937
  };
11927
11938
  getFont = function(name) {
@@ -13947,10 +13958,17 @@ function useMainThreadPressEvents(events, viewProps) {
13947
13958
  ref.current.pressOutTimer = null;
13948
13959
  ref.current.longPressTimer = null;
13949
13960
  }
13950
- viewProps.onStartShouldSetResponder = function() {
13951
- return !events.disabled;
13961
+ var userStartShouldSet = viewProps.onStartShouldSetResponder;
13962
+ var userGrant = viewProps.onResponderGrant;
13963
+ var userRelease = viewProps.onResponderRelease;
13964
+ var userTerminate = viewProps.onResponderTerminate;
13965
+ var userTerminationRequest = viewProps.onResponderTerminationRequest;
13966
+ var userMove = viewProps.onResponderMove;
13967
+ viewProps.onStartShouldSetResponder = function(e) {
13968
+ return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
13952
13969
  };
13953
13970
  viewProps.onResponderGrant = function(e) {
13971
+ userGrant === null || userGrant === void 0 || userGrant(e);
13954
13972
  cleanup();
13955
13973
  ref.current.state = "pressing";
13956
13974
  if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
@@ -13966,6 +13984,7 @@ function useMainThreadPressEvents(events, viewProps) {
13966
13984
  }, delayLongPress + delayPressIn);
13967
13985
  };
13968
13986
  viewProps.onResponderRelease = function(e) {
13987
+ userRelease === null || userRelease === void 0 || userRelease(e);
13969
13988
  var wasLongPressed = ref.current.state === "longPressed";
13970
13989
  cleanup();
13971
13990
  if (ref.current.state === "pressing") activate(e);
@@ -13977,15 +13996,18 @@ function useMainThreadPressEvents(events, viewProps) {
13977
13996
  ref.current.state = "idle";
13978
13997
  };
13979
13998
  viewProps.onResponderTerminate = function(e) {
13999
+ userTerminate === null || userTerminate === void 0 || userTerminate(e);
13980
14000
  cleanup();
13981
14001
  if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
13982
14002
  ref.current.state = "idle";
13983
14003
  };
13984
- viewProps.onResponderTerminationRequest = function() {
14004
+ viewProps.onResponderTerminationRequest = function(e) {
14005
+ if (userTerminationRequest) return userTerminationRequest(e);
13985
14006
  return events.cancelable !== false;
13986
14007
  };
13987
14008
  viewProps.onResponderMove = function(e) {
13988
14009
  var _events_onPressMove;
14010
+ userMove === null || userMove === void 0 || userMove(e);
13989
14011
  (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
13990
14012
  };
13991
14013
  }
@@ -14439,11 +14461,11 @@ var init_expandStyle_native = __esmMin((() => {
14439
14461
  init_parseBorderShorthand_native();
14440
14462
  init_parseOutlineShorthand_native();
14441
14463
  init_objectSpread2();
14442
- _loop = function(parent) {
14464
+ _loop = function(parent2) {
14443
14465
  var _exec;
14444
14466
  var _exec_index;
14445
- var prefix = parent.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent.length);
14446
- EXPANSIONS[parent] = EXPANSIONS[parent].map(function(k) {
14467
+ var prefix = parent2.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent2)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent2.length);
14468
+ EXPANSIONS[parent2] = EXPANSIONS[parent2].map(function(k) {
14447
14469
  return `${prefix}${k}`;
14448
14470
  });
14449
14471
  };
@@ -16496,7 +16518,7 @@ var init_useComponentState_native = __esmMin((() => {
16496
16518
  init_objectSpread2();
16497
16519
  useComponentState = function(props, animationDriver, staticConfig, config) {
16498
16520
  "use no memo";
16499
- var _animationDriver_usePresence;
16521
+ var _getPlatformDriver, _animationDriver_usePresence;
16500
16522
  var isHydrated = useDidFinishSSR();
16501
16523
  var needsHydration = !useIsClientOnly();
16502
16524
  var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
@@ -16510,8 +16532,9 @@ var init_useComponentState_native = __esmMin((() => {
16510
16532
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
16511
16533
  var curStateRef = stateRef.current;
16512
16534
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
16535
+ var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && ("hoverStyle" in props || "pressStyle" in props || "focusStyle" in props));
16513
16536
  var willBeAnimatedClient = function() {
16514
- return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
16537
+ return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
16515
16538
  }();
16516
16539
  var willBeAnimated = willBeAnimatedClient;
16517
16540
  if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
@@ -16568,7 +16591,8 @@ var init_useComponentState_native = __esmMin((() => {
16568
16591
  inputStyle,
16569
16592
  outputStyle,
16570
16593
  willBeAnimated,
16571
- willBeAnimatedClient
16594
+ willBeAnimatedClient,
16595
+ platformPseudo
16572
16596
  };
16573
16597
  };
16574
16598
  isDisabled = function(props) {
@@ -16676,13 +16700,30 @@ function createComponent(staticConfig) {
16676
16700
  }();
16677
16701
  var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
16678
16702
  var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
16679
- var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
16703
+ var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
16680
16704
  if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
16705
+ var emitted = stateRef.current.prevPseudoState;
16706
+ if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
16707
+ var _stateRef_current_updateStyleListener, _stateRef_current;
16708
+ (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
16709
+ }
16681
16710
  var pendingState = stateRef.current.nextState;
16682
16711
  if (!pendingState) return;
16683
16712
  stateRef.current.nextState = void 0;
16684
16713
  if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
16685
16714
  });
16715
+ useIsomorphicLayoutEffect(function() {
16716
+ var _getPlatformDriver;
16717
+ if (!platformPseudo || props.disabled) return;
16718
+ var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
16719
+ var host = stateRef.current.host;
16720
+ if (!pseudoDriver || !host) return;
16721
+ return pseudoDriver.subscribe(host, function(param) {
16722
+ var { hovered } = param;
16723
+ var _stateRef_current_setStateShallow, _stateRef_current;
16724
+ (_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
16725
+ });
16726
+ }, [platformPseudo, props.disabled]);
16686
16727
  var allGroupContexts = (0, react$1.useMemo)(function() {
16687
16728
  var _stateRef_current_group_listeners, _stateRef_current_group;
16688
16729
  if (!groupName || props.passThrough) return groupContextParent;
@@ -16778,7 +16819,7 @@ function createComponent(staticConfig) {
16778
16819
  }
16779
16820
  }
16780
16821
  var hasEnterExitTransition = props.transition && _type_of$7(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
16781
- if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
16822
+ if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
16782
16823
  let updateGroupListeners2 = function() {
16783
16824
  var updatedState = stateRef.current.nextState;
16784
16825
  if (groupContext) {
@@ -16797,9 +16838,11 @@ function createComponent(staticConfig) {
16797
16838
  var updatedState = stateRef.current.nextState || state;
16798
16839
  var mediaState2 = stateRef.current.nextMedia;
16799
16840
  var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
16800
- var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, props.transition);
16841
+ var _props_transition2;
16842
+ var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, (_props_transition2 = props.transition) !== null && _props_transition2 !== void 0 ? _props_transition2 : platformPseudo ? "0ms" : void 0);
16801
16843
  stateRef.current.prevPseudoState = extractPseudoState(updatedState);
16802
- useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2);
16844
+ var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
16845
+ useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
16803
16846
  };
16804
16847
  componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
16805
16848
  if (!stateRef.current.mediaEmitCleanup) {
@@ -16877,7 +16920,8 @@ function createComponent(staticConfig) {
16877
16920
  var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
16878
16921
  stateRef.current.useStyleListener = listener;
16879
16922
  } : void 0;
16880
- var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, props.transition);
16923
+ var _props_transition;
16924
+ var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, (_props_transition = props.transition) !== null && _props_transition !== void 0 ? _props_transition : platformPseudo ? "0ms" : void 0);
16881
16925
  if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
16882
16926
  stateRef.current.prevPseudoState = extractPseudoState(state);
16883
16927
  var animations = useAnimations({
@@ -16984,7 +17028,7 @@ function createComponent(staticConfig) {
16984
17028
  var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
16985
17029
  var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
16986
17030
  var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
16987
- var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
17031
+ var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
16988
17032
  var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
16989
17033
  var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
16990
17034
  var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
package/dist/test.cjs CHANGED
@@ -1021,7 +1021,7 @@ var init_index_native$11 = __esmMin((() => {
1021
1021
  avoidUpdates = true;
1022
1022
  queuedUpdates = /* @__PURE__ */ new Map();
1023
1023
  if (ENABLE) {
1024
- let ensureRectFetchObserver = function() {
1024
+ let ensureRectFetchObserver2 = function() {
1025
1025
  if (rectFetchObserver) return rectFetchObserver;
1026
1026
  rectFetchObserver = new IntersectionObserver(function(entries) {
1027
1027
  lastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);
@@ -1118,7 +1118,7 @@ var init_index_native$11 = __esmMin((() => {
1118
1118
  }
1119
1119
  }
1120
1120
  if (visibleNodes.length > 0) {
1121
- var io = ensureRectFetchObserver();
1121
+ var io = ensureRectFetchObserver2();
1122
1122
  rectFetchStartTime = performance.now();
1123
1123
  for (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[i]);
1124
1124
  var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
@@ -12016,9 +12016,19 @@ var init_constants_native$1 = __esmMin((() => {
12016
12016
  }[Platform.OS] : void 0) || "native";
12017
12017
  }));
12018
12018
  //#endregion
12019
+ //#region ../../core/constants/dist/esm/platformDriver.native.js
12020
+ function getPlatformDriver() {
12021
+ return platformDriver;
12022
+ }
12023
+ var platformDriver;
12024
+ var init_platformDriver_native = __esmMin((() => {
12025
+ platformDriver = null;
12026
+ }));
12027
+ //#endregion
12019
12028
  //#region ../../core/constants/dist/esm/index.native.js
12020
12029
  var init_index_native$7 = __esmMin((() => {
12021
12030
  init_constants_native$1();
12031
+ init_platformDriver_native();
12022
12032
  }));
12023
12033
  //#endregion
12024
12034
  //#region ../../core/web/dist/esm/constants/constants.native.js
@@ -12100,6 +12110,7 @@ var init_config_native = __esmMin((() => {
12100
12110
  };
12101
12111
  updateConfig = function(key, value) {
12102
12112
  var config = getConfigFromGlobalOrLocal();
12113
+ if (!config || !Object.prototype.hasOwnProperty.call(config, key)) return;
12103
12114
  Object.assign(config[key], value);
12104
12115
  };
12105
12116
  getFont = function(name) {
@@ -14125,10 +14136,17 @@ function useMainThreadPressEvents(events, viewProps) {
14125
14136
  ref.current.pressOutTimer = null;
14126
14137
  ref.current.longPressTimer = null;
14127
14138
  }
14128
- viewProps.onStartShouldSetResponder = function() {
14129
- return !events.disabled;
14139
+ var userStartShouldSet = viewProps.onStartShouldSetResponder;
14140
+ var userGrant = viewProps.onResponderGrant;
14141
+ var userRelease = viewProps.onResponderRelease;
14142
+ var userTerminate = viewProps.onResponderTerminate;
14143
+ var userTerminationRequest = viewProps.onResponderTerminationRequest;
14144
+ var userMove = viewProps.onResponderMove;
14145
+ viewProps.onStartShouldSetResponder = function(e) {
14146
+ return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
14130
14147
  };
14131
14148
  viewProps.onResponderGrant = function(e) {
14149
+ userGrant === null || userGrant === void 0 || userGrant(e);
14132
14150
  cleanup();
14133
14151
  ref.current.state = "pressing";
14134
14152
  if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
@@ -14144,6 +14162,7 @@ function useMainThreadPressEvents(events, viewProps) {
14144
14162
  }, delayLongPress + delayPressIn);
14145
14163
  };
14146
14164
  viewProps.onResponderRelease = function(e) {
14165
+ userRelease === null || userRelease === void 0 || userRelease(e);
14147
14166
  var wasLongPressed = ref.current.state === "longPressed";
14148
14167
  cleanup();
14149
14168
  if (ref.current.state === "pressing") activate(e);
@@ -14155,15 +14174,18 @@ function useMainThreadPressEvents(events, viewProps) {
14155
14174
  ref.current.state = "idle";
14156
14175
  };
14157
14176
  viewProps.onResponderTerminate = function(e) {
14177
+ userTerminate === null || userTerminate === void 0 || userTerminate(e);
14158
14178
  cleanup();
14159
14179
  if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
14160
14180
  ref.current.state = "idle";
14161
14181
  };
14162
- viewProps.onResponderTerminationRequest = function() {
14182
+ viewProps.onResponderTerminationRequest = function(e) {
14183
+ if (userTerminationRequest) return userTerminationRequest(e);
14163
14184
  return events.cancelable !== false;
14164
14185
  };
14165
14186
  viewProps.onResponderMove = function(e) {
14166
14187
  var _events_onPressMove;
14188
+ userMove === null || userMove === void 0 || userMove(e);
14167
14189
  (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
14168
14190
  };
14169
14191
  }
@@ -14617,11 +14639,11 @@ var init_expandStyle_native = __esmMin((() => {
14617
14639
  init_parseBorderShorthand_native();
14618
14640
  init_parseOutlineShorthand_native();
14619
14641
  init_objectSpread2();
14620
- _loop = function(parent) {
14642
+ _loop = function(parent2) {
14621
14643
  var _exec;
14622
14644
  var _exec_index;
14623
- var prefix = parent.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent.length);
14624
- EXPANSIONS[parent] = EXPANSIONS[parent].map(function(k) {
14645
+ var prefix = parent2.slice(0, (_exec_index = (_exec = /[A-Z]/.exec(parent2)) === null || _exec === void 0 ? void 0 : _exec.index) !== null && _exec_index !== void 0 ? _exec_index : parent2.length);
14646
+ EXPANSIONS[parent2] = EXPANSIONS[parent2].map(function(k) {
14625
14647
  return `${prefix}${k}`;
14626
14648
  });
14627
14649
  };
@@ -16676,7 +16698,7 @@ var init_useComponentState_native = __esmMin((() => {
16676
16698
  init_objectSpread2();
16677
16699
  useComponentState = function(props, animationDriver, staticConfig, config) {
16678
16700
  "use no memo";
16679
- var _animationDriver_usePresence;
16701
+ var _getPlatformDriver, _animationDriver_usePresence;
16680
16702
  var isHydrated = useDidFinishSSR();
16681
16703
  var needsHydration = !useIsClientOnly();
16682
16704
  var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
@@ -16690,8 +16712,9 @@ var init_useComponentState_native = __esmMin((() => {
16690
16712
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
16691
16713
  var curStateRef = stateRef.current;
16692
16714
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
16715
+ var platformPseudo = Boolean(!isHOC && useAnimations && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && ((_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo) && ("hoverStyle" in props || "pressStyle" in props || "focusStyle" in props));
16693
16716
  var willBeAnimatedClient = function() {
16694
- return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
16717
+ return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
16695
16718
  }();
16696
16719
  var willBeAnimated = willBeAnimatedClient;
16697
16720
  if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
@@ -16748,7 +16771,8 @@ var init_useComponentState_native = __esmMin((() => {
16748
16771
  inputStyle,
16749
16772
  outputStyle,
16750
16773
  willBeAnimated,
16751
- willBeAnimatedClient
16774
+ willBeAnimatedClient,
16775
+ platformPseudo
16752
16776
  };
16753
16777
  };
16754
16778
  isDisabled = function(props) {
@@ -16861,13 +16885,30 @@ function createComponent(staticConfig) {
16861
16885
  }();
16862
16886
  var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
16863
16887
  var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
16864
- var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
16888
+ var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
16865
16889
  if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
16890
+ var emitted = stateRef.current.prevPseudoState;
16891
+ if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
16892
+ var _stateRef_current_updateStyleListener, _stateRef_current;
16893
+ (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
16894
+ }
16866
16895
  var pendingState = stateRef.current.nextState;
16867
16896
  if (!pendingState) return;
16868
16897
  stateRef.current.nextState = void 0;
16869
16898
  if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
16870
16899
  });
16900
+ useIsomorphicLayoutEffect(function() {
16901
+ var _getPlatformDriver;
16902
+ if (!platformPseudo || props.disabled) return;
16903
+ var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
16904
+ var host = stateRef.current.host;
16905
+ if (!pseudoDriver || !host) return;
16906
+ return pseudoDriver.subscribe(host, function(param) {
16907
+ var { hovered } = param;
16908
+ var _stateRef_current_setStateShallow, _stateRef_current;
16909
+ (_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
16910
+ });
16911
+ }, [platformPseudo, props.disabled]);
16871
16912
  var allGroupContexts = (0, react$1.useMemo)(function() {
16872
16913
  var _stateRef_current_group_listeners, _stateRef_current_group;
16873
16914
  if (!groupName || props.passThrough) return groupContextParent;
@@ -16963,7 +17004,7 @@ function createComponent(staticConfig) {
16963
17004
  }
16964
17005
  }
16965
17006
  var hasEnterExitTransition = props.transition && _type_of$7(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
16966
- if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
17007
+ if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
16967
17008
  let updateGroupListeners2 = function() {
16968
17009
  var updatedState = stateRef.current.nextState;
16969
17010
  if (groupContext) {
@@ -16982,9 +17023,11 @@ function createComponent(staticConfig) {
16982
17023
  var updatedState = stateRef.current.nextState || state;
16983
17024
  var mediaState2 = stateRef.current.nextMedia;
16984
17025
  var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
16985
- var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, props.transition);
17026
+ var _props_transition2;
17027
+ var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, (_props_transition2 = props.transition) !== null && _props_transition2 !== void 0 ? _props_transition2 : platformPseudo ? "0ms" : void 0);
16986
17028
  stateRef.current.prevPseudoState = extractPseudoState(updatedState);
16987
- useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2);
17029
+ var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
17030
+ useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
16988
17031
  };
16989
17032
  componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
16990
17033
  if (!stateRef.current.mediaEmitCleanup) {
@@ -17062,7 +17105,8 @@ function createComponent(staticConfig) {
17062
17105
  var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
17063
17106
  stateRef.current.useStyleListener = listener;
17064
17107
  } : void 0;
17065
- var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, props.transition);
17108
+ var _props_transition;
17109
+ var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, (_props_transition = props.transition) !== null && _props_transition !== void 0 ? _props_transition : platformPseudo ? "0ms" : void 0);
17066
17110
  if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
17067
17111
  stateRef.current.prevPseudoState = extractPseudoState(state);
17068
17112
  var animations = useAnimations({
@@ -17169,7 +17213,7 @@ function createComponent(staticConfig) {
17169
17213
  var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
17170
17214
  var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
17171
17215
  var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
17172
- var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
17216
+ var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
17173
17217
  var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
17174
17218
  var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
17175
17219
  var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tamagui",
3
- "version": "2.2.0",
3
+ "version": "2.3.1",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "description": "Style and UI for React (web and native) meet an optimizing compiler",
6
6
  "repository": {
@@ -77,72 +77,72 @@
77
77
  "check-circular-deps": "npx madge --circular ./src/index.ts"
78
78
  },
79
79
  "dependencies": {
80
- "@tamagui/accordion": "2.2.0",
81
- "@tamagui/adapt": "2.2.0",
82
- "@tamagui/alert-dialog": "2.2.0",
83
- "@tamagui/animate": "2.2.0",
84
- "@tamagui/animate-presence": "2.2.0",
85
- "@tamagui/avatar": "2.2.0",
86
- "@tamagui/button": "2.2.0",
87
- "@tamagui/card": "2.2.0",
88
- "@tamagui/checkbox": "2.2.0",
89
- "@tamagui/collapsible": "2.2.0",
90
- "@tamagui/compose-refs": "2.2.0",
91
- "@tamagui/constants": "2.2.0",
92
- "@tamagui/context-menu": "2.2.0",
93
- "@tamagui/core": "2.2.0",
94
- "@tamagui/create-context": "2.2.0",
95
- "@tamagui/create-menu": "2.2.0",
96
- "@tamagui/dialog": "2.2.0",
97
- "@tamagui/element": "2.2.0",
98
- "@tamagui/elements": "2.2.0",
99
- "@tamagui/fake-react-native": "2.2.0",
100
- "@tamagui/focusable": "2.2.0",
101
- "@tamagui/form": "2.2.0",
102
- "@tamagui/get-button-sized": "2.2.0",
103
- "@tamagui/get-font-sized": "2.2.0",
104
- "@tamagui/get-token": "2.2.0",
105
- "@tamagui/group": "2.2.0",
106
- "@tamagui/helpers-tamagui": "2.2.0",
107
- "@tamagui/image": "2.2.0",
108
- "@tamagui/input": "2.2.0",
109
- "@tamagui/label": "2.2.0",
110
- "@tamagui/linear-gradient": "2.2.0",
111
- "@tamagui/list-item": "2.2.0",
112
- "@tamagui/menu": "2.2.0",
113
- "@tamagui/polyfill-dev": "2.2.0",
114
- "@tamagui/popover": "2.2.0",
115
- "@tamagui/popper": "2.2.0",
116
- "@tamagui/portal": "2.2.0",
117
- "@tamagui/progress": "2.2.0",
118
- "@tamagui/radio-group": "2.2.0",
119
- "@tamagui/react-native-media-driver": "2.2.0",
120
- "@tamagui/scroll-view": "2.2.0",
121
- "@tamagui/select": "2.2.0",
122
- "@tamagui/separator": "2.2.0",
123
- "@tamagui/shapes": "2.2.0",
124
- "@tamagui/sheet": "2.2.0",
125
- "@tamagui/slider": "2.2.0",
126
- "@tamagui/spacer": "2.2.0",
127
- "@tamagui/spinner": "2.2.0",
128
- "@tamagui/stacks": "2.2.0",
129
- "@tamagui/switch": "2.2.0",
130
- "@tamagui/tabs": "2.2.0",
131
- "@tamagui/text": "2.2.0",
132
- "@tamagui/theme": "2.2.0",
133
- "@tamagui/toast": "2.2.0",
134
- "@tamagui/toggle-group": "2.2.0",
135
- "@tamagui/tooltip": "2.2.0",
136
- "@tamagui/use-controllable-state": "2.2.0",
137
- "@tamagui/use-debounce": "2.2.0",
138
- "@tamagui/use-force-update": "2.2.0",
139
- "@tamagui/use-window-dimensions": "2.2.0",
140
- "@tamagui/visually-hidden": "2.2.0",
141
- "@tamagui/font-size": "2.2.0",
142
- "@tamagui/z-index-stack": "2.2.0"
80
+ "@tamagui/accordion": "2.3.1",
81
+ "@tamagui/adapt": "2.3.1",
82
+ "@tamagui/alert-dialog": "2.3.1",
83
+ "@tamagui/animate": "2.3.1",
84
+ "@tamagui/animate-presence": "2.3.1",
85
+ "@tamagui/avatar": "2.3.1",
86
+ "@tamagui/button": "2.3.1",
87
+ "@tamagui/card": "2.3.1",
88
+ "@tamagui/checkbox": "2.3.1",
89
+ "@tamagui/collapsible": "2.3.1",
90
+ "@tamagui/compose-refs": "2.3.1",
91
+ "@tamagui/constants": "2.3.1",
92
+ "@tamagui/context-menu": "2.3.1",
93
+ "@tamagui/core": "2.3.1",
94
+ "@tamagui/create-context": "2.3.1",
95
+ "@tamagui/create-menu": "2.3.1",
96
+ "@tamagui/dialog": "2.3.1",
97
+ "@tamagui/element": "2.3.1",
98
+ "@tamagui/elements": "2.3.1",
99
+ "@tamagui/fake-react-native": "2.3.1",
100
+ "@tamagui/focusable": "2.3.1",
101
+ "@tamagui/form": "2.3.1",
102
+ "@tamagui/get-button-sized": "2.3.1",
103
+ "@tamagui/get-font-sized": "2.3.1",
104
+ "@tamagui/get-token": "2.3.1",
105
+ "@tamagui/group": "2.3.1",
106
+ "@tamagui/helpers-tamagui": "2.3.1",
107
+ "@tamagui/image": "2.3.1",
108
+ "@tamagui/input": "2.3.1",
109
+ "@tamagui/label": "2.3.1",
110
+ "@tamagui/linear-gradient": "2.3.1",
111
+ "@tamagui/list-item": "2.3.1",
112
+ "@tamagui/menu": "2.3.1",
113
+ "@tamagui/polyfill-dev": "2.3.1",
114
+ "@tamagui/popover": "2.3.1",
115
+ "@tamagui/popper": "2.3.1",
116
+ "@tamagui/portal": "2.3.1",
117
+ "@tamagui/progress": "2.3.1",
118
+ "@tamagui/radio-group": "2.3.1",
119
+ "@tamagui/react-native-media-driver": "2.3.1",
120
+ "@tamagui/scroll-view": "2.3.1",
121
+ "@tamagui/select": "2.3.1",
122
+ "@tamagui/separator": "2.3.1",
123
+ "@tamagui/shapes": "2.3.1",
124
+ "@tamagui/sheet": "2.3.1",
125
+ "@tamagui/slider": "2.3.1",
126
+ "@tamagui/spacer": "2.3.1",
127
+ "@tamagui/spinner": "2.3.1",
128
+ "@tamagui/stacks": "2.3.1",
129
+ "@tamagui/switch": "2.3.1",
130
+ "@tamagui/tabs": "2.3.1",
131
+ "@tamagui/text": "2.3.1",
132
+ "@tamagui/theme": "2.3.1",
133
+ "@tamagui/toast": "2.3.1",
134
+ "@tamagui/toggle-group": "2.3.1",
135
+ "@tamagui/tooltip": "2.3.1",
136
+ "@tamagui/use-controllable-state": "2.3.1",
137
+ "@tamagui/use-debounce": "2.3.1",
138
+ "@tamagui/use-force-update": "2.3.1",
139
+ "@tamagui/use-window-dimensions": "2.3.1",
140
+ "@tamagui/visually-hidden": "2.3.1",
141
+ "@tamagui/font-size": "2.3.1",
142
+ "@tamagui/z-index-stack": "2.3.1"
143
143
  },
144
144
  "devDependencies": {
145
- "@tamagui/build": "2.2.0",
145
+ "@tamagui/build": "2.3.1",
146
146
  "react": ">=19",
147
147
  "react-native": "0.83.2",
148
148
  "react-native-web": "^0.21.0"