@tamagui/core 1.112.25 → 1.113.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.
package/dist/native.js CHANGED
@@ -2208,6 +2208,7 @@ var require_createVariable_native = __commonJS({
2208
2208
  }
2209
2209
  function getVariable(nameOrVariable) {
2210
2210
  var group = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "size", _tokens_group;
2211
+ if (nameOrVariable != null && nameOrVariable.dynamic) return nameOrVariable;
2211
2212
  if (setDidGetVariableValue(!0), isVariable(nameOrVariable)) return variableToString(nameOrVariable);
2212
2213
  var tokens = (0, import_config.getConfig)().tokensParsed, _tokens_group_nameOrVariable;
2213
2214
  return variableToString((_tokens_group_nameOrVariable = (_tokens_group = tokens[group]) === null || _tokens_group === void 0 ? void 0 : _tokens_group[nameOrVariable]) !== null && _tokens_group_nameOrVariable !== void 0 ? _tokens_group_nameOrVariable : nameOrVariable);
@@ -3732,7 +3733,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3732
3733
  function someParentIsInversed(manager) {
3733
3734
  for (var cur = manager; cur; ) {
3734
3735
  if (!cur.parentManager) return !1;
3735
- if (cur.parentManager.state.scheme !== cur.state.scheme) return !0;
3736
+ 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.
3737
+
3738
+ This means you've accessed a theme value without .get() in a child of an inversed theme.
3739
+
3740
+ This isn't necessarily a bug, but can often be due to a mistaken inverse (for example,
3741
+ you may have a Theme inside your TamaguiProvider with mis-matched theme values for light/dark).
3742
+
3743
+ For this reason we've added this warning. If this is intentional, you can disable it with:
3744
+
3745
+ process.env.TAMAGUI_DISABLE_INVERSE_THEME_WARNING === 1
3746
+ or globalThis.TAMAGUI_DITW = true
3747
+ `), !0;
3736
3748
  cur = cur.parentManager;
3737
3749
  }
3738
3750
  return !1;
@@ -3764,10 +3776,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3764
3776
  function getShouldUpdateTheme() {
3765
3777
  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
3778
  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;
3779
+ var next2 = nextState || manager.getState(props, parentManager);
3780
+ if (forceShouldChange || next2 && !(forceUpdate !== !0 && !manager.getStateShouldChange(next2, prevState2))) return next2;
3769
3781
  }
3770
3782
  }
3783
+ if (!import_constants2.isWeb && themeManager && getShouldUpdateTheme(themeManager)) {
3784
+ var _next_state, _themeState_state, next = createState(themeState);
3785
+ ((_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), console.error = preventWarnSetState, themeManager.notify(), console.error = ogLog);
3786
+ }
3771
3787
  if (import_constants2.isServer || (import_react3.default.useLayoutEffect(function() {
3772
3788
  themeManager && state && prevState && state !== prevState && themeManager.notify();
3773
3789
  }, [
@@ -3786,8 +3802,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3786
3802
  (isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
3787
3803
  var selfListenerDispose = themeManager.onChangeTheme(function(_a, _b, forced) {
3788
3804
  forced && setThemeState(function(prev) {
3789
- var next = createState(prev, !!forced);
3790
- return next;
3805
+ var next2 = createState(prev, forced !== "self");
3806
+ return next2;
3791
3807
  });
3792
3808
  }, !0), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(function(name, manager, forced) {
3793
3809
  var force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
@@ -3848,8 +3864,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3848
3864
  };
3849
3865
  if (prev != null && prev.themeManager) {
3850
3866
  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);
3867
+ var forceChange = force || !!(keys != null && keys.length), next2 = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(themeManager2, next2, prev.state, forceChange);
3868
+ nextState ? (state2 = nextState, !prev.isNewTheme && !isRoot ? themeManager2 = getNewThemeManager() : themeManager2.updateState(nextState)) : prev.isNewTheme && parentManager && !next2 && (themeManager2 = parentManager);
3853
3869
  } else themeManager2 = getNewThemeManager(), state2 = {
3854
3870
  ...themeManager2.state
3855
3871
  };