@tamagui/core 1.89.6 → 1.89.8

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.
@@ -3902,7 +3902,7 @@ var require_getSplitStyles_native = __commonJS({
3902
3902
  return (staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles))[key] || ((_a = staticConfig.acceptTokens) == null ? void 0 : _a[key]);
3903
3903
  }
3904
3904
  var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3905
- var _a, _b, _c, _e, _f, _g, _h;
3905
+ var _a, _b, _c, _f, _g, _h;
3906
3906
  conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3907
3907
  let { shorthands } = conf, {
3908
3908
  isHOC,
@@ -3914,7 +3914,7 @@ var require_getSplitStyles_native = __commonJS({
3914
3914
  inlineWhenUnflattened,
3915
3915
  parentStaticConfig,
3916
3916
  acceptsClassName
3917
- } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = props.className || "", mediaStylesSeen = 0, styleState = {
3917
+ } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0, styleState = {
3918
3918
  curProps: {},
3919
3919
  classNames,
3920
3920
  conf,
@@ -3922,7 +3922,7 @@ var require_getSplitStyles_native = __commonJS({
3922
3922
  styleProps,
3923
3923
  componentState,
3924
3924
  staticConfig,
3925
- style,
3925
+ style: null,
3926
3926
  theme,
3927
3927
  usedKeys,
3928
3928
  viewProps,
@@ -3969,7 +3969,7 @@ var require_getSplitStyles_native = __commonJS({
3969
3969
  continue;
3970
3970
  }
3971
3971
  if (!isValidStyleKeyInit && keyInit.startsWith("_style") && (0, import_isObj.isObj)(valInit)) {
3972
- Object.assign(styleState.style, valInit);
3972
+ styleState.style || (styleState.style = {}), Object.assign(styleState.style, valInit);
3973
3973
  continue;
3974
3974
  }
3975
3975
  if (0)
@@ -3993,7 +3993,7 @@ var require_getSplitStyles_native = __commonJS({
3993
3993
  if ((shouldPassProp || isHOCShouldPassThrough) && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in import_skipProps.skipProps)
3994
3994
  continue;
3995
3995
  if ((isText || isInput) && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && valInit !== "unset" && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
3996
- style[keyInit] = valInit;
3996
+ styleState.style || (styleState.style = {}), styleState.style[keyInit] = valInit;
3997
3997
  continue;
3998
3998
  }
3999
3999
  let avoidPropMap = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit, expanded = avoidPropMap ? null : (0, import_propMapper.propMapper)(keyInit, valInit, styleState);
@@ -4046,7 +4046,7 @@ var require_getSplitStyles_native = __commonJS({
4046
4046
  let val2 = pseudoStyleObject[pkey];
4047
4047
  if (isDisabled) {
4048
4048
  let defaultValues = animatableDefaults[pkey];
4049
- defaultValues != null && !(pkey in usedKeys) && !(pkey in styleState.style) && mergeStyle(styleState, pkey, defaultValues);
4049
+ defaultValues != null && !(pkey in usedKeys) && (!styleState.style || !(pkey in styleState.style)) && mergeStyle(styleState, pkey, defaultValues);
4050
4050
  } else {
4051
4051
  let curImportance = usedKeys[pkey] || 0;
4052
4052
  importance >= curImportance && (pseudos || (pseudos = {}), pseudos[key] || (pseudos[key] = {}), pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2));
@@ -4092,16 +4092,16 @@ var require_getSplitStyles_native = __commonJS({
4092
4092
  }
4093
4093
  let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
4094
4094
  mediaStylesSeen += 1;
4095
- for (let style2 of mediaStyles) {
4095
+ for (let style of mediaStyles) {
4096
4096
  let out = (0, import_createMediaStyle.createMediaStyle)(
4097
- style2,
4097
+ style,
4098
4098
  mediaKeyShort,
4099
4099
  import_useMedia.mediaQueryConfig,
4100
4100
  isMedia,
4101
4101
  !1,
4102
4102
  priority
4103
4103
  );
4104
- `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4104
+ `${style.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4105
4105
  }
4106
4106
  } else {
4107
4107
  let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
@@ -4139,8 +4139,8 @@ var require_getSplitStyles_native = __commonJS({
4139
4139
  space = valInit.space;
4140
4140
  continue;
4141
4141
  }
4142
- (0, import_useMedia.mergeMediaByImportance)(
4143
- style,
4142
+ styleState.style || (styleState.style = {}), (0, import_useMedia.mergeMediaByImportance)(
4143
+ styleState.style,
4144
4144
  mediaKeyShort,
4145
4145
  subKey,
4146
4146
  mediaStyle[subKey],
@@ -4176,20 +4176,19 @@ var require_getSplitStyles_native = __commonJS({
4176
4176
  if (isHOC)
4177
4177
  viewProps.style = props.style;
4178
4178
  else
4179
- for (let style2 of [].concat(props.style))
4180
- style2 && (style2.$$css ? Object.assign(styleState.classNames, style2) : Object.assign(styleState.style, style2));
4181
- if (styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
4182
- mergeTransform(style, key, val, !0);
4183
- }), parentSplitStyles && !shouldDoClasses))
4179
+ for (let style of [].concat(props.style))
4180
+ style && (style.$$css ? Object.assign(styleState.classNames, style) : (styleState.style || (styleState.style = {}), Object.assign(styleState.style, style)));
4181
+ if (styleProps.noNormalize !== !1 && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), import_constants.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(styleState.style)), styleState.transforms && (styleState.style || (styleState.style = {}), Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
4182
+ mergeTransform(styleState.style, key, val, !0);
4183
+ })), parentSplitStyles && !shouldDoClasses))
4184
4184
  for (let key in parentSplitStyles.style)
4185
- key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
4185
+ key in classNames || styleState.style && key in styleState.style || (styleState.style || (styleState.style = {}), styleState.style[key] = parentSplitStyles.style[key]);
4186
4186
  let result = {
4187
4187
  space,
4188
4188
  hasMedia,
4189
4189
  fontFamily: styleState.fontFamily,
4190
4190
  viewProps,
4191
- // @ts-expect-error
4192
- style,
4191
+ style: styleState.style,
4193
4192
  pseudos,
4194
4193
  classNames,
4195
4194
  rulesToInsert,
@@ -4197,31 +4196,36 @@ var require_getSplitStyles_native = __commonJS({
4197
4196
  pseudoGroups,
4198
4197
  mediaGroups
4199
4198
  };
4200
- if (style.fontFamily) {
4201
- let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
4202
- if (faceInfo) {
4203
- let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
4204
- overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4199
+ {
4200
+ let style = styleState.style;
4201
+ if (style != null && style.fontFamily) {
4202
+ let faceInfo = (_f = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _f.face;
4203
+ if (faceInfo) {
4204
+ let overrideFace = (_h = (_g = faceInfo[style.fontWeight]) == null ? void 0 : _g[style.fontStyle || "normal"]) == null ? void 0 : _h.val;
4205
+ overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4206
+ }
4205
4207
  }
4206
4208
  }
4207
- let fontFamily = isText || isInput ? styleState.fontFamily || ((_h = staticConfig.defaultProps) == null ? void 0 : _h.fontFamily) : null;
4208
- fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
4209
- let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", asChild = props.asChild;
4210
- if (asChild === "except-style" || asChild === "except-style-web" || styleProps.noMergeStyle || (viewProps.style = style), !1)
4209
+ let asChild = props.asChild;
4210
+ if (!(asChild === "except-style" || asChild === "except-style-web")) {
4211
+ let style = styleState.style;
4212
+ style && !styleProps.noMergeStyle && (viewProps.style = style);
4213
+ }
4214
+ if (0)
4211
4215
  try {
4212
4216
  } catch {
4213
4217
  }
4214
4218
  return result;
4215
4219
  };
4216
4220
  function mergeStyle(styleState, key, val, disableNormalize = !1) {
4217
- let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
4221
+ let { classNames, viewProps, usedKeys, styleProps } = styleState;
4218
4222
  if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
4219
4223
  classNames[key] = val, usedKeys[key] || (usedKeys[key] = 1);
4220
4224
  else if (key in import_helpers.stylePropsTransform)
4221
4225
  styleState.transforms || (styleState.transforms = {}), styleState.transforms[key] = val;
4222
4226
  else {
4223
4227
  let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
4224
- key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
4228
+ key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : (styleState.style || (styleState.style = {}), styleState.style[key] = out);
4225
4229
  }
4226
4230
  }
4227
4231
  var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
@@ -4705,7 +4709,7 @@ var require_createComponent_native = __commonJS({
4705
4709
  elementType,
4706
4710
  debugProp
4707
4711
  );
4708
- props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style.opacity = 0), curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
4712
+ props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style || (splitStyles.style = {}), splitStyles.style.opacity = 0), curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
4709
4713
  let isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
4710
4714
  (0, import_useMedia.setMediaShouldUpdate)(stateRef, {
4711
4715
  enabled: shouldListenForMedia,
@@ -4754,7 +4758,7 @@ var require_createComponent_native = __commonJS({
4754
4758
  let animations = useAnimations({
4755
4759
  props: propsWithAnimation,
4756
4760
  // if hydrating, send empty style
4757
- style: splitStylesStyle,
4761
+ style: splitStylesStyle || {},
4758
4762
  presence,
4759
4763
  componentState: state,
4760
4764
  styleProps,
@@ -4897,6 +4901,7 @@ var require_createComponent_native = __commonJS({
4897
4901
  let ResetPresence = (_m = config == null ? void 0 : config.animations) == null ? void 0 : _m.ResetPresence;
4898
4902
  ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResetPresence, { children: content }));
4899
4903
  let groupState = curState.group, subGroupContext = (0, import_react3.useMemo)(() => {
4904
+ var _a3, _b2;
4900
4905
  if (!(!groupState || !groupName))
4901
4906
  return groupState.listeners.clear(), {
4902
4907
  ...componentContext.groups,
@@ -4908,8 +4913,8 @@ var require_createComponent_native = __commonJS({
4908
4913
  // capture just initial width and height if they exist
4909
4914
  // will have top, left, width, height (not x, y)
4910
4915
  layout: {
4911
- width: fromPx(splitStyles.style.width),
4912
- height: fromPx(splitStyles.style.height)
4916
+ width: fromPx((_a3 = splitStyles.style) == null ? void 0 : _a3.width),
4917
+ height: fromPx((_b2 = splitStyles.style) == null ? void 0 : _b2.height)
4913
4918
  }
4914
4919
  }
4915
4920
  },
@@ -5919,8 +5924,8 @@ var require_internalWithTheme_native = __commonJS({
5919
5924
  });
5920
5925
  module2.exports = __toCommonJS2(internalWithTheme_exports);
5921
5926
  var import_useTheme = require_useTheme_native(), import_jsx_runtime = require("react/jsx-runtime"), internalWithTheme = (Component, styleProvider) => (props) => {
5922
- let { expressions, ...rest } = props, theme = (0, import_useTheme.useTheme)();
5923
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { style: styleProvider(theme, expressions), ...rest });
5927
+ let { _expressions = [], ...rest } = props, theme = (0, import_useTheme.useTheme)();
5928
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, { style: styleProvider(theme, _expressions), ...rest });
5924
5929
  };
5925
5930
  }
5926
5931
  });
@@ -6064,7 +6069,7 @@ var require_useProps_native = __commonJS({
6064
6069
  };
6065
6070
  }
6066
6071
  function useStyle(props, opts) {
6067
- return usePropsAndStyle(props, opts)[1];
6072
+ return usePropsAndStyle(props, opts)[1] || {};
6068
6073
  }
6069
6074
  function usePropsAndStyle(props, opts) {
6070
6075
  var _a, _b;
@@ -6088,7 +6093,7 @@ var require_useProps_native = __commonJS({
6088
6093
  null,
6089
6094
  componentContext
6090
6095
  );
6091
- return [splitStyles.viewProps, splitStyles.style, theme, media];
6096
+ return [splitStyles.viewProps, splitStyles.style || {}, theme, media];
6092
6097
  }
6093
6098
  }
6094
6099
  });