@tamagui/core 1.116.9 → 1.116.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/native.js +27 -19
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +26 -25
- package/dist/test.native.js.map +2 -2
- package/package.json +7 -7
package/dist/native.js
CHANGED
|
@@ -3266,6 +3266,13 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3266
3266
|
if (nextState) return this.updateState(nextState, shouldNotify), nextState;
|
|
3267
3267
|
}
|
|
3268
3268
|
},
|
|
3269
|
+
{
|
|
3270
|
+
key: "getParents",
|
|
3271
|
+
value: function() {
|
|
3272
|
+
for (var parents = [], current = this; current; ) parents.push(current), current = current.parentManager;
|
|
3273
|
+
return parents;
|
|
3274
|
+
}
|
|
3275
|
+
},
|
|
3269
3276
|
{
|
|
3270
3277
|
key: "updateState",
|
|
3271
3278
|
value: function(nextState) {
|
|
@@ -3416,6 +3423,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3416
3423
|
theme: themes[found],
|
|
3417
3424
|
className,
|
|
3418
3425
|
isComponent,
|
|
3426
|
+
isSchemeFixed: props.name === "light" || props.name === "dark",
|
|
3419
3427
|
scheme
|
|
3420
3428
|
};
|
|
3421
3429
|
break;
|
|
@@ -3720,19 +3728,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3720
3728
|
if (subkey === "val") globalThis.tamaguiAvoidTracking || (process.env.NODE_ENV === "development" && debug === "verbose" && console.info(" \u{1F3A8} useTheme() tracking new key because of .val access", new Error().stack), track(keyString));
|
|
3721
3729
|
else if (subkey === "get") return function(platform) {
|
|
3722
3730
|
var outVal = (0, import_createVariable.getVariable)(val);
|
|
3723
|
-
if (platform !== "web" && import_constants2.isIos && !deopt && (0, import_config.getSetting)("fastSchemeChange") && scheme) {
|
|
3724
|
-
var
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
light: scheme === "light" ? outVal : oppositeVal
|
|
3732
|
-
}
|
|
3733
|
-
};
|
|
3734
|
-
return dynamicVal;
|
|
3735
|
-
}
|
|
3731
|
+
if (platform !== "web" && import_constants2.isIos && !deopt && (0, import_config.getSetting)("fastSchemeChange") && !hasFixedSchemeParent(themeManager) && scheme) {
|
|
3732
|
+
var _config_themes_name, _config_themes_oppositeName, oppositeName = name.replace(scheme === "dark" ? "dark" : "light", scheme === "dark" ? "light" : "dark"), colorLight = (0, import_createVariable.getVariable)((_config_themes_name = config.themes[name]) === null || _config_themes_name === void 0 ? void 0 : _config_themes_name[keyString]), colorDark = (0, import_createVariable.getVariable)((_config_themes_oppositeName = config.themes[oppositeName]) === null || _config_themes_oppositeName === void 0 ? void 0 : _config_themes_oppositeName[keyString]), dynamicVal = {
|
|
3733
|
+
dynamic: {
|
|
3734
|
+
light: colorLight,
|
|
3735
|
+
dark: colorDark
|
|
3736
|
+
}
|
|
3737
|
+
};
|
|
3738
|
+
return dynamicVal;
|
|
3736
3739
|
}
|
|
3737
3740
|
return process.env.NODE_ENV === "development" && debug && console.info(` \u{1F3A8} useTheme() tracking new key because of:
|
|
3738
3741
|
not web: ${platform !== "web"}
|
|
@@ -3759,6 +3762,11 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3759
3762
|
}
|
|
3760
3763
|
return !1;
|
|
3761
3764
|
}
|
|
3765
|
+
function hasFixedSchemeParent(manager) {
|
|
3766
|
+
return manager == null ? void 0 : manager.getParents().some(function(x) {
|
|
3767
|
+
return x.state.isSchemeFixed;
|
|
3768
|
+
});
|
|
3769
|
+
}
|
|
3762
3770
|
var activeThemeManagers = /* @__PURE__ */ new Set(), _uidToManager = /* @__PURE__ */ new WeakMap(), _idToUID = {}, getId = function(id) {
|
|
3763
3771
|
return _idToUID[id];
|
|
3764
3772
|
}, getThemeManager = function(id) {
|
|
@@ -3782,7 +3790,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3782
3790
|
state: parentManager == null ? void 0 : parentManager.state,
|
|
3783
3791
|
themeManager: parentManager
|
|
3784
3792
|
};
|
|
3785
|
-
var [themeState, setThemeState] = import_react3.default.useState(createState), { state, mounted, isNewTheme, themeManager,
|
|
3793
|
+
var [themeState, setThemeState] = import_react3.default.useState(createState), { state, mounted, isNewTheme, themeManager, prevState } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
3786
3794
|
function getShouldUpdateTheme() {
|
|
3787
3795
|
var manager = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : themeManager, nextState = arguments.length > 1 ? arguments[1] : void 0, prevState2 = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : state, forceShouldChange = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
|
|
3788
3796
|
if (!(!manager || !forceShouldChange && forceUpdate === !1)) {
|
|
@@ -3790,7 +3798,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3790
3798
|
if (forceShouldChange || next2 && !(forceUpdate !== !0 && !manager.getStateShouldChange(next2, prevState2))) return next2;
|
|
3791
3799
|
}
|
|
3792
3800
|
}
|
|
3793
|
-
if (
|
|
3801
|
+
if (themeManager && getShouldUpdateTheme(themeManager)) {
|
|
3794
3802
|
var _next_state, _themeState_state, next = createState(themeState);
|
|
3795
3803
|
((_next_state = next.state) === null || _next_state === void 0 ? void 0 : _next_state.name) !== ((_themeState_state = themeState.state) === null || _themeState_state === void 0 ? void 0 : _themeState_state.name) && (setThemeState(next), console.error = preventWarnSetState, themeManager.notify(), console.error = ogLog);
|
|
3796
3804
|
}
|
|
@@ -3861,7 +3869,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3861
3869
|
return {
|
|
3862
3870
|
state,
|
|
3863
3871
|
isNewTheme,
|
|
3864
|
-
inversed,
|
|
3872
|
+
inversed: !!props.inverse,
|
|
3865
3873
|
themeManager
|
|
3866
3874
|
};
|
|
3867
3875
|
function createState(prev) {
|
|
@@ -3884,11 +3892,11 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3884
3892
|
isNewTheme2 && registerThemeManager(themeManager2);
|
|
3885
3893
|
var isWebSSR = import_constants2.isWeb ? !(0, import_config.getSetting)("disableSSR") : !1, mounted2 = isWebSSR ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
3886
3894
|
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
3887
|
-
var
|
|
3895
|
+
var response = {
|
|
3888
3896
|
themeManager: themeManager2,
|
|
3889
3897
|
isNewTheme: isNewTheme2,
|
|
3890
3898
|
mounted: mounted2,
|
|
3891
|
-
inversed:
|
|
3899
|
+
inversed: props.inverse
|
|
3892
3900
|
}, shouldReturnPrev = prev && !force && // isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
3893
3901
|
(0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
|
|
3894
3902
|
(0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
|
|
@@ -7278,7 +7286,7 @@ current`, {
|
|
|
7278
7286
|
if (!styleState.style.$$css) {
|
|
7279
7287
|
var atomic, _iteratorNormalCompletion, _didIteratorError, _iteratorError;
|
|
7280
7288
|
try {
|
|
7281
|
-
for (var _iterator, _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) var atomicStyle, _props_animateOnly, key3, value, identifier1, isAnimatedAndAnimateOnly, nonAnimatedAnimateOnly;
|
|
7289
|
+
for (var _iterator, _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) var atomicStyle, _props_animateOnly, _props_animateOnly1, key3, value, identifier1, isAnimatedAndAnimateOnly, nonAnimatedAnimateOnly;
|
|
7282
7290
|
} catch (err) {
|
|
7283
7291
|
} finally {
|
|
7284
7292
|
try {
|