@tamagui/core 1.74.15 → 1.74.17
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/cjs/index.js.map +1 -1
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js.map +1 -1
- package/dist/native.js +105 -112
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +103 -96
- package/dist/test.native.js.map +2 -2
- package/package.json +6 -6
- package/src/index.tsx +1 -1
package/dist/cjs/index.js.map
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAmC,uDAUnC,aAKO,yBAGP,sBAA6B,2BAC7B,0BAAiC,qCACjC,4BAAmC,uCAEnC,
|
|
4
|
+
"mappings": ";;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,+CAAmC,uDAUnC,aAKO,yBAGP,sBAA6B,2BAC7B,0BAAiC,qCACjC,4BAAmC,uCAEnC,sBAAgC;AAGhC,wBAAc,yBAzBd;AA4BA,wBAAc,+BA5Bd;AAgCO,MAAM,QAAQ,WAAAA,OAMR,OAAO,WAAAC;AAAA,IAQpB,uBAAW;AAAA,EACT;AAAA,EAEA,kBAAkB,aAAa,SAAS,SAAS;AAE/C,UAAM;AAAA;AAAA,MAEJ;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA;AAAA,MAGA;AAAA,MACA;AAAA,MAEA;AAAA,MACA;AAAA,MAEA,GAAG;AAA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O,CAAC,MAAM,MAAM,IAAI,MAAM,KAAK;AAAA,IAEjE;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,WAAW,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,cAAc;AASrE,QAPI,QAAQ,YACV,UAAU,UAAa,OAAO,UAE5B,QAAQ,WACV,UAAU,SAAY,OAAO,SAG3B,aAAa;AACf,UAAI,QAAQ;AACV,cAAM,EAAE,WAAW,YAAY,QAAQ,IAAI,QACrC,cAAc;AAAA,UAClB;AAAA,UACA,YAAY,cAAc;AAAA,QAC5B;AACA,QAAI,cAAc,YAEhB,YAAY,aAAa,qBAAqB,SAAS,UAAU,IAEnE,OAAO,OAAO,WAAW,WAAW;AAAA,MACtC;AAAA,WACK;AAGL,MAAI,UAAU,UAAU,YACtB,OAAO,UAAU,UAAU;AAG7B,YAAM,eAAe,gBAAgB,UAAU,IAAI;AAEnD,UAAI,UACE,OAAO;AACT,mBAAW,OAAO,cAAc;AAC9B,gBAAM,KAAK,UAAU,GAAG,GAClB,MAAM,aAAa,GAAG;AAC5B,oBAAU,GAAG,IACX,MAAM,CAAC,4BAA4B,GAAG,IAClC,qBAAqB,IAAI,GAAG,IAC5B;AAAA,QACR;AAAA,IAGN;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF,CAAC;AAED,MAAM,8BAA8B;AAAA,EAClC,SAAS;AACX;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/native.js
CHANGED
|
@@ -2151,6 +2151,7 @@ var require_createShallowSetState_native = __commonJS({
|
|
|
2151
2151
|
}, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), createShallowSetState_exports = {};
|
|
2152
2152
|
__export2(createShallowSetState_exports, {
|
|
2153
2153
|
createShallowSetState: () => createShallowSetState,
|
|
2154
|
+
isEqualShallow: () => isEqualShallow,
|
|
2154
2155
|
mergeIfNotShallowEqual: () => mergeIfNotShallowEqual
|
|
2155
2156
|
});
|
|
2156
2157
|
module2.exports = __toCommonJS2(createShallowSetState_exports);
|
|
@@ -2158,10 +2159,13 @@ var require_createShallowSetState_native = __commonJS({
|
|
|
2158
2159
|
return (next) => setter((prev) => mergeIfNotShallowEqual(prev, next));
|
|
2159
2160
|
}
|
|
2160
2161
|
function mergeIfNotShallowEqual(prev, next) {
|
|
2162
|
+
return isEqualShallow(prev, next) ? prev : { ...prev, ...next };
|
|
2163
|
+
}
|
|
2164
|
+
function isEqualShallow(prev, next) {
|
|
2161
2165
|
for (let key in next)
|
|
2162
2166
|
if (prev[key] !== next[key])
|
|
2163
|
-
return
|
|
2164
|
-
return
|
|
2167
|
+
return !1;
|
|
2168
|
+
return !0;
|
|
2165
2169
|
}
|
|
2166
2170
|
}
|
|
2167
2171
|
});
|
|
@@ -4028,7 +4032,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4028
4032
|
__export2(ThemeManager_exports, {
|
|
4029
4033
|
ThemeManager: () => ThemeManager,
|
|
4030
4034
|
getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
|
|
4031
|
-
|
|
4035
|
+
getManagers: () => getManagers
|
|
4032
4036
|
});
|
|
4033
4037
|
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
4034
4038
|
var import_constants2 = require_index_native2(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
@@ -4036,17 +4040,17 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4036
4040
|
return props.name || props.componentName || props.inverse || props.reset;
|
|
4037
4041
|
}
|
|
4038
4042
|
var uid = 0, ThemeManager = class {
|
|
4039
|
-
constructor(props = {},
|
|
4040
|
-
if (this.props = props, this.id = uid++, this.
|
|
4043
|
+
constructor(props = {}, parentManager) {
|
|
4044
|
+
if (this.props = props, this.id = uid++, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, parentManager === "root") {
|
|
4041
4045
|
this.updateStateFromProps(props, !1);
|
|
4042
4046
|
return;
|
|
4043
4047
|
}
|
|
4044
|
-
if (!
|
|
4048
|
+
if (!parentManager)
|
|
4045
4049
|
throw process.env.NODE_ENV !== "production" ? new Error(
|
|
4046
4050
|
"No parent manager given, this is likely due to duplicated Tamagui dependencies. Check your lockfile for mis-matched versions. It could also be from an error somewhere else in your stack causing Tamagui to recieve undefined context, you can try putting some ErrorBoundary components around other areas of your app, or a Suspense boundary."
|
|
4047
4051
|
) : "\u274C 0";
|
|
4048
|
-
if (this.parentManager =
|
|
4049
|
-
return
|
|
4052
|
+
if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
|
|
4053
|
+
return parentManager;
|
|
4050
4054
|
}
|
|
4051
4055
|
updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
|
|
4052
4056
|
if (this.props = props, props.forceTheme)
|
|
@@ -4056,9 +4060,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4056
4060
|
return this.updateState(nextState, shouldNotify), nextState;
|
|
4057
4061
|
}
|
|
4058
4062
|
updateState(nextState, shouldNotify = !0) {
|
|
4059
|
-
this.state = nextState
|
|
4060
|
-
let names = this.state.name.split("_"), lastName = names[names.length - 1][0];
|
|
4061
|
-
this.isComponent = lastName[0] === lastName[0].toUpperCase(), this._allKeys = null, this.scheme = names[0] === "light" ? "light" : names[0] === "dark" ? "dark" : null, process.env.NODE_ENV === "development" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && queueMicrotask(() => {
|
|
4063
|
+
this.state = nextState, this._allKeys = null, process.env.NODE_ENV !== "production" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && queueMicrotask(() => {
|
|
4062
4064
|
this.notify();
|
|
4063
4065
|
});
|
|
4064
4066
|
}
|
|
@@ -4086,51 +4088,37 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4086
4088
|
this.themeListeners.forEach((cb) => cb(this.state.name, this, forced));
|
|
4087
4089
|
}
|
|
4088
4090
|
onChangeTheme(cb, debugId) {
|
|
4089
|
-
return process.env.NODE_ENV
|
|
4091
|
+
return process.env.NODE_ENV !== "production" && debugId && (this._listeningIds ??= /* @__PURE__ */ new Set(), this._listeningIds.add(debugId)), this.themeListeners.add(cb), () => {
|
|
4090
4092
|
this.themeListeners.delete(cb);
|
|
4091
4093
|
};
|
|
4092
4094
|
}
|
|
4093
4095
|
};
|
|
4094
|
-
function
|
|
4095
|
-
|
|
4096
|
-
}
|
|
4097
|
-
function getState(props, parentManager) {
|
|
4098
|
-
var _a, _b, _c, _d, _e, _f;
|
|
4099
|
-
let validManagerAndAllComponentThemes = getNonComponentParentManager(parentManager);
|
|
4100
|
-
parentManager = validManagerAndAllComponentThemes[0];
|
|
4101
|
-
let allComponentThemes = validManagerAndAllComponentThemes[1], themes = (0, import_config.getThemes)(), isDirectParentAComponentTheme = allComponentThemes.length > 0;
|
|
4096
|
+
function getState(props, manager) {
|
|
4097
|
+
var _a;
|
|
4102
4098
|
if (props.name && props.reset)
|
|
4103
|
-
throw new Error(
|
|
4104
|
-
|
|
4099
|
+
throw new Error(
|
|
4100
|
+
process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
|
|
4101
|
+
);
|
|
4102
|
+
if (!getHasThemeUpdatingProps(props))
|
|
4105
4103
|
return null;
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4111
|
-
|
|
4112
|
-
|
|
4113
|
-
let base =
|
|
4114
|
-
|
|
4115
|
-
let parentBaseTheme = isParentComponentTheme ? base.slice(0, base.length).join(import_constants22.THEME_NAME_SEPARATOR) : parentName, max = base.length, min = componentName && !nextName ? max : 0;
|
|
4116
|
-
process.env.NODE_ENV === "development" && typeof props.debug == "string" && (console.groupCollapsed("ThemeManager.getState()"), console.info({
|
|
4117
|
-
props,
|
|
4118
|
-
parentName,
|
|
4119
|
-
parentBaseTheme,
|
|
4120
|
-
base,
|
|
4121
|
-
min,
|
|
4122
|
-
max,
|
|
4123
|
-
isParentComponentTheme
|
|
4124
|
-
}));
|
|
4104
|
+
let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = props.reset && !isDirectParentAComponentTheme ? 1 : 0, baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
|
|
4105
|
+
if (!baseManager && props.reset)
|
|
4106
|
+
return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
|
|
4107
|
+
let { componentName } = props, result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "";
|
|
4108
|
+
baseManager != null && baseManager.state.isComponent && (baseName = baseName.replace(/_[A-Z][a-z]+/, ""));
|
|
4109
|
+
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
4110
|
+
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
4111
|
+
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
|
|
4112
|
+
process.env.NODE_ENV !== "production" && typeof props.debug == "string" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }));
|
|
4125
4113
|
for (let i = max; i >= min; i--) {
|
|
4126
4114
|
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4127
4115
|
props.inverse && (prefix = inverseThemeName(prefix));
|
|
4128
4116
|
let potentials = [];
|
|
4129
|
-
if (prefix && prefix !==
|
|
4130
|
-
let
|
|
4131
|
-
|
|
4117
|
+
if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
|
|
4118
|
+
let lastSegment = potentials.findIndex((x) => !x.includes("_"));
|
|
4119
|
+
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
4132
4120
|
}
|
|
4133
|
-
if (componentName) {
|
|
4121
|
+
if (componentName && !props.reset) {
|
|
4134
4122
|
let componentPotentials = [];
|
|
4135
4123
|
if (nextName) {
|
|
4136
4124
|
let beforeSeparator = prefix.slice(0, prefix.indexOf(import_constants22.THEME_NAME_SEPARATOR));
|
|
@@ -4148,29 +4136,27 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4148
4136
|
potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
|
|
4149
4137
|
}
|
|
4150
4138
|
let found = potentials.find((t) => t in themes);
|
|
4151
|
-
if (process.env.NODE_ENV
|
|
4139
|
+
if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" - ", { found, potentials, baseManager, nextName, baseName, prefix }), found) {
|
|
4140
|
+
let names = found.split("_"), [firstName, ...restNames] = names, lastName = names[names.length - 1], isComponent = lastName[0] === lastName[0].toUpperCase(), scheme = firstName === "light" ? "light" : firstName === "dark" ? "dark" : void 0, pre = import_constants22.THEME_CLASSNAME_PREFIX, className = import_constants2.isWeb ? `${pre}sub_theme ${pre}${!scheme || !restNames.length ? firstName : restNames.join("_")}` : "", parentState = (_a = baseManager || parentManager) == null ? void 0 : _a.state, parentName = parentState == null ? void 0 : parentState.name;
|
|
4152
4141
|
result = {
|
|
4153
4142
|
name: found,
|
|
4154
|
-
theme: themes[found],
|
|
4155
|
-
className: import_constants2.isWeb ? getNextThemeClassName(found) : "",
|
|
4156
4143
|
parentName,
|
|
4157
|
-
|
|
4158
|
-
|
|
4144
|
+
theme: themes[found],
|
|
4145
|
+
className,
|
|
4146
|
+
isComponent,
|
|
4147
|
+
scheme
|
|
4159
4148
|
};
|
|
4160
4149
|
break;
|
|
4161
4150
|
}
|
|
4162
4151
|
}
|
|
4163
|
-
return process.env.NODE_ENV
|
|
4164
|
-
result
|
|
4165
|
-
}), console.trace(), console.groupEnd()), result;
|
|
4152
|
+
return process.env.NODE_ENV !== "production" && typeof props.debug == "string" && typeof window < "u" && (console.warn("ThemeManager.getState():", { result }), console.trace(), console.groupEnd()), result;
|
|
4166
4153
|
}
|
|
4167
4154
|
var inverseThemeName = (themeName) => themeName.startsWith("light") ? themeName.replace(/^light/, "dark") : themeName.replace(/^dark/, "light");
|
|
4168
|
-
function
|
|
4169
|
-
|
|
4170
|
-
|
|
4171
|
-
|
|
4172
|
-
|
|
4173
|
-
return [res || null, componentThemeNames];
|
|
4155
|
+
function getManagers(themeManager) {
|
|
4156
|
+
let comp = [], all = [], cur = themeManager;
|
|
4157
|
+
for (; cur; )
|
|
4158
|
+
all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
|
|
4159
|
+
return [all, comp];
|
|
4174
4160
|
}
|
|
4175
4161
|
}
|
|
4176
4162
|
});
|
|
@@ -4218,7 +4204,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4218
4204
|
useThemeWithState: () => useThemeWithState
|
|
4219
4205
|
});
|
|
4220
4206
|
module2.exports = __toCommonJS2(useTheme_exports);
|
|
4221
|
-
var import_constants2 = require_index_native2(), import_react = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
|
|
4207
|
+
var import_constants2 = require_index_native2(), import_react = require("react"), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_createProxy = require_createProxy_native(), import_createShallowSetState = require_createShallowSetState_native(), import_ThemeManager = require_ThemeManager_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_getThemeUnwrapped = require_getThemeUnwrapped_native(), emptyProps = { name: null }, cached;
|
|
4222
4208
|
function getDefaultThemeProxied() {
|
|
4223
4209
|
if (cached)
|
|
4224
4210
|
return cached;
|
|
@@ -4252,7 +4238,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4252
4238
|
let themeProxied = (0, import_react.useMemo)(() => !themeManager || !(state != null && state.theme) ? {} : getThemeProxied(state, props.deopt, themeManager, keys.current, props.debug), [state, themeManager, props.deopt, props.debug]);
|
|
4253
4239
|
return process.env.NODE_ENV === "development" && props.debug === "verbose" && (console.groupCollapsed(" \u{1F539} useTheme =>", state == null ? void 0 : state.name), console.info("returning state", changedThemeState, "from props", props), console.groupEnd()), [changedThemeState, themeProxied];
|
|
4254
4240
|
};
|
|
4255
|
-
function getThemeProxied({ theme, name }, deopt = !1, themeManager, keys, debug) {
|
|
4241
|
+
function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
|
|
4256
4242
|
if (!theme)
|
|
4257
4243
|
return {};
|
|
4258
4244
|
let config = (0, import_config.getConfig)();
|
|
@@ -4285,21 +4271,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4285
4271
|
else if (subkey === "get")
|
|
4286
4272
|
return (platform) => {
|
|
4287
4273
|
let outVal = (0, import_createVariable.getVariable)(val);
|
|
4288
|
-
if (platform !== "web" && import_constants2.isIos && !deopt && config.settings.fastSchemeChange) {
|
|
4289
|
-
let
|
|
4290
|
-
|
|
4291
|
-
|
|
4292
|
-
|
|
4293
|
-
|
|
4294
|
-
|
|
4295
|
-
|
|
4296
|
-
|
|
4297
|
-
|
|
4298
|
-
|
|
4299
|
-
|
|
4300
|
-
}
|
|
4301
|
-
};
|
|
4302
|
-
}
|
|
4274
|
+
if (platform !== "web" && import_constants2.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
|
|
4275
|
+
let oppositeThemeName = name.replace(
|
|
4276
|
+
scheme === "dark" ? "dark" : "light",
|
|
4277
|
+
scheme === "dark" ? "light" : "dark"
|
|
4278
|
+
), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
|
|
4279
|
+
if (oppositeVal)
|
|
4280
|
+
return {
|
|
4281
|
+
dynamic: {
|
|
4282
|
+
dark: scheme === "dark" ? outVal : oppositeVal,
|
|
4283
|
+
light: scheme === "light" ? outVal : oppositeVal
|
|
4284
|
+
}
|
|
4285
|
+
};
|
|
4303
4286
|
}
|
|
4304
4287
|
return track(keyString), outVal;
|
|
4305
4288
|
};
|
|
@@ -4311,6 +4294,19 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4311
4294
|
}
|
|
4312
4295
|
});
|
|
4313
4296
|
}
|
|
4297
|
+
function someParentIsInversed(manager) {
|
|
4298
|
+
{
|
|
4299
|
+
let cur = manager;
|
|
4300
|
+
for (; cur; ) {
|
|
4301
|
+
if (!cur.parentManager)
|
|
4302
|
+
return !0;
|
|
4303
|
+
if (cur.parentManager.state.scheme !== cur.state.scheme)
|
|
4304
|
+
return !1;
|
|
4305
|
+
cur = cur.parentManager;
|
|
4306
|
+
}
|
|
4307
|
+
}
|
|
4308
|
+
return !1;
|
|
4309
|
+
}
|
|
4314
4310
|
var activeThemeManagers = /* @__PURE__ */ new Set(), useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
4315
4311
|
let { disable } = props, parentManager = (0, import_react.useContext)(import_ThemeManagerContext.ThemeManagerContext);
|
|
4316
4312
|
if (!isRoot && !parentManager || disable)
|
|
@@ -4319,7 +4315,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4319
4315
|
state: parentManager == null ? void 0 : parentManager.state,
|
|
4320
4316
|
themeManager: parentManager
|
|
4321
4317
|
};
|
|
4322
|
-
let [themeState, setThemeState] = (0, import_react.useState)(createState), { state, mounted, isNewTheme, themeManager } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
4318
|
+
let [themeState, setThemeState] = (0, import_react.useState)(createState), { state, mounted, isNewTheme, themeManager, inversed } = themeState, isInversingOnMount = !!(!themeState.mounted && props.inverse);
|
|
4323
4319
|
function getShouldUpdateTheme(manager = themeManager, nextState, prevState = state, forceShouldChange = !1) {
|
|
4324
4320
|
let forceUpdate = shouldUpdate == null ? void 0 : shouldUpdate();
|
|
4325
4321
|
if (!manager || !forceShouldChange && forceUpdate === !1)
|
|
@@ -4332,7 +4328,10 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4332
4328
|
if (!themeManager)
|
|
4333
4329
|
return;
|
|
4334
4330
|
if (props.inverse && !mounted) {
|
|
4335
|
-
setThemeState(
|
|
4331
|
+
setThemeState((prev) => createState({
|
|
4332
|
+
...prev,
|
|
4333
|
+
mounted: !0
|
|
4334
|
+
}));
|
|
4336
4335
|
return;
|
|
4337
4336
|
}
|
|
4338
4337
|
isNewTheme && themeManager && activeThemeManagers.add(themeManager), (isNewTheme || getShouldUpdateTheme(themeManager)) && setThemeState(createState);
|
|
@@ -4366,6 +4365,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4366
4365
|
}), [themeManager])), isInversingOnMount)
|
|
4367
4366
|
return {
|
|
4368
4367
|
isNewTheme: !1,
|
|
4368
|
+
inversed: !1,
|
|
4369
4369
|
themeManager: parentManager,
|
|
4370
4370
|
state: {
|
|
4371
4371
|
name: "",
|
|
@@ -4376,10 +4376,10 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4376
4376
|
return {
|
|
4377
4377
|
state,
|
|
4378
4378
|
isNewTheme,
|
|
4379
|
+
inversed,
|
|
4379
4380
|
themeManager
|
|
4380
4381
|
};
|
|
4381
4382
|
function createState(prev, force = !1) {
|
|
4382
|
-
var _a;
|
|
4383
4383
|
if (prev && (shouldUpdate == null ? void 0 : shouldUpdate()) === !1)
|
|
4384
4384
|
return prev;
|
|
4385
4385
|
let themeManager2 = parentManager, state2;
|
|
@@ -4398,15 +4398,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4398
4398
|
themeManager2 = getNewThemeManager(), state2 = { ...themeManager2.state };
|
|
4399
4399
|
}
|
|
4400
4400
|
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse), mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
let response = {
|
|
4404
|
-
state: state2,
|
|
4401
|
+
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4402
|
+
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed ? !1 : null, response = {
|
|
4405
4403
|
themeManager: themeManager2,
|
|
4406
4404
|
isNewTheme: isNewTheme2,
|
|
4407
|
-
mounted: mounted2
|
|
4408
|
-
|
|
4409
|
-
|
|
4405
|
+
mounted: mounted2,
|
|
4406
|
+
inversed: inversed2
|
|
4407
|
+
}, shouldReturnPrev = !force && prev && // isEqualShallow uses the second arg as the keys so this should compare without state first...
|
|
4408
|
+
(0, import_createShallowSetState.isEqualShallow)(prev, response) && // ... and then compare just the state, because we make a new state obj but is likely the same
|
|
4409
|
+
(0, import_createShallowSetState.isEqualShallow)(prev.state, state2);
|
|
4410
|
+
if (prev && shouldReturnPrev)
|
|
4411
|
+
return prev;
|
|
4412
|
+
if (response.state = state2, process.env.NODE_ENV === "development" && props.debug && import_constants2.isClient) {
|
|
4410
4413
|
console.groupCollapsed(` \u{1F537} ${themeManager2.id} useChangeThemeEffect createState`);
|
|
4411
4414
|
let parentState = { ...parentManager == null ? void 0 : parentManager.state }, parentId = parentManager == null ? void 0 : parentManager.id, themeManagerState = { ...themeManager2.state };
|
|
4412
4415
|
console.info({
|
|
@@ -4474,9 +4477,7 @@ var require_Theme_native = __commonJS({
|
|
|
4474
4477
|
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Theme_exports = {};
|
|
4475
4478
|
__export2(Theme_exports, {
|
|
4476
4479
|
Theme: () => Theme,
|
|
4477
|
-
|
|
4478
|
-
useThemedChildren: () => useThemedChildren,
|
|
4479
|
-
wrapThemeElements: () => wrapThemeElements
|
|
4480
|
+
useThemedChildren: () => useThemedChildren
|
|
4480
4481
|
});
|
|
4481
4482
|
module2.exports = __toCommonJS2(Theme_exports);
|
|
4482
4483
|
var import_constants2 = require_index_native2(), import_react = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_jsx_runtime = require("react/jsx-runtime"), Theme = (0, import_react.forwardRef)(function(props, ref) {
|
|
@@ -4515,40 +4516,32 @@ var require_Theme_native = __commonJS({
|
|
|
4515
4516
|
isRoot
|
|
4516
4517
|
}) : elementsWithContext;
|
|
4517
4518
|
}
|
|
4518
|
-
function getThemeCNStyle(themeState, isRoot = !1) {
|
|
4519
|
-
var _a, _b;
|
|
4520
|
-
if (!themeState.isNewTheme)
|
|
4521
|
-
return;
|
|
4522
|
-
let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
|
|
4523
|
-
color: themeColor
|
|
4524
|
-
} : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
|
|
4525
|
-
return isRoot && (className = className.replace("t_sub_theme", "")), { style, className };
|
|
4526
|
-
}
|
|
4527
4519
|
function wrapThemeElements({
|
|
4528
4520
|
children,
|
|
4529
4521
|
themeState,
|
|
4530
4522
|
forceClassName,
|
|
4531
4523
|
isRoot
|
|
4532
4524
|
}) {
|
|
4533
|
-
var _a
|
|
4525
|
+
var _a;
|
|
4534
4526
|
if (isRoot && forceClassName === !1)
|
|
4535
4527
|
return children;
|
|
4536
|
-
let inverse =
|
|
4537
|
-
if (!themeState.isNewTheme && !
|
|
4528
|
+
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName;
|
|
4529
|
+
if (!themeState.isNewTheme && !requiresExtraWrapper)
|
|
4538
4530
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "_dsp_contents is_Theme", children });
|
|
4539
|
-
let { className, style } =
|
|
4540
|
-
if (
|
|
4541
|
-
let name = ((
|
|
4542
|
-
themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
4543
|
-
"span",
|
|
4544
|
-
{
|
|
4545
|
-
className: `${name.startsWith("light") ? "t_light" : name.startsWith("dark") ? "t_dark" : ""} _dsp_contents ${inverse ? "is_inversed" : ""}`,
|
|
4546
|
-
children: themedChildren
|
|
4547
|
-
}
|
|
4548
|
-
);
|
|
4531
|
+
let { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4532
|
+
if (requiresExtraWrapper) {
|
|
4533
|
+
let name = ((_a = themeState.state) == null ? void 0 : _a.name) || "", inverseClassName = name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "";
|
|
4534
|
+
themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
|
|
4549
4535
|
}
|
|
4550
4536
|
return themedChildren;
|
|
4551
4537
|
}
|
|
4538
|
+
function getThemeClassNameAndStyle(themeState, isRoot = !1) {
|
|
4539
|
+
var _a, _b;
|
|
4540
|
+
let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
|
|
4541
|
+
color: themeColor
|
|
4542
|
+
} : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
|
|
4543
|
+
return isRoot && (className = className.replace("t_sub_theme", "")), { style, className };
|
|
4544
|
+
}
|
|
4552
4545
|
}
|
|
4553
4546
|
});
|
|
4554
4547
|
|
|
@@ -4577,7 +4570,7 @@ var require_themeable_native = __commonJS({
|
|
|
4577
4570
|
import_Theme.Theme,
|
|
4578
4571
|
{
|
|
4579
4572
|
componentName: componentName || (staticConfig == null ? void 0 : staticConfig.componentName),
|
|
4580
|
-
name: theme
|
|
4573
|
+
name: theme,
|
|
4581
4574
|
"disable-child-theme": !0,
|
|
4582
4575
|
debug: props.debug,
|
|
4583
4576
|
inverse: themeInverse,
|