@tamagui/core 1.130.3 → 1.130.5

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
@@ -6768,10 +6768,7 @@ var require_Theme_native = __commonJS({
6768
6768
  }
6769
6769
  });
6770
6770
  module2.exports = __toCommonJS2(Theme_exports);
6771
- 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 = {
6772
- className: "",
6773
- style: {}
6774
- }, Theme = /* @__PURE__ */ (0, import_react3.forwardRef)(function(props, ref) {
6771
+ 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) {
6775
6772
  if (props.disable) return props.children;
6776
6773
  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) {
6777
6774
  return passThrough ? child : /* @__PURE__ */ (0, import_react3.cloneElement)(child, {
@@ -6819,17 +6816,21 @@ var require_Theme_native = __commonJS({
6819
6816
  forceClassName,
6820
6817
  themeState,
6821
6818
  state,
6822
- ...getThemeClassNameAndStyle(themeState, props, isRoot)
6819
+ themeSpanProps: getThemeClassNameAndColor(themeState, props, isRoot)
6823
6820
  }), forceClassName === !1) return children;
6824
6821
  if (import_constants.isWeb) {
6825
- var { className = "", style } = passThrough ? {} : getThemeClassNameAndStyle(themeState, props, isRoot);
6822
+ var baseStyle = props.contain ? inertContainedStyle : inertStyle, { className = "", color } = passThrough ? {} : getThemeClassNameAndColor(themeState, props, isRoot);
6826
6823
  if (children = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
6827
- className: `${className} _dsp_contents is_Theme`,
6828
- style: passThrough ? void 0 : style,
6824
+ className: `${className} is_Theme`,
6825
+ style: passThrough ? baseStyle : {
6826
+ color,
6827
+ ...baseStyle
6828
+ },
6829
6829
  children
6830
6830
  }), state.hasEverThemed === "wrapped") {
6831
- var className1 = !passThrough && requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} _dsp_contents` : "_dsp_contents";
6831
+ var className1 = !passThrough && requiresExtraWrapper ? `${isInverse ? name.startsWith("light") ? "t_light is_inversed" : name.startsWith("dark") ? "t_dark is_inversed" : "" : ""} ` : "";
6832
6832
  children = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("span", {
6833
+ style: baseStyle,
6833
6834
  className: className1,
6834
6835
  children
6835
6836
  });
@@ -6838,14 +6839,21 @@ var require_Theme_native = __commonJS({
6838
6839
  }
6839
6840
  return children;
6840
6841
  }
6841
- function getThemeClassNameAndStyle(themeState, props) {
6842
+ var inertStyle = {
6843
+ display: "contents"
6844
+ }, inertContainedStyle = {
6845
+ display: "contents",
6846
+ contain: "strict"
6847
+ }, empty = {
6848
+ className: "",
6849
+ color: void 0
6850
+ };
6851
+ function getThemeClassNameAndColor(themeState, props) {
6842
6852
  var isRoot = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : !1;
6843
6853
  if (!themeState.isNew && !props.forceClassName) return empty;
6844
- var themeColor = themeState != null && themeState.theme && themeState.isNew ? (0, import_createVariable.variableToString)(themeState.theme.color) : "", style = themeColor ? {
6845
- color: themeColor
6846
- } : 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}`;
6854
+ 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}`;
6847
6855
  return {
6848
- style,
6856
+ color: themeColor,
6849
6857
  className
6850
6858
  };
6851
6859
  }
@@ -7952,13 +7960,13 @@ If you meant to do this, you can disable this warning - either change untilMeasu
7952
7960
  onPress,
7953
7961
  onLongPress
7954
7962
  });
7955
- process.env.NODE_ENV === "development" && time2 && time2`spaced-as-child`;
7956
- var useChildrenResult;
7957
- import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(elementType, content, viewProps)), process.env.NODE_ENV === "development" && time2 && time2`use-children`, splitStyles || (elementType = "span", content = propsIn.children, viewProps = {
7963
+ process.env.NODE_ENV === "development" && time2 && time2`spaced-as-child`, splitStyles || (content = propsIn.children, elementType = BaseViewComponent, viewProps = {
7958
7964
  style: {
7959
7965
  display: "contents"
7960
7966
  }
7961
- }), useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */ import_react3.default.createElement(elementType, viewProps, content);
7967
+ });
7968
+ var useChildrenResult;
7969
+ import_setupHooks.hooks.useChildren && (useChildrenResult = import_setupHooks.hooks.useChildren(elementType, content, viewProps)), process.env.NODE_ENV === "development" && time2 && time2`use-children`, useChildrenResult ? content = useChildrenResult : content = /* @__PURE__ */ import_react3.default.createElement(elementType, viewProps, content);
7962
7970
  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
7963
7971
  (!asChild && // not when passThrough
7964
7972
  splitStyles && // not when HOC
@@ -12295,7 +12303,6 @@ var require_index_native12 = __commonJS({
12295
12303
  return cb();
12296
12304
  }), queuedUpdates.clear()));
12297
12305
  }
12298
- var expectedFrameTime = 16.67, numDroppedFramesUntilPause = 10;
12299
12306
  function startGlobalIntersectionObserver() {
12300
12307
  !import_constants.isClient || globalIntersectionObserver || (globalIntersectionObserver = new IntersectionObserver(function(entries) {
12301
12308
  entries.forEach(function(entry) {
@@ -12308,20 +12315,18 @@ var require_index_native12 = __commonJS({
12308
12315
  }
12309
12316
  if (import_constants.isClient) if (rAF) {
12310
12317
  layoutOnAnimationFrame = function() {
12311
- var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
12312
- if (lastFrameAt = now, frameCount++, frameCount % RUN_EVERY_X_FRAMES === 0) {
12313
- frameCount = 0, rAF(layoutOnAnimationFrame);
12314
- return;
12315
- }
12316
12318
  if (strategy !== "off") {
12317
- var hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
12318
- hasRecentSyncWork || Nodes.forEach(function(node) {
12319
- updateLayoutIfChanged(node, lastFrameAt);
12319
+ if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12320
+ rAF(layoutOnAnimationFrame);
12321
+ return;
12322
+ }
12323
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
12324
+ updateLayoutIfChanged(node);
12320
12325
  });
12321
12326
  }
12322
12327
  rAF(layoutOnAnimationFrame);
12323
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body, lastFrameAt = Date.now();
12324
- async function updateLayoutIfChanged(node, frameId) {
12328
+ }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
12329
+ async function updateLayoutIfChanged(node) {
12325
12330
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
12326
12331
  var onLayout = LayoutHandlers.get(node);
12327
12332
  if (typeof onLayout == "function") {
@@ -12333,7 +12338,7 @@ var require_index_native12 = __commonJS({
12333
12338
  getBoundingClientRectAsync(node),
12334
12339
  getBoundingClientRectAsync(parentNode)
12335
12340
  ]);
12336
- if (nr === !1 || pr === !1 || frameId !== lastFrameAt) return;
12341
+ if (nr === !1 || pr === !1) return;
12337
12342
  nodeRect = nr, parentRect = pr;
12338
12343
  } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode.getBoundingClientRect();
12339
12344
  var cachedRect = NodeRectCache.get(node), cachedParentRect = NodeRectCache.get(parentNode);
@@ -12351,9 +12356,9 @@ var require_index_native12 = __commonJS({
12351
12356
  }
12352
12357
  }
12353
12358
  }
12354
- rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 4;
12359
+ rAF(layoutOnAnimationFrame), frameCount = 0, RUN_EVERY_X_FRAMES = 8;
12355
12360
  } else process.env.NODE_ENV === "development" && console.warn("No requestAnimationFrame - please polyfill for onLayout to work correctly");
12356
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, lastFrameAt, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
12361
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
12357
12362
  return {
12358
12363
  nativeEvent: {
12359
12364
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -12418,7 +12423,7 @@ var require_index_native12 = __commonJS({
12418
12423
  if (onLayout) {
12419
12424
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
12420
12425
  if (node2) {
12421
- LayoutHandlers.set(node2, onLayout), Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
12426
+ Nodes.add(node2), startGlobalIntersectionObserver(), globalIntersectionObserver && (globalIntersectionObserver.observe(node2), IntersectionState.set(node2, !0));
12422
12427
  var parentNode = node2.parentNode;
12423
12428
  return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
12424
12429
  Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2), IntersectionState.delete(node2), globalIntersectionObserver && globalIntersectionObserver.unobserve(node2);