tamagui 1.89.5 → 1.89.7

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 CHANGED
@@ -3909,7 +3909,7 @@ var require_getSplitStyles_native = __commonJS({
3909
3909
  return (staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles))[key] || ((_a = staticConfig.acceptTokens) == null ? void 0 : _a[key]);
3910
3910
  }
3911
3911
  var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3912
- var _a, _b, _c, _e, _f, _g, _h;
3912
+ var _a, _b, _c, _f, _g, _h;
3913
3913
  conf = conf || (0, import_config.getConfig)(), import_constants4.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3914
3914
  let { shorthands } = conf, {
3915
3915
  isHOC,
@@ -3921,7 +3921,7 @@ var require_getSplitStyles_native = __commonJS({
3921
3921
  inlineWhenUnflattened,
3922
3922
  parentStaticConfig,
3923
3923
  acceptsClassName
3924
- } = staticConfig, viewProps = {}, mediaState3 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants4.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 = {
3924
+ } = staticConfig, viewProps = {}, mediaState3 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants4.isWeb && !styleProps.noClassNames, rulesToInsert = void 0, classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, className = props.className || "", mediaStylesSeen = 0, styleState = {
3925
3925
  curProps: {},
3926
3926
  classNames,
3927
3927
  conf,
@@ -3929,7 +3929,7 @@ var require_getSplitStyles_native = __commonJS({
3929
3929
  styleProps,
3930
3930
  componentState,
3931
3931
  staticConfig,
3932
- style,
3932
+ style: null,
3933
3933
  theme,
3934
3934
  usedKeys,
3935
3935
  viewProps,
@@ -3985,7 +3985,7 @@ var require_getSplitStyles_native = __commonJS({
3985
3985
  continue;
3986
3986
  }
3987
3987
  if (!isValidStyleKeyInit && keyInit.startsWith("_style") && (0, import_isObj.isObj)(valInit)) {
3988
- Object.assign(styleState.style, valInit);
3988
+ styleState.style || (styleState.style = {}), Object.assign(styleState.style, valInit);
3989
3989
  continue;
3990
3990
  }
3991
3991
  if (0)
@@ -4018,7 +4018,7 @@ var require_getSplitStyles_native = __commonJS({
4018
4018
  })), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in import_skipProps.skipProps)
4019
4019
  continue;
4020
4020
  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] !== "$")) {
4021
- style[keyInit] = valInit;
4021
+ styleState.style || (styleState.style = {}), styleState.style[keyInit] = valInit;
4022
4022
  continue;
4023
4023
  }
4024
4024
  let avoidPropMap = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit, expanded = avoidPropMap ? null : (0, import_propMapper.propMapper)(keyInit, valInit, styleState);
@@ -4045,7 +4045,7 @@ var require_getSplitStyles_native = __commonJS({
4045
4045
  }), (0, import_log.log)("expanded", expanded, `
4046
4046
  usedKeys`, { ...usedKeys }, `
4047
4047
  current`, {
4048
- ...style
4048
+ ...styleState.style
4049
4049
  }));
4050
4050
  } catch {
4051
4051
  }
@@ -4091,7 +4091,7 @@ current`, {
4091
4091
  let val2 = pseudoStyleObject[pkey];
4092
4092
  if (isDisabled) {
4093
4093
  let defaultValues = animatableDefaults[pkey];
4094
- defaultValues != null && !(pkey in usedKeys) && !(pkey in styleState.style) && mergeStyle(styleState, pkey, defaultValues);
4094
+ defaultValues != null && !(pkey in usedKeys) && (!styleState.style || !(pkey in styleState.style)) && mergeStyle(styleState, pkey, defaultValues);
4095
4095
  } else {
4096
4096
  let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
4097
4097
  shouldMerge && (pseudos || (pseudos = {}), pseudos[key] || (pseudos[key] = {}), pseudos[key][pkey] = val2, mergeStyle(styleState, pkey, val2)), process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)(" subKey", pkey, shouldMerge, {
@@ -4155,16 +4155,16 @@ current`, {
4155
4155
  }
4156
4156
  let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
4157
4157
  mediaStylesSeen += 1;
4158
- for (let style2 of mediaStyles) {
4158
+ for (let style of mediaStyles) {
4159
4159
  let out = (0, import_createMediaStyle.createMediaStyle)(
4160
- style2,
4160
+ style,
4161
4161
  mediaKeyShort,
4162
4162
  import_useMedia.mediaQueryConfig,
4163
4163
  isMedia,
4164
4164
  !1,
4165
4165
  priority
4166
4166
  );
4167
- process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style2.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4167
+ process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out), `${style.property}${PROP_SPLIT}${mediaKeyShort}` in usedKeys || out.identifier;
4168
4168
  }
