tamagui 1.74.15 → 1.74.17

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
@@ -1510,6 +1510,7 @@ var require_createShallowSetState_native = __commonJS({
1510
1510
  }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
1511
1511
  __export2(createShallowSetState_exports, {
1512
1512
  createShallowSetState: () => createShallowSetState,
1513
+ isEqualShallow: () => isEqualShallow,
1513
1514
  mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
1514
1515
  });
1515
1516
  module2.exports = __toCommonJS2(createShallowSetState_exports);
@@ -1517,10 +1518,13 @@ var require_createShallowSetState_native = __commonJS({
1517
1518
  return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next));
1518
1519
  }
1519
1520
  function mergeIfNotShallowEqual(prev, next) {
1521
+ return isEqualShallow(prev, next) ? prev : { ...prev, ...next };
1522
+ }
1523
+ function isEqualShallow(prev, next) {
1520
1524
  for (let key in next)
1521
1525
  if (prev[key] !== next[key])
1522
- return { ...prev, ...next };
1523
- return prev;
1526
+ return !1;
1527
+ return !0;
1524
1528
  }
1525
1529
  }
1526
1530
  });
@@ -3387,7 +3391,7 @@ var require_ThemeManager_native = __commonJS({
3387
3391
  __export2(ThemeManager_exports, {
3388
3392
  ThemeManager: () => ThemeManager,
3389
3393
  getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
3390
- getNonComponentParentManager: () => getNonComponentParentManager
3394
+ getManagers: () => getManagers
3391
3395
  });
3392
3396
  module2.exports = __toCommonJS2(ThemeManager_exports);
3393
3397
  var import_constants = require_index_native2(), import_config = require_config_native(), import_constants2 = require_constants_native2(), emptyState = { name: "" };
@@ -3395,17 +3399,17 @@ var require_ThemeManager_native = __commonJS({
3395
3399
  return props.name || props.componentName || props.inverse || props.reset;
3396
3400
  }
3397
3401
  var uid = 0, ThemeManager = class {
3398
- constructor(props = {}, parentManagerIn) {
3399
- if (this.props = props, this.id = uid++, this.isComponent = !1, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this.scheme = null, this._allKeys = null, parentManagerIn === "root") {
3402
+ constructor(props = {}, parentManager) {
3403
+ if (this.props = props, this.id = uid++, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, parentManager === "root") {
3400
3404
  this.updateStateFromProps(props, !1);
3401
3405
  return;
3402
3406
  }
3403
- if (!parentManagerIn)
3407
+ if (!parentManager)
3404
3408
  throw process.env.NODE_ENV !== "production" ? new Error(
3405
3409
  "No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
3406
3410
  ) : "\u274C 0";
3407
- if (this.parentManager = parentManagerIn, !this.updateStateFromProps(props, !1))
3408
- return parentManagerIn || this;
3411
+ if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
3412
+ return parentManager;
3409
3413
  }
3410
3414
  updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
3411
3415
  if (this.props = props, props.forceTheme)
@@ -3415,9 +3419,7 @@ var require_ThemeManager_native = __commonJS({
3415
3419
  return this.updateState(nextState, shouldNotify), nextState;
3416
3420
  }
3417
3421
  updateState(nextState, shouldNotify = !0) {
3418
- this.state = nextState;
3419
- let names = this.state.name.split("_"), lastName = names[names.length - 1][0];
3420
- this.isComponent = lastName[0] === lastName[0].toUpperCase(), this._allKeys = null, this.scheme = names[0] === "light" ? "light" : names[0] === "dark" ? "dark" : null, process.env.NODE_ENV === "development" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && queueMicrotask(() => {
3422
+ this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && queueMicrotask(() => {
3421
3423
  this.notify();
3422
3424
  });
3423
3425
  }
@@ -3445,51 +3447,37 @@ var require_ThemeManager_native = __commonJS({
3445
3447
  this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
3446
3448
  }
3447
3449
  onChangeTheme(cb, debugId) {
3448
- return process.env.NODE_ENV === "development" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
3450
+ return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
3449
3451
  this.themeListeners.delete(cb);
3450
3452
  };
3451
3453
  }
3452
3454
  };
3453
- function getNextThemeClassName(name) {
3454
- return `t_sub_theme ${import_constants2.THEME_CLASSNAME_PREFIX}${name}`.replace("light_", "").replace("dark_", "");
3455
- }
3456
- function getState(props, parentManager) {
3457
- var _a, _b, _c, _d, _e, _f;
3458
- let validManagerAndAllComponentThemes = getNonComponentParentManager(parentManager);
3459
- parentManager = validManagerAndAllComponentThemes[0];
3460
- let allComponentThemes = validManagerAndAllComponentThemes[1], themes = (0, import_config.getThemes)(), isDirectParentAComponentTheme = allComponentThemes.length > 0;
3455
+ function getState(props, manager) {
3456
+ var _a;
3461
3457
  if (props.name && props.reset)
3462
- throw new Error("Cannot reset + set new name");
3463
- if (!props.name && !props.inverse && !props.reset && !props.componentName)
3458
+ throw new Error(
3459
+ process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
3460
+ );
3461
+ if (!getHasThemeUpdatingProps(props))
3464
3462
  return null;
3465
- if (props.reset && !isDirectParentAComponentTheme && !(parentManager != null && parentManager.parentManager))
3466
- return process.env.NODE_ENV === "development" && console.warn("Cannot reset no grandparent exists"), null;
3467
- let result = null, nextName = props.reset ? isDirectParentAComponentTheme ? ((_a = parentManager == null ? void 0 : parentManager.state) == null ? void 0 : _a.name) || "" : ((_c = (_b = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _b.state) == null ? void 0 : _c.name) || "" : props.name || "", { componentName } = props, parentName = props.reset ? isDirectParentAComponentTheme ? (
3468
- // here because parentManager already skipped componentTheme so we have to only go up once
3469
- ((_d = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _d.state.name) || ""
3470
- ) : ((_f = (_e = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _e.parentManager) == null ? void 0 : _f.state.name) || "" : isDirectParentAComponentTheme ? allComponentThemes[0] || "" : (parentManager == null ? void 0 : parentManager.state.name) || "";
3471
- props.reset && isDirectParentAComponentTheme && allComponentThemes.shift();
3472
- let base = parentName.split(import_constants2.THEME_NAME_SEPARATOR), lastSegment = base[base.length - 1], isParentComponentTheme = parentName && lastSegment[0].toUpperCase() === lastSegment[0];
3473
- isParentComponentTheme && base.pop();
3474
- let parentBaseTheme = isParentComponentTheme ? base.slice(0, base.length).join(import_constants2.THEME_NAME_SEPARATOR) : parentName, max2 = base.length, min2 = componentName && !nextName ? max2 : 0;
3475
- process.env.NODE_ENV === "development" && typeof props.debug == "string" && (console.groupCollapsed("ThemeManager.getState()"), console.info({
3476
- props,
3477
- parentName,
3478
- parentBaseTheme,
3479
- base,
3480
- min: min2,
3481
- max: max2,
3482
- isParentComponentTheme
3483
- }));
3463
+ let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
3464
+ if (!baseManager && props.reset)
3465
+ return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
3466
+ let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
3467
+ baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][a-z]+/, ""));
3468
+ let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
3469
+ isDirectParentAComponentTheme && allComponentThemes.shift();
3470
+ let base = baseName.split(import_constants2.THEME_NAME_SEPARATOR), max2 = base.length, min2 = props.componentName && !nextName ? max2 : 0;
3471
+ process.env.NODE_ENV !== "production" && typeof props.debug == "string" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min: min2, max: max2 }));
3484
3472
  for (let i = max2; i >= min2; i--) {
3485
3473
  let prefix = base.slice(0, i).join(import_constants2.THEME_NAME_SEPARATOR);
3486
3474
  props.inverse && (prefix = inverseThemeName(prefix));
3487
3475
  let potentials = [];
3488
- if (prefix && prefix !== parentBaseTheme && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
3489
- let lastSegment2 = potentials.findIndex((x) => !x.includes("_"));
3490
- lastSegment2 > 0 && potentials.splice(lastSegment2, 0, nextName);
3476
+ if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
3477
+ let lastSegment = potentials.findIndex((x) => !x.includes("_"));
3478
+ lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
3491
3479
  }
3492
- if (componentName) {
3480
+ if (componentName && !props.reset) {
3493
3481
  let componentPotentials = [];
3494
3482
  if (nextName) {
3495
3483
  let beforeSeparator = prefix.slice(0, prefix.indexOf(import_constants2.THEME_NAME_SEPARATOR));
@@ -3507,29 +3495,27 @@ var require_ThemeManager_native = __commonJS({
3507
3495
  potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
3508
3496
  }
3509
3497
  let found = potentials.find((t) => t in themes);
3510
- if (process.env.NODE_ENV === "development" && typeof props.debug == "string" && console.info(" - ", { found, potentials, parentManager }), found) {
3498
+ if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" - ", { found, potentials, baseManager, nextName, baseName, prefix }), found) {
3499
+ let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants2.THEME_CLASSNAME_PREFIX, className = import_constants.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
3511
3500
  result = {
3512
3501
  name: found,
3513
- theme: themes[found],
3514
- className: import_constants.isWeb ? getNextThemeClassName(found) : "",
3515
3502
  parentName,
3516
- componentName,
3517
- inverse: props.inverse
3503
+ theme: themes[found],
3504
+ className,
3505
+ isComponent,
3506
+ scheme
3518
3507
  };
3519
3508
  break;
3520
3509
  }
3521
3510
  }
3522
- return process.env.NODE_ENV === "development" && typeof props.debug == "string" && typeof window < "u" && (console.warn("ThemeManager.getState():", {
3523
- result
3524
- }), console.trace(), console.groupEnd()), result;
3511
+ return process.env.NODE_ENV !== "production" && typeof props.debug == "string" && typeof window < "u" && (console.warn("ThemeManager.getState():", { result }), console.trace(), console.groupEnd()), result;
3525
3512
  }
3526
3513
  var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
3527
- function getNonComponentParentManager(themeManager) {
3528
- var _a;
3529
- let res = themeManager, componentThemeNames = [];
3530
- for (; res && res != null && res.isComponent; )
3531
- componentThemeNames.push((_a = res == null ? void 0 : res.state) == null ? void 0 : _a.name), res = res.parentManager;
3532
- return [res || null, componentThemeNames];
3514
+ function getManagers(themeManager) {
3515
+ let comp = [], all = [], cur = themeManager;
3516
+ for (; cur; )
3517
+ all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
3518
+ return [all, comp];
3533
3519
  }
3534
3520
  }
3535
3521
  });
@@ -3577,7 +3563,7 @@ var require_useTheme_native = __commonJS({
3577
3563
  useThemeWithState: () => useThemeWithState
3578
3564
  });
3579
3565
  module2.exports = __toCommonJS2(useTheme_exports);
3580
- var import_constants = require_index_native2(), import_react2 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
3566
+ var import_constants = require_index_native2(), import_react2 = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
3581
3567
  function getDefaultThemeProxied() {
3582
3568
  if (cached)
3583
3569
  return cached;
@@ -3611,7 +3597,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3611
3597
  let themeProxied = (0, import_react2.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state, themeManager, props.deopt, props.debug]);
3612
3598
  return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
3613
3599
  };
3614
- function getThemeProxied({ theme, name }, deopt = !1, themeManager, keys, debug) {
3600
+ function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
3615
3601
  if (!theme)
3616
3602
  return {};
3617
3603
  let config = (0, import_config.getConfig)();
@@ -3644,21 +3630,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3644
3630
  else if (subkey === "get")
3645
3631
  return (platform) => {
3646
3632
  let outVal = (0, import_createVariable.getVariable)(val);
3647
- if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange) {
3648
- let isDark = name.startsWith("dark"), isLight = !isDark && name.startsWith("light");
3649
- if (isDark || isLight) {
3650
- let oppositeThemeName = name.replace(
3651
- isDark ? "dark" : "light",
3652
- isDark ? "light" : "dark"
3653
- ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
3654
- if (oppositeVal)
3655
- return {
3656
- dynamic: {
3657
- dark: isDark ? outVal : oppositeVal,
3658
- light: isLight ? outVal : oppositeVal
3659
- }
3660
- };
3661
- }
3633
+ if (platform !== "web" && import_constants.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
3634
+ let oppositeThemeName = name.replace(
3635
+ scheme === "dark" ? "dark" : "light",
3636
+ scheme === "dark" ? "light" : "dark"
3637
+ ), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
3638
+ if (oppositeVal)
3639
+ return {
3640
+ dynamic: {
3641
+ dark: scheme === "dark" ? outVal : oppositeVal,
3642
+ light: scheme === "light" ? outVal : oppositeVal
3643
+ }
3644
+ };
3662
3645
  }
3663
3646
  return track(keyString), outVal;
3664
3647
  };
@@ -3670,6 +3653,19 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3670
3653
  }
3671
3654
  });
3672
3655
  }
3656
+ function someParentIsInversed(manager) {
3657
+ {
3658
+ let cur = manager;
3659
+ for (; cur; ) {
3660
+ if (!cur.parentManager)
3661
+ return !0;
3662
+ if (cur.parentManager.state.scheme !== cur.state.scheme)
3663
+ return !1;
3664
+ cur = cur.parentManager;
3665
+ }
3666
+ }
3667
+ return !1;
3668
+ }
3673
3669
  var activeThemeManagers = /* @__PURE__ */ new Set(), useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
3674
3670
  let { disable } = props, parentManager = (0, import_react2.useContext)(import_ThemeManagerContext.ThemeManagerContext);
3675
3671
  if (!isRoot && !parentManager || disable)
@@ -3678,7 +3674,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3678
3674
  state: parentManager == null ? void 0 : parentManager.state,
3679
3675
  themeManager: parentManager
3680
3676
  };
3681
- let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
3677
+ let [themeState, setThemeState] = (0, import_react2.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
3682
3678
  function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
3683
3679
  let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
3684
3680
  if (!manager || !forceShouldChange && forceUpdate === !1)
@@ -3691,7 +3687,10 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3691
3687
  if (!themeManager)
3692
3688
  return;
3693
3689
  if (props.inverse && !mounted) {
3694
- setThemeState({ ...themeState, mounted: !0 });
3690
+ setThemeState((prev) => createState({
3691
+ ...prev,
3692
+ mounted: !0
3693
+ }));
3695
3694
  return;
3696
3695
  }
3697
3696
  isNewTheme && themeManager && activeThemeManagers.add(themeManager), (isNewTheme || getShouldUpdateTheme(themeManager)) && setThemeState(createState);
@@ -3725,6 +3724,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3725
3724
  }), [themeManager])), isInversingOnMount)
