tamagui 1.77.0 → 1.78.0

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
@@ -2649,8 +2649,13 @@ var require_propMapper_native = __commonJS({
2649
2649
  });
2650
2650
  module2.exports = __toCommonJS2(propMapper_exports);
2651
2651
  var import_constants = require_index_native2(), import_helpers = require_index_native4(), import_config = require_config_native(), import_isDevTools = require_isDevTools_native(), import_createVariable = require_createVariable_native(), import_expandStyle = require_expandStyle_native(), import_expandStylesAndRemoveNullishValues = require_expandStylesAndRemoveNullishValues_native(), import_getVariantExtras = require_getVariantExtras_native(), import_isObj = require_isObj_native(), import_pseudoDescriptors = require_pseudoDescriptors_native(), propMapper = (key, value, styleStateIn, subPropsIn) => {
2652
+ var _a;
2652
2653
  if (!import_constants.isAndroid && key === "elevationAndroid")
2653
2654
  return;
2655
+ if (value === "unset") {
2656
+ let unsetVal = (_a = styleStateIn.conf.unset) == null ? void 0 : _a[key];
2657
+ unsetVal != null && (value = unsetVal);
2658
+ }
2654
2659
  let subProps = styleStateIn.styleProps.fallbackProps || subPropsIn, styleState = subProps ? new Proxy(styleStateIn, {
2655
2660
  get(_, k) {
2656
2661
  return k === "curProps" ? subProps : Reflect.get(_, k);
@@ -2667,8 +2672,12 @@ var require_propMapper_native = __commonJS({
2667
2672
  return variantValue;
2668
2673
  }
2669
2674
  let shouldReturn = !1;
2670
- if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null)
2671
- return (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [[key, value]];
2675
+ if (styleProps.disableExpandShorthands || key in conf.shorthands && (shouldReturn = !0, key = conf.shorthands[key]), value && (value[0] === "$" ? value = getTokenForKey(key, value, styleProps.resolveValues, styleState) : (0, import_createVariable.isVariable)(value) && (value = resolveVariableValue(key, value, styleProps.resolveValues))), shouldReturn || value != null) {
2676
+ let result = (styleProps.noExpand ? null : (0, import_expandStyle.expandStyle)(key, value)) || [
2677
+ [key, value]
2678
+ ];
2679
+ return key === "fontFamily" && fontFamilyCache.set(result, lastFontFamilyToken), result;
2680
+ }
2672
2681
  }, resolveVariants = (key, value, styleProps, styleState, parentVariantKey) => {
2673
2682
  let { staticConfig, conf, debug } = styleState, { variants } = staticConfig;
2674
2683
  if (!variants)
@@ -2794,7 +2803,7 @@ var require_propMapper_native = __commonJS({
2794
2803
  var fontShorthand = {
2795
2804
  fontSize: "size",
2796
2805
  fontWeight: "weight"
2797
- }, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
2806
+ }, lastFontFamilyToken = null, getTokenForKey = (key, value, resolveAs = "none", styleState) => {
2798
2807
  var _a, _b;
2799
2808
  if (resolveAs === "none")
2800
2809
  return value;
@@ -2806,7 +2815,7 @@ var require_propMapper_native = __commonJS({
2806
2815
  else {
2807
2816
  switch (key) {
2808
2817
  case "fontFamily": {
2809
- valOrVar = ((_a = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _a.family) || value, hasSet = !0;
2818
+ valOrVar = ((_a = (context != null && context.language ? (0, import_getVariantExtras.getFontsForLanguage)(conf.fontsParsed, context.language) : conf.fontsParsed)[value]) == null ? void 0 : _a.family) || value, lastFontFamilyToken = value, hasSet = !0;
2810
2819
  break;
2811
2820
  }
2812
2821
  case "fontSize":
@@ -2871,7 +2880,7 @@ var require_getSplitStyles_native = __commonJS({
2871
2880
  useSplitStyles: () => useSplitStyles
2872
2881
  });
2873
2882
  module2.exports = __toCommonJS2(getSplitStyles_exports);
2874
- var import_constants = require_index_native2(), import_helpers = require_index_native4(), import_react2 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), 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(), fontFamilyKey = "fontFamily", IS_STATIC = process.env.IS_STATIC === "is_static", conf, PROP_SPLIT = "-", getSplitStyles = (props, staticConfig, theme, themeName, componentState, styleProps, parentSplitStyles, context, elementType, debug) => {
2883
+ var import_constants = require_index_native2(), import_helpers = require_index_native4(), import_react2 = require("react"), import_config = require_config_native(), import_accessibilityDirectMap = require_accessibilityDirectMap_native(), 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) => {
2875
2884
  var _a, _b, _c, _e, _f, _g;
2876
2885
  conf = conf || (0, import_config.getConfig)(), import_constants.isWeb && styleProps.isAnimated && conf.animations.isReactNative && !styleProps.noNormalize && (styleProps.noNormalize = "values");
2877
2886
  let { shorthands } = conf, {
@@ -2884,7 +2893,7 @@ var require_getSplitStyles_native = __commonJS({
2884
2893
  parentStaticConfig,
2885
2894
  acceptsClassName
2886
2895
  } = staticConfig, validStyleProps = isText ? import_helpers.stylePropsText : import_helpers.validStyles, viewProps = {}, mediaState3 = styleProps.mediaState || import_useMedia.mediaState, usedKeys = {}, shouldDoClasses = acceptsClassName && import_constants.isWeb && !styleProps.noClassNames, rulesToInsert = [], classNames = {}, transforms = {}, pseudos = null, space = props.space, hasMedia = !1, dynamicThemeAccess, pseudoGroups, mediaGroups, style = {}, className = "", mediaStylesSeen = 0, styleState = {
2887
- curProps: Object.assign({}, props),
2896
+ curProps: { ...props },
2888
2897
  classNames,
2889
2898
  conf,
2890
2899
  props,
@@ -2976,7 +2985,7 @@ var require_getSplitStyles_native = __commonJS({
2976
2985
  parentStaticConfig
2977
2986
  }), console.groupEnd()), shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo), !isVariant) || !styleProps.noSkip && keyInit in skipProps)
2978
2987
  continue;
2979
- if (isText && valInit && (keyInit === fontFamilyKey || keyInit === shorthands[fontFamilyKey]) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
2988
+ if (isText && valInit && (keyInit === "fontFamily" || keyInit === shorthands.fontFamily) && valInit in conf.fontsParsed && (styleState.fontFamily = valInit), isValidStyleKeyInit && !variants && (valInitType === "number" || valInitType === "string" && valInit[0] !== "$")) {
2980
2989
  style[keyInit] = valInit;
2981
2990
  continue;
2982
2991
  }
@@ -3169,7 +3178,7 @@ current`, {
3169
3178
  usedKeys,
3170
3179
  mediaState3[mediaKeyShort],
3171
3180
  importanceBump
3172
- ), key === fontFamilyKey && (styleState.fontFamily = mediaStyle.fontFamily);
3181
+ ), key === "fontFamily" && (styleState.fontFamily = mediaStyle.fontFamily);
3173
3182
  }
3174
3183
  }
3175
3184
  continue;
@@ -5224,6 +5233,10 @@ ${runtimeStyles}`;
5224
5233
  animations: {},
5225
5234
  media: {},
5226
5235
  ...configIn,
5236
+ unset: {
5237
+ fontFamily: configIn.defaultFont ? defaultFont : void 0,
5238
+ ...configIn.unset
5239
+ },
5227
5240
  settings: {
5228
5241
  webContainerType: "size",
5229
5242
  ...configIn.settings
@@ -5810,6 +5823,7 @@ var require_Text_native = __commonJS({
5810
5823
  acceptsClassName: !0,
5811
5824
  isText: !0,
5812
5825
  defaultProps: {
5826
+ fontFamily: "unset",
5813
5827
  suppressHighlighting: !0
5814
5828
  },
5815
5829
  inlineWhenUnflattened: /* @__PURE__ */ new Set(["fontFamily"]),
@@ -17876,7 +17890,11 @@ var require_createSwitch_native = __commonJS({
17876
17890
  nativeProps,
17877
17891
  children,
17878
17892
  ...switchProps
17879
- } = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core13.isWeb && nativeProp === !0 || !import_core13.isWeb && native.includes("mobile") || native.includes("android") && import_react_native4.Platform.OS === "android" || native.includes("ios") && import_react_native4.Platform.OS === "ios", [button, setButton] = React2.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(forwardedRef, (node) => setButton(node)), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core13.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
17893
+ } = props, native = Array.isArray(nativeProp) ? nativeProp : [nativeProp], shouldRenderMobileNative = !import_core13.isWeb && nativeProp === !0 || !import_core13.isWeb && native.includes("mobile") || native.includes("android") && import_react_native4.Platform.OS === "android" || native.includes("ios") && import_react_native4.Platform.OS === "ios", [button, setButton] = React2.useState(null), composedRefs = (0, import_compose_refs.useComposedRefs)(
17894
+ forwardedRef,
17895
+ // @ts-expect-error
17896
+ setButton
17897
+ ), labelId = (0, import_label.useLabelContext)(button), labelledBy = ariaLabelledby || labelId, hasConsumerStoppedPropagationRef = React2.useRef(!1), isFormControl = import_core13.isWeb ? button ? !!button.closest("form") : !0 : !1, [frameWidth, setFrameWidth] = React2.useState(0), [checked = !1, setChecked] = (0, import_use_controllable_state.useControllableState)({
17880
17898
  prop: checkedProp,
17881
17899
  defaultProp: defaultChecked || !1,
17882
17900
  onChange: onCheckedChange,
@@ -17900,6 +17918,7 @@ var require_createSwitch_native = __commonJS({
17900
17918
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
17901
17919
  Frame,
17902
17920
  {
17921
+ tag: "button",
17903
17922
  unstyled,
17904
17923
  size: size2,
17905
17924
  checked,