@tamagui/core 1.125.13 → 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.
package/dist/native.js CHANGED
@@ -5929,22 +5929,19 @@ var require_createShallowSetState_native = __commonJS({
5929
5929
  var import_react3 = require("react"), callImmediate = function(cb) {
5930
5930
  return cb();
5931
5931
  };
5932
- function createShallowSetState(setter, onlyAllow, transition, debugIn, callback) {
5933
- var debug = !0;
5932
+ function createShallowSetState(setter, onlyAllow, transition, debugIn) {
5934
5933
  return (0, import_react3.useCallback)(function(next) {
5935
5934
  var wrap = transition ? import_react3.startTransition : callImmediate;
5936
5935
  wrap(function() {
5937
5936
  setter(function(prev) {
5938
- var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debug);
5939
- return callback == null || callback(out), out;
5937
+ return mergeIfNotShallowEqual(prev, next, onlyAllow, debugIn);
5940
5938
  });
5941
5939
  });
5942
5940
  }, [
5943
5941
  setter,
5944
5942
  onlyAllow ? onlyAllow.join("") : "",
5945
5943
  transition,
5946
- debug,
5947
- callback
5944
+ debugIn
5948
5945
  ]);
5949
5946
  }
5950
5947
  function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
@@ -6013,15 +6010,15 @@ var require_subscribeToContextGroup_native = __commonJS({
6013
6010
  }
6014
6011
  });
6015
6012
  module2.exports = __toCommonJS2(subscribeToContextGroup_exports);
6016
- var import_createShallowSetState = require_createShallowSetState_native(), import_useMedia = require_useMedia_native(), subscribeToContextGroup = function(param) {
6013
+ var import_useMedia = require_useMedia_native(), import_createShallowSetState = require_createShallowSetState_native(), subscribeToContextGroup = function(param) {
6017
6014
  var { setStateShallow, pseudoGroups, mediaGroups, componentContext, state } = param;
6018
6015
  if (pseudoGroups || mediaGroups) {
6019
- var _componentContext_groups_subscribe, _componentContext_groups, current = {
6020
- pseudo: {},
6021
- media: {}
6022
- };
6016
+ var _componentContext_groups_subscribe, _componentContext_groups;
6023
6017
  return process.env.NODE_ENV === "development" && !componentContext.groups && console.debug("No context group found"), (_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) {
6024
- var { layout, pseudo } = param2;
6018
+ var { layout, pseudo } = param2, _state_group, current = ((_state_group = state.group) === null || _state_group === void 0 ? void 0 : _state_group[name]) || {
6019
+ pseudo: {},
6020
+ media: {}
6021
+ };
6025
6022
  if (pseudo && pseudoGroups != null && pseudoGroups.has(String(name))) Object.assign(current.pseudo, pseudo), persist();
6026
6023
  else if (layout && mediaGroups) {
6027
6024
  var mediaState2 = (0, import_useMedia.getMediaState)(mediaGroups, layout), next = (0, import_createShallowSetState.mergeIfNotShallowEqual)(current.media, mediaState2);
@@ -6973,7 +6970,7 @@ var require_useComponentState_native = __commonJS({
6973
6970
  });
6974
6971
  module2.exports = __toCommonJS2(useComponentState_exports);
6975
6972
  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) {
6976
- 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);
6973
+ 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);
6977
6974
  stateRef.current || (stateRef.current = {});
6978
6975
  var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current, willBeAnimatedClient = function() {
6979
6976
  var next = !!(hasAnimationProp && !staticConfig.isHOC && useAnimations);
@@ -6998,24 +6995,9 @@ var require_useComponentState_native = __commonJS({
6998
6995
  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({
6999
6996
  ...state
7000
6997
  }));
7001
- var groupName = props.group, groupContextState = groups == null ? void 0 : groups.state, setStateWrapper = (0, import_react3.useMemo)(function() {
7002
- if (groupContextState && groupName) return function(state2) {
7003
- curStateRef.group.emit(groupName, {
7004
- pseudo: state2
7005
- });
7006
- var next = {
7007
- ...groupContextState[groupName],
7008
- ...state2
7009
- };
7010
- groupContextState[groupName] = next;
7011
- };
7012
- }, [
7013
- groupContextState,
7014
- curStateRef,
7015
- groupName
7016
- ]), setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
6998
+ var groupName = props.group, setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
7017
6999
  "disabled"
7018
- ] : void 0, !1, props.debug, setStateWrapper);
7000
+ ] : void 0, !1, props.debug);
7019
7001
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
7020
7002
  process.env.NODE_ENV === "development" && props.debug === "verbose" && console.warn(`has presenceState ${JSON.stringify(presenceState)}`);
7021
7003
  var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
@@ -7526,8 +7508,9 @@ var require_createComponent_native = __commonJS({
7526
7508
  process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
7527
7509
 
7528
7510
  If you meant to do this, you can disable this warning - either change untilMeasured and group at the same time, or do group={conditional ? 'name' : undefined}`), process.env.NODE_ENV === "development" && time2 && time2`destructure`, groupName && (nonTamaguiProps.onLayout = (0, import_helpers2.composeEventHandlers)(nonTamaguiProps.onLayout, function(e) {
7529
- stateRef.current.group.emit(groupName, {
7530
- layout: e.nativeEvent.layout
7511
+ var layout = e.nativeEvent.layout;
7512
+ stateRef.current.group.layout = layout, stateRef.current.group.emit(groupName, {
7513
+ layout
7531
7514
  }), !stateRef.current.hasMeasured && props.untilMeasured === "hide" && setState(function(prev) {
7532
7515
  return {
7533
7516
  ...prev
@@ -7590,6 +7573,25 @@ If you meant to do this, you can disable this warning - either change untilMeasu
7590
7573
  mediaGroups ? Object.keys([
7591
7574
  ...mediaGroups
7592
7575
  ]).join("") : 0
7576
+ ]), (0, import_constants2.useIsomorphicLayoutEffect)(function() {
7577
+ var _curStateRef_group;
7578
+ if (groupName) {
7579
+ curStateRef.group.emit(groupName, {
7580
+ pseudo: state,
7581
+ layout: (_curStateRef_group = curStateRef.group) === null || _curStateRef_group === void 0 ? void 0 : _curStateRef_group.layout
7582
+ });
7583
+ var groupContextState = componentContext == null ? void 0 : componentContext.groups;
7584
+ if (groupContextState) {
7585
+ var next = {
7586
+ ...groupContextState[groupName],
7587
+ ...state
7588
+ };
7589
+ groupContextState[groupName] = next;
7590
+ }
7591
+ }
7592
+ }, [
7593
+ groupName,
7594
+ state
7593
7595
  ]);
7594
7596
  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);
7595
7597
  process.env.NODE_ENV === "development" && time2 && time2`events-setup`, process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)("\u{1FAA9} events()", {
@@ -7719,7 +7721,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
7719
7721
  }, [
7720
7722
  groupName
7721
7723
  ]);
7722
- if ((groupName || propsIn.focusWithinStyle) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
7724
+ if (("group" in props || propsIn.focusWithinStyle) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
7723
7725
  ...componentContext,
7724
7726
  groups: subGroupContext,
7725
7727
  setParentFocusState: setStateShallow,
@@ -8472,7 +8474,7 @@ var require_createFont_native = __commonJS({
8472
8474
  ];
8473
8475
  }));
8474
8476
  }, createFont = function(font) {
8475
- var sizeKeys = Object.keys(font.size), processedFont = Object.fromEntries(Object.entries(font).map(function(param) {
8477
+ var sizeKeys = Object.keys(font.size || {}), processedFont = Object.fromEntries(Object.entries(font).map(function(param) {
8476
8478
  var [key, section] = param;
8477
8479
  return [
8478
8480
  key,