@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.
package/dist/native.js CHANGED
@@ -3447,6 +3447,9 @@ var require_constants_native2 = __commonJS({
3447
3447
  }), mod);
3448
3448
  }, constants_exports = {};
3449
3449
  __export2(constants_exports, {
3450
+ FONT_DATA_ATTRIBUTE_NAME: function() {
3451
+ return FONT_DATA_ATTRIBUTE_NAME;
3452
+ },
3450
3453
  THEME_CLASSNAME_PREFIX: function() {
3451
3454
  return THEME_CLASSNAME_PREFIX;
3452
3455
  },
@@ -3461,7 +3464,7 @@ var require_constants_native2 = __commonJS({
3461
3464
  }
3462
3465
  });
3463
3466
  module2.exports = __toCommonJS2(constants_exports);
3464
- var THEME_NAME_SEPARATOR = "_", THEME_CLASSNAME_PREFIX = "t_", stackDefaultStyles = {}, webViewFlexCompatStyles = {
3467
+ var THEME_NAME_SEPARATOR = "_", THEME_CLASSNAME_PREFIX = "t_", FONT_DATA_ATTRIBUTE_NAME = "data-tamagui-font", stackDefaultStyles = {}, webViewFlexCompatStyles = {
3465
3468
  display: "flex",
3466
3469
  alignItems: "stretch",
3467
3470
  flexDirection: "column",
@@ -4263,9 +4266,9 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4263
4266
  }
4264
4267
  var isNewTheme2 = !!(themeManager2 !== parentManager || props.inverse);
4265
4268
  isNewTheme2 && registerThemeManager(themeManager2);
4266
- var mounted2 = props.inverse ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4269
+ var isWebSSR = import_constants.isWeb ? !(0, import_config.getConfig)().disableSSR : !1, mounted2 = isWebSSR ? isRoot || (prev == null ? void 0 : prev.mounted) : !0;
4267
4270
  state2 || (isNewTheme2 ? state2 = themeManager2.state : (state2 = parentManager.state, themeManager2 = parentManager));
4268
- 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 = {
4271
+ 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 = {
4269
4272
  themeManager: themeManager2,
4270
4273
  isNewTheme: isNewTheme2,
4271
4274
  mounted: mounted2,
@@ -4345,7 +4348,7 @@ If this is intended and you are using Tamagui without any themes, you can disabl
4345
4348
  };
4346
4349
  }, [
4347
4350
  themeManager
4348
- ])), isInversingOnMount ? {
4351
+ ])), import_constants.isWeb && isInversingOnMount ? {
4349
4352
  isNewTheme: !1,
4350
4353
  inversed: !1,
4351
4354
  themeManager: parentManager,
@@ -8041,7 +8044,7 @@ current`, _object_spread2({}, styleState.style)));
8041
8044
  if (isHOC)
8042
8045
  viewProps.style = normalizeStyle(styleProp);
8043
8046
  else
8044
- for (var isArray = Array.isArray(styleProp), len = isArray ? props.length : 1, i1 = 0; i1 < len; i1++) {
8047
+ for (var isArray = Array.isArray(styleProp), len = isArray ? styleProp.length : 1, i1 = 0; i1 < len; i1++) {
8045
8048
  var style1 = isArray ? styleProp[i1] : styleProp;
8046
8049
  if (style1)
8047
8050
  if (style1.$$css)
@@ -8051,6 +8054,15 @@ current`, _object_spread2({}, styleState.style)));
8051
8054
  (_styleState4 = styleState).style || (_styleState4.style = {}), Object.assign(styleState.style, normalizeStyle(style1));
8052
8055
  }
8053
8056
  }
