tamagui 1.132.2 → 1.132.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.
@@ -8293,7 +8293,8 @@ var require_createComponent_native = __commonJS({
8293
8293
  }
8294
8294
  var allGroupContexts = (0, import_react3.useMemo)(function() {
8295
8295
  var _stateRef_current_group;
8296
- if (!groupName || props.passThrough) return groupContextParent;
8296
+ if (!groupName || props.passThrough || // avoids onLayout
8297
+ props.containerType === "normal") return groupContextParent;
8297
8298
  (_stateRef_current_group = stateRef.current.group) === null || _stateRef_current_group === void 0 || _stateRef_current_group.listeners.clear();
8298
8299
  var listeners = /* @__PURE__ */ new Set();
8299
8300
  return stateRef.current.group = {
@@ -12947,18 +12948,7 @@ var require_index_native19 = __commonJS({
12947
12948
  }));
12948
12949
  }
12949
12950
  if (import_constants4.isClient && rAF) {
12950
- layoutOnAnimationFrame = function() {
12951
- if (strategy !== "off") {
12952
- if (frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12953
- rAF(layoutOnAnimationFrame);
12954
- return;
12955
- }
12956
- frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), Nodes.forEach(function(node) {
12957
- updateLayoutIfChanged(node);
12958
- });
12959
- }
12960
- rAF(layoutOnAnimationFrame);
12961
- }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, supportsCheckVisibility = "checkVisibility" in document.body;
12951
+ supportsCheckVisibility = "checkVisibility" in document.body, BoundingRects = /* @__PURE__ */ new WeakMap();
12962
12952
  async function updateLayoutIfChanged(node) {
12963
12953
  if (IntersectionState.get(node) !== !1 && !(process.env.TAMAGUI_ONLAYOUT_VISIBILITY_CHECK === "1" && supportsCheckVisibility && !node.checkVisibility())) {
12964
12954
  var onLayout = LayoutHandlers.get(node);
@@ -12968,8 +12958,8 @@ var require_index_native19 = __commonJS({
12968
12958
  var nodeRect, parentRect;
12969
12959
  if (strategy === "async") {
12970
12960
  var [nr, pr] = await Promise.all([
12971
- getBoundingClientRectAsync(node),
12972
- getBoundingClientRectAsync(parentNode)
12961
+ BoundingRects.get(node) || getBoundingClientRectAsync(node),
12962
+ BoundingRects.get(parentNode) || getBoundingClientRectAsync(parentNode)
12973
12963
  ]);
12974
12964
  if (nr === !1 || pr === !1) return;
12975
12965
  nodeRect = nr, parentRect = pr;
@@ -12990,8 +12980,56 @@ var require_index_native19 = __commonJS({
12990
12980
  }
12991
12981
  }
12992
12982
  rAF(layoutOnAnimationFrame), frameCount = 0, userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP, RUN_EVERY_X_FRAMES = userSkipVal ? +userSkipVal : 10;
12983
+ async function layoutOnAnimationFrame() {
12984
+ if (strategy !== "off") {
12985
+ if (!Nodes.size || frameCount++ % RUN_EVERY_X_FRAMES !== 0) {
12986
+ rAF(layoutOnAnimationFrame);
12987
+ return;
12988
+ }
12989
+ frameCount === Number.MAX_SAFE_INTEGER && (frameCount = 0), await new Promise(function(res) {
12990
+ var io = new IntersectionObserver(function(entries) {
12991
+ io.disconnect();
12992
+ var _iteratorNormalCompletion2 = !0, _didIteratorError2 = !1, _iteratorError2 = void 0;
12993
+ try {
12994
+ for (var _iterator2 = entries[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
12995
+ var entry = _step2.value;
12996
+ BoundingRects.set(entry.target, entry.boundingClientRect);
12997
+ }
12998
+ } catch (err) {
12999
+ _didIteratorError2 = !0, _iteratorError2 = err;
13000
+ } finally {
13001
+ try {
13002
+ !_iteratorNormalCompletion2 && _iterator2.return != null && _iterator2.return();
13003
+ } finally {
13004
+ if (_didIteratorError2) throw _iteratorError2;
13005
+ }
13006
+ }
13007
+ res();
13008
+ }, {
13009
+ threshold: 0
13010
+ }), _iteratorNormalCompletion = !0, _didIteratorError = !1, _iteratorError = void 0;
13011
+ try {
13012
+ for (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = !0) {
13013
+ var node = _step.value;
13014
+ node.parentElement instanceof HTMLElement && (io.observe(node), io.observe(node.parentElement));
13015
+ }
13016
+ } catch (err) {
13017
+ _didIteratorError = !0, _iteratorError = err;
13018
+ } finally {
13019
+ try {
13020
+ !_iteratorNormalCompletion && _iterator.return != null && _iterator.return();
13021
+ } finally {
13022
+ if (_didIteratorError) throw _iteratorError;
13023
+ }
13024
+ }
13025
+ }), Nodes.forEach(function(node) {
13026
+ updateLayoutIfChanged(node);
13027
+ });
13028
+ }
13029
+ rAF(layoutOnAnimationFrame);
13030
+ }
12993
13031
  }
12994
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, supportsCheckVisibility, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
13032
+ var supportsCheckVisibility, BoundingRects, frameCount, userSkipVal, RUN_EVERY_X_FRAMES, getElementLayoutEvent = function(nodeRect, parentRect) {
12995
13033
  return {
12996
13034
  nativeEvent: {
12997
13035
  layout: getRelativeDimensions(nodeRect, parentRect),
@@ -23598,7 +23636,23 @@ var require_useFloating_native = __commonJS({
23598
23636
  module2.exports = __toCommonJS2(useFloating_exports);
23599
23637
  var import_react3 = __toESM2(require("react")), Floating = __toESM2(require_Floating_native()), FloatingOverrideContext2 = /* @__PURE__ */ import_react3.default.createContext(null), useFloating2 = function(props) {
23600
23638
  var _this, context = import_react3.default.useContext(FloatingOverrideContext2);
23601
- return (_this = context || Floating.useFloating) === null || _this === void 0 ? void 0 : _this(props);
23639
+ return (_this = context || Floating.useFloating) === null || _this === void 0 ? void 0 : _this({
23640
+ ...props,
23641
+ middleware: [
23642
+ // @ts-ignore
23643
+ ...props.middleware,
23644
+ {
23645
+ name: "rounded",
23646
+ fn(param) {
23647
+ var { x, y } = param;
23648
+ return {
23649
+ x: Math.round(x),
23650
+ y: Math.round(y)
23651
+ };
23652
+ }
23653
+ }
23654
+ ]
23655
+ });
23602
23656
  };
23603
23657
  }
23604
23658
  });
@@ -23835,7 +23889,7 @@ var require_Popper_native = __commonJS({
23835
23889
  Object.assign(setupOptions, options);
23836
23890
  }
23837
23891
  function Popper(props) {
23838
- var _middlewareData_checkFloating, { children, size: size2, strategy = "absolute", placement = "bottom", stayInFrame, allowFlip, offset: offset2, disableRTL, resize, passThrough, open, scope } = props, [arrowEl, setArrow] = React4.useState(null), [arrowSize, setArrowSize] = React4.useState(0), offsetOptions = offset2 ?? arrowSize, floatingStyle = React4.useRef({}), floating = (0, import_floating.useFloating)({
23892
+ var { children, size: size2, strategy = "absolute", placement = "bottom", stayInFrame, allowFlip, offset: offset2, disableRTL, resize, passThrough, open, scope } = props, [arrowEl, setArrow] = React4.useState(null), [arrowSize, setArrowSize] = React4.useState(0), offsetOptions = offset2 ?? arrowSize, floatingStyle = React4.useRef({}), floating = (0, import_floating.useFloating)({
23839
23893
  open: passThrough ? !1 : open || !0,
23840
23894
  strategy,
23841
23895
  placement,
@@ -23879,14 +23933,22 @@ var require_Popper_native = __commonJS({
23879
23933
  dimensions,
23880
23934
  keyboardOpen
23881
23935
  ]);
23882
- var popperContext = {
23883
- size: size2,
23884
- arrowRef: setArrow,
23885
- arrowStyle: middlewareData.arrow,
23886
- onArrowSize: setArrowSize,
23887
- hasFloating: (_middlewareData_checkFloating = middlewareData.checkFloating) === null || _middlewareData_checkFloating === void 0 ? void 0 : _middlewareData_checkFloating.hasFloating,
23888
- ...floating
23889
- };
23936
+ var popperContext = React4.useMemo(function() {
23937
+ var _middlewareData_checkFloating;
23938
+ return {
23939
+ size: size2,
23940
+ arrowRef: setArrow,
23941
+ arrowStyle: middlewareData.arrow,
23942
+ onArrowSize: setArrowSize,
23943
+ hasFloating: (_middlewareData_checkFloating = middlewareData.checkFloating) === null || _middlewareData_checkFloating === void 0 ? void 0 : _middlewareData_checkFloating.hasFloating,
23944
+ ...floating
23945
+ };
23946
+ }, [
23947
+ size2,
23948
+ floating.x,
23949
+ floating.y,
23950
+ floating.isPositioned
23951
+ ]);
23890
23952
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperProvider, {
23891
23953
  scope,
23892
23954
  ...popperContext,
@@ -23975,13 +24037,13 @@ var require_Popper_native = __commonJS({
23975
24037
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core12.View, {
23976
24038
  passThrough,
23977
24039
  ref: contentRefs,
24040
+ contain: "layout style",
23978
24041
  ...passThrough ? null : floatingProps,
23979
24042
  children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(PopperContentFrame, {
23980
24043
  passThrough,
23981
24044
  ...!passThrough && {
23982
24045
  "data-placement": placement,
23983
24046
  "data-strategy": strategy,
23984
- contain: "layout",
23985
24047
  size: size2,
23986
24048
  ...style,
23987
24049
  ...rest