@tamagui/core 1.74.14 → 1.74.16
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 +1 -5
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.native.js +1 -5
- package/dist/esm/index.native.js.map +1 -1
- package/dist/native.js +77 -81
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +74 -66
- package/dist/test.native.js.map +2 -2
- package/package.json +6 -6
- package/src/index.tsx +6 -9
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;AAAA,IACL,IAAI;AAyBJ,YAvBA,8CAAmB,OAA6B,OAChD,0CAAiB,SAA+B,QAAe,OAC/D,6DAAmB,SAAS;AAAA,MAC1B;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,IACF,CAAQ,GAIJ,UAAU,SAAS,UAAa,cAAc,QAAW;AAC3D,YAAM,EAAE,UAAU,KAAK,OAAO,IAAI;AAClC,MAAI,YAAY,SACd,UAAU,WAAW,WAEnB,OAAO,SACT,UAAU,MAAM,MAEd,OAAO,UAAW,aACpB,UAAU,SAAS,OAAO,OAAO,CAAC,MAAM,MAAM,IAAI,MAAM,KAAK;AAAA,IAEjE;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,WAAW,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,cAAc;AAAA,EA6CzE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF,CAAC;",
|
|
5
5
|
"names": ["WebStack", "WebText"]
|
|
6
6
|
}
|
package/dist/cjs/index.native.js
CHANGED
|
@@ -78,11 +78,7 @@ const Stack = import_web.Stack, Text = import_web.Text;
|
|
|
78
78
|
return viewProps;
|
|
79
79
|
},
|
|
80
80
|
useEvents(viewProps, events, { pseudos }, setStateShallow, staticConfig) {
|
|
81
|
-
if (
|
|
82
|
-
setStateShallow({ focus: !0 });
|
|
83
|
-
}), viewProps.onBlur = (0, import_web.composeEventHandlers)(viewProps.onBlur, () => {
|
|
84
|
-
setStateShallow({ focus: !1 });
|
|
85
|
-
})), staticConfig.isInput) {
|
|
81
|
+
if (events != null && events.onFocus && (viewProps.onFocus = events.onFocus), events != null && events.onBlur && (viewProps.onBlur = events.onBlur), staticConfig.isInput) {
|
|
86
82
|
if (events) {
|
|
87
83
|
const { onPressIn, onPressOut, onPress } = events, inputEvents = {
|
|
88
84
|
onPressIn,
|
|
@@ -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;AAAA,IACL,IAAI;AAyBJ,YAvBA,8CAAmB,OAA6B,OAChD,0CAAiB,SAA+B,QAAe,OAC/D,6DAAmB,SAAS;AAAA,MAC1B;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,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AAE,UAAU,KAAK,OAAO,IAAI;AAClC,MAAI,YAAY,SACd,UAAU,WAAW,WAEnB,OAAO,SACT,UAAU,MAAM,MAEd,OAAO,UAAW,aACpB,UAAU,SAAS,OAAO,OAAO,CAAC,MAAM,MAAM,IAAI,MAAM,KAAK;AAAA,IAEjE;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,UAAU,WAAW,QAAQ,EAAE,QAAQ,GAAG,iBAAiB,cAAc;AAAA,EA6CzE;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiBF,CAAC;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -67,11 +67,7 @@ setupHooks({
|
|
|
67
67
|
return viewProps;
|
|
68
68
|
},
|
|
69
69
|
useEvents(viewProps, events, { pseudos }, setStateShallow, staticConfig) {
|
|
70
|
-
if (
|
|
71
|
-
setStateShallow({ focus: !0 });
|
|
72
|
-
}), viewProps.onBlur = composeEventHandlers(viewProps.onBlur, () => {
|
|
73
|
-
setStateShallow({ focus: !1 });
|
|
74
|
-
})), staticConfig.isInput) {
|
|
70
|
+
if (events?.onFocus && (viewProps.onFocus = events.onFocus), events?.onBlur && (viewProps.onBlur = events.onBlur), staticConfig.isInput) {
|
|
75
71
|
if (events) {
|
|
76
72
|
const { onPressIn, onPressOut, onPress } = events, inputEvents = {
|
|
77
73
|
onPressIn,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/index.tsx"],
|
|
4
|
-
"mappings": "AAAA,SAAS,0BAA0B;AAUnC;AAAA,EACE,SAAS;AAAA,EACT,QAAQ;AAAA,EACR;AAAA,EACA;AAAA,OACK;AAGP,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,0BAA0B;AAEnC,
|
|
4
|
+
"mappings": "AAAA,SAAS,0B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Aa,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
|
@@ -4028,7 +4028,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4028
4028
|
__export2(ThemeManager_exports, {
|
|
4029
4029
|
ThemeManager: () => ThemeManager,
|
|
4030
4030
|
getHasThemeUpdatingProps: () => getHasThemeUpdatingProps,
|
|
4031
|
-
|
|
4031
|
+
getManagers: () => getManagers
|
|
4032
4032
|
});
|
|
4033
4033
|
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
4034
4034
|
var import_constants2 = require_index_native2(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
@@ -4036,17 +4036,17 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4036
4036
|
return props.name || props.componentName || props.inverse || props.reset;
|
|
4037
4037
|
}
|
|
4038
4038
|
var uid = 0, ThemeManager = class {
|
|
4039
|
-
constructor(props = {},
|
|
4040
|
-
if (this.props = props, this.id = uid++, this.
|
|
4039
|
+
constructor(props = {}, parentManager) {
|
|
4040
|
+
if (this.props = props, this.id = uid++, this.themeListeners = /* @__PURE__ */ new Set(), this.parentManager = null, this.state = emptyState, this._allKeys = null, parentManager === "root") {
|
|
4041
4041
|
this.updateStateFromProps(props, !1);
|
|
4042
4042
|
return;
|
|
4043
4043
|
}
|
|
4044
|
-
if (!
|
|
4044
|
+
if (!parentManager)
|
|
4045
4045
|
throw process.env.NODE_ENV !== "production" ? new Error(
|
|
4046
4046
|
"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
4047
|
) : "\u274C 0";
|
|
4048
|
-
if (this.parentManager =
|
|
4049
|
-
return
|
|
4048
|
+
if (this.parentManager = parentManager, !this.updateStateFromProps(props, !1))
|
|
4049
|
+
return parentManager;
|
|
4050
4050
|
}
|
|
4051
4051
|
updateStateFromProps(props = this.props || {}, shouldNotify = !0) {
|
|
4052
4052
|
if (this.props = props, props.forceTheme)
|
|
@@ -4056,9 +4056,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4056
4056
|
return this.updateState(nextState, shouldNotify), nextState;
|
|
4057
4057
|
}
|
|
4058
4058
|
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(() => {
|
|
4059
|
+
this.state = nextState, this._allKeys = null, process.env.NODE_ENV === "development" && (this._numChangeEventsSent ??= 0, this._numChangeEventsSent++), shouldNotify && queueMicrotask(() => {
|
|
4062
4060
|
this.notify();
|
|
4063
4061
|
});
|
|
4064
4062
|
}
|
|
@@ -4091,86 +4089,68 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4091
4089
|
};
|
|
4092
4090
|
}
|
|
4093
4091
|
};
|
|
4094
|
-
function
|
|
4095
|
-
return `t_sub_theme ${import_constants22.THEME_CLASSNAME_PREFIX}${name}`.replace("light_", "").replace("dark_", "");
|
|
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;
|
|
4092
|
+
function getState(props, manager) {
|
|
4102
4093
|
if (props.name && props.reset)
|
|
4103
|
-
throw new Error(
|
|
4104
|
-
|
|
4094
|
+
throw new Error(
|
|
4095
|
+
process.env.NODE_ENV === "production" ? "\u274C004" : "Cannot reset and set a new name at the same time."
|
|
4096
|
+
);
|
|
4097
|
+
if (!getHasThemeUpdatingProps(props))
|
|
4105
4098
|
return null;
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
((_d = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _d.state.name) || ""
|
|
4111
|
-
) : ((_f = (_e = parentManager == null ? void 0 : parentManager.parentManager) == null ? void 0 : _e.parentManager) == null ? void 0 : _f.state.name) || "" : isDirectParentAComponentTheme ? allComponentThemes[0] || "" : (parentManager == null ? void 0 : parentManager.state.name) || "";
|
|
4099
|
+
let themes = (0, import_config.getThemes)(), [allManagers, componentManagers] = getManagers(manager), isDirectParentAComponentTheme = !!(manager != null && manager.state.isComponent), startIndex = allManagers.findIndex((x) => !(x != null && x.state.isComponent)) + (props.reset && !isDirectParentAComponentTheme ? 1 : 0), baseManager = allManagers[startIndex], parentManager = allManagers[startIndex + 1];
|
|
4100
|
+
if (!baseManager && props.reset)
|
|
4101
|
+
return process.env.NODE_ENV !== "production" && console.warn("Cannot reset, no parent theme exists"), null;
|
|
4102
|
+
let result = null, baseName = (baseManager == null ? void 0 : baseManager.state.name) || "", nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
4112
4103
|
props.reset && isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
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 base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
|
|
4105
|
+
process.env.NODE_ENV === "development" && typeof props.debug == "string" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }));
|
|
4125
4106
|
for (let i = max; i >= min; i--) {
|
|
4126
4107
|
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4127
4108
|
props.inverse && (prefix = inverseThemeName(prefix));
|
|
4128
4109
|
let potentials = [];
|
|
4129
|
-
if (prefix && prefix !==
|
|
4130
|
-
let
|
|
4131
|
-
|
|
4110
|
+
if (prefix && prefix !== baseName && potentials.push(prefix), nextName && potentials.unshift(prefix ? `${prefix}_${nextName}` : nextName), i === 1) {
|
|
4111
|
+
let lastSegment = potentials.findIndex((x) => !x.includes("_"));
|
|
4112
|
+
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
4132
4113
|
}
|
|
4133
|
-
if (componentName) {
|
|
4114
|
+
if (props.componentName) {
|
|
4134
4115
|
let componentPotentials = [];
|
|
4135
4116
|
if (nextName) {
|
|
4136
4117
|
let beforeSeparator = prefix.slice(0, prefix.indexOf(import_constants22.THEME_NAME_SEPARATOR));
|
|
4137
|
-
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
4118
|
+
componentPotentials.push(`${beforeSeparator}_${nextName}_${props.componentName}`);
|
|
4138
4119
|
}
|
|
4139
|
-
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
4120
|
+
if (componentPotentials.push(`${prefix}_${props.componentName}`), nextName) {
|
|
4140
4121
|
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4141
4122
|
if (prefixLessOne) {
|
|
4142
|
-
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
4123
|
+
let lessSpecific = `${prefixLessOne}_${nextName}_${props.componentName}`;
|
|
4143
4124
|
componentPotentials.unshift(lessSpecific);
|
|
4144
4125
|
}
|
|
4145
|
-
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
4126
|
+
let moreSpecific = `${prefix}_${nextName}_${props.componentName}`;
|
|
4146
4127
|
componentPotentials.unshift(moreSpecific);
|
|
4147
4128
|
}
|
|
4148
4129
|
potentials = [...componentPotentials, ...potentials, ...allComponentThemes];
|
|
4149
4130
|
}
|
|
4150
4131
|
let found = potentials.find((t) => t in themes);
|
|
4151
|
-
if (process.env.NODE_ENV === "development" && typeof props.debug == "string" && console.info(" - ", { found, potentials,
|
|
4132
|
+
if (process.env.NODE_ENV === "development" && typeof props.debug == "string" && console.info(" - ", { found, potentials, baseManager }), found) {
|
|
4133
|
+
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 = baseManager == null ? void 0 : baseManager.state, parentScheme = parentState == null ? void 0 : parentState.scheme, parentName = parentState == null ? void 0 : parentState.name, inverse = parentScheme && scheme !== parentScheme;
|
|
4152
4134
|
result = {
|
|
4153
4135
|
name: found,
|
|
4154
|
-
theme: themes[found],
|
|
4155
|
-
className: import_constants2.isWeb ? getNextThemeClassName(found) : "",
|
|
4156
4136
|
parentName,
|
|
4157
|
-
|
|
4158
|
-
|
|
4137
|
+
theme: themes[found],
|
|
4138
|
+
className,
|
|
4139
|
+
inverse,
|
|
4140
|
+
isComponent,
|
|
4141
|
+
scheme
|
|
4159
4142
|
};
|
|
4160
4143
|
break;
|
|
4161
4144
|
}
|
|
4162
4145
|
}
|
|
4163
|
-
return process.env.NODE_ENV === "development" && typeof props.debug == "string" && typeof window < "u" && (console.warn("ThemeManager.getState():", {
|
|
4164
|
-
result
|
|
4165
|
-
}), console.trace(), console.groupEnd()), result;
|
|
4146
|
+
return process.env.NODE_ENV === "development" && typeof props.debug == "string" && typeof window < "u" && (console.warn("ThemeManager.getState():", { result }), console.trace(), console.groupEnd()), result;
|
|
4166
4147
|
}
|
|
4167
4148
|
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];
|
|
4149
|
+
function getManagers(themeManager) {
|
|
4150
|
+
let comp = [], all = [], cur = themeManager;
|
|
4151
|
+
for (; cur; )
|
|
4152
|
+
all.push(cur), cur.state.isComponent && comp.push(cur), cur = cur.parentManager;
|
|
4153
|
+
return [all, comp];
|
|
4174
4154
|
}
|
|
4175
4155
|
}
|
|
4176
4156
|
});
|
|
@@ -4252,7 +4232,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4252
4232
|
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
4233
|
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
4234
|
};
|
|
4255
|
-
function getThemeProxied({ theme, name }, deopt = !1, themeManager, keys, debug) {
|
|
4235
|
+
function getThemeProxied({ theme, name, scheme }, deopt = !1, themeManager, keys, debug) {
|
|
4256
4236
|
if (!theme)
|
|
4257
4237
|
return {};
|
|
4258
4238
|
let config = (0, import_config.getConfig)();
|
|
@@ -4285,21 +4265,18 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4285
4265
|
else if (subkey === "get")
|
|
4286
4266
|
return (platform) => {
|
|
4287
4267
|
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
|
-
}
|
|
4268
|
+
if (platform !== "web" && import_constants2.isIos && !deopt && config.settings.fastSchemeChange && !someParentIsInversed(themeManager) && scheme) {
|
|
4269
|
+
let oppositeThemeName = name.replace(
|
|
4270
|
+
scheme === "dark" ? "dark" : "light",
|
|
4271
|
+
scheme === "dark" ? "light" : "dark"
|
|
4272
|
+
), oppositeTheme = config.themes[oppositeThemeName], oppositeVal = (0, import_createVariable.getVariable)(oppositeTheme == null ? void 0 : oppositeTheme[keyString]);
|
|
4273
|
+
if (oppositeVal)
|
|
4274
|
+
return {
|
|
4275
|
+
dynamic: {
|
|
4276
|
+
dark: scheme === "dark" ? outVal : oppositeVal,
|
|
4277
|
+
light: scheme === "light" ? outVal : oppositeVal
|
|
4278
|
+
}
|
|
4279
|
+
};
|
|
4303
4280
|
}
|
|
4304
4281
|
return track(keyString), outVal;
|
|
4305
4282
|
};
|
|
@@ -4311,6 +4288,17 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4311
4288
|
}
|
|
4312
4289
|
});
|
|
4313
4290
|
}
|
|
4291
|
+
function someParentIsInversed(manager) {
|
|
4292
|
+
{
|
|
4293
|
+
let cur = manager;
|
|
4294
|
+
for (; cur; ) {
|
|
4295
|
+
if (cur.state.inverse)
|
|
4296
|
+
return !0;
|
|
4297
|
+
cur = cur.parentManager;
|
|
4298
|
+
}
|
|
4299
|
+
}
|
|
4300
|
+
return !1;
|
|
4301
|
+
}
|
|
4314
4302
|
var activeThemeManagers = /* @__PURE__ */ new Set(), useChangeThemeEffect = (props, isRoot = !1, keys, shouldUpdate) => {
|
|
4315
4303
|
let { disable } = props, parentManager = (0, import_react.useContext)(import_ThemeManagerContext.ThemeManagerContext);
|
|
4316
4304
|
if (!isRoot && !parentManager || disable)
|
|
@@ -5037,7 +5025,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
5037
5025
|
fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
|
|
5038
5026
|
let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", style = avoidAnimationStyle ? splitStyles.style : animationStyles || splitStyles.style, className;
|
|
5039
5027
|
viewProps.style = style;
|
|
5040
|
-
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants2.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), handlesPressEvents = !(import_constants2.isWeb || asChild), shouldAttach = !!(attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
5028
|
+
let runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), attachFocus = !!(runtimePressStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onLongPress || onClick), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = runtimeHoverStyle || onHoverIn || onHoverOut, isHoverable = import_constants2.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), handlesPressEvents = !(import_constants2.isWeb || asChild), shouldAttach = !!(attachFocus || attachPress || isHoverable || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle);
|
|
5041
5029
|
process.env.NODE_ENV === "development" && time && time`events-setup`;
|
|
5042
5030
|
let events = shouldAttach && !isDisabled && !props.asChild ? {
|
|
5043
5031
|
onPressOut: attachPress ? (e) => {
|
|
@@ -5066,6 +5054,18 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
5066
5054
|
onLongPress: (e) => {
|
|
5067
5055
|
unPress(), onLongPress == null || onLongPress(e);
|
|
5068
5056
|
}
|
|
5057
|
+
},
|
|
5058
|
+
...attachFocus && {
|
|
5059
|
+
onFocus: (e) => {
|
|
5060
|
+
setStateShallow({
|
|
5061
|
+
focus: !0
|
|
5062
|
+
}), onFocus == null || onFocus(e);
|
|
5063
|
+
},
|
|
5064
|
+
onBlur: (e) => {
|
|
5065
|
+
setStateShallow({
|
|
5066
|
+
focus: !1
|
|
5067
|
+
}), onBlur == null || onBlur(e);
|
|
5068
|
+
}
|
|
5069
5069
|
}
|
|
5070
5070
|
} : null;
|
|
5071
5071
|
events && !asChild && Object.assign(events, {
|
|
@@ -6914,11 +6914,7 @@ var Stack = import_web2.Stack, Text = import_web2.Text;
|
|
|
6914
6914
|
return viewProps;
|
|
6915
6915
|
},
|
|
6916
6916
|
useEvents(viewProps, events, { pseudos }, setStateShallow, staticConfig) {
|
|
6917
|
-
if (
|
|
6918
|
-
setStateShallow({ focus: !0 });
|
|
6919
|
-
}), viewProps.onBlur = (0, import_web2.composeEventHandlers)(viewProps.onBlur, () => {
|
|
6920
|
-
setStateShallow({ focus: !1 });
|
|
6921
|
-
})), staticConfig.isInput) {
|
|
6917
|
+
if (events != null && events.onFocus && (viewProps.onFocus = events.onFocus), events != null && events.onBlur && (viewProps.onBlur = events.onBlur), staticConfig.isInput) {
|
|
6922
6918
|
if (events) {
|
|
6923
6919
|
let { onPressIn, onPressOut, onPress } = events, inputEvents = {
|
|
6924
6920
|
onPressIn,
|