8057
+ var style2 = styleState.style;
8058
+ if (style2 != null && style2.fontFamily) {
8059
+ var _getFont, faceInfo = (_getFont = (0, import_config.getFont)(style2.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
8060
+ if (faceInfo) {
8061
+ 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;
8062
+ overrideFace && (style2.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style2.fontWeight, delete style2.fontStyle);
8063
+ }
8064
+ process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)("Found fontFamily native: ".concat(style2.fontFamily), faceInfo);
8065
+ }
8054
8066
  var result = {
8055
8067
  space,
8056
8068
  hasMedia,
@@ -8063,16 +8075,7 @@ current`, _object_spread2({}, styleState.style)));
8063
8075
  dynamicThemeAccess,
8064
8076
  pseudoGroups,
8065
8077
  mediaGroups
8066
- }, style2 = styleState.style;
8067
- if (style2 != null && style2.fontFamily) {
8068
- var _getFont, faceInfo = (_getFont = (0, import_config.getFont)(style2.fontFamily)) === null || _getFont === void 0 ? void 0 : _getFont.face;
8069
- if (faceInfo) {
8070
- 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;
8071
- overrideFace && (style2.fontFamily = overrideFace, styleState.fontFamily = overrideFace, delete style2.fontWeight, delete style2.fontStyle);
8072
- }
8073
- process.env.NODE_ENV === "development" && debug && debug !== "profile" && (0, import_log.log)("Found fontFamily native: ".concat(style2.fontFamily), faceInfo);
8074
- }
8075
- var asChild = props.asChild, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
8078
+ }, asChild = props.asChild, asChildExceptStyleLike = asChild === "except-style" || asChild === "except-style-web";
8076
8079
  if (!asChildExceptStyleLike) {
8077
8080
  var style3 = styleState.style;
8078
8081
  if (0) {
@@ -9266,7 +9269,16 @@ var require_createComponent_native = __commonJS({
9266
9269
  });
9267
9270
  }
9268
9271
  }));
9269
- var cancelTouches, BaseText, BaseView, hasSetupBaseViews = !1;
9272
+ var cancelTouches, BaseText, BaseView, hasSetupBaseViews = !1, lastInteractionWasKeyboard = {
9273
+ value: !1
9274
+ };
9275
+ import_constants.isWeb && globalThis.document && (document.addEventListener("keydown", function() {
9276
+ lastInteractionWasKeyboard.value = !0;
9277
+ }), document.addEventListener("mousedown", function() {
9278
+ lastInteractionWasKeyboard.value = !1;
9279
+ }), document.addEventListener("mousemove", function() {
9280
+ lastInteractionWasKeyboard.value = !1;
9281
+ }));
9270
9282
  function createComponent(staticConfig) {
9271
9283
  var _staticConfig_defaultProps, componentName = staticConfig.componentName, config = null, defaultProps = staticConfig.defaultProps;
9272
9284
  (0, import_config.onConfiguredOnce)(function(conf) {
@@ -9330,9 +9342,7 @@ var require_createComponent_native = __commonJS({
9330
9342
  ]), !1)
9331
9343
  var timer;
9332
9344
  process.env.NODE_ENV === "development" && time && time(_templateObject()), process.env.NODE_ENV === "development" && time && time(_templateObject1());
9333
- var stateRef = (0, import_react3.useRef)({
9334
- handleFocusVisible: !0
9335
- });
9345
+ var stateRef = (0, import_react3.useRef)({});
9336
9346
  process.env.NODE_ENV === "development" && time && time(_templateObject2());
9337
9347
  var 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() {
9338
9348
  var next = !!(hasAnimationProp && !isHOC && useAnimations);
@@ -9536,11 +9546,11 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9536
9546
  }
9537
9547
  var disposeGroupsListener;
9538
9548
  if (pseudoGroups || mediaGroups) {
9539
- var current = {
9549
+ var _componentContext_groups, current = {
9540
9550
  pseudo: {},
9541
9551
  media: {}
9542
9552
  };
9543
- disposeGroupsListener = componentContext.groups.subscribe(function(name2, param) {
9553
+ process.env.NODE_ENV === "development" && !componentContext.groups && console.debug("No context group found"), disposeGroupsListener = (_componentContext_groups = componentContext.groups) === null || _componentContext_groups === void 0 ? void 0 : _componentContext_groups.subscribe(function(name2, param) {
9544
9554
  var layout = param.layout, pseudo = param.pseudo, persist = function() {
9545
9555
  var group = _object_spread_props(_object_spread2({}, state.group), _define_property2({}, name2, current));
9546
9556
  setStateShallow({
@@ -9569,7 +9579,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9569
9579
  process.env.NODE_ENV === "development" && time && time(_templateObject14());
9570
9580
  var events = shouldAttach ? _object_spread2(_object_spread_props(_object_spread2({
9571
9581
  onPressOut: attachPress ? function(e) {
9572
- stateRef.current.handleFocusVisible = !0, unPress(), onPressOut == null || onPressOut(e), onMouseUp == null || onMouseUp(e);
9582
+ unPress(), onPressOut == null || onPressOut(e), onMouseUp == null || onMouseUp(e);
9573
9583
  } : void 0
9574
9584
  }, (attachHover || attachPress) && {
9575
9585
  onMouseEnter: function(e) {
@@ -9582,7 +9592,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9582
9592
  }
9583
9593
  }), {
9584
9594
  onPressIn: attachPress ? function(e) {
9585
- stateRef.current.handleFocusVisible = !1, runtimePressStyle && setStateShallow({
9595
+ runtimePressStyle && setStateShallow({
9586
9596
  press: !0,
9587
9597
  pressIn: !0
9588
9598
  }), onPressIn == null || onPressIn(e), onMouseDown == null || onMouseDown(e), import_constants.isWeb && mouseUps.add(unPress);
@@ -9599,7 +9609,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9599
9609
  pseudos != null && pseudos.focusVisibleStyle ? setTimeout(function() {
9600
9610
  setStateShallow({
9601
9611
  focus: !0,
9602
- focusVisible: !!stateRef.current.handleFocusVisible
9612
+ focusVisible: !!lastInteractionWasKeyboard.value
9603
9613
  });
9604
9614
  }, 0) : setStateShallow({
9605
9615
  focus: !0,
@@ -9607,7 +9617,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9607
9617
  }), onFocus == null || onFocus(e);
9608
9618
  },
9609
9619
  onBlur: function(e) {
9610
- stateRef.current.handleFocusVisible = !0, setStateShallow({
9620
+ setStateShallow({
9611
9621
  focus: !1,
9612
9622
  focusVisible: !1
9613
9623
  }), onBlur == null || onBlur(e);
@@ -10603,11 +10613,11 @@ var require_insertFont_native = __commonJS({
10603
10613
  }
10604
10614
  });
10605
10615
  module2.exports = __toCommonJS2(insertFont_exports);
10606
- var import_config = require_config_native(), import_createFont = require_createFont_native(), import_createVariables = require_createVariables_native(), import_registerCSSVariable = require_registerCSSVariable_native();
10616
+ 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();
10607
10617
  function insertFont(name, fontIn) {
10608
10618
  var font = (0, import_createFont.createFont)(fontIn), tokened = (0, import_createVariables.createVariables)(font, name), parsed = parseFont(tokened);
10609
10619
  if (0)
10610
- var fontVars, style;
10620
+ var fontVars, styleElement;
10611
10621
  return (0, import_config.setConfigFont)(name, tokened, parsed), parsed;
10612
10622
  }
10613
10623
  var updateFont = insertFont;