@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.
@@ -8893,7 +8893,7 @@ var require_createComponent_native = __commonJS({
8893
8893
  enabled: shouldListenForMedia,
8894
8894
  keys: mediaListeningKeys
8895
8895
  });
8896
- 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, [
8896
+ 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, [
8897
8897
  "asChild",
8898
8898
  "children",
8899
8899
  "themeShallow",
@@ -8913,8 +8913,7 @@ var require_createComponent_native = __commonJS({
8913
8913
  "separator",
8914
8914
  "forceStyle",
8915
8915
  "onClick",
8916
- "theme",
8917
- "defaultVariants"
8916
+ "theme"
8918
8917
  ]), viewProps = nonTamaguiProps;
8919
8918
  !isTaggable && props.forceStyle && (viewProps.forceStyle = props.forceStyle), isHOC && _themeProp && (viewProps.theme = _themeProp), elementType.acceptTagProp && (viewProps.tag = tagProp);
8920
8919
  var animationStyles, shouldUseAnimation = (
@@ -8934,7 +8933,7 @@ var require_createComponent_native = __commonJS({
8934
8933
  staticConfig,
8935
8934
  stateRef
8936
8935
  });
8937
- (isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles);
8936
+ (isAnimated || supportsCSSVars) && animations && (animationStyles = animations.style, viewProps.style = animationStyles, animations.className && (viewProps.className = "".concat(viewProps.className || "", " ").concat(animations.className)));
8938
8937
  }
8939
8938
  groupName && (nonTamaguiProps.onLayout = (0, import_helpers.composeEventHandlers)(nonTamaguiProps.onLayout, function(e) {
8940
8939
  stateRef.current.group.emit(groupName, {
@@ -10681,12 +10680,19 @@ var require_styled_native = __commonJS({
10681
10680
  "defaultVariants",
10682
10681
  "acceptsClassName",
10683
10682
  "context"
10684
- ]);
10685
- if (defaultVariants && (defaultProps = _object_spread2({}, defaultVariants, defaultProps)), parentStaticConfig) {
10683
+ ]), parentDefaultVariants, parentDefaultProps;
10684
+ if (parentStaticConfig) {
10686
10685
  var avoid = parentStaticConfig.isHOC && !parentStaticConfig.isStyledHOC;
10687
- avoid || (defaultProps = _object_spread2({}, parentStaticConfig.defaultProps, defaultProps), parentStaticConfig.variants && (variants = (0, import_mergeVariants.mergeVariants)(parentStaticConfig.variants, variants)));
10686
+ if (!avoid) {
10687
+ var pdp = parentStaticConfig.defaultProps;
10688
+ for (var key2 in pdp) {
10689
+ var val = pdp[key2];
10690
+ parentStaticConfig.defaultVariants && key2 in parentStaticConfig.defaultVariants && (!defaultVariants || !(key2 in defaultVariants)) && (parentDefaultVariants || (parentDefaultVariants = {}), parentDefaultVariants[key2] = val), key2 in defaultProps || (parentDefaultProps || (parentDefaultProps = {}), parentDefaultProps[key2] = pdp[key2]);
10691
+ }
10692
+ parentStaticConfig.variants && (variants = (0, import_mergeVariants.mergeVariants)(parentStaticConfig.variants, variants));
10693
+ }
10688
10694
  }
10689
- parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
10695
+ (parentDefaultProps || defaultVariants || parentDefaultVariants) && (defaultProps = _object_spread2({}, parentDefaultProps, parentDefaultVariants, defaultProps, defaultVariants)), parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
10690
10696
  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 && {
10691
10697
  Component
10692
10698
  }), {
@@ -11991,7 +11997,7 @@ var require_TamaguiProvider_native = __commonJS({
11991
11997
  "@swc/helpers - typeof";
11992
11998
  return obj && typeof Symbol < "u" && obj.constructor === Symbol ? "symbol" : typeof obj;
11993
11999
  }
11994
- var __create2 = Object.create, __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __getProtoOf2 = Object.getPrototypeOf, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
12000
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = function(target, all) {
11995
12001
  for (var name in all) __defProp2(target, name, {
11996
12002
  get: all[name],
11997
12003
  enumerable: !0
@@ -12019,18 +12025,6 @@ var require_TamaguiProvider_native = __commonJS({
12019
12025
  }
12020
12026
  }
12021
12027
  return to;
12022
- }, __toESM2 = function(mod, isNodeMode, target) {
12023
- return target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
12024
- // If the importer is in node compatibility mode or this is not an ESM
12025
- // file that has been converted to a CommonJS file using a Babel-
12026
- // compatible transform (i.e. "__esModule" has not been set), then set
12027
- // "default" to the CommonJS "module.exports" for node compatibility.
12028
- isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", {
12029
- value: mod,
12030
- enumerable: !0
12031
- }) : target,
12032
- mod
12033
- );
12034
12028
  }, __toCommonJS2 = function(mod) {
12035
12029
  return __copyProps2(__defProp2({}, "__esModule", {
12036
12030
  value: !0
@@ -12042,64 +12036,51 @@ var require_TamaguiProvider_native = __commonJS({
12042
12036
  }
12043
12037
  });
12044
12038
  module2.exports = __toCommonJS2(TamaguiProvider_exports);
12045
- 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();
12046
- function _define_property2(obj, key, value) {
12047
- return key in obj ? Object.defineProperty(obj, key, {
12048
- value,
12049
- enumerable: !0,
12050
- configurable: !0,
12051
- writable: !0
12052
- }) : obj[key] = value, obj;
12039
+ 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();
12040
+ function _array_like_to_array(arr, len) {
12041
+ (len == null || len > arr.length) && (len = arr.length);
12042
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
12043
+ return arr2;
12053
12044
  }
12054
- function _object_spread2(target) {
12055
- for (var i = 1; i < arguments.length; i++) {
12056
- var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
12057
- typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
12058
- return Object.getOwnPropertyDescriptor(source, sym).enumerable;
12059
- }))), ownKeys2.forEach(function(key) {
12060
- _define_property2(target, key, source[key]);
12061
- });
12062
- }
12063
- return target;
12045
+ function _array_with_holes(arr) {
12046
+ if (Array.isArray(arr)) return arr;
12064
12047
  }
12065
- function ownKeys(object, enumerableOnly) {
12066
- var keys = Object.keys(object);
12067
- if (Object.getOwnPropertySymbols) {
12068
- var symbols = Object.getOwnPropertySymbols(object);
12069
- enumerableOnly && (symbols = symbols.filter(function(sym) {
12070
- return Object.getOwnPropertyDescriptor(object, sym).enumerable;
12071
- })), keys.push.apply(keys, symbols);
12048
+ function _iterable_to_array_limit(arr, i) {
12049
+ var _i = arr == null ? null : (typeof Symbol > "u" ? "undefined" : _type_of(Symbol)) < "u" && arr[Symbol.iterator] || arr["@@iterator"];
12050
+ if (_i != null) {
12051
+ var _arr = [], _n = !0, _d = !1, _s, _e;
12052
+ try {
12053
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done) && (_arr.push(_s.value), !(i && _arr.length === i)); _n = !0) ;
12054
+ } catch (err) {
12055
+ _d = !0, _e = err;
12056
+ } finally {
12057
+ try {
12058
+ !_n && _i.return != null && _i.return();
12059
+ } finally {
12060
+ if (_d) throw _e;
12061
+ }
12062
+ }
12063
+ return _arr;
12072
12064
  }
12073
- return keys;
12074
12065
  }
12075
- function _object_spread_props(target, source) {
12076
- return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
12077
- Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
12078
- }), target;
12066
+ function _non_iterable_rest() {
12067
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
12079
12068
  }
12080
- function _object_without_properties(source, excluded) {
12081
- if (source == null) return {};
12082
- var target = _object_without_properties_loose(source, excluded), key, i;
12083
- if (Object.getOwnPropertySymbols) {
12084
- var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
12085
- for (i = 0; i < sourceSymbolKeys.length; i++) key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
12086
- }
12087
- return target;
12069
+ function _sliced_to_array(arr, i) {
12070
+ return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
12088
12071
  }
12089
- function _object_without_properties_loose(source, excluded) {
12090
- if (source == null) return {};
12091
- var target = {}, sourceKeys = Object.keys(source), key, i;
12092
- for (i = 0; i < sourceKeys.length; i++) key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
12093
- return target;
12072
+ function _unsupported_iterable_to_array(o, minLen) {
12073
+ if (o) {
12074
+ if (typeof o == "string") return _array_like_to_array(o, minLen);
12075
+ var n = Object.prototype.toString.call(o).slice(8, -1);
12076
+ if (n === "Object" && o.constructor && (n = o.constructor.name), n === "Map" || n === "Set") return Array.from(n);
12077
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
12078
+ }
12094
12079
  }
12095
- function TamaguiProvider(_param) {
12096
- var children = _param.children, disableInjectCSS = _param.disableInjectCSS, config = _param.config, themePropsProvider = _object_without_properties(_param, [
12097
- "children",
12098
- "disableInjectCSS",
12099
- "config"
12100
- ]);
12101
- (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && ((0, import_useDidHydrateOnce.useDidHydrateOnceRoot)(), React.useInsertionEffect(function() {
12102
- if (config && (config.disableSSR || document.documentElement.classList.contains("t_unmounted") && document.documentElement.classList.remove("t_unmounted"), !disableInjectCSS)) {
12080
+ function TamaguiProvider(param) {
12081
+ 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;
12082
+ (0, import_useMedia.setupMediaListeners)(), import_constants.isClient && ((0, import_useDidHydrateOnce.useDidHydrateOnceRoot)(), (0, import_constants.useIsomorphicLayoutEffect)(function() {
12083
+ if (config && !disableInjectCSS) {
12103
12084
  var style = document.createElement("style");
12104
12085
  return style.appendChild(document.createTextNode(config.getCSS())), document.head.appendChild(style), function() {
12105
12086
  document.head.removeChild(style);
@@ -12109,18 +12090,32 @@ var require_TamaguiProvider_native = __commonJS({
12109
12090
  config,
12110
12091
  disableInjectCSS
12111
12092
  ]));
12112
- var _themePropsProvider_defaultTheme;
12113
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
12114
- animationDriver: config == null ? void 0 : config.animations,
12115
- children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeProvider.ThemeProvider, _object_spread_props(_object_spread2({
12116
- themeClassNameOnRoot: config == null ? void 0 : config.themeClassNameOnRoot,
12117
- disableRootThemeClass: config == null ? void 0 : config.disableRootThemeClass
12118
- }, themePropsProvider), {
12119
- defaultTheme: (_themePropsProvider_defaultTheme = themePropsProvider.defaultTheme) !== null && _themePropsProvider_defaultTheme !== void 0 ? _themePropsProvider_defaultTheme : config ? Object.keys(config.themes)[0] : "",
12120
- children
12121
- }))
12093
+ var contents = (0, import_react3.useMemo)(function() {
12094
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ComponentContext.ComponentContext.Provider, {
12095
+ animationDriver: config == null ? void 0 : config.animations,
12096
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ThemeProvider.ThemeProvider, {
12097
+ themeClassNameOnRoot: themeClassNameOnRoot ?? (config == null ? void 0 : config.themeClassNameOnRoot),
12098
+ disableRootThemeClass: disableRootThemeClass ?? (config == null ? void 0 : config.disableRootThemeClass),
12099
+ defaultTheme: defaultTheme ?? (config ? Object.keys(config.themes)[0] : ""),
12100
+ reset,
12101
+ className,
12102
+ children
12103
+ })
12104
+ });
12105
+ }, []);
12106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(UnmountedClassName, {
12107
+ children: contents
12122
12108
  });
12123
12109
  }
12110
+ function UnmountedClassName(props) {
12111
+ var _useState = _sliced_to_array((0, import_react3.useState)(!1), 2), mounted = _useState[0], setMounted = _useState[1];
12112
+ return (0, import_react3.useEffect)(function() {
12113
+ setMounted(!0);
12114
+ }, []), import_constants.isWeb ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", {
12115
+ className: mounted ? "" : "t_unmounted",
12116
+ children: props.children
12117
+ }) : props.children;
12118
+ }
12124
12119
  TamaguiProvider.displayName = "TamaguiProvider";
12125
12120
  }
12126
12121
  });