tamagui 1.131.0 → 1.131.2

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
@@ -3222,22 +3222,22 @@ var require_useMedia_native = __commonJS({
3222
3222
  listeners.delete(subscriber);
3223
3223
  };
3224
3224
  }
3225
- function useMedia3(cc, debug) {
3226
- var componentState = cc ? States.get(cc) : null, internalRef = (0, import_react3.useRef)(null);
3225
+ function useMedia3(componentContext, debug) {
3226
+ var componentState = componentContext ? States.get(componentContext) : null, internalRef = (0, import_react3.useRef)(null);
3227
3227
  internalRef.current || (internalRef.current = {
3228
- keys: /* @__PURE__ */ new Set()
3229
- });
3230
- var { keys, lastState = mediaState3 } = internalRef.current;
3228
+ keys: /* @__PURE__ */ new Set(),
3229
+ lastState: mediaState3
3230
+ }), internalRef.current.pendingState && (internalRef.current.lastState = internalRef.current.pendingState, internalRef.current.pendingState = void 0);
3231
+ var { keys } = internalRef.current;
3231
3232
  keys.size && keys.clear();
3232
3233
  var state = (0, import_react3.useSyncExternalStore)(subscribe, function() {
3233
- if (componentState != null && componentState.enabled) return internalRef.current.lastState = mediaState3, mediaState3;
3234
- var curKeys = (componentState == null ? void 0 : componentState.keys) || keys;
3234
+ var curKeys = (componentState == null ? void 0 : componentState.keys) || keys, { lastState, pendingState } = internalRef.current;
3235
3235
  if (!curKeys.size) return lastState;
3236
3236
  var _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
3237
3237
  try {
3238
3238
  for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
3239
3239
  var key = _step.value;
3240
- if (mediaState3[key] !== lastState[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia() \u270D\uFE0F", key, lastState[key], "=>", mediaState3[key]), internalRef.current.lastState = mediaState3, mediaState3;
3240
+ if (mediaState3[key] !== (pendingState || lastState)[key]) return process.env.NODE_ENV === "development" && debug && console.warn("useMedia() \u270D\uFE0F", key, lastState[key], "=>", mediaState3[key]), componentContext != null && componentContext.mediaEmit ? (componentContext.mediaEmit(mediaState3), internalRef.current.pendingState = mediaState3, lastState) : (internalRef.current.lastState = mediaState3, mediaState3);
3241
3241
  }
3242
3242
  } catch (err) {
3243
3243
  _didIteratorError = !0, _iteratorError = err;
@@ -7563,6 +7563,8 @@ var require_useThemeState_native = __commonJS({
7563
7563
  if (name && reset) throw new Error(process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time.");
7564
7564
  var { themes: themes2 } = (0, import_config.getConfig)();
7565
7565
  if (reset) {
7566
+ var isSchemeOnly = parentName === "light" || parentName === "dark";
7567
+ if (isSchemeOnly) return parentName === "light" ? "dark" : "light";
7566
7568
  var lastPartIndex = parentName.lastIndexOf("_"), name1 = lastPartIndex <= 0 ? parentName : parentName.slice(lastPartIndex), scheme = parentName.slice(0, lastPartIndex), result = themes2[name1] ? name1 : scheme;
7567
7569
  return result;
7568
7570
  }
@@ -8642,7 +8644,7 @@ var require_createComponent_native = __commonJS({
8642
8644
  }
8643
8645
  });
8644
8646
  module2.exports = __toCommonJS2(createComponent_exports);
8645
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native11(), import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_is_equal_shallow = require_index_native12(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_GroupContext = require_GroupContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getShorthandValue = require_getShorthandValue_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), time2, NextState = /* @__PURE__ */ new WeakMap(), debugKeyListeners, startVisualizer, componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
8647
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_compose_refs = require_index_native11(), import_constants4 = require_index_native6(), import_helpers = require_index_native7(), import_is_equal_shallow = require_index_native12(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_ComponentContext = require_ComponentContext_native(), import_GroupContext = require_GroupContext_native(), import_createVariable = require_createVariable_native(), import_defaultComponentState = require_defaultComponentState_native(), import_getShorthandValue = require_getShorthandValue_native(), import_getSplitStyles = require_getSplitStyles_native(), import_log = require_log_native(), import_mergeProps = require_mergeProps_native(), import_setElementProps = require_setElementProps_native(), import_subscribeToContextGroup = require_subscribeToContextGroup_native(), import_themeable = require_themeable_native(), import_wrapStyleTags = require_wrapStyleTags_native(), import_useComponentState = require_useComponentState_native(), import_useMedia = require_useMedia_native(), import_useTheme = require_useTheme_native(), import_setupHooks = require_setupHooks_native(), import_Slot = require_Slot_native(), import_Theme = require_Theme_native(), time2, NextState = /* @__PURE__ */ new WeakMap(), NextMedia = /* @__PURE__ */ new WeakMap(), debugKeyListeners, startVisualizer, componentSetStates = /* @__PURE__ */ new Set(), avoidReRenderKeys = /* @__PURE__ */ new Set([
8646
8648
  "hover",
8647
8649
  "press",
8648
8650
  "pressIn",
@@ -8858,6 +8860,18 @@ var require_createComponent_native = __commonJS({
8858
8860
  }
8859
8861
  if (splitStyles && (hasAnimationProp || groupName) && animationDriver != null && animationDriver.avoidReRenders) {
8860
8862
  var useStyleListener = stateRef.current.useStyleListener, ogSetStateShallow = setStateShallow;
8863
+ componentContext.mediaEmit = function(next) {
8864
+ NextMedia.set(stateRef, next), updateStyleListener();
8865
+ };
8866
+ var updateStyleListener = function() {
8867
+ var updatedState = NextState.get(stateRef) || state, mediaState22 = NextMedia.get(stateRef), { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8868
+ groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8869
+ var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, mediaState22 ? {
8870
+ ...styleProps,
8871
+ mediaState: mediaState22
8872
+ } : styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8873
+ useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8874
+ };
8861
8875
  stateRef.current.setStateShallow = function(nextOrGetNext) {
8862
8876
  var prev = NextState.get(stateRef) || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
8863
8877
  if (!(next === prev || (0, import_is_equal_shallow.isEqualShallow)(prev, next))) {
@@ -8872,11 +8886,7 @@ var require_createComponent_native = __commonJS({
8872
8886
  NextState.set(stateRef, updatedState), process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && (console.groupCollapsed("[\u26A1\uFE0F] avoid setState", next, {
8873
8887
  updatedState,
8874
8888
  props
8875
- }), console.info(stateRef.current.host), console.groupEnd());
8876
- var { group, hasDynGroupChildren, unmounted, animation, ...childrenGroupState } = updatedState;
8877
- groupContext && notifyGroupSubscribers(groupContext, stateRef.current.group || null, childrenGroupState);
8878
- var nextStyles = (0, import_getSplitStyles.getSplitStyles)(props, staticConfig, theme, themeName, updatedState, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp);
8879
- useStyleListener == null || useStyleListener((nextStyles == null ? void 0 : nextStyles.style) || {});
8889
+ }), console.info(stateRef.current.host), console.groupEnd()), updateStyleListener();
8880
8890
  } else process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile" && console.info("[\u{1F40C}] re-render", {
8881
8891
  canAvoidReRender,
8882
8892
  next
@@ -24070,7 +24080,8 @@ var require_ListItem_native = __commonJS({
24070
24080
  });
24071
24081
  }), ListItem2 = (0, import_helpers.withStaticProperties)(ListItemComponent, {
24072
24082
  Text: ListItemText,
24073
- Subtitle: ListItemSubtitle
24083
+ Subtitle: ListItemSubtitle,
24084
+ Title: ListItemTitle
24074
24085
  });
24075
24086
  }
24076
24087
  });
@@ -24644,7 +24655,7 @@ var require_Popper_native = __commonJS({
24644
24655
  });
24645
24656
  }
24646
24657
  var PopperAnchor = import_stacks3.YStack.extractable(/* @__PURE__ */ React4.forwardRef(function(props, forwardedRef) {
24647
- var { virtualRef, scope, ...anchorProps } = props, { getReferenceProps, refs, update } = usePopperContextSlow(scope), ref = React4.useRef(null);
24658
+ var { virtualRef, scope, ...anchorProps } = props, context = usePopperContextSlow(scope), { getReferenceProps, refs, update } = context, ref = React4.useRef(null);
24648
24659
  React4.useEffect(function() {
24649
24660
  virtualRef && refs.setReference(virtualRef.current);
24650
24661
  }, [
@@ -24652,6 +24663,7 @@ var require_Popper_native = __commonJS({
24652
24663
  ]);
24653
24664
  var stackProps = anchorProps, refProps = getReferenceProps ? getReferenceProps(stackProps) : null, composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, ref);
24654
24665
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
24666
+ ...stackProps,
24655
24667
  ...refProps,
24656
24668
  ref: composedRefs,
24657
24669
  // this helps us with handling scoped poppers with many different targets
@@ -24665,7 +24677,7 @@ var require_Popper_native = __commonJS({
24665
24677
  },
24666
24678
  onMouseLeave: function(e) {
24667
24679
  var _refProps_onMouseLeave;
24668
- refProps == null || (_refProps_onMouseLeave = refProps.onMouseLeave) === null || _refProps_onMouseLeave === void 0 || _refProps_onMouseLeave.call(refProps, e), refs.setReference(null);
24680
+ refProps == null || (_refProps_onMouseLeave = refProps.onMouseLeave) === null || _refProps_onMouseLeave === void 0 || _refProps_onMouseLeave.call(refProps, e);
24669
24681
  }
24670
24682
  });
24671
24683
  })), PopperContentFrame = (0, import_core12.styled)(import_stacks3.ThemeableStack, {