@tamagui/core 2.3.3 → 2.4.0-1783099846627
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/.turbo/turbo-build.log +2 -2
- package/dist/native.cjs +401 -204
- package/dist/test.native.cjs +373 -179
- package/package.json +10 -10
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
|
|
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,29 @@ function cleanupNode(node) {
|
|
|
912
932
|
IntersectionState.delete(node);
|
|
913
933
|
if (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);
|
|
914
934
|
}
|
|
935
|
+
function emitLayoutFromClientRects(node) {
|
|
936
|
+
var parentNode = node.parentElement;
|
|
937
|
+
if (!parentNode) return;
|
|
938
|
+
emitLayoutIfChanged(node, parentNode, node.getBoundingClientRect(), parentNode.getBoundingClientRect());
|
|
939
|
+
}
|
|
940
|
+
function emitLayoutFromObserver(_x2) {
|
|
941
|
+
return _emitLayoutFromObserver.apply(this, arguments);
|
|
942
|
+
}
|
|
943
|
+
function _emitLayoutFromObserver() {
|
|
944
|
+
_emitLayoutFromObserver = _asyncToGenerator(function* (node) {
|
|
945
|
+
if (!ENABLE || strategy !== "async") {
|
|
946
|
+
emitLayoutFromClientRects(node);
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
var parentNode = node.parentElement;
|
|
950
|
+
if (!parentNode) return;
|
|
951
|
+
var [nodeRect, parentRect] = yield Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(parentNode)]);
|
|
952
|
+
if (!nodeRect || !parentRect) return;
|
|
953
|
+
if (!Nodes.has(node) || node.parentElement !== parentNode) return;
|
|
954
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
955
|
+
});
|
|
956
|
+
return _emitLayoutFromObserver.apply(this, arguments);
|
|
957
|
+
}
|
|
915
958
|
function useElementLayout$1(ref, onLayout) {
|
|
916
959
|
var _ref_current;
|
|
917
960
|
var disableKey = (0, react.useContext)(DisableLayoutContextKey);
|
|
@@ -929,35 +972,17 @@ function useElementLayout$1(ref, onLayout) {
|
|
|
929
972
|
if (prevNode) cleanupNode(prevNode);
|
|
930
973
|
PrevHostNode.set(ref, nextNode);
|
|
931
974
|
if (!nextNode) return;
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
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));
|
|
975
|
+
LayoutHandlers.set(nextNode, onLayout);
|
|
976
|
+
observeLayoutNode(nextNode, disableKey);
|
|
977
|
+
emitLayoutFromObserver(nextNode);
|
|
947
978
|
});
|
|
948
979
|
useIsomorphicLayoutEffect(function() {
|
|
949
980
|
var _ref_current2;
|
|
950
981
|
if (!onLayout) return;
|
|
951
982
|
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
952
983
|
if (!node2) return;
|
|
953
|
-
|
|
954
|
-
|
|
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));
|
|
984
|
+
LayoutHandlers.set(node2, onLayout);
|
|
985
|
+
observeLayoutNode(node2, disableKey);
|
|
961
986
|
return function() {
|
|
962
987
|
cleanupNode(node2);
|
|
963
988
|
var swappedNode = PrevHostNode.get(ref);
|
|
@@ -1033,8 +1058,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1033
1058
|
}
|
|
1034
1059
|
function _updateLayoutIfChanged() {
|
|
1035
1060
|
_updateLayoutIfChanged = _asyncToGenerator(function* (node) {
|
|
1036
|
-
|
|
1037
|
-
if (typeof onLayout !== "function") return;
|
|
1061
|
+
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
1038
1062
|
var parentNode = node.parentElement;
|
|
1039
1063
|
if (!parentNode) return;
|
|
1040
1064
|
var nodeRect;
|
|
@@ -1047,19 +1071,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1047
1071
|
nodeRect = node.getBoundingClientRect();
|
|
1048
1072
|
parentRect = parentNode.getBoundingClientRect();
|
|
1049
1073
|
}
|
|
1050
|
-
|
|
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
|
-
}
|
|
1074
|
+
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
1063
1075
|
});
|
|
1064
1076
|
return _updateLayoutIfChanged.apply(this, arguments);
|
|
1065
1077
|
}
|
|
@@ -1210,7 +1222,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1210
1222
|
}
|
|
1211
1223
|
return null;
|
|
1212
1224
|
});
|
|
1213
|
-
return function measureNode(
|
|
1225
|
+
return function measureNode(_x3, _x4) {
|
|
1214
1226
|
return _ref.apply(this, arguments);
|
|
1215
1227
|
};
|
|
1216
1228
|
}();
|
|
@@ -1220,7 +1232,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1220
1232
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
1221
1233
|
return out;
|
|
1222
1234
|
});
|
|
1223
|
-
return function measure(
|
|
1235
|
+
return function measure(_x5, _x6) {
|
|
1224
1236
|
return _ref2.apply(this, arguments);
|
|
1225
1237
|
};
|
|
1226
1238
|
}();
|
|
@@ -1230,7 +1242,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1230
1242
|
if (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);
|
|
1231
1243
|
return out;
|
|
1232
1244
|
});
|
|
1233
|
-
return function measureInWindow(
|
|
1245
|
+
return function measureInWindow(_x7, _x8) {
|
|
1234
1246
|
return _ref3.apply(this, arguments);
|
|
1235
1247
|
};
|
|
1236
1248
|
}();
|
|
@@ -1245,7 +1257,7 @@ var init_index_native$11 = __esmMin((() => {
|
|
|
1245
1257
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
1246
1258
|
return out;
|
|
1247
1259
|
});
|
|
1248
|
-
return function measureLayout(
|
|
1260
|
+
return function measureLayout(_x9, _x10, _x11) {
|
|
1249
1261
|
return _ref4.apply(this, arguments);
|
|
1250
1262
|
};
|
|
1251
1263
|
}();
|
|
@@ -12144,6 +12156,43 @@ function updateMediaListeners() {
|
|
|
12144
12156
|
return cb(getMedia());
|
|
12145
12157
|
});
|
|
12146
12158
|
}
|
|
12159
|
+
function buildTouchTrackerProto() {
|
|
12160
|
+
var proto = {};
|
|
12161
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
12162
|
+
try {
|
|
12163
|
+
var _loop = function() {
|
|
12164
|
+
var fullKey = _step.value;
|
|
12165
|
+
var key = fullKey[0] === "$" ? fullKey.slice(1) : fullKey;
|
|
12166
|
+
proto[key] = {
|
|
12167
|
+
enumerable: true,
|
|
12168
|
+
configurable: true,
|
|
12169
|
+
get() {
|
|
12170
|
+
var slot = this[refSlot];
|
|
12171
|
+
if (!disableMediaTouch) slot.keys.add(key);
|
|
12172
|
+
return slot.proxyTarget[key];
|
|
12173
|
+
}
|
|
12174
|
+
};
|
|
12175
|
+
};
|
|
12176
|
+
for (var _iterator = mediaKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) _loop();
|
|
12177
|
+
} catch (err) {
|
|
12178
|
+
_didIteratorError = true;
|
|
12179
|
+
_iteratorError = err;
|
|
12180
|
+
} finally {
|
|
12181
|
+
try {
|
|
12182
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
12183
|
+
} finally {
|
|
12184
|
+
if (_didIteratorError) throw _iteratorError;
|
|
12185
|
+
}
|
|
12186
|
+
}
|
|
12187
|
+
return Object.create(null, proto);
|
|
12188
|
+
}
|
|
12189
|
+
function getTouchTrackerProto() {
|
|
12190
|
+
if (!touchTrackerProto) touchTrackerProto = buildTouchTrackerProto();
|
|
12191
|
+
return touchTrackerProto;
|
|
12192
|
+
}
|
|
12193
|
+
function resetMediaTouchTracker() {
|
|
12194
|
+
touchTrackerProto = null;
|
|
12195
|
+
}
|
|
12147
12196
|
function setMediaShouldUpdate(ref, enabled, keys) {
|
|
12148
12197
|
var cur = States.get(ref);
|
|
12149
12198
|
if (!cur || cur.enabled !== enabled || keys) States.set(ref, _objectSpread2(_objectSpread2({}, cur), {}, {
|
|
@@ -12159,53 +12208,99 @@ function subscribe(subscriber) {
|
|
|
12159
12208
|
}
|
|
12160
12209
|
function useMedia(componentContext, debug) {
|
|
12161
12210
|
"use no memo";
|
|
12162
|
-
var componentState = componentContext ? States.get(componentContext) : null;
|
|
12163
12211
|
var internalRef = (0, react.useRef)(null);
|
|
12164
|
-
if (!internalRef.current)
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
var
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
12212
|
+
if (!internalRef.current) {
|
|
12213
|
+
var initial = getMedia();
|
|
12214
|
+
var r = {
|
|
12215
|
+
keys: /* @__PURE__ */ new Set(),
|
|
12216
|
+
lastState: initial,
|
|
12217
|
+
renderVersion: 0,
|
|
12218
|
+
proxyTarget: initial,
|
|
12219
|
+
proxy: void 0,
|
|
12220
|
+
getSnapshot: void 0,
|
|
12221
|
+
componentContext,
|
|
12222
|
+
debug
|
|
12223
|
+
};
|
|
12224
|
+
var tracker = Object.create(getTouchTrackerProto());
|
|
12225
|
+
tracker[refSlot] = {
|
|
12226
|
+
proxyTarget: initial,
|
|
12227
|
+
keys: r.keys
|
|
12228
|
+
};
|
|
12229
|
+
r.proxy = tracker;
|
|
12230
|
+
r.getSnapshot = function() {
|
|
12231
|
+
var _States_get;
|
|
12232
|
+
var curKeys = r.componentContext ? ((_States_get = States.get(r.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.keys) || r.keys : r.keys;
|
|
12233
|
+
var { lastState, pendingState } = r;
|
|
12234
|
+
if (!curKeys.size) return lastState;
|
|
12235
|
+
var ms = getMedia();
|
|
12236
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
12237
|
+
try {
|
|
12238
|
+
for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
12239
|
+
var key = _step.value;
|
|
12240
|
+
if (ms[key] !== (pendingState || lastState)[key]) {
|
|
12241
|
+
var _r_componentContext;
|
|
12242
|
+
if ((_r_componentContext = r.componentContext) === null || _r_componentContext === void 0 ? void 0 : _r_componentContext.mediaEmit) {
|
|
12243
|
+
r.componentContext.mediaEmit(ms);
|
|
12244
|
+
r.pendingState = ms;
|
|
12245
|
+
return lastState;
|
|
12246
|
+
}
|
|
12247
|
+
r.lastState = ms;
|
|
12248
|
+
return ms;
|
|
12188
12249
|
}
|
|
12189
|
-
internalRef.current.lastState = ms;
|
|
12190
|
-
return ms;
|
|
12191
12250
|
}
|
|
12192
|
-
}
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
_iteratorError = err;
|
|
12196
|
-
} finally {
|
|
12197
|
-
try {
|
|
12198
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
12251
|
+
} catch (err) {
|
|
12252
|
+
_didIteratorError = true;
|
|
12253
|
+
_iteratorError = err;
|
|
12199
12254
|
} finally {
|
|
12200
|
-
|
|
12255
|
+
try {
|
|
12256
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
12257
|
+
} finally {
|
|
12258
|
+
if (_didIteratorError) throw _iteratorError;
|
|
12259
|
+
}
|
|
12201
12260
|
}
|
|
12261
|
+
return lastState;
|
|
12262
|
+
};
|
|
12263
|
+
internalRef.current = r;
|
|
12264
|
+
} else {
|
|
12265
|
+
internalRef.current.componentContext = componentContext;
|
|
12266
|
+
internalRef.current.debug = debug;
|
|
12267
|
+
}
|
|
12268
|
+
var ref = internalRef.current;
|
|
12269
|
+
ref.renderVersion++;
|
|
12270
|
+
if (ref.pendingState) {
|
|
12271
|
+
ref.lastState = ref.pendingState;
|
|
12272
|
+
ref.pendingState = void 0;
|
|
12273
|
+
}
|
|
12274
|
+
if (ref.keys.size) ref.keys.clear();
|
|
12275
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer$1, 0);
|
|
12276
|
+
var state = ref.getSnapshot();
|
|
12277
|
+
ref.proxyTarget = state;
|
|
12278
|
+
ref.proxy[refSlot].proxyTarget = state;
|
|
12279
|
+
(0, react.useEffect)(function() {
|
|
12280
|
+
var _States_get;
|
|
12281
|
+
var renderVersion = ref.renderVersion;
|
|
12282
|
+
if (!ref.componentContext || !!((_States_get = States.get(ref.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.enabled)) {
|
|
12283
|
+
if (!ref.unsubscribe) ref.unsubscribe = subscribe(function() {
|
|
12284
|
+
var next = ref.getSnapshot();
|
|
12285
|
+
if (next !== ref.proxyTarget) {
|
|
12286
|
+
ref.proxyTarget = next;
|
|
12287
|
+
ref.proxy[refSlot].proxyTarget = next;
|
|
12288
|
+
forceUpdate();
|
|
12289
|
+
}
|
|
12290
|
+
});
|
|
12291
|
+
} else if (ref.unsubscribe) {
|
|
12292
|
+
ref.unsubscribe();
|
|
12293
|
+
ref.unsubscribe = void 0;
|
|
12202
12294
|
}
|
|
12203
|
-
return
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12295
|
+
return function() {
|
|
12296
|
+
if (ref.renderVersion === renderVersion) {
|
|
12297
|
+
var _ref_unsubscribe;
|
|
12298
|
+
(_ref_unsubscribe = ref.unsubscribe) === null || _ref_unsubscribe === void 0 || _ref_unsubscribe.call(ref);
|
|
12299
|
+
ref.unsubscribe = void 0;
|
|
12300
|
+
}
|
|
12301
|
+
};
|
|
12302
|
+
});
|
|
12303
|
+
return ref.proxy;
|
|
12209
12304
|
}
|
|
12210
12305
|
function _disableMediaTouch(val) {
|
|
12211
12306
|
disableMediaTouch = val;
|
|
@@ -12231,7 +12326,7 @@ function mediaKeyMatch(key, dimensions) {
|
|
|
12231
12326
|
return isMax ? givenVal < expectedVal : givenVal > expectedVal;
|
|
12232
12327
|
});
|
|
12233
12328
|
}
|
|
12234
|
-
var mediaKeyRegex, getMediaKey,
|
|
12329
|
+
var mediaKeyRegex, getMediaKey, mediaKeysOrdered, getMediaKeyImportance, dispose, mediaVersion, configureMedia, setupVersion, listeners, States, touchTrackerProto, refSlot, incReducer$1, disableMediaTouch, getMediaImportanceIfMoreImportant;
|
|
12235
12330
|
var init_useMedia_native = __esmMin((() => {
|
|
12236
12331
|
init_index_native$7();
|
|
12237
12332
|
init_config_native();
|
|
@@ -12260,20 +12355,23 @@ var init_useMedia_native = __esmMin((() => {
|
|
|
12260
12355
|
if (!media) return;
|
|
12261
12356
|
mediaVersion++;
|
|
12262
12357
|
resetMediaStyleCache();
|
|
12358
|
+
resetMediaTouchTracker();
|
|
12263
12359
|
for (var key in media) {
|
|
12264
12360
|
getMedia()[key] = (mediaQueryDefaultActive === null || mediaQueryDefaultActive === void 0 ? void 0 : mediaQueryDefaultActive[key]) || false;
|
|
12265
12361
|
mediaKeys.add(`$${key}`);
|
|
12266
12362
|
}
|
|
12267
12363
|
Object.assign(mediaQueryConfig, media);
|
|
12268
|
-
|
|
12364
|
+
_objectSpread2({}, getMedia());
|
|
12269
12365
|
mediaKeysOrdered = Object.keys(media);
|
|
12270
12366
|
setupMediaListeners();
|
|
12271
12367
|
};
|
|
12272
12368
|
setupVersion = -1;
|
|
12273
12369
|
listeners = /* @__PURE__ */ new Set();
|
|
12274
12370
|
States = /* @__PURE__ */ new WeakMap();
|
|
12275
|
-
|
|
12276
|
-
|
|
12371
|
+
touchTrackerProto = null;
|
|
12372
|
+
refSlot = /* @__PURE__ */ Symbol("mediaRefSlot");
|
|
12373
|
+
incReducer$1 = function(c) {
|
|
12374
|
+
return c + 1;
|
|
12277
12375
|
};
|
|
12278
12376
|
disableMediaTouch = false;
|
|
12279
12377
|
getMediaImportanceIfMoreImportant = function(mediaKey, key, styleState, isSizeMedia) {
|
|
@@ -12904,6 +13002,18 @@ var init_getDynamicVal_native = __esmMin((() => {
|
|
|
12904
13002
|
}));
|
|
12905
13003
|
//#endregion
|
|
12906
13004
|
//#region ../web/dist/esm/hooks/useThemeState.native.js
|
|
13005
|
+
function cleanupThemeSubscription(r) {
|
|
13006
|
+
var _r_unsubscribe;
|
|
13007
|
+
(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
|
|
13008
|
+
}
|
|
13009
|
+
function cleanupThemeState(r) {
|
|
13010
|
+
if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
13011
|
+
else {
|
|
13012
|
+
localStates.delete(r.id);
|
|
13013
|
+
states.delete(r.id);
|
|
13014
|
+
PendingUpdate.delete(r.id);
|
|
13015
|
+
}
|
|
13016
|
+
}
|
|
12907
13017
|
function scheduleUpdate(id) {
|
|
12908
13018
|
var queue = [id];
|
|
12909
13019
|
var visited = /* @__PURE__ */ new Set();
|
|
@@ -13077,7 +13187,7 @@ function getNewThemeName() {
|
|
|
13077
13187
|
themeNameCache.set(cacheKey, found);
|
|
13078
13188
|
return found;
|
|
13079
13189
|
}
|
|
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;
|
|
13190
|
+
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
13191
|
var init_useThemeState_native = __esmMin((() => {
|
|
13082
13192
|
init_index_native$7();
|
|
13083
13193
|
init_config_native();
|
|
@@ -13114,9 +13224,12 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13114
13224
|
getThemeBaseName = function(name) {
|
|
13115
13225
|
return name.replace(/^(light|dark)_/, "");
|
|
13116
13226
|
};
|
|
13227
|
+
incReducer = function(c) {
|
|
13228
|
+
return c + 1;
|
|
13229
|
+
};
|
|
13117
13230
|
useThemeState = function(props) {
|
|
13118
13231
|
"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;
|
|
13232
|
+
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
13233
|
var { disable } = props;
|
|
13121
13234
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
13122
13235
|
if (!parentId && !isRoot) throw new Error(MISSING_THEME_MESSAGE);
|
|
@@ -13126,53 +13239,69 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13126
13239
|
theme: getConfig().themes.light
|
|
13127
13240
|
};
|
|
13128
13241
|
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
13242
|
var propsKey = getPropsKey(props);
|
|
13145
|
-
var
|
|
13146
|
-
|
|
13147
|
-
|
|
13148
|
-
|
|
13149
|
-
|
|
13150
|
-
|
|
13151
|
-
|
|
13152
|
-
|
|
13153
|
-
|
|
13154
|
-
|
|
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;
|
|
13243
|
+
var ref = (0, react.useRef)(null);
|
|
13244
|
+
if (!ref.current) ref.current = {
|
|
13245
|
+
id,
|
|
13246
|
+
parentId,
|
|
13247
|
+
props,
|
|
13248
|
+
propsKey,
|
|
13249
|
+
isRoot,
|
|
13250
|
+
keys,
|
|
13251
|
+
schemeKeys,
|
|
13252
|
+
renderVersion: 0
|
|
13173
13253
|
};
|
|
13174
|
-
|
|
13175
|
-
|
|
13254
|
+
else {
|
|
13255
|
+
ref.current.props = props;
|
|
13256
|
+
ref.current.propsKey = propsKey;
|
|
13257
|
+
ref.current.isRoot = isRoot;
|
|
13258
|
+
ref.current.keys = keys;
|
|
13259
|
+
ref.current.schemeKeys = schemeKeys;
|
|
13260
|
+
ref.current.parentId = parentId;
|
|
13261
|
+
}
|
|
13262
|
+
ref.current.renderVersion++;
|
|
13263
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer, 0);
|
|
13264
|
+
var state = getSnapshotImpl(ref.current);
|
|
13265
|
+
ref.current.lastSnap = state;
|
|
13266
|
+
(0, react.useEffect)(function() {
|
|
13267
|
+
var r = ref.current;
|
|
13268
|
+
var renderVersion = r.renderVersion;
|
|
13269
|
+
if (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);
|
|
13270
|
+
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
13271
|
+
if (!r.unsubscribe) {
|
|
13272
|
+
var pid = r.parentId;
|
|
13273
|
+
var sid = r.id;
|
|
13274
|
+
var cb = function() {
|
|
13275
|
+
var next = getSnapshotImpl(r);
|
|
13276
|
+
if (next !== r.lastSnap) {
|
|
13277
|
+
r.lastSnap = next;
|
|
13278
|
+
forceUpdate();
|
|
13279
|
+
}
|
|
13280
|
+
};
|
|
13281
|
+
listenersByParent[pid] = listenersByParent[pid] || /* @__PURE__ */ new Set();
|
|
13282
|
+
listenersByParent[pid].add(sid);
|
|
13283
|
+
allListeners.set(sid, function() {
|
|
13284
|
+
PendingUpdate.set(sid, shouldForce ? "force" : true);
|
|
13285
|
+
cb();
|
|
13286
|
+
});
|
|
13287
|
+
r.subscribedParentId = pid;
|
|
13288
|
+
r.unsubscribe = function() {
|
|
13289
|
+
var _listenersByParent_pid;
|
|
13290
|
+
allListeners.delete(sid);
|
|
13291
|
+
(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);
|
|
13292
|
+
localStates.delete(sid);
|
|
13293
|
+
states.delete(sid);
|
|
13294
|
+
PendingUpdate.delete(sid);
|
|
13295
|
+
r.unsubscribe = void 0;
|
|
13296
|
+
r.subscribedParentId = void 0;
|
|
13297
|
+
};
|
|
13298
|
+
}
|
|
13299
|
+
} else if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
13300
|
+
return function() {
|
|
13301
|
+
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
13302
|
+
};
|
|
13303
|
+
});
|
|
13304
|
+
if (cascadeOnChange) useIsomorphicLayoutEffect(function() {
|
|
13176
13305
|
if (!HasRenderedOnce.get(keys)) {
|
|
13177
13306
|
HasRenderedOnce.set(keys, true);
|
|
13178
13307
|
return;
|
|
@@ -13187,6 +13316,40 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13187
13316
|
}, [keys, propsKey]);
|
|
13188
13317
|
return state;
|
|
13189
13318
|
};
|
|
13319
|
+
shouldSubscribeToTheme = function(r, cascadeOnChange) {
|
|
13320
|
+
var _r_keys_current, _r_props_needsUpdate, _r_props;
|
|
13321
|
+
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));
|
|
13322
|
+
};
|
|
13323
|
+
getSnapshotImpl = function(r) {
|
|
13324
|
+
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
|
|
13325
|
+
var { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r;
|
|
13326
|
+
var local = localStates.get(id);
|
|
13327
|
+
var parentState = states.get(parentId);
|
|
13328
|
+
if (local && !PendingUpdate.has(id)) {
|
|
13329
|
+
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
|
|
13330
|
+
}
|
|
13331
|
+
var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
13332
|
+
var _keys_current_size;
|
|
13333
|
+
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;
|
|
13334
|
+
var _schemeKeys_current_size;
|
|
13335
|
+
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;
|
|
13336
|
+
var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
|
|
13337
|
+
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);
|
|
13338
|
+
var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
13339
|
+
PendingUpdate.delete(id);
|
|
13340
|
+
if (!local || rerender) {
|
|
13341
|
+
local = _objectSpread2({}, next);
|
|
13342
|
+
localStates.set(id, local);
|
|
13343
|
+
}
|
|
13344
|
+
if (next !== local) {
|
|
13345
|
+
Object.assign(local, next);
|
|
13346
|
+
local.id = id;
|
|
13347
|
+
}
|
|
13348
|
+
local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
|
|
13349
|
+
local._propsKey = propsKey;
|
|
13350
|
+
states.set(id, next);
|
|
13351
|
+
return local;
|
|
13352
|
+
};
|
|
13190
13353
|
getNextState = function(lastState, props, propsKey) {
|
|
13191
13354
|
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
13355
|
var { debug } = props;
|
|
@@ -13201,9 +13364,13 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13201
13364
|
return [shouldRerender, _objectSpread2(_objectSpread2({}, parentState), {}, { isNew: false })];
|
|
13202
13365
|
}
|
|
13203
13366
|
if (!name) {
|
|
13204
|
-
var
|
|
13205
|
-
|
|
13206
|
-
|
|
13367
|
+
var _ref, _ref1;
|
|
13368
|
+
var next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {
|
|
13369
|
+
id,
|
|
13370
|
+
name: "light",
|
|
13371
|
+
theme: getConfig().themes.light
|
|
13372
|
+
};
|
|
13373
|
+
if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
|
|
13207
13374
|
return [false, next];
|
|
13208
13375
|
}
|
|
13209
13376
|
var scheme = getScheme(name);
|
|
@@ -13324,10 +13491,14 @@ var init_useTheme_native = __esmMin((() => {
|
|
|
13324
13491
|
};
|
|
13325
13492
|
useThemeWithState = function(props) {
|
|
13326
13493
|
"use no memo";
|
|
13327
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
13328
|
-
var
|
|
13329
|
-
|
|
13330
|
-
|
|
13494
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
13495
|
+
var bag = (0, react.useRef)(null);
|
|
13496
|
+
if (!bag.current) bag.current = {
|
|
13497
|
+
keys: { current: null },
|
|
13498
|
+
schemeKeys: { current: null }
|
|
13499
|
+
};
|
|
13500
|
+
var { keys, schemeKeys } = bag.current;
|
|
13501
|
+
var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
|
|
13331
13502
|
return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
|
|
13332
13503
|
};
|
|
13333
13504
|
}));
|
|
@@ -13450,6 +13621,10 @@ function resetPressOwner() {
|
|
|
13450
13621
|
function resetStaleOwner(now, debugName) {
|
|
13451
13622
|
if (now - pressState.timestamp > 2e3) resetPressOwner();
|
|
13452
13623
|
}
|
|
13624
|
+
function hasExternalPressOwnership() {
|
|
13625
|
+
resetStaleOwner(Date.now());
|
|
13626
|
+
return pressState.ownerSource === "external";
|
|
13627
|
+
}
|
|
13453
13628
|
function getGestureHandler() {
|
|
13454
13629
|
return {
|
|
13455
13630
|
get isEnabled() {
|
|
@@ -13580,7 +13755,7 @@ function getGestureHandler() {
|
|
|
13580
13755
|
}
|
|
13581
13756
|
};
|
|
13582
13757
|
}
|
|
13583
|
-
var state, GESTURE_ENABLED_FREEZE_KEY$1, pressGestureDebugId, PRESS_MOVE_CANCEL_DISTANCE, PRESS_MOVE_CANCEL_DISTANCE_SQ, pressState;
|
|
13758
|
+
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
13759
|
var init_gestureState_native = __esmMin((() => {
|
|
13585
13760
|
init_globalState_native();
|
|
13586
13761
|
state = createGlobalState(`gesture`, {
|
|
@@ -13594,7 +13769,8 @@ var init_gestureState_native = __esmMin((() => {
|
|
|
13594
13769
|
pressGestureDebugId = 0;
|
|
13595
13770
|
PRESS_MOVE_CANCEL_DISTANCE = 12;
|
|
13596
13771
|
PRESS_MOVE_CANCEL_DISTANCE_SQ = PRESS_MOVE_CANCEL_DISTANCE * PRESS_MOVE_CANCEL_DISTANCE;
|
|
13597
|
-
|
|
13772
|
+
PRESS_STATE_KEY = "__tamagui_press_state__";
|
|
13773
|
+
pressState = (_$1 = (_globalThis = globalThis)[_PRESS_STATE_KEY = PRESS_STATE_KEY]) !== null && _$1 !== void 0 ? _$1 : _globalThis[_PRESS_STATE_KEY] = {
|
|
13598
13774
|
owner: null,
|
|
13599
13775
|
ownerId: null,
|
|
13600
13776
|
ownerSource: null,
|
|
@@ -13643,7 +13819,8 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13643
13819
|
pressInTimer: null,
|
|
13644
13820
|
pressOutTimer: null,
|
|
13645
13821
|
longPressTimer: null,
|
|
13646
|
-
activateTime: 0
|
|
13822
|
+
activateTime: 0,
|
|
13823
|
+
blockedByExternalOwnership: false
|
|
13647
13824
|
};
|
|
13648
13825
|
if (!enabled || !events) return;
|
|
13649
13826
|
var _events_delayPressIn;
|
|
@@ -13687,11 +13864,18 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13687
13864
|
var userTerminationRequest = viewProps.onResponderTerminationRequest;
|
|
13688
13865
|
var userMove = viewProps.onResponderMove;
|
|
13689
13866
|
viewProps.onStartShouldSetResponder = function(e) {
|
|
13690
|
-
|
|
13867
|
+
if (userStartShouldSet === null || userStartShouldSet === void 0 ? void 0 : userStartShouldSet(e)) return true;
|
|
13868
|
+
return !events.disabled && !hasExternalPressOwnership();
|
|
13691
13869
|
};
|
|
13692
13870
|
viewProps.onResponderGrant = function(e) {
|
|
13693
|
-
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13694
13871
|
cleanup();
|
|
13872
|
+
if (hasExternalPressOwnership()) {
|
|
13873
|
+
ref.current.state = "idle";
|
|
13874
|
+
ref.current.blockedByExternalOwnership = true;
|
|
13875
|
+
return;
|
|
13876
|
+
}
|
|
13877
|
+
userGrant === null || userGrant === void 0 || userGrant(e);
|
|
13878
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13695
13879
|
ref.current.state = "pressing";
|
|
13696
13880
|
if (delayPressIn > 0) ref.current.pressInTimer = setTimeout(function() {
|
|
13697
13881
|
return activate(e);
|
|
@@ -13706,6 +13890,12 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13706
13890
|
}, delayLongPress + delayPressIn);
|
|
13707
13891
|
};
|
|
13708
13892
|
viewProps.onResponderRelease = function(e) {
|
|
13893
|
+
if (ref.current.blockedByExternalOwnership || hasExternalPressOwnership()) {
|
|
13894
|
+
cleanup();
|
|
13895
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13896
|
+
ref.current.state = "idle";
|
|
13897
|
+
return;
|
|
13898
|
+
}
|
|
13709
13899
|
userRelease === null || userRelease === void 0 || userRelease(e);
|
|
13710
13900
|
var wasLongPressed = ref.current.state === "longPressed";
|
|
13711
13901
|
cleanup();
|
|
@@ -13716,12 +13906,14 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13716
13906
|
}
|
|
13717
13907
|
deactivate(e);
|
|
13718
13908
|
ref.current.state = "idle";
|
|
13909
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13719
13910
|
};
|
|
13720
13911
|
viewProps.onResponderTerminate = function(e) {
|
|
13721
13912
|
userTerminate === null || userTerminate === void 0 || userTerminate(e);
|
|
13722
13913
|
cleanup();
|
|
13723
13914
|
if (ref.current.state === "active" || ref.current.state === "longPressed") deactivate(e);
|
|
13724
13915
|
ref.current.state = "idle";
|
|
13916
|
+
ref.current.blockedByExternalOwnership = false;
|
|
13725
13917
|
};
|
|
13726
13918
|
viewProps.onResponderTerminationRequest = function(e) {
|
|
13727
13919
|
if (userTerminationRequest) return userTerminationRequest(e);
|
|
@@ -13735,6 +13927,7 @@ function useMainThreadPressEvents(events, viewProps) {
|
|
|
13735
13927
|
}
|
|
13736
13928
|
var DEFAULT_LONG_PRESS_DELAY, DEFAULT_MIN_PRESS_DURATION;
|
|
13737
13929
|
var init_mainThreadPressEvents_native = __esmMin((() => {
|
|
13930
|
+
init_index_native$3();
|
|
13738
13931
|
DEFAULT_LONG_PRESS_DELAY = 500;
|
|
13739
13932
|
DEFAULT_MIN_PRESS_DURATION = 130;
|
|
13740
13933
|
}));
|
|
@@ -13784,7 +13977,7 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13784
13977
|
if (isUsingRNGH) {
|
|
13785
13978
|
var callbacksRef = (0, react.useRef)(isUsingRNGH ? {} : null);
|
|
13786
13979
|
var gestureRef = (0, react.useRef)(null);
|
|
13787
|
-
useMainThreadPressEvents(events, viewProps,
|
|
13980
|
+
useMainThreadPressEvents(events, viewProps, !isInsideNativeMenu && Boolean(hasRealPressEvents || getIsAndroid() && hasPressEvents), debugName);
|
|
13788
13981
|
if (everEnabled) {
|
|
13789
13982
|
callbacksRef.current = hasPressEvents ? {
|
|
13790
13983
|
onPressIn: events.onPressIn,
|
|
@@ -13792,6 +13985,10 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13792
13985
|
onPress: events.onPress,
|
|
13793
13986
|
onLongPress: events.onLongPress
|
|
13794
13987
|
} : {};
|
|
13988
|
+
if (hasRealPressEvents && !isInsideNativeMenu) {
|
|
13989
|
+
gestureRef.current = null;
|
|
13990
|
+
return null;
|
|
13991
|
+
}
|
|
13795
13992
|
if (!gestureRef.current) {
|
|
13796
13993
|
var { Gesture } = gh.state;
|
|
13797
13994
|
if (isInsideNativeMenu) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function() {
|
|
@@ -13805,27 +14002,6 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13805
14002
|
var _callbacksRef_current_onPressOut, _callbacksRef_current;
|
|
13806
14003
|
(_callbacksRef_current_onPressOut = (_callbacksRef_current = callbacksRef.current).onPressOut) === null || _callbacksRef_current_onPressOut === void 0 || _callbacksRef_current_onPressOut.call(_callbacksRef_current, {});
|
|
13807
14004
|
});
|
|
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
14005
|
else if (!getIsAndroid()) gestureRef.current = Gesture.Manual().runOnJS(true).manualActivation(true).onTouchesDown(function(e) {
|
|
13830
14006
|
var _callbacksRef_current_onPressIn, _callbacksRef_current;
|
|
13831
14007
|
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 +14021,20 @@ function useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNat
|
|
|
13845
14021
|
useMainThreadPressEvents(events, viewProps, hasPressEvents, debugName);
|
|
13846
14022
|
return null;
|
|
13847
14023
|
}
|
|
13848
|
-
function wrapWithGestureDetector(content, gesture,
|
|
14024
|
+
function wrapWithGestureDetector(content, gesture, _stateRef, isHOC, isCompositeComponent, hasRealPressEvents) {
|
|
13849
14025
|
if (isHOC || isCompositeComponent) return content;
|
|
13850
|
-
var { GestureDetector
|
|
13851
|
-
|
|
13852
|
-
if (!GestureDetector
|
|
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);
|
|
14026
|
+
var { GestureDetector } = getGestureHandler().state;
|
|
14027
|
+
if (!GestureDetector || !gesture) return content;
|
|
14028
|
+
if (!hasRealPressEvents) return react.default.createElement(GestureDetector, { gesture }, content);
|
|
13856
14029
|
if (isFabric) {
|
|
13857
14030
|
var claimed = react.default.cloneElement(content, { onStartShouldSetResponder: responderClaim });
|
|
13858
|
-
return react.default.createElement(GestureDetector, { gesture
|
|
14031
|
+
return react.default.createElement(GestureDetector, { gesture }, claimed);
|
|
13859
14032
|
}
|
|
13860
14033
|
return react.default.createElement(View$2, {
|
|
13861
14034
|
collapsable: false,
|
|
13862
14035
|
style: responderWrapperStyle,
|
|
13863
14036
|
onStartShouldSetResponder: responderClaim
|
|
13864
|
-
}, react.default.createElement(GestureDetector, { gesture
|
|
14037
|
+
}, react.default.createElement(GestureDetector, { gesture }, content));
|
|
13865
14038
|
}
|
|
13866
14039
|
var isFabric, isAndroidCache, getIsAndroid, isNativeDesktopCache, getIsNativeDesktop, responderClaim, responderWrapperStyle;
|
|
13867
14040
|
var init_eventHandling_native = __esmMin((() => {
|
|
@@ -15159,6 +15332,11 @@ function normalizeGroupKey(key, groupContext) {
|
|
|
15159
15332
|
function isValidStyleKey(key, validStyles, accept) {
|
|
15160
15333
|
return key in validStyles ? true : accept && key in accept;
|
|
15161
15334
|
}
|
|
15335
|
+
function shouldSkipNativeHoverProp(key, isMedia) {
|
|
15336
|
+
if (key === "hoverStyle") return true;
|
|
15337
|
+
if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
|
|
15338
|
+
return false;
|
|
15339
|
+
}
|
|
15162
15340
|
function mergeFlatTransforms(target, flatTransforms) {
|
|
15163
15341
|
Object.entries(flatTransforms).sort(function(param, param1) {
|
|
15164
15342
|
var [a] = param, [b] = param1;
|
|
@@ -15269,6 +15447,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15269
15447
|
viewProps[keyInit] = valInit;
|
|
15270
15448
|
return "continue";
|
|
15271
15449
|
}
|
|
15450
|
+
if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
|
|
15272
15451
|
if (accept) {
|
|
15273
15452
|
var accepted = accept[keyInit];
|
|
15274
15453
|
if ((accepted === "style" || accepted === "textStyle") && valInit && (typeof valInit === "undefined" ? "undefined" : _type_of$3(valInit)) === "object") {
|
|
@@ -15310,6 +15489,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15310
15489
|
var isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15311
15490
|
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
15312
15491
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
15492
|
+
if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
|
|
15313
15493
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
15314
15494
|
var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
|
|
15315
15495
|
var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
|
|
@@ -15347,6 +15527,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15347
15527
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15348
15528
|
isVariant = variants && key5 in variants;
|
|
15349
15529
|
if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
|
|
15530
|
+
if (shouldSkipNativeHoverProp(key5, isMedia)) return;
|
|
15350
15531
|
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
15532
|
var _props_key;
|
|
15352
15533
|
viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
@@ -15511,6 +15692,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15511
15692
|
var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
|
|
15512
15693
|
var groupPseudoKey = groupInfo.pseudo;
|
|
15513
15694
|
var groupMediaKey = groupInfo.media;
|
|
15695
|
+
if (groupPseudoKey === "hover") return;
|
|
15514
15696
|
if (!groupState) {
|
|
15515
15697
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
15516
15698
|
return;
|
|
@@ -15864,13 +16046,17 @@ var init_mergeRenderElementProps_native = __esmMin((() => {
|
|
|
15864
16046
|
function usePointerEvents(props, viewProps) {
|
|
15865
16047
|
var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
|
|
15866
16048
|
var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
|
|
15867
|
-
var
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
16049
|
+
var ref = (0, react.useRef)(null);
|
|
16050
|
+
if (!ref.current) ref.current = {
|
|
16051
|
+
isInside: false,
|
|
16052
|
+
layout: {
|
|
16053
|
+
width: 0,
|
|
16054
|
+
height: 0
|
|
16055
|
+
},
|
|
16056
|
+
isCaptured: false
|
|
16057
|
+
};
|
|
15873
16058
|
if (!hasPointerEvents) return;
|
|
16059
|
+
var bag = ref.current;
|
|
15874
16060
|
var createNormalizedEvent = function(e) {
|
|
15875
16061
|
var touch = e.nativeEvent;
|
|
15876
16062
|
var _touch_identifier;
|
|
@@ -15886,10 +16072,10 @@ function usePointerEvents(props, viewProps) {
|
|
|
15886
16072
|
nativeEvent: touch,
|
|
15887
16073
|
target: {
|
|
15888
16074
|
setPointerCapture: function(_pointerId) {
|
|
15889
|
-
|
|
16075
|
+
bag.isCaptured = true;
|
|
15890
16076
|
},
|
|
15891
16077
|
releasePointerCapture: function(_pointerId) {
|
|
15892
|
-
|
|
16078
|
+
bag.isCaptured = false;
|
|
15893
16079
|
}
|
|
15894
16080
|
}
|
|
15895
16081
|
});
|
|
@@ -15898,46 +16084,46 @@ function usePointerEvents(props, viewProps) {
|
|
|
15898
16084
|
onPointerDown(createNormalizedEvent(e));
|
|
15899
16085
|
});
|
|
15900
16086
|
if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15901
|
-
|
|
16087
|
+
bag.isCaptured = false;
|
|
15902
16088
|
onPointerUp(createNormalizedEvent(e));
|
|
15903
16089
|
});
|
|
15904
16090
|
if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15905
16091
|
var { locationX, locationY } = e.nativeEvent;
|
|
15906
|
-
var { width, height } =
|
|
16092
|
+
var { width, height } = bag.layout;
|
|
15907
16093
|
var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15908
|
-
if (
|
|
16094
|
+
if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
|
|
15909
16095
|
});
|
|
15910
16096
|
if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
|
|
15911
|
-
|
|
16097
|
+
bag.isCaptured = false;
|
|
15912
16098
|
onPointerCancel(createNormalizedEvent(e));
|
|
15913
16099
|
});
|
|
15914
16100
|
if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
|
|
15915
|
-
|
|
16101
|
+
bag.layout = {
|
|
15916
16102
|
width: e.nativeEvent.layout.width,
|
|
15917
16103
|
height: e.nativeEvent.layout.height
|
|
15918
16104
|
};
|
|
15919
16105
|
});
|
|
15920
16106
|
if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
|
|
15921
16107
|
var { locationX, locationY } = e.nativeEvent;
|
|
15922
|
-
var { width, height } =
|
|
16108
|
+
var { width, height } = bag.layout;
|
|
15923
16109
|
if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
|
|
15924
|
-
|
|
16110
|
+
bag.isInside = true;
|
|
15925
16111
|
onPointerEnter(createNormalizedEvent(e));
|
|
15926
16112
|
}
|
|
15927
16113
|
});
|
|
15928
16114
|
if (onPointerLeave) {
|
|
15929
16115
|
viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15930
16116
|
var { locationX, locationY } = e.nativeEvent;
|
|
15931
|
-
var { width, height } =
|
|
16117
|
+
var { width, height } = bag.layout;
|
|
15932
16118
|
var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15933
|
-
if (
|
|
15934
|
-
|
|
16119
|
+
if (bag.isInside && !isInside) {
|
|
16120
|
+
bag.isInside = false;
|
|
15935
16121
|
onPointerLeave(createNormalizedEvent(e));
|
|
15936
16122
|
}
|
|
15937
16123
|
});
|
|
15938
16124
|
viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15939
|
-
if (
|
|
15940
|
-
|
|
16125
|
+
if (bag.isInside) {
|
|
16126
|
+
bag.isInside = false;
|
|
15941
16127
|
onPointerLeave(createNormalizedEvent(e));
|
|
15942
16128
|
}
|
|
15943
16129
|
});
|
|
@@ -16133,7 +16319,7 @@ var init_Theme_native = __esmMin((() => {
|
|
|
16133
16319
|
if (props.disable) return props.children;
|
|
16134
16320
|
var { passThrough } = props;
|
|
16135
16321
|
var isRoot = !!props["_isRoot"];
|
|
16136
|
-
var [_, themeState] = useThemeWithState(props, isRoot);
|
|
16322
|
+
var [_, themeState] = useThemeWithState(props, isRoot, true);
|
|
16137
16323
|
var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
|
|
16138
16324
|
return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
|
|
16139
16325
|
}) : props.children;
|
|
@@ -16302,7 +16488,15 @@ var init_useComponentState_native = __esmMin((() => {
|
|
|
16302
16488
|
});
|
|
16303
16489
|
}
|
|
16304
16490
|
var groupName = props.group;
|
|
16305
|
-
|
|
16491
|
+
if (!stateRef.current.baseSetStateShallow) {
|
|
16492
|
+
var r = stateRef.current;
|
|
16493
|
+
r.baseSetStateShallow = function(stateOrGetState) {
|
|
16494
|
+
setState(function(prev) {
|
|
16495
|
+
return mergeIfNotShallowEqual(prev, typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState);
|
|
16496
|
+
});
|
|
16497
|
+
};
|
|
16498
|
+
}
|
|
16499
|
+
var setStateShallow = stateRef.current.baseSetStateShallow;
|
|
16306
16500
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
16307
16501
|
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
16308
16502
|
if (isObj(custom)) Object.assign(props, custom);
|
|
@@ -16422,7 +16616,7 @@ function createComponent(staticConfig) {
|
|
|
16422
16616
|
var overriddenContextProps = null;
|
|
16423
16617
|
var componentContext = react.default.useContext(ComponentContext);
|
|
16424
16618
|
var hasTextAncestor = false;
|
|
16425
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
16619
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
16426
16620
|
var props = propsIn;
|
|
16427
16621
|
var componentName = props.componentName || staticConfig.componentName;
|
|
16428
16622
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -16856,7 +17050,8 @@ function createComponent(staticConfig) {
|
|
|
16856
17050
|
var propsInWithHref = propsIn;
|
|
16857
17051
|
var _props_testID, _ref, _ref1, _ref2, _ref3;
|
|
16858
17052
|
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
|
|
17053
|
+
var hasRealPressEvents = !!(onPress || onPressIn || onPressOut || onLongPress);
|
|
17054
|
+
var pressGesture = useEvents(events, viewProps, stateRef, staticConfig, isHOC, isInsideNativeMenu, pressDebugName, hasRealPressEvents);
|
|
16860
17055
|
if (asChild) {
|
|
16861
17056
|
elementType = Slot;
|
|
16862
17057
|
Object.assign(viewProps, {
|
|
@@ -16881,7 +17076,7 @@ function createComponent(staticConfig) {
|
|
|
16881
17076
|
content = /* @__PURE__ */ react.default.createElement(elementType, viewProps, content || children);
|
|
16882
17077
|
}
|
|
16883
17078
|
}
|
|
16884
|
-
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string");
|
|
17079
|
+
content = wrapWithGestureDetector(content, pressGesture, stateRef, isHOC, !isHOC && Component && typeof Component !== "string", hasRealPressEvents);
|
|
16885
17080
|
var ResetPresence = animationDriver === null || animationDriver === void 0 ? void 0 : animationDriver.ResetPresence;
|
|
16886
17081
|
var needsReset = Boolean(!asChild && splitStyles && !isHOC && ResetPresence && willBeAnimated && (hasEnterStyle || presenceState));
|
|
16887
17082
|
var hasEverReset = stateRef.current.hasEverResetPresence;
|
|
@@ -19005,6 +19200,7 @@ exports.rgba = rgba;
|
|
|
19005
19200
|
exports.setConfig = setConfig;
|
|
19006
19201
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
19007
19202
|
exports.setIdentifierValue = setIdentifierValue;
|
|
19203
|
+
exports.setMediaState = setMediaState;
|
|
19008
19204
|
exports.setNonce = setNonce;
|
|
19009
19205
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
19010
19206
|
exports.setRef = setRef;
|
|
@@ -19030,6 +19226,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
19030
19226
|
exports.transformsToString = transformsToString;
|
|
19031
19227
|
exports.updateConfig = updateConfig;
|
|
19032
19228
|
exports.updateFont = updateFont;
|
|
19229
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
19033
19230
|
exports.useClientValue = useClientValue;
|
|
19034
19231
|
exports.useComposedRefs = useComposedRefs;
|
|
19035
19232
|
exports.useConfiguration = useConfiguration;
|