@tamagui/core 1.89.6 → 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
@@ -4070,7 +4070,7 @@ var require_getSplitStyles_native = __commonJS({
4070
4070
  return (staticConfig.validStyles || (staticConfig.isText || staticConfig.isInput ? import_helpers.stylePropsText : import_helpers.validStyles))[key] || ((_a = staticConfig.acceptTokens) == null ? void 0 : _a[key]);
4071
4071
  }
4072
4072
  var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
4073
- var _a, _b, _c, _e, _f, _g, _h;
4073
+ var _a, _b, _c, _f, _g, _h;
4074
4074
  conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
4075
4075
  let { shorthands } = conf, {
4076
4076
  isHOC,
@@ -4082,7 +4082,7 @@ var require_getSplitStyles_native = __commonJS({
4082
4082
  inlineWhenUnflattened,
4083
4083
  parentStaticConfig,
4084
4084
  acceptsClassName
4085
- } = 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 = {
4085
+ } = 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 = {
4086
4086
  curProps: {},
4087
4087
  classNames,
4088
4088
  conf,
@@ -4090,7 +4090,7 @@ var require_getSplitStyles_native = __commonJS({
4090
4090
  styleProps,
4091
4091
  componentState,
4092
4092
  staticConfig,
4093
- style,
4093
+ style: null,
4094
4094
  theme,
4095
4095
  usedKeys,
4096
4096
  viewProps,
@@ -4146,7 +4146,7 @@ var require_getSplitStyles_native = __commonJS({
4146
4146
  continue;
4147
4147
  }
4148
4148
  if (!isValidStyleKeyInit && keyInit.startsWith("_style") && (0, import_isObj.isObj)(valInit)) {
4149
- Object.assign(styleState.style, valInit);
4149
+ styleState.style || (styleState.style = {}), Object.assign(styleState.style, valInit);
4150
4150
  continue;
4151
4151
  }
4152
4152
  if (0)
@@ -4179,7 +4179,7 @@ var require_getSplitStyles_native = __commonJS({
4179
4179
  })), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in import_skipProps.skipProps)
4180
4180
  continue;
4181
4181
  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] !== "$")) {
4182
- style[keyInit] = valInit;
4182
+ styleState.style || (styleState.style = {}), styleState.style[keyInit] = valInit;
4183
4183
  continue;
4184
4184
  }
4185
4185
  let avoidPropMap = isMediaOrPseudo || !isVariant && !isValidStyleKeyInit, expanded = avoidPropMap ? null : (0, import_propMapper.propMapper)(keyInit, valInit, styleState);
@@ -4206,7 +4206,7 @@ var require_getSplitStyles_native = __commonJS({
4206
4206
  }), (0, import_log.log)("expanded", expanded, `
4207
4207
  usedKeys`, { ...usedKeys }, `
4208
4208
  current`, {
4209
- ...style
4209
+ ...styleState.style
4210
4210
  }));
4211
4211
  } catch {
4212
4212
  }
@@ -4252,7 +4252,7 @@ current`, {
4252
4252
  let val2 = pseudoStyleObject[pkey];
4253
4253
  if (isDisabled) {
4254
4254
  let defaultValues = animatableDefaults[pkey];
4255
- defaultValues != null && !(pkey in usedKeys) && !(pkey in styleState.style) && mergeStyle(styleState, pkey, defaultValues);
4255
+ defaultValues != null && !(pkey in usedKeys) && (!styleState.style || !(pkey in styleState.style)) && mergeStyle(styleState, pkey, defaultValues);
4256
4256
  } else {
4257
4257
  let curImportance = usedKeys[pkey] || 0, shouldMerge = importance >= curImportance;
4258
4258
  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, {
@@ -4316,16 +4316,16 @@ current`, {
4316
4316
  }
4317
4317
  let mediaStyles = (0, import_getStylesAtomic.getStylesAtomic)(mediaStyle, debug), priority = mediaStylesSeen;
4318
4318
  mediaStylesSeen += 1;
4319
- for (let style2 of mediaStyles) {
4319
+ for (let style of mediaStyles) {
4320
4320
  let out = (0, import_createMediaStyle.createMediaStyle)(
4321
- style2,
4321
+ style,
4322
4322
  mediaKeyShort,
4323
4323
  import_useMedia.mediaQueryConfig,
4324
4324
  isMedia,
4325
4325
  !1,
4326
4326
  priority
4327
4327
  );
4328
- 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;
4328
+ 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;
4329
4329
  }
4330
4330
  } else {
4331
4331
  let isThemeMedia = isMedia === "theme", isGroupMedia = isMedia === "group";
@@ -4365,8 +4365,8 @@ current`, {
4365
4365
  space = valInit.space;
4366
4366
  continue;
4367
4367
  }
4368
- (0, import_useMedia.mergeMediaByImportance)(
4369
- style,
4368
+ styleState.style || (styleState.style = {}), (0, import_useMedia.mergeMediaByImportance)(
4369
+ styleState.style,
4370
4370
  mediaKeyShort,
4371
4371
  subKey,
4372
4372
  mediaStyle[subKey],
@@ -4395,7 +4395,7 @@ current`, {
4395
4395
  }
4396
4396
  if (process.env.NODE_ENV === "development" && debug === "verbose") {
4397
4397
  try {
4398
- (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 });
4398
+ (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 });
4399
4399
  } catch {
4400
4400
  }
