@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.
@@ -1657,7 +1657,7 @@ var require_objectIdentityKey_native = __commonJS({
1657
1657
  for (let key in obj) {
1658
1658
  k += key;
1659
1659
  let arg = obj[key], type = typeof arg;
1660
- if (!arg || type !== "object")
1660
+ if (!arg || type !== "object" && type !== "function")
1661
1661
  k += type + arg;
1662
1662
  else if (cache.has(arg))
1663
1663
  k += cache.get(arg);
@@ -1696,7 +1696,7 @@ var require_createStyledContext_native = __commonJS({
1696
1696
  scope,
1697
1697
  ...values
1698
1698
  }) => {
1699
- let value = (0, import_react3.useMemo)(() => ({
1699
+ let next = (0, import_react3.useMemo)(() => ({
1700
1700
  // this ! is a workaround for ts error
1701
1701
  ...defaultValues,
1702
1702
  ...values
@@ -1705,7 +1705,7 @@ var require_createStyledContext_native = __commonJS({
1705
1705
  let ScopedContext = scopedContexts.get(scope);
1706
1706
  ScopedContext || (ScopedContext = (0, import_react3.createContext)(defaultValues), scopedContexts.set(scope, ScopedContext)), Provider2 = ScopedContext.Provider;
1707
1707
  }
1708
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value, children });
1708
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider2, { value: next, children });
1709
1709
  }, useStyledContext = (scope) => {
1710
1710
  let context = scope ? scopedContexts.get(scope) : OGContext;
1711
1711
  return (0, import_react3.useContext)(context);
@@ -3388,37 +3388,43 @@ var require_propMapper_native = __commonJS({
3388
3388
  fontSize: "size",
3389
3389
  fontWeight: "weight"
3390
3390
  }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
3391
- var _a, _b, _c;
3391
+ var _a, _b, _c, _d;
3392
3392
  if (resolveAs === "none")
3393
3393
  return value;
3394
- let { theme, conf = (0, import_config.getConfig)(), context, fontFamily } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3394
+ let { theme, conf = (0, import_config.getConfig)(), context, fontFamily, staticConfig } = styleState, tokensParsed = conf.tokensParsed, valOrVar, hasSet = !1;
3395
3395
  if (theme && value in theme)
3396
3396
  valOrVar = theme[value], hasSet = !0;
3397
3397
  else if (value in conf.specificTokens)
3398
3398
  hasSet = !0, valOrVar = conf.specificTokens[value];
3399
3399
  else {
3400
- switch (key) {
3401
- case "fontFamily": {
3402
- 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;
3403
- break;
3404
- }
3405
- case "fontSize":
3406
- case "lineHeight":
3407
- case "letterSpacing":
3408
- case "fontWeight": {
3409
- let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3410
- if (fam) {
3411
- let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3412
- valOrVar = ((_c = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _c[value]) || value, hasSet = !0;
3400
+ let customTokenAccept = (_b = staticConfig == null ? void 0 : staticConfig.acceptTokens) == null ? void 0 : _b[key];
3401
+ if (customTokenAccept) {
3402
+ let val = tokensParsed[customTokenAccept][value];
3403
+ val && (valOrVar = val, hasSet = !0);
3404
+ } else {
3405
+ switch (key) {
3406
+ case "fontFamily": {
3407
+ 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;
3408
+ break;
3409
+ }
3410
+ case "fontSize":
3411
+ case "lineHeight":
3412
+ case "letterSpacing":
3413
+ case "fontWeight": {
3414
+ let defaultFont = conf.defaultFont || "$body", fam = fontFamily || defaultFont;
3415
+ if (fam) {
3416
+ let fontsParsed = context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed, font = fontsParsed[fam] || fontsParsed[defaultFont];
3417
+ valOrVar = ((_d = font == null ? void 0 : font[fontShorthand[key] || key]) == null ? void 0 : _d[value]) || value, hasSet = !0;
3418
+ }
3419
+ break;
3413
3420
  }
3414
- break;
3415
3421
  }
3422
+ for (let cat in import_helpers.tokenCategories)
3423
+ if (key in import_helpers.tokenCategories[cat]) {
3424
+ let res = tokensParsed[cat][value];
3425
+ res != null && (valOrVar = res, hasSet = !0);
3426
+ }
3416
3427
  }
3417
- for (let cat in import_helpers.tokenCategories)
3418
- if (key in import_helpers.tokenCategories[cat]) {
3419
- let res = tokensParsed[cat][value];
3420
- res != null && (valOrVar = res, hasSet = !0);
3421
- }
3422
3428
  if (!hasSet) {
3423
3429
  let spaceVar = tokensParsed.space[value];
3424
3430
  spaceVar != null && (valOrVar = spaceVar, hasSet = !0);
@@ -3460,7 +3466,12 @@ var require_getSplitStyles_native = __commonJS({
3460
3466
  useSplitStyles: () => useSplitStyles
3461
3467
  });
3462
3468
  module2.exports = __toCommonJS2(getSplitStyles_exports);
3463
- 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) => {
3469
+ 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 = "-";
3470
+ function isValidStyleKey(key, staticConfig) {
3471
+ let validStyleProps = staticConfig.validStyles ?? (staticConfig.isText ? import_helpers.stylePropsText : import_helpers.validStyles);
3472
+ return key in validStyleProps || staticConfig.acceptTokens && key in staticConfig.acceptTokens;
3473
+ }
3474
+ var getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
3464
3475
  var _a, _b, _c, _e, _f, _g;
3465
3476
  conf = conf || (0, import_config.getConfig)(), import_constants3.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
3466
3477
  let { shorthands } = conf, {
@@ -3472,7 +3483,7 @@ var require_getSplitStyles_native = __commonJS({
3472
3483
  inlineWhenUnflattened,
3473
3484
  parentStaticConfig,
3474
3485
  acceptsClassName
3475
- } = 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 = {
3486
+ } = 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 = {
3476
3487
  curProps: { ...props },
3477
3488
  classNames,
3478
3489
  conf,
@@ -3491,7 +3502,7 @@ var require_getSplitStyles_native = __commonJS({
3491
3502
  let keyInit = keyOg, valInit = props[keyOg];
3492
3503
  if (styleProps.disableExpandShorthands || keyInit in shorthands && (keyInit = shorthands[keyInit]), keyInit === "className" || keyInit in usedKeys || keyInit in skipProps && !isHOC)
3493
3504
  continue;
3494
- let valInitType = typeof valInit;
3505
+ let valInitType = typeof valInit, isValidStyleKeyInit = isValidStyleKey(keyInit, staticConfig);
3495
3506
  if (styleState.curProps[keyInit] = valInit, !import_constants3.isAndroid && keyInit === "elevationAndroid")
3496
3507
  continue;
3497
3508
  if (keyInit === "userSelect")
@@ -3540,7 +3551,7 @@ var require_getSplitStyles_native = __commonJS({
3540
3551
  case "accessibilityRequired":
3541
3552
  default:
3542
3553
  }
3543
- 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;
3554
+ 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;
3544
3555
  if (isStyleProp && (props.asChild === "except-style" || props.asChild === "except-style-web"))
3545
3556
  continue;
3546
3557
  let shouldPassProp = !isStyleProp || // is in parent variants
@@ -3704,7 +3715,7 @@ var require_getSplitStyles_native = __commonJS({
3704
3715
  if (
3705
3716
  // is HOC we can just pass through the styles as props
3706
3717
  // this fixes issues where style prop got merged with wrong priority
3707
- !isHOC && (key in validStyleProps || import_constants3.isAndroid && key === "elevation")
3718
+ !isHOC && (isValidStyleKey(key, staticConfig) || import_constants3.isAndroid && key === "elevation")
3708
3719
  ) {
3709
3720
  mergeStyle(styleState, key, val);
3710
3721
  continue;
@@ -4930,7 +4941,7 @@ var require_createComponent_native = __commonJS({
4930
4941
  subscribe: groupState.subscribe
4931
4942
  };
4932
4943
  }, [groupName]);
4933
- if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { groups: subGroupContext, children: content })), content = disableThemeProp ? content : (0, import_Theme.useThemedChildren)(themeState, content, themeStateProps, !1), staticConfig.context) {
4944
+ if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, { ...componentContext, groups: subGroupContext, children: content })), content = disableThemeProp ? content : (0, import_Theme.useThemedChildren)(themeState, content, themeStateProps, !1), staticConfig.context) {
4934
4945
  let contextProps = staticConfig.context.props;
4935
4946
  for (let key in contextProps)
4936
4947
  (key in style || key in viewProps) && (overriddenContextProps ||= {}, overriddenContextProps[key] = style[key] ?? viewProps[key]);
@@ -6168,7 +6179,6 @@ var require_Text_native = __commonJS({
6168
6179
  }
6169
6180
  }
6170
6181
  },
6171
- deoptProps: /* @__PURE__ */ new Set(["ellipse"]),
6172
6182
  validStyles: {
6173
6183
  ...import_helpers.validStyles,
6174
6184
  ...import_helpers.stylePropsTextOnly