@tamagui/core 1.125.14 → 1.125.15

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,21 +5561,19 @@ 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, debugIn, callback) {
5564
+ function createShallowSetState(setter, onlyAllow, transition, debugIn) {
5565
5565
  return (0, import_react3.useCallback)(function(next) {
5566
5566
  var wrap = transition ? import_react3.startTransition : callImmediate;
5567
5567
  wrap(function() {
5568
5568
  setter(function(prev) {
5569
- var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debugIn);
5570
- return callback == null || callback(out), out;
5569
+ return mergeIfNotShallowEqual(prev, next, onlyAllow, debugIn);
5571
5570
  });
5572
5571
  });
5573
5572
  }, [
5574
5573
  setter,
5575
5574
  onlyAllow ? onlyAllow.join("") : "",
5576
5575
  transition,
5577
- debugIn,
5578
- callback
5576
+ debugIn
5579
5577
  ]);
5580
5578
  }
5581
5579
  function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
@@ -5639,15 +5637,15 @@ var require_subscribeToContextGroup_native = __commonJS({
5639
5637
  }
5640
5638
  });
5641
5639
  module2.exports = __toCommonJS2(subscribeToContextGroup_exports);
5642
- var import_createShallowSetState = require_createShallowSetState_native(), import_useMedia = require_useMedia_native(), subscribeToContextGroup = function(param) {
5640
+ var import_useMedia = require_useMedia_native(), import_createShallowSetState = require_createShallowSetState_native(), subscribeToContextGroup = function(param) {
5643
5641
  var { setStateShallow, pseudoGroups, mediaGroups, componentContext, state } = param;
5644
5642
  if (pseudoGroups || mediaGroups) {
5645
- var _componentContext_groups_subscribe, _componentContext_groups, current = {
5646
- pseudo: {},
5647
- media: {}
5648
- };
5643
+ var _componentContext_groups_subscribe, _componentContext_groups;
5649
5644
  return (_componentContext_groups = componentContext.groups) === null || _componentContext_groups === void 0 || (_componentContext_groups_subscribe = _componentContext_groups.subscribe) === null || _componentContext_groups_subscribe === void 0 ? void 0 : _componentContext_groups_subscribe.call(_componentContext_groups, function(name, param2) {
5650
- var { layout, pseudo } = param2;
5645
+ var { layout, pseudo } = param2, _state_group, current = ((_state_group = state.group) === null || _state_group === void 0 ? void 0 : _state_group[name]) || {
5646
+ pseudo: {},
5647
+ media: {}
5648
+ };
5651
5649
  if (pseudo && pseudoGroups != null && pseudoGroups.has(String(name))) Object.assign(current.pseudo, pseudo), persist();
5652
5650
  else if (layout && mediaGroups) {
5653
5651
  var mediaState2 = (0, import_useMedia.getMediaState)(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState2);
@@ -6558,7 +6556,7 @@ var require_useComponentState_native = __commonJS({
6558
6556
  });
6559
6557
  module2.exports = __toCommonJS2(useComponentState_exports);
6560
6558
  var import_constants2 = require_index_native2(), import_use_did_finish_ssr = require_index_native6(), import_react3 = require("react"), import_defaultComponentState = require_defaultComponentState_native(), import_createShallowSetState = require_createShallowSetState_native(), import_isObj = require_isObj_native(), import_log = require_log_native(), useComponentState = function(props, param, staticConfig, config) {
6561
- var { animationDriver, groups } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
6559
+ var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
6562
6560
  stateRef.current || (stateRef.current = {});
6563
6561
  var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
6564
6562
  var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
@@ -6583,24 +6581,9 @@ var require_useComponentState_native = __commonJS({
6583
6581
  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({
6584
6582
  ...state
6585
6583
  }));
6586
- var groupName = props.group, groupContextState = groups == null ? void 0 : groups.state, setStateWrapper = (0, import_react3.useMemo)(function() {
6587
- if (groupContextState && groupName) return function(state2) {
6588
- curStateRef.group.emit(groupName, {
6589
- pseudo: state2
6590
- });
6591
- var next = {
6592
- ...groupContextState[groupName],
6593
- ...state2
6594
- };
6595
- groupContextState[groupName] = next;
6596
- };
6597
- }, [
6598
- groupContextState,
6599
- curStateRef,
6600
- groupName
6601
- ]), setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
6584
+ var groupName = props.group, setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
6602
6585
  "disabled"
6603
- ] : void 0, !1, props.debug, setStateWrapper);
6586
+ ] : void 0, !1, props.debug);
6604
6587
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
6605
6588
  var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
6606
6589
  (0, import_isObj.isObj)(custom) && Object.assign(props, custom);
@@ -7025,8 +7008,9 @@ var require_createComponent_native = __commonJS({
7025
7008
  (isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = `${state.unmounted === "should-enter" ? "t_unmounted " : ""}${viewProps.className || ""} ${animations.className}`));
7026
7009
  }
7027
7010
  groupName && (nonTamaguiProps.onLayout = (0, import_helpers2.composeEventHandlers)(nonTamaguiProps.onLayout, function(e) {
7028
- stateRef.current.group.emit(groupName, {
7029
- layout: e.nativeEvent.layout
7011
+ var layout = e.nativeEvent.layout;
7012
+ stateRef.current.group.layout = layout, stateRef.current.group.emit(groupName, {
7013
+ layout
7030
7014
  }), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(function(prev) {
7031
7015
  return {
7032
7016
  ...prev
@@ -7075,6 +7059,25 @@ var require_createComponent_native = __commonJS({
7075
7059
  mediaGroups ? Object.keys([
7076
7060
  ...mediaGroups
7077
7061
  ]).join("") : 0
7062
+ ]), (0, import_constants2.useIsomorphicLayoutEffect)(function() {
7063
+ var _curStateRef_group;
7064
+ if (groupName) {
7065
+ curStateRef.group.emit(groupName, {
7066
+ pseudo: state,
7067
+ layout: (_curStateRef_group = curStateRef.group) === null || _curStateRef_group === void 0 ? void 0 : _curStateRef_group.layout
7068
+ });
7069
+ var groupContextState = componentContext == null ? void 0 : componentContext.groups;
7070
+ if (groupContextState) {
7071
+ var next = {
7072
+ ...groupContextState[groupName],
7073
+ ...state
7074
+ };
7075
+ groupContextState[groupName] = next;
7076
+ }
7077
+ }
7078
+ }, [
7079
+ groupName,
7080
+ state
7078
7081
  ]);
7079
7082
  var runtimePressStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusVisibleStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur || componentContext.setParentFocusState), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || pseudos != null && pseudos.focusVisibleStyle), runtimeHoverStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut), attachHover = import_constants2.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(groupName || runtimePressStyle), events = shouldAttach ? {
7080
7083
  onPressOut: attachPress ? function(e) {
@@ -7184,7 +7187,7 @@ var require_createComponent_native = __commonJS({
7184
7187
  }, [
7185
7188
  groupName
7186
7189
  ]);
7187
- if ((groupName || propsIn.focusWithinStyle) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
7190
+ if (("group" in props || propsIn.focusWithinStyle) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
7188
7191
  ...componentContext,
7189
7192
  groups: subGroupContext,
7190
7193
  setParentFocusState: setStateShallow,