@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/native.js
CHANGED
|
@@ -3573,7 +3573,7 @@ var require_getSplitStyles_native = __commonJS({
|
|
|
3573
3573
|
}), console.groupEnd());
|
|
3574
3574
|
for (let keyOg in props) {
|
|
3575
3575
|
let keyInit = keyOg, valInit = props[keyOg];
|
|
3576
|
-
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !isHOC)
|
|
3576
|
+
if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !styleProps.noSkip && !isHOC)
|
|
3577
3577
|
continue;
|
|
3578
3578
|
let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
|
|
3579
3579
|
if (styleState.curProps[keyInit] = valInit, !import_constants3.isAndroid && keyInit === "elevationAndroid")
|
|
@@ -4120,7 +4120,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4120
4120
|
module2.exports = __toCommonJS2(ThemeManager_exports);
|
|
4121
4121
|
var import_constants3 = require_index_native3(), import_config = require_config_native(), import_constants22 = require_constants_native2(), emptyState = { name: "" };
|
|
4122
4122
|
function getHasThemeUpdatingProps(props) {
|
|
4123
|
-
return props.name || props.componentName || props.inverse || props.reset;
|
|
4123
|
+
return !!(props.name || props.componentName || props.inverse || props.reset);
|
|
4124
4124
|
}
|
|
4125
4125
|
var uid = 0, ThemeManager = class {
|
|
4126
4126
|
constructor(props = {}, parentManager) {
|
|
@@ -4190,7 +4190,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4190
4190
|
let nextName = props.reset ? baseName : props.name || "", allComponentThemes = componentManagers.map((x) => (x == null ? void 0 : x.state.name) || "");
|
|
4191
4191
|
isDirectParentAComponentTheme && allComponentThemes.shift();
|
|
4192
4192
|
let base = baseName.split(import_constants22.THEME_NAME_SEPARATOR), max = base.length, min = props.componentName && !nextName ? max : 0;
|
|
4193
|
-
process.env.NODE_ENV !== "production" &&
|
|
4193
|
+
process.env.NODE_ENV !== "production" && props.debug && typeof window < "u" && (console.groupCollapsed("ThemeManager.getState()"), console.info({ props, baseName, base, min, max }));
|
|
4194
4194
|
for (let i = max; i >= min; i--) {
|
|
4195
4195
|
let prefix = base.slice(0, i).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4196
4196
|
props.inverse && (prefix = inverseThemeName(prefix));
|
|
@@ -4200,16 +4200,18 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4200
4200
|
lastSegment > 0 && potentials.splice(lastSegment, 0, nextName);
|
|
4201
4201
|
}
|
|
4202
4202
|
if (componentName && !props.reset) {
|
|
4203
|
-
let componentPotentials = [];
|
|
4204
|
-
if (nextName) {
|
|
4205
|
-
let beforeSeparator =
|
|
4203
|
+
let baseLen = base.length, componentPotentials = [];
|
|
4204
|
+
if (nextName && baseLen > 1) {
|
|
4205
|
+
let beforeSeparator = base[0];
|
|
4206
4206
|
componentPotentials.push(`${beforeSeparator}_${nextName}_${componentName}`);
|
|
4207
4207
|
}
|
|
4208
4208
|
if (componentPotentials.push(`${prefix}_${componentName}`), nextName) {
|
|
4209
|
-
|
|
4210
|
-
|
|
4211
|
-
|
|
4212
|
-
|
|
4209
|
+
if (i > baseLen) {
|
|
4210
|
+
let prefixLessOne = base.slice(0, i - 1).join(import_constants22.THEME_NAME_SEPARATOR);
|
|
4211
|
+
if (prefixLessOne) {
|
|
4212
|
+
let lessSpecific = `${prefixLessOne}_${nextName}_${componentName}`;
|
|
4213
|
+
componentPotentials.unshift(lessSpecific);
|
|
4214
|
+
}
|
|
4213
4215
|
}
|
|
4214
4216
|
let moreSpecific = `${prefix}_${nextName}_${componentName}`;
|
|
4215
4217
|
componentPotentials.unshift(moreSpecific);
|
|
@@ -4218,6 +4220,7 @@ var require_ThemeManager_native = __commonJS({
|
|
|
4218
4220
|
}
|
|
4219
4221
|
let found = potentials.find((t) => t in themes);
|
|
4220
4222
|
if (process.env.NODE_ENV !== "production" && typeof props.debug == "string" && console.info(" getState ", {
|
|
4223
|
+
props,
|
|
4221
4224
|
found,
|
|
4222
4225
|
potentials,
|
|
4223
4226
|
baseManager,
|
|
@@ -4466,7 +4469,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
|
|
|
4466
4469
|
}
|
|
4467
4470
|
let isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse), mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
|
|
4468
4471
|
state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
|
|
4469
|
-
let wasInversed = prev == null ? void 0 : prev.inversed, inversed2 = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme) ? !0 : wasInversed ? !1 : null, response = {
|
|
4472
|
+
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 = {
|
|
4470
4473
|
themeManager: themeManager2,
|
|
4471
4474
|
isNewTheme: isNewTheme2,
|
|
4472
4475
|
mounted: mounted2,
|
|
@@ -4545,40 +4548,40 @@ var require_Theme_native = __commonJS({
|
|
|
4545
4548
|
)), __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), Theme_exports = {};
|
|
4546
4549
|
__export2(Theme_exports, {
|
|
4547
4550
|
Theme: () => Theme,
|
|
4548
|
-
|
|
4551
|
+
getThemedChildren: () => getThemedChildren
|
|
4549
4552
|
});
|
|
4550
4553
|
module2.exports = __toCommonJS2(Theme_exports);
|
|
4551
|
-
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) {
|
|
4554
|
+
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) {
|
|
4552
4555
|
if (props.disable)
|
|
4553
|
-
return
|
|
4554
|
-
let isRoot = !!props._isRoot,
|
|
4555
|
-
|
|
4556
|
-
|
|
4557
|
-
|
|
4558
|
-
|
|
4559
|
-
|
|
4560
|
-
|
|
4561
|
-
|
|
4562
|
-
|
|
4563
|
-
|
|
4564
|
-
return process.env.NODE_ENV === "development" && props.debug === "visualize" && (children2 = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: children2 })), children2;
|
|
4565
|
-
}, [props.children, disableDirectChildTheme]);
|
|
4566
|
-
return useThemedChildren(themeState, children, props, isRoot);
|
|
4556
|
+
return children;
|
|
4557
|
+
let isRoot = !!props._isRoot, themeState = (0, import_useTheme.useChangeThemeEffect)(props, isRoot), finalChildren = props["disable-child-theme"] ? import_react3.Children.map(
|
|
4558
|
+
children,
|
|
4559
|
+
(child) => (0, import_react3.cloneElement)(child, { "data-disable-theme": !0 })
|
|
4560
|
+
) : children;
|
|
4561
|
+
if (ref)
|
|
4562
|
+
try {
|
|
4563
|
+
import_react3.default.Children.only(finalChildren), finalChildren = (0, import_react3.cloneElement)(finalChildren, { ref });
|
|
4564
|
+
} catch {
|
|
4565
|
+
}
|
|
4566
|
+
return process.env.NODE_ENV === "development" && props.debug === "visualize" && (finalChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: finalChildren })), getThemedChildren(themeState, finalChildren, props, isRoot);
|
|
4567
4567
|
});
|
|
4568
4568
|
Theme.displayName = "Theme";
|
|
4569
4569
|
Theme.avoidForwardRef = !0;
|
|
4570
|
-
function
|
|
4571
|
-
let { themeManager, isNewTheme } = themeState
|
|
4572
|
-
if (
|
|
4570
|
+
function getThemedChildren(themeState, children, props, isRoot = !1) {
|
|
4571
|
+
let { themeManager, isNewTheme } = themeState;
|
|
4572
|
+
if (!themeManager)
|
|
4573
|
+
throw "\u274C";
|
|
4574
|
+
let { shallow, forceClassName } = props, hasEverThemed = (0, import_react3.useRef)(!1), shouldRenderChildrenWithTheme = isNewTheme || props.inverse || hasEverThemed.current || forceClassName || isRoot;
|
|
4575
|
+
if (shouldRenderChildrenWithTheme && (hasEverThemed.current = !0), !shouldRenderChildrenWithTheme)
|
|
4573
4576
|
return children;
|
|
4574
4577
|
let next = children;
|
|
4575
|
-
shallow &&
|
|
4578
|
+
shallow && (next = import_react3.Children.toArray(children).map((child) => (0, import_react3.isValidElement)(child) ? (0, import_react3.cloneElement)(
|
|
4576
4579
|
child,
|
|
4577
4580
|
void 0,
|
|
4578
4581
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, { name: themeManager.state.parentName, children: child.props.children })
|
|
4579
4582
|
) : child));
|
|
4580
|
-
let elementsWithContext =
|
|
4581
|
-
return forceClassName === !1 ? elementsWithContext : import_constants3.isWeb
|
|
4583
|
+
let elementsWithContext = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeManagerContext.ThemeManagerContext.Provider, { value: themeManager, children: next });
|
|
4584
|
+
return forceClassName === !1 ? elementsWithContext : import_constants3.isWeb ? wrapThemeElements({
|
|
4582
4585
|
children: elementsWithContext,
|
|
4583
4586
|
themeState,
|
|
4584
4587
|
forceClassName,
|
|
@@ -4594,18 +4597,18 @@ var require_Theme_native = __commonJS({
|
|
|
4594
4597
|
var _a;
|
|
4595
4598
|
if (isRoot && forceClassName === !1)
|
|
4596
4599
|
return children;
|
|
4597
|
-
let inverse = themeState.inversed, requiresExtraWrapper = inverse != null || forceClassName;
|
|
4598
|
-
if (!themeState.isNewTheme && !requiresExtraWrapper)
|
|
4599
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "_dsp_contents is_Theme", children });
|
|
4600
|
-
let { className, style } = getThemeClassNameAndStyle(themeState, isRoot), themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${className} _dsp_contents is_Theme`, style, children });
|
|
4600
|
+
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 });
|
|
4601
4601
|
if (requiresExtraWrapper) {
|
|
4602
4602
|
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" : "";
|
|
4603
4603
|
themedChildren = /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: `${inverse ? inverseClassName : ""} _dsp_contents`, children: themedChildren });
|
|
4604
4604
|
}
|
|
4605
4605
|
return themedChildren;
|
|
4606
4606
|
}
|
|
4607
|
+
var emptyObj = {};
|
|
4607
4608
|
function getThemeClassNameAndStyle(themeState, isRoot = !1) {
|
|
4608
4609
|
var _a, _b;
|
|
4610
|
+
if (!themeState.isNewTheme)
|
|
4611
|
+
return { className: "", style: emptyObj };
|
|
4609
4612
|
let themeColor = (_a = themeState.state) != null && _a.theme && themeState.isNewTheme ? (0, import_createVariable.variableToString)(themeState.state.theme.color) : "", style = themeColor ? {
|
|
4610
4613
|
color: themeColor
|
|
4611
4614
|
} : void 0, className = ((_b = themeState.state) == null ? void 0 : _b.className) || "";
|
|
@@ -4631,7 +4634,10 @@ var require_themeable_native = __commonJS({
|
|
|
4631
4634
|
themeable: () => themeable
|
|
4632
4635
|
});
|
|
4633
4636
|
module2.exports = __toCommonJS2(themeable_exports);
|
|
4634
|
-
var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime =
|
|
4637
|
+
var import_react3 = require("react"), import_Theme = require_Theme_native(), import_jsx_runtime = (
|
|
4638
|
+
// @ts-expect-error its ok
|
|
4639
|
+
require("react/jsx-runtime")
|
|
4640
|
+
);
|
|
4635
4641
|
function themeable(Component, staticConfig) {
|
|
4636
4642
|
let withTheme = (0, import_react3.forwardRef)(function(props, ref) {
|
|
4637
4643
|
let { themeInverse, theme, componentName, themeReset, ...rest } = props, element = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { ref, ...rest, "data-disable-theme": !0 });
|
|
@@ -4909,7 +4915,7 @@ var require_createComponent_native = __commonJS({
|
|
|
4909
4915
|
isEntering && enterVariant ? (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence ENTER "${enterVariant}"`), props[enterVariant] = !0) : isExiting2 && exitVariant && (process.env.NODE_ENV === "development" && debugProp === "verbose" && console.warn(`Animating presence EXIT "${enterVariant}"`), props[exitVariant] = !enterExitVariant);
|
|
4910
4916
|
}
|
|
4911
4917
|
}
|
|
4912
|
-
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,
|
|
4918
|
+
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;
|
|
4913
4919
|
process.env.NODE_ENV === "development" && time && time`theme-props`, props.themeShallow && (stateRef.current.themeShallow = !0);
|
|
4914
4920
|
let themeStateProps = {
|
|
4915
4921
|
name: props.theme,
|
|
@@ -5202,7 +5208,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
|
|
|
5202
5208
|
subscribe: groupState.subscribe
|
|
5203
5209
|
};
|
|
5204
5210
|
}, [groupName]);
|
|
5205
|
-
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content =
|
|
5211
|
+
if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableTheme ? content : (0, import_Theme.getThemedChildren)(themeState, content, themeStateProps, !1), process.env.NODE_ENV === "development" && time && time`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, { themeState, themeProps: props, children: content })), staticConfig.context) {
|
|
5206
5212
|
let contextProps = staticConfig.context.props;
|
|
5207
5213
|
for (let key in contextProps)
|
|
5208
5214
|
(key in style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = style[key] ?? viewProps[key]);
|