4401
4401
  console.groupEnd();
@@ -4405,20 +4405,19 @@ current`, {
4405
4405
  if (isHOC)
4406
4406
  viewProps.style = props.style;
4407
4407
  else
4408
- for (let style2 of [].concat(props.style))
4409
- style2 && (style2.$$css ? Object.assign(styleState.classNames, style2) : Object.assign(styleState.style, style2));
4410
- 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]) => {
4411
- mergeTransform(style, key, val, !0);
4412
- }), parentSplitStyles && !shouldDoClasses))
4408
+ for (let style of [].concat(props.style))
4409
+ style && (style.$$css ? Object.assign(styleState.classNames, style) : (styleState.style || (styleState.style = {}), Object.assign(styleState.style, style)));
4410
+ 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]) => {
4411
+ mergeTransform(styleState.style, key, val, !0);
4412
+ })), parentSplitStyles && !shouldDoClasses))
4413
4413
  for (let key in parentSplitStyles.style)
4414
- key in classNames || key in style || (style[key] = parentSplitStyles.style[key]);
4414
+ key in classNames || styleState.style && key in styleState.style || (styleState.style || (styleState.style = {}), styleState.style[key] = parentSplitStyles.style[key]);
4415
4415
  let result = {
4416
4416
  space,
4417
4417
  hasMedia,
4418
4418
  fontFamily: styleState.fontFamily,
4419
4419
  viewProps,
4420
- // @ts-expect-error
4421
- style,
4420
+ style: styleState.style,
4422
4421
  pseudos,
4423
4422
  classNames,
4424
4423
  rulesToInsert,
@@ -4426,18 +4425,23 @@ current`, {
4426
4425
  pseudoGroups,
4427
4426
  mediaGroups
4428
4427
  };
