@tamagui/core 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
@@ -2477,6 +2477,9 @@ var require_insertStyleRule_native = __commonJS({
2477
2477
  scanAllSheets: function() {
2478
2478
  return scanAllSheets;
2479
2479
  },
2480
+ setNonce: function() {
2481
+ return setNonce2;
2482
+ },
2480
2483
  shouldInsertStyleRules: function() {
2481
2484
  return shouldInsertStyleRules;
2482
2485
  },
@@ -2753,12 +2756,20 @@ var require_insertStyleRule_native = __commonJS({
2753
2756
  var getIdentifierFromTamaguiSelector = function(selector) {
2754
2757
  var dotIndex = selector.indexOf(":");
2755
2758
  return dotIndex > -1 ? selector.slice(7, dotIndex) : selector.slice(7);
2756
- }, sheet = import_constants.isClient && document.head ? document.head.appendChild(document.createElement("style")).sheet : null;
2759
+ }, sheet = null;
2757
2760
  function updateRules(identifier, rules) {
2758
2761
  if (!process.env.TAMAGUI_REACT_19) return identifier in allRules ? !1 : (allRules[identifier] = rules.join(" "), identifier.startsWith("_transform-") ? addTransform(identifier, rules[0]) : !0);
2759
2762
  }
2763
+ var nonce = "";
2764
+ function setNonce2(_) {
2765
+ nonce = _;
2766
+ }
2760
2767
  function insertStyleRules(rulesToInsert) {
2761
2768
  if (!process.env.TAMAGUI_REACT_19) {
2769
+ if (!sheet && import_constants.isClient && document.head) {
2770
+ var styleTag = document.createElement("style");
2771
+ nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
2772
+ }
2762
2773
  if (!sheet) return;
2763
2774
  for (var key in rulesToInsert) {
2764
2775
  var styleObject = rulesToInsert[key], identifier = styleObject[import_helpers.StyleObjectIdentifier];
@@ -5327,18 +5338,22 @@ var require_createMediaStyle_native = __commonJS({
5327
5338
  }
5328
5339
  var MEDIA_SEP = "_", prefixes = null, selectors = null, groupPseudoToPseudoCSSMap = {
5329
5340
  press: "active"
5330
- }, createMediaStyle = function(styleObject, mediaKeyIn, mediaQueries, type, negate, priority) {
5331
- 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) {
5341
+ }, specifities = new Array(5).fill(0).map(function(_, i) {
5342
+ return new Array(i).fill(":root").join("");
5343
+ }), createMediaStyle = function(styleObject, mediaKeyIn, mediaQueries, type, negate, priority) {
5344
+ 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) {
5332
5345
  return rule.replace(identifier, nextIdentifier);
5333
- }).join(";");
5346
+ }).join(";"), isHover = !1;
5334
5347
  if (isNonWindowMedia) {
5335
- var precedenceImportancePrefix = new Array((priority || 0) + (isGroup ? 1 : 0)).fill(":root").join("");
5348
+ var specificity = (priority || 0) + (isGroup ? 1 : 0);
5336
5349
  if (isTheme || isGroup) {
5337
- var groupInfo = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), mediaName = groupInfo == null ? void 0 : groupInfo.name;
5338
- groupMediaKey = groupInfo == null ? void 0 : groupInfo.media, isGroup && (containerName = mediaName);
5339
- 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", ""));
5350
+ var _getGroupPropParts = (0, import_getGroupPropParts.getGroupPropParts)(mediaKeyIn), name = _getGroupPropParts.name, media = _getGroupPropParts.media, pseudo = _getGroupPropParts.pseudo;
5351
+ groupMediaKey = media, isGroup && (containerName = name);
5352
+ 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;
5353
+ pseudo === "press" && (specificity += 2), pseudo === "hover" && (isHover = !0);
5354
+ 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", ""));
5340
5355
  styleRule = styleInner.replace(selector, nextSelector);
5341
- } else styleRule = "".concat(precedenceImportancePrefix).concat(styleInner);
5356
+ } else styleRule = "".concat(specifities[specificity]).concat(styleInner);
5342
5357
  }
5343
5358
  if (!isNonWindowMedia || groupMediaKey) {
5344
5359
  if (!selectors) {
@@ -5355,16 +5370,16 @@ var require_createMediaStyle_native = __commonJS({
5355
5370
  ];
5356
5371
  })));
5357
5372
  }
5358
- var mediaKey = groupMediaKey || mediaKeyIn, mediaSelector1 = selectors[mediaKey], screenStr = negate ? "not all and " : "", mediaQuery = "".concat(screenStr).concat(mediaSelector1), precedenceImportancePrefix1 = groupMediaKey ? "" : enableMediaPropOrder ? (
5373
+ var mediaKey = groupMediaKey || mediaKeyIn, mediaSelector1 = selectors[mediaKey], screenStr = negate ? "not all and " : "", mediaQuery = "".concat(screenStr).concat(mediaSelector1), precedenceImportancePrefix = groupMediaKey ? groupPriority : enableMediaPropOrder && priority ? (
5359
5374
  // this new array should be cached
5360
- new Array(priority).fill(":root").join("")
5375
+ specifities[priority]
5361
5376
  ) : (
5362
5377
  // @ts-ignore
5363
5378
  prefixes[mediaKey]
5364
5379
  ), prefix = groupMediaKey ? "@container ".concat(containerName) : "@media";
5365
- 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, "}"));
5380
+ 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, "}"));
5366
5381
  }
