@tamagui/core 1.112.25 → 1.113.1
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 +46 -25
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +28 -10
- package/dist/test.native.js.map +2 -2
- package/package.json +6 -6
package/dist/native.js
CHANGED
|
@@ -2208,6 +2208,7 @@ var require_createVariable_native = __commonJS({
|
|
|
2208
2208
|
}
|
|
2209
2209
|
function getVariable(nameOrVariable) {
|
|
2210
2210
|
var group = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "size", _tokens_group;
|
|
2211
|
+
if (nameOrVariable != null && nameOrVariable.dynamic) return nameOrVariable;
|
|
2211
2212
|
if (setDidGetVariableValue(!0), isVariable(nameOrVariable)) return variableToString(nameOrVariable);
|
|
2212
2213
|
var tokens = (0, import_config.getConfig)().tokensParsed, _tokens_group_nameOrVariable;
|
|
2213
2214
|
return variableToString((_tokens_group_nameOrVariable = (_tokens_group = tokens[group]) === null || _tokens_group === void 0 ? void 0 : _tokens_group[nameOrVariable]) !== null && _tokens_group_nameOrVariable !== void 0 ? _tokens_group_nameOrVariable : nameOrVariable);
|
|
@@ -3652,12 +3653,7 @@ var require_useTheme_native = __commonJS({
|
|
|
3652
3653
|
var _props_shouldUpdate, _props_shouldUpdate1, next = (_props_shouldUpdate1 = (_props_shouldUpdate = props.shouldUpdate) === null || _props_shouldUpdate === void 0 ? void 0 : _props_shouldUpdate.call(props)) !== null && _props_shouldUpdate1 !== void 0 ? _props_shouldUpdate1 : keys.current.length > 0 ? !0 : void 0;
|
|
3653
3654
|
if (process.env.NODE_ENV === "development" && typeof props.debug == "string" && props.debug !== "profile") {
|
|
3654
3655
|
var _props_shouldUpdate2;
|
|
3655
|
-
console.info(
|
|
3656
|
-
shouldUpdateProp: (_props_shouldUpdate2 = props.shouldUpdate) === null || _props_shouldUpdate2 === void 0 ? void 0 : _props_shouldUpdate2.call(props),
|
|
3657
|
-
keys: [
|
|
3658
|
-
...keys.current
|
|
3659
|
-
]
|
|
3660
|
-
} : "");
|
|
3656
|
+
console.info(` \u{1F3A8} useTheme() shouldUpdate? tracking keys ${keys.current.length} ${(_props_shouldUpdate2 = props.shouldUpdate) === null || _props_shouldUpdate2 === void 0 ? void 0 : _props_shouldUpdate2.call(props)}`, next);
|
|
3661
3657
|
}
|
|
3662
3658
|
return next;
|
|
3663
3659
|
}), { themeManager, state } = changedThemeState;
|
|
@@ -3665,7 +3661,7 @@ var require_useTheme_native = __commonJS({
|
|
|
3665
3661
|
|
|
3666
3662
|
If this is intended and you are using Tamagui without any themes, you can disable this warning by setting the environment variable TAMAGUI_DISABLE_NO_THEME_WARNING=1`));
|
|
3667
3663
|
var themeProxied = import_react3.default.useMemo(function() {
|
|
3668
|
-
return !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug);
|
|
3664
|
+
return keys.current = [], !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug);
|
|
3669
3665
|
}, [
|
|
3670
3666
|
state == null ? void 0 : state.theme,
|
|
3671
3667
|
themeManager,
|
|
@@ -3702,7 +3698,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3702
3698
|
// when they touch the actual value we only track it
|
|
3703
3699
|
// if its a variable (web), its ignored!
|
|
3704
3700
|
get(_2, subkey) {
|
|
3705
|
-
if (subkey === "val") track(keyString);
|
|
3701
|
+
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));
|
|
3706
3702
|
else if (subkey === "get") return function(platform) {
|
|
3707
3703
|
var outVal = (0, import_createVariable.getVariable)(val);
|
|
3708
3704
|
if (platform !== "web" && import_constants2.isIos && !deopt && (0, import_config.getSetting)("fastSchemeChange") && !someParentIsInversed(themeManager) && scheme) {
|
|
@@ -3717,6 +3713,16 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3717
3713
|
return dynamicVal;
|
|
3718
3714
|
}
|
|
3719
3715
|
}
|
|
3716
|
+
if (process.env.NODE_ENV === "development" && debug && (console.info(` \u{1F3A8} useTheme() tracking new key because of:
|
|
3717
|
+
not web: ${platform !== "web"}
|
|
3718
|
+
isIOS: ${import_constants2.isIos}
|
|
3719
|
+
deopt: ${deopt}
|
|
3720
|
+
fastScheme: ${(0, import_config.getSetting)("fastSchemeChange")}
|
|
3721
|
+
parent inversed: ${someParentIsInversed(themeManager)}
|
|
3722
|
+
`), someParentIsInversed(themeManager))) {
|
|
3723
|
+
var _themeManager_parentManager;
|
|
3724
|
+
console.info(` some parent is inversed: ${themeManager == null ? void 0 : themeManager.state.name} => ${themeManager == null || (_themeManager_parentManager = themeManager.parentManager) === null || _themeManager_parentManager === void 0 ? void 0 : _themeManager_parentManager.state.name}`);
|
|
3725
|
+
}
|
|
3720
3726
|
return track(keyString), outVal;
|
|
3721
3727
|
};
|
|
3722
3728
|
return Reflect.get(val, subkey);
|
|
@@ -3732,7 +3738,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3732
3738
|
function someParentIsInversed(manager) {
|
|
3733
3739
|
for (var cur = manager; cur; ) {
|
|
3734
3740
|
if (!cur.parentManager) return !1;
|
|
3735
|
-
if (cur.parentManager.state.scheme !== cur.state.scheme) return !
|
|
3741
|
+
if (cur.parentManager.state.scheme !== cur.state.scheme) return process.env.NODE_ENV === "development" && !globalThis.TAMAGUI_DITW && !process.env.TAMAGUI_DISABLE_INVERSE_THEME_WARNING && console.info(` \u203C\uFE0F De-opted a theme value access due to an inversed parent.
|
|
3742
|
+
|
|
3743
|
+
This means you've accessed a theme value without .get() in a child of an inversed theme.
|
|
3744
|
+
|
|
3745
|
+
This isn't necessarily a bug, but can often be due to a mistaken inverse (for example,
|
|
3746
|
+
you may have a Theme inside your TamaguiProvider with mis-matched theme values for light/dark).
|
|
3747
|
+
|
|
3748
|
+
For this reason we've added this warning. If this is intentional, you can disable it with:
|
|
3749
|
+
|
|
3750
|
+
process.env.TAMAGUI_DISABLE_INVERSE_THEME_WARNING === 1
|
|
3751
|
+
or globalThis.TAMAGUI_DITW = true
|
|
3752
|
+
`), !0;
|
|
3736
3753
|
cur = cur.parentManager;
|
|
3737
3754
|
}
|
|
3738
3755
|
return !1;
|
|
@@ -3764,10 +3781,14 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3764
3781
|
function getShouldUpdateTheme() {
|
|
3765
3782
|
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();
|
|
3766
3783
|
if (!(!manager || !forceShouldChange && forceUpdate === !1)) {
|
|
3767
|
-
var
|
|
3768
|
-
if (forceShouldChange ||
|
|
3784
|
+
var next2 = nextState || manager.getState(props, parentManager);
|
|
3785
|
+
if (forceShouldChange || next2 && !(forceUpdate !== !0 && !manager.getStateShouldChange(next2, prevState2))) return next2;
|
|
3769
3786
|
}
|
|
3770
3787
|
}
|
|
3788
|
+
if (!import_constants2.isWeb && themeManager && getShouldUpdateTheme(themeManager)) {
|
|
3789
|
+
var _next_state, _themeState_state, next = createState(themeState);
|
|
3790
|
+
((_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);
|
|
3791
|
+
}
|
|
3771
3792
|
if (import_constants2.isServer || (import_react3.default.useLayoutEffect(function() {
|
|
3772
3793
|
themeManager && state && prevState && state !== prevState && themeManager.notify();
|
|
3773
3794
|
}, [
|
|
@@ -3786,8 +3807,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3786
3807
|
(isNewTheme || getShouldUpdateTheme(themeManager)) && (activeThemeManagers.add(themeManager), setThemeState(createState));
|
|
3787
3808
|
var selfListenerDispose = themeManager.onChangeTheme(function(_a, _b, forced) {
|
|
3788
3809
|
forced && setThemeState(function(prev) {
|
|
3789
|
-
var
|
|
3790
|
-
return
|
|
3810
|
+
var next2 = createState(prev, forced !== "self");
|
|
3811
|
+
return next2;
|
|
3791
3812
|
});
|
|
3792
3813
|
}, !0), disposeChangeListener = parentManager == null ? void 0 : parentManager.onChangeTheme(function(name, manager, forced) {
|
|
3793
3814
|
var force = forced || (shouldUpdate == null ? void 0 : shouldUpdate()) || props.deopt || props["disable-child-theme"], shouldTryUpdate = force ?? !!(keys != null && keys.length || isNewTheme);
|
|
@@ -3848,8 +3869,8 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
3848
3869
|
};
|
|
3849
3870
|
if (prev != null && prev.themeManager) {
|
|
3850
3871
|
themeManager2 = prev.themeManager;
|
|
3851
|
-
var forceChange = force || !!(keys != null && keys.length),
|
|
3852
|
-
nextState ? (state2 = nextState, !prev.isNewTheme && !isRoot ? themeManager2 = getNewThemeManager() : themeManager2.updateState(nextState)) : prev.isNewTheme && parentManager && !
|
|
3872
|
+
var forceChange = force || !!(keys != null && keys.length), next2 = themeManager2.getState(props, parentManager), nextState = getShouldUpdateTheme(themeManager2, next2, prev.state, forceChange);
|
|
3873
|
+
nextState ? (state2 = nextState, !prev.isNewTheme && !isRoot ? themeManager2 = getNewThemeManager() : themeManager2.updateState(nextState)) : prev.isNewTheme && parentManager && !next2 && (themeManager2 = parentManager);
|
|
3853
3874
|
} else themeManager2 = getNewThemeManager(), state2 = {
|
|
3854
3875
|
...themeManager2.state
|
|
3855
3876
|
};
|
|
@@ -6439,11 +6460,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6439
6460
|
}
|
|
6440
6461
|
if (typeof variantValue == "function") {
|
|
6441
6462
|
var fn = variantValue, extras = (0, import_getVariantExtras.getVariantExtras)(styleState);
|
|
6442
|
-
variantValue = fn(value, extras), process.env.NODE_ENV
|
|
6443
|
-
fn,
|
|
6444
|
-
variantValue,
|
|
6445
|
-
extras
|
|
6446
|
-
}), console.groupEnd());
|
|
6463
|
+
variantValue = fn(value, extras), process.env.NODE_ENV;
|
|
6447
6464
|
}
|
|
6448
6465
|
var fontFamilyResult;
|
|
6449
6466
|
if ((0, import_isObj.isObj)(variantValue)) {
|
|
@@ -6578,7 +6595,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6578
6595
|
var _theme_value, val = (_theme_value = theme == null ? void 0 : theme[value]) !== null && _theme_value !== void 0 ? _theme_value : tokensParsed[customTokenAccept][value];
|
|
6579
6596
|
val != null && (resolveAs = "value", valOrVar = val, hasSet = !0);
|
|
6580
6597
|
}
|
|
6581
|
-
if (theme && value in theme) valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}`, valOrVar), hasSet = !0;
|
|
6598
|
+
if (theme && value in theme) valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && (globalThis.tamaguiAvoidTracking = !0, console.info(` - resolving ${key} to theme value ${value} resolveAs ${resolveAs}`, valOrVar), globalThis.tamaguiAvoidTracking = !1), hasSet = !0;
|
|
6582
6599
|
else {
|
|
6583
6600
|
if (value in conf.specificTokens) hasSet = !0, valOrVar = conf.specificTokens[value];
|
|
6584
6601
|
else {
|
|
@@ -6612,7 +6629,7 @@ var require_propMapper_native = __commonJS({
|
|
|
6612
6629
|
}
|
|
6613
6630
|
if (hasSet) {
|
|
6614
6631
|
var out = resolveVariableValue(key, valOrVar, resolveAs);
|
|
6615
|
-
return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info("resolved", resolveAs, valOrVar, out), out;
|
|
6632
|
+
return process.env.NODE_ENV === "development" && styleState.debug === "verbose" && (globalThis.tamaguiAvoidTracking = !0, console.info("resolved", resolveAs, valOrVar, out), globalThis.tamaguiAvoidTracking = !1), out;
|
|
6616
6633
|
}
|
|
6617
6634
|
process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.warn(`Warning: no token found for ${key}, omitting`);
|
|
6618
6635
|
};
|
|
@@ -6621,7 +6638,11 @@ var require_propMapper_native = __commonJS({
|
|
|
6621
6638
|
if ((0, import_createVariable.isVariable)(valOrVar)) {
|
|
6622
6639
|
if (resolveValues === "value") return valOrVar.val;
|
|
6623
6640
|
var get = valOrVar == null ? void 0 : valOrVar.get;
|
|
6624
|
-
|
|
6641
|
+
if (key !== "shadowColor" && typeof get == "function") {
|
|
6642
|
+
var resolveDynamicFor = resolveValues === "web" ? "web" : void 0;
|
|
6643
|
+
return get(resolveDynamicFor);
|
|
6644
|
+
}
|
|
6645
|
+
return valOrVar.val;
|
|
6625
6646
|
}
|
|
6626
6647
|
return valOrVar;
|
|
6627
6648
|
}
|
|
@@ -7154,13 +7175,13 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
7154
7175
|
usedKeys: {
|
|
7155
7176
|
...usedKeys
|
|
7156
7177
|
}
|
|
7157
|
-
}), (0, import_log.log)("expanded", expanded, `
|
|
7178
|
+
}), globalThis.tamaguiAvoidTracking = !0, (0, import_log.log)("expanded", expanded, `
|
|
7158
7179
|
usedKeys`, {
|
|
7159
7180
|
...usedKeys
|
|
7160
7181
|
}, `
|
|
7161
7182
|
current`, {
|
|
7162
7183
|
...styleState.style
|
|
7163
|
-
}));
|
|
7184
|
+
}), globalThis.tamaguiAvoidTracking = !1);
|
|
7164
7185
|
} catch {
|
|
7165
7186
|
}
|
|
7166
7187
|
console.groupEnd();
|