@tamagui/core 1.138.1 → 1.138.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.cjs CHANGED
@@ -2664,6 +2664,10 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
2664
2664
  if (!(!styleProps.noSkip && subKey in skipProps)) {
2665
2665
  if (styleProps.noExpand) res[subKey] = val;
2666
2666
  else if (variants && subKey in variants) {
2667
+ if (staticConfig) {
2668
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
2669
+ contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
2670
+ }
2667
2671
  if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
2668
2672
  val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val;
2669
2673
  else {
@@ -2838,6 +2842,17 @@ function _type_of$2(obj) {
2838
2842
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
2839
2843
  }
2840
2844
  var conf, PROP_SPLIT = "-";
2845
+ function normalizeGroupKey(key, groupContext) {
2846
+ var parts = key.split("-"), plen = parts.length;
2847
+ if (
2848
+ // check if its actually a simple group selector to avoid breaking selectors
2849
+ plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
2850
+ ) {
2851
+ var name = parts[1];
2852
+ if (groupContext && !groupContext[name]) return key.replace("$group-", "$group-true-");
2853
+ }
2854
+ return key;
2855
+ }
2841
2856
  function isValidStyleKey(key, validStyles2, accept) {
2842
2857
  return key in validStyles2 ? true : accept && key in accept;
2843
2858
  }
@@ -2864,16 +2879,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2864
2879
  return "continue";
2865
2880
  }
2866
2881
  var isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isValidStyleKeyInit || isVariant, isPseudo = keyInit in validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo ? getMediaKey(keyInit) : false, isMediaOrPseudo = !!(isMedia || isPseudo);
2867
- if (isMediaOrPseudo && isMedia === "group") {
2868
- var parts = keyInit.split("-"), plen = parts.length;
2869
- if (
2870
- // check if its actually a simple group selector to avoid breaking selectors
2871
- plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
2872
- ) {
2873
- var name2 = parts[1];
2874
- groupContext && !(groupContext == null ? void 0 : groupContext[name2]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
2875
- }
2876
- }
2882
+ isMediaOrPseudo && isMedia === "group" && (keyInit = normalizeGroupKey(keyInit, groupContext));
2877
2883
  var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
2878
2884
  if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
2879
2885
  var shouldPassProp = !isStyleProp && isHOC || // is in parent variants
@@ -2897,7 +2903,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2897
2903
  mergeStyle(styleState, key4, val2, 1);
2898
2904
  return;
2899
2905
  }
2900
- if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
2906
+ if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, isMedia === "group" && (key4 = normalizeGroupKey(key4, groupContext)), (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
2901
2907
  var _props_key;
2902
2908
  viewProps[key4] = (_props_key = props[key4]) !== null && _props_key !== void 0 ? _props_key : val2;
2903
2909
  }
@@ -3122,7 +3128,8 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
3122
3128
  rulesToInsert,
3123
3129
  dynamicThemeAccess,
3124
3130
  pseudoGroups,
3125
- mediaGroups
3131
+ mediaGroups,
3132
+ resolvedContextVariants: styleState.resolvedContextVariants
3126
3133
  }, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
3127
3134
  if (!styleProps.noMergeStyle && !asChildExceptStyleLike) {
3128
3135
  var style2 = styleState.style;
@@ -3434,9 +3441,16 @@ function _type_of$1(obj) {
3434
3441
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
3435
3442
  }
3436
3443
  var useComponentState = function(props, animationDriver, staticConfig, config) {
3437
- var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), [startedUnhydrated] = React.useState(needsHydration && !isHydrated), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, {
3444
+ var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = (animationDriver == null ? void 0 : animationDriver.isStub) ? void 0 : animationDriver == null ? void 0 : animationDriver.useAnimations, {
3438
3445
  isHOC
3439
- } = staticConfig, stateRef = React.useRef({}), hasAnimationProp = !!(!isHOC && "animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSS = animationDriver == null ? void 0 : animationDriver.supportsCSS, curStateRef = stateRef.current;
3446
+ } = staticConfig, stateRef = React.useRef(
3447
+ // performance: avoid creating object every render
3448
+ void 0
3449
+ );
3450
+ stateRef.current || (stateRef.current = {
3451
+ startedUnhydrated: needsHydration && !isHydrated
3452
+ });
3453
+ var hasAnimationProp = !!(!isHOC && "animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSS = animationDriver == null ? void 0 : animationDriver.supportsCSS, curStateRef = stateRef.current;
3440
3454
  !needsHydration && hasAnimationProp && (curStateRef.hasAnimated = true);
3441
3455
  var willBeAnimatedClient = (function() {
3442
3456
  var next = !!(hasAnimationProp && !isHOC && useAnimations);
@@ -3476,7 +3490,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
3476
3490
  }
3477
3491
  var noClass = !isWeb;
3478
3492
  return {
3479
- startedUnhydrated,
3493
+ startedUnhydrated: curStateRef.startedUnhydrated,
3480
3494
  curStateRef,
3481
3495
  disabled,
3482
3496
  groupName,
@@ -3584,7 +3598,7 @@ function createComponent(staticConfig) {
3584
3598
  nextProps && (props = nextProps), overriddenContextProps = overrides;
3585
3599
  }
3586
3600
  var componentName2 = props.componentName || staticConfig.componentName;
3587
- var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, animationDriver, staticConfig), {
3601
+ var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, (animationDriver == null ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig), {
3588
3602
  disabled,
3589
3603
  groupName,
3590
3604
  hasAnimationProp,
@@ -3674,7 +3688,15 @@ function createComponent(staticConfig) {
3674
3688
  willBeAnimated,
3675
3689
  styledContext: styledContextValue
3676
3690
  }, themeName = (themeState == null ? void 0 : themeState.name) || "";
3677
- var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
3691
+ var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
3692
+ if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
3693
+ var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
3694
+ if (contextForVariants) {
3695
+ for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
3696
+ staticConfig.context || (contextForOverride = contextForVariants);
3697
+ }
3698
+ }
3699
+ var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
3678
3700
  if (!isPassthrough && groupContext && // avoids onLayout if we don't need it
3679
3701
  props.containerType !== "normal") {
3680
3702
  var groupState = groupContext == null ? void 0 : groupContext.state;
@@ -3716,8 +3738,8 @@ function createComponent(staticConfig) {
3716
3738
  }), stateRef.current.setStateShallow = function(nextOrGetNext) {
3717
3739
  var prev = stateRef.current.nextState || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
3718
3740
  if (!(next === prev || isEqualShallow(prev, next))) {
3719
- var canAvoidReRender = Object.keys(next).every(function(key2) {
3720
- return avoidReRenderKeys.has(key2);
3741
+ var canAvoidReRender = Object.keys(next).every(function(key3) {
3742
+ return avoidReRenderKeys.has(key3);
3721
3743
  }), updatedState = __spreadValues(__spreadValues({}, prev), next);
3722
3744
  if (stateRef.current.nextState = updatedState, canAvoidReRender) {
3723
3745
  var _stateRef_current_updateStyleListener, _stateRef_current;
@@ -3963,9 +3985,9 @@ function createComponent(staticConfig) {
3963
3985
  }))), "group" in props && (content = /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContext.Provider, {
3964
3986
  value: allGroupContexts,
3965
3987
  children: content
3966
- })), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps) {
3967
- var Provider = staticConfig.context.Provider;
3968
- for (var key in styledContextValue) key in overriddenContextProps || (overriddenContextProps[key] = styledContextValue[key]);
3988
+ })), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps && contextForOverride) {
3989
+ var Provider = contextForOverride.Provider;
3990
+ for (var key1 in styledContextValue) key1 in overriddenContextProps || (overriddenContextProps[key1] = styledContextValue[key1]);
3969
3991
  debugProp && console.info("overriddenContextProps", overriddenContextProps), content = /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, __spreadProps(__spreadValues({
3970
3992
  __disableMergeDefaultValues: true
3971
3993
  }, overriddenContextProps), {
@@ -4334,6 +4356,35 @@ var cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
4334
4356
  }
4335
4357
  return cache.set(res, true), res;
4336
4358
  };
4359
+ var noAnimationDriver = function(method) {
4360
+ console.warn(`No animation driver configured. To use ${method}, you must pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);
4361
+ }, createEmptyAnimationDriver = function() {
4362
+ return {
4363
+ isReactNative: false,
4364
+ supportsCSS: true,
4365
+ classNameAnimation: true,
4366
+ isStub: true,
4367
+ animations: {},
4368
+ useAnimations: function() {
4369
+ return noAnimationDriver("animations");
4370
+ },
4371
+ usePresence: function() {
4372
+ return noAnimationDriver("usePresence");
4373
+ },
4374
+ ResetPresence: function() {
4375
+ return noAnimationDriver("ResetPresence");
4376
+ },
4377
+ useAnimatedNumber: function() {
4378
+ return noAnimationDriver("useAnimatedNumber");
4379
+ },
4380
+ useAnimatedNumberStyle: function() {
4381
+ return noAnimationDriver("useAnimatedNumberStyle");
4382
+ },
4383
+ useAnimatedNumberReaction: function() {
4384
+ return noAnimationDriver("useAnimatedNumberReaction");
4385
+ }
4386
+ };
4387
+ }, defaultAnimationDriver = createEmptyAnimationDriver();
4337
4388
  var registerCSSVariable = function(v) {
4338
4389
  tokensValueToVariable.set(getVariableValue(v), v);
4339
4390
  }, variableToCSS = function(v) {
@@ -4443,7 +4494,7 @@ function createTamagui$1(configIn) {
4443
4494
  fonts: {},
4444
4495
  onlyAllowShorthands: false,
4445
4496
  fontLanguages: [],
4446
- animations: {},
4497
+ animations: defaultAnimationDriver,
4447
4498
  media: {}
4448
4499
  }, configIn), {
4449
4500
  unset,
@@ -4493,8 +4544,7 @@ function getThemesDeduped(themes2, colorTokens) {
4493
4544
  e2.names.push(themeName);
4494
4545
  continue;
4495
4546
  }
4496
- var theme = __spreadValues({}, rawTheme);
4497
- colorTokens && Object.assign(theme, colorTokens);
4547
+ var theme = __spreadValues(__spreadValues({}, colorTokens), rawTheme);
4498
4548
  for (var key1 in theme) ensureThemeVariable(theme, key1);
4499
4549
  var deduped = {
4500
4550
  names: [themeName],
@@ -2489,6 +2489,10 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
2489
2489
  if (!(!styleProps.noSkip && subKey in skipProps)) {
2490
2490
  if (styleProps.noExpand) res[subKey] = val;
2491
2491
  else if (variants && subKey in variants) {
2492
+ if (staticConfig) {
2493
+ var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
2494
+ contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
2495
+ }
2492
2496
  if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
2493
2497
  val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val;
2494
2498
  else {
@@ -2663,6 +2667,17 @@ function _type_of$2(obj) {
2663
2667
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
2664
2668
  }
2665
2669
  var conf, PROP_SPLIT = "-";
2670
+ function normalizeGroupKey(key, groupContext) {
2671
+ var parts = key.split("-"), plen = parts.length;
2672
+ if (
2673
+ // check if its actually a simple group selector to avoid breaking selectors
2674
+ plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
2675
+ ) {
2676
+ var name = parts[1];
2677
+ if (groupContext && !groupContext[name]) return key.replace("$group-", "$group-true-");
2678
+ }
2679
+ return key;
2680
+ }
2666
2681
  function isValidStyleKey(key, validStyles2, accept) {
2667
2682
  return key in validStyles2 ? true : accept && key in accept;
2668
2683
  }
@@ -2690,16 +2705,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2690
2705
  return "continue";
2691
2706
  }
2692
2707
  var isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isValidStyleKeyInit || isVariant, isPseudo = keyInit in validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo ? getMediaKey(keyInit) : false, isMediaOrPseudo = !!(isMedia || isPseudo);
2693
- if (isMediaOrPseudo && isMedia === "group") {
2694
- var parts = keyInit.split("-"), plen = parts.length;
2695
- if (
2696
- // check if its actually a simple group selector to avoid breaking selectors
2697
- plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
2698
- ) {
2699
- var name2 = parts[1];
2700
- groupContext && !(groupContext == null ? void 0 : groupContext[name2]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
2701
- }
2702
- }
2708
+ isMediaOrPseudo && isMedia === "group" && (keyInit = normalizeGroupKey(keyInit, groupContext));
2703
2709
  var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
2704
2710
  if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
2705
2711
  var shouldPassProp = !isStyleProp && isHOC || // is in parent variants
@@ -2723,7 +2729,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2723
2729
  mergeStyle(styleState, key4, val2, 1);
2724
2730
  return;
2725
2731
  }
2726
- if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
2732
+ if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, isMedia === "group" && (key4 = normalizeGroupKey(key4, groupContext)), (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
2727
2733
  var _props_key;
2728
2734
  viewProps[key4] = (_props_key = props[key4]) !== null && _props_key !== void 0 ? _props_key : val2;
2729
2735
  }
@@ -2948,7 +2954,8 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
2948
2954
  rulesToInsert,
2949
2955
  dynamicThemeAccess,
2950
2956
  pseudoGroups,
2951
- mediaGroups
2957
+ mediaGroups,
2958
+ resolvedContextVariants: styleState.resolvedContextVariants
2952
2959
  }, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
2953
2960
  if (!styleProps.noMergeStyle && !asChildExceptStyleLike) {
2954
2961
  var style2 = styleState.style;
@@ -3260,9 +3267,16 @@ function _type_of$1(obj) {
3260
3267
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
3261
3268
  }
3262
3269
  var useComponentState = function(props, animationDriver, staticConfig, config) {
3263
- var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), [startedUnhydrated] = React.useState(needsHydration && !isHydrated), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, {
3270
+ var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = (animationDriver == null ? void 0 : animationDriver.isStub) ? void 0 : animationDriver == null ? void 0 : animationDriver.useAnimations, {
3264
3271
  isHOC
3265
- } = staticConfig, stateRef = React.useRef({}), hasAnimationProp = !!(!isHOC && "animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSS = animationDriver == null ? void 0 : animationDriver.supportsCSS, curStateRef = stateRef.current;
3272
+ } = staticConfig, stateRef = React.useRef(
3273
+ // performance: avoid creating object every render
3274
+ void 0
3275
+ );
3276
+ stateRef.current || (stateRef.current = {
3277
+ startedUnhydrated: needsHydration && !isHydrated
3278
+ });
3279
+ var hasAnimationProp = !!(!isHOC && "animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSS = animationDriver == null ? void 0 : animationDriver.supportsCSS, curStateRef = stateRef.current;
3266
3280
  !needsHydration && hasAnimationProp && (curStateRef.hasAnimated = true);
3267
3281
  var willBeAnimatedClient = (function() {
3268
3282
  var next = !!(hasAnimationProp && !isHOC && useAnimations);
@@ -3302,7 +3316,7 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
3302
3316
  }
3303
3317
  var noClass = !isWeb;
3304
3318
  return {
3305
- startedUnhydrated,
3319
+ startedUnhydrated: curStateRef.startedUnhydrated,
3306
3320
  curStateRef,
3307
3321
  disabled,
3308
3322
  groupName,
@@ -3414,7 +3428,7 @@ function createComponent(staticConfig) {
3414
3428
  nextProps && (props = nextProps), overriddenContextProps = overrides;
3415
3429
  }
3416
3430
  var componentName2 = props.componentName || staticConfig.componentName;
3417
- var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, animationDriver, staticConfig), {
3431
+ var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, (animationDriver == null ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig), {
3418
3432
  disabled,
3419
3433
  groupName,
3420
3434
  hasAnimationProp,
@@ -3504,7 +3518,15 @@ function createComponent(staticConfig) {
3504
3518
  willBeAnimated,
3505
3519
  styledContext: styledContextValue
3506
3520
  }, themeName = (themeState == null ? void 0 : themeState.name) || "";
3507
- var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
3521
+ var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
3522
+ if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
3523
+ var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
3524
+ if (contextForVariants) {
3525
+ for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
3526
+ staticConfig.context || (contextForOverride = contextForVariants);
3527
+ }
3528
+ }
3529
+ var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
3508
3530
  if (!isPassthrough && groupContext && // avoids onLayout if we don't need it
3509
3531
  props.containerType !== "normal") {
3510
3532
  var groupState = groupContext == null ? void 0 : groupContext.state;
@@ -3546,8 +3568,8 @@ function createComponent(staticConfig) {
3546
3568
  }), stateRef.current.setStateShallow = function(nextOrGetNext) {
3547
3569
  var prev = stateRef.current.nextState || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
3548
3570
  if (!(next === prev || isEqualShallow(prev, next))) {
3549
- var canAvoidReRender = Object.keys(next).every(function(key2) {
3550
- return avoidReRenderKeys.has(key2);
3571
+ var canAvoidReRender = Object.keys(next).every(function(key3) {
3572
+ return avoidReRenderKeys.has(key3);
3551
3573
  }), updatedState = __spreadValues(__spreadValues({}, prev), next);
3552
3574
  if (stateRef.current.nextState = updatedState, canAvoidReRender) {
3553
3575
  var _stateRef_current_updateStyleListener, _stateRef_current;
@@ -3793,9 +3815,9 @@ function createComponent(staticConfig) {
3793
3815
  }))), "group" in props && (content = /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContext.Provider, {
3794
3816
  value: allGroupContexts,
3795
3817
  children: content
3796
- })), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps) {
3797
- var Provider = staticConfig.context.Provider;
3798
- for (var key in styledContextValue) key in overriddenContextProps || (overriddenContextProps[key] = styledContextValue[key]);
3818
+ })), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps && contextForOverride) {
3819
+ var Provider = contextForOverride.Provider;
3820
+ for (var key1 in styledContextValue) key1 in overriddenContextProps || (overriddenContextProps[key1] = styledContextValue[key1]);
3799
3821
  debugProp && console.info("overriddenContextProps", overriddenContextProps), content = /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, __spreadProps(__spreadValues({
3800
3822
  __disableMergeDefaultValues: true
3801
3823
  }, overriddenContextProps), {
@@ -4164,6 +4186,35 @@ var cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
4164
4186
  }
4165
4187
  return cache.set(res, true), res;
4166
4188
  };
4189
+ var noAnimationDriver = function(method) {
4190
+ console.warn(`No animation driver configured. To use ${method}, you must pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);
4191
+ }, createEmptyAnimationDriver = function() {
4192
+ return {
4193
+ isReactNative: false,
4194
+ supportsCSS: true,
4195
+ classNameAnimation: true,
4196
+ isStub: true,
4197
+ animations: {},
4198
+ useAnimations: function() {
4199
+ return noAnimationDriver("animations");
4200
+ },
4201
+ usePresence: function() {
4202
+ return noAnimationDriver("usePresence");
4203
+ },
4204
+ ResetPresence: function() {
4205
+ return noAnimationDriver("ResetPresence");
4206
+ },
4207
+ useAnimatedNumber: function() {
4208
+ return noAnimationDriver("useAnimatedNumber");
4209
+ },
4210
+ useAnimatedNumberStyle: function() {
4211
+ return noAnimationDriver("useAnimatedNumberStyle");
4212
+ },
4213
+ useAnimatedNumberReaction: function() {
4214
+ return noAnimationDriver("useAnimatedNumberReaction");
4215
+ }
4216
+ };
4217
+ }, defaultAnimationDriver = createEmptyAnimationDriver();
4167
4218
  var registerCSSVariable = function(v) {
4168
4219
  tokensValueToVariable.set(getVariableValue(v), v);
4169
4220
  }, variableToCSS = function(v) {
@@ -4274,7 +4325,7 @@ function createTamagui$1(configIn) {
4274
4325
  fonts: {},
4275
4326
  onlyAllowShorthands: false,
4276
4327
  fontLanguages: [],
4277
- animations: {},
4328
+ animations: defaultAnimationDriver,
4278
4329
  media: {}
4279
4330
  }, configIn), {
4280
4331
  unset,
@@ -4324,8 +4375,7 @@ function getThemesDeduped(themes2, colorTokens) {
4324
4375
  e2.names.push(themeName);
4325
4376
  continue;
4326
4377
  }
4327
- var theme = __spreadValues({}, rawTheme);
4328
- colorTokens && Object.assign(theme, colorTokens);
4378
+ var theme = __spreadValues(__spreadValues({}, colorTokens), rawTheme);
4329
4379
  for (var key1 in theme) ensureThemeVariable(theme, key1);
4330
4380
  var deduped = {
4331
4381
  names: [themeName],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tamagui/core",
3
- "version": "1.138.1",
3
+ "version": "1.138.3",
4
4
  "type": "module",
5
5
  "source": "src/index.tsx",
6
6
  "main": "dist/cjs",
@@ -33,18 +33,18 @@
33
33
  "native-test.d.ts"
34
34
  ],
35
35
  "dependencies": {
36
- "@tamagui/helpers": "1.138.1",
37
- "@tamagui/react-native-media-driver": "1.138.1",
38
- "@tamagui/react-native-use-pressable": "1.138.1",
39
- "@tamagui/react-native-use-responder-events": "1.138.1",
40
- "@tamagui/use-element-layout": "1.138.1",
41
- "@tamagui/use-event": "1.138.1",
42
- "@tamagui/web": "1.138.1"
36
+ "@tamagui/helpers": "1.138.3",
37
+ "@tamagui/react-native-media-driver": "1.138.3",
38
+ "@tamagui/react-native-use-pressable": "1.138.3",
39
+ "@tamagui/react-native-use-responder-events": "1.138.3",
40
+ "@tamagui/use-element-layout": "1.138.3",
41
+ "@tamagui/use-event": "1.138.3",
42
+ "@tamagui/web": "1.138.3"
43
43
  },
44
44
  "devDependencies": {
45
- "@tamagui/build": "1.138.1",
46
- "@tamagui/native-bundle": "1.138.1",
47
- "@tamagui/react-native-web-lite": "1.138.1",
45
+ "@tamagui/build": "1.138.3",
46
+ "@tamagui/native-bundle": "1.138.3",
47
+ "@tamagui/react-native-web-lite": "1.138.3",
48
48
  "@testing-library/react": "^16.1.0",
49
49
  "csstype": "^3.0.10",
50
50
  "react": "*",