@tamagui/core 1.102.3 → 1.103.1

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
@@ -7764,6 +7764,7 @@ var require_getSplitStyles_native = __commonJS({
7764
7764
  staticConfig,
7765
7765
  shouldDoClasses,
7766
7766
  styleProps,
7767
+ rulesToInsert,
7767
7768
  componentState,
7768
7769
  styleState,
7769
7770
  theme: _object_spread2({}, theme)
@@ -9663,7 +9664,7 @@ var require_createComponent_native = __commonJS({
9663
9664
  enabled: shouldListenForMedia,
9664
9665
  keys: mediaListeningKeys
9665
9666
  });
9666
- var viewPropsIn = splitStyles.viewProps, pseudos = splitStyles.pseudos, splitStylesStyle = splitStyles.style, classNames = splitStyles.classNames, space = splitStyles.space, propsWithAnimation = props, asChild = viewPropsIn.asChild, children = viewPropsIn.children, themeShallow = viewPropsIn.themeShallow, _spaceDirection = viewPropsIn.spaceDirection, onPress = viewPropsIn.onPress, onLongPress = viewPropsIn.onLongPress, onPressIn = viewPropsIn.onPressIn, onPressOut = viewPropsIn.onPressOut, onHoverIn = viewPropsIn.onHoverIn, onHoverOut = viewPropsIn.onHoverOut, onMouseUp = viewPropsIn.onMouseUp, onMouseDown = viewPropsIn.onMouseDown, onMouseEnter = viewPropsIn.onMouseEnter, onMouseLeave = viewPropsIn.onMouseLeave, onFocus = viewPropsIn.onFocus, onBlur = viewPropsIn.onBlur, separator = viewPropsIn.separator, _forceStyle = viewPropsIn.forceStyle, onClick = viewPropsIn.onClick, _themeProp = viewPropsIn.theme, defaultVariants = viewPropsIn.defaultVariants, nonTamaguiProps = _object_without_properties(viewPropsIn, [
9667
+ var viewPropsIn = splitStyles.viewProps, pseudos = splitStyles.pseudos, splitStylesStyle = splitStyles.style, classNames = splitStyles.classNames, space = splitStyles.space, propsWithAnimation = props, asChild = viewPropsIn.asChild, children = viewPropsIn.children, themeShallow = viewPropsIn.themeShallow, _spaceDirection = viewPropsIn.spaceDirection, onPress = viewPropsIn.onPress, onLongPress = viewPropsIn.onLongPress, onPressIn = viewPropsIn.onPressIn, onPressOut = viewPropsIn.onPressOut, onHoverIn = viewPropsIn.onHoverIn, onHoverOut = viewPropsIn.onHoverOut, onMouseUp = viewPropsIn.onMouseUp, onMouseDown = viewPropsIn.onMouseDown, onMouseEnter = viewPropsIn.onMouseEnter, onMouseLeave = viewPropsIn.onMouseLeave, onFocus = viewPropsIn.onFocus, onBlur = viewPropsIn.onBlur, separator = viewPropsIn.separator, _forceStyle = viewPropsIn.forceStyle, onClick = viewPropsIn.onClick, _themeProp = viewPropsIn.theme, nonTamaguiProps = _object_without_properties(viewPropsIn, [
9667
9668
  "asChild",
9668
9669
  "children",
9669
9670
  "themeShallow",
@@ -9683,8 +9684,7 @@ var require_createComponent_native = __commonJS({
9683
9684
  "separator",
9684
9685
  "forceStyle",
9685
9686
  "onClick",
9686
- "theme",
9687
- "defaultVariants"
9687
+ "theme"
9688
9688
  ]), viewProps = nonTamaguiProps;
9689
9689
  !isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), elementType.acceptTagProp && (viewProps.tag = tagProp);
9690
9690
  var animationStyles, shouldUseAnimation = (
@@ -9704,7 +9704,7 @@ var require_createComponent_native = __commonJS({
9704
9704
  staticConfig,
9705
9705
  stateRef
9706
9706
  });
9707
- (isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles), process.env.NODE_ENV === "development" && time && time(_templateObject11());
9707
+ (isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = "".concat(viewProps.className || "", " ").concat(animations.className))), process.env.NODE_ENV === "development" && time && time(_templateObject11());
9708
9708
  }
9709
9709
  process.env.NODE_ENV === "development" && props.untilMeasured && !props.group && console.warn(`You set the untilMeasured prop without setting group. This doesn't work, be sure to set untilMeasured on the parent that sets group, not the children that use the $group- prop.
9710
9710
 
@@ -9726,7 +9726,9 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9726
9726
  pressIn: !1
9727
9727
  });
9728
9728
  };
9729
- (0, import_react3.useEffect)(function() {
9729
+ process.env.NODE_ENV === "development" && (0, import_constants.useIsomorphicLayoutEffect)(function() {
9730
+ debugProp && (console.groupCollapsed("Rendered style >"), console.warn(getComputedStyle(stateRef.current.host)), console.groupEnd());
9731
+ }), (0, import_react3.useEffect)(function() {
9730
9732
  if (!disabled) {
9731
9733
  if (state.unmounted === !0 && hasEnterStyle) {
9732
9734
  setStateShallow({
@@ -11507,12 +11509,19 @@ var require_styled_native = __commonJS({
11507
11509
  "defaultVariants",
11508
11510
  "acceptsClassName",
11509
11511
  "context"
11510
- ]);
11511
- if (defaultVariants && (defaultProps = _object_spread2({}, defaultVariants, defaultProps)), parentStaticConfig) {
11512
+ ]), parentDefaultVariants, parentDefaultProps;
11513
+ if (parentStaticConfig) {
11512
11514
  var avoid = parentStaticConfig.isHOC && !parentStaticConfig.isStyledHOC;
11513
- avoid || (defaultProps = _object_spread2({}, parentStaticConfig.defaultProps, defaultProps), parentStaticConfig.variants && (variants = (0, import_mergeVariants.mergeVariants)(parentStaticConfig.variants, variants)));
11515
+ if (!avoid) {
11516
+ var pdp = parentStaticConfig.defaultProps;
11517
+ for (var key2 in pdp) {
11518
+ var val = pdp[key2];
11519
+ parentStaticConfig.defaultVariants && key2 in parentStaticConfig.defaultVariants && (!defaultVariants || !(key2 in defaultVariants)) && (parentDefaultVariants || (parentDefaultVariants = {}), parentDefaultVariants[key2] = val), key2 in defaultProps || (parentDefaultProps || (parentDefaultProps = {}), parentDefaultProps[key2] = pdp[key2]);
11520
+ }
11521
+ parentStaticConfig.variants && (variants = (0, import_mergeVariants.mergeVariants)(parentStaticConfig.variants, variants));
11522
+ }
11514
11523
  }
11515
- parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
11524
+ (parentDefaultProps || defaultVariants || parentDefaultVariants) && (defaultProps = _object_spread2({}, parentDefaultProps, parentDefaultVariants, defaultProps, defaultVariants)), parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
11516
11525
  var isText = !!(staticExtractionOptions != null && staticExtractionOptions.isText || parentStaticConfig != null && parentStaticConfig.isText), acceptsClassName = acceptsClassNameProp ?? (isPlainStyledComponent || isReactNative || (parentStaticConfig == null ? void 0 : parentStaticConfig.isHOC) && (parentStaticConfig == null ? void 0 : parentStaticConfig.acceptsClassName)), conf = _object_spread_props(_object_spread2(_object_spread_props(_object_spread2({}, parentStaticConfig, staticExtractionOptions, !isPlainStyledComponent && {
11517
11526
  Component
11518
11527
  }), {
@@ -12817,7 +12826,7 @@ var require_TamaguiProvider_native = __commonJS({
12817
12826
  "@swc/helpers - typeof";
12818
12827
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
12819
12828
  }
12820
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
12829
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
12821
12830
  for (var name in all) __defProp2(target, name, {
12822
12831
  get: all[name],
12823
12832
  enumerable: !0
@@ -12845,18 +12854,6 @@ var require_TamaguiProvider_native = __commonJS({
12845
12854
  }
12846
12855
  }
12847
12856
  return to;
12848
- }, __toESM2 = function(mod, isNodeMode, target) {
12849
- return target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
12850
- // If the importer is in node compatibility mode or this is not an ESM
12851
- // file that has been converted to a CommonJS file using a Babel-
12852
- // compatible transform (i.e. "__esModule" has not been set), then set
12853
- // "default" to the CommonJS "module.exports" for node compatibility.
12854
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", {
12855
- value: mod,
12856
- enumerable: !0
12857
- }) : target,
12858
- mod
12859
- );
12860
12857
  }, __toCommonJS2 = function(mod) {
12861
12858
  return __copyProps2(__defProp2({}, "__esModule", {
12862
12859
  value: !0
@@ -12868,64 +12865,51 @@ var require_TamaguiProvider_native = __commonJS({
12868
12865
  }
12869
12866
  });
12870
12867
  module2.exports = __toCommonJS2(TamaguiProvider_exports);
12871
- var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require_index_native3(), React = __toESM2(require("react")), import_ComponentContext = require_ComponentContext_native(), import_useMedia = require_useMedia_native(), import_ThemeProvider = require_ThemeProvider_native(), import_useDidHydrateOnce = require_useDidHydrateOnce_native();
12872
- function _define_property2(obj, key, value) {
12873
- return key in obj ? Object.defineProperty(obj, key, {
12874
- value,
12875
- enumerable: !0,
12876
- configurable: !0,
12877
- writable: !0
12878
- }) : obj[key] = value, obj;
12868
+ var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require_index_native3(), import_react3 = require("react"), import_ComponentContext = require_ComponentContext_native(), import_useDidHydrateOnce = require_useDidHydrateOnce_native(), import_useMedia = require_useMedia_native(), import_ThemeProvider = require_ThemeProvider_native();
12869
+ function _array_like_to_array(arr, len) {
12870
+ (len == null || len > arr.length) && (len = arr.length);
12871
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
12872
+ return arr2;
12879
12873
  }
12880
- function _object_spread2(target) {
12881
- for (var i = 1; i < arguments.length; i++) {
12882
- var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
12883
- typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
12884
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
12885
- }))), ownKeys2.forEach(function(key) {
12886
- _define_property2(target, key, source[key]);
12887
- });
12888
- }
12889
- return target;
12874
+ function _array_with_holes(arr) {
12875
+ if (Array.isArray(arr)) return arr;
12890
12876
  }
12891
- function ownKeys(object, enumerableOnly) {
12892
- var keys = Object.keys(object);
12893
- if (Object.getOwnPropertySymbols) {
12894
- var symbols = Object.getOwnPropertySymbols(object);
12895
- enumerableOnly && (symbols = symbols.filter(function(sym) {
12896
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
12897
- })), keys.push.apply(keys, symbols);
12877
+ function _iterable_to_array_limit(arr, i) {
12878
+ var _i = arr == null ? null : (typeof Symbol > "u" ? "undefined" : _type_of(Symbol)) < "u" && arr[Symbol.iterator] || arr["@@iterator"];
12879
+ if (_i != null) {
12880
+ var _arr = [], _n = !0, _d = !1, _s, _e;
12881
+ try {
12882
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0) ;
12883
+ } catch (err) {
12884
+ _d = !0, _e = err;
12885
+ } finally {
12886
+ try {
12887
+ !_n && _i.return != null && _i.return();
12888
+ } finally {
12889
+ if (_d) throw _e;
12890
+ }
12891
+ }
12892
+ return _arr;
12898
12893
  }
12899
- return keys;
12900
12894
  }
12901
- function _object_spread_props(target, source) {
12902
- return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
12903
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
12904
- }), target;
12895
+ function _non_iterable_rest() {
12896
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12905
12897
  }
12906
- function _object_without_properties(source, excluded) {
12907
- if (source == null) return {};
12908
- var target = _object_without_properties_loose(source, excluded), key, i;
12909
- if (Object.getOwnPropertySymbols) {
12910
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12911
- for (i = 0; i < sourceSymbolKeys.length; i++) key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
12912
- }
12913
- return target;
12898
+ function _sliced_to_array(arr, i) {
12899
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
12914
12900
  }
12915
- function _object_without_properties_loose(source, excluded) {
12916
- if (source == null) return {};
12917
- var target = {}, sourceKeys = Object.keys(source), key, i;
12918
- for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
12919
- return target;
12901
+ function _unsupported_iterable_to_array(o, minLen) {
12902
+ if (o) {
12903
+ if (typeof o == "string") return _array_like_to_array(o, minLen);
12904
+ var n = Object.prototype.toString.call(o).slice(8, -1);
12905
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
12906
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
12907
+ }
12920
12908
  }
12921
- function TamaguiProvider(_param) {
12922
- var children = _param.children, disableInjectCSS = _param.disableInjectCSS, config = _param.config, themePropsProvider = _object_without_properties(_param, [
12923
- "children",
12924
- "disableInjectCSS",
12925
- "config"
12926
- ]);
12927
- (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && ((0, import_useDidHydrateOnce.useDidHydrateOnceRoot)(), React.useInsertionEffect(function() {
12928
- if (config && (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS)) {
12909
+ function TamaguiProvider(param) {
12910
+ var children = param.children, disableInjectCSS = param.disableInjectCSS, config = param.config, className = param.className, defaultTheme = param.defaultTheme, disableRootThemeClass = param.disableRootThemeClass, reset = param.reset, themeClassNameOnRoot = param.themeClassNameOnRoot;
12911
+ (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && ((0, import_useDidHydrateOnce.useDidHydrateOnceRoot)(), (0, import_constants.useIsomorphicLayoutEffect)(function() {
12912
+ if (config && !disableInjectCSS) {
12929
12913
  var style = document.createElement("style");
12930
12914
  return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), function() {
12931
12915
  document.head.removeChild(style);
@@ -12935,18 +12919,32 @@ var require_TamaguiProvider_native = __commonJS({
12935
12919
  config,
12936
12920
  disableInjectCSS
12937
12921
  ]));
12938
- var _themePropsProvider_defaultTheme;
12939
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
12940
- animationDriver: config == null ? void 0 : config.animations,
12941
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeProvider.ThemeProvider, _object_spread_props(_object_spread2({
12942
- themeClassNameOnRoot: config == null ? void 0 : config.themeClassNameOnRoot,
12943
- disableRootThemeClass: config == null ? void 0 : config.disableRootThemeClass
12944
- }, themePropsProvider), {
12945
- defaultTheme: (_themePropsProvider_defaultTheme = themePropsProvider.defaultTheme) !== null && _themePropsProvider_defaultTheme !== void 0 ? _themePropsProvider_defaultTheme : config ? Object.keys(config.themes)[0] : "",
12946
- children
12947
- }))
12922
+ var contents = (0, import_react3.useMemo)(function() {
12923
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
12924
+ animationDriver: config == null ? void 0 : config.animations,
12925
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeProvider.ThemeProvider, {
12926
+ themeClassNameOnRoot: themeClassNameOnRoot ?? (config == null ? void 0 : config.themeClassNameOnRoot),
12927
+ disableRootThemeClass: disableRootThemeClass ?? (config == null ? void 0 : config.disableRootThemeClass),
12928
+ defaultTheme: defaultTheme ?? (config ? Object.keys(config.themes)[0] : ""),
12929
+ reset,
12930
+ className,
12931
+ children
12932
+ })
12933
+ });
12934
+ }, []);
12935
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnmountedClassName, {
12936
+ children: contents
12948
12937
  });
12949
12938
  }
12939
+ function UnmountedClassName(props) {
12940
+ var _useState = _sliced_to_array((0, import_react3.useState)(!1), 2), mounted = _useState[0], setMounted = _useState[1];
12941
+ return (0, import_react3.useEffect)(function() {
12942
+ setMounted(!0);
12943
+ }, []), import_constants.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
12944
+ className: mounted ? "" : "t_unmounted",
12945
+ children: props.children
12946
+ }) : props.children;
12947
+ }
12950
12948
  TamaguiProvider.displayName = "TamaguiProvider";
12951
12949
  }
12952
12950
  });