@tamagui/core 1.113.2 → 1.114.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.
@@ -2791,10 +2791,12 @@ var require_useMedia_native = __commonJS({
2791
2791
  }));
2792
2792
  }
2793
2793
  var States = /* @__PURE__ */ new WeakMap();
2794
- function setMediaShouldUpdate(ref, props) {
2795
- return States.set(ref, {
2796
- ...States.get(ref),
2797
- ...props
2794
+ function setMediaShouldUpdate(ref, enabled, keys) {
2795
+ var cur = States.get(ref);
2796
+ (!cur || cur.enabled !== enabled || keys) && States.set(ref, {
2797
+ ...cur,
2798
+ enabled,
2799
+ keys
2798
2800
  });
2799
2801
  }
2800
2802
  function subscribe(subscriber) {
@@ -6740,7 +6742,7 @@ var require_getSplitStyles_native = __commonJS({
6740
6742
  }
6741
6743
  var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo1 || isVariant && !noExpand || isShorthand;
6742
6744
  if (!(isStyleProp && (asChild === "except-style" || asChild === "except-style-web"))) {
6743
- var shouldPassProp = !isStyleProp || // is in parent variants
6745
+ var shouldPassProp = !isStyleProp && isHOC || // is in parent variants
6744
6746
  isHOC && parentVariants && keyInit in parentVariants || (inlineProps == null ? void 0 : inlineProps.has(keyInit)), parentVariant = parentVariants == null ? void 0 : parentVariants[keyInit], isHOCShouldPassThrough = !!(isHOC && (isShorthand || isValidStyleKeyInit || isMediaOrPseudo1 || parentVariant || keyInit in import_skipProps.skipProps)), shouldPassThrough = shouldPassProp || isHOCShouldPassThrough;
6745
6747
  if (shouldPassThrough && (passDownProp(viewProps, keyInit, valInit, isMediaOrPseudo1), !isVariant) || !noSkip && keyInit in import_skipProps.skipProps)
6746
6748
  continue;
@@ -7417,7 +7419,12 @@ var require_themeable_native = __commonJS({
7417
7419
  var import_jsx_runtime = require("react/jsx-runtime"), import_react3 = __toESM2(require("react")), import_Theme = require_Theme_native();
7418
7420
  function themeable(Component, staticConfig) {
7419
7421
  var withThemeComponent = /* @__PURE__ */ import_react3.default.forwardRef(function(props, ref) {
7420
- var { themeInverse, theme, componentName, themeReset, ...rest } = props, element = (
7422
+ var { themeInverse, theme, componentName, themeReset, ...rest } = props, overriddenContextProps, context = staticConfig == null ? void 0 : staticConfig.context;
7423
+ if (context) for (var key in context.props) {
7424
+ var val = props[key];
7425
+ val !== void 0 && (overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = val);
7426
+ }
7427
+ var element = (
7421
7428
  // @ts-expect-error its ok
7422
7429
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Component, {
7423
7430
  ref,
@@ -7433,6 +7440,14 @@ var require_themeable_native = __commonJS({
7433
7440
  reset: themeReset,
7434
7441
  children: element
7435
7442
  });
7443
+ if (context) {
7444
+ var Provider = context.Provider, contextValue = import_react3.default.useContext(context);
7445
+ contents = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Provider, {
7446
+ ...contextValue,
7447
+ ...overriddenContextProps,
7448
+ children: contents
7449
+ });
7450
+ }
7436
7451
  return contents;
7437
7452
  }), withTheme = withThemeComponent;
7438
7453
  return withTheme.displayName = `Themed(${(Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "Anonymous"})`, withTheme;
@@ -7912,17 +7927,16 @@ var require_createComponent_native = __commonJS({
7912
7927
  (_ = (_propsIn_datatestrenders = propsIn["data-test-renders"])[_current = "current"]) !== null && _ !== void 0 || (_propsIn_datatestrenders[_current] = 0), propsIn["data-test-renders"].current += 1;
7913
7928
  }
7914
7929
  var componentContext = import_react3.default.useContext(import_ComponentContext.ComponentContext), styledContextProps, overriddenContextProps, contextValue, { context, isReactNative } = staticConfig;
7915
- if (context) {
7916
- contextValue = import_react3.default.useContext(context);
7917
- var { inverseShorthands } = (0, import_config.getConfig)();
7930
+ if (context && (contextValue = import_react3.default.useContext(context), contextValue))
7918
7931
  for (var key in context.props) {
7919
- var _propsIn_key, _ref, _ref1, propVal = (_ref1 = (_ref = (_propsIn_key = propsIn[key]) !== null && _propsIn_key !== void 0 ? _propsIn_key : propsIn[inverseShorthands[key]]) !== null && _ref !== void 0 ? _ref : defaultProps == null ? void 0 : defaultProps[key]) !== null && _ref1 !== void 0 ? _ref1 : defaultProps == null ? void 0 : defaultProps[inverseShorthands[key]];
7932
+ var propVal = propsIn[key];
7920
7933
  if (propVal === void 0) {
7921
7934
  var val = contextValue == null ? void 0 : contextValue[key];
7922
7935
  val !== void 0 && (styledContextProps || (styledContextProps = {}), styledContextProps[key] = val);
7923
- } else overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = propVal;
7936
+ }
7937
+ var finalVal = propVal ?? (defaultProps == null ? void 0 : defaultProps[key]);
7938
+ finalVal !== void 0 && (overriddenContextProps || (overriddenContextProps = {}), overriddenContextProps[key] = finalVal);
7924
7939
  }
7925
- }
7926
7940
  var curDefaultProps = styledContextProps ? {
7927
7941
  ...defaultProps,
7928
7942
  ...styledContextProps
@@ -7969,10 +7983,7 @@ var require_createComponent_native = __commonJS({
7969
7983
  }
7970
7984
  curStateRef.isListeningToTheme = splitStyles.dynamicThemeAccess;
7971
7985
  var hasRuntimeMediaKeys = splitStyles.hasMedia && splitStyles.hasMedia !== !0, shouldListenForMedia = (0, import_createVariable.didGetVariableValue)() || hasRuntimeMediaKeys || noClassNames && splitStyles.hasMedia === !0, mediaListeningKeys = hasRuntimeMediaKeys ? splitStyles.hasMedia : null;
7972
- (0, import_useMedia.setMediaShouldUpdate)(stateRef, {
7973
- enabled: shouldListenForMedia,
7974
- keys: mediaListeningKeys
7975
- });
7986
+ (0, import_useMedia.setMediaShouldUpdate)(stateRef, shouldListenForMedia, mediaListeningKeys);
7976
7987
  var { viewProps: viewPropsIn, pseudos, style: splitStylesStyle, classNames, space } = splitStyles, propsWithAnimation = props, {
7977
7988
  asChild,
7978
7989
  children,
@@ -7998,7 +8009,7 @@ var require_createComponent_native = __commonJS({
7998
8009
  theme: _themeProp,
7999
8010
  ...nonTamaguiProps
8000
8011
  } = viewPropsIn, viewProps = nonTamaguiProps;
8001
- !isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), elementType.acceptTagProp && (viewProps.tag = tagProp);
8012
+ !isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), tagProp && elementType.acceptTagProp && (viewProps.tag = tagProp);
8002
8013
  var animationStyles, shouldUseAnimation = (
8003
8014
  // if it supports css vars we run it on server too to get matching initial style
8004
8015
  (supportsCSSVars ? willBeAnimatedClient : willBeAnimated) && useAnimations && !isHOC
@@ -9169,20 +9180,20 @@ ${runtimeStyles}`;
9169
9180
  sinceLastCall: !0
9170
9181
  });
9171
9182
  }, _configIn_settings_defaultFont, defaultFontSetting = (_configIn_settings_defaultFont = (_configIn_settings = configIn.settings) === null || _configIn_settings === void 0 ? void 0 : _configIn_settings.defaultFont) !== null && _configIn_settings_defaultFont !== void 0 ? _configIn_settings_defaultFont : configIn.defaultFont, defaultFont = function() {
9172
- var val2 = defaultFontSetting || // uses font named "body" if present for compat
9173
- configIn.fonts && ("body" in configIn.fonts ? "body" : "");
9174
- return !val2 && configIn.fonts && (val2 = Object.keys(configIn.fonts)[0]), (val2 == null ? void 0 : val2[0]) === "$" && (val2 = val2.slice(1)), val2;
9175
- }(), defaultFontToken = `$${defaultFont}`, config = {
9183
+ var val2 = defaultFontSetting;
9184
+ return (val2 == null ? void 0 : val2[0]) === "$" && (val2 = val2.slice(1)), val2;
9185
+ }(), defaultFontToken = defaultFont ? `$${defaultFont}` : "", unset = {
9186
+ ...configIn.unset
9187
+ };
9188
+ !unset.fontFamily && defaultFont && (unset.fontFamily = defaultFontToken);
9189
+ var config = {
9176
9190
  fonts: {},
9177
9191
  onlyAllowShorthands: !1,
9178
9192
  fontLanguages: [],
9179
9193
  animations: {},
9180
9194
  media: {},
9181
9195
  ...configIn,
9182
- unset: {
9183
- fontFamily: defaultFont ? defaultFontToken : void 0,
9184
- ...configIn.unset
9185
- },
9196
+ unset,
9186
9197
  settings: {
9187
9198
  // move deprecated settings here so we can reference them all using `getSetting`
9188
9199
  // TODO remove this on v2