@tamagui/core 2.3.3 → 2.4.0-1783110557100

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.cjs CHANGED
@@ -891,15 +891,35 @@ function startGlobalObservers() {
891
891
  function rectsEqual(a, b) {
892
892
  return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
893
893
  }
894
- function registerLayoutNode(node, onChange, disableKey) {
894
+ function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
895
+ var onLayout = LayoutHandlers.get(node);
896
+ if (typeof onLayout !== "function") return;
897
+ var cachedRect = NodeRectCache.get(node);
898
+ var cachedParentRect = NodeRectCache.get(parentNode);
899
+ var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
900
+ var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
901
+ if (!nodeChanged && !parentChanged) return;
902
+ NodeRectCache.set(node, nodeRect);
903
+ NodeRectCache.set(parentNode, parentRect);
904
+ var event = getElementLayoutEvent(nodeRect, parentRect, node);
905
+ if (avoidUpdates) queuedUpdates.set(node, function() {
906
+ return onLayout(event);
907
+ });
908
+ else onLayout(event);
909
+ }
910
+ function observeLayoutNode(node, disableKey) {
895
911
  Nodes.add(node);
896
- LayoutHandlers.set(node, onChange);
897
912
  if (disableKey) LayoutDisableKey.set(node, disableKey);
913
+ else LayoutDisableKey.delete(node);
898
914
  startGlobalObservers();
899
915
  if (globalIntersectionObserver) {
900
916
  globalIntersectionObserver.observe(node);
901
917
  IntersectionState.set(node, true);
902
918
  }
919
+ }
920
+ function registerLayoutNode(node, onChange, disableKey) {
921
+ LayoutHandlers.set(node, onChange);
922
+ observeLayoutNode(node, disableKey);
903
923
  return function() {
904
924
  return cleanupNode(node);
905
925
  };
@@ -912,6 +932,17 @@ function cleanupNode(node) {
912
932
  IntersectionState.delete(node);
913
933
  if (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);
914
934
  }
935
+ function emitLayoutSync(node) {
936
+ var onLayout = LayoutHandlers.get(node);
937
+ if (typeof onLayout !== "function") return;
938
+ var parentNode = node.parentElement;
939
+ if (!parentNode) return;
940
+ var nodeRect = node.getBoundingClientRect();
941
+ var parentRect = parentNode.getBoundingClientRect();
942
+ NodeRectCache.set(node, nodeRect);
943
+ NodeRectCache.set(parentNode, parentRect);
944
+ onLayout(getElementLayoutEvent(nodeRect, parentRect, node));
945
+ }
915
946
  function useElementLayout$1(ref, onLayout) {
916
947
  var _ref_current;
917
948
  var disableKey = (0, react.useContext)(DisableLayoutContextKey);
@@ -929,35 +960,17 @@ function useElementLayout$1(ref, onLayout) {
929
960
  if (prevNode) cleanupNode(prevNode);
930
961
  PrevHostNode.set(ref, nextNode);
931
962
  if (!nextNode) return;
932
- Nodes.add(nextNode);
933
- startGlobalObservers();
934
- if (globalIntersectionObserver) {
935
- globalIntersectionObserver.observe(nextNode);
936
- IntersectionState.set(nextNode, true);
937
- }
938
- var handler = LayoutHandlers.get(nextNode);
939
- if (typeof handler !== "function") return;
940
- var parentNode = nextNode.parentElement;
941
- if (!parentNode) return;
942
- var nodeRect = nextNode.getBoundingClientRect();
943
- var parentRect = parentNode.getBoundingClientRect();
944
- NodeRectCache.set(nextNode, nodeRect);
945
- NodeRectCache.set(parentNode, parentRect);
946
- handler(getElementLayoutEvent(nodeRect, parentRect, nextNode));
963
+ LayoutHandlers.set(nextNode, onLayout);
964
+ observeLayoutNode(nextNode, disableKey);
965
+ emitLayoutSync(nextNode);
947
966
  });
948
967
  useIsomorphicLayoutEffect(function() {
949
968
  var _ref_current2;
950
969
  if (!onLayout) return;
951
970
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
952
971
  if (!node2) return;
953
- Nodes.add(node2);
954
- startGlobalObservers();
955
- if (globalIntersectionObserver) {
956
- globalIntersectionObserver.observe(node2);
957
- IntersectionState.set(node2, true);
958
- }
959
- var parentNode = node2.parentNode;
960
- if (parentNode) onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect(), node2));
972
+ LayoutHandlers.set(node2, onLayout);
973
+ observeLayoutNode(node2, disableKey);
961
974
  return function() {
962
975
  cleanupNode(node2);
963
976
  var swappedNode = PrevHostNode.get(ref);
@@ -1033,8 +1046,7 @@ var init_index_native$11 = __esmMin((() => {
1033
1046
  }
1034
1047
  function _updateLayoutIfChanged() {
1035
1048
  _updateLayoutIfChanged = _asyncToGenerator(function* (node) {
1036
- var onLayout = LayoutHandlers.get(node);
1037
- if (typeof onLayout !== "function") return;
1049
+ if (typeof LayoutHandlers.get(node) !== "function") return;
1038
1050
  var parentNode = node.parentElement;
1039
1051
  if (!parentNode) return;
1040
1052
  var nodeRect;
@@ -1047,19 +1059,7 @@ var init_index_native$11 = __esmMin((() => {
1047
1059
  nodeRect = node.getBoundingClientRect();
1048
1060
  parentRect = parentNode.getBoundingClientRect();
1049
1061
  }
1050
- var cachedRect = NodeRectCache.get(node);
1051
- var cachedParentRect = NodeRectCache.get(parentNode);
1052
- var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
1053
- var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
1054
- if (nodeChanged || parentChanged) {
1055
- NodeRectCache.set(node, nodeRect);
1056
- NodeRectCache.set(parentNode, parentRect);
1057
- var event = getElementLayoutEvent(nodeRect, parentRect, node);
1058
- if (avoidUpdates) queuedUpdates.set(node, function() {
1059
- return onLayout(event);
1060
- });
1061
- else onLayout(event);
1062
- }
1062
+ emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
1063
1063
  });
1064
1064
  return _updateLayoutIfChanged.apply(this, arguments);
1065
1065
  }
@@ -12144,6 +12144,43 @@ function updateMediaListeners() {
12144
12144
  return cb(getMedia());
12145
12145
  });
12146
12146
  }
12147
+ function buildTouchTrackerProto() {
12148
+ var proto = {};
12149
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
12150
+ try {
12151
+ var _loop = function() {
12152
+ var fullKey = _step.value;
12153
+ var key = fullKey[0] === "$" ? fullKey.slice(1) : fullKey;
12154
+ proto[key] = {
12155
+ enumerable: true,
12156
+ configurable: true,
12157
+ get() {
12158
+ var slot = this[refSlot];
12159
+ if (!disableMediaTouch) slot.keys.add(key);
12160
+ return slot.proxyTarget[key];
12161
+ }
12162
+ };
12163
+ };
12164
+ for (var _iterator = mediaKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) _loop();
12165
+ } catch (err) {
12166
+ _didIteratorError = true;
12167
+ _iteratorError = err;
12168
+ } finally {
12169
+ try {
12170
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
12171
+ } finally {
12172
+ if (_didIteratorError) throw _iteratorError;
12173
+ }
12174
+ }
12175
+ return Object.create(null, proto);
12176
+ }
12177
+ function getTouchTrackerProto() {
12178
+ if (!touchTrackerProto) touchTrackerProto = buildTouchTrackerProto();
12179
+ return touchTrackerProto;
12180
+ }
12181
+ function resetMediaTouchTracker() {
12182
+ touchTrackerProto = null;
12183
+ }
12147
12184
  function setMediaShouldUpdate(ref, enabled, keys) {
12148
12185
  var cur = States.get(ref);
12149
12186
  if (!cur || cur.enabled !== enabled || keys) States.set(ref, _objectSpread2(_objectSpread2({}, cur), {}, {
@@ -12159,53 +12196,99 @@ function subscribe(subscriber) {
12159
12196
  }
12160
12197
  function useMedia(componentContext, debug) {
12161
12198
  "use no memo";
12162
- var componentState = componentContext ? States.get(componentContext) : null;
12163
12199
  var internalRef = (0, react.useRef)(null);
12164
- if (!internalRef.current) internalRef.current = {
12165
- keys: /* @__PURE__ */ new Set(),
12166
- lastState: getMedia()
12167
- };
12168
- if (internalRef.current.pendingState) {
12169
- internalRef.current.lastState = internalRef.current.pendingState;
12170
- internalRef.current.pendingState = void 0;
12171
- }
12172
- var { keys } = internalRef.current;
12173
- if (keys.size) keys.clear();
12174
- var state = (0, react.useSyncExternalStore)(subscribe, function() {
12175
- var curKeys = (componentState === null || componentState === void 0 ? void 0 : componentState.keys) || keys;
12176
- var { lastState, pendingState } = internalRef.current;
12177
- if (!curKeys.size) return lastState;
12178
- var ms = getMedia();
12179
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
12180
- try {
12181
- for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12182
- var key = _step.value;
12183
- if (ms[key] !== (pendingState || lastState)[key]) {
12184
- if (componentContext === null || componentContext === void 0 ? void 0 : componentContext.mediaEmit) {
12185
- componentContext.mediaEmit(ms);
12186
- internalRef.current.pendingState = ms;
12187
- return lastState;
12200
+ if (!internalRef.current) {
12201
+ var initial = getMedia();
12202
+ var r = {
12203
+ keys: /* @__PURE__ */ new Set(),
12204
+ lastState: initial,
12205
+ renderVersion: 0,
12206
+ proxyTarget: initial,
12207
+ proxy: void 0,
12208
+ getSnapshot: void 0,
12209
+ componentContext,
12210
+ debug
12211
+ };
12212
+ var tracker = Object.create(getTouchTrackerProto());
12213
+ tracker[refSlot] = {
12214
+ proxyTarget: initial,
12215
+ keys: r.keys
12216
+ };
12217
+ r.proxy = tracker;
12218
+ r.getSnapshot = function() {
12219
+ var _States_get;
12220
+ var curKeys = r.componentContext ? ((_States_get = States.get(r.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.keys) || r.keys : r.keys;
12221
+ var { lastState, pendingState } = r;
12222
+ if (!curKeys.size) return lastState;
12223
+ var ms = getMedia();
12224
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
12225
+ try {
12226
+ for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
12227
+ var key = _step.value;
12228
+ if (ms[key] !== (pendingState || lastState)[key]) {
12229
+ var _r_componentContext;
12230
+ if ((_r_componentContext = r.componentContext) === null || _r_componentContext === void 0 ? void 0 : _r_componentContext.mediaEmit) {
12231
+ r.componentContext.mediaEmit(ms);
12232
+ r.pendingState = ms;
12233
+ return lastState;
12234
+ }
12235
+ r.lastState = ms;
12236
+ return ms;
12188
12237
  }
12189
- internalRef.current.lastState = ms;
12190
- return ms;
12191
12238
  }
12192
- }
12193
- } catch (err) {
12194
- _didIteratorError = true;
12195
- _iteratorError = err;
12196
- } finally {
12197
- try {
12198
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
12239
+ } catch (err) {
12240
+ _didIteratorError = true;
12241
+ _iteratorError = err;
12199
12242
  } finally {
12200
- if (_didIteratorError) throw _iteratorError;
12243
+ try {
12244
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
12245
+ } finally {
12246
+ if (_didIteratorError) throw _iteratorError;
12247
+ }
12201
12248
  }
12249
+ return lastState;
12250
+ };
12251
+ internalRef.current = r;
12252
+ } else {
12253
+ internalRef.current.componentContext = componentContext;
12254
+ internalRef.current.debug = debug;
12255
+ }
12256
+ var ref = internalRef.current;
12257
+ ref.renderVersion++;
12258
+ if (ref.pendingState) {
12259
+ ref.lastState = ref.pendingState;
12260
+ ref.pendingState = void 0;
12261
+ }
12262
+ if (ref.keys.size) ref.keys.clear();
12263
+ var [, forceUpdate] = (0, react.useReducer)(incReducer$1, 0);
12264
+ var state = ref.getSnapshot();
12265
+ ref.proxyTarget = state;
12266
+ ref.proxy[refSlot].proxyTarget = state;
12267
+ (0, react.useEffect)(function() {
12268
+ var _States_get;
12269
+ var renderVersion = ref.renderVersion;
12270
+ if (!ref.componentContext || !!((_States_get = States.get(ref.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.enabled)) {
12271
+ if (!ref.unsubscribe) ref.unsubscribe = subscribe(function() {
12272
+ var next = ref.getSnapshot();
12273
+ if (next !== ref.proxyTarget) {
12274
+ ref.proxyTarget = next;
12275
+ ref.proxy[refSlot].proxyTarget = next;
12276
+ forceUpdate();
12277
+ }
12278
+ });
12279
+ } else if (ref.unsubscribe) {
12280
+ ref.unsubscribe();
12281
+ ref.unsubscribe = void 0;
12202
12282
  }
12203
- return lastState;
12204
- }, getServerSnapshot);
12205
- return new Proxy(state, { get(_, key) {
12206
- if (!disableMediaTouch && typeof key === "string") keys.add(key);
12207
- return Reflect.get(state, key);
12208
- } });
12283
+ return function() {
12284
+ if (ref.renderVersion === renderVersion) {
12285
+ var _ref_unsubscribe;
12286
+ (_ref_unsubscribe = ref.unsubscribe) === null || _ref_unsubscribe === void 0 || _ref_unsubscribe.call(ref);
12287
+ ref.unsubscribe = void 0;
12288
+ }
12289
+ };
12290
+ });
12291
+ return ref.proxy;
12209
12292
  }
12210
12293
  function _disableMediaTouch(val) {
12211
12294
  disableMediaTouch = val;
@@ -12231,7 +12314,7 @@ function mediaKeyMatch(key, dimensions) {
12231
12314
  return isMax ? givenVal < expectedVal : givenVal > expectedVal;
12232
12315
  });
12233
12316
  }
12234
- var mediaKeyRegex, getMediaKey, initState, mediaKeysOrdered, getMediaKeyImportance, dispose, mediaVersion, configureMedia, setupVersion, listeners, States, getServerSnapshot, disableMediaTouch, getMediaImportanceIfMoreImportant;
12317
+ var mediaKeyRegex, getMediaKey, mediaKeysOrdered, getMediaKeyImportance, dispose, mediaVersion, configureMedia, setupVersion, listeners, States, touchTrackerProto, refSlot, incReducer$1, disableMediaTouch, getMediaImportanceIfMoreImportant;
12235
12318
  var init_useMedia_native = __esmMin((() => {
12236
12319
  init_index_native$7();
12237
12320
  init_config_native();
@@ -12260,20 +12343,23 @@ var init_useMedia_native = __esmMin((() => {
12260
12343
  if (!media) return;
12261
12344
  mediaVersion++;
12262
12345
  resetMediaStyleCache();
12346
+ resetMediaTouchTracker();
12263
12347
  for (var key in media) {
12264
12348
  getMedia()[key] = (mediaQueryDefaultActive === null || mediaQueryDefaultActive === void 0 ? void 0 : mediaQueryDefaultActive[key]) || false;
12265
12349
  mediaKeys.add(`$${key}`);
12266
12350
  }
12267
12351
  Object.assign(mediaQueryConfig, media);
12268
- initState = _objectSpread2({}, getMedia());
12352
+ _objectSpread2({}, getMedia());
12269
12353
  mediaKeysOrdered = Object.keys(media);
12270
12354
  setupMediaListeners();
12271
12355
  };
12272
12356
  setupVersion = -1;
12273
12357
  listeners = /* @__PURE__ */ new Set();
12274
12358
  States = /* @__PURE__ */ new WeakMap();
12275
- getServerSnapshot = function() {
12276
- return initState;
12359
+ touchTrackerProto = null;
12360
+ refSlot = /* @__PURE__ */ Symbol("mediaRefSlot");
12361
+ incReducer$1 = function(c) {
12362
+ return c + 1;
12277
12363
  };
12278
12364
  disableMediaTouch = false;
12279
12365
  getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
@@ -12904,6 +12990,18 @@ var init_getDynamicVal_native = __esmMin((() => {
12904
12990
  }));
12905
12991
  //#endregion
12906
12992
  //#region ../web/dist/esm/hooks/useThemeState.native.js
12993
+ function cleanupThemeSubscription(r) {
12994
+ var _r_unsubscribe;
12995
+ (_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
12996
+ }
12997
+ function cleanupThemeState(r) {
12998
+ if (r.unsubscribe) cleanupThemeSubscription(r);
12999
+ else {
13000
+ localStates.delete(r.id);
13001
+ states.delete(r.id);
13002
+ PendingUpdate.delete(r.id);
13003
+ }
13004
+ }
12907
13005
  function scheduleUpdate(id) {
12908
13006
  var queue = [id];
12909
13007
  var visited = /* @__PURE__ */ new Set();
@@ -13077,7 +13175,7 @@ function getNewThemeName() {
13077
13175
  themeNameCache.set(cacheKey, found);
13078
13176
  return found;
13079
13177
  }
13080
- var ThemeStateContext, allListeners, listenersByParent, HasRenderedOnce, HadTheme, PendingUpdate, states, localStates, shouldForce, forceUpdateThemes, getThemeState, cacheVersion, themeNameCache, themeNameCacheVer, themes, rootThemeState, getRootThemeState, getThemeBaseName, useThemeState, getNextState, validSchemes, getPropsKey, hasThemeUpdatingProps;
13178
+ var ThemeStateContext, allListeners, listenersByParent, HasRenderedOnce, HadTheme, PendingUpdate, states, localStates, shouldForce, forceUpdateThemes, getThemeState, cacheVersion, themeNameCache, themeNameCacheVer, themes, rootThemeState, getRootThemeState, getThemeBaseName, incReducer, useThemeState, shouldSubscribeToTheme, getSnapshotImpl, getNextState, validSchemes, getPropsKey, hasThemeUpdatingProps;
13081
13179
  var init_useThemeState_native = __esmMin((() => {
13082
13180
  init_index_native$7();
13083
13181
  init_config_native();
@@ -13114,9 +13212,12 @@ var init_useThemeState_native = __esmMin((() => {
13114
13212
  getThemeBaseName = function(name) {
13115
13213
  return name.replace(/^(light|dark)_/, "");
13116
13214
  };
13215
+ incReducer = function(c) {
13216
+ return c + 1;
13217
+ };
13117
13218
  useThemeState = function(props) {
13118
13219
  "use no memo";
13119
- var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0;
13220
+ var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, keys = arguments.length > 2 ? arguments[2] : void 0, schemeKeys = arguments.length > 3 ? arguments[3] : void 0, cascadeOnChange = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : false;
13120
13221
  var { disable } = props;
13121
13222
  var parentId = (0, react.useContext)(ThemeStateContext);
13122
13223
  if (!parentId && !isRoot) throw new Error(MISSING_THEME_MESSAGE);
@@ -13126,53 +13227,69 @@ var init_useThemeState_native = __esmMin((() => {
13126
13227
  theme: getConfig().themes.light
13127
13228
  };
13128
13229
  var id = (0, react.useId)();
13129
- var subscribe = (0, react.useCallback)(function(cb) {
13130
- listenersByParent[parentId] = listenersByParent[parentId] || /* @__PURE__ */ new Set();
13131
- listenersByParent[parentId].add(id);
13132
- allListeners.set(id, function() {
13133
- PendingUpdate.set(id, shouldForce ? "force" : true);
13134
- cb();
13135
- });
13136
- return function() {
13137
- allListeners.delete(id);
13138
- listenersByParent[parentId].delete(id);
13139
- localStates.delete(id);
13140
- states.delete(id);
13141
- PendingUpdate.delete(id);
13142
- };
13143
- }, [id, parentId]);
13144
13230
  var propsKey = getPropsKey(props);
13145
- var getSnapshot = function() {
13146
- var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
13147
- var local = localStates.get(id);
13148
- var parentState = states.get(parentId);
13149
- if (local && !PendingUpdate.has(id)) {
13150
- if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
13151
- }
13152
- var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
13153
- var _keys_current_size;
13154
- var keysSize = (_keys_current_size = keys === null || keys === void 0 ? void 0 : (_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) !== null && _keys_current_size !== void 0 ? _keys_current_size : 0;
13155
- var _schemeKeys_current_size;
13156
- var allKeysSchemeOptimized = ((_schemeKeys_current_size = schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) !== null && _schemeKeys_current_size !== void 0 ? _schemeKeys_current_size : 0) === keysSize && keysSize > 0;
13157
- var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
13158
- var needsUpdate = props.passThrough ? false : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
13159
- var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
13160
- PendingUpdate.delete(id);
13161
- if (!local || rerender) {
13162
- local = _objectSpread2({}, next);
13163
- localStates.set(id, local);
13164
- }
13165
- if (next !== local) {
13166
- Object.assign(local, next);
13167
- local.id = id;
13168
- }
13169
- local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
13170
- local._propsKey = propsKey;
13171
- states.set(id, next);
13172
- return local;
13231
+ var ref = (0, react.useRef)(null);
13232
+ if (!ref.current) ref.current = {
13233
+ id,
13234
+ parentId,
13235
+ props,
13236
+ propsKey,
13237
+ isRoot,
13238
+ keys,
13239
+ schemeKeys,
13240
+ renderVersion: 0
13173
13241
  };
13174
- var state = (0, react.useSyncExternalStore)(subscribe, getSnapshot, getSnapshot);
13175
- useIsomorphicLayoutEffect(function() {
13242
+ else {
13243
+ ref.current.props = props;
13244
+ ref.current.propsKey = propsKey;
13245
+ ref.current.isRoot = isRoot;
13246
+ ref.current.keys = keys;
13247
+ ref.current.schemeKeys = schemeKeys;
13248
+ ref.current.parentId = parentId;
13249
+ }
13250
+ ref.current.renderVersion++;
13251
+ var [, forceUpdate] = (0, react.useReducer)(incReducer, 0);
13252
+ var state = getSnapshotImpl(ref.current);
13253
+ ref.current.lastSnap = state;
13254
+ (0, react.useEffect)(function() {
13255
+ var r = ref.current;
13256
+ var renderVersion = r.renderVersion;
13257
+ if (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);
13258
+ if (shouldSubscribeToTheme(r, cascadeOnChange)) {
13259
+ if (!r.unsubscribe) {
13260
+ var pid = r.parentId;
13261
+ var sid = r.id;
13262
+ var cb = function() {
13263
+ var next = getSnapshotImpl(r);
13264
+ if (next !== r.lastSnap) {
13265
+ r.lastSnap = next;
13266
+ forceUpdate();
13267
+ }
13268
+ };
13269
+ listenersByParent[pid] = listenersByParent[pid] || /* @__PURE__ */ new Set();
13270
+ listenersByParent[pid].add(sid);
13271
+ allListeners.set(sid, function() {
13272
+ PendingUpdate.set(sid, shouldForce ? "force" : true);
13273
+ cb();
13274
+ });
13275
+ r.subscribedParentId = pid;
13276
+ r.unsubscribe = function() {
13277
+ var _listenersByParent_pid;
13278
+ allListeners.delete(sid);
13279
+ (_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);
13280
+ localStates.delete(sid);
13281
+ states.delete(sid);
13282
+ PendingUpdate.delete(sid);
13283
+ r.unsubscribe = void 0;
13284
+ r.subscribedParentId = void 0;
13285
+ };
13286
+ }
13287
+ } else if (r.unsubscribe) cleanupThemeSubscription(r);
13288
+ return function() {
13289
+ if (r.renderVersion === renderVersion) cleanupThemeState(r);
13290
+ };
13291
+ });
13292
+ if (cascadeOnChange) useIsomorphicLayoutEffect(function() {
13176
13293
  if (!HasRenderedOnce.get(keys)) {
13177
13294
  HasRenderedOnce.set(keys, true);
13178
13295
  return;
@@ -13187,6 +13304,40 @@ var init_useThemeState_native = __esmMin((() => {
13187
13304
  }, [keys, propsKey]);
13188
13305
  return state;
13189
13306
  };
13307
+ shouldSubscribeToTheme = function(r, cascadeOnChange) {
13308
+ var _r_keys_current, _r_props_needsUpdate, _r_props;
13309
+ return r.isRoot || cascadeOnChange || hasThemeUpdatingProps(r.props) || !!((_r_keys_current = r.keys.current) === null || _r_keys_current === void 0 ? void 0 : _r_keys_current.size) || !!((_r_props_needsUpdate = (_r_props = r.props).needsUpdate) === null || _r_props_needsUpdate === void 0 ? void 0 : _r_props_needsUpdate.call(_r_props));
13310
+ };
13311
+ getSnapshotImpl = function(r) {
13312
+ var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
13313
+ var { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r;
13314
+ var local = localStates.get(id);
13315
+ var parentState = states.get(parentId);
13316
+ if (local && !PendingUpdate.has(id)) {
13317
+ if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
13318
+ }
13319
+ var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
13320
+ var _keys_current_size;
13321
+ var keysSize = (_keys_current_size = keys === null || keys === void 0 ? void 0 : (_keys_current = keys.current) === null || _keys_current === void 0 ? void 0 : _keys_current.size) !== null && _keys_current_size !== void 0 ? _keys_current_size : 0;
13322
+ var _schemeKeys_current_size;
13323
+ var allKeysSchemeOptimized = ((_schemeKeys_current_size = schemeKeys === null || schemeKeys === void 0 ? void 0 : (_schemeKeys_current = schemeKeys.current) === null || _schemeKeys_current === void 0 ? void 0 : _schemeKeys_current.size) !== null && _schemeKeys_current_size !== void 0 ? _schemeKeys_current_size : 0) === keysSize && keysSize > 0;
13324
+ var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
13325
+ var needsUpdate = props.passThrough ? false : isRoot || props.name === "light" || props.name === "dark" || props.name === null ? true : !HasRenderedOnce.get(keys) ? true : canSkipForSchemeChange ? false : (keys === null || keys === void 0 ? void 0 : (_keys_current1 = keys.current) === null || _keys_current1 === void 0 ? void 0 : _keys_current1.size) ? true : (_props_needsUpdate = props.needsUpdate) === null || _props_needsUpdate === void 0 ? void 0 : _props_needsUpdate.call(props);
13326
+ var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
13327
+ PendingUpdate.delete(id);
13328
+ if (!local || rerender) {
13329
+ local = _objectSpread2({}, next);
13330
+ localStates.set(id, local);
13331
+ }
13332
+ if (next !== local) {
13333
+ Object.assign(local, next);
13334
+ local.id = id;
13335
+ }
13336
+ local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
13337
+ local._propsKey = propsKey;
13338
+ states.set(id, next);
13339
+ return local;
13340
+ };
13190
13341
  getNextState = function(lastState, props, propsKey) {
13191
13342
  var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : false, 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;
13192
13343
  var { debug } = props;
@@ -13201,9 +13352,13 @@ var init_useThemeState_native = __esmMin((() => {
13201
13352
  return [shouldRerender, _objectSpread2(_objectSpread2({}, parentState), {}, { isNew: false })];
13202
13353
  }
13203
13354
  if (!name) {
13204
- var next = lastState !== null && lastState !== void 0 ? lastState : parentState;
13205
- if (!next) throw new Error(MISSING_THEME_MESSAGE);
13206
- if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState)];
13355
+ var _ref, _ref1;
13356
+ var next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {
13357
+ id,
13358
+ name: "light",
13359
+ theme: getConfig().themes.light
13360
+ };
13361
+ if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
13207
13362
  return [false, next];
13208
13363
  }
13209
13364
  var scheme = getScheme(name);
@@ -13324,10 +13479,14 @@ var init_useTheme_native = __esmMin((() => {
13324
13479
  };
13325
13480
  useThemeWithState = function(props) {
13326
13481
  "use no memo";
13327
- var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
13328
- var keys = (0, react.useRef)(null);
13329
- var schemeKeys = (0, react.useRef)(null);
13330
- var themeState = useThemeState(props, isRoot, keys, schemeKeys);
13482
+ var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
13483
+ var bag = (0, react.useRef)(null);
13484
+ if (!bag.current) bag.current = {
13485
+ keys: { current: null },
13486
+ schemeKeys: { current: null }
13487
+ };
13488
+ var { keys, schemeKeys } = bag.current;
13489
+ var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
13331
13490
  return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
13332
13491
  };
13333
13492
  }));
@@ -13450,6 +13609,10 @@ function resetPressOwner() {
13450
13609
  function resetStaleOwner(now, debugName) {
13451
13610
  if (now - pressState.timestamp > 2e3) resetPressOwner();
13452
13611
  }
13612
+ function hasExternalPressOwnership() {
13613
+ resetStaleOwner(Date.now());
13614
+ return pressState.ownerSource === "external";
13615
+ }
13453
13616
  function getGestureHandler() {
13454
13617
  return {
13455
13618
  get isEnabled() {
@@ -13580,7 +13743,7 @@ function getGestureHandler() {
13580
13743
  }
13581
13744
  };
13582
13745
  }
13583
- var state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, pressState;
13746
+ var _globalThis, _PRESS_STATE_KEY, state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, PRESS_STATE_KEY, _$1, pressState;
13584
13747
  var init_gestureState_native = __esmMin((() => {
13585
13748
  init_globalState_native();
13586
13749
  state = createGlobalState(`gesture`, {
@@ -13594,7 +13757,8 @@ var init_gestureState_native = __esmMin((() => {
13594
13757
  pressGestureDebugId = 0;
13595
13758
  PRESS_MOVE_CANCEL_DISTANCE = 12;
13596
13759
  PRESS_MOVE_CANCEL_DISTANCE_SQ = PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE;
13597
- pressState = {
13760
+ PRESS_STATE_KEY = "__tamagui_press_state__";
13761
+ pressState = (_$1 = (_globalThis = globalThis)[_PRESS_STATE_KEY = PRESS_STATE_KEY]) !== null && _$1 !== void 0 ? _$1 : _globalThis[_PRESS_STATE_KEY] = {
13598
13762
  owner: null,
13599
13763
  ownerId: null,
13600
13764
  ownerSource: null,
@@ -13643,7 +13807,8 @@ function useMainThreadPressEvents(events, viewProps) {
13643
13807
  pressInTimer: null,
13644
13808
  pressOutTimer: null,
13645
13809
  longPressTimer: null,
13646
- activateTime: 0
13810
+ activateTime: 0,
13811
+ blockedByExternalOwnership: false
13647
13812
  };
13648
13813
  if (!enabled || !events) return;
13649
13814
  var _events_delayPressIn;
@@ -13687,11 +13852,18 @@ function useMainThreadPressEvents(events, viewProps) {
13687
13852
  var userTerminationRequest = viewProps.onResponderTerminationRequest;
13688
13853
  var userMove = viewProps.onResponderMove;
13689
13854
  viewProps.onStartShouldSetResponder = function(e) {
13690
- return Boolean(userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) || !events.disabled;
13855
+ if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;
13856
+ return !events.disabled && !hasExternalPressOwnership();
13691
13857
  };
13692
13858
  viewProps.onResponderGrant = function(e) {
13693
- userGrant === null || userGrant === void 0 || userGrant(e);
13694
13859
  cleanup();
13860
+ if (hasExternalPressOwnership()) {
13861
+ ref.current.state = "idle";
13862
+ ref.current.blockedByExternalOwnership = true;
13863
+ return;
13864
+ }
13865
+ userGrant === null || userGrant === void 0 || userGrant(e);
13866
+ ref.current.blockedByExternalOwnership = false;
13695
13867
  ref.current.state = "pressing";
13696
13868
  if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
13697
13869
  return activate(e);
@@ -13706,6 +13878,12 @@ function useMainThreadPressEvents(events, viewProps) {
13706
13878
  }, delayLongPress + delayPressIn);
13707
13879
  };
13708
13880
  viewProps.onResponderRelease = function(e) {
13881
+ if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
13882
+ cleanup();
13883
+ ref.current.blockedByExternalOwnership = false;
13884
+ ref.current.state = "idle";
13885
+ return;
13886
+ }
13709
13887
  userRelease === null || userRelease === void 0 || userRelease(e);
13710
13888
  var wasLongPressed = ref.current.state === "longPressed";
13711
13889
  cleanup();
@@ -13716,12 +13894,14 @@ function useMainThreadPressEvents(events, viewProps) {
13716
13894
  }
13717
13895
  deactivate(e);
13718
13896
  ref.current.state = "idle";
13897
+ ref.current.blockedByExternalOwnership = false;
13719
13898
  };
13720
13899
  viewProps.onResponderTerminate = function(e) {
13721
13900
  userTerminate === null || userTerminate === void 0 || userTerminate(e);
13722
13901
  cleanup();
13723
13902
  if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
13724
13903
  ref.current.state = "idle";
13904
+ ref.current.blockedByExternalOwnership = false;
13725
13905
  };
13726
13906
  viewProps.onResponderTerminationRequest = function(e) {
13727
13907
  if (userTerminationRequest) return userTerminationRequest(e);
@@ -13735,6 +13915,7 @@ function useMainThreadPressEvents(events, viewProps) {
13735
13915
  }
13736
13916
  var DEFAULT_LONG_PRESS_DELAY, DEFAULT_MIN_PRESS_DURATION;
13737
13917
  var init_mainThreadPressEvents_native = __esmMin((() => {
13918
+ init_index_native$3();
13738
13919
  DEFAULT_LONG_PRESS_DELAY = 500;
13739
13920
  DEFAULT_MIN_PRESS_DURATION = 130;
13740
13921
  }));
@@ -13784,7 +13965,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13784
13965
  if (isUsingRNGH) {
13785
13966
  var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
13786
13967
  var gestureRef = (0, react.useRef)(null);
13787
- useMainThreadPressEvents(events, viewProps, getIsAndroid() && !(hasRealPressEvents || stateRef.current.hasRealPressEvents) && Boolean(hasPressEvents), debugName);
13968
+ useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
13788
13969
  if (everEnabled) {
13789
13970
  callbacksRef.current = hasPressEvents ? {
13790
13971
  onPressIn: events.onPressIn,
@@ -13792,6 +13973,10 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13792
13973
  onPress: events.onPress,
13793
13974
  onLongPress: events.onLongPress
13794
13975
  } : {};
13976
+ if (hasRealPressEvents && !isInsideNativeMenu) {
13977
+ gestureRef.current = null;
13978
+ return null;
13979
+ }
13795
13980
  if (!gestureRef.current) {
13796
13981
  var { Gesture } = gh.state;
13797
13982
  if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
@@ -13805,27 +13990,6 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13805
13990
  var _callbacksRef_current_onPressOut, _callbacksRef_current;
13806
13991
  (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
13807
13992
  });
13808
- else if (hasRealPressEvents || stateRef.current.hasRealPressEvents) gestureRef.current = gh.createPressGesture({
13809
- debugName,
13810
- onPressIn: function(e) {
13811
- var _callbacksRef_current_onPressIn, _callbacksRef_current;
13812
- return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
13813
- },
13814
- onPressOut: function(e) {
13815
- var _callbacksRef_current_onPressOut, _callbacksRef_current;
13816
- return (_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 ? void 0 : _callbacksRef_current_onPressOut.call(_callbacksRef_current, e);
13817
- },
13818
- onPress: function(e) {
13819
- var _callbacksRef_current_onPress, _callbacksRef_current;
13820
- return (_callbacksRef_current_onPress = (_callbacksRef_current = callbacksRef.current).onPress) === null || _callbacksRef_current_onPress === void 0 ? void 0 : _callbacksRef_current_onPress.call(_callbacksRef_current, e);
13821
- },
13822
- onLongPress: function(e) {
13823
- var _callbacksRef_current_onLongPress, _callbacksRef_current;
13824
- return (_callbacksRef_current_onLongPress = (_callbacksRef_current = callbacksRef.current).onLongPress) === null || _callbacksRef_current_onLongPress === void 0 ? void 0 : _callbacksRef_current_onLongPress.call(_callbacksRef_current, e);
13825
- },
13826
- delayLongPress: events === null || events === void 0 ? void 0 : events.delayLongPress,
13827
- hitSlop: viewProps.hitSlop
13828
- });
13829
13993
  else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
13830
13994
  var _callbacksRef_current_onPressIn, _callbacksRef_current;
13831
13995
  return (_callbacksRef_current_onPressIn = (_callbacksRef_current = callbacksRef.current).onPressIn) === null || _callbacksRef_current_onPressIn === void 0 ? void 0 : _callbacksRef_current_onPressIn.call(_callbacksRef_current, e);
@@ -13845,23 +14009,20 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
13845
14009
  useMainThreadPressEvents(events, viewProps, hasPressEvents, debugName);
13846
14010
  return null;
13847
14011
  }
13848
- function wrapWithGestureDetector(content, gesture, stateRef, isHOC, isCompositeComponent) {
14012
+ function wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {
13849
14013
  if (isHOC || isCompositeComponent) return content;
13850
- var { GestureDetector, Gesture } = getGestureHandler().state;
13851
- var shouldWrap = getIsAndroid() ? stateRef.current.hasRealPressEvents : stateRef.current.hasHadEvents;
13852
- if (!GestureDetector || !shouldWrap) return content;
13853
- var gestureToUse = gesture || (Gesture === null || Gesture === void 0 ? void 0 : Gesture.Manual());
13854
- if (!gestureToUse) return content;
13855
- if (!stateRef.current.hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture: gestureToUse }, content);
14014
+ var { GestureDetector } = getGestureHandler().state;
14015
+ if (!GestureDetector || !gesture) return content;
14016
+ if (!hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture }, content);
13856
14017
  if (isFabric) {
13857
14018
  var claimed = react.default.cloneElement(content, { onStartShouldSetResponder: responderClaim });
13858
- return react.default.createElement(GestureDetector, { gesture: gestureToUse }, claimed);
14019
+ return react.default.createElement(GestureDetector, { gesture }, claimed);
13859
14020
  }
13860
14021
  return react.default.createElement(View$2, {
13861
14022
  collapsable: false,
13862
14023
  style: responderWrapperStyle,
13863
14024
  onStartShouldSetResponder: responderClaim
13864
- }, react.default.createElement(GestureDetector, { gesture: gestureToUse }, content));
14025
+ }, react.default.createElement(GestureDetector, { gesture }, content));
13865
14026
  }
13866
14027
  var isFabric, isAndroidCache, getIsAndroid, isNativeDesktopCache, getIsNativeDesktop, responderClaim, responderWrapperStyle;
13867
14028
  var init_eventHandling_native = __esmMin((() => {
@@ -14920,6 +15081,29 @@ var init_propMapper_native = __esmMin((() => {
14920
15081
  }
14921
15082
  var { conf, styleProps, staticConfig } = styleState;
14922
15083
  var { variants } = staticConfig;
15084
+ if (value === "unset") {
15085
+ var expandedKey = !styleProps.disableExpandShorthands && conf.shorthands[key] || key;
15086
+ var expanded = styleProps.noExpand ? null : expandStyle(expandedKey, value, conf.settings.styleCompat || "web");
15087
+ if (styleState.style) if (expanded) {
15088
+ var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
15089
+ try {
15090
+ for (var _iterator = expanded[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
15091
+ var [nkey] = _step.value;
15092
+ delete styleState.style[nkey];
15093
+ }
15094
+ } catch (err) {
15095
+ _didIteratorError = true;
15096
+ _iteratorError = err;
15097
+ } finally {
15098
+ try {
15099
+ if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
15100
+ } finally {
15101
+ if (_didIteratorError) throw _iteratorError;
15102
+ }
15103
+ }
15104
+ } else delete styleState.style[expandedKey];
15105
+ return;
15106
+ }
14923
15107
  if (!styleProps.noExpand) {
14924
15108
  if (variants && key in variants) {
14925
15109
  var variantValue = resolveVariants(key, value, styleProps, styleState, "");
@@ -14949,20 +15133,20 @@ var init_propMapper_native = __esmMin((() => {
14949
15133
  var parsed = parseNativeStyle(key, value);
14950
15134
  if (parsed) {
14951
15135
  if (key === "textShadow" && Array.isArray(parsed) && Array.isArray(parsed[0])) {
14952
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
15136
+ var _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;
14953
15137
  try {
14954
- for (var _iterator = parsed[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
14955
- var [nkey, nvalue] = _step.value;
14956
- map(nkey, nvalue, originalValue);
15138
+ for (var _iterator1 = parsed[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
15139
+ var [nkey1, nvalue] = _step1.value;
15140
+ map(nkey1, nvalue, originalValue);
14957
15141
  }
14958
15142
  } catch (err) {
14959
- _didIteratorError = true;
14960
- _iteratorError = err;
15143
+ _didIteratorError1 = true;
15144
+ _iteratorError1 = err;
14961
15145
  } finally {
14962
15146
  try {
14963
- if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
15147
+ if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
14964
15148
  } finally {
14965
- if (_didIteratorError) throw _iteratorError;
15149
+ if (_didIteratorError1) throw _iteratorError1;
14966
15150
  }
14967
15151
  }
14968
15152
  return;
@@ -14973,12 +15157,12 @@ var init_propMapper_native = __esmMin((() => {
14973
15157
  if (value != null) {
14974
15158
  var fontToken = getLastFontFamilyToken();
14975
15159
  if (key === "fontFamily" && fontToken) styleState.fontFamily = fontToken;
14976
- var expanded = styleProps.noExpand ? null : expandStyle(key, value, conf.settings.styleCompat || "web");
14977
- if (expanded) {
14978
- var max = expanded.length;
15160
+ var expanded1 = styleProps.noExpand ? null : expandStyle(key, value, conf.settings.styleCompat || "web");
15161
+ if (expanded1) {
15162
+ var max = expanded1.length;
14979
15163
  for (var i = 0; i < max; i++) {
14980
- var [nkey1, nvalue1, noriginalValue] = expanded[i];
14981
- map(nkey1, nvalue1, noriginalValue !== null && noriginalValue !== void 0 ? noriginalValue : originalValue);
15164
+ var [nkey2, nvalue1, noriginalValue] = expanded1[i];
15165
+ map(nkey2, nvalue1, noriginalValue !== null && noriginalValue !== void 0 ? noriginalValue : originalValue);
14982
15166
  }
14983
15167
  } else map(key, value, originalValue);
14984
15168
  }
@@ -15159,6 +15343,11 @@ function normalizeGroupKey(key, groupContext) {
15159
15343
  function isValidStyleKey(key, validStyles, accept) {
15160
15344
  return key in validStyles ? true : accept && key in accept;
15161
15345
  }
15346
+ function shouldSkipNativeHoverProp(key, isMedia) {
15347
+ if (key === "hoverStyle") return true;
15348
+ if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
15349
+ return false;
15350
+ }
15162
15351
  function mergeFlatTransforms(target, flatTransforms) {
15163
15352
  Object.entries(flatTransforms).sort(function(param, param1) {
15164
15353
  var [a] = param, [b] = param1;
@@ -15269,6 +15458,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15269
15458
  viewProps[keyInit] = valInit;
15270
15459
  return "continue";
15271
15460
  }
15461
+ if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
15272
15462
  if (accept) {
15273
15463
  var accepted = accept[keyInit];
15274
15464
  if ((accepted === "style" || accepted === "textStyle") && valInit && (typeof valInit === "undefined" ? "undefined" : _type_of$3(valInit)) === "object") {
@@ -15310,6 +15500,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15310
15500
  var isMediaOrPseudo = Boolean(isMedia || isPseudo);
15311
15501
  if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
15312
15502
  var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
15503
+ if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
15313
15504
  if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
15314
15505
  var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
15315
15506
  var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
@@ -15347,6 +15538,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15347
15538
  isMediaOrPseudo = Boolean(isMedia || isPseudo);
15348
15539
  isVariant = variants && key5 in variants;
15349
15540
  if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
15541
+ if (shouldSkipNativeHoverProp(key5, isMedia)) return;
15350
15542
  if ((inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(key5)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened === null || inlineWhenUnflattened === void 0 ? void 0 : inlineWhenUnflattened.has(key5))) {
15351
15543
  var _props_key;
15352
15544
  viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
@@ -15511,6 +15703,7 @@ var init_getSplitStyles_native = __esmMin((() => {
15511
15703
  var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
15512
15704
  var groupPseudoKey = groupInfo.pseudo;
15513
15705
  var groupMediaKey = groupInfo.media;
15706
+ if (groupPseudoKey === "hover") return;
15514
15707
  if (!groupState) {
15515
15708
  pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
15516
15709
  return;
@@ -15864,13 +16057,17 @@ var init_mergeRenderElementProps_native = __esmMin((() => {
15864
16057
  function usePointerEvents(props, viewProps) {
15865
16058
  var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
15866
16059
  var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
15867
- var isInsideRef = (0, react.useRef)(false);
15868
- var layoutRef = (0, react.useRef)({
15869
- width: 0,
15870
- height: 0
15871
- });
15872
- var isCapturedRef = (0, react.useRef)(false);
16060
+ var ref = (0, react.useRef)(null);
16061
+ if (!ref.current) ref.current = {
16062
+ isInside: false,
16063
+ layout: {
16064
+ width: 0,
16065
+ height: 0
16066
+ },
16067
+ isCaptured: false
16068
+ };
15873
16069
  if (!hasPointerEvents) return;
16070
+ var bag = ref.current;
15874
16071
  var createNormalizedEvent = function(e) {
15875
16072
  var touch = e.nativeEvent;
15876
16073
  var _touch_identifier;
@@ -15886,10 +16083,10 @@ function usePointerEvents(props, viewProps) {
15886
16083
  nativeEvent: touch,
15887
16084
  target: {
15888
16085
  setPointerCapture: function(_pointerId) {
15889
- isCapturedRef.current = true;
16086
+ bag.isCaptured = true;
15890
16087
  },
15891
16088
  releasePointerCapture: function(_pointerId) {
15892
- isCapturedRef.current = false;
16089
+ bag.isCaptured = false;
15893
16090
  }
15894
16091
  }
15895
16092
  });
@@ -15898,46 +16095,46 @@ function usePointerEvents(props, viewProps) {
15898
16095
  onPointerDown(createNormalizedEvent(e));
15899
16096
  });
15900
16097
  if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
15901
- isCapturedRef.current = false;
16098
+ bag.isCaptured = false;
15902
16099
  onPointerUp(createNormalizedEvent(e));
15903
16100
  });
15904
16101
  if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
15905
16102
  var { locationX, locationY } = e.nativeEvent;
15906
- var { width, height } = layoutRef.current;
16103
+ var { width, height } = bag.layout;
15907
16104
  var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
15908
- if (isCapturedRef.current || isInBounds) onPointerMove(createNormalizedEvent(e));
16105
+ if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
15909
16106
  });
15910
16107
  if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
15911
- isCapturedRef.current = false;
16108
+ bag.isCaptured = false;
15912
16109
  onPointerCancel(createNormalizedEvent(e));
15913
16110
  });
15914
16111
  if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
15915
- layoutRef.current = {
16112
+ bag.layout = {
15916
16113
  width: e.nativeEvent.layout.width,
15917
16114
  height: e.nativeEvent.layout.height
15918
16115
  };
15919
16116
  });
15920
16117
  if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
15921
16118
  var { locationX, locationY } = e.nativeEvent;
15922
- var { width, height } = layoutRef.current;
16119
+ var { width, height } = bag.layout;
15923
16120
  if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
15924
- isInsideRef.current = true;
16121
+ bag.isInside = true;
15925
16122
  onPointerEnter(createNormalizedEvent(e));
15926
16123
  }
15927
16124
  });
15928
16125
  if (onPointerLeave) {
15929
16126
  viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
15930
16127
  var { locationX, locationY } = e.nativeEvent;
15931
- var { width, height } = layoutRef.current;
16128
+ var { width, height } = bag.layout;
15932
16129
  var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
15933
- if (isInsideRef.current && !isInside) {
15934
- isInsideRef.current = false;
16130
+ if (bag.isInside && !isInside) {
16131
+ bag.isInside = false;
15935
16132
  onPointerLeave(createNormalizedEvent(e));
15936
16133
  }
15937
16134
  });
15938
16135
  viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
15939
- if (isInsideRef.current) {
15940
- isInsideRef.current = false;
16136
+ if (bag.isInside) {
16137
+ bag.isInside = false;
15941
16138
  onPointerLeave(createNormalizedEvent(e));
15942
16139
  }
15943
16140
  });
@@ -16133,7 +16330,7 @@ var init_Theme_native = __esmMin((() => {
16133
16330
  if (props.disable) return props.children;
16134
16331
  var { passThrough } = props;
16135
16332
  var isRoot = !!props["_isRoot"];
16136
- var [_, themeState] = useThemeWithState(props, isRoot);
16333
+ var [_, themeState] = useThemeWithState(props, isRoot, true);
16137
16334
  var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
16138
16335
  return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
16139
16336
  }) : props.children;
@@ -16302,7 +16499,15 @@ var init_useComponentState_native = __esmMin((() => {
16302
16499
  });
16303
16500
  }
16304
16501
  var groupName = props.group;
16305
- var setStateShallow = useCreateShallowSetState(setState, props.debug);
16502
+ if (!stateRef.current.baseSetStateShallow) {
16503
+ var r = stateRef.current;
16504
+ r.baseSetStateShallow = function(stateOrGetState) {
16505
+ setState(function(prev) {
16506
+ return mergeIfNotShallowEqual(prev, typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState);
16507
+ });
16508
+ };
16509
+ }
16510
+ var setStateShallow = stateRef.current.baseSetStateShallow;
16306
16511
  if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
16307
16512
  var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
16308
16513
  if (isObj(custom)) Object.assign(props, custom);
@@ -16422,7 +16627,7 @@ function createComponent(staticConfig) {
16422
16627
  var overriddenContextProps = null;
16423
16628
  var componentContext = react.default.useContext(ComponentContext);
16424
16629
  var hasTextAncestor = false;
16425
- var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
16630
+ var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
16426
16631
  var props = propsIn;
16427
16632
  var componentName = props.componentName || staticConfig.componentName;
16428
16633
  var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
@@ -16856,7 +17061,8 @@ function createComponent(staticConfig) {
16856
17061
  var propsInWithHref = propsIn;
16857
17062
  var _props_testID, _ref, _ref1, _ref2, _ref3;
16858
17063
  var pressDebugName = [componentName, (_ref3 = (_ref2 = (_ref1 = (_ref = (_props_testID = props.testID) !== null && _props_testID !== void 0 ? _props_testID : propsIn.testID) !== null && _ref !== void 0 ? _ref : props.accessibilityLabel) !== null && _ref1 !== void 0 ? _ref1 : propsIn.accessibilityLabel) !== null && _ref2 !== void 0 ? _ref2 : typeof propsWithHref.href === "string" ? propsWithHref.href : null) !== null && _ref3 !== void 0 ? _ref3 : typeof propsInWithHref.href === "string" ? propsInWithHref.href : null].filter(Boolean).join(":") || null;
16859
- var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, !!(onPress || onPressIn || onPressOut || onLongPress));
17064
+ var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
17065
+ var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
16860
17066
  if (asChild) {
16861
17067
  elementType = Slot;
16862
17068
  Object.assign(viewProps, {
@@ -16881,7 +17087,7 @@ function createComponent(staticConfig) {
16881
17087
  content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
16882
17088
  }
16883
17089
  }
16884
- content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
17090
+ content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
16885
17091
  var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
16886
17092
  var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
16887
17093
  var hasEverReset = stateRef.current.hasEverResetPresence;
@@ -19005,6 +19211,7 @@ exports.rgba = rgba;
19005
19211
  exports.setConfig = setConfig;
19006
19212
  exports.setDidGetVariableValue = setDidGetVariableValue;
19007
19213
  exports.setIdentifierValue = setIdentifierValue;
19214
+ exports.setMediaState = setMediaState;
19008
19215
  exports.setNonce = setNonce;
19009
19216
  exports.setOnLayoutStrategy = setOnLayoutStrategy;
19010
19217
  exports.setRef = setRef;
@@ -19030,6 +19237,7 @@ exports.tokenCategories = tokenCategories;
19030
19237
  exports.transformsToString = transformsToString;
19031
19238
  exports.updateConfig = updateConfig;
19032
19239
  exports.updateFont = updateFont;
19240
+ exports.updateMediaListeners = updateMediaListeners;
19033
19241
  exports.useClientValue = useClientValue;
19034
19242
  exports.useComposedRefs = useComposedRefs;
19035
19243
  exports.useConfiguration = useConfiguration;