@tamagui/core 1.121.4 → 1.121.5

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
@@ -1247,6 +1247,7 @@ var require_concatClassName_native = __commonJS({
1247
1247
  focus: "focusStyle",
1248
1248
  press: "pressStyle",
1249
1249
  focusVisible: "focusVisibleStyle",
1250
+ focusWithin: "focusWithinStyle",
1250
1251
  disabled: "disabledStyle"
1251
1252
  };
1252
1253
  }
@@ -1821,7 +1822,8 @@ var require_validStyleProps_native = __commonJS({
1821
1822
  hoverStyle: !0,
1822
1823
  pressStyle: !0,
1823
1824
  focusStyle: !0,
1824
- disabledStyle: !0
1825
+ disabledStyle: !0,
1826
+ focusWithinStyle: !0
1825
1827
  }, validStyles = {
1826
1828
  ...validPseudoKeys,
1827
1829
  ...stylePropsView
@@ -2734,6 +2736,11 @@ var require_pseudoDescriptors_native = __commonJS({
2734
2736
  name: "focus",
2735
2737
  priority: 3
2736
2738
  },
2739
+ focusWithinStyle: {
2740
+ name: "focus-within",
2741
+ priority: 3,
2742
+ stateKey: "focusWithin"
2743
+ },
2737
2744
  disabledStyle: {
2738
2745
  name: "disabled",
2739
2746
  priority: 4,
@@ -2744,6 +2751,7 @@ var require_pseudoDescriptors_native = __commonJS({
2744
2751
  press: 2,
2745
2752
  focus: 3,
2746
2753
  focusVisible: 3,
2754
+ focusWithin: 3,
2747
2755
  disabled: 4
2748
2756
  }, pseudoDescriptors = {
2749
2757
  ...pseudoDescriptorsBase,
@@ -4502,6 +4510,7 @@ var require_ComponentContext_native = __commonJS({
4502
4510
  inText: !1,
4503
4511
  language: null,
4504
4512
  animationDriver: null,
4513
+ setParentFocusState: null,
4505
4514
  groups: {
4506
4515
  emit: null,
4507
4516
  subscribe: null,
@@ -4566,6 +4575,7 @@ var require_defaultComponentState_native = __commonJS({
4566
4575
  pressIn: !1,
4567
4576
  focus: !1,
4568
4577
  focusVisible: !1,
4578
+ focusWithin: !1,
4569
4579
  unmounted: !0,
4570
4580
  disabled: !1
4571
4581
  }, defaultComponentStateMounted = {
@@ -4739,7 +4749,9 @@ var require_createMediaStyle_native = __commonJS({
4739
4749
  });
4740
4750
  module2.exports = __toCommonJS2(createMediaStyle_exports);
4741
4751
  var import_config = require_config_native(), import_useMedia = require_useMedia_native(), import_getGroupPropParts = require_getGroupPropParts_native(), MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
4742
- press: "active"
4752
+ press: "active",
4753
+ focusVisible: "focus-visible",
4754
+ focusWithin: "focus-within"
4743
4755
  }, specificities = new Array(5).fill(0).map(function(_, i) {
4744
4756
  return new Array(i).fill(":root").join("");
4745
4757
  });
@@ -4751,7 +4763,7 @@ var require_createMediaStyle_native = __commonJS({
4751
4763
  ];
4752
4764
  }
4753
4765
  var createMediaStyle = function(styleObject, mediaKeyIn, mediaQueries, type, negate, priority) {
4754
- var [property, , identifier, pseudoIn, rules] = styleObject, enableMediaPropOrder = (0, import_config.getSetting)("mediaPropOrder"), isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupPriority = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map(function(rule) {
4766
+ var [propertyIn, , identifier, pseudoIn, rules] = styleObject, property = propertyIn, enableMediaPropOrder = (0, import_config.getSetting)("mediaPropOrder"), isTheme = type === "theme", isPlatform = type === "platform", isGroup = type === "group", isNonWindowMedia = isTheme || isPlatform || isGroup, negKey = negate ? "0" : "", ogPrefix = identifier.slice(0, identifier.indexOf("-") + 1), id = `${ogPrefix}${MEDIA_SEP}${mediaKeyIn.replace("-", "")}${negKey}${MEDIA_SEP}`, styleRule = "", groupPriority = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map(function(rule) {
4755
4767
  return rule.replace(identifier, nextIdentifier);
4756
4768
  }).join(";"), isHover = !1;
4757
4769
  if (isNonWindowMedia) {
@@ -7145,11 +7157,11 @@ var require_getSplitStyles_native = __commonJS({
7145
7157
  var _iteratorNormalCompletion12 = !0, _didIteratorError12 = !1, _iteratorError12 = void 0;
7146
7158
  try {
7147
7159
  for (var _iterator12 = mediaStyles[Symbol.iterator](), _step12; !(_iteratorNormalCompletion12 = (_step12 = _iterator12.next()).done); _iteratorNormalCompletion12 = !0) {
7148
- var style3 = _step12.value, property = style3[0];
7149
- if (!(property[0] === "$" && !(0, import_isActivePlatform.isActivePlatform)(property))) {
7160
+ var style3 = _step12.value, property = style3[import_helpers.StyleObjectProperty], isSubStyle = property[0] === "$";
7161
+ if (!(isSubStyle && !(0, import_isActivePlatform.isActivePlatform)(property))) {
7150
7162
  var out = (0, import_createMediaStyle.createMediaStyle)(style3, mediaKeyShort, import_useMedia.mediaQueryConfig, isMedia, !1, priority);
7151
7163
  process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out);
7152
- var fullKey1 = `${style3[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${mediaKeyShort}${style3[import_helpers.StyleObjectPseudo] || ""}`;
7164
+ var subKey = isSubStyle ? style3[2] : "", fullKey1 = `${style3[import_helpers.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style3[import_helpers.StyleObjectPseudo] || ""}`;
7153
7165
  fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out), mergeClassName(transforms, classNames, fullKey1, out[import_helpers.StyleObjectIdentifier], !0, !0));
7154
7166
  }
7155
7167
  }
@@ -7200,15 +7212,15 @@ var require_getSplitStyles_native = __commonJS({
7200
7212
  importanceBump = priority1;
7201
7213
  }
7202
7214
  }
7203
- for (var subKey in mediaStyle1) {
7204
- if (subKey === "space") {
7215
+ for (var subKey1 in mediaStyle1) {
7216
+ if (subKey1 === "space") {
7205
7217
  space = valInit.space;
7206
7218
  continue;
7207
7219
  }
7208
- if (subKey[0] === "$") {
7209
- if (!(0, import_isActivePlatform.isActivePlatform)(subKey) || !(0, import_isActiveTheme.isActiveTheme)(subKey, themeName)) continue;
7210
- for (var subSubKey in mediaStyle1[subKey]) mergeMediaStyle2(subSubKey, mediaStyle1[subKey][subSubKey]);
7211
- } else mergeMediaStyle2(subKey, mediaStyle1[subKey]);
7220
+ if (subKey1[0] === "$") {
7221
+ if (!(0, import_isActivePlatform.isActivePlatform)(subKey1) || !(0, import_isActiveTheme.isActiveTheme)(subKey1, themeName)) continue;
7222
+ for (var subSubKey in mediaStyle1[subKey1]) mergeMediaStyle2(subSubKey, mediaStyle1[subKey1][subSubKey]);
7223
+ } else mergeMediaStyle2(subKey1, mediaStyle1[subKey1]);
7212
7224
  }
7213
7225
  }
7214
7226
  return "continue";
@@ -7257,8 +7269,14 @@ var require_getSplitStyles_native = __commonJS({
7257
7269
  if (0) var didUseKeyInit;
7258
7270
  var 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), isMediaOrPseudo1 = !!(isMedia || isPseudo);
7259
7271
  if (isMediaOrPseudo1 && keyInit.startsWith("$group-")) {
7260
- var name = keyInit.split("-")[1];
7261
- context != null && context.groups.subscribe && !(context != null && context.groups.state[name]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
7272
+ var parts = keyInit.split("-");
7273
+ if (
7274
+ // check if its actually a simple group selector to avoid breaking selectors
7275
+ parts.length === 2 || parts.length === 3 && import_pseudoDescriptors.pseudoPriorities[parts[parts.length - 1]]
7276
+ ) {
7277
+ var name = parts[1];
7278
+ context != null && context.groups.subscribe && !(context != null && context.groups.state[name]) && (keyInit = keyInit.replace("$group-", "$group-true-"));
7279
+ }
7262
7280
  }
7263
7281
  var isStyleProp = isValidStyleKeyInit || isMediaOrPseudo1 || isVariant && !noExpand || isShorthand;
7264
7282
  if (!(isStyleProp && (asChild === "except-style" || asChild === "except-style-web"))) {
@@ -8641,7 +8659,7 @@ var require_createComponent_native = __commonJS({
8641
8659
  if ("themeInverse" in props && (themeStateProps.inverse = props.themeInverse), "theme" in props && (themeStateProps.name = props.theme), typeof curStateRef.isListeningToTheme == "boolean" && (themeStateProps.shouldUpdate = function() {
8642
8660
  return stateRef.current.isListeningToTheme;
8643
8661
  }), themeStateProps.deopt = willBeAnimated, process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
8644
- var name = `${componentName2 || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`, type = (hasEnterStyle ? "(hasEnter)" : " ") + (isAnimated ? "(animated)" : " ") + (isReactNative ? "(rnw)" : " ") + (noClass ? "(noClass)" : " ") + (state.press || state.pressIn ? "(PRESSED)" : " ") + (state.hover ? "(HOVERED)" : " ") + (state.focus ? "(FOCUSED)" : " ") + ((presenceState == null ? void 0 : presenceState.isPresent) === !1 ? "(EXIT)" : ""), dataIs = propsIn["data-is"] || "", banner = `${internalID} ${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
8662
+ var name = `${componentName2 || (Component == null ? void 0 : Component.displayName) || (Component == null ? void 0 : Component.name) || "[Unnamed Component]"}`, type = (hasEnterStyle ? "(hasEnter)" : " ") + (isAnimated ? "(animated)" : " ") + (isReactNative ? "(rnw)" : " ") + (noClass ? "(noClass)" : " ") + (state.press || state.pressIn ? "(PRESSED)" : " ") + (state.hover ? "(HOVERED)" : " ") + (state.focus ? "(FOCUSED)" : " ") + (state.focusWithin ? "(WITHIN FOCUSED)" : " ") + ((presenceState == null ? void 0 : presenceState.isPresent) === !1 ? "(EXIT)" : ""), dataIs = propsIn["data-is"] || "", banner = `${internalID} ${name}${dataIs ? ` ${dataIs}` : ""} ${type}`;
8645
8663
  if (console.info(`%c ${banner} (hydrated: ${isHydrated}) (unmounted: ${state.unmounted})`, "background: green; color: white;"), import_constants2.isServer) (0, import_log.log)({
8646
8664
  noClass,
8647
8665
  isAnimated,
@@ -8755,7 +8773,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
8755
8773
  return stateRef.current.host = x;
8756
8774
  }, forwardedRef, import_setElementProps.setElementProps)), viewProps.ref = curStateRef.composedRef, process.env.NODE_ENV === "development" && !isReactNative && !isText && import_constants2.isWeb && !isHOC && import_react3.default.Children.toArray(props.children).forEach(function(item) {
8757
8775
  typeof item == "string" && item !== `
8758
- ` && console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
8776
+ ` && console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <${staticConfig.componentName || propsIn.tag || "View"}>.`, props);
8759
8777
  }), process.env.NODE_ENV === "development" && time2 && time2`events-hooks`;
8760
8778
  var { pseudoGroups, mediaGroups } = splitStyles, unPress = function() {
8761
8779
  return setStateShallow({
@@ -8812,7 +8830,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
8812
8830
  ...mediaGroups
8813
8831
  ]).join("") : 0
8814
8832
  ]);
8815
- var runtimePressStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClass && (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 && noClass && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut), attachHover = import_constants2.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(groupName || runtimePressStyle);
8833
+ var runtimePressStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.pressStyle), runtimeFocusStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusStyle), runtimeFocusVisibleStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.focusVisibleStyle), attachFocus = !!(runtimePressStyle || runtimeFocusStyle || runtimeFocusVisibleStyle || onFocus || onBlur || componentContext.setParentFocusState), attachPress = !!(groupName || runtimePressStyle || onPress || onPressOut || onPressIn || onMouseDown || onMouseUp || onLongPress || onClick || pseudos != null && pseudos.focusVisibleStyle), runtimeHoverStyle = !disabled && noClass && (pseudos == null ? void 0 : pseudos.hoverStyle), needsHoverState = !!(groupName || runtimeHoverStyle || onHoverIn || onHoverOut), attachHover = import_constants2.isWeb && !!(groupName || needsHoverState || onMouseEnter || onMouseLeave), shouldAttach = !disabled && !props.asChild && !!(attachFocus || attachPress || attachHover || runtimePressStyle || runtimeHoverStyle || runtimeFocusStyle), needsPressState = !!(groupName || runtimePressStyle);
8816
8834
  process.env.NODE_ENV === "development" && time2 && time2`events-setup`, process.env.NODE_ENV === "development" && debugProp === "verbose" && (0, import_log.log)("\u{1FAA9} events()", {
8817
8835
  runtimeFocusStyle,
8818
8836
  runtimePressStyle,
@@ -8854,7 +8872,9 @@ If you meant to do this, you can disable this warning - either change untilMeasu
8854
8872
  },
8855
8873
  ...attachFocus && {
8856
8874
  onFocus: function(e) {
8857
- pseudos != null && pseudos.focusVisibleStyle ? setTimeout(function() {
8875
+ componentContext.setParentFocusState && componentContext.setParentFocusState({
8876
+ focusWithin: !0
8877
+ }), pseudos != null && pseudos.focusVisibleStyle ? setTimeout(function() {
8858
8878
  setStateShallow({
8859
8879
  focus: !0,
8860
8880
  focusVisible: !!lastInteractionWasKeyboard.value
@@ -8865,7 +8885,9 @@ If you meant to do this, you can disable this warning - either change untilMeasu
8865
8885
  }), onFocus == null || onFocus(e);
8866
8886
  },
8867
8887
  onBlur: function(e) {
8868
- setStateShallow({
8888
+ componentContext.setParentFocusState && componentContext.setParentFocusState({
8889
+ focusWithin: !1
8890
+ }), setStateShallow({
8869
8891
  focus: !1,
8870
8892
  focusVisible: !1
8871
8893
  }), onBlur == null || onBlur(e);
@@ -8935,9 +8957,10 @@ If you meant to do this, you can disable this warning - either change untilMeasu
8935
8957
  }, [
8936
8958
  groupName
8937
8959
  ]);
8938
- if (groupName && subGroupContext && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
8960
+ if ((groupName && subGroupContext || propsIn.focusWithinStyle) && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
8939
8961
  ...componentContext,
8940
8962
  groups: subGroupContext,
8963
+ setParentFocusState: setStateShallow,
8941
8964
  children: content
8942
8965
  })), process.env.NODE_ENV === "development" && time2 && time2`group-context`, content = disableTheme ? content : (0, import_Theme.getThemedChildren)(themeState, content, themeStateProps, !1, stateRef), process.env.NODE_ENV === "development" && time2 && time2`themed-children`, process.env.NODE_ENV === "development" && props.debug === "visualize" && (content = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeDebug.ThemeDebug, {
8943
8966
  themeState,