tamagui 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.
package/dist/native.js CHANGED
@@ -7028,7 +7028,8 @@ var require_createShallowSetState_native = __commonJS({
7028
7028
  var import_react3 = require("react"), callImmediate = function(cb) {
7029
7029
  return cb();
7030
7030
  };
7031
- function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
7031
+ function createShallowSetState(setter, onlyAllow, transition, debugIn, callback) {
7032
+ var debug = !0;
7032
7033
  return (0, import_react3.useCallback)(function(next) {
7033
7034
  var wrap = transition ? import_react3.startTransition : callImmediate;
7034
7035
  wrap(function() {
@@ -7041,7 +7042,8 @@ var require_createShallowSetState_native = __commonJS({
7041
7042
  setter,
7042
7043
  onlyAllow ? onlyAllow.join("") : "",
7043
7044
  transition,
7044
- debug
7045
+ debug,
7046
+ callback
7045
7047
  ]);
7046
7048
  }
7047
7049
  function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
@@ -7192,32 +7194,12 @@ var require_useThemeState_native = __commonJS({
7192
7194
  hasThemeUpdatingProps: function() {
7193
7195
  return hasThemeUpdatingProps;
7194
7196
  },
7195
- keysToId: function() {
7196
- return keysToId;
7197
- },
7198
7197
  useThemeState: function() {
7199
7198
  return useThemeState;
7200
7199
  }
7201
7200
  });
7202
7201
  module2.exports = __toCommonJS2(useThemeState_exports);
7203
- 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(), localStates = /* @__PURE__ */ new Map();
7204
- process.env.NODE_ENV === "development" && (globalThis.getTamaguiThemes = function() {
7205
- function buildTree(id) {
7206
- var node = states.get(id);
7207
- if (!node) return null;
7208
- var children = Array.from(states.values()).filter(function(child) {
7209
- return (child == null ? void 0 : child.parentId) === id;
7210
- }).map(function(child) {
7211
- return buildTree(child.id);
7212
- }).filter(Boolean);
7213
- return {
7214
- ...node,
7215
- children
7216
- };
7217
- }
7218
- rootThemeState && console.info(buildTree(rootThemeState.id));
7219
- });
7220
- var shouldForce = !1, forceUpdateThemes2 = function() {
7202
+ 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 = {}, HasRenderedOnce = /* @__PURE__ */ new WeakMap(), HadTheme = /* @__PURE__ */ new WeakMap(), PendingUpdate = /* @__PURE__ */ new Map(), states = /* @__PURE__ */ new Map(), localStates = /* @__PURE__ */ new Map(), shouldForce = !1, forceUpdateThemes2 = function() {
7221
7203
  cacheVersion++, shouldForce = !0, allListeners.forEach(function(cb) {
7222
7204
  return cb();
7223
7205
  });
@@ -7237,16 +7219,16 @@ var require_useThemeState_native = __commonJS({
7237
7219
  var id = (0, import_react3.useId)(), subscribe = (0, import_react3.useCallback)(function(cb) {
7238
7220
  var _listenersByParent, _parentId;
7239
7221
  return (_listenersByParent = listenersByParent)[_parentId = parentId] || (_listenersByParent[_parentId] = /* @__PURE__ */ new Set()), listenersByParent[parentId].add(id), allListeners.set(id, function() {
7240
- pendingUpdate.set(id, shouldForce ? "force" : !0), cb();
7222
+ PendingUpdate.set(id, shouldForce ? "force" : !0), cb();
7241
7223
  }), function() {
7242
- allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), pendingUpdate.delete(id);
7224
+ allListeners.delete(id), listenersByParent[parentId].delete(id), localStates.delete(id), states.delete(id), PendingUpdate.delete(id);
7243
7225
  };
7244
7226
  }, [
7245
7227
  id,
7246
7228
  parentId
7247
7229
  ]), propsKey = getPropsKey(props), getSnapshot = function() {
7248
- 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));
7249
- return pendingUpdate.delete(id), (!local || rerender) && (local = {
7230
+ 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));
7231
+ return PendingUpdate.delete(id), (!local || rerender) && (local = {
7250
7232
  ...next
7251
7233
  }, localStates.set(id, local)), process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile" && (console.groupCollapsed(` ${id} \u{1FA84} ${rerender}`, local.name, ">", next.name), console.info({
7252
7234
  props,
@@ -7261,25 +7243,27 @@ var require_useThemeState_native = __commonJS({
7261
7243
  process.env.NODE_ENV === "development" && globalThis.time && globalThis.time`theme-prep-uses`;
7262
7244
  var state = (0, import_react3.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
7263
7245
  return (0, import_constants4.useIsomorphicLayoutEffect)(function() {
7264
- if (!hasRenderedOnce.get(keys)) {
7265
- hasRenderedOnce.set(keys, !0);
7246
+ if (!HasRenderedOnce.get(keys)) {
7247
+ HasRenderedOnce.set(keys, !0);
7266
7248
  return;
7267
7249
  }
7268
- if (propsKey) {
7269
- if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
7270
- var _states_get;
7271
- console.warn(` \xB7 useTheme(${id}) scheduleUpdate`, propsKey, (_states_get = states.get(id)) === null || _states_get === void 0 ? void 0 : _states_get.name);
7272
- }
7273
- scheduleUpdate(id);
7250
+ if (!propsKey) {
7251
+ HadTheme.get(keys) && scheduleUpdate(id), HadTheme.set(keys, !1);
7252
+ return;
7253
+ }
7254
+ if (process.env.NODE_ENV === "development" && props.debug && props.debug !== "profile") {
7255
+ var _states_get;
7256
+ console.warn(` \xB7 useTheme(${id}) scheduleUpdate`, propsKey, (_states_get = states.get(id)) === null || _states_get === void 0 ? void 0 : _states_get.name);
7274
7257
  }
7258
+ scheduleUpdate(id), HadTheme.set(keys, !0);
7275
7259
  }, [
7276
7260
  keys,
7277
7261
  propsKey
7278
7262
  ]), state;
7279
7263
  }, getNextState = function(lastState, props, propsKey) {
7280
- 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);
7264
+ 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);
7281
7265
  themes || (themes = (0, import_config.getConfig)().themes);
7282
- 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)));
7266
+ 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)));
7283
7267
  if (process.env.NODE_ENV === "development" && debug && debug !== "profile") {
7284
7268
  var message = ` \xB7 useTheme(${id}) => ${name} needsUpdate ${needsUpdate} shouldRerender ${shouldRerender}`;
7285
7269
  console.info(message);
@@ -7319,16 +7303,16 @@ var require_useThemeState_native = __commonJS({
7319
7303
  isInverse,
7320
7304
  isNew: !0
7321
7305
  };
7322
- if (isRoot && (rootThemeState = nextState), pendingUpdate2 !== "force" && lastState && lastState.name === name) return [
7306
+ if (isRoot && (rootThemeState = nextState), pendingUpdate !== "force" && lastState && lastState.name === name) return [
7323
7307
  !1,
7324
7308
  nextState
7325
7309
  ];
7326
- var shouldAvoidRerender = pendingUpdate2 !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
7310
+ var shouldAvoidRerender = pendingUpdate !== "force" && lastState && !needsUpdate && nextState.name === lastState.name;
7327
7311
  return process.env.NODE_ENV === "development" && debug && debug !== "profile" && (console.groupCollapsed(` \xB7 useTheme(${id}) \u23ED\uFE0F ${name} shouldAvoidRerender: ${shouldAvoidRerender}`), console.info({
7328
7312
  lastState,
7329
7313
  needsUpdate,
7330
7314
  nextState,
7331
- pendingUpdate: pendingUpdate2
7315
+ pendingUpdate
7332
7316
  }), console.groupEnd()), shouldAvoidRerender ? [
7333
7317
  !1,
7334
7318
  nextState
@@ -7519,7 +7503,7 @@ var require_getThemeProxied_native = __commonJS({
7519
7503
  }
7520
7504
  });
7521
7505
  module2.exports = __toCommonJS2(getThemeProxied_exports);
7522
- 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 = {};
7506
+ 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, curState, emptyObject = {};
7523
7507
  function getThemeProxied(_props, _state, _keys) {
7524
7508
  if (!(_state != null && _state.theme)) return emptyObject;
7525
7509
  if (curKeys = _keys, curProps = _props, curState = _state, cache.has(curState.theme)) {
@@ -7528,10 +7512,7 @@ var require_getThemeProxied_native = __commonJS({
7528
7512
  }
7529
7513
  var config = (0, import_config.getConfig)();
7530
7514
  function track(key) {
7531
- if (curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key), process.env.NODE_ENV === "development" && curProps.debug)) {
7532
- var _globalThis_states, realId = import_useThemeState.keysToId.get(curKeys);
7533
- console.info(` \u{1F3A8} useTheme(${realId}) tracking new key: ${key}`, curKeys, (_globalThis_states = globalThis.states) === null || _globalThis_states === void 0 ? void 0 : _globalThis_states.get(realId + 1));
7534
- }
7515
+ curKeys && (curKeys.current || (curKeys.current = /* @__PURE__ */ new Set()), curKeys.current.add(key), process.env.NODE_ENV === "development" && curProps.debug && console.info(` \u{1F3A8} useTheme() tracking new key: ${key}`, curKeys));
7535
7516
  }
7536
7517
  var proxied1 = Object.fromEntries(Object.entries(_state.theme).flatMap(function(param) {
7537
7518
  var [key, value] = param, proxied2 = {
@@ -8116,10 +8097,8 @@ var require_useComponentState_native = __commonJS({
8116
8097
  import_constants4.isWeb && hasAnimationThatNeedsHydrate && !staticConfig.isHOC && !isHydrated && (isAnimated = !1, curStateRef.willHydrate = !0), disabled !== state.disabled && (state.disabled = disabled, disabled && Object.assign(state, import_defaultComponentState.defaultComponentStateMounted), setState({
8117
8098
  ...state
8118
8099
  }));
8119
- var groupName = props.group, setStateWrapper;
8120
- if (groupName) {
8121
- var groupContextState = groups.state;
8122
- setStateWrapper = function(state2) {
8100
+ var groupName = props.group, groupContextState = groups == null ? void 0 : groups.state, setStateWrapper = (0, import_react3.useMemo)(function() {
8101
+ if (groupContextState && groupName) return function(state2) {
8123
8102
  curStateRef.group.emit(groupName, {
8124
8103
  pseudo: state2
8125
8104
  });
@@ -8129,8 +8108,11 @@ var require_useComponentState_native = __commonJS({
8129
8108
  };
8130
8109
  groupContextState[groupName] = next;
8131
8110
  };
8132
- }
8133
- var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
8111
+ }, [
8112
+ groupContextState,
8113
+ curStateRef,
8114
+ groupName
8115
+ ]), setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
8134
8116
  "disabled"
8135
8117
  ] : void 0, !1, props.debug, setStateWrapper);
8136
8118
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
@@ -9740,6 +9722,7 @@ var require_createTamagui_native = __commonJS({
9740
9722
  var import_constants4 = require_index_native6(), 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();
9741
9723
  function createTamagui2(configIn) {
9742
9724
  var _configIn_settings;
9725
+ if (process.env.NODE_ENV === "test" && 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;
9743
9726
  if (createdConfigs.has(configIn)) return configIn;
9744
9727
  var tokensParsed = {}, tokens = (0, import_createVariables.createVariables)(configIn.tokens || {});
9745
9728
  if (configIn.tokens) {
@@ -9887,7 +9870,7 @@ ${JSON.stringify(variable, null, 2)}`);
9887
9870
  specificTokens,
9888
9871
  defaultFontToken
9889
9872
  };
9890
- 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) {
9873
+ if ((0, import_config.setConfig)(config), (0, import_useMedia.configureMedia)(config), createdConfigs.set(config, !0), process.env.NODE_ENV === "test" && (globalThis.__tamaguiConfig = config), import_config.configListeners.size && (import_config.configListeners.forEach(function(cb) {
9891
9874
  return cb(config);
9892
9875
  }), import_config.configListeners.clear()), process.env.NODE_ENV === "development") {
9893
9876
  var _process_env_DEBUG;
@@ -16765,7 +16748,7 @@ var require_Adapt_native = __commonJS({
16765
16748
  }
16766
16749
  });
16767
16750
  module2.exports = __toCommonJS2(Adapt_exports);
16768
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_core12 = require_index_native18(), import_helpers = require_index_native7(), import_portal2 = require_index_native28(), import_react3 = __toESM2(require("react")), CurrentAdaptContextScope = /* @__PURE__ */ (0, import_react3.createContext)(""), AdaptContext = (0, import_core12.createStyledContext)({
16751
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_z_index_stack2 = require_index_native27(), import_constants4 = require_index_native6(), import_core12 = require_index_native18(), import_helpers = require_index_native7(), import_portal2 = require_index_native28(), import_react3 = __toESM2(require("react")), CurrentAdaptContextScope = /* @__PURE__ */ (0, import_react3.createContext)(""), AdaptContext = (0, import_core12.createStyledContext)({
16769
16752
  Contents: null,
16770
16753
  scopeName: "",
16771
16754
  portalName: "",
@@ -16847,9 +16830,11 @@ var require_Adapt_native = __commonJS({
16847
16830
  typeof children == "function" && output !== void 0 && (context == null || context.setChildren(output));
16848
16831
  }, [
16849
16832
  output
16850
- ]), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CurrentAdaptContextScope.Provider, {
16851
- value: scopeName,
16852
- children: enabled ? output : null
16833
+ ]), /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_z_index_stack2.StackZIndexContext, {
16834
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(CurrentAdaptContextScope.Provider, {
16835
+ value: scopeName,
16836
+ children: enabled ? output : null
16837
+ })
16853
16838
  });
16854
16839
  }, {
16855
16840
  Contents: AdaptContents