@tamagui/core 1.130.2 → 1.130.4

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.
@@ -6362,10 +6362,7 @@ var require_Theme_native = __commonJS({
6362
6362
  }
6363
6363
  });
6364
6364
  module2.exports = __toCommonJS2(Theme_exports);
6365
- var import_jsx_runtime2 = require("react/jsx-runtime"), import_constants = require_index_native2(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_useTheme = require_useTheme_native(), import_useThemeState = require_useThemeState_native(), import_ThemeDebug = require_ThemeDebug_native(), empty = {
6366
- className: "",
6367
- style: {}
6368
- }, Theme = /* @__PURE__ */ (0, import_react3.forwardRef)(function(props, ref) {
6365
+ var import_jsx_runtime2 = require("react/jsx-runtime"), import_constants = require_index_native2(), import_react3 = __toESM2(require("react")), import_config = require_config_native(), import_createVariable = require_createVariable_native(), import_useTheme = require_useTheme_native(), import_useThemeState = require_useThemeState_native(), import_ThemeDebug = require_ThemeDebug_native(), Theme = /* @__PURE__ */ (0, import_react3.forwardRef)(function(props, ref) {
6369
6366
  if (props.disable) return props.children;
6370
6367
  var { passThrough } = props, isRoot = !!props._isRoot, [_, themeState] = (0, import_useTheme.useThemeWithState)(props, isRoot), disableDirectChildTheme = props["disable-child-theme"], finalChildren = disableDirectChildTheme ? import_react3.Children.map(props.children, function(child) {
6371
6368
  return passThrough ? child : /* @__PURE__ */ (0, import_react3.cloneElement)(child, {
@@ -6406,14 +6403,18 @@ var require_Theme_native = __commonJS({
6406
6403
  }
6407
6404
  if (forceClassName === !1) return children;
6408
6405
  if (import_constants.isWeb) {
6409
- var { className = "", style } = passThrough ? {} : getThemeClassNameAndStyle(themeState, props, isRoot);
6406
+ var baseStyle = props.contain ? inertContainedStyle : inertStyle, { className = "", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);
6410
6407
  if (children = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
6411
- className: `${className} _dsp_contents is_Theme`,
6412
- style: passThrough ? void 0 : style,
6408
+ className: `${className} is_Theme`,
6409
+ style: passThrough ? baseStyle : {
6410
+ color,
6411
+ ...baseStyle
6412
+ },
6413
6413
  children
6414
6414
  }), state.hasEverThemed === "wrapped") {
6415
- var className1 = !passThrough && requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
6415
+ var className1 = !passThrough && requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} ` : "";
6416
6416
  children = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
6417
+ style: baseStyle,
6417
6418
  className: className1,
6418
6419
  children
6419
6420
  });
@@ -6422,14 +6423,21 @@ var require_Theme_native = __commonJS({
6422
6423
  }
6423
6424
  return children;
6424
6425
  }
6425
- function getThemeClassNameAndStyle(themeState, props) {
6426
+ var inertStyle = {
6427
+ display: "contents"
6428
+ }, inertContainedStyle = {
6429
+ display: "contents",
6430
+ contain: "strict"
6431
+ }, empty = {
6432
+ className: "",
6433
+ color: void 0
6434
+ };
6435
+ function getThemeClassNameAndColor(themeState, props) {
6426
6436
  var isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
6427
6437
  if (!themeState.isNew && !props.forceClassName) return empty;
6428
- var themeColor = themeState != null && themeState.theme && themeState.isNew ? (0, import_createVariable.variableToString)(themeState.theme.color) : "", style = themeColor ? {
6429
- color: themeColor
6430
- } : void 0, maxInverses = (0, import_config.getSetting)("maxDarkLightNesting") || 3, themeClassName = themeState.inverses >= maxInverses ? themeState.name : themeState.name.replace(schemePrefix, ""), className = `${isRoot ? "" : "t_sub_theme"} t_${themeClassName}`;
6438
+ var themeColor = themeState != null && themeState.theme && themeState.isNew ? (0, import_createVariable.variableToString)(themeState.theme.color) : "", maxInverses = (0, import_config.getSetting)("maxDarkLightNesting") || 3, themeClassName = themeState.inverses >= maxInverses ? themeState.name : themeState.name.replace(schemePrefix, ""), className = `${isRoot ? "" : "t_sub_theme"} t_${themeClassName}`;
6431
6439
  return {
6432
- style,
6440
+ color: themeColor,
6433
6441
  className
6434
6442
  };
6435
6443
  }
@@ -7429,12 +7437,13 @@ var require_createComponent_native = __commonJS({
7429
7437
  onPress,
7430
7438
  onLongPress
7431
7439
  });
7432
- var useChildrenResult;
7433
- import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(elementType, content, viewProps)), splitStyles || (elementType = "span", content = propsIn.children, viewProps = {
7440
+ splitStyles || (content = propsIn.children, elementType = BaseViewComponent, viewProps = {
7434
7441
  style: {
7435
7442
  display: "contents"
7436
7443
  }
7437
- }), useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */ import_react3.default.createElement(elementType, viewProps, content);
7444
+ });
7445
+ var useChildrenResult;
7446
+ import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(elementType, content, viewProps)), useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */ import_react3.default.createElement(elementType, viewProps, content);
7438
7447
  var ResetPresence = config == null || (_config_animations = config.animations) === null || _config_animations === void 0 ? void 0 : _config_animations.ResetPresence, needsReset = !!// not when passing down to child
7439
7448
  (!asChild && // not when passThrough
7440
7449
  splitStyles && // not when HOC
@@ -11723,7 +11732,6 @@ var require_index_native12 = __commonJS({
11723
11732
  return cb();
11724
11733
  }), queuedUpdates.clear()));
11725
11734
  }
11726
- var expectedFrameTime = 16.67, numDroppedFramesUntilPause = 10;
11727
11735
  function startGlobalIntersectionObserver() {
11728
11736
  !import_constants.isClient || globalIntersectionObserver || (globalIntersectionObserver = new IntersectionObserver(function(entries) {
11729
11737
  entries.forEach(function(entry) {
@@ -11736,21 +11744,19 @@ var require_index_native12 = __commonJS({
11736
11744
  }
11737
11745
  if (import_constants.isClient && rAF) {
11738
11746
  layoutOnAnimationFrame = function() {
11739
- var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
11740
- if (lastFrameAt = now, frameCount++, frameCount % RUN_EVERY_X_FRAMES === 0) {
11741
- frameCount = 0, rAF(layoutOnAnimationFrame);
11742
- return;
11743
- }
11744
11747
  if (strategy !== "off") {
11745
- var hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
11746
- hasRecentSyncWork || Nodes.forEach(function(node) {
11747
- updateLayoutIfChanged(node, lastFrameAt);
11748
+ if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
11749
+ rAF(layoutOnAnimationFrame);
11750
+ return;
11751
+ }
11752
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
11753
+ updateLayoutIfChanged(node);
11748
11754
  });
11749
11755
  }
11750
11756
  rAF(layoutOnAnimationFrame);
11751
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
11752
- async function updateLayoutIfChanged(node, frameId) {
11753
- if (!(supportsCheckVisibility && !node.checkVisibility()) && IntersectionState.get(node) !== !1) {
11757
+ }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
11758
+ async function updateLayoutIfChanged(node) {
11759
+ if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
11754
11760
  var onLayout = LayoutHandlers.get(node);
11755
11761
  if (typeof onLayout == "function") {
11756
11762
  var parentNode = node.parentElement;
@@ -11761,7 +11767,7 @@ var require_index_native12 = __commonJS({
11761
11767
  getBoundingClientRectAsync(node),
11762
11768
  getBoundingClientRectAsync(parentNode)
11763
11769
  ]);
11764
- if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
11770
+ if (nr === !1 || pr === !1) return;
11765
11771
  nodeRect = nr, parentRect = pr;
11766
11772
  } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
11767
11773
  var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
@@ -11779,9 +11785,9 @@ var require_index_native12 = __commonJS({
11779
11785
  }
11780
11786
  }
11781
11787
  }
11782
- rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 4;
11788
+ rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 8;
11783
11789
  }
11784
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, lastFrameAt, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
11790
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
11785
11791
  return {
11786
11792
  nativeEvent: {
11787
11793
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -11846,7 +11852,7 @@ var require_index_native12 = __commonJS({
11846
11852
  if (onLayout) {
11847
11853
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
11848
11854
  if (node2) {
11849
- LayoutHandlers.set(node2, onLayout), Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
11855
+ Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
11850
11856
  var parentNode = node2.parentNode;
11851
11857
  return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
11852
11858
  Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2), IntersectionState.delete(node2), globalIntersectionObserver && globalIntersectionObserver.unobserve(node2);