@tamagui/core 2.3.2 → 2.3.3-1782465561627
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 +313 -122
- package/dist/test.native.cjs +310 -120
- package/package.json +10 -10
package/.turbo/turbo-build.log
CHANGED
package/dist/native.cjs
CHANGED
|
@@ -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)
|
|
12165
|
-
|
|
12166
|
-
|
|
12167
|
-
|
|
12168
|
-
|
|
12169
|
-
|
|
12170
|
-
|
|
12171
|
-
|
|
12172
|
-
|
|
12173
|
-
|
|
12174
|
-
|
|
12175
|
-
|
|
12176
|
-
var
|
|
12177
|
-
|
|
12178
|
-
|
|
12179
|
-
|
|
12180
|
-
|
|
12181
|
-
|
|
12182
|
-
|
|
12183
|
-
|
|
12184
|
-
|
|
12185
|
-
|
|
12186
|
-
|
|
12187
|
-
|
|
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
|
-
|
|
12194
|
-
|
|
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
|
-
|
|
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
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
12276
|
-
|
|
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
|
|
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;
|
|
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
|
-
|
|
13175
|
-
|
|
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;
|
|
@@ -13324,10 +13475,14 @@ var init_useTheme_native = __esmMin((() => {
|
|
|
13324
13475
|
};
|
|
13325
13476
|
useThemeWithState = function(props) {
|
|
13326
13477
|
"use no memo";
|
|
13327
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
13328
|
-
var
|
|
13329
|
-
|
|
13330
|
-
|
|
13478
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
13479
|
+
var bag = (0, react.useRef)(null);
|
|
13480
|
+
if (!bag.current) bag.current = {
|
|
13481
|
+
keys: { current: null },
|
|
13482
|
+
schemeKeys: { current: null }
|
|
13483
|
+
};
|
|
13484
|
+
var { keys, schemeKeys } = bag.current;
|
|
13485
|
+
var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
|
|
13331
13486
|
return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
|
|
13332
13487
|
};
|
|
13333
13488
|
}));
|
|
@@ -15159,6 +15314,11 @@ function normalizeGroupKey(key, groupContext) {
|
|
|
15159
15314
|
function isValidStyleKey(key, validStyles, accept) {
|
|
15160
15315
|
return key in validStyles ? true : accept && key in accept;
|
|
15161
15316
|
}
|
|
15317
|
+
function shouldSkipNativeHoverProp(key, isMedia) {
|
|
15318
|
+
if (key === "hoverStyle") return true;
|
|
15319
|
+
if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
|
|
15320
|
+
return false;
|
|
15321
|
+
}
|
|
15162
15322
|
function mergeFlatTransforms(target, flatTransforms) {
|
|
15163
15323
|
Object.entries(flatTransforms).sort(function(param, param1) {
|
|
15164
15324
|
var [a] = param, [b] = param1;
|
|
@@ -15269,6 +15429,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15269
15429
|
viewProps[keyInit] = valInit;
|
|
15270
15430
|
return "continue";
|
|
15271
15431
|
}
|
|
15432
|
+
if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
|
|
15272
15433
|
if (accept) {
|
|
15273
15434
|
var accepted = accept[keyInit];
|
|
15274
15435
|
if ((accepted === "style" || accepted === "textStyle") && valInit && (typeof valInit === "undefined" ? "undefined" : _type_of$3(valInit)) === "object") {
|
|
@@ -15310,6 +15471,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15310
15471
|
var isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15311
15472
|
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
15312
15473
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
15474
|
+
if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
|
|
15313
15475
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
15314
15476
|
var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
|
|
15315
15477
|
var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
|
|
@@ -15347,6 +15509,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15347
15509
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15348
15510
|
isVariant = variants && key5 in variants;
|
|
15349
15511
|
if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
|
|
15512
|
+
if (shouldSkipNativeHoverProp(key5, isMedia)) return;
|
|
15350
15513
|
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
15514
|
var _props_key;
|
|
15352
15515
|
viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
@@ -15511,6 +15674,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15511
15674
|
var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
|
|
15512
15675
|
var groupPseudoKey = groupInfo.pseudo;
|
|
15513
15676
|
var groupMediaKey = groupInfo.media;
|
|
15677
|
+
if (groupPseudoKey === "hover") return;
|
|
15514
15678
|
if (!groupState) {
|
|
15515
15679
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
15516
15680
|
return;
|
|
@@ -15864,13 +16028,17 @@ var init_mergeRenderElementProps_native = __esmMin((() => {
|
|
|
15864
16028
|
function usePointerEvents(props, viewProps) {
|
|
15865
16029
|
var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
|
|
15866
16030
|
var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
|
|
15867
|
-
var
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
16031
|
+
var ref = (0, react.useRef)(null);
|
|
16032
|
+
if (!ref.current) ref.current = {
|
|
16033
|
+
isInside: false,
|
|
16034
|
+
layout: {
|
|
16035
|
+
width: 0,
|
|
16036
|
+
height: 0
|
|
16037
|
+
},
|
|
16038
|
+
isCaptured: false
|
|
16039
|
+
};
|
|
15873
16040
|
if (!hasPointerEvents) return;
|
|
16041
|
+
var bag = ref.current;
|
|
15874
16042
|
var createNormalizedEvent = function(e) {
|
|
15875
16043
|
var touch = e.nativeEvent;
|
|
15876
16044
|
var _touch_identifier;
|
|
@@ -15886,10 +16054,10 @@ function usePointerEvents(props, viewProps) {
|
|
|
15886
16054
|
nativeEvent: touch,
|
|
15887
16055
|
target: {
|
|
15888
16056
|
setPointerCapture: function(_pointerId) {
|
|
15889
|
-
|
|
16057
|
+
bag.isCaptured = true;
|
|
15890
16058
|
},
|
|
15891
16059
|
releasePointerCapture: function(_pointerId) {
|
|
15892
|
-
|
|
16060
|
+
bag.isCaptured = false;
|
|
15893
16061
|
}
|
|
15894
16062
|
}
|
|
15895
16063
|
});
|
|
@@ -15898,46 +16066,46 @@ function usePointerEvents(props, viewProps) {
|
|
|
15898
16066
|
onPointerDown(createNormalizedEvent(e));
|
|
15899
16067
|
});
|
|
15900
16068
|
if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15901
|
-
|
|
16069
|
+
bag.isCaptured = false;
|
|
15902
16070
|
onPointerUp(createNormalizedEvent(e));
|
|
15903
16071
|
});
|
|
15904
16072
|
if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15905
16073
|
var { locationX, locationY } = e.nativeEvent;
|
|
15906
|
-
var { width, height } =
|
|
16074
|
+
var { width, height } = bag.layout;
|
|
15907
16075
|
var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15908
|
-
if (
|
|
16076
|
+
if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
|
|
15909
16077
|
});
|
|
15910
16078
|
if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
|
|
15911
|
-
|
|
16079
|
+
bag.isCaptured = false;
|
|
15912
16080
|
onPointerCancel(createNormalizedEvent(e));
|
|
15913
16081
|
});
|
|
15914
16082
|
if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
|
|
15915
|
-
|
|
16083
|
+
bag.layout = {
|
|
15916
16084
|
width: e.nativeEvent.layout.width,
|
|
15917
16085
|
height: e.nativeEvent.layout.height
|
|
15918
16086
|
};
|
|
15919
16087
|
});
|
|
15920
16088
|
if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
|
|
15921
16089
|
var { locationX, locationY } = e.nativeEvent;
|
|
15922
|
-
var { width, height } =
|
|
16090
|
+
var { width, height } = bag.layout;
|
|
15923
16091
|
if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
|
|
15924
|
-
|
|
16092
|
+
bag.isInside = true;
|
|
15925
16093
|
onPointerEnter(createNormalizedEvent(e));
|
|
15926
16094
|
}
|
|
15927
16095
|
});
|
|
15928
16096
|
if (onPointerLeave) {
|
|
15929
16097
|
viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15930
16098
|
var { locationX, locationY } = e.nativeEvent;
|
|
15931
|
-
var { width, height } =
|
|
16099
|
+
var { width, height } = bag.layout;
|
|
15932
16100
|
var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15933
|
-
if (
|
|
15934
|
-
|
|
16101
|
+
if (bag.isInside && !isInside) {
|
|
16102
|
+
bag.isInside = false;
|
|
15935
16103
|
onPointerLeave(createNormalizedEvent(e));
|
|
15936
16104
|
}
|
|
15937
16105
|
});
|
|
15938
16106
|
viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15939
|
-
if (
|
|
15940
|
-
|
|
16107
|
+
if (bag.isInside) {
|
|
16108
|
+
bag.isInside = false;
|
|
15941
16109
|
onPointerLeave(createNormalizedEvent(e));
|
|
15942
16110
|
}
|
|
15943
16111
|
});
|
|
@@ -16133,7 +16301,7 @@ var init_Theme_native = __esmMin((() => {
|
|
|
16133
16301
|
if (props.disable) return props.children;
|
|
16134
16302
|
var { passThrough } = props;
|
|
16135
16303
|
var isRoot = !!props["_isRoot"];
|
|
16136
|
-
var [_, themeState] = useThemeWithState(props, isRoot);
|
|
16304
|
+
var [_, themeState] = useThemeWithState(props, isRoot, true);
|
|
16137
16305
|
var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
|
|
16138
16306
|
return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
|
|
16139
16307
|
}) : props.children;
|
|
@@ -16422,7 +16590,7 @@ function createComponent(staticConfig) {
|
|
|
16422
16590
|
var overriddenContextProps = null;
|
|
16423
16591
|
var componentContext = react.default.useContext(ComponentContext);
|
|
16424
16592
|
var hasTextAncestor = false;
|
|
16425
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
16593
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
16426
16594
|
var props = propsIn;
|
|
16427
16595
|
var componentName = props.componentName || staticConfig.componentName;
|
|
16428
16596
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -16908,9 +17076,21 @@ function createComponent(staticConfig) {
|
|
|
16908
17076
|
});
|
|
16909
17077
|
function notifyGroupSubscribers(groupContext, groupEmitter, pseudo) {
|
|
16910
17078
|
if (!groupContext || !groupEmitter) return;
|
|
16911
|
-
var
|
|
16912
|
-
|
|
16913
|
-
|
|
17079
|
+
var prevPseudo = groupContext.state.pseudo;
|
|
17080
|
+
var shouldReplacePseudo = !prevPseudo || "unmounted" in prevPseudo || "group" in prevPseudo || "hasDynGroupChildren" in prevPseudo || "transition" in prevPseudo;
|
|
17081
|
+
var nextPseudo = shouldReplacePseudo ? {} : prevPseudo;
|
|
17082
|
+
var didChange = shouldReplacePseudo;
|
|
17083
|
+
for (var i = 0; i < groupPseudoKeys.length; i++) {
|
|
17084
|
+
var key = groupPseudoKeys[i];
|
|
17085
|
+
var value = pseudo[key];
|
|
17086
|
+
if (nextPseudo[key] !== value) {
|
|
17087
|
+
nextPseudo[key] = value;
|
|
17088
|
+
didChange = true;
|
|
17089
|
+
} else if (didChange) nextPseudo[key] = value;
|
|
17090
|
+
}
|
|
17091
|
+
if (!didChange) return;
|
|
17092
|
+
groupContext.state.pseudo = nextPseudo;
|
|
17093
|
+
groupEmitter.emit(groupContext.state);
|
|
16914
17094
|
}
|
|
16915
17095
|
if (staticConfig.componentName) component.displayName = staticConfig.componentName;
|
|
16916
17096
|
var res = component;
|
|
@@ -16942,7 +17122,7 @@ function getRenderElementForPlatform(potential) {
|
|
|
16942
17122
|
function isHTMLElement(el) {
|
|
16943
17123
|
return typeof el["type"] === "string" && el["type"][0] === el["type"][0].toLowerCase();
|
|
16944
17124
|
}
|
|
16945
|
-
var _excluded$2, _excluded2$1, componentSetStates, avoidReRenderKeys, BaseText, BaseView, hasSetupBaseViews, lastInteractionWasKeyboard, lastInteractionWasTouch, fromPx, getCustomRender;
|
|
17125
|
+
var _excluded$2, _excluded2$1, componentSetStates, avoidReRenderKeys, groupPseudoKeys, BaseText, BaseView, hasSetupBaseViews, lastInteractionWasKeyboard, lastInteractionWasTouch, fromPx, getCustomRender;
|
|
16946
17126
|
var init_createComponent_native = __esmMin((() => {
|
|
16947
17127
|
init_index_native$4();
|
|
16948
17128
|
init_index_native$7();
|
|
@@ -17013,6 +17193,15 @@ var init_createComponent_native = __esmMin((() => {
|
|
|
17013
17193
|
"media",
|
|
17014
17194
|
"group"
|
|
17015
17195
|
]);
|
|
17196
|
+
groupPseudoKeys = [
|
|
17197
|
+
"disabled",
|
|
17198
|
+
"hover",
|
|
17199
|
+
"press",
|
|
17200
|
+
"pressIn",
|
|
17201
|
+
"focus",
|
|
17202
|
+
"focusVisible",
|
|
17203
|
+
"focusWithin"
|
|
17204
|
+
];
|
|
17016
17205
|
hasSetupBaseViews = false;
|
|
17017
17206
|
lastInteractionWasKeyboard = { value: false };
|
|
17018
17207
|
lastInteractionWasTouch = { value: false };
|
|
@@ -18984,6 +19173,7 @@ exports.rgba = rgba;
|
|
|
18984
19173
|
exports.setConfig = setConfig;
|
|
18985
19174
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
18986
19175
|
exports.setIdentifierValue = setIdentifierValue;
|
|
19176
|
+
exports.setMediaState = setMediaState;
|
|
18987
19177
|
exports.setNonce = setNonce;
|
|
18988
19178
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
18989
19179
|
exports.setRef = setRef;
|
|
@@ -19009,6 +19199,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
19009
19199
|
exports.transformsToString = transformsToString;
|
|
19010
19200
|
exports.updateConfig = updateConfig;
|
|
19011
19201
|
exports.updateFont = updateFont;
|
|
19202
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
19012
19203
|
exports.useClientValue = useClientValue;
|
|
19013
19204
|
exports.useComposedRefs = useComposedRefs;
|
|
19014
19205
|
exports.useConfiguration = useConfiguration;
|
package/dist/test.native.cjs
CHANGED
|
@@ -634,7 +634,6 @@ var getMediaKey = function(key) {
|
|
|
634
634
|
if (match) return match[1];
|
|
635
635
|
return false;
|
|
636
636
|
};
|
|
637
|
-
var initState;
|
|
638
637
|
var mediaKeysOrdered;
|
|
639
638
|
var getMediaKeyImportance = function(key) {
|
|
640
639
|
return mediaKeysOrdered.indexOf(key) + 100;
|
|
@@ -647,12 +646,13 @@ var configureMedia = function(config) {
|
|
|
647
646
|
if (!media) return;
|
|
648
647
|
mediaVersion++;
|
|
649
648
|
resetMediaStyleCache();
|
|
649
|
+
resetMediaTouchTracker();
|
|
650
650
|
for (var key in media) {
|
|
651
651
|
getMedia()[key] = (mediaQueryDefaultActive === null || mediaQueryDefaultActive === void 0 ? void 0 : mediaQueryDefaultActive[key]) || false;
|
|
652
652
|
mediaKeys.add(`$${key}`);
|
|
653
653
|
}
|
|
654
654
|
Object.assign(mediaQueryConfig, media);
|
|
655
|
-
|
|
655
|
+
_objectSpread2({}, getMedia());
|
|
656
656
|
mediaKeysOrdered = Object.keys(media);
|
|
657
657
|
setupMediaListeners();
|
|
658
658
|
};
|
|
@@ -696,6 +696,45 @@ function updateMediaListeners() {
|
|
|
696
696
|
});
|
|
697
697
|
}
|
|
698
698
|
var States = /* @__PURE__ */ new WeakMap();
|
|
699
|
+
var touchTrackerProto = null;
|
|
700
|
+
var refSlot = /* @__PURE__ */ Symbol("mediaRefSlot");
|
|
701
|
+
function buildTouchTrackerProto() {
|
|
702
|
+
var proto = {};
|
|
703
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
704
|
+
try {
|
|
705
|
+
var _loop = function() {
|
|
706
|
+
var fullKey = _step.value;
|
|
707
|
+
var key = fullKey[0] === "$" ? fullKey.slice(1) : fullKey;
|
|
708
|
+
proto[key] = {
|
|
709
|
+
enumerable: true,
|
|
710
|
+
configurable: true,
|
|
711
|
+
get() {
|
|
712
|
+
var slot = this[refSlot];
|
|
713
|
+
if (!disableMediaTouch) slot.keys.add(key);
|
|
714
|
+
return slot.proxyTarget[key];
|
|
715
|
+
}
|
|
716
|
+
};
|
|
717
|
+
};
|
|
718
|
+
for (var _iterator = mediaKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) _loop();
|
|
719
|
+
} catch (err) {
|
|
720
|
+
_didIteratorError = true;
|
|
721
|
+
_iteratorError = err;
|
|
722
|
+
} finally {
|
|
723
|
+
try {
|
|
724
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
725
|
+
} finally {
|
|
726
|
+
if (_didIteratorError) throw _iteratorError;
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
return Object.create(null, proto);
|
|
730
|
+
}
|
|
731
|
+
function getTouchTrackerProto() {
|
|
732
|
+
if (!touchTrackerProto) touchTrackerProto = buildTouchTrackerProto();
|
|
733
|
+
return touchTrackerProto;
|
|
734
|
+
}
|
|
735
|
+
function resetMediaTouchTracker() {
|
|
736
|
+
touchTrackerProto = null;
|
|
737
|
+
}
|
|
699
738
|
function setMediaShouldUpdate(ref, enabled, keys) {
|
|
700
739
|
var cur = States.get(ref);
|
|
701
740
|
if (!cur || cur.enabled !== enabled || keys) States.set(ref, _objectSpread2(_objectSpread2({}, cur), {}, {
|
|
@@ -711,56 +750,102 @@ function subscribe(subscriber) {
|
|
|
711
750
|
}
|
|
712
751
|
function useMedia(componentContext, debug) {
|
|
713
752
|
"use no memo";
|
|
714
|
-
var componentState = componentContext ? States.get(componentContext) : null;
|
|
715
753
|
var internalRef = (0, react.useRef)(null);
|
|
716
|
-
if (!internalRef.current)
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
var
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
754
|
+
if (!internalRef.current) {
|
|
755
|
+
var initial = getMedia();
|
|
756
|
+
var r = {
|
|
757
|
+
keys: /* @__PURE__ */ new Set(),
|
|
758
|
+
lastState: initial,
|
|
759
|
+
renderVersion: 0,
|
|
760
|
+
proxyTarget: initial,
|
|
761
|
+
proxy: void 0,
|
|
762
|
+
getSnapshot: void 0,
|
|
763
|
+
componentContext,
|
|
764
|
+
debug
|
|
765
|
+
};
|
|
766
|
+
var tracker = Object.create(getTouchTrackerProto());
|
|
767
|
+
tracker[refSlot] = {
|
|
768
|
+
proxyTarget: initial,
|
|
769
|
+
keys: r.keys
|
|
770
|
+
};
|
|
771
|
+
r.proxy = tracker;
|
|
772
|
+
r.getSnapshot = function() {
|
|
773
|
+
var _States_get;
|
|
774
|
+
var curKeys = r.componentContext ? ((_States_get = States.get(r.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.keys) || r.keys : r.keys;
|
|
775
|
+
var { lastState, pendingState } = r;
|
|
776
|
+
if (!curKeys.size) return lastState;
|
|
777
|
+
var ms = getMedia();
|
|
778
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
779
|
+
try {
|
|
780
|
+
for (var _iterator = curKeys[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
781
|
+
var key = _step.value;
|
|
782
|
+
if (ms[key] !== (pendingState || lastState)[key]) {
|
|
783
|
+
var _r_componentContext;
|
|
784
|
+
if ((_r_componentContext = r.componentContext) === null || _r_componentContext === void 0 ? void 0 : _r_componentContext.mediaEmit) {
|
|
785
|
+
r.componentContext.mediaEmit(ms);
|
|
786
|
+
r.pendingState = ms;
|
|
787
|
+
return lastState;
|
|
788
|
+
}
|
|
789
|
+
r.lastState = ms;
|
|
790
|
+
return ms;
|
|
740
791
|
}
|
|
741
|
-
internalRef.current.lastState = ms;
|
|
742
|
-
return ms;
|
|
743
792
|
}
|
|
744
|
-
}
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
_iteratorError = err;
|
|
748
|
-
} finally {
|
|
749
|
-
try {
|
|
750
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
793
|
+
} catch (err) {
|
|
794
|
+
_didIteratorError = true;
|
|
795
|
+
_iteratorError = err;
|
|
751
796
|
} finally {
|
|
752
|
-
|
|
797
|
+
try {
|
|
798
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
799
|
+
} finally {
|
|
800
|
+
if (_didIteratorError) throw _iteratorError;
|
|
801
|
+
}
|
|
753
802
|
}
|
|
803
|
+
return lastState;
|
|
804
|
+
};
|
|
805
|
+
internalRef.current = r;
|
|
806
|
+
} else {
|
|
807
|
+
internalRef.current.componentContext = componentContext;
|
|
808
|
+
internalRef.current.debug = debug;
|
|
809
|
+
}
|
|
810
|
+
var ref = internalRef.current;
|
|
811
|
+
ref.renderVersion++;
|
|
812
|
+
if (ref.pendingState) {
|
|
813
|
+
ref.lastState = ref.pendingState;
|
|
814
|
+
ref.pendingState = void 0;
|
|
815
|
+
}
|
|
816
|
+
if (ref.keys.size) ref.keys.clear();
|
|
817
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer$1, 0);
|
|
818
|
+
var state = ref.getSnapshot();
|
|
819
|
+
ref.proxyTarget = state;
|
|
820
|
+
ref.proxy[refSlot].proxyTarget = state;
|
|
821
|
+
(0, react.useEffect)(function() {
|
|
822
|
+
var _States_get;
|
|
823
|
+
var renderVersion = ref.renderVersion;
|
|
824
|
+
if (!ref.componentContext || !!((_States_get = States.get(ref.componentContext)) === null || _States_get === void 0 ? void 0 : _States_get.enabled)) {
|
|
825
|
+
if (!ref.unsubscribe) ref.unsubscribe = subscribe(function() {
|
|
826
|
+
var next = ref.getSnapshot();
|
|
827
|
+
if (next !== ref.proxyTarget) {
|
|
828
|
+
ref.proxyTarget = next;
|
|
829
|
+
ref.proxy[refSlot].proxyTarget = next;
|
|
830
|
+
forceUpdate();
|
|
831
|
+
}
|
|
832
|
+
});
|
|
833
|
+
} else if (ref.unsubscribe) {
|
|
834
|
+
ref.unsubscribe();
|
|
835
|
+
ref.unsubscribe = void 0;
|
|
754
836
|
}
|
|
755
|
-
return
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
837
|
+
return function() {
|
|
838
|
+
if (ref.renderVersion === renderVersion) {
|
|
839
|
+
var _ref_unsubscribe;
|
|
840
|
+
(_ref_unsubscribe = ref.unsubscribe) === null || _ref_unsubscribe === void 0 || _ref_unsubscribe.call(ref);
|
|
841
|
+
ref.unsubscribe = void 0;
|
|
842
|
+
}
|
|
843
|
+
};
|
|
844
|
+
});
|
|
845
|
+
return ref.proxy;
|
|
761
846
|
}
|
|
762
|
-
var
|
|
763
|
-
return
|
|
847
|
+
var incReducer$1 = function(c) {
|
|
848
|
+
return c + 1;
|
|
764
849
|
};
|
|
765
850
|
var disableMediaTouch = false;
|
|
766
851
|
function _disableMediaTouch(val) {
|
|
@@ -1400,9 +1485,12 @@ var getRootThemeState = function() {
|
|
|
1400
1485
|
var getThemeBaseName = function(name) {
|
|
1401
1486
|
return name.replace(/^(light|dark)_/, "");
|
|
1402
1487
|
};
|
|
1488
|
+
var incReducer = function(c) {
|
|
1489
|
+
return c + 1;
|
|
1490
|
+
};
|
|
1403
1491
|
var useThemeState = function(props) {
|
|
1404
1492
|
"use no memo";
|
|
1405
|
-
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;
|
|
1493
|
+
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;
|
|
1406
1494
|
var { disable } = props;
|
|
1407
1495
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
1408
1496
|
if (!parentId && !isRoot) throw new Error(MISSING_THEME_MESSAGE);
|
|
@@ -1412,53 +1500,69 @@ var useThemeState = function(props) {
|
|
|
1412
1500
|
theme: getConfig().themes.light
|
|
1413
1501
|
};
|
|
1414
1502
|
var id = (0, react.useId)();
|
|
1415
|
-
var subscribe = (0, react.useCallback)(function(cb) {
|
|
1416
|
-
listenersByParent[parentId] = listenersByParent[parentId] || /* @__PURE__ */ new Set();
|
|
1417
|
-
listenersByParent[parentId].add(id);
|
|
1418
|
-
allListeners.set(id, function() {
|
|
1419
|
-
PendingUpdate.set(id, shouldForce ? "force" : true);
|
|
1420
|
-
cb();
|
|
1421
|
-
});
|
|
1422
|
-
return function() {
|
|
1423
|
-
allListeners.delete(id);
|
|
1424
|
-
listenersByParent[parentId].delete(id);
|
|
1425
|
-
localStates.delete(id);
|
|
1426
|
-
states.delete(id);
|
|
1427
|
-
PendingUpdate.delete(id);
|
|
1428
|
-
};
|
|
1429
|
-
}, [id, parentId]);
|
|
1430
1503
|
var propsKey = getPropsKey(props);
|
|
1431
|
-
var
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
var _schemeKeys_current_size;
|
|
1442
|
-
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;
|
|
1443
|
-
var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
|
|
1444
|
-
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);
|
|
1445
|
-
var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
1446
|
-
PendingUpdate.delete(id);
|
|
1447
|
-
if (!local || rerender) {
|
|
1448
|
-
local = _objectSpread2({}, next);
|
|
1449
|
-
localStates.set(id, local);
|
|
1450
|
-
}
|
|
1451
|
-
if (next !== local) {
|
|
1452
|
-
Object.assign(local, next);
|
|
1453
|
-
local.id = id;
|
|
1454
|
-
}
|
|
1455
|
-
local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
|
|
1456
|
-
local._propsKey = propsKey;
|
|
1457
|
-
states.set(id, next);
|
|
1458
|
-
return local;
|
|
1504
|
+
var ref = (0, react.useRef)(null);
|
|
1505
|
+
if (!ref.current) ref.current = {
|
|
1506
|
+
id,
|
|
1507
|
+
parentId,
|
|
1508
|
+
props,
|
|
1509
|
+
propsKey,
|
|
1510
|
+
isRoot,
|
|
1511
|
+
keys,
|
|
1512
|
+
schemeKeys,
|
|
1513
|
+
renderVersion: 0
|
|
1459
1514
|
};
|
|
1460
|
-
|
|
1461
|
-
|
|
1515
|
+
else {
|
|
1516
|
+
ref.current.props = props;
|
|
1517
|
+
ref.current.propsKey = propsKey;
|
|
1518
|
+
ref.current.isRoot = isRoot;
|
|
1519
|
+
ref.current.keys = keys;
|
|
1520
|
+
ref.current.schemeKeys = schemeKeys;
|
|
1521
|
+
ref.current.parentId = parentId;
|
|
1522
|
+
}
|
|
1523
|
+
ref.current.renderVersion++;
|
|
1524
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer, 0);
|
|
1525
|
+
var state = getSnapshotImpl(ref.current);
|
|
1526
|
+
ref.current.lastSnap = state;
|
|
1527
|
+
(0, react.useEffect)(function() {
|
|
1528
|
+
var r = ref.current;
|
|
1529
|
+
var renderVersion = r.renderVersion;
|
|
1530
|
+
if (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);
|
|
1531
|
+
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
1532
|
+
if (!r.unsubscribe) {
|
|
1533
|
+
var pid = r.parentId;
|
|
1534
|
+
var sid = r.id;
|
|
1535
|
+
var cb = function() {
|
|
1536
|
+
var next = getSnapshotImpl(r);
|
|
1537
|
+
if (next !== r.lastSnap) {
|
|
1538
|
+
r.lastSnap = next;
|
|
1539
|
+
forceUpdate();
|
|
1540
|
+
}
|
|
1541
|
+
};
|
|
1542
|
+
listenersByParent[pid] = listenersByParent[pid] || /* @__PURE__ */ new Set();
|
|
1543
|
+
listenersByParent[pid].add(sid);
|
|
1544
|
+
allListeners.set(sid, function() {
|
|
1545
|
+
PendingUpdate.set(sid, shouldForce ? "force" : true);
|
|
1546
|
+
cb();
|
|
1547
|
+
});
|
|
1548
|
+
r.subscribedParentId = pid;
|
|
1549
|
+
r.unsubscribe = function() {
|
|
1550
|
+
var _listenersByParent_pid;
|
|
1551
|
+
allListeners.delete(sid);
|
|
1552
|
+
(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);
|
|
1553
|
+
localStates.delete(sid);
|
|
1554
|
+
states.delete(sid);
|
|
1555
|
+
PendingUpdate.delete(sid);
|
|
1556
|
+
r.unsubscribe = void 0;
|
|
1557
|
+
r.subscribedParentId = void 0;
|
|
1558
|
+
};
|
|
1559
|
+
}
|
|
1560
|
+
} else if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
1561
|
+
return function() {
|
|
1562
|
+
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
1563
|
+
};
|
|
1564
|
+
});
|
|
1565
|
+
if (cascadeOnChange) useIsomorphicLayoutEffect(function() {
|
|
1462
1566
|
if (!HasRenderedOnce.get(keys)) {
|
|
1463
1567
|
HasRenderedOnce.set(keys, true);
|
|
1464
1568
|
return;
|
|
@@ -1473,6 +1577,52 @@ var useThemeState = function(props) {
|
|
|
1473
1577
|
}, [keys, propsKey]);
|
|
1474
1578
|
return state;
|
|
1475
1579
|
};
|
|
1580
|
+
var shouldSubscribeToTheme = function(r, cascadeOnChange) {
|
|
1581
|
+
var _r_keys_current, _r_props_needsUpdate, _r_props;
|
|
1582
|
+
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));
|
|
1583
|
+
};
|
|
1584
|
+
function cleanupThemeSubscription(r) {
|
|
1585
|
+
var _r_unsubscribe;
|
|
1586
|
+
(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
|
|
1587
|
+
}
|
|
1588
|
+
function cleanupThemeState(r) {
|
|
1589
|
+
if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
1590
|
+
else {
|
|
1591
|
+
localStates.delete(r.id);
|
|
1592
|
+
states.delete(r.id);
|
|
1593
|
+
PendingUpdate.delete(r.id);
|
|
1594
|
+
}
|
|
1595
|
+
}
|
|
1596
|
+
var getSnapshotImpl = function(r) {
|
|
1597
|
+
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
|
|
1598
|
+
var { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r;
|
|
1599
|
+
var local = localStates.get(id);
|
|
1600
|
+
var parentState = states.get(parentId);
|
|
1601
|
+
if (local && !PendingUpdate.has(id)) {
|
|
1602
|
+
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
|
|
1603
|
+
}
|
|
1604
|
+
var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
1605
|
+
var _keys_current_size;
|
|
1606
|
+
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;
|
|
1607
|
+
var _schemeKeys_current_size;
|
|
1608
|
+
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;
|
|
1609
|
+
var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
|
|
1610
|
+
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);
|
|
1611
|
+
var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
1612
|
+
PendingUpdate.delete(id);
|
|
1613
|
+
if (!local || rerender) {
|
|
1614
|
+
local = _objectSpread2({}, next);
|
|
1615
|
+
localStates.set(id, local);
|
|
1616
|
+
}
|
|
1617
|
+
if (next !== local) {
|
|
1618
|
+
Object.assign(local, next);
|
|
1619
|
+
local.id = id;
|
|
1620
|
+
}
|
|
1621
|
+
local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
|
|
1622
|
+
local._propsKey = propsKey;
|
|
1623
|
+
states.set(id, next);
|
|
1624
|
+
return local;
|
|
1625
|
+
};
|
|
1476
1626
|
var getNextState = function(lastState, props, propsKey) {
|
|
1477
1627
|
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;
|
|
1478
1628
|
var { debug } = props;
|
|
@@ -1769,10 +1919,14 @@ var useTheme = function() {
|
|
|
1769
1919
|
};
|
|
1770
1920
|
var useThemeWithState = function(props) {
|
|
1771
1921
|
"use no memo";
|
|
1772
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1773
|
-
var
|
|
1774
|
-
|
|
1775
|
-
|
|
1922
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
1923
|
+
var bag = (0, react.useRef)(null);
|
|
1924
|
+
if (!bag.current) bag.current = {
|
|
1925
|
+
keys: { current: null },
|
|
1926
|
+
schemeKeys: { current: null }
|
|
1927
|
+
};
|
|
1928
|
+
var { keys, schemeKeys } = bag.current;
|
|
1929
|
+
var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
|
|
1776
1930
|
return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
|
|
1777
1931
|
};
|
|
1778
1932
|
//#endregion
|
|
@@ -3709,6 +3863,11 @@ function normalizeGroupKey(key, groupContext) {
|
|
|
3709
3863
|
function isValidStyleKey(key, validStyles, accept) {
|
|
3710
3864
|
return key in validStyles ? true : accept && key in accept;
|
|
3711
3865
|
}
|
|
3866
|
+
function shouldSkipNativeHoverProp(key, isMedia) {
|
|
3867
|
+
if (key === "hoverStyle") return true;
|
|
3868
|
+
if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
|
|
3869
|
+
return false;
|
|
3870
|
+
}
|
|
3712
3871
|
var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) {
|
|
3713
3872
|
var _loop = function(keyOg2) {
|
|
3714
3873
|
var keyInit = keyOg2;
|
|
@@ -3717,6 +3876,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3717
3876
|
viewProps[keyInit] = valInit;
|
|
3718
3877
|
return "continue";
|
|
3719
3878
|
}
|
|
3879
|
+
if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
|
|
3720
3880
|
if (keyInit === "jestAnimatedStyle") return "continue";
|
|
3721
3881
|
if (accept) {
|
|
3722
3882
|
var accepted = accept[keyInit];
|
|
@@ -3759,6 +3919,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3759
3919
|
var isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
3760
3920
|
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
3761
3921
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
3922
|
+
if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
|
|
3762
3923
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
3763
3924
|
var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
|
|
3764
3925
|
var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
|
|
@@ -3796,6 +3957,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3796
3957
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
3797
3958
|
isVariant = variants && key5 in variants;
|
|
3798
3959
|
if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
|
|
3960
|
+
if (shouldSkipNativeHoverProp(key5, isMedia)) return;
|
|
3799
3961
|
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))) {
|
|
3800
3962
|
var _props_key;
|
|
3801
3963
|
viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
@@ -3960,6 +4122,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3960
4122
|
var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
|
|
3961
4123
|
var groupPseudoKey = groupInfo.pseudo;
|
|
3962
4124
|
var groupMediaKey = groupInfo.media;
|
|
4125
|
+
if (groupPseudoKey === "hover") return;
|
|
3963
4126
|
if (!groupState) {
|
|
3964
4127
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
3965
4128
|
return;
|
|
@@ -4380,13 +4543,17 @@ function mergeRenderElementProps(elementProps, viewProps, children) {
|
|
|
4380
4543
|
function usePointerEvents(props, viewProps) {
|
|
4381
4544
|
var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
|
|
4382
4545
|
var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
|
|
4383
|
-
var
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4546
|
+
var ref = (0, react.useRef)(null);
|
|
4547
|
+
if (!ref.current) ref.current = {
|
|
4548
|
+
isInside: false,
|
|
4549
|
+
layout: {
|
|
4550
|
+
width: 0,
|
|
4551
|
+
height: 0
|
|
4552
|
+
},
|
|
4553
|
+
isCaptured: false
|
|
4554
|
+
};
|
|
4389
4555
|
if (!hasPointerEvents) return;
|
|
4556
|
+
var bag = ref.current;
|
|
4390
4557
|
var createNormalizedEvent = function(e) {
|
|
4391
4558
|
var touch = e.nativeEvent;
|
|
4392
4559
|
var _touch_identifier;
|
|
@@ -4402,10 +4569,10 @@ function usePointerEvents(props, viewProps) {
|
|
|
4402
4569
|
nativeEvent: touch,
|
|
4403
4570
|
target: {
|
|
4404
4571
|
setPointerCapture: function(_pointerId) {
|
|
4405
|
-
|
|
4572
|
+
bag.isCaptured = true;
|
|
4406
4573
|
},
|
|
4407
4574
|
releasePointerCapture: function(_pointerId) {
|
|
4408
|
-
|
|
4575
|
+
bag.isCaptured = false;
|
|
4409
4576
|
}
|
|
4410
4577
|
}
|
|
4411
4578
|
});
|
|
@@ -4414,46 +4581,46 @@ function usePointerEvents(props, viewProps) {
|
|
|
4414
4581
|
onPointerDown(createNormalizedEvent(e));
|
|
4415
4582
|
});
|
|
4416
4583
|
if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
4417
|
-
|
|
4584
|
+
bag.isCaptured = false;
|
|
4418
4585
|
onPointerUp(createNormalizedEvent(e));
|
|
4419
4586
|
});
|
|
4420
4587
|
if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
4421
4588
|
var { locationX, locationY } = e.nativeEvent;
|
|
4422
|
-
var { width, height } =
|
|
4589
|
+
var { width, height } = bag.layout;
|
|
4423
4590
|
var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
4424
|
-
if (
|
|
4591
|
+
if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
|
|
4425
4592
|
});
|
|
4426
4593
|
if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
|
|
4427
|
-
|
|
4594
|
+
bag.isCaptured = false;
|
|
4428
4595
|
onPointerCancel(createNormalizedEvent(e));
|
|
4429
4596
|
});
|
|
4430
4597
|
if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
|
|
4431
|
-
|
|
4598
|
+
bag.layout = {
|
|
4432
4599
|
width: e.nativeEvent.layout.width,
|
|
4433
4600
|
height: e.nativeEvent.layout.height
|
|
4434
4601
|
};
|
|
4435
4602
|
});
|
|
4436
4603
|
if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
|
|
4437
4604
|
var { locationX, locationY } = e.nativeEvent;
|
|
4438
|
-
var { width, height } =
|
|
4605
|
+
var { width, height } = bag.layout;
|
|
4439
4606
|
if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
|
|
4440
|
-
|
|
4607
|
+
bag.isInside = true;
|
|
4441
4608
|
onPointerEnter(createNormalizedEvent(e));
|
|
4442
4609
|
}
|
|
4443
4610
|
});
|
|
4444
4611
|
if (onPointerLeave) {
|
|
4445
4612
|
viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
4446
4613
|
var { locationX, locationY } = e.nativeEvent;
|
|
4447
|
-
var { width, height } =
|
|
4614
|
+
var { width, height } = bag.layout;
|
|
4448
4615
|
var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
4449
|
-
if (
|
|
4450
|
-
|
|
4616
|
+
if (bag.isInside && !isInside) {
|
|
4617
|
+
bag.isInside = false;
|
|
4451
4618
|
onPointerLeave(createNormalizedEvent(e));
|
|
4452
4619
|
}
|
|
4453
4620
|
});
|
|
4454
4621
|
viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
4455
|
-
if (
|
|
4456
|
-
|
|
4622
|
+
if (bag.isInside) {
|
|
4623
|
+
bag.isInside = false;
|
|
4457
4624
|
onPointerLeave(createNormalizedEvent(e));
|
|
4458
4625
|
}
|
|
4459
4626
|
});
|
|
@@ -4604,7 +4771,7 @@ var Theme = /* @__PURE__ */ (0, react.forwardRef)(function Theme2(props, ref) {
|
|
|
4604
4771
|
if (props.disable) return props.children;
|
|
4605
4772
|
var { passThrough } = props;
|
|
4606
4773
|
var isRoot = !!props["_isRoot"];
|
|
4607
|
-
var [_, themeState] = useThemeWithState(props, isRoot);
|
|
4774
|
+
var [_, themeState] = useThemeWithState(props, isRoot, true);
|
|
4608
4775
|
var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
|
|
4609
4776
|
return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
|
|
4610
4777
|
}) : props.children;
|
|
@@ -4900,6 +5067,15 @@ var avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
|
4900
5067
|
"media",
|
|
4901
5068
|
"group"
|
|
4902
5069
|
]);
|
|
5070
|
+
var groupPseudoKeys = [
|
|
5071
|
+
"disabled",
|
|
5072
|
+
"hover",
|
|
5073
|
+
"press",
|
|
5074
|
+
"pressIn",
|
|
5075
|
+
"focus",
|
|
5076
|
+
"focusVisible",
|
|
5077
|
+
"focusWithin"
|
|
5078
|
+
];
|
|
4903
5079
|
var BaseText;
|
|
4904
5080
|
var BaseView;
|
|
4905
5081
|
var hasSetupBaseViews = false;
|
|
@@ -4932,7 +5108,7 @@ function createComponent(staticConfig) {
|
|
|
4932
5108
|
var overriddenContextProps = null;
|
|
4933
5109
|
var componentContext = react.default.useContext(ComponentContext);
|
|
4934
5110
|
var hasTextAncestor = false;
|
|
4935
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
5111
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
4936
5112
|
var props = propsIn;
|
|
4937
5113
|
var componentName = props.componentName || staticConfig.componentName;
|
|
4938
5114
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -5418,9 +5594,21 @@ function createComponent(staticConfig) {
|
|
|
5418
5594
|
});
|
|
5419
5595
|
function notifyGroupSubscribers(groupContext, groupEmitter, pseudo) {
|
|
5420
5596
|
if (!groupContext || !groupEmitter) return;
|
|
5421
|
-
var
|
|
5422
|
-
|
|
5423
|
-
|
|
5597
|
+
var prevPseudo = groupContext.state.pseudo;
|
|
5598
|
+
var shouldReplacePseudo = !prevPseudo || "unmounted" in prevPseudo || "group" in prevPseudo || "hasDynGroupChildren" in prevPseudo || "transition" in prevPseudo;
|
|
5599
|
+
var nextPseudo = shouldReplacePseudo ? {} : prevPseudo;
|
|
5600
|
+
var didChange = shouldReplacePseudo;
|
|
5601
|
+
for (var i = 0; i < groupPseudoKeys.length; i++) {
|
|
5602
|
+
var key = groupPseudoKeys[i];
|
|
5603
|
+
var value = pseudo[key];
|
|
5604
|
+
if (nextPseudo[key] !== value) {
|
|
5605
|
+
nextPseudo[key] = value;
|
|
5606
|
+
didChange = true;
|
|
5607
|
+
} else if (didChange) nextPseudo[key] = value;
|
|
5608
|
+
}
|
|
5609
|
+
if (!didChange) return;
|
|
5610
|
+
groupContext.state.pseudo = nextPseudo;
|
|
5611
|
+
groupEmitter.emit(groupContext.state);
|
|
5424
5612
|
}
|
|
5425
5613
|
if (staticConfig.componentName) component.displayName = staticConfig.componentName;
|
|
5426
5614
|
var res = component;
|
|
@@ -7322,6 +7510,7 @@ exports.rgba = rgba;
|
|
|
7322
7510
|
exports.setConfig = setConfig;
|
|
7323
7511
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
7324
7512
|
exports.setIdentifierValue = setIdentifierValue;
|
|
7513
|
+
exports.setMediaState = setMediaState;
|
|
7325
7514
|
exports.setNonce = setNonce;
|
|
7326
7515
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
7327
7516
|
exports.setRef = setRef;
|
|
@@ -7347,6 +7536,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
7347
7536
|
exports.transformsToString = transformsToString;
|
|
7348
7537
|
exports.updateConfig = updateConfig;
|
|
7349
7538
|
exports.updateFont = updateFont;
|
|
7539
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
7350
7540
|
exports.useClientValue = useClientValue;
|
|
7351
7541
|
exports.useComposedRefs = useComposedRefs;
|
|
7352
7542
|
exports.useConfiguration = useConfiguration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.3-1782465561627",
|
|
4
4
|
"gitHead": "a49cc7ea6b93ba384e77a4880ae48ac4a5635c14",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": {
|
|
@@ -79,17 +79,17 @@
|
|
|
79
79
|
"clean:build": "tamagui-build clean:build"
|
|
80
80
|
},
|
|
81
81
|
"dependencies": {
|
|
82
|
-
"@tamagui/helpers": "2.3.
|
|
83
|
-
"@tamagui/react-native-media-driver": "2.3.
|
|
84
|
-
"@tamagui/react-native-use-pressable": "2.3.
|
|
85
|
-
"@tamagui/use-element-layout": "2.3.
|
|
86
|
-
"@tamagui/use-event": "2.3.
|
|
87
|
-
"@tamagui/web": "2.3.
|
|
82
|
+
"@tamagui/helpers": "2.3.3-1782465561627",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.3.3-1782465561627",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.3.3-1782465561627",
|
|
85
|
+
"@tamagui/use-element-layout": "2.3.3-1782465561627",
|
|
86
|
+
"@tamagui/use-event": "2.3.3-1782465561627",
|
|
87
|
+
"@tamagui/web": "2.3.3-1782465561627"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "2.3.
|
|
91
|
-
"@tamagui/native-bundle": "2.3.
|
|
92
|
-
"@tamagui/react-native-web-lite": "2.3.
|
|
90
|
+
"@tamagui/build": "2.3.3-1782465561627",
|
|
91
|
+
"@tamagui/native-bundle": "2.3.3-1782465561627",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.3.3-1782465561627",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|