tamagui 1.124.8 → 1.124.10

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.
@@ -2010,14 +2010,12 @@ var require_useControllableState_native = __commonJS({
2010
2010
  var import_use_event = require_index_native8(), React4 = __toESM2(require("react")), import_start_transition = require_index_native9(), emptyCallbackFn = function(_) {
2011
2011
  return _();
2012
2012
  };
2013
- function useControllableState(props) {
2014
- var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = props, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
2013
+ function useControllableState(param) {
2014
+ var { prop, defaultProp, onChange, strategy = "prop-wins", preventUpdate, transition } = param, [state, setState] = React4.useState(prop ?? defaultProp), previous = React4.useRef(state), propWins = strategy === "prop-wins" && prop !== void 0, value = propWins ? prop : state, onChangeCb = (0, import_use_event.useEvent)(onChange || idFn), transitionFn = transition ? import_start_transition.startTransition : emptyCallbackFn;
2015
2015
  React4.useEffect(function() {
2016
- "prop" in props && prop !== state && transitionFn(function() {
2017
- setState(function(prev) {
2018
- if (prev !== prop) return previous.current = prop, prop;
2019
- });
2020
- });
2016
+ prop !== void 0 && (previous.current = prop, transitionFn(function() {
2017
+ setState(prop);
2018
+ }));
2021
2019
  }, [
2022
2020
  prop
2023
2021
  ]), React4.useEffect(function() {
@@ -6772,24 +6770,29 @@ var require_createShallowSetState_native = __commonJS({
6772
6770
  var import_react3 = require("react"), callImmediate = function(cb) {
6773
6771
  return cb();
6774
6772
  };
6775
- function createShallowSetState(setter, isDisabled, transition, debug, callback) {
6773
+ function createShallowSetState(setter, onlyAllow, transition, debug, callback) {
6776
6774
  return (0, import_react3.useCallback)(function(next) {
6777
6775
  var wrap = transition ? import_react3.startTransition : callImmediate;
6778
6776
  wrap(function() {
6779
6777
  setter(function(prev) {
6780
- var out = mergeIfNotShallowEqual(prev, next, isDisabled, debug);
6778
+ var out = mergeIfNotShallowEqual(prev, next, onlyAllow, debug);
6781
6779
  return callback == null || callback(out), out;
6782
6780
  });
6783
6781
  });
6784
6782
  }, [
6785
6783
  setter,
6786
- isDisabled,
6784
+ onlyAllow ? onlyAllow.join("") : "",
6787
6785
  transition,
6788
6786
  debug
6789
6787
  ]);
6790
6788
  }
6791
- function mergeIfNotShallowEqual(prev, next, isDisabled, debug) {
6792
- return isDisabled || !prev || !next || isEqualShallow(prev, next) ? prev || next : {
6789
+ function mergeIfNotShallowEqual(prev, next, onlyAllow, debug) {
6790
+ if (onlyAllow) {
6791
+ var allowed = {};
6792
+ for (var key in next) onlyAllow.includes(key) && (allowed[key] = next[key]);
6793
+ next = allowed;
6794
+ }
6795
+ return !prev || !next || isEqualShallow(prev, next) ? prev || next : {
6793
6796
  ...prev,
6794
6797
  ...next
6795
6798
  };
@@ -7716,7 +7719,9 @@ var require_useComponentState_native = __commonJS({
7716
7719
  groupContextState[groupName] = next;
7717
7720
  };
7718
7721
  }
7719
- var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled, !1, props.debug, setStateWrapper);
7722
+ var setStateShallow = (0, import_createShallowSetState.createShallowSetState)(setState, disabled ? [
7723
+ "disabled"
7724
+ ] : void 0, !1, props.debug, setStateWrapper);
7720
7725
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
7721
7726
  var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
7722
7727
  (0, import_isObj.isObj)(custom) && Object.assign(props, custom);
@@ -10281,7 +10286,7 @@ var require_useProps_native = __commonJS({
10281
10286
  resolveValues: "auto",
10282
10287
  ...opts
10283
10288
  }, null, componentContext), { mediaGroups, pseudoGroups } = splitStyles;
10284
- return import_react3.default.useEffect(function() {
10289
+ return import_react3.default.useLayoutEffect(function() {
10285
10290
  if (!disabled) {
10286
10291
  if (state.unmounted) {
10287
10292
  setStateShallow({
@@ -15344,7 +15349,7 @@ var require_constants_native3 = __commonJS({
15344
15349
  }
15345
15350
  });
15346
15351
  module2.exports = __toCommonJS2(constants_exports);
15347
- var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = !import_constants4.isAndroid && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
15352
+ var import_constants4 = require_index_native6(), _global__IS_FABRIC, IS_FABRIC = typeof global < "u" && !!((_global__IS_FABRIC = global._IS_FABRIC) !== null && _global__IS_FABRIC !== void 0 ? _global__IS_FABRIC : global.nativeFabricUIManager), USE_NATIVE_PORTAL = process.env.TAMAGUI_USE_NATIVE_PORTAL && process.env.TAMAGUI_USE_NATIVE_PORTAL !== "false" ? !0 : !import_constants4.isAndroid && !IS_FABRIC, allPortalHosts = /* @__PURE__ */ new Map(), portalListeners = {};
15348
15353
  }
15349
15354
  });
15350
15355