@tamagui/core 2.2.0 → 2.3.0

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,4 +1,4 @@
1
1
  $ tamagui-build
2
- built @tamagui/core in 636 ms
2
+ built @tamagui/core in 1067 ms
3
3
  Running afterBuild script...
4
- afterBuild completed in 182 ms
4
+ afterBuild completed in 280 ms
package/dist/native.cjs CHANGED
@@ -11794,9 +11794,22 @@ var init_constants_native$1 = __esmMin((() => {
11794
11794
  }[Platform.OS] : void 0) || "native";
11795
11795
  }));
11796
11796
  //#endregion
11797
+ //#region ../constants/dist/esm/platformDriver.native.js
11798
+ function setupPlatformDriver(driver) {
11799
+ platformDriver = driver;
11800
+ }
11801
+ function getPlatformDriver() {
11802
+ return platformDriver;
11803
+ }
11804
+ var platformDriver;
11805
+ var init_platformDriver_native = __esmMin((() => {
11806
+ platformDriver = null;
11807
+ }));
11808
+ //#endregion
11797
11809
  //#region ../constants/dist/esm/index.native.js
11798
11810
  var init_index_native$7 = __esmMin((() => {
11799
11811
  init_constants_native$1();
11812
+ init_platformDriver_native();
11800
11813
  }));
11801
11814
  //#endregion
11802
11815
  //#region ../web/dist/esm/constants/constants.native.js
@@ -13666,10 +13679,17 @@ function useMainThreadPressEvents(events, viewProps) {
13666
13679
  ref.current.pressOutTimer = null;
13667
13680
  ref.current.longPressTimer = null;
13668
13681
  }
13669
- viewProps.onStartShouldSetResponder = function() {
13670
- return !events.disabled;
13682
+ var userStartShouldSet = viewProps.onStartShouldSetResponder;
13683
+ var userGrant = viewProps.onResponderGrant;
13684
+ var userRelease = viewProps.onResponderRelease;
13685
+ var userTerminate = viewProps.onResponderTerminate;
13686
+ var userTerminationRequest = viewProps.onResponderTerminationRequest;
13687
+ var userMove = viewProps.onResponderMove;
13688
+ viewProps.onStartShouldSetResponder = function(e) {
13689
+ return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
13671
13690
  };
13672
13691
  viewProps.onResponderGrant = function(e) {
13692
+ userGrant === null || userGrant === void 0 || userGrant(e);
13673
13693
  cleanup();
13674
13694
  ref.current.state = "pressing";
13675
13695
  if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
@@ -13685,6 +13705,7 @@ function useMainThreadPressEvents(events, viewProps) {
13685
13705
  }, delayLongPress + delayPressIn);
13686
13706
  };
