@tamagui/core 2.3.2 → 2.3.3-1782462397214
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 +318 -123
- package/dist/test.native.cjs +315 -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, themeStateIdCounter, nextThemeStateId, 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,16 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13114
13212
|
getThemeBaseName = function(name) {
|
|
13115
13213
|
return name.replace(/^(light|dark)_/, "");
|
|
13116
13214
|
};
|
|
13215
|
+
themeStateIdCounter = 0;
|
|
13216
|
+
nextThemeStateId = function() {
|
|
13217
|
+
return `t${++themeStateIdCounter}`;
|
|
13218
|
+
};
|
|
13219
|
+
incReducer = function(c) {
|
|
13220
|
+
return c + 1;
|
|
13221
|
+
};
|
|
13117
13222
|
useThemeState = function(props) {
|
|
13118
13223
|
"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;
|
|
13224
|
+
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
13225
|
var { disable } = props;
|
|
13121
13226
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
13122
13227
|
if (!parentId && !isRoot) throw new Error(MISSING_THEME_MESSAGE);
|
|
@@ -13125,54 +13230,70 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13125
13230
|
name: "light",
|
|
13126
13231
|
theme: getConfig().themes.light
|
|
13127
13232
|
};
|
|
13128
|
-
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
13233
|
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;
|
|
13234
|
+
var ref = (0, react.useRef)(null);
|
|
13235
|
+
if (!ref.current) ref.current = {
|
|
13236
|
+
id: nextThemeStateId(),
|
|
13237
|
+
parentId,
|
|
13238
|
+
props,
|
|
13239
|
+
propsKey,
|
|
13240
|
+
isRoot,
|
|
13241
|
+
keys,
|
|
13242
|
+
schemeKeys,
|
|
13243
|
+
renderVersion: 0
|
|
13173
13244
|
};
|
|
13174
|
-
|
|
13175
|
-
|
|
13245
|
+
else {
|
|
13246
|
+
ref.current.props = props;
|
|
13247
|
+
ref.current.propsKey = propsKey;
|
|
13248
|
+
ref.current.isRoot = isRoot;
|
|
13249
|
+
ref.current.keys = keys;
|
|
13250
|
+
ref.current.schemeKeys = schemeKeys;
|
|
13251
|
+
ref.current.parentId = parentId;
|
|
13252
|
+
}
|
|
13253
|
+
ref.current.renderVersion++;
|
|
13254
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer, 0);
|
|
13255
|
+
var state = getSnapshotImpl(ref.current);
|
|
13256
|
+
ref.current.lastSnap = state;
|
|
13257
|
+
(0, react.useEffect)(function() {
|
|
13258
|
+
var r = ref.current;
|
|
13259
|
+
var renderVersion = r.renderVersion;
|
|
13260
|
+
if (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);
|
|
13261
|
+
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
13262
|
+
if (!r.unsubscribe) {
|
|
13263
|
+
var pid = r.parentId;
|
|
13264
|
+
var sid = r.id;
|
|
13265
|
+
var cb = function() {
|
|
13266
|
+
var next = getSnapshotImpl(r);
|
|
13267
|
+
if (next !== r.lastSnap) {
|
|
13268
|
+
r.lastSnap = next;
|
|
13269
|
+
forceUpdate();
|
|
13270
|
+
}
|
|
13271
|
+
};
|
|
13272
|
+
listenersByParent[pid] = listenersByParent[pid] || /* @__PURE__ */ new Set();
|
|
13273
|
+
listenersByParent[pid].add(sid);
|
|
13274
|
+
allListeners.set(sid, function() {
|
|
13275
|
+
PendingUpdate.set(sid, shouldForce ? "force" : true);
|
|
13276
|
+
cb();
|
|
13277
|
+
});
|
|
13278
|
+
r.subscribedParentId = pid;
|
|
13279
|
+
r.unsubscribe = function() {
|
|
13280
|
+
var _listenersByParent_pid;
|
|
13281
|
+
allListeners.delete(sid);
|
|
13282
|
+
(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);
|
|
13283
|
+
localStates.delete(sid);
|
|
13284
|
+
states.delete(sid);
|
|
13285
|
+
PendingUpdate.delete(sid);
|
|
13286
|
+
r.unsubscribe = void 0;
|
|
13287
|
+
r.subscribedParentId = void 0;
|
|
13288
|
+
};
|
|
13289
|
+
}
|
|
13290
|
+
} else if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
13291
|
+
return function() {
|
|
13292
|
+
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
13293
|
+
};
|
|
13294
|
+
});
|
|
13295
|
+
var id = ref.current.id;
|
|
13296
|
+
if (cascadeOnChange) useIsomorphicLayoutEffect(function() {
|
|
13176
13297
|
if (!HasRenderedOnce.get(keys)) {
|
|
13177
13298
|
HasRenderedOnce.set(keys, true);
|
|
13178
13299
|
return;
|
|
@@ -13187,6 +13308,40 @@ var init_useThemeState_native = __esmMin((() => {
|
|
|
13187
13308
|
}, [keys, propsKey]);
|
|
13188
13309
|
return state;
|
|
13189
13310
|
};
|
|
13311
|
+
shouldSubscribeToTheme = function(r, cascadeOnChange) {
|
|
13312
|
+
var _r_keys_current, _r_props_needsUpdate, _r_props;
|
|
13313
|
+
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));
|
|
13314
|
+
};
|
|
13315
|
+
getSnapshotImpl = function(r) {
|
|
13316
|
+
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
|
|
13317
|
+
var { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r;
|
|
13318
|
+
var local = localStates.get(id);
|
|
13319
|
+
var parentState = states.get(parentId);
|
|
13320
|
+
if (local && !PendingUpdate.has(id)) {
|
|
13321
|
+
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
|
|
13322
|
+
}
|
|
13323
|
+
var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
13324
|
+
var _keys_current_size;
|
|
13325
|
+
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;
|
|
13326
|
+
var _schemeKeys_current_size;
|
|
13327
|
+
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;
|
|
13328
|
+
var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
|
|
13329
|
+
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);
|
|
13330
|
+
var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
13331
|
+
PendingUpdate.delete(id);
|
|
13332
|
+
if (!local || rerender) {
|
|
13333
|
+
local = _objectSpread2({}, next);
|
|
13334
|
+
localStates.set(id, local);
|
|
13335
|
+
}
|
|
13336
|
+
if (next !== local) {
|
|
13337
|
+
Object.assign(local, next);
|
|
13338
|
+
local.id = id;
|
|
13339
|
+
}
|
|
13340
|
+
local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
|
|
13341
|
+
local._propsKey = propsKey;
|
|
13342
|
+
states.set(id, next);
|
|
13343
|
+
return local;
|
|
13344
|
+
};
|
|
13190
13345
|
getNextState = function(lastState, props, propsKey) {
|
|
13191
13346
|
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
13347
|
var { debug } = props;
|
|
@@ -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;
|
|
@@ -16422,7 +16594,7 @@ function createComponent(staticConfig) {
|
|
|
16422
16594
|
var overriddenContextProps = null;
|
|
16423
16595
|
var componentContext = react.default.useContext(ComponentContext);
|
|
16424
16596
|
var hasTextAncestor = false;
|
|
16425
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
16597
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
16426
16598
|
var props = propsIn;
|
|
16427
16599
|
var componentName = props.componentName || staticConfig.componentName;
|
|
16428
16600
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -16908,9 +17080,21 @@ function createComponent(staticConfig) {
|
|
|
16908
17080
|
});
|
|
16909
17081
|
function notifyGroupSubscribers(groupContext, groupEmitter, pseudo) {
|
|
16910
17082
|
if (!groupContext || !groupEmitter) return;
|
|
16911
|
-
var
|
|
16912
|
-
|
|
16913
|
-
|
|
17083
|
+
var prevPseudo = groupContext.state.pseudo;
|
|
17084
|
+
var shouldReplacePseudo = !prevPseudo || "unmounted" in prevPseudo || "group" in prevPseudo || "hasDynGroupChildren" in prevPseudo || "transition" in prevPseudo;
|
|
17085
|
+
var nextPseudo = shouldReplacePseudo ? {} : prevPseudo;
|
|
17086
|
+
var didChange = shouldReplacePseudo;
|
|
17087
|
+
for (var i = 0; i < groupPseudoKeys.length; i++) {
|
|
17088
|
+
var key = groupPseudoKeys[i];
|
|
17089
|
+
var value = pseudo[key];
|
|
17090
|
+
if (nextPseudo[key] !== value) {
|
|
17091
|
+
nextPseudo[key] = value;
|
|
17092
|
+
didChange = true;
|
|
17093
|
+
} else if (didChange) nextPseudo[key] = value;
|
|
17094
|
+
}
|
|
17095
|
+
if (!didChange) return;
|
|
17096
|
+
groupContext.state.pseudo = nextPseudo;
|
|
17097
|
+
groupEmitter.emit(groupContext.state);
|
|
16914
17098
|
}
|
|
16915
17099
|
if (staticConfig.componentName) component.displayName = staticConfig.componentName;
|
|
16916
17100
|
var res = component;
|
|
@@ -16942,7 +17126,7 @@ function getRenderElementForPlatform(potential) {
|
|
|
16942
17126
|
function isHTMLElement(el) {
|
|
16943
17127
|
return typeof el["type"] === "string" && el["type"][0] === el["type"][0].toLowerCase();
|
|
16944
17128
|
}
|
|
16945
|
-
var _excluded$2, _excluded2$1, componentSetStates, avoidReRenderKeys, BaseText, BaseView, hasSetupBaseViews, lastInteractionWasKeyboard, lastInteractionWasTouch, fromPx, getCustomRender;
|
|
17129
|
+
var _excluded$2, _excluded2$1, componentSetStates, avoidReRenderKeys, groupPseudoKeys, BaseText, BaseView, hasSetupBaseViews, lastInteractionWasKeyboard, lastInteractionWasTouch, fromPx, getCustomRender;
|
|
16946
17130
|
var init_createComponent_native = __esmMin((() => {
|
|
16947
17131
|
init_index_native$4();
|
|
16948
17132
|
init_index_native$7();
|
|
@@ -17013,6 +17197,15 @@ var init_createComponent_native = __esmMin((() => {
|
|
|
17013
17197
|
"media",
|
|
17014
17198
|
"group"
|
|
17015
17199
|
]);
|
|
17200
|
+
groupPseudoKeys = [
|
|
17201
|
+
"disabled",
|
|
17202
|
+
"hover",
|
|
17203
|
+
"press",
|
|
17204
|
+
"pressIn",
|
|
17205
|
+
"focus",
|
|
17206
|
+
"focusVisible",
|
|
17207
|
+
"focusWithin"
|
|
17208
|
+
];
|
|
17016
17209
|
hasSetupBaseViews = false;
|
|
17017
17210
|
lastInteractionWasKeyboard = { value: false };
|
|
17018
17211
|
lastInteractionWasTouch = { value: false };
|
|
@@ -18984,6 +19177,7 @@ exports.rgba = rgba;
|
|
|
18984
19177
|
exports.setConfig = setConfig;
|
|
18985
19178
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
18986
19179
|
exports.setIdentifierValue = setIdentifierValue;
|
|
19180
|
+
exports.setMediaState = setMediaState;
|
|
18987
19181
|
exports.setNonce = setNonce;
|
|
18988
19182
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
18989
19183
|
exports.setRef = setRef;
|
|
@@ -19009,6 +19203,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
19009
19203
|
exports.transformsToString = transformsToString;
|
|
19010
19204
|
exports.updateConfig = updateConfig;
|
|
19011
19205
|
exports.updateFont = updateFont;
|
|
19206
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
19012
19207
|
exports.useClientValue = useClientValue;
|
|
19013
19208
|
exports.useComposedRefs = useComposedRefs;
|
|
19014
19209
|
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,16 @@ var getRootThemeState = function() {
|
|
|
1400
1485
|
var getThemeBaseName = function(name) {
|
|
1401
1486
|
return name.replace(/^(light|dark)_/, "");
|
|
1402
1487
|
};
|
|
1488
|
+
var themeStateIdCounter = 0;
|
|
1489
|
+
var nextThemeStateId = function() {
|
|
1490
|
+
return `t${++themeStateIdCounter}`;
|
|
1491
|
+
};
|
|
1492
|
+
var incReducer = function(c) {
|
|
1493
|
+
return c + 1;
|
|
1494
|
+
};
|
|
1403
1495
|
var useThemeState = function(props) {
|
|
1404
1496
|
"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;
|
|
1497
|
+
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
1498
|
var { disable } = props;
|
|
1407
1499
|
var parentId = (0, react.useContext)(ThemeStateContext);
|
|
1408
1500
|
if (!parentId && !isRoot) throw new Error(MISSING_THEME_MESSAGE);
|
|
@@ -1411,54 +1503,70 @@ var useThemeState = function(props) {
|
|
|
1411
1503
|
name: "light",
|
|
1412
1504
|
theme: getConfig().themes.light
|
|
1413
1505
|
};
|
|
1414
|
-
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
1506
|
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;
|
|
1507
|
+
var ref = (0, react.useRef)(null);
|
|
1508
|
+
if (!ref.current) ref.current = {
|
|
1509
|
+
id: nextThemeStateId(),
|
|
1510
|
+
parentId,
|
|
1511
|
+
props,
|
|
1512
|
+
propsKey,
|
|
1513
|
+
isRoot,
|
|
1514
|
+
keys,
|
|
1515
|
+
schemeKeys,
|
|
1516
|
+
renderVersion: 0
|
|
1459
1517
|
};
|
|
1460
|
-
|
|
1461
|
-
|
|
1518
|
+
else {
|
|
1519
|
+
ref.current.props = props;
|
|
1520
|
+
ref.current.propsKey = propsKey;
|
|
1521
|
+
ref.current.isRoot = isRoot;
|
|
1522
|
+
ref.current.keys = keys;
|
|
1523
|
+
ref.current.schemeKeys = schemeKeys;
|
|
1524
|
+
ref.current.parentId = parentId;
|
|
1525
|
+
}
|
|
1526
|
+
ref.current.renderVersion++;
|
|
1527
|
+
var [, forceUpdate] = (0, react.useReducer)(incReducer, 0);
|
|
1528
|
+
var state = getSnapshotImpl(ref.current);
|
|
1529
|
+
ref.current.lastSnap = state;
|
|
1530
|
+
(0, react.useEffect)(function() {
|
|
1531
|
+
var r = ref.current;
|
|
1532
|
+
var renderVersion = r.renderVersion;
|
|
1533
|
+
if (r.unsubscribe && r.subscribedParentId !== r.parentId) cleanupThemeSubscription(r);
|
|
1534
|
+
if (shouldSubscribeToTheme(r, cascadeOnChange)) {
|
|
1535
|
+
if (!r.unsubscribe) {
|
|
1536
|
+
var pid = r.parentId;
|
|
1537
|
+
var sid = r.id;
|
|
1538
|
+
var cb = function() {
|
|
1539
|
+
var next = getSnapshotImpl(r);
|
|
1540
|
+
if (next !== r.lastSnap) {
|
|
1541
|
+
r.lastSnap = next;
|
|
1542
|
+
forceUpdate();
|
|
1543
|
+
}
|
|
1544
|
+
};
|
|
1545
|
+
listenersByParent[pid] = listenersByParent[pid] || /* @__PURE__ */ new Set();
|
|
1546
|
+
listenersByParent[pid].add(sid);
|
|
1547
|
+
allListeners.set(sid, function() {
|
|
1548
|
+
PendingUpdate.set(sid, shouldForce ? "force" : true);
|
|
1549
|
+
cb();
|
|
1550
|
+
});
|
|
1551
|
+
r.subscribedParentId = pid;
|
|
1552
|
+
r.unsubscribe = function() {
|
|
1553
|
+
var _listenersByParent_pid;
|
|
1554
|
+
allListeners.delete(sid);
|
|
1555
|
+
(_listenersByParent_pid = listenersByParent[pid]) === null || _listenersByParent_pid === void 0 || _listenersByParent_pid.delete(sid);
|
|
1556
|
+
localStates.delete(sid);
|
|
1557
|
+
states.delete(sid);
|
|
1558
|
+
PendingUpdate.delete(sid);
|
|
1559
|
+
r.unsubscribe = void 0;
|
|
1560
|
+
r.subscribedParentId = void 0;
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
} else if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
1564
|
+
return function() {
|
|
1565
|
+
if (r.renderVersion === renderVersion) cleanupThemeState(r);
|
|
1566
|
+
};
|
|
1567
|
+
});
|
|
1568
|
+
var id = ref.current.id;
|
|
1569
|
+
if (cascadeOnChange) useIsomorphicLayoutEffect(function() {
|
|
1462
1570
|
if (!HasRenderedOnce.get(keys)) {
|
|
1463
1571
|
HasRenderedOnce.set(keys, true);
|
|
1464
1572
|
return;
|
|
@@ -1473,6 +1581,52 @@ var useThemeState = function(props) {
|
|
|
1473
1581
|
}, [keys, propsKey]);
|
|
1474
1582
|
return state;
|
|
1475
1583
|
};
|
|
1584
|
+
var shouldSubscribeToTheme = function(r, cascadeOnChange) {
|
|
1585
|
+
var _r_keys_current, _r_props_needsUpdate, _r_props;
|
|
1586
|
+
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));
|
|
1587
|
+
};
|
|
1588
|
+
function cleanupThemeSubscription(r) {
|
|
1589
|
+
var _r_unsubscribe;
|
|
1590
|
+
(_r_unsubscribe = r.unsubscribe) === null || _r_unsubscribe === void 0 || _r_unsubscribe.call(r);
|
|
1591
|
+
}
|
|
1592
|
+
function cleanupThemeState(r) {
|
|
1593
|
+
if (r.unsubscribe) cleanupThemeSubscription(r);
|
|
1594
|
+
else {
|
|
1595
|
+
localStates.delete(r.id);
|
|
1596
|
+
states.delete(r.id);
|
|
1597
|
+
PendingUpdate.delete(r.id);
|
|
1598
|
+
}
|
|
1599
|
+
}
|
|
1600
|
+
var getSnapshotImpl = function(r) {
|
|
1601
|
+
var _keys_current, _schemeKeys_current, _keys_current1, _props_needsUpdate;
|
|
1602
|
+
var { id, parentId, props, propsKey, isRoot, keys, schemeKeys } = r;
|
|
1603
|
+
var local = localStates.get(id);
|
|
1604
|
+
var parentState = states.get(parentId);
|
|
1605
|
+
if (local && !PendingUpdate.has(id)) {
|
|
1606
|
+
if (parentState && local._parentName === parentState.name && local._propsKey === propsKey) return local;
|
|
1607
|
+
}
|
|
1608
|
+
var isSchemeOnlyChange = supportsDynamicColorIOS && getSetting("fastSchemeChange") && local && parentState && local.scheme !== parentState.scheme && getThemeBaseName(local.name) === getThemeBaseName(parentState.name);
|
|
1609
|
+
var _keys_current_size;
|
|
1610
|
+
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;
|
|
1611
|
+
var _schemeKeys_current_size;
|
|
1612
|
+
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;
|
|
1613
|
+
var canSkipForSchemeChange = isSchemeOnlyChange && allKeysSchemeOptimized;
|
|
1614
|
+
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);
|
|
1615
|
+
var [rerender, next] = getNextState(local, props, propsKey, isRoot, id, parentId, needsUpdate, PendingUpdate.get(id));
|
|
1616
|
+
PendingUpdate.delete(id);
|
|
1617
|
+
if (!local || rerender) {
|
|
1618
|
+
local = _objectSpread2({}, next);
|
|
1619
|
+
localStates.set(id, local);
|
|
1620
|
+
}
|
|
1621
|
+
if (next !== local) {
|
|
1622
|
+
Object.assign(local, next);
|
|
1623
|
+
local.id = id;
|
|
1624
|
+
}
|
|
1625
|
+
local._parentName = parentState === null || parentState === void 0 ? void 0 : parentState.name;
|
|
1626
|
+
local._propsKey = propsKey;
|
|
1627
|
+
states.set(id, next);
|
|
1628
|
+
return local;
|
|
1629
|
+
};
|
|
1476
1630
|
var getNextState = function(lastState, props, propsKey) {
|
|
1477
1631
|
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
1632
|
var { debug } = props;
|
|
@@ -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;
|
|
@@ -4900,6 +5071,15 @@ var avoidReRenderKeys = /* @__PURE__ */ new Set([
|
|
|
4900
5071
|
"media",
|
|
4901
5072
|
"group"
|
|
4902
5073
|
]);
|
|
5074
|
+
var groupPseudoKeys = [
|
|
5075
|
+
"disabled",
|
|
5076
|
+
"hover",
|
|
5077
|
+
"press",
|
|
5078
|
+
"pressIn",
|
|
5079
|
+
"focus",
|
|
5080
|
+
"focusVisible",
|
|
5081
|
+
"focusWithin"
|
|
5082
|
+
];
|
|
4903
5083
|
var BaseText;
|
|
4904
5084
|
var BaseView;
|
|
4905
5085
|
var hasSetupBaseViews = false;
|
|
@@ -4932,7 +5112,7 @@ function createComponent(staticConfig) {
|
|
|
4932
5112
|
var overriddenContextProps = null;
|
|
4933
5113
|
var componentContext = react.default.useContext(ComponentContext);
|
|
4934
5114
|
var hasTextAncestor = false;
|
|
4935
|
-
var isInsideNativeMenu = react.default.useContext(NativeMenuContext);
|
|
5115
|
+
var isInsideNativeMenu = isAndroid ? react.default.useContext(NativeMenuContext) : false;
|
|
4936
5116
|
var props = propsIn;
|
|
4937
5117
|
var componentName = props.componentName || staticConfig.componentName;
|
|
4938
5118
|
var [nextProps, overrides] = mergeComponentProps(getDefaultProps(staticConfig, props.componentName), styledContextValue, propsIn);
|
|
@@ -5418,9 +5598,21 @@ function createComponent(staticConfig) {
|
|
|
5418
5598
|
});
|
|
5419
5599
|
function notifyGroupSubscribers(groupContext, groupEmitter, pseudo) {
|
|
5420
5600
|
if (!groupContext || !groupEmitter) return;
|
|
5421
|
-
var
|
|
5422
|
-
|
|
5423
|
-
|
|
5601
|
+
var prevPseudo = groupContext.state.pseudo;
|
|
5602
|
+
var shouldReplacePseudo = !prevPseudo || "unmounted" in prevPseudo || "group" in prevPseudo || "hasDynGroupChildren" in prevPseudo || "transition" in prevPseudo;
|
|
5603
|
+
var nextPseudo = shouldReplacePseudo ? {} : prevPseudo;
|
|
5604
|
+
var didChange = shouldReplacePseudo;
|
|
5605
|
+
for (var i = 0; i < groupPseudoKeys.length; i++) {
|
|
5606
|
+
var key = groupPseudoKeys[i];
|
|
5607
|
+
var value = pseudo[key];
|
|
5608
|
+
if (nextPseudo[key] !== value) {
|
|
5609
|
+
nextPseudo[key] = value;
|
|
5610
|
+
didChange = true;
|
|
5611
|
+
} else if (didChange) nextPseudo[key] = value;
|
|
5612
|
+
}
|
|
5613
|
+
if (!didChange) return;
|
|
5614
|
+
groupContext.state.pseudo = nextPseudo;
|
|
5615
|
+
groupEmitter.emit(groupContext.state);
|
|
5424
5616
|
}
|
|
5425
5617
|
if (staticConfig.componentName) component.displayName = staticConfig.componentName;
|
|
5426
5618
|
var res = component;
|
|
@@ -7322,6 +7514,7 @@ exports.rgba = rgba;
|
|
|
7322
7514
|
exports.setConfig = setConfig;
|
|
7323
7515
|
exports.setDidGetVariableValue = setDidGetVariableValue;
|
|
7324
7516
|
exports.setIdentifierValue = setIdentifierValue;
|
|
7517
|
+
exports.setMediaState = setMediaState;
|
|
7325
7518
|
exports.setNonce = setNonce;
|
|
7326
7519
|
exports.setOnLayoutStrategy = setOnLayoutStrategy;
|
|
7327
7520
|
exports.setRef = setRef;
|
|
@@ -7347,6 +7540,7 @@ exports.tokenCategories = tokenCategories;
|
|
|
7347
7540
|
exports.transformsToString = transformsToString;
|
|
7348
7541
|
exports.updateConfig = updateConfig;
|
|
7349
7542
|
exports.updateFont = updateFont;
|
|
7543
|
+
exports.updateMediaListeners = updateMediaListeners;
|
|
7350
7544
|
exports.useClientValue = useClientValue;
|
|
7351
7545
|
exports.useComposedRefs = useComposedRefs;
|
|
7352
7546
|
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-1782462397214",
|
|
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-1782462397214",
|
|
83
|
+
"@tamagui/react-native-media-driver": "2.3.3-1782462397214",
|
|
84
|
+
"@tamagui/react-native-use-pressable": "2.3.3-1782462397214",
|
|
85
|
+
"@tamagui/use-element-layout": "2.3.3-1782462397214",
|
|
86
|
+
"@tamagui/use-event": "2.3.3-1782462397214",
|
|
87
|
+
"@tamagui/web": "2.3.3-1782462397214"
|
|
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-1782462397214",
|
|
91
|
+
"@tamagui/native-bundle": "2.3.3-1782462397214",
|
|
92
|
+
"@tamagui/react-native-web-lite": "2.3.3-1782462397214",
|
|
93
93
|
"@testing-library/react": "^16.1.0",
|
|
94
94
|
"csstype": "^3.0.10",
|
|
95
95
|
"react": ">=19",
|