@tamagui/core 1.116.9 → 1.116.11

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.
@@ -3080,6 +3080,13 @@ var require_ThemeManager_native = __commonJS({
3080
3080
  if (nextState) return this.updateState(nextState, shouldNotify), nextState;
3081
3081
  }
3082
3082
  },
3083
+ {
3084
+ key: "getParents",
3085
+ value: function() {
3086
+ for (var parents = [], current = this; current; ) parents.push(current), current = current.parentManager;
3087
+ return parents;
3088
+ }
3089
+ },
3083
3090
  {
3084
3091
  key: "updateState",
3085
3092
  value: function(nextState) {
@@ -3229,6 +3236,7 @@ var require_ThemeManager_native = __commonJS({
3229
3236
  theme: themes[found],
3230
3237
  className,
3231
3238
  isComponent,
3239
+ isSchemeFixed: props.name === "light" || props.name === "dark",
3232
3240
  scheme
3233
3241
  };
3234
3242
  break;
@@ -3522,19 +3530,14 @@ var require_useTheme_native = __commonJS({
3522
3530
  if (subkey === "val") globalThis.tamaguiAvoidTracking || track(keyString);
3523
3531
  else if (subkey === "get") return function(platform) {
3524
3532
  var outVal = (0, import_createVariable.getVariable)(val);
3525
- if (platform !== "web" && import_constants2.isIos && !deopt && (0, import_config.getSetting)("fastSchemeChange") && scheme) {
3526
- var isInversed = getIsInversed(themeManager);
3527
- isInversed && (scheme = scheme === "dark" ? "light" : "dark");
3528
- var oppositeThemeName = name.replace(scheme === "dark" ? "dark" : "light", scheme === "dark" ? "light" : "dark"), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
3529
- if (oppositeVal) {
3530
- var dynamicVal = {
3531
- dynamic: {
3532
- dark: scheme === "dark" ? outVal : oppositeVal,
3533
- light: scheme === "light" ? outVal : oppositeVal
3534
- }
3535
- };
3536
- return dynamicVal;
3537
- }
3533
+ if (platform !== "web" && import_constants2.isIos && !deopt && (0, import_config.getSetting)("fastSchemeChange") && !hasFixedSchemeParent(themeManager) && scheme) {
3534
+ var _config_themes_name, _config_themes_oppositeName, oppositeName = name.replace(scheme === "dark" ? "dark" : "light", scheme === "dark" ? "light" : "dark"), colorLight = (0, import_createVariable.getVariable)((_config_themes_name = config.themes[name]) === null || _config_themes_name === void 0 ? void 0 : _config_themes_name[keyString]), colorDark = (0, import_createVariable.getVariable)((_config_themes_oppositeName = config.themes[oppositeName]) === null || _config_themes_oppositeName === void 0 ? void 0 : _config_themes_oppositeName[keyString]), dynamicVal = {
3535
+ dynamic: {
3536
+ light: colorLight,
3537
+ dark: colorDark
3538
+ }
3539
+ };
3540
+ return dynamicVal;
3538
3541
  }
3539
3542
  return track(keyString), outVal;
3540
3543
  };
@@ -3546,12 +3549,10 @@ var require_useTheme_native = __commonJS({
3546
3549
  }
3547
3550
  });
3548
3551
  }
3549
- function getIsInversed(manager) {
3550
- for (var isInversed = !1, cur = manager; cur; ) {
3551
- if (!cur.parentManager) return isInversed;
3552
- cur.parentManager.state.scheme !== cur.state.scheme && (isInversed = !isInversed), cur = cur.parentManager;
3553
- }
3554
- return !1;
3552
+ function hasFixedSchemeParent(manager) {
3553
+ return manager == null ? void 0 : manager.getParents().some(function(x) {
3554
+ return x.state.isSchemeFixed;
3555
+ });
3555
3556
  }
3556
3557
  var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = function(id) {
3557
3558
  return _idToUID[id];
@@ -3576,7 +3577,7 @@ var require_useTheme_native = __commonJS({
3576
3577
  state: parentManager == null ? void 0 : parentManager.state,
3577
3578
  themeManager: parentManager
3578
3579
  };
3579
- var [themeState, setThemeState] = import_react3.default.useState(createState), { state, mounted, isNewTheme, themeManager, inversed, prevState } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
3580
+ var [themeState, setThemeState] = import_react3.default.useState(createState), { state, mounted, isNewTheme, themeManager, prevState } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
3580
3581
  function getShouldUpdateTheme() {
3581
3582
  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();
3582
3583
  if (!(!manager || !forceShouldChange && forceUpdate === !1)) {
@@ -3584,7 +3585,7 @@ var require_useTheme_native = __commonJS({
3584
3585
  if (forceShouldChange || next2 && !(forceUpdate !== !0 && !manager.getStateShouldChange(next2, prevState2))) return next2;
3585
3586
  }
3586
3587
  }
3587
- if (!import_constants2.isWeb && themeManager && getShouldUpdateTheme(themeManager)) {
3588
+ if (themeManager && getShouldUpdateTheme(themeManager)) {
3588
3589
  var _next_state, _themeState_state, next = createState(themeState);
3589
3590
  ((_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);
3590
3591
  }
@@ -3641,7 +3642,7 @@ var require_useTheme_native = __commonJS({
3641
3642
  return {
3642
3643
  state,
3643
3644
  isNewTheme,
3644
- inversed,
3645
+ inversed: !!props.inverse,
3645
3646
  themeManager
3646
3647
  };
3647
3648
  function createState(prev) {
@@ -3664,11 +3665,11 @@ var require_useTheme_native = __commonJS({
3664
3665
  isNewTheme2 && registerThemeManager(themeManager2);
3665
3666
  var isWebSSR = import_constants2.isWeb ? !(0, import_config.getSetting)("disableSSR") : !1, mounted2 = isWebSSR ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
3666
3667
  state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
3667
- var wasInversed = prev == null ? void 0 : prev.inversed, isInherentlyInversed = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme), inversed2 = isRoot ? !1 : isInherentlyInversed ? !0 : isWebSSR ? wasInversed != null ? !1 : null : props.inverse, response = {
3668
+ var response = {
3668
3669
  themeManager: themeManager2,
3669
3670
  isNewTheme: isNewTheme2,
3670
3671
  mounted: mounted2,
3671
- inversed: inversed2
3672
+ inversed: props.inverse
3672
3673
  }, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
3673
3674
  (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
3674
3675
  (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
@@ -6850,7 +6851,7 @@ var require_getSplitStyles_native = __commonJS({
6850
6851
  if (!styleState.style.$$css) {
6851
6852
  var atomic, _iteratorNormalCompletion, _didIteratorError, _iteratorError;
6852
6853
  try {
6853
- for (var _iterator, _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) var atomicStyle, _props_animateOnly, key3, value, identifier1, isAnimatedAndAnimateOnly, nonAnimatedAnimateOnly;
6854
+ for (var _iterator, _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) var atomicStyle, _props_animateOnly, _props_animateOnly1, key3, value, identifier1, isAnimatedAndAnimateOnly, nonAnimatedAnimateOnly;
6854
6855
  } catch (err) {
6855
6856
  } finally {
6856
6857
  try {