@tamagui/core 1.80.4 → 1.81.1

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
@@ -1704,7 +1704,7 @@ var require_objectIdentityKey_native = __commonJS({
1704
1704
  for (let key in obj) {
1705
1705
  k += key;
1706
1706
  let arg = obj[key], type = typeof arg;
1707
- if (!arg || type !== "object")
1707
+ if (!arg || type !== "object" && type !== "function")
1708
1708
  k += type + arg;
1709
1709
  else if (cache.has(arg))
1710
1710
  k += cache.get(arg);
@@ -1743,7 +1743,7 @@ var require_createStyledContext_native = __commonJS({
1743
1743
  scope,
1744
1744
  ...values
1745
1745
  }) => {
1746
- let value = (0, import_react3.useMemo)(() => ({
1746
+ let next = (0, import_react3.useMemo)(() => ({
1747
1747
  // this ! is a workaround for ts error
1748
1748
  ...defaultValues,
1749
1749
  ...values
@@ -1752,7 +1752,7 @@ var require_createStyledContext_native = __commonJS({
1752
1752
  let ScopedContext = scopedContexts.get(scope);
1753
1753
  ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1754
1754
  }
1755
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value, children });
1755
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
1756
1756
  }, useStyledContext = (scope) => {
1757
1757
  let context = scope ? scopedContexts.get(scope) : OGContext;
1758
1758
  return (0, import_react3.useContext)(context);
@@ -3482,37 +3482,43 @@ var require_propMapper_native = __commonJS({
3482
3482
  fontSize: "size",
3483
3483
  fontWeight: "weight"
3484
3484
  }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3485
- var _a, _b, _c;
3485
+ var _a, _b, _c, _d;
3486
3486
  if (resolveAs === "none")
3487
3487
  return value;
3488
- let { theme, conf = (0, import_config.getConfig)(), context, fontFamily } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3488
+ let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3489
3489
  if (theme && value in theme)
3490
3490
  valOrVar = theme[value], process.env.NODE_ENV === "development" && styleState.debug === "verbose" && console.info(` - resolving ${key} to theme value ${value}: ${(_a = valOrVar == null ? void 0 : valOrVar.get) == null ? void 0 : _a.call(valOrVar)}`), hasSet = !0;
3491
3491
  else if (value in conf.specificTokens)
3492
3492
  hasSet = !0, valOrVar = conf.specificTokens[value];
3493
3493
  else {
3494
- switch (key) {
3495
- case "fontFamily": {
3496
- valOrVar = ((_b = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _b.family) || value, lastFontFamilyToken = value, hasSet = !0;
3497
- break;
3498
- }
3499
- case "fontSize":
3500
- case "lineHeight":
3501
- case "letterSpacing":
3502
- case "fontWeight": {
3503
- let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3504
- if (fam) {
3505
- let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3506
- valOrVar = ((_c = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _c[value]) || value, hasSet = !0;
3494
+ let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3495
+ if (customTokenAccept) {
3496
+ let val = tokensParsed[customTokenAccept][value];
3497
+ val && (valOrVar = val, hasSet = !0);
3498
+ } else {
3499
+ switch (key) {
3500
+ case "fontFamily": {
3501
+ valOrVar = ((_c = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _c.family) || value, lastFontFamilyToken = value, hasSet = !0;
3502
+ break;
3503
+ }
3504
+ case "fontSize":
3505
+ case "lineHeight":
3506
+ case "letterSpacing":
3507
+ case "fontWeight": {
3508
+ let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3509
+ if (fam) {
3510
+ let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3511
+ valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3512
+ }
3513
+ break;
3507
3514
  }
3508
- break;
3509
3515
  }
3516
+ for (let cat in import_helpers.tokenCategories)
3517
+ if (key in import_helpers.tokenCategories[cat]) {
3518
+ let res = tokensParsed[cat][value];
3519
+ res != null && (valOrVar = res, hasSet = !0);
3520
+ }
3510
3521
  }
3511
- for (let cat in import_helpers.tokenCategories)
3512
- if (key in import_helpers.tokenCategories[cat]) {
3513
- let res = tokensParsed[cat][value];
3514
- res != null && (valOrVar = res, hasSet = !0);
3515
- }
3516
3522
  if (!hasSet) {
3517
3523
  let spaceVar = tokensParsed.space[value];
3518
3524
  spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
@@ -3558,7 +3564,12 @@ var require_getSplitStyles_native = __commonJS({
3558
3564
  useSplitStyles: () => useSplitStyles
3559
3565
  });
3560
3566
  module2.exports = __toCommonJS2(getSplitStyles_exports);
3561
- var import_constants3 = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-", getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3567
+ var import_constants3 = require_index_native3(), import_helpers = require_index_native4(), import_react3 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), import_constants22 = require_constants_native2(), import_isDevTools = require_isDevTools_native(), import_useMedia = require_useMedia_native(), import_createMediaStyle = require_createMediaStyle_native(), import_expandStyles = require_expandStyles_native(), import_getGroupPropParts = require_getGroupPropParts_native(), import_getStylesAtomic = require_getStylesAtomic_native(), import_insertStyleRule = require_insertStyleRule_native(), import_log = require_log_native(), import_normalizeValueWithProperty = require_normalizeValueWithProperty_native(), import_propMapper = require_propMapper_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-";
3568
+ function isValidStyleKey(key, staticConfig) {
3569
+ let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3570
+ return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
3571
+ }
3572
+ var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3562
3573
  var _a, _b, _c, _e, _f, _g;
3563
3574
  conf = conf || (0, import_config.getConfig)(), import_constants3.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3564
3575
  let { shorthands } = conf, {
@@ -3570,7 +3581,7 @@ var require_getSplitStyles_native = __commonJS({
3570
3581
  inlineWhenUnflattened,
3571
3582
  parentStaticConfig,
3572
3583
  acceptsClassName
3573
- } = staticConfig, validStyleProps = isText ? import_helpers.stylePropsText : import_helpers.validStyles, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants3.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = "", mediaStylesSeen = 0, styleState = {
3584
+ } = staticConfig, viewProps = {}, mediaState2 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants3.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = "", mediaStylesSeen = 0, styleState = {
3574
3585
  curProps: { ...props },
3575
3586
  classNames,
3576
3587
  conf,
@@ -3598,7 +3609,7 @@ var require_getSplitStyles_native = __commonJS({
3598
3609
  let keyInit = keyOg, valInit = props[keyOg];
3599
3610
  if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !isHOC)
3600
3611
  continue;
3601
- let valInitType = typeof valInit;
3612
+ let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
3602
3613
  if (styleState.curProps[keyInit] = valInit, !import_constants3.isAndroid && keyInit === "elevationAndroid")
3603
3614
  continue;
3604
3615
  if (keyInit === "userSelect")
@@ -3647,7 +3658,7 @@ var require_getSplitStyles_native = __commonJS({
3647
3658
  case "accessibilityRequired":
3648
3659
  default:
3649
3660
  }
3650
- let isValidStyleKeyInit = keyInit in validStyleProps, isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
3661
+ let isShorthand = keyInit in shorthands, isVariant = !isValidStyleKeyInit && variants && keyInit in variants, isStyleLikeKey = isShorthand || isValidStyleKeyInit || isVariant, isPseudo = keyInit in import_helpers.validPseudoKeys, isMedia = !isStyleLikeKey && !isPseudo && (0, import_useMedia.isMediaKey)(keyInit), isMediaOrPseudo = !!(isMedia || isPseudo), isStyleProp = isMediaOrPseudo || isVariant && !styleProps.noExpand || isValidStyleKeyInit || isShorthand;
3651
3662
  if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3652
3663
  continue;
3653
3664
  let shouldPassProp = !isStyleProp || // is in parent variants
@@ -3868,7 +3879,7 @@ current`, {
3868
3879
  if (
3869
3880
  // is HOC we can just pass through the styles as props
3870
3881
  // this fixes issues where style prop got merged with wrong priority
3871
- !isHOC && (key in validStyleProps || import_constants3.isAndroid && key === "elevation")
3882
+ !isHOC && (isValidStyleKey(key, staticConfig) || import_constants3.isAndroid && key === "elevation")
3872
3883
  ) {
3873
3884
  mergeStyle(styleState, key, val);
3874
3885
  continue;
@@ -5245,7 +5256,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
5245
5256
  subscribe: groupState.subscribe
5246
5257
  };
5247
5258
  }, [groupName]);
5248
- if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { groups: subGroupContext, children: content })), process.env.NODE_ENV === "development" && time && time`group-context`, content = disableThemeProp ? content : (0, import_Theme.useThemedChildren)(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) {
5259
+ 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 = disableThemeProp ? content : (0, import_Theme.useThemedChildren)(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) {
5249
5260
  let contextProps = staticConfig.context.props;
5250
5261
  for (let key in contextProps)
5251
5262
  (key in style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = style[key] ?? viewProps[key]);
@@ -6529,7 +6540,6 @@ var require_Text_native = __commonJS({
6529
6540
  }
6530
6541
  }
6531
6542
  },
6532
- deoptProps: /* @__PURE__ */ new Set(["ellipse"]),
6533
6543
  validStyles: {
6534
6544
  ...import_helpers.validStyles,
6535
6545
  ...import_helpers.stylePropsTextOnly