3726
3725
  return {
3727
3726
  isNewTheme: !1,
3727
+ inversed: !1,
3728
3728
  themeManager: parentManager,
3729
3729
  state: {
3730
3730
  name: "",
@@ -3735,10 +3735,10 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3735
3735
  return {
3736
3736
  state,
3737
3737
  isNewTheme,
3738
+ inversed,
3738
3739
  themeManager
3739
3740
  };
3740
3741
  function createState(prev, force = !1) {
3741
- var _a;
3742
3742
  if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1)
3743
3743
  return prev;
3744
3744
  let themeManager2 = parentManager, state2;
@@ -3757,15 +3757,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
3757
3757
  themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
3758
3758
  }
3759
3759
  let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse), mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
3760
- if (state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager)), !force && (state2 == null ? void 0 : state2.name) === ((_a = prev == null ? void 0 : prev.state) == null ? void 0 : _a.name))
3761
- return prev;
3762
- let response = {
3763
- state: state2,
3760
+ state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
3761
+ let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed ? !1 : null, response = {
3764
3762
  themeManager: themeManager2,
3765
3763
  isNewTheme: isNewTheme2,
3766
- mounted: mounted2
3767
- };
3768
- if (process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
3764
+ mounted: mounted2,
3765
+ inversed: inversed2
3766
+ }, shouldReturnPrev = !force && prev && // isEqualShallow uses the second arg as the keys so this should compare without state first...
3767
+ (0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
3768
+ (0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
3769
+ if (prev && shouldReturnPrev)
3770
+ return prev;
3771
+ if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants.isClient) {
3769
3772
  console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
3770
3773
  let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
3771
3774
  console.info({
@@ -3833,9 +3836,7 @@ var require_Theme_native = __commonJS({
3833
3836
  )), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Theme_exports = {};
3834
3837
  __export2(Theme_exports, {
3835
3838
  Theme: () => Theme2,
3836
- getThemeCNStyle: () => getThemeCNStyle,
3837
- useThemedChildren: () => useThemedChildren,
3838
- wrapThemeElements: () => wrapThemeElements
3839
+ useThemedChildren: () => useThemedChildren
3839
3840
  });
3840
3841
  module2.exports = __toCommonJS2(Theme_exports);
3841
3842
  var import_constants = require_index_native2(), import_react2 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime6 = require("react/jsx-runtime"), Theme2 = (0, import_react2.forwardRef)(function(props, ref) {
@@ -3874,40 +3875,32 @@ var require_Theme_native = __commonJS({
3874
3875
  isRoot
3875
3876
  }) : elementsWithContext;
3876
3877
  }
3877
- function getThemeCNStyle(themeState, isRoot = !1) {
3878
- var _a, _b;
3879
- if (!themeState.isNewTheme)
3880
- return;
3881
- let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
3882
- color: themeColor
3883
- } : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
3884
- return isRoot && (className = className.replace("t_sub_theme", "")), { style, className };
3885
- }
3886
3878
  function wrapThemeElements({
3887
3879
  children,
3888
3880
  themeState,
3889
3881
  forceClassName,
3890
3882
  isRoot
3891
3883
  }) {
3892
- var _a, _b;
3884
+ var _a;
3893
3885
  if (isRoot && forceClassName === !1)
3894
3886
  return children;
3895
- let inverse = (_a = themeState.state) == null ? void 0 : _a.inverse;
3896
- if (!themeState.isNewTheme && !inverse && !forceClassName)
3887
+ let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName;
3888
+ if (!themeState.isNewTheme && !requiresExtraWrapper)
3897
3889
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: "_dsp_contents is_Theme", children });
3898
- let { className, style } = getThemeCNStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
3899
- if (inverse != null || forceClassName) {
3900
- let name = ((_b = themeState.state) == null ? void 0 : _b.name) || "";
3901
- themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
3902
- "span",
3903
- {
3904
- className: `${name.startsWith("light") ? "t_light" : name.startsWith("dark") ? "t_dark" : ""} _dsp_contents ${inverse ? "is_inversed" : ""}`,
3905
- children: themedChildren
3906
- }
3907
- );
3890
+ let { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
3891
+ if (requiresExtraWrapper) {
3892
+ let name = ((_a = themeState.state) == null ? void 0 : _a.name) || "", inverseClassName = name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "";
3893
+ themedChildren = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
3908
3894
  }
3909
3895
  return themedChildren;
3910
3896
  }
3897
+ function getThemeClassNameAndStyle(themeState, isRoot = !1) {
3898
+ var _a, _b;
3899
+ let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
3900
+ color: themeColor
3901
+ } : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
3902
+ return isRoot && (className = className.replace("t_sub_theme", "")), { style, className };
3903
+ }
3911
3904
  }
3912
3905
  });
