@tamagui/core 1.82.1 → 1.82.2
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 -40
- package/dist/native.js.map +2 -2
- package/dist/test.native.js +46 -40
- package/dist/test.native.js.map +2 -2
- package/package.json +6 -6
package/dist/test.native.js
CHANGED
|
@@ -3473,7 +3473,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3473
3473
|
};
|
|
3474
3474
|
for (let keyOg in props) {
|
|
3475
3475
|
let keyInit = keyOg, valInit = props[keyOg];
|
|
3476
|
-
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !isHOC)
|
|
3476
|
+
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
|
|
3477
3477
|
continue;
|
|
3478
3478
|
let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
|
|
3479
3479
|
if (styleState.curProps[keyInit] = valInit, !import_constants3.isAndroid && keyInit === "elevationAndroid")
|
|
@@ -3943,7 +3943,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
3943
3943
|
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
3944
3944
|
var import_constants3 = require_index_native3(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
3945
3945
|
function getHasThemeUpdatingProps(props) {
|
|
3946
|
-
return props.name || props.componentName || props.inverse || props.reset;
|
|
3946
|
+
return !!(props.name || props.componentName || props.inverse || props.reset);
|
|
3947
3947
|
}
|
|
3948
3948
|
var uid = 0, ThemeManager = class {
|
|
3949
3949
|
constructor(props = {}, parentManager) {
|
|
@@ -4013,7 +4013,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4013
4013
|
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
4014
4014
|
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
4015
4015
|
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
|
|
4016
|
-
|
|
4016
|
+
props.debug && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }));
|
|
4017
4017
|
for (let i = max; i >= min; i--) {
|
|
4018
4018
|
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4019
4019
|
props.inverse && (prefix = inverseThemeName(prefix));
|
|
@@ -4023,16 +4023,18 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4023
4023
|
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
4024
4024
|
}
|
|
4025
4025
|
if (componentName && !props.reset) {
|
|
4026
|
-
let componentPotentials = [];
|
|
4027
|
-
if (nextName) {
|
|
4028
|
-
let beforeSeparator =
|
|
4026
|
+
let baseLen = base.length, componentPotentials = [];
|
|
4027
|
+
if (nextName && baseLen > 1) {
|
|
4028
|
+
let beforeSeparator = base[0];
|
|
4029
4029
|
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
4030
4030
|
}
|
|
4031
4031
|
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4032
|
+
if (i > baseLen) {
|
|
4033
|
+
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4034
|
+
if (prefixLessOne) {
|
|
4035
|
+
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
4036
|
+
componentPotentials.unshift(lessSpecific);
|
|
4037
|
+
}
|
|
4036
4038
|
}
|
|
4037
4039
|
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
4038
4040
|
componentPotentials.unshift(moreSpecific);
|
|
@@ -4041,6 +4043,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4041
4043
|
}
|
|
4042
4044
|
let found = potentials.find((t) => t in themes);
|
|
4043
4045
|
if (typeof props.debug == "string" && console.info(" getState ", {
|
|
4046
|
+
props,
|
|
4044
4047
|
found,
|
|
4045
4048
|
potentials,
|
|
4046
4049
|
baseManager,
|
|
@@ -4270,7 +4273,7 @@ var require_useTheme_native = __commonJS({
|
|
|
4270
4273
|
}
|
|
4271
4274
|
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse), mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4272
4275
|
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4273
|
-
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed ? !1 : null, response = {
|
|
4276
|
+
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed != null ? !1 : null, response = {
|
|
4274
4277
|
themeManager: themeManager2,
|
|
4275
4278
|
isNewTheme: isNewTheme2,
|
|
4276
4279
|
mounted: mounted2,
|
|
@@ -4334,40 +4337,40 @@ var require_Theme_native = __commonJS({
|
|
|
4334
4337
|
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Theme_exports = {};
|
|
4335
4338
|
__export2(Theme_exports, {
|
|
4336
4339
|
Theme: () => Theme,
|
|
4337
|
-
|
|
4340
|
+
getThemedChildren: () => getThemedChildren
|
|
4338
4341
|
});
|
|
4339
4342
|
module2.exports = __toCommonJS2(Theme_exports);
|
|
4340
|
-
var import_constants3 = require_index_native3(), import_react3 = __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_react3.forwardRef)(function(props, ref) {
|
|
4343
|
+
var import_constants3 = require_index_native3(), import_react3 = __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_react3.forwardRef)(function({ children, ...props }, ref) {
|
|
4341
4344
|
if (props.disable)
|
|
4342
|
-
return
|
|
4343
|
-
let isRoot = !!props._isRoot,
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
return children2;
|
|
4354
|
-
}, [props.children, disableDirectChildTheme]);
|
|
4355
|
-
return useThemedChildren(themeState, children, props, isRoot);
|
|
4345
|
+
return children;
|
|
4346
|
+
let isRoot = !!props._isRoot, themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), finalChildren = props["disable-child-theme"] ? import_react3.Children.map(
|
|
4347
|
+
children,
|
|
4348
|
+
(child) => (0, import_react3.cloneElement)(child, { "data-disable-theme": !0 })
|
|
4349
|
+
) : children;
|
|
4350
|
+
if (ref)
|
|
4351
|
+
try {
|
|
4352
|
+
import_react3.default.Children.only(finalChildren), finalChildren = (0, import_react3.cloneElement)(finalChildren, { ref });
|
|
4353
|
+
} catch {
|
|
4354
|
+
}
|
|
4355
|
+
return getThemedChildren(themeState, finalChildren, props, isRoot);
|
|
4356
4356
|
});
|
|
4357
4357
|
Theme.displayName = "Theme";
|
|
4358
4358
|
Theme.avoidForwardRef = !0;
|
|
4359
|
-
function
|
|
4360
|
-
let { themeManager, isNewTheme } = themeState
|
|
4361
|
-
if (
|
|
4359
|
+
function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
4360
|
+
let { themeManager, isNewTheme } = themeState;
|
|
4361
|
+
if (!themeManager)
|
|
4362
|
+
throw "\u274C";
|
|
4363
|
+
let { shallow, forceClassName } = props, hasEverThemed = (0, import_react3.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
4364
|
+
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
4362
4365
|
return children;
|
|
4363
4366
|
let next = children;
|
|
4364
|
-
shallow &&
|
|
4367
|
+
shallow && (next = import_react3.Children.toArray(children).map((child) => (0, import_react3.isValidElement)(child) ? (0, import_react3.cloneElement)(
|
|
4365
4368
|
child,
|
|
4366
4369
|
void 0,
|
|
4367
4370
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children })
|
|
4368
4371
|
) : child));
|
|
4369
|
-
let elementsWithContext =
|
|
4370
|
-
return forceClassName === !1 ? elementsWithContext : import_constants3.isWeb
|
|
4372
|
+
let elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next });
|
|
4373
|
+
return forceClassName === !1 ? elementsWithContext : import_constants3.isWeb ? wrapThemeElements({
|
|
4371
4374
|
children: elementsWithContext,
|
|
4372
4375
|
themeState,
|
|
4373
4376
|
forceClassName,
|
|
@@ -4383,18 +4386,18 @@ var require_Theme_native = __commonJS({
|
|
|
4383
4386
|
var _a;
|
|
4384
4387
|
if (isRoot && forceClassName === !1)
|
|
4385
4388
|
return children;
|
|
4386
|
-
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName;
|
|
4387
|
-
if (!themeState.isNewTheme && !requiresExtraWrapper)
|
|
4388
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "_dsp_contents is_Theme", children });
|
|
4389
|
-
let { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4389
|
+
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName, { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4390
4390
|
if (requiresExtraWrapper) {
|
|
4391
4391
|
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" : "";
|
|
4392
4392
|
themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
|
|
4393
4393
|
}
|
|
4394
4394
|
return themedChildren;
|
|
4395
4395
|
}
|
|
4396
|
+
var emptyObj = {};
|
|
4396
4397
|
function getThemeClassNameAndStyle(themeState, isRoot = !1) {
|
|
4397
4398
|
var _a, _b;
|
|
4399
|
+
if (!themeState.isNewTheme)
|
|
4400
|
+
return { className: "", style: emptyObj };
|
|
4398
4401
|
let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
|
|
4399
4402
|
color: themeColor
|
|
4400
4403
|
} : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
|
|
@@ -4420,7 +4423,10 @@ var require_themeable_native = __commonJS({
|
|
|
4420
4423
|
themeable: () => themeable
|
|
4421
4424
|
});
|
|
4422
4425
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
4423
|
-
var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime =
|
|
4426
|
+
var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime = (
|
|
4427
|
+
// @ts-expect-error its ok
|
|
4428
|
+
require("react/jsx-runtime")
|
|
4429
|
+
);
|
|
4424
4430
|
function themeable(Component, staticConfig) {
|
|
4425
4431
|
let withTheme = (0, import_react3.forwardRef)(function(props, ref) {
|
|
4426
4432
|
let { themeInverse, theme, componentName, themeReset, ...rest } = props, element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref, ...rest, "data-disable-theme": !0 });
|
|
@@ -4647,7 +4653,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4647
4653
|
isEntering && enterVariant ? props[enterVariant] = !0 : isExiting2 && exitVariant && (props[exitVariant] = !enterExitVariant);
|
|
4648
4654
|
}
|
|
4649
4655
|
}
|
|
4650
|
-
let isAnimatedReactNative = hasAnimationProp && (animationsConfig == null ? void 0 : animationsConfig.isReactNative), isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!import_constants3.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo,
|
|
4656
|
+
let isAnimatedReactNative = hasAnimationProp && (animationsConfig == null ? void 0 : animationsConfig.isReactNative), isReactNative = !!(staticConfig.isReactNative || isAnimatedReactNative), shouldAvoidClasses = !!(!import_constants3.isWeb || isAnimated || !staticConfig.acceptsClassName || propsIn.disableClassName), shouldForcePseudo = !!propsIn.forceStyle, noClassNames = shouldAvoidClasses || shouldForcePseudo, disableTheme = isHOC;
|
|
4651
4657
|
props.themeShallow && (stateRef.current.themeShallow = !0);
|
|
4652
4658
|
let themeStateProps = {
|
|
4653
4659
|
name: props.theme,
|
|
@@ -4894,7 +4900,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4894
4900
|
subscribe: groupState.subscribe
|
|
4895
4901
|
};
|
|
4896
4902
|
}, [groupName]);
|
|
4897
|
-
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), content =
|
|
4903
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), content = disableTheme ? content : (0, import_Theme.getThemedChildren)(themeState, content, themeStateProps, !1), staticConfig.context) {
|
|
4898
4904
|
let contextProps = staticConfig.context.props;
|
|
4899
4905
|
for (let key in contextProps)
|
|
4900
4906
|
(key in style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = style[key] ?? viewProps[key]);
|