@tamagui/core 1.125.9 → 1.125.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.
@@ -5561,7 +5561,8 @@ var require_createShallowSetState_native = __commonJS({
5561
5561
  var import_react3 = require("react"), callImmediate = function(cb) {
5562
5562
  return cb();
5563
5563
  };
5564
- function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
5564
+ function createShallowSetState(setter, onlyAllow, transition, debugIn, callback) {
5565
+ var debug = !0;
5565
5566
  return (0, import_react3.useCallback)(function(next) {
5566
5567
  var wrap = transition ? import_react3.startTransition : callImmediate;
5567
5568
  wrap(function() {
@@ -5574,7 +5575,8 @@ var require_createShallowSetState_native = __commonJS({
5574
5575
  setter,
5575
5576
  onlyAllow ? onlyAllow.join("") : "",
5576
5577
  transition,
5577
- debug
5578
+ debug,
5579
+ callback
5578
5580
  ]);
5579
5581
  }
5580
5582
  function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
@@ -5720,15 +5722,12 @@ var require_useThemeState_native = __commonJS({
5720
5722
  hasThemeUpdatingProps: function() {
5721
5723
  return hasThemeUpdatingProps;
5722
5724
  },
5723
- keysToId: function() {
5724
- return keysToId;
5725
- },
5726
5725
  useThemeState: function() {
5727
5726
  return useThemeState;
5728
5727
  }
5729
5728
  });
5730
5729
  module2.exports = __toCommonJS2(useThemeState_exports);
5731
- var import_constants2 = require_index_native2(), 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(), localStates = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
5730
+ var import_constants2 = require_index_native2(), import_react3 = require("react"), import_config = require_config_native(), ThemeStateContext = (0, import_react3.createContext)(""), allListeners = /* @__PURE__ */ new Map(), listenersByParent = {}, HasRenderedOnce = /* @__PURE__ */ new WeakMap(), HadTheme = /* @__PURE__ */ new WeakMap(), PendingUpdate = /* @__PURE__ */ new Map(), states = /* @__PURE__ */ new Map(), localStates = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
5732
5731
  cacheVersion++, shouldForce = !0, allListeners.forEach(function(cb) {
5733
5732
  return cb();
5734
5733
  });
@@ -5748,37 +5747,39 @@ var require_useThemeState_native = __commonJS({
5748
5747
  var id = (0, import_react3.useId)(), subscribe = (0, import_react3.useCallback)(function(cb) {
5749
5748
  var _listenersByParent, _parentId;
5750
5749
  return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, function() {
5751
- pendingUpdate.set(id, shouldForce ? "force" : !0), cb();
5750
+ PendingUpdate.set(id, shouldForce ? "force" : !0), cb();
5752
5751
  }), function() {
5753
- allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), pendingUpdate.delete(id);
5752
+ allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), PendingUpdate.delete(id);
5754
5753
  };
5755
5754
  }, [
5756
5755
  id,
5757
5756
  parentId
5758
5757
  ]), propsKey = getPropsKey(props), getSnapshot = function() {
5759
- var _keys_current, _props_needsUpdate, local = localStates.get(id), needsUpdate = isRoot || props.name === "light" || props.name === "dark" || props.name === null ? !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, [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, pendingUpdate.get(id));
5760
- return pendingUpdate.delete(id), (!local || rerender) && (local = {
5758
+ var _keys_current, _props_needsUpdate, local = localStates.get(id), needsUpdate = isRoot || props.name === "light" || props.name === "dark" || props.name === null ? !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, [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
5759
+ return PendingUpdate.delete(id), (!local || rerender) && (local = {
5761
5760
  ...next
5762
5761
  }, localStates.set(id, local)), Object.assign(local, next), local.id = id, states.set(id, next), local;
5763
5762
  }, state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
5764
5763
  return (0, import_constants2.useIsomorphicLayoutEffect)(function() {
5765
- if (!hasRenderedOnce.get(keys)) {
5766
- hasRenderedOnce.set(keys, !0);
5764
+ if (!HasRenderedOnce.get(keys)) {
5765
+ HasRenderedOnce.set(keys, !0);
5767
5766
  return;
5768
5767
  }
5769
- if (propsKey) {
5770
- if (0)
5771
- var _states_get;
5772
- scheduleUpdate(id);
5768
+ if (!propsKey) {
5769
+ HadTheme.get(keys) && scheduleUpdate(id), HadTheme.set(keys, !1);
5770
+ return;
5773
5771
  }
5772
+ if (0)
5773
+ var _states_get;
5774
+ scheduleUpdate(id), HadTheme.set(keys, !0);
5774
5775
  }, [
5775
5776
  keys,
5776
5777
  propsKey
5777
5778
  ]), state;
5778
5779
  }, getNextState = function(lastState, props, propsKey) {
5779
- 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, { debug } = props, parentState = states.get(parentId);
5780
+ 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, pendingUpdate = arguments.length > 7 ? arguments[7] : void 0, { debug } = props, parentState = states.get(parentId);
5780
5781
  themes || (themes = (0, import_config.getConfig)().themes);
5781
- var name = !propsKey && (!lastState || !(lastState != null && lastState.isNew)) ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate2 === "force" ? !0 : !!needsUpdate), isSameAsParent = parentState && (!name || name === parentState.name), shouldRerender = !!(needsUpdate && (pendingUpdate2 || (lastState == null ? void 0 : lastState.name) !== (parentState == null ? void 0 : parentState.name)));
5782
+ var name = !propsKey && (!lastState || !(lastState != null && lastState.isNew)) ? null : getNewThemeName(parentState == null ? void 0 : parentState.name, props, pendingUpdate === "force" ? !0 : !!needsUpdate), isSameAsParent = parentState && (!name || name === parentState.name), shouldRerender = !!(needsUpdate && (pendingUpdate || (lastState == null ? void 0 : lastState.name) !== (parentState == null ? void 0 : parentState.name)));
5782
5783
  if (0)
5783
5784
  var message;
5784
5785
  if (isSameAsParent) return [
@@ -5816,11 +5817,11 @@ var require_useThemeState_native = __commonJS({
5816
5817
  isInverse,
5817
5818
  isNew: !0
5818
5819
  };
5819
- if (isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && lastState.name === name) return [
5820
+ if (isRoot && (rootThemeState = nextState), pendingUpdate !== "force" && lastState && lastState.name === name) return [
5820
5821
  !1,
5821
5822
  nextState
5822
5823
  ];
5823
- var shouldAvoidRerender = pendingUpdate2 !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
5824
+ var shouldAvoidRerender = pendingUpdate !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
5824
5825
  return shouldAvoidRerender ? [
5825
5826
  !1,
5826
5827
  nextState
@@ -6011,7 +6012,7 @@ var require_getThemeProxied_native = __commonJS({
6011
6012
  }
6012
6013
  });
6013
6014
  module2.exports = __toCommonJS2(getThemeProxied_exports);
6014
- var import_constants2 = require_index_native2(), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_doesRootSchemeMatchSystem = require_doesRootSchemeMatchSystem_native(), import_useThemeState = require_useThemeState_native(), cache2 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
6015
+ var import_constants2 = require_index_native2(), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_doesRootSchemeMatchSystem = require_doesRootSchemeMatchSystem_native(), cache2 = /* @__PURE__ */ new Map(), curKeys, curProps, curState, emptyObject = {};
6015
6016
  function getThemeProxied(_props, _state, _keys) {
6016
6017
  if (!(_state != null && _state.theme)) return emptyObject;
6017
6018
  if (curKeys = _keys, curProps = _props, curState = _state, cache2.has(curState.theme)) {
@@ -6020,8 +6021,7 @@ var require_getThemeProxied_native = __commonJS({
6020
6021
  }
6021
6022
  var config = (0, import_config.getConfig)();
6022
6023
  function track(key) {
6023
- if (curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key), !1))
6024
- var _globalThis_states, realId;
6024
+ curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key));
6025
6025
  }
6026
6026
  var proxied1 = Object.fromEntries(Object.entries(_state.theme).flatMap(function(param) {
6027
6027
  var [key, value] = param, proxied2 = {
@@ -6584,10 +6584,8 @@ var require_useComponentState_native = __commonJS({
6584
6584
  import_constants2.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated && (isAnimated = !1, curStateRef.willHydrate = !0), disabled !== state.disabled && (state.disabled = disabled, disabled && Object.assign(state, import_defaultComponentState.defaultComponentStateMounted), setState({
6585
6585
  ...state
6586
6586
  }));
6587
- var groupName = props.group, setStateWrapper;
6588
- if (groupName) {
6589
- var groupContextState = groups.state;
6590
- setStateWrapper = function(state2) {
6587
+ var groupName = props.group, groupContextState = groups == null ? void 0 : groups.state, setStateWrapper = (0, import_react3.useMemo)(function() {
6588
+ if (groupContextState && groupName) return function(state2) {
6591
6589
  curStateRef.group.emit(groupName, {
6592
6590
  pseudo: state2
6593
6591
  });
@@ -6597,8 +6595,11 @@ var require_useComponentState_native = __commonJS({
6597
6595
  };
6598
6596
  groupContextState[groupName] = next;
6599
6597
  };
6600
- }
6601
- var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
6598
+ }, [
6599
+ groupContextState,
6600
+ curStateRef,
6601
+ groupName
6602
+ ]), setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
6602
6603
  "disabled"
6603
6604
  ] : void 0, !1, props.debug, setStateWrapper);
6604
6605
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
@@ -8049,6 +8050,7 @@ var require_createTamagui_native = __commonJS({
8049
8050
  var import_constants2 = require_index_native2(), import_config = require_config_native(), import_createVariables = require_createVariables_native(), import_getThemeCSSRules = require_getThemeCSSRules_native(), import_insertStyleRule = require_insertStyleRule_native(), import_proxyThemeToParents = require_proxyThemeToParents_native(), import_registerCSSVariable = require_registerCSSVariable_native(), import_themes = require_themes_native(), import_useMedia = require_useMedia_native(), import_insertFont = require_insertFont_native(), import_Tamagui = require_Tamagui_native(), createdConfigs = /* @__PURE__ */ new WeakMap();
8050
8051
  function createTamagui2(configIn) {
8051
8052
  var _configIn_settings;
8053
+ if (globalThis.__tamaguiConfig) return console.warn("Warning: You somehow have duplicate Tamagui dependencies, this can cause issues. Tamagui is working around this by loading a previously loaded config in test mode. "), globalThis.__tamaguiConfig;
8052
8054
  if (createdConfigs.has(configIn)) return configIn;
8053
8055
  var tokensParsed = {}, tokens = (0, import_createVariables.createVariables)(configIn.tokens || {});
8054
8056
  if (configIn.tokens) {
@@ -8194,7 +8196,7 @@ var require_createTamagui_native = __commonJS({
8194
8196
  specificTokens,
8195
8197
  defaultFontToken
8196
8198
  };
8197
- if ((0, import_config.setConfig)(config), (0, import_useMedia.configureMedia)(config), createdConfigs.set(config, !0), import_config.configListeners.size && (import_config.configListeners.forEach(function(cb) {
8199
+ if ((0, import_config.setConfig)(config), (0, import_useMedia.configureMedia)(config), createdConfigs.set(config, !0), globalThis.__tamaguiConfig = config, import_config.configListeners.size && (import_config.configListeners.forEach(function(cb) {
8198
8200
  return cb(config);
8199
8201
  }), import_config.configListeners.clear()), !1)
8200
8202
  var _process_env_DEBUG;