4169
4169
  } else {
4170
4170
  let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
@@ -4204,8 +4204,8 @@ current`, {
4204
4204
  space = valInit.space;
4205
4205
  continue;
4206
4206
  }
4207
- (0, import_useMedia.mergeMediaByImportance)(
4208
- style,
4207
+ styleState.style || (styleState.style = {}), (0, import_useMedia.mergeMediaByImportance)(
4208
+ styleState.style,
4209
4209
  mediaKeyShort,
4210
4210
  subKey,
4211
4211
  mediaStyle[subKey],
@@ -4234,7 +4234,7 @@ current`, {
4234
4234
  }
4235
4235
  if (process.env.NODE_ENV === "development" && debug === "verbose") {
4236
4236
  try {
4237
- (0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", { ...style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
4237
+ (0, import_log.log)(" \u2714\uFE0F expand complete", keyInit), (0, import_log.log)("style", { ...styleState.style }), (0, import_log.log)("transforms", { ...transforms }), (0, import_log.log)("viewProps", { ...viewProps });
4238
4238
  } catch {
4239
4239
  }
4240
4240
  console.groupEnd();
@@ -4244,20 +4244,19 @@ current`, {
4244
4244
  if (isHOC)
4245
4245
  viewProps.style = props.style;
4246
4246
  else
4247
- for (let style2 of [].concat(props.style))
4248
- style2 && (style2.$$css ? Object.assign(styleState.classNames, style2) : Object.assign(styleState.style, style2));
4249
- if (styleProps.noNormalize !== !1 && ((0, import_expandStyles.fixStyles)(style), import_constants4.isWeb && !staticConfig.isReactNative && (0, import_getStylesAtomic.styleToCSS)(style), styleState.transforms && Object.entries(styleState.transforms).sort(([a], [b]) => a.localeCompare(b)).forEach(([key, val]) => {
4250
- mergeTransform(style, key, val, !0);
4251
- }), parentSplitStyles && !shouldDoClasses))
4247
+ for (let style of [].concat(props.style))
4248
+ style && (style.$$css ? Object.assign(styleState.classNames, style) : (styleState.style || (styleState.style = {}), Object.assign(styleState.style, style)));
4249
+ if (styleProps.noNormalize !== !1 && (styleState.style && ((0, import_expandStyles.fixStyles)(styleState.style), import_constants4.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]) => {
4250
+ mergeTransform(styleState.style, key, val, !0);
4251
+ })), parentSplitStyles && !shouldDoClasses))
4252
4252
  for (let key in parentSplitStyles.style)
4253
- key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
4253
+ key in classNames || styleState.style && key in styleState.style || (styleState.style || (styleState.style = {}), styleState.style[key] = parentSplitStyles.style[key]);
4254
4254
  let result = {
4255
4255
  space,
4256
4256
  hasMedia,
4257
4257
  fontFamily: styleState.fontFamily,
4258
4258
  viewProps,
4259
- // @ts-expect-error
4260
- style,
4259
+ style: styleState.style,
4261
4260
  pseudos,
4262
4261
  classNames,
4263
4262
  rulesToInsert,
@@ -4265,18 +4264,23 @@ current`, {
4265
4264
  pseudoGroups,
4266
4265
  mediaGroups
4267
4266
  };
4268
- if (style.fontFamily) {
4269
- let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
4270
- if (faceInfo) {
4271
- let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
4272
- overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4267
+ {
4268
+ let style = styleState.style;
4269
+ if (style != null && style.fontFamily) {
4270
+ let faceInfo = (_f = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _f.face;
4271
+ if (faceInfo) {
4272
+ let overrideFace = (_h = (_g = faceInfo[style.fontWeight]) == null ? void 0 : _g[style.fontStyle || "normal"]) == null ? void 0 : _h.val;
4273
+ overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4274
+ }
4275
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4273
4276
  }
4274
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4275
4277
  }
4276
- let fontFamily = isText || isInput ? styleState.fontFamily || ((_h = staticConfig.defaultProps) == null ? void 0 : _h.fontFamily) : null;
4277
- fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
4278
- let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", asChild = props.asChild;
4279
- if (asChild === "except-style" || asChild === "except-style-web" || styleProps.noExpand || (viewProps.style = style), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4278
+ let asChild = props.asChild;
4279
+ if (!(asChild === "except-style" || asChild === "except-style-web")) {
4280
+ let style = styleState.style;
4281
+ style && !styleProps.noMergeStyle && (viewProps.style = style);
4282
+ }
4283
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4280
4284
  console.groupCollapsed("\u{1F539} getSplitStyles ===>");
4281
4285
  try {
4282
4286
  let logs = {
@@ -4285,7 +4289,6 @@ current`, {
4285
4289
  componentState,
4286
4290
  transforms,
4287
4291
  viewProps,
4288
- viewPropsOrder: Object.keys(viewProps),
4289
4292
  rulesToInsert,
4290
4293
  parentSplitStyles
4291
4294
  };
@@ -4298,14 +4301,14 @@ current`, {
4298
4301
  return result;
4299
4302
  };
4300
4303
  function mergeStyle(styleState, key, val, disableNormalize = !1) {
4301
- let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
4304
+ let { classNames, viewProps, usedKeys, styleProps } = styleState;
4302
4305
  if (import_constants4.isWeb && (val == null ? void 0 : val[0]) === "_")
4303
4306
  classNames[key] = val, usedKeys[key] || (usedKeys[key] = 1);
4304
4307
  else if (key in import_helpers.stylePropsTransform)
4305
4308
  styleState.transforms || (styleState.transforms = {}), styleState.transforms[key] = val;
4306
4309
  else {
4307
4310
  let out = import_constants4.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
4308
- key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
4311
+ key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : (styleState.style || (styleState.style = {}), styleState.style[key] = out);
4309
4312
  }
4310
4313
  }
4311
4314
  var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
@@ -4852,7 +4855,7 @@ var require_createComponent_native = __commonJS({
4852
4855
  elementType,
4853
4856
  debugProp
4854
4857
  );
4855
- props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
4858
+ props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style || (splitStyles.style = {}), splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
4856
4859
  let isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
4857
4860
  (0, import_useMedia.setMediaShouldUpdate)(stateRef, {
4858
4861
  enabled: shouldListenForMedia,
@@ -4901,7 +4904,7 @@ var require_createComponent_native = __commonJS({
4901
4904
  let animations = useAnimations({
4902
4905
  props: propsWithAnimation,
4903
4906
  // if hydrating, send empty style
4904
- style: splitStylesStyle,
4907
+ style: splitStylesStyle || {},
4905
4908
  presence,
4906
4909
  componentState: state,
4907
4910
  styleProps,
@@ -5058,6 +5061,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5058
5061
  let ResetPresence = (_m = config == null ? void 0 : config.animations) == null ? void 0 : _m.ResetPresence;
5059
5062
  ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ResetPresence, { children: content })), process.env.NODE_ENV === "development" && time && time`create-element`;
5060
5063
  let groupState = curState.group, subGroupContext = (0, import_react2.useMemo)(() => {
5064
+ var _a3, _b2;
5061
5065
  if (!(!groupState || !groupName))
5062
5066
  return groupState.listeners.clear(), {
5063
5067
  ...componentContext.groups,
@@ -5069,8 +5073,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5069
5073
  // capture just initial width and height if they exist
5070
5074
  // will have top, left, width, height (not x, y)
5071
5075
  layout: {
5072
- width: fromPx(splitStyles.style.width),
5073
- height: fromPx(splitStyles.style.height)
5076
+ width: fromPx((_a3 = splitStyles.style) == null ? void 0 : _a3.width),
5077
+ height: fromPx((_b2 = splitStyles.style) == null ? void 0 : _b2.height)
5074
5078
  }
5075
5079
  }
5076
5080
  },
@@ -6272,7 +6276,7 @@ var require_useProps_native = __commonJS({
6272
6276
  };
6273
6277
  }
6274
6278
  function useStyle2(props, opts) {
6275
- return usePropsAndStyle2(props, opts)[1];
6279
+ return usePropsAndStyle2(props, opts)[1] || {};
6276
6280
  }
6277
6281
  function usePropsAndStyle2(props, opts) {
6278
6282
  var _a, _b;
@@ -6288,6 +6292,7 @@ var require_useProps_native = __commonJS({
6288
6292
  isAnimated: !1,
6289
6293
  mediaState: media,
6290
6294
  noSkip: !0,
6295
+ noMergeStyle: !0,
6291
6296
  noClassNames: !0,
6292
6297
  resolveValues: "auto",
6293
6298
  ...opts
@@ -6295,7 +6300,7 @@ var require_useProps_native = __commonJS({
6295
6300
  null,
6296
6301
  componentContext
6297
6302
  );
6298
- return [splitStyles.viewProps, splitStyles.style, theme, media];
6303
+ return [splitStyles.viewProps, splitStyles.style || {}, theme, media];
6299
6304
  }
6300
6305
  }
6301
6306
  });