@tamagui/core 2.3.3 → 2.4.0
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 +304 -122
- package/dist/test.native.cjs +302 -121
- 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;
|
|
@@ -13201,9 +13352,13 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13201
13352
|
return [shouldRerender, _objectSpread2(_objectSpread2({}, parentState), {}, { isNew: false })];
|
|
13202
13353
|
}
|
|
13203
13354
|
if (!name) {
|
|
13204
|
-
var
|
|
13205
|
-
|
|
13206
|
-
|
|
13355
|
+
var _ref, _ref1;
|
|
13356
|
+
var next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {
|
|
13357
|
+
id,
|
|
13358
|
+
name: "light",
|
|
13359
|
+
theme: getConfig().themes.light
|
|
13360
|
+
};
|
|
13361
|
+
if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
|
|
13207
13362
|
return [false, next];
|
|
13208
13363
|
}
|
|
13209
13364
|
var scheme = getScheme(name);
|
|
@@ -13324,10 +13479,14 @@ var init_useTheme_native = __esmMin((() => {
|
|
|
13324
13479
|
};
|
|
13325
13480
|
useThemeWithState = function(props) {
|
|
13326
13481
|
"use no memo";
|
|
13327
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
13328
|
-
var
|
|
13329
|
-
|
|
13330
|
-
|
|
13482
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
13483
|
+
var bag = (0, react.useRef)(null);
|
|
13484
|
+
if (!bag.current) bag.current = {
|
|
13485
|
+
keys: { current: null },
|
|
13486
|
+
schemeKeys: { current: null }
|
|
13487
|
+
};
|
|
13488
|
+
var { keys, schemeKeys } = bag.current;
|
|
13489
|
+
var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
|
|
13331
13490
|
return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
|
|
13332
13491
|
};
|
|
13333
13492
|
}));
|
|
@@ -15159,6 +15318,11 @@ function normalizeGroupKey(key, groupContext) {
|
|
|
15159
15318
|
function isValidStyleKey(key, validStyles, accept) {
|
|
15160
15319
|
return key in validStyles ? true : accept && key in accept;
|
|
15161
15320
|
}
|
|
15321
|
+
function shouldSkipNativeHoverProp(key, isMedia) {
|
|
15322
|
+
if (key === "hoverStyle") return true;
|
|
15323
|
+
if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
|
|
15324
|
+
return false;
|
|
15325
|
+
}
|
|
15162
15326
|
function mergeFlatTransforms(target, flatTransforms) {
|
|
15163
15327
|
Object.entries(flatTransforms).sort(function(param, param1) {
|
|
15164
15328
|
var [a] = param, [b] = param1;
|
|
@@ -15269,6 +15433,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15269
15433
|
viewProps[keyInit] = valInit;
|
|
15270
15434
|
return "continue";
|
|
15271
15435
|
}
|
|
15436
|
+
if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
|
|
15272
15437
|
if (accept) {
|
|
15273
15438
|
var accepted = accept[keyInit];
|
|
15274
15439
|
if ((accepted === "style" || accepted === "textStyle") && valInit && (typeof valInit === "undefined" ? "undefined" : _type_of$3(valInit)) === "object") {
|
|
@@ -15310,6 +15475,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15310
15475
|
var isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15311
15476
|
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
15312
15477
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
15478
|
+
if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
|
|
15313
15479
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
15314
15480
|
var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
|
|
15315
15481
|
var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
|
|
@@ -15347,6 +15513,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15347
15513
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
15348
15514
|
isVariant = variants && key5 in variants;
|
|
15349
15515
|
if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
|
|
15516
|
+
if (shouldSkipNativeHoverProp(key5, isMedia)) return;
|
|
15350
15517
|
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
15518
|
var _props_key;
|
|
15352
15519
|
viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
@@ -15511,6 +15678,7 @@ var init_getSplitStyles_native = __esmMin((() => {
|
|
|
15511
15678
|
var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
|
|
15512
15679
|
var groupPseudoKey = groupInfo.pseudo;
|
|
15513
15680
|
var groupMediaKey = groupInfo.media;
|
|
15681
|
+
if (groupPseudoKey === "hover") return;
|
|
15514
15682
|
if (!groupState) {
|
|
15515
15683
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
15516
15684
|
return;
|
|
@@ -15864,13 +16032,17 @@ var init_mergeRenderElementProps_native = __esmMin((() => {
|
|
|
15864
16032
|
function usePointerEvents(props, viewProps) {
|
|
15865
16033
|
var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
|
|
15866
16034
|
var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
|
|
15867
|
-
var
|
|
15868
|
-
|
|
15869
|
-
|
|
15870
|
-
|
|
15871
|
-
|
|
15872
|
-
|
|
16035
|
+
var ref = (0, react.useRef)(null);
|
|
16036
|
+
if (!ref.current) ref.current = {
|
|
16037
|
+
isInside: false,
|
|
16038
|
+
layout: {
|
|
16039
|
+
width: 0,
|
|
16040
|
+
height: 0
|
|
16041
|
+
},
|
|
16042
|
+
isCaptured: false
|
|
16043
|
+
};
|
|
15873
16044
|
if (!hasPointerEvents) return;
|
|
16045
|
+
var bag = ref.current;
|
|
15874
16046
|
var createNormalizedEvent = function(e) {
|
|
15875
16047
|
var touch = e.nativeEvent;
|
|
15876
16048
|
var _touch_identifier;
|
|
@@ -15886,10 +16058,10 @@ function usePointerEvents(props, viewProps) {
|
|
|
15886
16058
|
nativeEvent: touch,
|
|
15887
16059
|
target: {
|
|
15888
16060
|
setPointerCapture: function(_pointerId) {
|
|
15889
|
-
|
|
16061
|
+
bag.isCaptured = true;
|
|
15890
16062
|
},
|
|
15891
16063
|
releasePointerCapture: function(_pointerId) {
|
|
15892
|
-
|
|
16064
|
+
bag.isCaptured = false;
|
|
15893
16065
|
}
|
|
15894
16066
|
}
|
|
15895
16067
|
});
|
|
@@ -15898,46 +16070,46 @@ function usePointerEvents(props, viewProps) {
|
|
|
15898
16070
|
onPointerDown(createNormalizedEvent(e));
|
|
15899
16071
|
});
|
|
15900
16072
|
if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15901
|
-
|
|
16073
|
+
bag.isCaptured = false;
|
|
15902
16074
|
onPointerUp(createNormalizedEvent(e));
|
|
15903
16075
|
});
|
|
15904
16076
|
if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15905
16077
|
var { locationX, locationY } = e.nativeEvent;
|
|
15906
|
-
var { width, height } =
|
|
16078
|
+
var { width, height } = bag.layout;
|
|
15907
16079
|
var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15908
|
-
if (
|
|
16080
|
+
if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
|
|
15909
16081
|
});
|
|
15910
16082
|
if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
|
|
15911
|
-
|
|
16083
|
+
bag.isCaptured = false;
|
|
15912
16084
|
onPointerCancel(createNormalizedEvent(e));
|
|
15913
16085
|
});
|
|
15914
16086
|
if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
|
|
15915
|
-
|
|
16087
|
+
bag.layout = {
|
|
15916
16088
|
width: e.nativeEvent.layout.width,
|
|
15917
16089
|
height: e.nativeEvent.layout.height
|
|
15918
16090
|
};
|
|
15919
16091
|
});
|
|
15920
16092
|
if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
|
|
15921
16093
|
var { locationX, locationY } = e.nativeEvent;
|
|
15922
|
-
var { width, height } =
|
|
16094
|
+
var { width, height } = bag.layout;
|
|
15923
16095
|
if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
|
|
15924
|
-
|
|
16096
|
+
bag.isInside = true;
|
|
15925
16097
|
onPointerEnter(createNormalizedEvent(e));
|
|
15926
16098
|
}
|
|
15927
16099
|
});
|
|
15928
16100
|
if (onPointerLeave) {
|
|
15929
16101
|
viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
15930
16102
|
var { locationX, locationY } = e.nativeEvent;
|
|
15931
|
-
var { width, height } =
|
|
16103
|
+
var { width, height } = bag.layout;
|
|
15932
16104
|
var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
15933
|
-
if (
|
|
15934
|
-
|
|
16105
|
+
if (bag.isInside && !isInside) {
|
|
16106
|
+
bag.isInside = false;
|
|
15935
16107
|
onPointerLeave(createNormalizedEvent(e));
|
|
15936
16108
|
}
|
|
15937
16109
|
});
|
|
15938
16110
|
viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
15939
|
-
if (
|
|
15940
|
-
|
|
16111
|
+
if (bag.isInside) {
|
|
16112
|
+
bag.isInside = false;
|
|
15941
16113
|
onPointerLeave(createNormalizedEvent(e));
|
|
15942
16114
|
}
|
|
15943
16115
|
});
|
|
@@ -16133,7 +16305,7 @@ var init_Theme_native = __esmMin((() => {
|
|
|
16133
16305
|
if (props.disable) return props.children;
|
|
16134
16306
|
var { passThrough } = props;
|
|
16135
16307
|
var isRoot = !!props["_isRoot"];
|
|
16136
|
-
var [_, themeState] = useThemeWithState(props, isRoot);
|
|
16308
|
+
var [_, themeState] = useThemeWithState(props, isRoot, true);
|
|
16137
16309
|
var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
|
|
16138
16310
|
return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
|
|
16139
16311
|
}) : props.children;
|
|
@@ -16302,7 +16474,15 @@ var init_useComponentState_native = __esmMin((() => {
|
|
|
16302
16474
|
});
|
|
16303
16475
|
}
|
|
16304
16476
|
var groupName = props.group;
|
|
16305
|
-
|
|
16477
|
+
if (!stateRef.current.baseSetStateShallow) {
|
|
16478
|
+
var r = stateRef.current;
|
|
16479
|
+
r.baseSetStateShallow = function(stateOrGetState) {
|
|
16480
|
+
setState(function(prev) {
|
|
16481
|
+
return mergeIfNotShallowEqual(prev, typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState);
|
|
16482
|
+
});
|
|
16483
|
+
};
|
|
16484
|
+
}
|
|
16485
|
+
var setStateShallow = stateRef.current.baseSetStateShallow;
|
|
16306
16486
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
16307
16487
|
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
16308
16488
|
if (isObj(custom)) Object.assign(props, custom);
|
|
@@ -16422,7 +16602,7 @@ function createComponent(staticConfig) {
|
|
|
16422
16602
|
var overriddenContextProps = null;
|
|
16423
16603
|
var componentContext = react.default.useContext(ComponentContext);
|
|
16424
16604
|
var hasTextAncestor = false;
|
|
16425
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
16605
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
16426
16606
|
var props = propsIn;
|
|
16427
16607
|
var componentName = props.componentName || staticConfig.componentName;
|
|
16428
16608
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -19005,6 +19185,7 @@ exports.rgba = rgba;
|
|
|
19005
19185
|
exports.setConfig = setConfig;
|
|
19006
19186
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
19007
19187
|
exports.setIdentifierValue = setIdentifierValue;
|
|
19188
|
+
exports.setMediaState = setMediaState;
|
|
19008
19189
|
exports.setNonce = setNonce;
|
|
19009
19190
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
19010
19191
|
exports.setRef = setRef;
|
|
@@ -19030,6 +19211,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
19030
19211
|
exports.transformsToString = transformsToString;
|
|
19031
19212
|
exports.updateConfig = updateConfig;
|
|
19032
19213
|
exports.updateFont = updateFont;
|
|
19214
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
19033
19215
|
exports.useClientValue = useClientValue;
|
|
19034
19216
|
exports.useComposedRefs = useComposedRefs;
|
|
19035
19217
|
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;
|
|
@@ -1487,9 +1637,13 @@ var getNextState = function(lastState, props, propsKey) {
|
|
|
1487
1637
|
return [shouldRerender, _objectSpread2(_objectSpread2({}, parentState), {}, { isNew: false })];
|
|
1488
1638
|
}
|
|
1489
1639
|
if (!name) {
|
|
1490
|
-
var
|
|
1491
|
-
|
|
1492
|
-
|
|
1640
|
+
var _ref, _ref1;
|
|
1641
|
+
var next = (_ref1 = (_ref = lastState !== null && lastState !== void 0 ? lastState : parentState) !== null && _ref !== void 0 ? _ref : rootThemeState) !== null && _ref1 !== void 0 ? _ref1 : {
|
|
1642
|
+
id,
|
|
1643
|
+
name: "light",
|
|
1644
|
+
theme: getConfig().themes.light
|
|
1645
|
+
};
|
|
1646
|
+
if (shouldRerender) return [true, _objectSpread2({}, parentState || lastState || next)];
|
|
1493
1647
|
return [false, next];
|
|
1494
1648
|
}
|
|
1495
1649
|
var scheme = getScheme(name);
|
|
@@ -1769,10 +1923,14 @@ var useTheme = function() {
|
|
|
1769
1923
|
};
|
|
1770
1924
|
var useThemeWithState = function(props) {
|
|
1771
1925
|
"use no memo";
|
|
1772
|
-
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
1773
|
-
var
|
|
1774
|
-
|
|
1775
|
-
|
|
1926
|
+
var isRoot = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false, forThemeView = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
1927
|
+
var bag = (0, react.useRef)(null);
|
|
1928
|
+
if (!bag.current) bag.current = {
|
|
1929
|
+
keys: { current: null },
|
|
1930
|
+
schemeKeys: { current: null }
|
|
1931
|
+
};
|
|
1932
|
+
var { keys, schemeKeys } = bag.current;
|
|
1933
|
+
var themeState = useThemeState(props, isRoot, keys, schemeKeys, forThemeView);
|
|
1776
1934
|
return [props.passThrough ? {} : getThemeProxied(props, themeState, keys, schemeKeys), themeState];
|
|
1777
1935
|
};
|
|
1778
1936
|
//#endregion
|
|
@@ -3709,6 +3867,11 @@ function normalizeGroupKey(key, groupContext) {
|
|
|
3709
3867
|
function isValidStyleKey(key, validStyles, accept) {
|
|
3710
3868
|
return key in validStyles ? true : accept && key in accept;
|
|
3711
3869
|
}
|
|
3870
|
+
function shouldSkipNativeHoverProp(key, isMedia) {
|
|
3871
|
+
if (key === "hoverStyle") return true;
|
|
3872
|
+
if (isMedia === "group") return getGroupPropParts(key.slice(1)).pseudo === "hover";
|
|
3873
|
+
return false;
|
|
3874
|
+
}
|
|
3712
3875
|
var getSplitStyles = function(props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, componentContext, groupContext, elementType, startedUnhydrated, debug, animationDriver) {
|
|
3713
3876
|
var _loop = function(keyOg2) {
|
|
3714
3877
|
var keyInit = keyOg2;
|
|
@@ -3717,6 +3880,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3717
3880
|
viewProps[keyInit] = valInit;
|
|
3718
3881
|
return "continue";
|
|
3719
3882
|
}
|
|
3883
|
+
if (keyInit[0] === "d" && keyInit.startsWith("data-")) return "continue";
|
|
3720
3884
|
if (keyInit === "jestAnimatedStyle") return "continue";
|
|
3721
3885
|
if (accept) {
|
|
3722
3886
|
var accepted = accept[keyInit];
|
|
@@ -3759,6 +3923,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3759
3923
|
var isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
3760
3924
|
if (isMediaOrPseudo && isMedia === "group") keyInit = normalizeGroupKey(keyInit, groupContext);
|
|
3761
3925
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
3926
|
+
if (shouldSkipNativeHoverProp(keyInit, isMedia)) return "continue";
|
|
3762
3927
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
3763
3928
|
var shouldPassProp = !isStyleProp && isHOC || isHOC && parentVariants && keyInit in parentVariants || (inlineProps === null || inlineProps === void 0 ? void 0 : inlineProps.has(keyInit));
|
|
3764
3929
|
var parentVariant = parentVariants === null || parentVariants === void 0 ? void 0 : parentVariants[keyInit];
|
|
@@ -3796,6 +3961,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3796
3961
|
isMediaOrPseudo = Boolean(isMedia || isPseudo);
|
|
3797
3962
|
isVariant = variants && key5 in variants;
|
|
3798
3963
|
if (isMedia === "group") key5 = normalizeGroupKey(key5, groupContext);
|
|
3964
|
+
if (shouldSkipNativeHoverProp(key5, isMedia)) return;
|
|
3799
3965
|
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
3966
|
var _props_key;
|
|
3801
3967
|
viewProps[key5] = (_props_key = props[key5]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
@@ -3960,6 +4126,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3960
4126
|
var groupState = groupContext === null || groupContext === void 0 ? void 0 : (_groupContext_groupName = groupContext[groupName]) === null || _groupContext_groupName === void 0 ? void 0 : _groupContext_groupName.state;
|
|
3961
4127
|
var groupPseudoKey = groupInfo.pseudo;
|
|
3962
4128
|
var groupMediaKey = groupInfo.media;
|
|
4129
|
+
if (groupPseudoKey === "hover") return;
|
|
3963
4130
|
if (!groupState) {
|
|
3964
4131
|
pseudoGroups || (pseudoGroups = /* @__PURE__ */ new Set());
|
|
3965
4132
|
return;
|
|
@@ -4380,13 +4547,17 @@ function mergeRenderElementProps(elementProps, viewProps, children) {
|
|
|
4380
4547
|
function usePointerEvents(props, viewProps) {
|
|
4381
4548
|
var { onPointerDown, onPointerUp, onPointerMove, onPointerCancel, onPointerEnter, onPointerLeave } = props;
|
|
4382
4549
|
var hasPointerEvents = onPointerDown || onPointerUp || onPointerMove || onPointerCancel || onPointerEnter || onPointerLeave;
|
|
4383
|
-
var
|
|
4384
|
-
|
|
4385
|
-
|
|
4386
|
-
|
|
4387
|
-
|
|
4388
|
-
|
|
4550
|
+
var ref = (0, react.useRef)(null);
|
|
4551
|
+
if (!ref.current) ref.current = {
|
|
4552
|
+
isInside: false,
|
|
4553
|
+
layout: {
|
|
4554
|
+
width: 0,
|
|
4555
|
+
height: 0
|
|
4556
|
+
},
|
|
4557
|
+
isCaptured: false
|
|
4558
|
+
};
|
|
4389
4559
|
if (!hasPointerEvents) return;
|
|
4560
|
+
var bag = ref.current;
|
|
4390
4561
|
var createNormalizedEvent = function(e) {
|
|
4391
4562
|
var touch = e.nativeEvent;
|
|
4392
4563
|
var _touch_identifier;
|
|
@@ -4402,10 +4573,10 @@ function usePointerEvents(props, viewProps) {
|
|
|
4402
4573
|
nativeEvent: touch,
|
|
4403
4574
|
target: {
|
|
4404
4575
|
setPointerCapture: function(_pointerId) {
|
|
4405
|
-
|
|
4576
|
+
bag.isCaptured = true;
|
|
4406
4577
|
},
|
|
4407
4578
|
releasePointerCapture: function(_pointerId) {
|
|
4408
|
-
|
|
4579
|
+
bag.isCaptured = false;
|
|
4409
4580
|
}
|
|
4410
4581
|
}
|
|
4411
4582
|
});
|
|
@@ -4414,46 +4585,46 @@ function usePointerEvents(props, viewProps) {
|
|
|
4414
4585
|
onPointerDown(createNormalizedEvent(e));
|
|
4415
4586
|
});
|
|
4416
4587
|
if (onPointerUp) viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
4417
|
-
|
|
4588
|
+
bag.isCaptured = false;
|
|
4418
4589
|
onPointerUp(createNormalizedEvent(e));
|
|
4419
4590
|
});
|
|
4420
4591
|
if (onPointerMove) viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
4421
4592
|
var { locationX, locationY } = e.nativeEvent;
|
|
4422
|
-
var { width, height } =
|
|
4593
|
+
var { width, height } = bag.layout;
|
|
4423
4594
|
var isInBounds = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
4424
|
-
if (
|
|
4595
|
+
if (bag.isCaptured || isInBounds) onPointerMove(createNormalizedEvent(e));
|
|
4425
4596
|
});
|
|
4426
4597
|
if (onPointerCancel) viewProps.onTouchCancel = composeEventHandlers(viewProps.onTouchCancel, function(e) {
|
|
4427
|
-
|
|
4598
|
+
bag.isCaptured = false;
|
|
4428
4599
|
onPointerCancel(createNormalizedEvent(e));
|
|
4429
4600
|
});
|
|
4430
4601
|
if (onPointerEnter || onPointerLeave || onPointerMove) viewProps.onLayout = composeEventHandlers(viewProps.onLayout, function(e) {
|
|
4431
|
-
|
|
4602
|
+
bag.layout = {
|
|
4432
4603
|
width: e.nativeEvent.layout.width,
|
|
4433
4604
|
height: e.nativeEvent.layout.height
|
|
4434
4605
|
};
|
|
4435
4606
|
});
|
|
4436
4607
|
if (onPointerEnter) viewProps.onTouchStart = composeEventHandlers(viewProps.onTouchStart, function(e) {
|
|
4437
4608
|
var { locationX, locationY } = e.nativeEvent;
|
|
4438
|
-
var { width, height } =
|
|
4609
|
+
var { width, height } = bag.layout;
|
|
4439
4610
|
if (locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height) {
|
|
4440
|
-
|
|
4611
|
+
bag.isInside = true;
|
|
4441
4612
|
onPointerEnter(createNormalizedEvent(e));
|
|
4442
4613
|
}
|
|
4443
4614
|
});
|
|
4444
4615
|
if (onPointerLeave) {
|
|
4445
4616
|
viewProps.onTouchMove = composeEventHandlers(viewProps.onTouchMove, function(e) {
|
|
4446
4617
|
var { locationX, locationY } = e.nativeEvent;
|
|
4447
|
-
var { width, height } =
|
|
4618
|
+
var { width, height } = bag.layout;
|
|
4448
4619
|
var isInside = locationX >= 0 && locationX <= width && locationY >= 0 && locationY <= height;
|
|
4449
|
-
if (
|
|
4450
|
-
|
|
4620
|
+
if (bag.isInside && !isInside) {
|
|
4621
|
+
bag.isInside = false;
|
|
4451
4622
|
onPointerLeave(createNormalizedEvent(e));
|
|
4452
4623
|
}
|
|
4453
4624
|
});
|
|
4454
4625
|
viewProps.onTouchEnd = composeEventHandlers(viewProps.onTouchEnd, function(e) {
|
|
4455
|
-
if (
|
|
4456
|
-
|
|
4626
|
+
if (bag.isInside) {
|
|
4627
|
+
bag.isInside = false;
|
|
4457
4628
|
onPointerLeave(createNormalizedEvent(e));
|
|
4458
4629
|
}
|
|
4459
4630
|
});
|
|
@@ -4604,7 +4775,7 @@ var Theme = /* @__PURE__ */ (0, react.forwardRef)(function Theme2(props, ref) {
|
|
|
4604
4775
|
if (props.disable) return props.children;
|
|
4605
4776
|
var { passThrough } = props;
|
|
4606
4777
|
var isRoot = !!props["_isRoot"];
|
|
4607
|
-
var [_, themeState] = useThemeWithState(props, isRoot);
|
|
4778
|
+
var [_, themeState] = useThemeWithState(props, isRoot, true);
|
|
4608
4779
|
var finalChildren = props["disable-child-theme"] ? react.Children.map(props.children, function(child) {
|
|
4609
4780
|
return passThrough || !/* @__PURE__ */ (0, react.isValidElement)(child) ? child : /* @__PURE__ */ (0, react.cloneElement)(child, { ["data-disable-theme"]: true });
|
|
4610
4781
|
}) : props.children;
|
|
@@ -4769,7 +4940,15 @@ var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
|
4769
4940
|
});
|
|
4770
4941
|
}
|
|
4771
4942
|
var groupName = props.group;
|
|
4772
|
-
|
|
4943
|
+
if (!stateRef.current.baseSetStateShallow) {
|
|
4944
|
+
var r = stateRef.current;
|
|
4945
|
+
r.baseSetStateShallow = function(stateOrGetState) {
|
|
4946
|
+
setState(function(prev) {
|
|
4947
|
+
return mergeIfNotShallowEqual(prev, typeof stateOrGetState === "function" ? stateOrGetState(prev) : stateOrGetState);
|
|
4948
|
+
});
|
|
4949
|
+
};
|
|
4950
|
+
}
|
|
4951
|
+
var setStateShallow = stateRef.current.baseSetStateShallow;
|
|
4773
4952
|
if (presenceState && isAnimated && isHydrated && staticConfig.variants) {
|
|
4774
4953
|
var { enterVariant, exitVariant, enterExitVariant, custom } = presenceState;
|
|
4775
4954
|
if (isObj(custom)) Object.assign(props, custom);
|
|
@@ -4941,7 +5120,7 @@ function createComponent(staticConfig) {
|
|
|
4941
5120
|
var overriddenContextProps = null;
|
|
4942
5121
|
var componentContext = react.default.useContext(ComponentContext);
|
|
4943
5122
|
var hasTextAncestor = false;
|
|
4944
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
5123
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
4945
5124
|
var props = propsIn;
|
|
4946
5125
|
var componentName = props.componentName || staticConfig.componentName;
|
|
4947
5126
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -7343,6 +7522,7 @@ exports.rgba = rgba;
|
|
|
7343
7522
|
exports.setConfig = setConfig;
|
|
7344
7523
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
7345
7524
|
exports.setIdentifierValue = setIdentifierValue;
|
|
7525
|
+
exports.setMediaState = setMediaState;
|
|
7346
7526
|
exports.setNonce = setNonce;
|
|
7347
7527
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
7348
7528
|
exports.setRef = setRef;
|
|
@@ -7368,6 +7548,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
7368
7548
|
exports.transformsToString = transformsToString;
|
|
7369
7549
|
exports.updateConfig = updateConfig;
|
|
7370
7550
|
exports.updateFont = updateFont;
|
|
7551
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
7371
7552
|
exports.useClientValue = useClientValue;
|
|
7372
7553
|
exports.useComposedRefs = useComposedRefs;
|
|
7373
7554
|
exports.useConfiguration = useConfiguration;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
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.
|
|
83
|
-
"@tamagui/react-native-media-driver": "2.
|
|
84
|
-
"@tamagui/react-native-use-pressable": "2.
|
|
85
|
-
"@tamagui/use-element-layout": "2.
|
|
86
|
-
"@tamagui/use-event": "2.
|
|
87
|
-
"@tamagui/web": "2.
|
|
82
|
+
"@tamagui/helpers": "2.4.0",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.4.0",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.4.0",
|
|
85
|
+
"@tamagui/use-element-layout": "2.4.0",
|
|
86
|
+
"@tamagui/use-event": "2.4.0",
|
|
87
|
+
"@tamagui/web": "2.4.0"
|
|
88
88
|
},
|
|
89
89
|
"devDependencies": {
|
|
90
|
-
"@tamagui/build": "2.
|
|
91
|
-
"@tamagui/native-bundle": "2.
|
|
92
|
-
"@tamagui/react-native-web-lite": "2.
|
|
90
|
+
"@tamagui/build": "2.4.0",
|
|
91
|
+
"@tamagui/native-bundle": "2.4.0",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.4.0",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|