13687
13707
  viewProps.onResponderRelease = function(e) {
13708
+ userRelease === null || userRelease === void 0 || userRelease(e);
13688
13709
  var wasLongPressed = ref.current.state === "longPressed";
13689
13710
  cleanup();
13690
13711
  if (ref.current.state === "pressing") activate(e);
@@ -13696,15 +13717,18 @@ function useMainThreadPressEvents(events, viewProps) {
13696
13717
  ref.current.state = "idle";
13697
13718
  };
13698
13719
  viewProps.onResponderTerminate = function(e) {
13720
+ userTerminate === null || userTerminate === void 0 || userTerminate(e);
13699
13721
  cleanup();
13700
13722
  if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
13701
13723
  ref.current.state = "idle";
13702
13724
  };
13703
- viewProps.onResponderTerminationRequest = function() {
13725
+ viewProps.onResponderTerminationRequest = function(e) {
13726
+ if (userTerminationRequest) return userTerminationRequest(e);
13704
13727
  return events.cancelable !== false;
13705
13728
  };
13706
13729
  viewProps.onResponderMove = function(e) {
13707
13730
  var _events_onPressMove;
13731
+ userMove === null || userMove === void 0 || userMove(e);
13708
13732
  (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
13709
13733
  };
13710
13734
  }
@@ -16230,7 +16254,7 @@ var init_useComponentState_native = __esmMin((() => {
16230
16254
  init_objectSpread2();
16231
16255
  useComponentState = function(props, animationDriver, staticConfig, config) {
16232
16256
  "use no memo";
16233
- var _animationDriver_usePresence;
16257
+ var _getPlatformDriver, _animationDriver_usePresence;
16234
16258
  var isHydrated = useDidFinishSSR();
16235
16259
  var needsHydration = !useIsClientOnly();
16236
16260
  var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
@@ -16244,8 +16268,9 @@ var init_useComponentState_native = __esmMin((() => {
16244
16268
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
16245
16269
  var curStateRef = stateRef.current;
16246
16270
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
16271
+ 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));
16247
16272
  var willBeAnimatedClient = function() {
16248
- return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
16273
+ return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
16249
16274
  }();
16250
16275
  var willBeAnimated = willBeAnimatedClient;
16251
16276
  if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
@@ -16302,7 +16327,8 @@ var init_useComponentState_native = __esmMin((() => {
16302
16327
  inputStyle,
16303
16328
  outputStyle,
16304
16329
  willBeAnimated,
16305
- willBeAnimatedClient
16330
+ willBeAnimatedClient,
16331
+ platformPseudo
16306
16332
  };
16307
16333
  };
16308
16334
  isDisabled = function(props) {
@@ -16410,13 +16436,30 @@ function createComponent(staticConfig) {
16410
16436
  }();
16411
16437
  var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
16412
16438
  var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
16413
- var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
16439
+ var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
16414
16440
  if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
16441
+ var emitted = stateRef.current.prevPseudoState;
16442
+ if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
16443
+ var _stateRef_current_updateStyleListener, _stateRef_current;
16444
+ (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
16445
+ }
16415
16446
  var pendingState = stateRef.current.nextState;
16416
16447
  if (!pendingState) return;
16417
16448
  stateRef.current.nextState = void 0;
16418
16449
  if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
16419
16450
  });
16451
+ useIsomorphicLayoutEffect(function() {
16452
+ var _getPlatformDriver;
16453
+ if (!platformPseudo || props.disabled) return;
16454
+ var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
16455
+ var host = stateRef.current.host;
16456
+ if (!pseudoDriver || !host) return;
16457
+ return pseudoDriver.subscribe(host, function(param) {
16458
+ var { hovered } = param;
16459
+ var _stateRef_current_setStateShallow, _stateRef_current;
16460
+ (_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
16461
+ });
16462
+ }, [platformPseudo, props.disabled]);
16420
16463
  var allGroupContexts = (0, react.useMemo)(function() {
16421
16464
  var _stateRef_current_group_listeners, _stateRef_current_group;
16422
16465
  if (!groupName || props.passThrough) return groupContextParent;
@@ -16512,7 +16555,7 @@ function createComponent(staticConfig) {
16512
16555
  }
16513
16556
  }
16514
16557
  var hasEnterExitTransition = props.transition && _type_of$1(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
16515
- if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
16558
+ if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
16516
16559
  let updateGroupListeners2 = function() {
16517
16560
  var updatedState = stateRef.current.nextState;
16518
16561
  if (groupContext) {
@@ -16531,9 +16574,11 @@ function createComponent(staticConfig) {
16531
16574
  var updatedState = stateRef.current.nextState || state;
16532
16575
  var mediaState2 = stateRef.current.nextMedia;
16533
16576
  var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
16534
- var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, props.transition);
16577
+ var _props_transition2;
16578
+ 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);
16535
16579
  stateRef.current.prevPseudoState = extractPseudoState(updatedState);
16536
- useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2);
16580
+ var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
16581
+ useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
16537
16582
  };
16538
16583
  componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
16539
16584
  if (!stateRef.current.mediaEmitCleanup) {
@@ -16611,7 +16656,8 @@ function createComponent(staticConfig) {
16611
16656
  var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
16612
16657
  stateRef.current.useStyleListener = listener;
16613
16658
  } : void 0;
16614
- var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, props.transition);
16659
+ var _props_transition;
16660
+ 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);
16615
16661
  if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
16616
16662
  stateRef.current.prevPseudoState = extractPseudoState(state);
16617
16663
  var animations = useAnimations({
@@ -16718,7 +16764,7 @@ function createComponent(staticConfig) {
16718
16764
  var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
16719
16765
  var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
16720
16766
  var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
16721
- var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
16767
+ var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
16722
16768
  var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
16723
16769
  var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
16724
16770
  var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
@@ -18851,6 +18897,7 @@ exports.getExpandedShorthands = getExpandedShorthands;
18851
18897
  exports.getFontFamilyFromNameOrVariable = getFontFamilyFromNameOrVariable;
18852
18898
  exports.getFontsForLanguage = getFontsForLanguage;
18853
18899
  exports.getMedia = getMedia;
18900
+ exports.getPlatformDriver = getPlatformDriver;
18854
18901
  exports.getReactNativeConfig = getReactNativeConfig;
18855
18902
  exports.getRgba = getRgba;
18856
18903
  exports.getSetting = getSetting;
@@ -18937,6 +18984,7 @@ exports.setRef = setRef;
18937
18984
  exports.setupDev = setupDev;
18938
18985
  exports.setupHooks = setupHooks;
18939
18986
  exports.setupMatchMedia = setupMatchMedia;
18987
+ exports.setupPlatformDriver = setupPlatformDriver;
18940
18988
  exports.shouldRenderNativePlatform = shouldRenderNativePlatform;
18941
18989
  exports.simpleHash = simpleHash;
18942
18990
  exports.styleOriginalValues = styleOriginalValues;
@@ -346,6 +346,15 @@ var currentPlatform = ((react_native.Platform === null || react_native.Platform
346
346
  windows: "windows"
347
347
  }[react_native.Platform.OS] : void 0) || "native";
348
348
  //#endregion
349
+ //#region ../constants/dist/esm/platformDriver.native.js
350
+ var platformDriver = null;
351
+ function setupPlatformDriver(driver) {
352
+ platformDriver = driver;
353
+ }
354
+ function getPlatformDriver() {
355
+ return platformDriver;
356
+ }
357
+ //#endregion
349
358
  //#region ../web/dist/esm/constants/constants.native.js
350
359
  var THEME_NAME_SEPARATOR = "_";
351
360
  var THEME_CLASSNAME_PREFIX = "t_";
@@ -2083,10 +2092,17 @@ function useMainThreadPressEvents(events, viewProps) {
2083
2092
  ref.current.pressOutTimer = null;
2084
2093
  ref.current.longPressTimer = null;
2085
2094
  }
2086
- viewProps.onStartShouldSetResponder = function() {
2087
- return !events.disabled;
2095
+ var userStartShouldSet = viewProps.onStartShouldSetResponder;
2096
+ var userGrant = viewProps.onResponderGrant;
2097
+ var userRelease = viewProps.onResponderRelease;
2098
+ var userTerminate = viewProps.onResponderTerminate;
2099
+ var userTerminationRequest = viewProps.onResponderTerminationRequest;
2100
+ var userMove = viewProps.onResponderMove;
2101
+ viewProps.onStartShouldSetResponder = function(e) {
2102
+ return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
2088
2103
  };
2089
2104
  viewProps.onResponderGrant = function(e) {
2105
+ userGrant === null || userGrant === void 0 || userGrant(e);
2090
2106
  cleanup();
2091
2107
  ref.current.state = "pressing";
2092
2108
  if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
@@ -2102,6 +2118,7 @@ function useMainThreadPressEvents(events, viewProps) {
2102
2118
  }, delayLongPress + delayPressIn);
2103
2119
  };
2104
2120
  viewProps.onResponderRelease = function(e) {
2121
+ userRelease === null || userRelease === void 0 || userRelease(e);
2105
2122
  var wasLongPressed = ref.current.state === "longPressed";
2106
2123
  cleanup();
2107
2124
  if (ref.current.state === "pressing") activate(e);
@@ -2113,15 +2130,18 @@ function useMainThreadPressEvents(events, viewProps) {
2113
2130
  ref.current.state = "idle";
2114
2131
  };
2115
2132
  viewProps.onResponderTerminate = function(e) {
2133
+ userTerminate === null || userTerminate === void 0 || userTerminate(e);
2116
2134
  cleanup();
2117
2135
  if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
2118
2136
  ref.current.state = "idle";
2119
2137
  };
2120
- viewProps.onResponderTerminationRequest = function() {
2138
+ viewProps.onResponderTerminationRequest = function(e) {
2139
+ if (userTerminationRequest) return userTerminationRequest(e);
2121
2140
  return events.cancelable !== false;
2122
2141
  };
2123
2142
  viewProps.onResponderMove = function(e) {
2124
2143
  var _events_onPressMove;
2144
+ userMove === null || userMove === void 0 || userMove(e);
2125
2145
  (_events_onPressMove = events.onPressMove) === null || _events_onPressMove === void 0 || _events_onPressMove.call(events, e);
2126
2146
  };
2127
2147
  }
@@ -4701,7 +4721,7 @@ function _type_of$2(obj) {
4701
4721
  }
4702
4722
  var useComponentState = function(props, animationDriver, staticConfig, config) {
4703
4723
  "use no memo";
4704
- var _animationDriver_usePresence;
4724
+ var _getPlatformDriver, _animationDriver_usePresence;
4705
4725
  var isHydrated = useDidFinishSSR();
4706
4726
  var needsHydration = !useIsClientOnly();
4707
4727
  var useAnimations = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? void 0 : animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
@@ -4715,8 +4735,9 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
4715
4735
  var outputStyle = (_animationDriver_outputStyle = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.outputStyle) !== null && _animationDriver_outputStyle !== void 0 ? _animationDriver_outputStyle : "css";
4716
4736
  var curStateRef = stateRef.current;
4717
4737
  if (!needsHydration && hasAnimationProp) curStateRef.hasAnimated = true;
4738
+ 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));
4718
4739
  var willBeAnimatedClient = function() {
4719
- return Boolean(!!(hasAnimationProp && !isHOC && useAnimations) || curStateRef.hasAnimated);
4740
+ return Boolean(!!((hasAnimationProp || platformPseudo) && !isHOC && useAnimations) || curStateRef.hasAnimated);
4720
4741
  }();
4721
4742
  var willBeAnimated = willBeAnimatedClient;
4722
4743
  if (willBeAnimated && !curStateRef.hasAnimated) curStateRef.hasAnimated = true;
@@ -4773,7 +4794,8 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
4773
4794
  inputStyle,
4774
4795
  outputStyle,
4775
4796
  willBeAnimated,
4776
- willBeAnimatedClient
4797
+ willBeAnimatedClient,
4798
+ platformPseudo
4777
4799
  };
4778
4800
  };
4779
4801
  function hasAnimatedStyleValue(style) {
@@ -4924,13 +4946,30 @@ function createComponent(staticConfig) {
4924
4946
  }();
4925
4947
  var useAnimations = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.useAnimations;
4926
4948
  var componentState = useComponentState(props, (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig, config);
4927
- var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, startedUnhydrated } = componentState;
4949
+ var { disabled, groupName, hasAnimationProp, hasEnterStyle, isAnimated, isExiting, isHydrated, presence, presenceState, setState, noClass, state, stateRef, inputStyle, outputStyle, willBeAnimated, willBeAnimatedClient, platformPseudo, startedUnhydrated } = componentState;
4928
4950
  if (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) useIsomorphicLayoutEffect(function() {
4951
+ var emitted = stateRef.current.prevPseudoState;
4952
+ if (emitted && (emitted.hover || emitted.press || emitted.focus)) {
4953
+ var _stateRef_current_updateStyleListener, _stateRef_current;
4954
+ (_stateRef_current_updateStyleListener = (_stateRef_current = stateRef.current).updateStyleListener) === null || _stateRef_current_updateStyleListener === void 0 || _stateRef_current_updateStyleListener.call(_stateRef_current);
4955
+ }
4929
4956
  var pendingState = stateRef.current.nextState;
4930
4957
  if (!pendingState) return;
4931
4958
  stateRef.current.nextState = void 0;
4932
4959
  if (!isEqualShallow(state, pendingState)) componentState.setStateShallow(pendingState);
4933
4960
  });
4961
+ useIsomorphicLayoutEffect(function() {
4962
+ var _getPlatformDriver;
4963
+ if (!platformPseudo || props.disabled) return;
4964
+ var pseudoDriver = (_getPlatformDriver = getPlatformDriver()) === null || _getPlatformDriver === void 0 ? void 0 : _getPlatformDriver.pseudo;
4965
+ var host = stateRef.current.host;
4966
+ if (!pseudoDriver || !host) return;
4967
+ return pseudoDriver.subscribe(host, function(param) {
4968
+ var { hovered } = param;
4969
+ var _stateRef_current_setStateShallow, _stateRef_current;
4970
+ (_stateRef_current_setStateShallow = (_stateRef_current = stateRef.current).setStateShallow) === null || _stateRef_current_setStateShallow === void 0 || _stateRef_current_setStateShallow.call(_stateRef_current, { hover: hovered });
4971
+ });
4972
+ }, [platformPseudo, props.disabled]);
4934
4973
  var allGroupContexts = (0, react.useMemo)(function() {
4935
4974
  var _stateRef_current_group_listeners, _stateRef_current_group;
4936
4975
  if (!groupName || props.passThrough) return groupContextParent;
@@ -5026,7 +5065,7 @@ function createComponent(staticConfig) {
5026
5065
  }
5027
5066
  }
5028
5067
  var hasEnterExitTransition = props.transition && _type_of$1(props.transition) === "object" && !Array.isArray(props.transition) && ("enter" in props.transition || "exit" in props.transition);
5029
- if (!isPassthrough && (hasAnimationProp || groupName) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
5068
+ if (!isPassthrough && (hasAnimationProp || groupName || platformPseudo) && (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) && !hasEnterExitTransition) {
5030
5069
  let updateGroupListeners2 = function() {
5031
5070
  var updatedState = stateRef.current.nextState;
5032
5071
  if (groupContext) {
@@ -5045,9 +5084,11 @@ function createComponent(staticConfig) {
5045
5084
  var updatedState = stateRef.current.nextState || state;
5046
5085
  var mediaState2 = stateRef.current.nextMedia;
5047
5086
  var nextStyles = getSplitStyles(props, staticConfig, theme, themeName, updatedState, mediaState2 ? _objectSpread2(_objectSpread2({}, styleProps), {}, { mediaState: mediaState2 }) : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp, animationDriver);
5048
- var effectiveTransition2 = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, updatedState, nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.pseudoTransitions, props.transition);
5087
+ var _props_transition2;
5088
+ 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);
5049
5089
  stateRef.current.prevPseudoState = extractPseudoState(updatedState);
5050
- useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2);
5090
+ var hasActivePseudo = Boolean(updatedState.hover || updatedState.press || updatedState.pressIn || updatedState.focus || updatedState.focusWithin);
5091
+ useStyleListener((nextStyles === null || nextStyles === void 0 ? void 0 : nextStyles.style) || {}, effectiveTransition2, hasActivePseudo);
5051
5092
  };
5052
5093
  componentContext.mediaEmitListeners = componentContext.mediaEmitListeners || /* @__PURE__ */ new Set();
5053
5094
  if (!stateRef.current.mediaEmitCleanup) {
@@ -5125,7 +5166,8 @@ function createComponent(staticConfig) {
5125
5166
  var useStyleEmitter = (animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.avoidReRenders) ? function(listener) {
5126
5167
  stateRef.current.useStyleListener = listener;
5127
5168
  } : void 0;
5128
- var effectiveTransition = resolveEffectivePseudoTransition(stateRef.current.prevPseudoState, state, splitStyles === null || splitStyles === void 0 ? void 0 : splitStyles.pseudoTransitions, props.transition);
5169
+ var _props_transition;
5170
+ 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);
5129
5171
  if (splitStyles) splitStyles.effectiveTransition = effectiveTransition;
5130
5172
  stateRef.current.prevPseudoState = extractPseudoState(state);
5131
5173
  var animations = useAnimations({
@@ -5232,7 +5274,7 @@ function createComponent(staticConfig) {
5232
5274
  var hasDynamicGroupChildren = Boolean(groupName && state.hasDynGroupChildren);
5233
5275
  var attachPress = Boolean(hasDynamicGroupChildren || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || (pseudos === null || pseudos === void 0 ? void 0 : pseudos.focusVisibleStyle));
5234
5276
  var runtimeHoverStyle = !disabled && noClass && (pseudos === null || pseudos === void 0 ? void 0 : pseudos.hoverStyle);
5235
- var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle);
5277
+ var needsHoverState = Boolean(hasDynamicGroupChildren || runtimeHoverStyle && !platformPseudo);
5236
5278
  var attachHover = isNativeDesktop && !!(hasDynamicGroupChildren || needsHoverState || onMouseEnter || onMouseLeave);
5237
5279
  var shouldAttach = !disabled && !props.asChild && Boolean(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
5238
5280
  var needsPressState = Boolean(hasDynamicGroupChildren || runtimePressStyle);
@@ -7193,6 +7235,7 @@ exports.getExpandedShorthands = getExpandedShorthands;
7193
7235
  exports.getFontFamilyFromNameOrVariable = getFontFamilyFromNameOrVariable;
7194
7236
  exports.getFontsForLanguage = getFontsForLanguage;
7195
7237
  exports.getMedia = getMedia;
7238
+ exports.getPlatformDriver = getPlatformDriver;
7196
7239
  exports.getReactNativeConfig = getReactNativeConfig;
7197
7240
  exports.getRgba = getRgba;
7198
7241
  exports.getSetting = getSetting;
@@ -7279,6 +7322,7 @@ exports.setRef = setRef;
7279
7322
  exports.setupDev = setupDev;
7280
7323
  exports.setupHooks = setupHooks;
7281
7324
  exports.setupMatchMedia = setupMatchMedia;
7325
+ exports.setupPlatformDriver = setupPlatformDriver;
7282
7326
  exports.shouldRenderNativePlatform = shouldRenderNativePlatform;
7283
7327
  exports.simpleHash = simpleHash;
7284
7328
  exports.styleOriginalValues = styleOriginalValues;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
5
5
  "license": "MIT",
6
6
  "author": {
@@ -79,17 +79,17 @@
79
79
  "clean:build": "tamagui-build clean:build"
80
80
  },
81
81
  "dependencies": {
82
- "@tamagui/helpers": "2.2.0",
83
- "@tamagui/react-native-media-driver": "2.2.0",
84
- "@tamagui/react-native-use-pressable": "2.2.0",
85
- "@tamagui/use-element-layout": "2.2.0",
86
- "@tamagui/use-event": "2.2.0",
87
- "@tamagui/web": "2.2.0"
82
+ "@tamagui/helpers": "2.3.0",
83
+ "@tamagui/react-native-media-driver": "2.3.0",
84
+ "@tamagui/react-native-use-pressable": "2.3.0",
85
+ "@tamagui/use-element-layout": "2.3.0",
86
+ "@tamagui/use-event": "2.3.0",
87
+ "@tamagui/web": "2.3.0"
88
88
  },
89
89
  "devDependencies": {
90
- "@tamagui/build": "2.2.0",
91
- "@tamagui/native-bundle": "2.2.0",
92
- "@tamagui/react-native-web-lite": "2.2.0",
90
+ "@tamagui/build": "2.3.0",
91
+ "@tamagui/native-bundle": "2.3.0",
92
+ "@tamagui/react-native-web-lite": "2.3.0",
93
93
  "@testing-library/react": "^16.1.0",
94
94
  "csstype": "^3.0.10",
95
95
  "react": ">=19",