5367
- return [
5382
+ return isHover && (styleRule = "@media (hover:hover){".concat(styleRule, "}")), [
5368
5383
  property,
5369
5384
  void 0,
5370
5385
  nextIdentifier,
@@ -8601,7 +8616,7 @@ var require_Theme_native = __commonJS({
8601
8616
  }
8602
8617
  });
8603
8618
  module2.exports = __toCommonJS2(Theme_exports);
8604
- var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require_index_native3(), import_react3 = __toESM2(require("react")), import_createVariable = require_createVariable_native(), import_ThemeManagerContext = require_ThemeManagerContext_native(), import_useTheme = require_useTheme_native(), import_ThemeDebug = require_ThemeDebug_native();
8619
+ var import_jsx_runtime = require("react/jsx-runtime"), import_constants = require_index_native3(), import_react3 = __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();
8605
8620
  function _define_property2(obj, key, value) {
8606
8621
  return key in obj ? Object.defineProperty(obj, key, {
8607
8622
  value,
@@ -8654,8 +8669,9 @@ var require_Theme_native = __commonJS({
8654
8669
  function getThemedChildren(themeState, children, props) {
8655
8670
  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;
8656
8671
  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");
8657
- var shallow = props.shallow, forceClassName = props.forceClassName, shouldRenderChildrenWithTheme = isNewTheme || "inverse" in props || "name" in props || stateRef.current.hasEverThemed || isRoot;
8672
+ var shallow = props.shallow, forceClassName = props.forceClassName, shouldRenderChildrenWithTheme = isNewTheme || isRoot || stateRef.current.hasEverThemed || typeof props.inverse == "boolean";
8658
8673
  if (shouldRenderChildrenWithTheme && (stateRef.current.hasEverThemed = !0), !shouldRenderChildrenWithTheme) return children;
8674
+ 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);
8659
8675
  var next = children;
8660
8676
  shallow && (next = import_react3.Children.toArray(children).map(function(child) {
8661
8677
  return /* @__PURE__ */ (0, import_react3.isValidElement)(child) ? /* @__PURE__ */ (0, import_react3.cloneElement)(child, void 0, /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Theme, {
@@ -9533,7 +9549,11 @@ var require_createComponent_native = __commonJS({
9533
9549
  var shouldAvoidClasses = !import_constants.isWeb;
9534
9550
  if (import_constants.isWeb) {
9535
9551
  var disableClassName = props.disableClassName, isAnimatedAndHydrated = isAnimated && !supportsCSSVars && didHydrateOnce && !import_constants.isServer, isClassNameDisabled = !staticConfig.acceptsClassName && (config.disableSSR || didHydrateOnce), isDisabledManually = disableClassName && !import_constants.isServer && didHydrateOnce && state.unmounted === !0;
9536
- (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0);
9552
+ (isAnimatedAndHydrated || isDisabledManually || isClassNameDisabled) && (shouldAvoidClasses = !0, process.env.NODE_ENV === "development" && props.debug && (0, import_log.log)("avoiding className", {
9553
+ isAnimatedAndHydrated,
9554
+ isDisabledManually,
9555
+ isClassNameDisabled
9556
+ }));
9537
9557
  }
9538
9558
  var groupName = props.group;
9539
9559
  if (groupName && !curStateRef.group) {
@@ -11567,7 +11587,7 @@ var require_styled_native = __commonJS({
11567
11587
  }
11568
11588
  }
11569
11589
  (parentDefaultProps || defaultVariants || parentDefaultVariants) && (defaultProps = _object_spread2({}, parentDefaultProps, parentDefaultVariants, defaultProps, defaultVariants)), parentStaticConfig != null && parentStaticConfig.isHOC && name && (defaultProps.componentName = name);
11570
- 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 && {
11590
+ 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_props(_object_spread2(_object_spread_props(_object_spread2({}, parentStaticConfig, staticExtractionOptions, !isPlainStyledComponent && {
11571
11591
  Component
11572
11592
  }), {
11573
11593
  // @ts-expect-error
@@ -13309,6 +13329,9 @@ var require_index_native9 = __commonJS({
13309
13329
  mediaState: function() {
13310
13330
  return import_useMedia.mediaState;
13311
13331
  },
13332
+ setNonce: function() {
13333
+ return import_insertStyleRule.setNonce;
13334
+ },
13312
13335
  setupDev: function() {
13313
13336
  return import_config.setupDev;
13314
13337
  },
@@ -13333,7 +13356,7 @@ var require_index_native9 = __commonJS({
13333
13356
  __reExport2(src_exports2, require_styled_native(), module2.exports);
13334
13357
  __reExport2(src_exports2, require_setupReactNative_native(), module2.exports);
13335
13358
  __reExport2(src_exports2, require_GetRef_native(), module2.exports);
13336
- var import_config = require_config_native();
13359
+ var import_config = require_config_native(), import_insertStyleRule = require_insertStyleRule_native();
13337
13360
  __reExport2(src_exports2, require_constants_native2(), module2.exports);
13338
13361
  __reExport2(src_exports2, require_ComponentContext_native(), module2.exports);
13339
13362
  __reExport2(src_exports2, require_withStableStyle_native(), module2.exports);