tamagui 1.86.4 → 1.86.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
@@ -4981,7 +4981,7 @@ If you meant to do this, you can disable this warning - either change untilMeasu
4981
4981
  staticConfig
4982
4982
  )), useChildrenResult ? content = useChildrenResult : content = (0, import_react2.createElement)(elementType, viewProps, content);
4983
4983
  let ResetPresence = (_m = config == null ? void 0 : config.animations) == null ? void 0 : _m.ResetPresence;
4984
- willBeAnimated && hasEnterStyle && ResetPresence && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ResetPresence, { children: content })), process.env.NODE_ENV === "development" && time && time`create-element`;
4984
+ ResetPresence && willBeAnimated && (hasEnterStyle || presenceState) && content && typeof content != "string" && (content = /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ResetPresence, { children: content })), process.env.NODE_ENV === "development" && time && time`create-element`;
4985
4985
  let groupState = curState.group, subGroupContext = (0, import_react2.useMemo)(() => {
4986
4986
  if (!(!groupState || !groupName))
4987
4987
  return groupState.listeners.clear(), {
@@ -7620,33 +7620,6 @@ var require_getBoundingClientRect_native = __commonJS({
7620
7620
  }
7621
7621
  });
7622
7622
 
7623
- // ../core/dist/cjs/helpers/getRect.native.js
7624
- var require_getRect_native = __commonJS({
7625
- "../core/dist/cjs/helpers/getRect.native.js"(exports2, module2) {
7626
- "use strict";
7627
- var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
7628
- for (var name in all)
7629
- __defProp2(target, name, { get: all[name], enumerable: !0 });
7630
- }, __copyProps2 = (to, from, except, desc) => {
7631
- if (from && typeof from == "object" || typeof from == "function")
7632
- for (let key of __getOwnPropNames2(from))
7633
- !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7634
- return to;
7635
- }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getRect_exports = {};
7636
- __export2(getRect_exports, {
7637
- getRect: () => getRect
7638
- });
7639
- module2.exports = __toCommonJS2(getRect_exports);
7640
- var import_getBoundingClientRect = require_getBoundingClientRect_native(), getRect = (node) => {
7641
- let rect = (0, import_getBoundingClientRect.getBoundingClientRect)(node);
7642
- if (!rect)
7643
- return;
7644
- let { x, y, top, left } = rect;
7645
- return { x, y, width: node.offsetWidth, height: node.offsetHeight, top, left };
7646
- };
7647
- }
7648
- });
7649
-
7650
7623
  // ../core/dist/cjs/hooks/useElementLayout.native.js
7651
7624
  var require_useElementLayout_native = __commonJS({
7652
7625
  "../core/dist/cjs/hooks/useElementLayout.native.js"(exports2, module2) {
@@ -7665,7 +7638,7 @@ var require_useElementLayout_native = __commonJS({
7665
7638
  useElementLayout: () => useElementLayout
7666
7639
  });
7667
7640
  module2.exports = __toCommonJS2(useElementLayout_exports);
7668
- var import_constants4 = require_index_native(), import_getBoundingClientRect = require_getBoundingClientRect_native(), import_getRect = require_getRect_native(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), LayoutTimeouts = /* @__PURE__ */ new WeakMap(), resizeObserver = null;
7641
+ var import_constants4 = require_index_native(), import_getBoundingClientRect = require_getBoundingClientRect_native(), LayoutHandlers = /* @__PURE__ */ new WeakMap(), resizeObserver = null;
7669
7642
  typeof window < "u" && "ResizeObserver" in window && (resizeObserver = new ResizeObserver((entries) => {
7670
7643
  for (let { target } of entries) {
7671
7644
  let onLayout = LayoutHandlers.get(target);
@@ -7682,17 +7655,41 @@ var require_useElementLayout_native = __commonJS({
7682
7655
  });
7683
7656
  }
7684
7657
  }));
7685
- var measureLayout = (node, relativeTo, callback) => {
7658
+ var cache = /* @__PURE__ */ new WeakMap(), measureLayout = (node, relativeTo, callback) => {
7686
7659
  let relativeNode = relativeTo || (node == null ? void 0 : node.parentNode);
7687
7660
  if (relativeNode instanceof HTMLElement) {
7688
- clearTimeout(LayoutTimeouts.get(relativeNode));
7689
- let tm = setTimeout(() => {
7690
- let relativeRect = (0, import_getBoundingClientRect.getBoundingClientRect)(relativeNode), { height, left, top, width } = (0, import_getRect.getRect)(node), x = left - relativeRect.left, y = top - relativeRect.top;
7691
- callback(x, y, width, height, left, top), LayoutTimeouts.delete(relativeNode);
7692
- }, 0);
7693
- LayoutTimeouts.set(relativeNode, tm);
7661
+ let now = Date.now();
7662
+ cache.set(node, now), Promise.all([
7663
+ getBoundingClientRectAsync(node),
7664
+ getBoundingClientRectAsync(relativeNode)
7665
+ ]).then(([nodeDim, relativeNodeDim]) => {
7666
+ if (relativeNodeDim && nodeDim && cache.get(node) === now) {
7667
+ let { x, y, width, height, left, top } = getRelativeDimensions(
7668
+ nodeDim,
7669
+ relativeNodeDim
7670
+ );
7671
+ callback(x, y, width, height, left, top);
7672
+ }
7673
+ });
7694
7674
  }
7695
- };
7675
+ }, getRelativeDimensions = (a, b) => {
7676
+ let { height, left, top, width } = a, x = left - b.left, y = top - b.top;
7677
+ return { x, y, width, height, left, top };
7678
+ }, getBoundingClientRectAsync = (element) => new Promise((resolve) => {
7679
+ function fallbackToSync() {
7680
+ resolve((0, import_getBoundingClientRect.getBoundingClientRect)(element));
7681
+ }
7682
+ let tm = setTimeout(fallbackToSync, 10);
7683
+ new IntersectionObserver(
7684
+ (entries, ob) => {
7685
+ var _a;
7686
+ clearTimeout(tm), ob.disconnect(), resolve((_a = entries[0]) == null ? void 0 : _a.boundingClientRect);
7687
+ },
7688
+ {
7689
+ threshold: 1e-4
7690
+ }
7691
+ ).observe(element);
7692
+ });
7696
7693
  function useElementLayout(ref, onLayout) {
7697
7694
  (0, import_constants4.useIsomorphicLayoutEffect)(() => {
7698
7695
  if (!resizeObserver || !onLayout)
@@ -7707,6 +7704,33 @@ var require_useElementLayout_native = __commonJS({
7707
7704
  }
7708
7705
  });
7709
7706
 
7707
+ // ../core/dist/cjs/helpers/getRect.native.js
7708
+ var require_getRect_native = __commonJS({
7709
+ "../core/dist/cjs/helpers/getRect.native.js"(exports2, module2) {
7710
+ "use strict";
7711
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc2 = Object.getOwnPropertyDescriptor, __getOwnPropNames2 = Object.getOwnPropertyNames, __hasOwnProp2 = Object.prototype.hasOwnProperty, __export2 = (target, all) => {
7712
+ for (var name in all)
7713
+ __defProp2(target, name, { get: all[name], enumerable: !0 });
7714
+ }, __copyProps2 = (to, from, except, desc) => {
7715
+ if (from && typeof from == "object" || typeof from == "function")
7716
+ for (let key of __getOwnPropNames2(from))
7717
+ !__hasOwnProp2.call(to, key) && key !== except && __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
7718
+ return to;
7719
+ }, __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: !0 }), mod), getRect_exports = {};
7720
+ __export2(getRect_exports, {
7721
+ getRect: () => getRect
7722
+ });
7723
+ module2.exports = __toCommonJS2(getRect_exports);
7724
+ var import_getBoundingClientRect = require_getBoundingClientRect_native(), getRect = (node) => {
7725
+ let rect = (0, import_getBoundingClientRect.getBoundingClientRect)(node);
7726
+ if (!rect)
7727
+ return;
7728
+ let { x, y, top, left } = rect;
7729
+ return { x, y, width: node.offsetWidth, height: node.offsetHeight, top, left };
7730
+ };
7731
+ }
7732
+ });
7733
+
7710
7734
  // ../core/dist/cjs/hooks/usePlatformMethods.native.js
7711
7735
  var require_usePlatformMethods_native = __commonJS({
7712
7736
  "../core/dist/cjs/hooks/usePlatformMethods.native.js"(exports2, module2) {