tamagui 1.105.5 → 1.105.7

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
@@ -2583,6 +2583,9 @@ var require_insertStyleRule_native = __commonJS({
2583
2583
  scanAllSheets: function() {
2584
2584
  return scanAllSheets;
2585
2585
  },
2586
+ setNonce: function() {
2587
+ return setNonce2;
2588
+ },
2586
2589
  shouldInsertStyleRules: function() {
2587
2590
  return shouldInsertStyleRules;
2588
2591
  },
@@ -2859,12 +2862,20 @@ var require_insertStyleRule_native = __commonJS({
2859
2862
  var getIdentifierFromTamaguiSelector = function(selector) {
2860
2863
  var dotIndex = selector.indexOf(":");
2861
2864
  return dotIndex > -1 ? selector.slice(7, dotIndex) : selector.slice(7);
2862
- }, sheet = import_constants4.isClient && document.head ? document.head.appendChild(document.createElement("style")).sheet : null;
2865
+ }, sheet = null;
2863
2866
  function updateRules(identifier, rules) {
2864
2867
  if (!process.env.TAMAGUI_REACT_19) return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0);
2865
2868
  }
2869
+ var nonce = "";
2870
+ function setNonce2(_) {
2871
+ nonce = _;
2872
+ }
2866
2873
  function insertStyleRules(rulesToInsert) {
2867
2874
  if (!process.env.TAMAGUI_REACT_19) {
2875
+ if (!sheet && import_constants4.isClient && document.head) {
2876
+ var styleTag = document.createElement("style");
2877
+ nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
2878
+ }
2868
2879
  if (!sheet) return;
2869
2880
  for (var key in rulesToInsert) {
2870
2881
  var styleObject = rulesToInsert[key], identifier = styleObject[import_helpers.StyleObjectIdentifier];
@@ -5433,18 +5444,22 @@ var require_createMediaStyle_native = __commonJS({
5433
5444
  }
5434
5445
  var MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
5435
5446
  press: "active"
5436
- }, createMediaStyle = function(styleObject, mediaKeyIn, mediaQueries, type, negate, priority) {
5437
- var _styleObject = _sliced_to_array(styleObject, 5), property = _styleObject[0], _value = _styleObject[1], identifier = _styleObject[2], _pseudo = _styleObject[3], rules = _styleObject[4], conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.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 = "".concat(ogPrefix).concat(MEDIA_SEP).concat(mediaKeyIn.replace("-", "")).concat(negKey).concat(MEDIA_SEP), styleRule = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map(function(rule) {
5447
+ }, specifities = new Array(5).fill(0).map(function(_, i) {
5448
+ return new Array(i).fill(":root").join("");
5449
+ }), createMediaStyle = function(styleObject, mediaKeyIn, mediaQueries, type, negate, priority) {
5450
+ var _styleObject = _sliced_to_array(styleObject, 5), property = _styleObject[0], _value = _styleObject[1], identifier = _styleObject[2], _pseudo = _styleObject[3], rules = _styleObject[4], conf = (0, import_config.getConfig)(), enableMediaPropOrder = conf.settings.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 = "".concat(ogPrefix).concat(MEDIA_SEP).concat(mediaKeyIn.replace("-", "")).concat(negKey).concat(MEDIA_SEP), styleRule = "", groupPriority = "", groupMediaKey, containerName, nextIdentifier = identifier.replace(ogPrefix, id), styleInner = rules.map(function(rule) {
5438
5451
  return rule.replace(identifier, nextIdentifier);
5439
- }).join(";");
5452
+ }).join(";"), isHover = !1;
5440
5453
  if (isNonWindowMedia) {
5441
- var precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
5454
+ var specificity = (priority || 0) + (isGroup ? 1 : 0);
5442
5455
  if (isTheme || isGroup) {
5443
- var groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
5444
- groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
5445
- var name = (isGroup ? "group_" : "") + mediaName, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = (0, import_config.getSetting)("themeClassNameOnRoot") && isTheme ? "" : " ", pseudoSelectorName = groupInfo.pseudo ? groupPseudoToPseudoCSSMap[groupInfo.pseudo] || groupInfo.pseudo : void 0, pseudoSelector = pseudoSelectorName ? ":".concat(pseudoSelectorName) : "", presedencePrefix = ":root".concat(precedenceImportancePrefix).concat(precedenceSpace), mediaSelector = ".t_".concat(name).concat(pseudoSelector), nextSelector = "".concat(presedencePrefix).concat(mediaSelector, " ").concat(selector.replace(":root", ""));
5456
+ var _getGroupPropParts = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), name = _getGroupPropParts.name, media = _getGroupPropParts.media, pseudo = _getGroupPropParts.pseudo;
5457
+ groupMediaKey = media, isGroup && (containerName = name);
5458
+ var groupClassName = (isGroup ? "group_" : "") + name, selectorStart = styleInner.indexOf(":root"), selectorEnd = styleInner.lastIndexOf("{"), selector = styleInner.slice(selectorStart, selectorEnd), precedenceSpace = (0, import_config.getSetting)("themeClassNameOnRoot") && isTheme ? "" : " ", pseudoSelectorName = pseudo ? groupPseudoToPseudoCSSMap[pseudo] || pseudo : void 0;
5459
+ pseudo === "press" && (specificity += 2), pseudo === "hover" && (isHover = !0);
5460
+ var pseudoSelector = pseudoSelectorName ? ":".concat(pseudoSelectorName) : "", presedencePrefix = ":root".concat(specifities[specificity]).concat(precedenceSpace), mediaSelector = ".t_".concat(groupClassName).concat(pseudoSelector), nextSelector = "".concat(presedencePrefix).concat(mediaSelector, " ").concat(selector.replace(":root", ""));
5446
5461
  styleRule = styleInner.replace(selector, nextSelector);
5447
- } else styleRule = "".concat(precedenceImportancePrefix).concat(styleInner);
5462
+ } else styleRule = "".concat(specifities[specificity]).concat(styleInner);
5448
5463
  }
5449
5464
  if (!isNonWindowMedia || groupMediaKey) {
5450
5465
  if (!selectors) {
@@ -5461,16 +5476,16 @@ var require_createMediaStyle_native = __commonJS({
5461
5476
  ];
5462
5477
  })));
5463
5478
  }
5464
- var mediaKey = groupMediaKey || mediaKeyIn, mediaSelector1 = selectors[mediaKey], screenStr = negate ? "not all and " : "", mediaQuery = "".concat(screenStr).concat(mediaSelector1), precedenceImportancePrefix1 = groupMediaKey ? "" : enableMediaPropOrder ? (
5479
+ var mediaKey = groupMediaKey || mediaKeyIn, mediaSelector1 = selectors[mediaKey], screenStr = negate ? "not all and " : "", mediaQuery = "".concat(screenStr).concat(mediaSelector1), precedenceImportancePrefix = groupMediaKey ? groupPriority : enableMediaPropOrder && priority ? (
5465
5480
  // this new array should be cached
5466
- new Array(priority).fill(":root").join("")
5481
+ specifities[priority]
5467
5482
  ) : (
5468
5483
  // @ts-ignore
5469
5484
  prefixes[mediaKey]
5470
5485
  ), prefix = groupMediaKey ? "@container ".concat(containerName) : "@media";
5471
- groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", " and ".concat(mediaQuery, " {")).replace("and screen and", "and") : styleRule = "".concat(prefix, " ").concat(mediaQuery, "{").concat(precedenceImportancePrefix1).concat(styleInner, "}"), groupMediaKey && (styleRule = "@supports (contain: ".concat(conf.settings.webContainerType || "inline-size", ") {").concat(styleRule, "}"));
5486
+ groupMediaKey && (styleInner = styleRule), styleInner.includes(prefix) ? styleRule = styleInner.replace("{", " and ".concat(mediaQuery, " {")).replace("and screen and", "and") : styleRule = "".concat(prefix, " ").concat(mediaQuery, "{").concat(precedenceImportancePrefix).concat(styleInner, "}"), groupMediaKey && (styleRule = "@supports (contain: ".concat(conf.settings.webContainerType || "inline-size", ") {").concat(styleRule, "}"));
5472
5487
  }
5473
- return [
5488
+ return isHover && (styleRule = "@media (hover:hover){".concat(styleRule, "}")), [
5474
5489
  property,
5475
5490
  void 0,
5476
5491
  nextIdentifier,
@@ -8707,7 +8722,7 @@ var require_Theme_native = __commonJS({
8707
8722
  }
8708
8723
  });
8709
8724
  module2.exports = __toCommonJS2(Theme_exports);
8710
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_react4 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native();
8725
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_react4 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native(), import_log = require_log_native();
8711
8726
  function _define_property9(obj, key, value) {
8712
8727
  return key in obj ? Object.defineProperty(obj, key, {
8713
8728
  value,
@@ -8760,8 +8775,9 @@ var require_Theme_native = __commonJS({
8760
8775
  function getThemedChildren(themeState, children, props) {
8761
8776
  var isRoot = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : !1, stateRef = arguments.length > 4 ? arguments[4] : void 0, themeManager = themeState.themeManager, isNewTheme = themeState.isNewTheme;
8762
8777
  if (!themeManager) throw new Error(process.env.NODE_ENV === "development" ? "\u274C No theme found, either incorrect name, potential duplicate tamagui deps, or TamaguiProvider not providing themes." : "\u274C 005");
8763
- var shallow = props.shallow, forceClassName = props.forceClassName, shouldRenderChildrenWithTheme = isNewTheme || "inverse" in props || "name" in props || stateRef.current.hasEverThemed || isRoot;
8778
+ var shallow = props.shallow, forceClassName = props.forceClassName, shouldRenderChildrenWithTheme = isNewTheme || isRoot || stateRef.current.hasEverThemed || typeof props.inverse == "boolean";
8764
8779
  if (shouldRenderChildrenWithTheme && (stateRef.current.hasEverThemed = !0), !shouldRenderChildrenWithTheme) return children;
8780
+ process.env.NODE_ENV === "development" && shouldRenderChildrenWithTheme && props.debug && (0, import_log.log)("adding theme: isRoot ".concat(isRoot, ", inverse ").concat("inverse" in props, ", isNewTheme ").concat(isNewTheme, ", hasEver ").concat(stateRef.current.hasEverThemed), props);
8765
8781
  var next = children;
8766
8782
  shallow && (next = import_react4.Children.toArray(children).map(function(child) {
8767
8783
  return /* @__PURE__ */ (0, import_react4.isValidElement)(child) ? /* @__PURE__ */ (0, import_react4.cloneElement)(child, void 0, /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(Theme2, {
@@ -9639,7 +9655,11 @@ var require_createComponent_native = __commonJS({
9639
9655
  var shouldAvoidClasses = !import_constants4.isWeb;
9640
9656
  if (import_constants4.isWeb) {
9641
9657
  var disableClassName = props.disableClassName, isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !import_constants4.isServer, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce), isDisabledManually = disableClassName && !import_constants4.isServer && didHydrateOnce && state.unmounted === !0;
9642
- (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0);
9658
+ (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0, process.env.NODE_ENV === "development" && props.debug && (0, import_log.log)("avoiding className", {
9659
+ isAnimatedAndHydrated,
9660
+ isDisabledManually,
9661
+ isClassNameDisabled
9662
+ }));
9643
9663
  }
9644
9664
  var groupName = props.group;
9645
9665
  if (groupName && !curStateRef.group) {
@@ -11673,7 +11693,7 @@ var require_styled_native = __commonJS({
11673
11693
  }
11674
11694
  }
11675
11695
  (parentDefaultProps || defaultVariants || parentDefaultVariants) && (defaultProps = _object_spread9({}, parentDefaultProps, parentDefaultVariants, defaultProps, defaultVariants)), parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
11676
- 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_props8(_object_spread9(_object_spread_props8(_object_spread9({}, parentStaticConfig, staticExtractionOptions, !isPlainStyledComponent && {
11696
+ var isText = !!(staticExtractionOptions != null && staticExtractionOptions.isText || parentStaticConfig != null && parentStaticConfig.isText), _staticExtractionOptions_acceptsClassName, _ref, acceptsClassName = (_ref = (_staticExtractionOptions_acceptsClassName = staticExtractionOptions == null ? void 0 : staticExtractionOptions.acceptsClassName) !== null && _staticExtractionOptions_acceptsClassName !== void 0 ? _staticExtractionOptions_acceptsClassName : acceptsClassNameProp) !== null && _ref !== void 0 ? _ref : isPlainStyledComponent || isReactNative || (parentStaticConfig == null ? void 0 : parentStaticConfig.isHOC) && (parentStaticConfig == null ? void 0 : parentStaticConfig.acceptsClassName), conf = _object_spread_props8(_object_spread9(_object_spread_props8(_object_spread9({}, parentStaticConfig, staticExtractionOptions, !isPlainStyledComponent && {
11677
11697
  Component
11678
11698
  }), {
11679
11699
  // @ts-expect-error
@@ -13251,6 +13271,9 @@ var require_index_native13 = __commonJS({
13251
13271
  mediaState: function() {
13252
13272
  return import_useMedia.mediaState;
13253
13273
  },
13274
+ setNonce: function() {
13275
+ return import_insertStyleRule.setNonce;
13276
+ },
13254
13277
  setupDev: function() {
13255
13278
  return import_config.setupDev;
13256
13279
  },
@@ -13275,7 +13298,7 @@ var require_index_native13 = __commonJS({
13275
13298
  __reExport2(src_exports2, require_styled_native(), module2.exports);
13276
13299
  __reExport2(src_exports2, require_setupReactNative_native(), module2.exports);
13277
13300
  __reExport2(src_exports2, require_GetRef_native(), module2.exports);
13278
- var import_config = require_config_native();
13301
+ var import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native();
13279
13302
  __reExport2(src_exports2, require_constants_native2(), module2.exports);
13280
13303
  __reExport2(src_exports2, require_ComponentContext_native(), module2.exports);
13281
13304
  __reExport2(src_exports2, require_withStableStyle_native(), module2.exports);