tamagui 1.124.3 → 1.124.5

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.
@@ -2012,13 +2012,11 @@ var require_useControllableState_native = __commonJS({
2012
2012
  };
2013
2013
  function useControllableState(param) {
2014
2014
  var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
2015
- React4.useEffect(function() {
2016
- prop !== void 0 && (previous.current = prop, transitionFn(function() {
2017
- setState(prop);
2018
- }));
2019
- }, [
2020
- prop
2021
- ]), React4.useEffect(function() {
2015
+ prop !== state && transitionFn(function() {
2016
+ setState(function(prev) {
2017
+ if (prev !== prop) return previous.current = prop, prop;
2018
+ });
2019
+ }), React4.useEffect(function() {
2022
2020
  propWins || state !== previous.current && (previous.current = state, onChangeCb(state));
2023
2021
  }, [
2024
2022
  onChangeCb,
@@ -5600,12 +5598,10 @@ var require_webPropsToSkip_native = __commonJS({
5600
5598
  contain: 1,
5601
5599
  boxSizing: 1,
5602
5600
  touchAction: 1,
5603
- boxShadow: 1,
5604
5601
  outlineStyle: 1,
5605
5602
  outlineOffset: 1,
5606
5603
  outlineWidth: 1,
5607
5604
  outlineColor: 1,
5608
- filter: 1,
5609
5605
  backdropFilter: 1,
5610
5606
  backgroundImage: 1,
5611
5607
  mixBlendMode: 1,
@@ -6926,20 +6922,23 @@ var require_useThemeState_native = __commonJS({
6926
6922
  hasThemeUpdatingProps: function() {
6927
6923
  return hasThemeUpdatingProps;
6928
6924
  },
6925
+ keysToId: function() {
6926
+ return keysToId;
6927
+ },
6929
6928
  useThemeState: function() {
6930
6929
  return useThemeState;
6931
6930
  }
6932
6931
  });
6933
6932
  module2.exports = __toCommonJS2(useThemeState_exports);
6934
- var import_constants4 = require_index_native6(), import_react3 = require("react"), import_config = require_config_native(), ThemeStateContext = (0, import_react3.createContext)(""), allListeners = /* @__PURE__ */ new Map(), listenersByParent = {}, states = /* @__PURE__ */ new Map(), forceUpdateThemes2 = function() {
6935
- allListeners.forEach(function(cb) {
6933
+ var import_constants4 = require_index_native6(), import_react3 = require("react"), import_config = require_config_native(), ThemeStateContext = (0, import_react3.createContext)(""), keysToId = /* @__PURE__ */ new WeakMap(), allListeners = /* @__PURE__ */ new Map(), listenersByParent = {}, hasRenderedOnce = /* @__PURE__ */ new WeakMap(), pendingUpdate = /* @__PURE__ */ new Map(), states = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
6934
+ cacheVersion++, shouldForce = !0, allListeners.forEach(function(cb) {
6936
6935
  return cb();
6937
6936
  });
6938
6937
  }, getThemeState = function(id) {
6939
6938
  return states.get(id);
6940
- }, rootThemeState = null, getRootThemeState = function() {
6939
+ }, cache = /* @__PURE__ */ new Map(), cacheVersion = 0, themes = null, rootThemeState = null, getRootThemeState = function() {
6941
6940
  return rootThemeState;
6942
- }, HasRenderedOnce = /* @__PURE__ */ new WeakMap(), useThemeState = function(props) {
6941
+ }, useThemeState = function(props) {
6943
6942
  var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : !1, keys = arguments.length > 2 ? arguments[2] : void 0, { disable } = props, parentId = (0, import_react3.useContext)(ThemeStateContext);
6944
6943
  if (disable) return states.get(parentId) || {
6945
6944
  id: "",
@@ -6949,22 +6948,26 @@ var require_useThemeState_native = __commonJS({
6949
6948
  };
6950
6949
  var id = (0, import_react3.useId)(), subscribe = (0, import_react3.useCallback)(function(cb) {
6951
6950
  var _listenersByParent, _parentId;
6952
- return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, cb), function() {
6951
+ return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, function() {
6952
+ pendingUpdate.set(id, shouldForce ? "force" : !0), cb();
6953
+ }), function() {
6953
6954
  allListeners.delete(id), listenersByParent[parentId].delete(id);
6954
6955
  };
6955
6956
  }, [
6956
6957
  id,
6957
- parentId,
6958
- keys
6958
+ parentId
6959
6959
  ]), propsKey = getPropsKey(props), getSnapshot = function() {
6960
- return getSnapshotFrom(props, propsKey, isRoot, id, parentId, keys);
6960
+ var _keys_current, _props_needsUpdate, last = states.get(id), needsUpdate = props.name === "light" || props.name === "dark" ? !0 : hasRenderedOnce.get(keys) ? !(keys == null || (_keys_current = keys.current) === null || _keys_current === void 0) && _keys_current.size ? !0 : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props) : !0, parentState = states.get(parentId), cacheKey = `${cacheVersion}${id}${propsKey}${(parentState == null ? void 0 : parentState.name) || ""}${isRoot}`;
6961
+ if (!needsUpdate && cache.has(cacheKey)) return cache.get(cacheKey);
6962
+ var next = getSnapshotFrom(last, props, propsKey, isRoot, id, parentId, needsUpdate, pendingUpdate.get(id));
6963
+ return last !== next && (pendingUpdate.delete(id), states.set(id, next), cache.set(id, next)), next;
6961
6964
  }, state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
6962
6965
  return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
6966
+ if (!hasRenderedOnce.get(keys)) {
6967
+ hasRenderedOnce.set(keys, !0);
6968
+ return;
6969
+ }
6963
6970
  if (propsKey) {
6964
- if (!HasRenderedOnce.has(keys)) {
6965
- HasRenderedOnce.set(keys, !0);
6966
- return;
6967
- }
6968
6971
  if (0)
6969
6972
  var _states_get;
6970
6973
  scheduleUpdate(id);
@@ -6976,16 +6979,24 @@ var require_useThemeState_native = __commonJS({
6976
6979
  ...state,
6977
6980
  isNew: !0
6978
6981
  } : state;
6979
- }, themes = null, getSnapshotFrom = function(props, propsKey) {
6980
- var isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1, id = arguments.length > 3 ? arguments[3] : void 0, parentId = arguments.length > 4 ? arguments[4] : void 0, keys = arguments.length > 5 ? arguments[5] : void 0, _keys_current, _props_needsUpdate, needsUpdate = (keys == null || (_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) || ((_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props)), parentState = states.get(parentId);
6982
+ }, getSnapshotFrom = function(lastState, props, propsKey) {
6983
+ var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, id = arguments.length > 4 ? arguments[4] : void 0, parentId = arguments.length > 5 ? arguments[5] : void 0, needsUpdate = arguments.length > 6 ? arguments[6] : void 0, pendingUpdate2 = arguments.length > 7 ? arguments[7] : void 0, parentState = states.get(parentId);
6981
6984
  themes || (themes = (0, import_config.getConfig)().themes);
6982
- var lastState = states.get(id), name = propsKey ? getNewThemeName(parentState == null ? void 0 : parentState.name, props, !!needsUpdate) : null;
6985
+ var name = !propsKey && pendingUpdate2 !== "force" ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate2 === "force" ? !0 : !!needsUpdate), isSameAsParent = !!(!name && propsKey);
6983
6986
  if (0)
6984
6987
  var message;
6985
- var isSameAsParent = !name && propsKey;
6986
6988
  if (parentState && isSameAsParent) return parentState;
6987
- if (!name) return lastState && !needsUpdate ? lastState : (states.set(id, parentState), parentState);
6988
- if (lastState && lastState.name === name) return lastState;
6989
+ if (!name) {
6990
+ var next = lastState ?? parentState;
6991
+ if (needsUpdate && pendingUpdate2) {
6992
+ var updated = {
6993
+ ...parentState || lastState
6994
+ };
6995
+ return updated;
6996
+ }
6997
+ return next;
6998
+ }
6999
+ if (pendingUpdate2 !== "force" && lastState && lastState.name === name) return lastState;
6989
7000
  var scheme = getScheme(name), _parentState_inverses, parentInverses = (_parentState_inverses = parentState == null ? void 0 : parentState.inverses) !== null && _parentState_inverses !== void 0 ? _parentState_inverses : 0, isInverse = parentState && scheme !== parentState.scheme, inverses = parentInverses + (isInverse ? 1 : 0), nextState = {
6990
7001
  id,
6991
7002
  name,
@@ -6996,7 +7007,7 @@ var require_useThemeState_native = __commonJS({
6996
7007
  inverses,
6997
7008
  isInverse
6998
7009
  };
6999
- return states.set(id, nextState), isRoot && (rootThemeState = nextState), nextState;
7010
+ return isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && !needsUpdate ? (Object.assign(lastState, nextState), lastState) : nextState;
7000
7011
  };
7001
7012
  function scheduleUpdate(id) {
7002
7013
  for (var queue = [
@@ -7034,7 +7045,7 @@ var require_useThemeState_native = __commonJS({
7034
7045
  return validSchemes[name.split("_")[0]];
7035
7046
  }
7036
7047
  function getNewThemeName() {
7037
- var parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", { name, reset, componentName, inverse } = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
7048
+ var parentName = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : "", { name, reset, componentName, inverse, debug } = arguments.length > 1 ? arguments[1] : void 0, forceUpdate = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
7038
7049
  if (name && reset) throw new Error("Cannot reset and set a new name at the same time.");
7039
7050
  if (reset) {
7040
7051
  if (!parentName) throw new Error("\u203C\uFE0F");
@@ -7068,7 +7079,8 @@ var require_useThemeState_native = __commonJS({
7068
7079
  }
7069
7080
  if (found) break;
7070
7081
  }
7071
- if (found && inverse) {
7082
+ if (inverse) {
7083
+ found || (found = parentName);
7072
7084
  var scheme = found.split("_")[0];
7073
7085
  found = found.replace(new RegExp(`^${scheme}`), scheme === "light" ? "dark" : "light");
7074
7086
  }
@@ -7179,36 +7191,38 @@ var require_getThemeProxied_native = __commonJS({
7179
7191
  }
7180
7192
  });
7181
7193
  module2.exports = __toCommonJS2(getThemeProxied_exports);
7182
- var import_constants4 = require_index_native6(), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_doesRootSchemeMatchSystem = require_doesRootSchemeMatchSystem_native(), cache = /* @__PURE__ */ new Map(), curKeys, curProps, emptyObject = {};
7183
- function getThemeProxied(_props, state, _keys) {
7184
- var theme = state == null ? void 0 : state.theme;
7185
- if (!theme) return emptyObject;
7186
- if (curKeys = _keys, curProps = _props, cache.has(theme)) {
7187
- var proxied = cache.get(theme);
7194
+ var import_constants4 = require_index_native6(), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_doesRootSchemeMatchSystem = require_doesRootSchemeMatchSystem_native(), import_useThemeState = require_useThemeState_native(), cache = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
7195
+ function getThemeProxied(_props, _state, _keys) {
7196
+ if (!(_state != null && _state.theme)) return emptyObject;
7197
+ if (curKeys = _keys, curProps = _props, curState = _state, cache.has(curState.theme)) {
7198
+ var proxied = cache.get(curState.theme);
7188
7199
  return proxied;
7189
7200
  }
7190
- var { name, scheme } = state, config = (0, import_config.getConfig)();
7201
+ var config = (0, import_config.getConfig)();
7191
7202
  function track(key) {
7192
- curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key));
7203
+ if (curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key), !1))
7204
+ var _globalThis_states, realId;
7193
7205
  }
7194
- var proxied1 = Object.fromEntries(Object.entries(theme).flatMap(function(param) {
7206
+ var proxied1 = Object.fromEntries(Object.entries(_state.theme).flatMap(function(param) {
7195
7207
  var [key, value] = param, proxied2 = {
7196
7208
  ...value,
7197
7209
  get val() {
7198
7210
  return globalThis.tamaguiAvoidTracking || track(key), value.val;
7199
7211
  },
7200
7212
  get(platform2) {
7201
- var outVal = (0, import_createVariable.getVariable)(value), shouldOptimize = scheme && platform2 !== "web" && import_constants4.isIos && !curProps.deopt && (0, import_config.getSetting)("fastSchemeChange") && state.inverses === 0 && (0, import_doesRootSchemeMatchSystem.doesRootSchemeMatchSystem)();
7202
- if (shouldOptimize) {
7203
- var _config_themes_name, _config_themes_oppositeName, oppositeScheme = scheme === "dark" ? "light" : "dark", oppositeName = name.replace(scheme, oppositeScheme), color = (0, import_createVariable.getVariable)((_config_themes_name = config.themes[name]) === null || _config_themes_name === void 0 ? void 0 : _config_themes_name[key]), oppositeColor = (0, import_createVariable.getVariable)((_config_themes_oppositeName = config.themes[oppositeName]) === null || _config_themes_oppositeName === void 0 ? void 0 : _config_themes_oppositeName[key]), dynamicVal = {
7204
- dynamic: {
7205
- [scheme]: color,
7206
- [oppositeScheme]: oppositeColor
7207
- }
7208
- };
7209
- return dynamicVal;
7213
+ if (curState) {
7214
+ var outVal = (0, import_createVariable.getVariable)(value), { name, scheme, inverses } = curState, shouldOptimize = scheme && platform2 !== "web" && import_constants4.isIos && !curProps.deopt && (0, import_config.getSetting)("fastSchemeChange") && inverses === 0 && (0, import_doesRootSchemeMatchSystem.doesRootSchemeMatchSystem)();
7215
+ if (shouldOptimize) {
7216
+ var _config_themes_name, _config_themes_oppositeName, oppositeScheme = scheme === "dark" ? "light" : "dark", oppositeName = name.replace(scheme, oppositeScheme), color = (0, import_createVariable.getVariable)((_config_themes_name = config.themes[name]) === null || _config_themes_name === void 0 ? void 0 : _config_themes_name[key]), oppositeColor = (0, import_createVariable.getVariable)((_config_themes_oppositeName = config.themes[oppositeName]) === null || _config_themes_oppositeName === void 0 ? void 0 : _config_themes_oppositeName[key]), dynamicVal = {
7217
+ dynamic: {
7218
+ [scheme]: color,
7219
+ [oppositeScheme]: oppositeColor
7220
+ }
7221
+ };
7222
+ return dynamicVal;
7223
+ }
7224
+ return track(key), outVal;
7210
7225
  }
7211
- return track(key), outVal;
7212
7226
  }
7213
7227
  };
7214
7228
  return [
@@ -7222,7 +7236,7 @@ var require_getThemeProxied_native = __commonJS({
7222
7236
  ]
7223
7237
  ];
7224
7238
  }));
7225
- return cache.set(theme, proxied1), proxied1;
7239
+ return cache.set(_state.theme, proxied1), proxied1;
7226
7240
  }
7227
7241
  }
7228
7242
  });
@@ -29089,6 +29103,9 @@ var require_Tabs_native = __commonJS({
29089
29103
  ...!props.unstyled && {
29090
29104
  size: context.size
29091
29105
  },
29106
+ ...isSelected && {
29107
+ forceStyle: "focus"
29108
+ },
29092
29109
  ...groupItemProps,
29093
29110
  ...triggerProps,
29094
29111
  ref: (0, import_compose_refs.composeRefs)(forwardedRef, triggerRef),
@@ -29304,8 +29321,9 @@ var require_mutateTheme_native = __commonJS({
29304
29321
  return (0, import_start_transition.startTransition)(function() {
29305
29322
  for (var themeName in allThemesProxied) {
29306
29323
  var theme2 = allThemesProxied[themeName];
29307
- updateThemeConfig(themeName, theme2), updateThemeStates(themeName, theme2);
29324
+ updateThemeConfig(themeName, theme2);
29308
29325
  }
29326
+ updateThemeStates();
29309
29327
  }), {
29310
29328
  themes: allThemesProxied,
29311
29329
  themesRaw: allThemesRaw,
@@ -29329,14 +29347,14 @@ var require_mutateTheme_native = __commonJS({
29329
29347
  };
29330
29348
  return props.avoidUpdate || (insertCSS && (response.cssRules = insertThemeCSS({
29331
29349
  [themeName]: theme1
29332
- })), updateThemeConfig(themeName, themeProxied), updateThemeStates(themeName, themeProxied)), response;
29350
+ })), updateThemeConfig(themeName, themeProxied), updateThemeStates()), response;
29333
29351
  }
29334
29352
  }
29335
29353
  function updateThemeConfig(themeName, theme) {
29336
29354
  var config = (0, import_web.getConfig)();
29337
29355
  config.themes[themeName] = theme, (0, import_web.updateConfig)("themes", config.themes);
29338
29356
  }
29339
- function updateThemeStates(themeName, theme) {
29357
+ function updateThemeStates() {
29340
29358
  (0, import_web.forceUpdateThemes)();
29341
29359
  }
29342
29360
  function insertThemeCSS(themes) {