4429
- if (style.fontFamily) {
4430
- let faceInfo = (_e = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _e.face;
4431
- if (faceInfo) {
4432
- let overrideFace = (_g = (_f = faceInfo[style.fontWeight]) == null ? void 0 : _f[style.fontStyle || "normal"]) == null ? void 0 : _g.val;
4433
- overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4428
+ {
4429
+ let style = styleState.style;
4430
+ if (style != null && style.fontFamily) {
4431
+ let faceInfo = (_f = (0, import_config.getFont)(style.fontFamily)) == null ? void 0 : _f.face;
4432
+ if (faceInfo) {
4433
+ let overrideFace = (_h = (_g = faceInfo[style.fontWeight]) == null ? void 0 : _g[style.fontStyle || "normal"]) == null ? void 0 : _h.val;
4434
+ overrideFace && (style.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style.fontWeight, delete style.fontStyle);
4435
+ }
4436
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4434
4437
  }
4435
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)(`Found fontFamily native: ${style.fontFamily}`, faceInfo);
4436
4438
  }
4437
- let fontFamily = isText || isInput ? styleState.fontFamily || ((_h = staticConfig.defaultProps) == null ? void 0 : _h.fontFamily) : null;
4438
- fontFamily && fontFamily[0] === "$" && (fontFamily = fontFamily.slice(1));
4439
- let fontFamilyClassName = fontFamily ? `font_${fontFamily}` : "", asChild = props.asChild;
4440
- if (asChild === "except-style" || asChild === "except-style-web" || styleProps.noMergeStyle || (viewProps.style = style), process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4439
+ let asChild = props.asChild;
4440
+ if (!(asChild === "except-style" || asChild === "except-style-web")) {
4441
+ let style = styleState.style;
4442
+ style && !styleProps.noMergeStyle && (viewProps.style = style);
4443
+ }
4444
+ if (process.env.NODE_ENV === "development" && debug === "verbose" && import_isDevTools.isDevTools) {
4441
4445
  console.groupCollapsed("\u{1F539} getSplitStyles ===>");
4442
4446
  try {
4443
4447
  let logs = {
@@ -4446,7 +4450,6 @@ current`, {
4446
4450
  componentState,
4447
4451
  transforms,
4448
4452
  viewProps,
4449
- viewPropsOrder: Object.keys(viewProps),
4450
4453
  rulesToInsert,
4451
4454
  parentSplitStyles
4452
4455
  };
@@ -4459,14 +4462,14 @@ current`, {
4459
4462
  return result;
4460
4463
  };
4461
4464
  function mergeStyle(styleState, key, val, disableNormalize = !1) {
4462
- let { classNames, viewProps, style, usedKeys, styleProps } = styleState;
4465
+ let { classNames, viewProps, usedKeys, styleProps } = styleState;
4463
4466
  if (import_constants.isWeb && (val == null ? void 0 : val[0]) === "_")
4464
4467
  classNames[key] = val, usedKeys[key] || (usedKeys[key] = 1);
4465
4468
  else if (key in import_helpers.stylePropsTransform)
4466
4469
  styleState.transforms || (styleState.transforms = {}), styleState.transforms[key] = val;
4467
4470
  else {
4468
4471
  let out = import_constants.isWeb && !disableNormalize && !styleProps.noNormalize ? (0, import_normalizeValueWithProperty.normalizeValueWithProperty)(val, key) : val;
4469
- key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : style[key] = out;
4472
+ key in import_helpers.validStylesOnBaseProps ? viewProps[key] = out : (styleState.style || (styleState.style = {}), styleState.style[key] = out);
4470
4473
  }
4471
4474
  }
4472
4475
  var getSubStyle = (styleState, subKey, styleIn, avoidMergeTransform) => {
@@ -5013,7 +5016,7 @@ var require_createComponent_native = __commonJS({
5013
5016
  elementType,
5014
5017
  debugProp
5015
5018
  );
5016
- props.group && props.untilMeasured === "hide" && !curState.hasMeasured && (splitStyles.style.opacity = 0), process.env.NODE_ENV === "development" && time && time`split-styles`, curState.isListeningToTheme = splitStyles.dynamicThemeAccess;
5019
+ 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;
5017
5020
  let isMediaArray = splitStyles.hasMedia && Array.isArray(splitStyles.hasMedia), shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || isMediaArray || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = isMediaArray ? splitStyles.hasMedia : null;
5018
5021
  (0, import_useMedia.setMediaShouldUpdate)(stateRef, {
5019
5022
  enabled: shouldListenForMedia,
@@ -5062,7 +5065,7 @@ var require_createComponent_native = __commonJS({
5062
5065
  let animations = useAnimations({
5063
5066
  props: propsWithAnimation,
5064
5067
  // if hydrating, send empty style
5065
- style: splitStylesStyle,
5068
+ style: splitStylesStyle || {},
5066
5069
  presence,
5067
5070
  componentState: state,
5068
5071
  styleProps,
@@ -5219,6 +5222,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5219
5222
  let ResetPresence = (_m = config == null ? void 0 : config.animations) == null ? void 0 : _m.ResetPresence;
5220
5223
  ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ResetPresence, { children: content })), process.env.NODE_ENV === "development" && time && time`create-element`;
5221
5224
  let groupState = curState.group, subGroupContext = (0, import_react3.useMemo)(() => {
5225
+ var _a3, _b2;
5222
5226
  if (!(!groupState || !groupName))
5223
5227
  return groupState.listeners.clear(), {
5224
5228
  ...componentContext.groups,
@@ -5230,8 +5234,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5230
5234
  // capture just initial width and height if they exist
5231
5235
  // will have top, left, width, height (not x, y)
5232
5236
  layout: {
5233
- width: fromPx(splitStyles.style.width),
5234
- height: fromPx(splitStyles.style.height)
5237
+ width: fromPx((_a3 = splitStyles.style) == null ? void 0 : _a3.width),
5238
+ height: fromPx((_b2 = splitStyles.style) == null ? void 0 : _b2.height)
5235
5239
  }
5236
5240
  }
5237
5241
  },
@@ -6433,7 +6437,7 @@ var require_useProps_native = __commonJS({
6433
6437
  };
6434
6438
  }
6435
6439
  function useStyle(props, opts) {
6436
- return usePropsAndStyle(props, opts)[1];
6440
+ return usePropsAndStyle(props, opts)[1] || {};
6437
6441
  }
6438
6442
  function usePropsAndStyle(props, opts) {
6439
6443
  var _a, _b;
@@ -6457,7 +6461,7 @@ var require_useProps_native = __commonJS({
6457
6461
  null,
6458
6462
  componentContext
6459
6463
  );
6460
- return [splitStyles.viewProps, splitStyles.style, theme, media];
6464
+ return [splitStyles.viewProps, splitStyles.style || {}, theme, media];
6461
6465
  }
6462
6466
  }
6463
6467
  });