@tamagui/core 1.112.23 → 1.112.25-1728362181133

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/native.js CHANGED
@@ -3732,7 +3732,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3732
3732
  function someParentIsInversed(manager) {
3733
3733
  for (var cur = manager; cur; ) {
3734
3734
  if (!cur.parentManager) return !1;
3735
- if (cur.parentManager.state.scheme !== cur.state.scheme) return !0;
3735
+ if (cur.parentManager.state.scheme !== cur.state.scheme) return process.env.NODE_ENV === "development" && !globalThis.TAMAGUI_DITW && !process.env.TAMAGUI_DISABLE_INVERSE_THEME_WARNING && console.info(` \u203C\uFE0F De-opted a theme value access due to an inversed parent.
3736
+
3737
+ This means you've accessed a theme value without .get() in a child of an inversed theme.
3738
+
3739
+ This isn't necessarily a bug, but can often be due to a mistaken inverse (for example,
3740
+ you may have a Theme inside your TamaguiProvider with mis-matched theme values for light/dark).
3741
+
3742
+ For this reason we've added this warning. If this is intentional, you can disable it with:
3743
+
3744
+ process.env.TAMAGUI_DISABLE_INVERSE_THEME_WARNING === 1
3745
+ or globalThis.TAMAGUI_DITW = true
3746
+ `), !0;
3736
3747
  cur = cur.parentManager;
3737
3748
  }
3738
3749
  return !1;
@@ -3764,10 +3775,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3764
3775
  function getShouldUpdateTheme() {
3765
3776
  var manager = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : themeManager, nextState = arguments.length > 1 ? arguments[1] : void 0, prevState2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : state, forceShouldChange = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
3766
3777
  if (!(!manager || !forceShouldChange && forceUpdate === !1)) {
3767
- var next = nextState || manager.getState(props, parentManager);
3768
- if (forceShouldChange || next && !(forceUpdate !== !0 && !manager.getStateShouldChange(next, prevState2))) return next;
3778
+ var next2 = nextState || manager.getState(props, parentManager);
3779
+ if (forceShouldChange || next2 && !(forceUpdate !== !0 && !manager.getStateShouldChange(next2, prevState2))) return next2;
3769
3780
  }
3770
3781
  }
3782
+ if (!import_constants2.isWeb && themeManager && getShouldUpdateTheme(themeManager)) {
3783
+ var _next_state, _themeState_state, next = createState(themeState);
3784
+ ((_next_state = next.state) === null || _next_state === void 0 ? void 0 : _next_state.name) !== ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) && (setThemeState(next), themeManager.notify());
3785
+ }
3771
3786
  if (import_constants2.isServer || (import_react3.default.useLayoutEffect(function() {
3772
3787
  themeManager && state && prevState && state !== prevState && themeManager.notify();
3773
3788
  }, [
@@ -3786,8 +3801,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3786
3801
  (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
3787
3802
  var selfListenerDispose = themeManager.onChangeTheme(function(_a, _b, forced) {
3788
3803
  forced && setThemeState(function(prev) {
3789
- var next = createState(prev, !!forced);
3790
- return next;
3804
+ var next2 = createState(prev, forced !== "self");
3805
+ return next2;
3791
3806
  });
3792
3807
  }, !0), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(function(name, manager, forced) {
3793
3808
  var force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
@@ -3848,8 +3863,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3848
3863
  };
3849
3864
  if (prev != null && prev.themeManager) {
3850
3865
  themeManager2 = prev.themeManager;
3851
- var forceChange = force || !!(keys != null && keys.length), next = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(themeManager2, next, prev.state, forceChange);
3852
- nextState ? (state2 = nextState, !prev.isNewTheme && !isRoot ? themeManager2 = getNewThemeManager() : themeManager2.updateState(nextState)) : prev.isNewTheme && parentManager && !next && (themeManager2 = parentManager);
3866
+ var forceChange = force, next2 = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(themeManager2, next2, prev.state, forceChange);
3867
+ nextState ? (state2 = nextState, !prev.isNewTheme && !isRoot ? themeManager2 = getNewThemeManager() : themeManager2.updateState(nextState)) : prev.isNewTheme && parentManager && !next2 && (themeManager2 = parentManager);
3853
3868
  } else themeManager2 = getNewThemeManager(), state2 = {
3854
3869
  ...themeManager2.state
3855
3870
  };
@@ -6578,10 +6593,8 @@ var require_propMapper_native = __commonJS({
6578
6593
  var _theme_value, val = (_theme_value = theme == null ? void 0 : theme[value]) !== null && _theme_value !== void 0 ? _theme_value : tokensParsed[customTokenAccept][value];
6579
6594
  val != null && (resolveAs = "value", valOrVar = val, hasSet = !0);
6580
6595
  }
6581
- if (theme && value in theme) {
6582
- if (valOrVar = theme[value], styleState.skipThemeTokenResolution && valOrVar != null && valOrVar.val) return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - keep original value: ${value} for ${key} due to enableFlattenThemeOnNative: true`), value;
6583
- process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${valOrVar == null ? void 0 : valOrVar.val}`), hasSet = !0;
6584
- } else {
6596
+ if (theme && value in theme) valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}`, valOrVar), hasSet = !0;
6597
+ else {
6585
6598
  if (value in conf.specificTokens) hasSet = !0, valOrVar = conf.specificTokens[value];
6586
6599
  else {
6587
6600
  switch (key) {
@@ -6861,7 +6874,7 @@ var require_getSplitStyles_native = __commonJS({
6861
6874
  var _staticConfig_accept, validStyleProps = staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles);
6862
6875
  return validStyleProps[key] || ((_staticConfig_accept = staticConfig.accept) === null || _staticConfig_accept === void 0 ? void 0 : _staticConfig_accept[key]);
6863
6876
  }
6864
- var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug, skipThemeTokenResolution) {
6877
+ var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) {
6865
6878
  conf = conf || (0, import_config.getConfig)(), import_constants2.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
6866
6879
  var { shorthands } = conf, { isHOC, isText, isInput, variants, isReactNative, inlineProps, inlineWhenUnflattened, parentStaticConfig, acceptsClassName } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants2.isWeb && !styleProps.noClassNames, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0, styleState = {
6867
6880
  classNames,
@@ -6875,8 +6888,7 @@ var require_getSplitStyles_native = __commonJS({
6875
6888
  usedKeys,
6876
6889
  viewProps,
6877
6890
  context,
6878
- debug,
6879
- skipThemeTokenResolution
6891
+ debug
6880
6892
  };
6881
6893
  process.env.NODE_ENV === "development" && debug && debug !== "profile" && import_constants2.isClient && (consoleGroupCollapsed("getSplitStyles (collapsed)"), (0, import_log.log)({
6882
6894
  props,
@@ -10862,9 +10874,9 @@ var require_useProps_native = __commonJS({
10862
10874
  componentName: staticConfig.componentName,
10863
10875
  name: "theme" in props ? props.theme : void 0,
10864
10876
  inverse: "themeInverse" in props ? props.themeInverse : void 0
10865
- }), componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), media = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, {
10877
+ }), componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), { state, disabled, setStateShallow } = (0, import_useComponentState.useComponentState)(props, componentContext, staticConfig, (0, import_config.getConfig)()), mediaState2 = (0, import_useMedia.useMedia)(), splitStyles = (0, import_getSplitStyles.useSplitStyles)(props, staticConfig, theme, ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) || "", state, {
10866
10878
  isAnimated: !1,
10867
- mediaState: media,
10879
+ mediaState: mediaState2,
10868
10880
  noSkip: !0,
10869
10881
  noMergeStyle: !0,
10870
10882
  noClassNames: !0,
@@ -10900,7 +10912,7 @@ var require_useProps_native = __commonJS({
10900
10912
  splitStyles.viewProps,
10901
10913
  splitStyles.style || {},
10902
10914
  theme,
10903
- media
10915
+ mediaState2
10904
10916
  ];
10905
10917
  }
10906
10918
  }