@tamagui/core 1.91.2 → 1.91.4

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.
@@ -3230,6 +3230,9 @@ var require_constants_native2 = __commonJS({
3230
3230
  }), mod);
3231
3231
  }, constants_exports = {};
3232
3232
  __export2(constants_exports, {
3233
+ FONT_DATA_ATTRIBUTE_NAME: function() {
3234
+ return FONT_DATA_ATTRIBUTE_NAME;
3235
+ },
3233
3236
  THEME_CLASSNAME_PREFIX: function() {
3234
3237
  return THEME_CLASSNAME_PREFIX;
3235
3238
  },
@@ -3244,7 +3247,7 @@ var require_constants_native2 = __commonJS({
3244
3247
  }
3245
3248
  });
3246
3249
  module2.exports = __toCommonJS2(constants_exports);
3247
- var THEME_NAME_SEPARATOR = "_", THEME_CLASSNAME_PREFIX = "t_", stackDefaultStyles = {}, webViewFlexCompatStyles = {
3250
+ var THEME_NAME_SEPARATOR = "_", THEME_CLASSNAME_PREFIX = "t_", FONT_DATA_ATTRIBUTE_NAME = "data-tamagui-font", stackDefaultStyles = {}, webViewFlexCompatStyles = {
3248
3251
  display: "flex",
3249
3252
  alignItems: "stretch",
3250
3253
  flexDirection: "column",
@@ -4012,9 +4015,9 @@ var require_useTheme_native = __commonJS({
4012
4015
  }
4013
4016
  var isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
4014
4017
  isNewTheme2 && registerThemeManager(themeManager2);
4015
- var mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4018
+ var isWebSSR = import_constants.isWeb ? !(0, import_config.getConfig)().disableSSR : !1, mounted2 = isWebSSR ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4016
4019
  state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
4017
- var wasInversed = prev == null ? void 0 : prev.inversed, nextInversed = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme), inversed2 = nextInversed ? !0 : wasInversed != null ? !1 : null, response = {
4020
+ var wasInversed = prev == null ? void 0 : prev.inversed, isInherentlyInversed = isNewTheme2 && state2.scheme !== (parentManager == null ? void 0 : parentManager.state.scheme), inversed2 = isInherentlyInversed ? !0 : isWebSSR ? wasInversed != null ? !1 : null : props.inverse, response = {
4018
4021
  themeManager: themeManager2,
4019
4022
  isNewTheme: isNewTheme2,
4020
4023
  mounted: mounted2,
@@ -4069,7 +4072,7 @@ var require_useTheme_native = __commonJS({
4069
4072
  props.name,
4070
4073
  props.reset,
4071
4074
  mounted
4072
- ]), isInversingOnMount ? {
4075
+ ]), import_constants.isWeb && isInversingOnMount ? {
4073
4076
  isNewTheme: !1,
4074
4077
  inversed: !1,
4075
4078
  themeManager: parentManager,
@@ -7550,7 +7553,7 @@ var require_getSplitStyles_native = __commonJS({
7550
7553
  if (isHOC)
7551
7554
  viewProps.style = normalizeStyle(styleProp);
7552
7555
  else
7553
- for (var isArray = Array.isArray(styleProp), len = isArray ? props.length : 1, i1 = 0; i1 < len; i1++) {
7556
+ for (var isArray = Array.isArray(styleProp), len = isArray ? styleProp.length : 1, i1 = 0; i1 < len; i1++) {
7554
7557
  var style1 = isArray ? styleProp[i1] : styleProp;
7555
7558
  if (style1)
7556
7559
  if (style1.$$css)
@@ -7560,6 +7563,14 @@ var require_getSplitStyles_native = __commonJS({
7560
7563
  (_styleState4 = styleState).style || (_styleState4.style = {}), Object.assign(styleState.style, normalizeStyle(style1));
7561
7564
  }
7562
7565
  }
7566
+ var style2 = styleState.style;
7567
+ if (style2 != null && style2.fontFamily) {
7568
+ var _getFont, faceInfo = (_getFont = (0, import_config.getFont)(style2.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
7569
+ if (faceInfo) {
7570
+ var _faceInfo_style_fontWeight_, _faceInfo_style_fontWeight, overrideFace = (_faceInfo_style_fontWeight = faceInfo[style2.fontWeight]) === null || _faceInfo_style_fontWeight === void 0 || (_faceInfo_style_fontWeight_ = _faceInfo_style_fontWeight[style2.fontStyle || "normal"]) === null || _faceInfo_style_fontWeight_ === void 0 ? void 0 : _faceInfo_style_fontWeight_.val;
7571
+ overrideFace && (style2.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style2.fontWeight, delete style2.fontStyle);
7572
+ }
7573
+ }
7563
7574
  var result = {
7564
7575
  space,
7565
7576
  hasMedia,
@@ -7572,15 +7583,7 @@ var require_getSplitStyles_native = __commonJS({
7572
7583
  dynamicThemeAccess,
7573
7584
  pseudoGroups,
7574
7585
  mediaGroups
7575
- }, style2 = styleState.style;
7576
- if (style2 != null && style2.fontFamily) {
7577
- var _getFont, faceInfo = (_getFont = (0, import_config.getFont)(style2.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
7578
- if (faceInfo) {
7579
- var _faceInfo_style_fontWeight_, _faceInfo_style_fontWeight, overrideFace = (_faceInfo_style_fontWeight = faceInfo[style2.fontWeight]) === null || _faceInfo_style_fontWeight === void 0 || (_faceInfo_style_fontWeight_ = _faceInfo_style_fontWeight[style2.fontStyle || "normal"]) === null || _faceInfo_style_fontWeight_ === void 0 ? void 0 : _faceInfo_style_fontWeight_.val;
7580
- overrideFace && (style2.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style2.fontWeight, delete style2.fontStyle);
7581
- }
7582
- }
7583
- var asChild = props.asChild, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
7586
+ }, asChild = props.asChild, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
7584
7587
  if (!asChildExceptStyleLike) {
7585
7588
  var style3 = styleState.style;
7586
7589
  if (0) {
@@ -8553,7 +8556,16 @@ var require_createComponent_native = __commonJS({
8553
8556
  return x();
8554
8557
  }), mouseUps.clear();
8555
8558
  }, addEventListener("mouseup", cancelTouches), addEventListener("touchend", cancelTouches), addEventListener("touchcancel", cancelTouches));
8556
- var cancelTouches, BaseText, BaseView, hasSetupBaseViews = !1;
8559
+ var cancelTouches, BaseText, BaseView, hasSetupBaseViews = !1, lastInteractionWasKeyboard = {
8560
+ value: !1
8561
+ };
8562
+ import_constants.isWeb && globalThis.document && (document.addEventListener("keydown", function() {
8563
+ lastInteractionWasKeyboard.value = !0;
8564
+ }), document.addEventListener("mousedown", function() {
8565
+ lastInteractionWasKeyboard.value = !1;
8566
+ }), document.addEventListener("mousemove", function() {
8567
+ lastInteractionWasKeyboard.value = !1;
8568
+ }));
8557
8569
  function createComponent(staticConfig) {
8558
8570
  var _staticConfig_defaultProps, componentName = staticConfig.componentName, config = null, defaultProps = staticConfig.defaultProps;
8559
8571
  (0, import_config.onConfiguredOnce)(function(conf) {
@@ -8594,9 +8606,7 @@ var require_createComponent_native = __commonJS({
8594
8606
  var debugProp = props.debug, componentName2 = props.componentName || staticConfig.componentName;
8595
8607
  if (0)
8596
8608
  var timer;
8597
- var stateRef = (0, import_react3.useRef)({
8598
- handleFocusVisible: !0
8599
- }), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations, hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars, curState = stateRef.current, willBeAnimatedClient = function() {
8609
+ var stateRef = (0, import_react3.useRef)({}), animationsConfig = componentContext.animationDriver, useAnimations = animationsConfig == null ? void 0 : animationsConfig.useAnimations, hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationsConfig == null ? void 0 : animationsConfig.supportsCSSVars, curState = stateRef.current, willBeAnimatedClient = function() {
8600
8610
  var next = !!(hasAnimationProp && !isHOC && useAnimations);
8601
8611
  return !!(next || curState.hasAnimated);
8602
8612
  }(), willBeAnimated = !import_constants.isServer && willBeAnimatedClient;
@@ -8761,11 +8771,11 @@ var require_createComponent_native = __commonJS({
8761
8771
  }
8762
8772
  var disposeGroupsListener;
8763
8773
  if (pseudoGroups || mediaGroups) {
8764
- var current = {
8774
+ var _componentContext_groups, current = {
8765
8775
  pseudo: {},
8766
8776
  media: {}
8767
8777
  };
8768
- disposeGroupsListener = componentContext.groups.subscribe(function(name2, param) {
8778
+ disposeGroupsListener = (_componentContext_groups = componentContext.groups) === null || _componentContext_groups === void 0 ? void 0 : _componentContext_groups.subscribe(function(name2, param) {
8769
8779
  var layout = param.layout, pseudo = param.pseudo, persist = function() {
8770
8780
  var group = _object_spread_props(_object_spread2({}, state.group), _define_property2({}, name2, current));
8771
8781
  setStateShallow({
@@ -8792,7 +8802,7 @@ var require_createComponent_native = __commonJS({
8792
8802
  ]);
8793
8803
  var runtimePressStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.focusVisibleStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || pseudos != null && pseudos.focusVisibleStyle), runtimeHoverStyle = !disabled && noClassNames && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut), attachHover = import_constants.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(groupName || runtimeHoverStyle), events = shouldAttach ? _object_spread2(_object_spread_props(_object_spread2({
8794
8804
  onPressOut: attachPress ? function(e) {
8795
- stateRef.current.handleFocusVisible = !0, unPress(), onPressOut == null || onPressOut(e), onMouseUp == null || onMouseUp(e);
8805
+ unPress(), onPressOut == null || onPressOut(e), onMouseUp == null || onMouseUp(e);
8796
8806
  } : void 0
8797
8807
  }, (attachHover || attachPress) && {
8798
8808
  onMouseEnter: function(e) {
@@ -8805,7 +8815,7 @@ var require_createComponent_native = __commonJS({
8805
8815
  }
8806
8816
  }), {
8807
8817
  onPressIn: attachPress ? function(e) {
8808
- stateRef.current.handleFocusVisible = !1, runtimePressStyle && setStateShallow({
8818
+ runtimePressStyle && setStateShallow({
8809
8819
  press: !0,
8810
8820
  pressIn: !0
8811
8821
  }), onPressIn == null || onPressIn(e), onMouseDown == null || onMouseDown(e), import_constants.isWeb && mouseUps.add(unPress);
@@ -8822,7 +8832,7 @@ var require_createComponent_native = __commonJS({
8822
8832
  pseudos != null && pseudos.focusVisibleStyle ? setTimeout(function() {
8823
8833
  setStateShallow({
8824
8834
  focus: !0,
8825
- focusVisible: !!stateRef.current.handleFocusVisible
8835
+ focusVisible: !!lastInteractionWasKeyboard.value
8826
8836
  });
8827
8837
  }, 0) : setStateShallow({
8828
8838
  focus: !0,
@@ -8830,7 +8840,7 @@ var require_createComponent_native = __commonJS({
8830
8840
  }), onFocus == null || onFocus(e);
8831
8841
  },
8832
8842
  onBlur: function(e) {
8833
- stateRef.current.handleFocusVisible = !0, setStateShallow({
8843
+ setStateShallow({
8834
8844
  focus: !1,
8835
8845
  focusVisible: !1
8836
8846
  }), onBlur == null || onBlur(e);
@@ -9779,11 +9789,11 @@ var require_insertFont_native = __commonJS({
9779
9789
  }
9780
9790
  });
9781
9791
  module2.exports = __toCommonJS2(insertFont_exports);
9782
- var import_config = require_config_native(), import_createFont = require_createFont_native(), import_createVariables = require_createVariables_native(), import_registerCSSVariable = require_registerCSSVariable_native();
9792
+ var import_config = require_config_native(), import_constants = require_constants_native2(), import_createFont = require_createFont_native(), import_createVariables = require_createVariables_native(), import_registerCSSVariable = require_registerCSSVariable_native();
9783
9793
  function insertFont(name, fontIn) {
9784
9794
  var font = (0, import_createFont.createFont)(fontIn), tokened = (0, import_createVariables.createVariables)(font, name), parsed = parseFont(tokened);
9785
9795
  if (0)
9786
- var fontVars, style;
9796
+ var fontVars, styleElement;
9787
9797
  return (0, import_config.setConfigFont)(name, tokened, parsed), parsed;
9788
9798
  }
9789
9799
  var updateFont = insertFont;