@tamagui/core 1.138.2 → 1.138.3
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.cjs +66 -23
- package/dist/test.native.cjs +66 -23
- package/package.json +11 -11
package/dist/native.cjs
CHANGED
|
@@ -2664,6 +2664,10 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
|
|
|
2664
2664
|
if (!(!styleProps.noSkip && subKey in skipProps)) {
|
|
2665
2665
|
if (styleProps.noExpand) res[subKey] = val;
|
|
2666
2666
|
else if (variants && subKey in variants) {
|
|
2667
|
+
if (staticConfig) {
|
|
2668
|
+
var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
|
|
2669
|
+
contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
|
|
2670
|
+
}
|
|
2667
2671
|
if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
|
|
2668
2672
|
val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val;
|
|
2669
2673
|
else {
|
|
@@ -2838,6 +2842,17 @@ function _type_of$2(obj) {
|
|
|
2838
2842
|
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2839
2843
|
}
|
|
2840
2844
|
var conf, PROP_SPLIT = "-";
|
|
2845
|
+
function normalizeGroupKey(key, groupContext) {
|
|
2846
|
+
var parts = key.split("-"), plen = parts.length;
|
|
2847
|
+
if (
|
|
2848
|
+
// check if its actually a simple group selector to avoid breaking selectors
|
|
2849
|
+
plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
|
|
2850
|
+
) {
|
|
2851
|
+
var name = parts[1];
|
|
2852
|
+
if (groupContext && !groupContext[name]) return key.replace("$group-", "$group-true-");
|
|
2853
|
+
}
|
|
2854
|
+
return key;
|
|
2855
|
+
}
|
|
2841
2856
|
function isValidStyleKey(key, validStyles2, accept) {
|
|
2842
2857
|
return key in validStyles2 ? true : accept && key in accept;
|
|
2843
2858
|
}
|
|
@@ -2864,16 +2879,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
2864
2879
|
return "continue";
|
|
2865
2880
|
}
|
|
2866
2881
|
var isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isValidStyleKeyInit || isVariant, isPseudo = keyInit in validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo ? getMediaKey(keyInit) : false, isMediaOrPseudo = !!(isMedia || isPseudo);
|
|
2867
|
-
|
|
2868
|
-
var parts = keyInit.split("-"), plen = parts.length;
|
|
2869
|
-
if (
|
|
2870
|
-
// check if its actually a simple group selector to avoid breaking selectors
|
|
2871
|
-
plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
|
|
2872
|
-
) {
|
|
2873
|
-
var name2 = parts[1];
|
|
2874
|
-
groupContext && !(groupContext == null ? void 0 : groupContext[name2]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
|
|
2875
|
-
}
|
|
2876
|
-
}
|
|
2882
|
+
isMediaOrPseudo && isMedia === "group" && (keyInit = normalizeGroupKey(keyInit, groupContext));
|
|
2877
2883
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
2878
2884
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
2879
2885
|
var shouldPassProp = !isStyleProp && isHOC || // is in parent variants
|
|
@@ -2897,7 +2903,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
2897
2903
|
mergeStyle(styleState, key4, val2, 1);
|
|
2898
2904
|
return;
|
|
2899
2905
|
}
|
|
2900
|
-
if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
|
|
2906
|
+
if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, isMedia === "group" && (key4 = normalizeGroupKey(key4, groupContext)), (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
|
|
2901
2907
|
var _props_key;
|
|
2902
2908
|
viewProps[key4] = (_props_key = props[key4]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
2903
2909
|
}
|
|
@@ -3122,7 +3128,8 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
3122
3128
|
rulesToInsert,
|
|
3123
3129
|
dynamicThemeAccess,
|
|
3124
3130
|
pseudoGroups,
|
|
3125
|
-
mediaGroups
|
|
3131
|
+
mediaGroups,
|
|
3132
|
+
resolvedContextVariants: styleState.resolvedContextVariants
|
|
3126
3133
|
}, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
|
|
3127
3134
|
if (!styleProps.noMergeStyle && !asChildExceptStyleLike) {
|
|
3128
3135
|
var style2 = styleState.style;
|
|
@@ -3434,7 +3441,7 @@ function _type_of$1(obj) {
|
|
|
3434
3441
|
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
3435
3442
|
}
|
|
3436
3443
|
var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
3437
|
-
var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, {
|
|
3444
|
+
var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = (animationDriver == null ? void 0 : animationDriver.isStub) ? void 0 : animationDriver == null ? void 0 : animationDriver.useAnimations, {
|
|
3438
3445
|
isHOC
|
|
3439
3446
|
} = staticConfig, stateRef = React.useRef(
|
|
3440
3447
|
// performance: avoid creating object every render
|
|
@@ -3591,7 +3598,7 @@ function createComponent(staticConfig) {
|
|
|
3591
3598
|
nextProps && (props = nextProps), overriddenContextProps = overrides;
|
|
3592
3599
|
}
|
|
3593
3600
|
var componentName2 = props.componentName || staticConfig.componentName;
|
|
3594
|
-
var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, animationDriver, staticConfig), {
|
|
3601
|
+
var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, (animationDriver == null ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig), {
|
|
3595
3602
|
disabled,
|
|
3596
3603
|
groupName,
|
|
3597
3604
|
hasAnimationProp,
|
|
@@ -3681,7 +3688,15 @@ function createComponent(staticConfig) {
|
|
|
3681
3688
|
willBeAnimated,
|
|
3682
3689
|
styledContext: styledContextValue
|
|
3683
3690
|
}, themeName = (themeState == null ? void 0 : themeState.name) || "";
|
|
3684
|
-
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles,
|
|
3691
|
+
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
|
|
3692
|
+
if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
|
|
3693
|
+
var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
|
|
3694
|
+
if (contextForVariants) {
|
|
3695
|
+
for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
|
|
3696
|
+
staticConfig.context || (contextForOverride = contextForVariants);
|
|
3697
|
+
}
|
|
3698
|
+
}
|
|
3699
|
+
var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
|
|
3685
3700
|
if (!isPassthrough && groupContext && // avoids onLayout if we don't need it
|
|
3686
3701
|
props.containerType !== "normal") {
|
|
3687
3702
|
var groupState = groupContext == null ? void 0 : groupContext.state;
|
|
@@ -3723,8 +3738,8 @@ function createComponent(staticConfig) {
|
|
|
3723
3738
|
}), stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
3724
3739
|
var prev = stateRef.current.nextState || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
3725
3740
|
if (!(next === prev || isEqualShallow(prev, next))) {
|
|
3726
|
-
var canAvoidReRender = Object.keys(next).every(function(
|
|
3727
|
-
return avoidReRenderKeys.has(
|
|
3741
|
+
var canAvoidReRender = Object.keys(next).every(function(key3) {
|
|
3742
|
+
return avoidReRenderKeys.has(key3);
|
|
3728
3743
|
}), updatedState = __spreadValues(__spreadValues({}, prev), next);
|
|
3729
3744
|
if (stateRef.current.nextState = updatedState, canAvoidReRender) {
|
|
3730
3745
|
var _stateRef_current_updateStyleListener, _stateRef_current;
|
|
@@ -3970,9 +3985,9 @@ function createComponent(staticConfig) {
|
|
|
3970
3985
|
}))), "group" in props && (content = /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContext.Provider, {
|
|
3971
3986
|
value: allGroupContexts,
|
|
3972
3987
|
children: content
|
|
3973
|
-
})), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps) {
|
|
3974
|
-
var Provider =
|
|
3975
|
-
for (var
|
|
3988
|
+
})), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps && contextForOverride) {
|
|
3989
|
+
var Provider = contextForOverride.Provider;
|
|
3990
|
+
for (var key1 in styledContextValue) key1 in overriddenContextProps || (overriddenContextProps[key1] = styledContextValue[key1]);
|
|
3976
3991
|
debugProp && console.info("overriddenContextProps", overriddenContextProps), content = /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, __spreadProps(__spreadValues({
|
|
3977
3992
|
__disableMergeDefaultValues: true
|
|
3978
3993
|
}, overriddenContextProps), {
|
|
@@ -4341,6 +4356,35 @@ var cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
|
|
|
4341
4356
|
}
|
|
4342
4357
|
return cache.set(res, true), res;
|
|
4343
4358
|
};
|
|
4359
|
+
var noAnimationDriver = function(method) {
|
|
4360
|
+
console.warn(`No animation driver configured. To use ${method}, you must pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);
|
|
4361
|
+
}, createEmptyAnimationDriver = function() {
|
|
4362
|
+
return {
|
|
4363
|
+
isReactNative: false,
|
|
4364
|
+
supportsCSS: true,
|
|
4365
|
+
classNameAnimation: true,
|
|
4366
|
+
isStub: true,
|
|
4367
|
+
animations: {},
|
|
4368
|
+
useAnimations: function() {
|
|
4369
|
+
return noAnimationDriver("animations");
|
|
4370
|
+
},
|
|
4371
|
+
usePresence: function() {
|
|
4372
|
+
return noAnimationDriver("usePresence");
|
|
4373
|
+
},
|
|
4374
|
+
ResetPresence: function() {
|
|
4375
|
+
return noAnimationDriver("ResetPresence");
|
|
4376
|
+
},
|
|
4377
|
+
useAnimatedNumber: function() {
|
|
4378
|
+
return noAnimationDriver("useAnimatedNumber");
|
|
4379
|
+
},
|
|
4380
|
+
useAnimatedNumberStyle: function() {
|
|
4381
|
+
return noAnimationDriver("useAnimatedNumberStyle");
|
|
4382
|
+
},
|
|
4383
|
+
useAnimatedNumberReaction: function() {
|
|
4384
|
+
return noAnimationDriver("useAnimatedNumberReaction");
|
|
4385
|
+
}
|
|
4386
|
+
};
|
|
4387
|
+
}, defaultAnimationDriver = createEmptyAnimationDriver();
|
|
4344
4388
|
var registerCSSVariable = function(v) {
|
|
4345
4389
|
tokensValueToVariable.set(getVariableValue(v), v);
|
|
4346
4390
|
}, variableToCSS = function(v) {
|
|
@@ -4450,7 +4494,7 @@ function createTamagui$1(configIn) {
|
|
|
4450
4494
|
fonts: {},
|
|
4451
4495
|
onlyAllowShorthands: false,
|
|
4452
4496
|
fontLanguages: [],
|
|
4453
|
-
animations:
|
|
4497
|
+
animations: defaultAnimationDriver,
|
|
4454
4498
|
media: {}
|
|
4455
4499
|
}, configIn), {
|
|
4456
4500
|
unset,
|
|
@@ -4500,8 +4544,7 @@ function getThemesDeduped(themes2, colorTokens) {
|
|
|
4500
4544
|
e2.names.push(themeName);
|
|
4501
4545
|
continue;
|
|
4502
4546
|
}
|
|
4503
|
-
var theme = __spreadValues({}, rawTheme);
|
|
4504
|
-
colorTokens && Object.assign(theme, colorTokens);
|
|
4547
|
+
var theme = __spreadValues(__spreadValues({}, colorTokens), rawTheme);
|
|
4505
4548
|
for (var key1 in theme) ensureThemeVariable(theme, key1);
|
|
4506
4549
|
var deduped = {
|
|
4507
4550
|
names: [themeName],
|
package/dist/test.native.cjs
CHANGED
|
@@ -2489,6 +2489,10 @@ var variableToFontNameCache = /* @__PURE__ */ new WeakMap(), resolveTokensAndVar
|
|
|
2489
2489
|
if (!(!styleProps.noSkip && subKey in skipProps)) {
|
|
2490
2490
|
if (styleProps.noExpand) res[subKey] = val;
|
|
2491
2491
|
else if (variants && subKey in variants) {
|
|
2492
|
+
if (staticConfig) {
|
|
2493
|
+
var _staticConfig_context, _staticConfig_parentStaticConfig_context, _staticConfig_parentStaticConfig, contextProps = ((_staticConfig_context = staticConfig.context) === null || _staticConfig_context === void 0 ? void 0 : _staticConfig_context.props) || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 || (_staticConfig_parentStaticConfig_context = _staticConfig_parentStaticConfig.context) === null || _staticConfig_parentStaticConfig_context === void 0 ? void 0 : _staticConfig_parentStaticConfig_context.props);
|
|
2494
|
+
contextProps && subKey in contextProps && (styleState.resolvedContextVariants || (styleState.resolvedContextVariants = {}), styleState.resolvedContextVariants[subKey] = val);
|
|
2495
|
+
}
|
|
2492
2496
|
if (parentVariantKey && parentVariantKey === key) res[subKey] = // SYNC WITH *1
|
|
2493
2497
|
val[0] === "$" ? getTokenForKey(subKey, val, styleProps, styleState) : val;
|
|
2494
2498
|
else {
|
|
@@ -2663,6 +2667,17 @@ function _type_of$2(obj) {
|
|
|
2663
2667
|
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
2664
2668
|
}
|
|
2665
2669
|
var conf, PROP_SPLIT = "-";
|
|
2670
|
+
function normalizeGroupKey(key, groupContext) {
|
|
2671
|
+
var parts = key.split("-"), plen = parts.length;
|
|
2672
|
+
if (
|
|
2673
|
+
// check if its actually a simple group selector to avoid breaking selectors
|
|
2674
|
+
plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
|
|
2675
|
+
) {
|
|
2676
|
+
var name = parts[1];
|
|
2677
|
+
if (groupContext && !groupContext[name]) return key.replace("$group-", "$group-true-");
|
|
2678
|
+
}
|
|
2679
|
+
return key;
|
|
2680
|
+
}
|
|
2666
2681
|
function isValidStyleKey(key, validStyles2, accept) {
|
|
2667
2682
|
return key in validStyles2 ? true : accept && key in accept;
|
|
2668
2683
|
}
|
|
@@ -2690,16 +2705,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
2690
2705
|
return "continue";
|
|
2691
2706
|
}
|
|
2692
2707
|
var isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isValidStyleKeyInit || isVariant, isPseudo = keyInit in validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo ? getMediaKey(keyInit) : false, isMediaOrPseudo = !!(isMedia || isPseudo);
|
|
2693
|
-
|
|
2694
|
-
var parts = keyInit.split("-"), plen = parts.length;
|
|
2695
|
-
if (
|
|
2696
|
-
// check if its actually a simple group selector to avoid breaking selectors
|
|
2697
|
-
plen === 2 || plen === 3 && pseudoPriorities[parts[parts.length - 1]]
|
|
2698
|
-
) {
|
|
2699
|
-
var name2 = parts[1];
|
|
2700
|
-
groupContext && !(groupContext == null ? void 0 : groupContext[name2]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
|
|
2701
|
-
}
|
|
2702
|
-
}
|
|
2708
|
+
isMediaOrPseudo && isMedia === "group" && (keyInit = normalizeGroupKey(keyInit, groupContext));
|
|
2703
2709
|
var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo || isVariant && !noExpand;
|
|
2704
2710
|
if (isStyleProp && (asChild === "except-style" || asChild === "except-style-web")) return "continue";
|
|
2705
2711
|
var shouldPassProp = !isStyleProp && isHOC || // is in parent variants
|
|
@@ -2723,7 +2729,7 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
2723
2729
|
mergeStyle(styleState, key4, val2, 1);
|
|
2724
2730
|
return;
|
|
2725
2731
|
}
|
|
2726
|
-
if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
|
|
2732
|
+
if (isPseudo = key4 in validPseudoKeys, isMedia = isPseudo ? false : getMediaKey(key4), isMediaOrPseudo = !!(isMedia || isPseudo), isVariant = variants && key4 in variants, isMedia === "group" && (key4 = normalizeGroupKey(key4, groupContext)), (inlineProps == null ? void 0 : inlineProps.has(key4)) || process.env.IS_STATIC === "is_static" && (inlineWhenUnflattened == null ? void 0 : inlineWhenUnflattened.has(key4))) {
|
|
2727
2733
|
var _props_key;
|
|
2728
2734
|
viewProps[key4] = (_props_key = props[key4]) !== null && _props_key !== void 0 ? _props_key : val2;
|
|
2729
2735
|
}
|
|
@@ -2948,7 +2954,8 @@ var getSplitStyles = function(props, staticConfig, theme, themeName, componentSt
|
|
|
2948
2954
|
rulesToInsert,
|
|
2949
2955
|
dynamicThemeAccess,
|
|
2950
2956
|
pseudoGroups,
|
|
2951
|
-
mediaGroups
|
|
2957
|
+
mediaGroups,
|
|
2958
|
+
resolvedContextVariants: styleState.resolvedContextVariants
|
|
2952
2959
|
}, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
|
|
2953
2960
|
if (!styleProps.noMergeStyle && !asChildExceptStyleLike) {
|
|
2954
2961
|
var style2 = styleState.style;
|
|
@@ -3260,7 +3267,7 @@ function _type_of$1(obj) {
|
|
|
3260
3267
|
return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
3261
3268
|
}
|
|
3262
3269
|
var useComponentState = function(props, animationDriver, staticConfig, config) {
|
|
3263
|
-
var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, {
|
|
3270
|
+
var _animationDriver_usePresence, isHydrated = useDidFinishSSR(), needsHydration = !useIsClientOnly(), useAnimations = (animationDriver == null ? void 0 : animationDriver.isStub) ? void 0 : animationDriver == null ? void 0 : animationDriver.useAnimations, {
|
|
3264
3271
|
isHOC
|
|
3265
3272
|
} = staticConfig, stateRef = React.useRef(
|
|
3266
3273
|
// performance: avoid creating object every render
|
|
@@ -3421,7 +3428,7 @@ function createComponent(staticConfig) {
|
|
|
3421
3428
|
nextProps && (props = nextProps), overriddenContextProps = overrides;
|
|
3422
3429
|
}
|
|
3423
3430
|
var componentName2 = props.componentName || staticConfig.componentName;
|
|
3424
|
-
var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, animationDriver, staticConfig), {
|
|
3431
|
+
var componentContext = React.useContext(ComponentContext), groupContextParent = React.useContext(GroupContext), animationDriver = componentContext.animationDriver, useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, componentState = useComponentState(props, (animationDriver == null ? void 0 : animationDriver.isStub) ? null : animationDriver, staticConfig), {
|
|
3425
3432
|
disabled,
|
|
3426
3433
|
groupName,
|
|
3427
3434
|
hasAnimationProp,
|
|
@@ -3511,7 +3518,15 @@ function createComponent(staticConfig) {
|
|
|
3511
3518
|
willBeAnimated,
|
|
3512
3519
|
styledContext: styledContextValue
|
|
3513
3520
|
}, themeName = (themeState == null ? void 0 : themeState.name) || "";
|
|
3514
|
-
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles,
|
|
3521
|
+
var splitStyles = useSplitStyles(props, staticConfig, theme, themeName, state, styleProps, null, componentContext, allGroupContexts, elementType, startedUnhydrated, debugProp), isPassthrough = !splitStyles, contextForOverride = staticConfig.context;
|
|
3522
|
+
if (splitStyles == null ? void 0 : splitStyles.resolvedContextVariants) {
|
|
3523
|
+
var _staticConfig_parentStaticConfig, contextForVariants = staticConfig.context || ((_staticConfig_parentStaticConfig = staticConfig.parentStaticConfig) === null || _staticConfig_parentStaticConfig === void 0 ? void 0 : _staticConfig_parentStaticConfig.context);
|
|
3524
|
+
if (contextForVariants) {
|
|
3525
|
+
for (var key in splitStyles.resolvedContextVariants) overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = splitStyles.resolvedContextVariants[key];
|
|
3526
|
+
staticConfig.context || (contextForOverride = contextForVariants);
|
|
3527
|
+
}
|
|
3528
|
+
}
|
|
3529
|
+
var groupContext = groupName && (allGroupContexts == null ? void 0 : allGroupContexts[groupName]) || null;
|
|
3515
3530
|
if (!isPassthrough && groupContext && // avoids onLayout if we don't need it
|
|
3516
3531
|
props.containerType !== "normal") {
|
|
3517
3532
|
var groupState = groupContext == null ? void 0 : groupContext.state;
|
|
@@ -3553,8 +3568,8 @@ function createComponent(staticConfig) {
|
|
|
3553
3568
|
}), stateRef.current.setStateShallow = function(nextOrGetNext) {
|
|
3554
3569
|
var prev = stateRef.current.nextState || state, next = typeof nextOrGetNext == "function" ? nextOrGetNext(prev) : nextOrGetNext;
|
|
3555
3570
|
if (!(next === prev || isEqualShallow(prev, next))) {
|
|
3556
|
-
var canAvoidReRender = Object.keys(next).every(function(
|
|
3557
|
-
return avoidReRenderKeys.has(
|
|
3571
|
+
var canAvoidReRender = Object.keys(next).every(function(key3) {
|
|
3572
|
+
return avoidReRenderKeys.has(key3);
|
|
3558
3573
|
}), updatedState = __spreadValues(__spreadValues({}, prev), next);
|
|
3559
3574
|
if (stateRef.current.nextState = updatedState, canAvoidReRender) {
|
|
3560
3575
|
var _stateRef_current_updateStyleListener, _stateRef_current;
|
|
@@ -3800,9 +3815,9 @@ function createComponent(staticConfig) {
|
|
|
3800
3815
|
}))), "group" in props && (content = /* @__PURE__ */ jsxRuntimeExports.jsx(GroupContext.Provider, {
|
|
3801
3816
|
value: allGroupContexts,
|
|
3802
3817
|
children: content
|
|
3803
|
-
})), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps) {
|
|
3804
|
-
var Provider =
|
|
3805
|
-
for (var
|
|
3818
|
+
})), content = disableTheme || !splitStyles ? content : getThemedChildren(themeState, content, themeStateProps, false, stateRef), overriddenContextProps && contextForOverride) {
|
|
3819
|
+
var Provider = contextForOverride.Provider;
|
|
3820
|
+
for (var key1 in styledContextValue) key1 in overriddenContextProps || (overriddenContextProps[key1] = styledContextValue[key1]);
|
|
3806
3821
|
debugProp && console.info("overriddenContextProps", overriddenContextProps), content = /* @__PURE__ */ jsxRuntimeExports.jsx(Provider, __spreadProps(__spreadValues({
|
|
3807
3822
|
__disableMergeDefaultValues: true
|
|
3808
3823
|
}, overriddenContextProps), {
|
|
@@ -4171,6 +4186,35 @@ var cache = /* @__PURE__ */ new WeakMap(), createVariables = function(tokens) {
|
|
|
4171
4186
|
}
|
|
4172
4187
|
return cache.set(res, true), res;
|
|
4173
4188
|
};
|
|
4189
|
+
var noAnimationDriver = function(method) {
|
|
4190
|
+
console.warn(`No animation driver configured. To use ${method}, you must pass \`animations\` to createTamagui. See: https://tamagui.dev/docs/core/animations`);
|
|
4191
|
+
}, createEmptyAnimationDriver = function() {
|
|
4192
|
+
return {
|
|
4193
|
+
isReactNative: false,
|
|
4194
|
+
supportsCSS: true,
|
|
4195
|
+
classNameAnimation: true,
|
|
4196
|
+
isStub: true,
|
|
4197
|
+
animations: {},
|
|
4198
|
+
useAnimations: function() {
|
|
4199
|
+
return noAnimationDriver("animations");
|
|
4200
|
+
},
|
|
4201
|
+
usePresence: function() {
|
|
4202
|
+
return noAnimationDriver("usePresence");
|
|
4203
|
+
},
|
|
4204
|
+
ResetPresence: function() {
|
|
4205
|
+
return noAnimationDriver("ResetPresence");
|
|
4206
|
+
},
|
|
4207
|
+
useAnimatedNumber: function() {
|
|
4208
|
+
return noAnimationDriver("useAnimatedNumber");
|
|
4209
|
+
},
|
|
4210
|
+
useAnimatedNumberStyle: function() {
|
|
4211
|
+
return noAnimationDriver("useAnimatedNumberStyle");
|
|
4212
|
+
},
|
|
4213
|
+
useAnimatedNumberReaction: function() {
|
|
4214
|
+
return noAnimationDriver("useAnimatedNumberReaction");
|
|
4215
|
+
}
|
|
4216
|
+
};
|
|
4217
|
+
}, defaultAnimationDriver = createEmptyAnimationDriver();
|
|
4174
4218
|
var registerCSSVariable = function(v) {
|
|
4175
4219
|
tokensValueToVariable.set(getVariableValue(v), v);
|
|
4176
4220
|
}, variableToCSS = function(v) {
|
|
@@ -4281,7 +4325,7 @@ function createTamagui$1(configIn) {
|
|
|
4281
4325
|
fonts: {},
|
|
4282
4326
|
onlyAllowShorthands: false,
|
|
4283
4327
|
fontLanguages: [],
|
|
4284
|
-
animations:
|
|
4328
|
+
animations: defaultAnimationDriver,
|
|
4285
4329
|
media: {}
|
|
4286
4330
|
}, configIn), {
|
|
4287
4331
|
unset,
|
|
@@ -4331,8 +4375,7 @@ function getThemesDeduped(themes2, colorTokens) {
|
|
|
4331
4375
|
e2.names.push(themeName);
|
|
4332
4376
|
continue;
|
|
4333
4377
|
}
|
|
4334
|
-
var theme = __spreadValues({}, rawTheme);
|
|
4335
|
-
colorTokens && Object.assign(theme, colorTokens);
|
|
4378
|
+
var theme = __spreadValues(__spreadValues({}, colorTokens), rawTheme);
|
|
4336
4379
|
for (var key1 in theme) ensureThemeVariable(theme, key1);
|
|
4337
4380
|
var deduped = {
|
|
4338
4381
|
names: [themeName],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tamagui/core",
|
|
3
|
-
"version": "1.138.
|
|
3
|
+
"version": "1.138.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"source": "src/index.tsx",
|
|
6
6
|
"main": "dist/cjs",
|
|
@@ -33,18 +33,18 @@
|
|
|
33
33
|
"native-test.d.ts"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@tamagui/helpers": "1.138.
|
|
37
|
-
"@tamagui/react-native-media-driver": "1.138.
|
|
38
|
-
"@tamagui/react-native-use-pressable": "1.138.
|
|
39
|
-
"@tamagui/react-native-use-responder-events": "1.138.
|
|
40
|
-
"@tamagui/use-element-layout": "1.138.
|
|
41
|
-
"@tamagui/use-event": "1.138.
|
|
42
|
-
"@tamagui/web": "1.138.
|
|
36
|
+
"@tamagui/helpers": "1.138.3",
|
|
37
|
+
"@tamagui/react-native-media-driver": "1.138.3",
|
|
38
|
+
"@tamagui/react-native-use-pressable": "1.138.3",
|
|
39
|
+
"@tamagui/react-native-use-responder-events": "1.138.3",
|
|
40
|
+
"@tamagui/use-element-layout": "1.138.3",
|
|
41
|
+
"@tamagui/use-event": "1.138.3",
|
|
42
|
+
"@tamagui/web": "1.138.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@tamagui/build": "1.138.
|
|
46
|
-
"@tamagui/native-bundle": "1.138.
|
|
47
|
-
"@tamagui/react-native-web-lite": "1.138.
|
|
45
|
+
"@tamagui/build": "1.138.3",
|
|
46
|
+
"@tamagui/native-bundle": "1.138.3",
|
|
47
|
+
"@tamagui/react-native-web-lite": "1.138.3",
|
|
48
48
|
"@testing-library/react": "^16.1.0",
|
|
49
49
|
"csstype": "^3.0.10",
|
|
50
50
|
"react": "*",
|