3913
3906
 
@@ -3936,7 +3929,7 @@ var require_themeable_native = __commonJS({
3936
3929
  import_Theme.Theme,
3937
3930
  {
3938
3931
  componentName: componentName || (staticConfig == null ? void 0 : staticConfig.componentName),
3939
- name: theme || null,
3932
+ name: theme,
3940
3933
  "disable-child-theme": !0,
3941
3934
  debug: props.debug,
3942
3935
  inverse: themeInverse,
@@ -11813,7 +11806,6 @@ var require_Button_native = __commonJS({
11813
11806
  }
11814
11807
  }), ButtonText = (0, import_web.styled)(import_text2.SizableText, {
11815
11808
  name: "Button",
11816
- // same name as the frame so they can share a single theme
11817
11809
  context: ButtonContext,
11818
11810
  variants: {
11819
11811
  unstyled: {
@@ -14993,12 +14985,12 @@ var require_Popper_native = __commonJS({
14993
14985
  left: "right"
14994
14986
  }, PopperArrow = PopperArrowFrame.styleable(function(propsIn, forwardedRef) {
14995
14987
  var _a, _b;
14996
- let { __scopePopper, ...rest } = propsIn, props = (0, import_core13.useProps)(rest), { offset: offset2, size: sizeProp, borderWidth = 0, ...arrowProps } = props, context = usePopperContext(__scopePopper), sizeVal = sizeProp ?? context.size, size2 = +(0, import_core13.getVariableValue)(
14988
+ let { __scopePopper, ...rest } = propsIn, props = (0, import_core13.useProps)(rest), { offset: offset2, size: sizeProp, borderWidth = 0, ...arrowProps } = props, context = usePopperContext(__scopePopper), sizeVal = sizeProp ?? context.size, sizeValResolved = (0, import_core13.getVariableValue)(
14997
14989
  (0, import_get_token2.getSpace)(sizeVal, {
14998
14990
  shift: -2,
14999
14991
  bounds: [2]
15000
14992
  })
15001
- ), { placement } = context, refs = (0, import_compose_refs.useComposedRefs)(context.arrowRef, forwardedRef), x = ((_a = context.arrowStyle) == null ? void 0 : _a.x) || 0, y = ((_b = context.arrowStyle) == null ? void 0 : _b.y) || 0, primaryPlacement = placement ? placement.split("-")[0] : "top", arrowStyle = { x, y, width: size2, height: size2 }, innerArrowStyle = {}, isVertical = primaryPlacement === "bottom" || primaryPlacement === "top";
14993
+ ), size2 = Math.max(0, +sizeValResolved), { placement } = context, refs = (0, import_compose_refs.useComposedRefs)(context.arrowRef, forwardedRef), x = ((_a = context.arrowStyle) == null ? void 0 : _a.x) || 0, y = ((_b = context.arrowStyle) == null ? void 0 : _b.y) || 0, primaryPlacement = placement ? placement.split("-")[0] : "top", arrowStyle = { x, y, width: size2, height: size2 }, innerArrowStyle = {}, isVertical = primaryPlacement === "bottom" || primaryPlacement === "top";
15002
14994
  if (primaryPlacement) {
15003
14995
  arrowStyle[isVertical ? "width" : "height"] = size2 * 2;
15004
14996
  let oppSide = opposites[primaryPlacement];
@@ -18471,9 +18463,7 @@ var require_ToggleGroup_native = __commonJS({
18471
18463
  width: void 0,
18472
18464
  height: void 0,
18473
18465
  padding: (0, import_web.getVariableValue)(size2) * 0.6
18474
- };
18475
- props.unstyled || (props.orientation === "horizontal" ? sizeProps.height = (0, import_web.getVariableValue)(size2) * 2.4 : sizeProps.width = (0, import_web.getVariableValue)(size2) * 2.4);
18476
- let iconSize = (typeof size2 == "number" ? size2 * 0.7 : (0, import_font_size.getFontSize)(size2)) * 1.2, theme = (0, import_web.useTheme)(), getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color: theme.color }), children = import_react2.default.Children.toArray(props.children).map((child) => props.disablePassStyles || !import_react2.default.isValidElement(child) ? child : getThemedIcon(child)), commonProps = { pressed, disabled, ...sizeProps, ...props, children };
18466
+ }, iconSize = (typeof size2 == "number" ? size2 * 0.7 : (0, import_font_size.getFontSize)(size2)) * 1.2, theme = (0, import_web.useTheme)(), getThemedIcon = (0, import_helpers_tamagui.useGetThemedIcon)({ size: iconSize, color: theme.color }), children = import_react2.default.Children.toArray(props.children).map((child) => props.disablePassStyles || !import_react2.default.isValidElement(child) ? child : getThemedIcon(child)), commonProps = { pressed, disabled, ...sizeProps, ...props, children };
18477
18467
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ToggleGroupItemProvider, { scope: __scopeToggleGroup, children: context.rovingFocus ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
18478
18468
  import_roving_focus.RovingFocusGroup.Item,
18479
18469
  {