@tamagui/core 1.129.6-1751237024118 → 1.129.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.
@@ -1426,7 +1426,7 @@ var require_insertStyleRule_native = __commonJS({
1426
1426
  return getAllTransforms;
1427
1427
  },
1428
1428
  insertStyleRules: function() {
1429
- return insertStyleRules;
1429
+ return insertStyleRules2;
1430
1430
  },
1431
1431
  insertedTransforms: function() {
1432
1432
  return insertedTransforms;
@@ -1525,7 +1525,7 @@ var require_insertStyleRule_native = __commonJS({
1525
1525
  function setNonce2(_) {
1526
1526
  nonce = _;
1527
1527
  }
1528
- function insertStyleRules(rulesToInsert) {
1528
+ function insertStyleRules2(rulesToInsert) {
1529
1529
  if (!sheet && import_constants.isClient && document.head) {
1530
1530
  var styleTag = document.createElement("style");
1531
1531
  nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
@@ -5101,7 +5101,7 @@ var require_getSplitStyles_native = __commonJS({
5101
5101
  try {
5102
5102
  for (var _iterator2 = pseudoStyles[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
5103
5103
  var psuedoStyle = _step2.value, fullKey = `${psuedoStyle[import_helpers2.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
5104
- fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), classNames[fullKey] = psuedoStyle[import_helpers2.StyleObjectIdentifier]);
5104
+ fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle, startedUnhydrated), classNames[fullKey] = psuedoStyle[import_helpers2.StyleObjectIdentifier]);
5105
5105
  }
5106
5106
  } catch (err) {
5107
5107
  _didIteratorError2 = !0, _iteratorError2 = err;
@@ -5156,7 +5156,7 @@ var require_getSplitStyles_native = __commonJS({
5156
5156
  var style3 = _step12.value, property = style3[import_helpers2.StyleObjectProperty], isSubStyle = property[0] === "$";
5157
5157
  if (!(isSubStyle && !(0, import_isActivePlatform.isActivePlatform)(property))) {
5158
5158
  var out = (0, import_createMediaStyle.createMediaStyle)(style3, mediaKeyShort, import_useMedia.mediaQueryConfig, isMedia, !1, priority), subKey = isSubStyle ? style3[2] : "", fullKey1 = `${style3[import_helpers2.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style3[import_helpers2.StyleObjectPseudo] || ""}`;
5159
- fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out), classNames[fullKey1] = out[import_helpers2.StyleObjectIdentifier]);
5159
+ fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out, startedUnhydrated), classNames[fullKey1] = out[import_helpers2.StyleObjectIdentifier]);
5160
5160
  }
5161
5161
  }
5162
5162
  } catch (err) {
@@ -6498,14 +6498,14 @@ var require_wrapStyleTags_native = __commonJS({
6498
6498
  }), mod);
6499
6499
  }, wrapStyleTags_exports = {};
6500
6500
  __export2(wrapStyleTags_exports, {
6501
- wrapStyleTags: function() {
6502
- return wrapStyleTags;
6501
+ getStyleTags: function() {
6502
+ return getStyleTags;
6503
6503
  }
6504
6504
  });
6505
6505
  module2.exports = __toCommonJS2(wrapStyleTags_exports);
6506
- var import_jsx_runtime2 = require("react/jsx-runtime"), import_helpers2 = require_index_native3(), import_constants = require_index_native2();
6507
- function wrapStyleTags(styles, content) {
6508
- return import_constants.IS_REACT_19, content;
6506
+ var import_jsx_runtime2 = require("react/jsx-runtime"), import_constants = require_index_native2(), import_helpers2 = require_index_native3();
6507
+ function getStyleTags(styles, content) {
6508
+ import_constants.IS_REACT_19;
6509
6509
  }
6510
6510
  }
6511
6511
  });
@@ -6690,8 +6690,8 @@ var require_useComponentState_native = __commonJS({
6690
6690
  }
6691
6691
  });
6692
6692
  module2.exports = __toCommonJS2(useComponentState_exports);
6693
- var import_constants = require_index_native2(), import_use_did_finish_ssr = require_index_native7(), import_react3 = require("react"), import_defaultComponentState = require_defaultComponentState_native(), import_isObj = require_isObj_native(), import_log = require_log_native(), import_is_equal_shallow = require_index_native6(), useComponentState = function(props, param, staticConfig, config) {
6694
- var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), needsHydration = !(0, import_use_did_finish_ssr.useIsClientOnly)(), [startedUnhydrated] = (0, import_react3.useState)(import_constants.IS_REACT_19 ? !isHydrated : !1), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
6693
+ var import_constants = require_index_native2(), import_is_equal_shallow = require_index_native6(), import_use_did_finish_ssr = require_index_native7(), import_react3 = require("react"), import_defaultComponentState = require_defaultComponentState_native(), import_isObj = require_isObj_native(), import_log = require_log_native(), useComponentState = function(props, param, staticConfig, config) {
6694
+ var { animationDriver } = param, _animationDriver_usePresence, isHydrated = (0, import_use_did_finish_ssr.useDidFinishSSR)(), needsHydration = !(0, import_use_did_finish_ssr.useIsClientOnly)(), [startedUnhydrated] = (0, import_react3.useState)(needsHydration && !isHydrated), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
6695
6695
  stateRef.current || (stateRef.current = {});
6696
6696
  var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current;
6697
6697
  !needsHydration && hasAnimationProp && (curStateRef.hasAnimated = !0);
@@ -7132,7 +7132,7 @@ var require_createComponent_native = __commonJS({
7132
7132
  ]), canAvoidReRender = Object.keys(next).every(function(key3) {
7133
7133
  return avoidReRenderKeys.has(key3);
7134
7134
  });
7135
- if (canAvoidReRender) {
7135
+ if (canAvoidReRender && styleListener) {
7136
7136
  var updatedState = {
7137
7137
  ...state,
7138
7138
  ...next
@@ -7407,6 +7407,7 @@ var require_createComponent_native = __commonJS({
7407
7407
  children: content
7408
7408
  });
7409
7409
  }
7410
+ if (0) var styleTags;
7410
7411
  if (0) {
7411
7412
  var element1, title;
7412
7413
  if (!import_constants.isWeb)
@@ -10103,6 +10104,9 @@ var require_index_native9 = __commonJS({
10103
10104
  getTokens: function() {
10104
10105
  return import_config.getTokens;
10105
10106
  },
10107
+ insertStyleRules: function() {
10108
+ return import_insertStyleRule2.insertStyleRules;
10109
+ },
10106
10110
  mediaKeyMatch: function() {
10107
10111
  return import_useMedia.mediaKeyMatch;
10108
10112
  },
@@ -10152,6 +10156,7 @@ var require_index_native9 = __commonJS({
10152
10156
  __reExport2(index_exports2, require_createMediaStyle_native(), module2.exports);
10153
10157
  __reExport2(index_exports2, require_getShorthandValue_native(), module2.exports);
10154
10158
  __reExport2(index_exports2, require_index_native6(), module2.exports);
10159
+ var import_insertStyleRule2 = require_insertStyleRule_native();
10155
10160
  __reExport2(index_exports2, require_createStyledContext_native(), module2.exports);
10156
10161
  __reExport2(index_exports2, require_expandStyles_native(), module2.exports);
10157
10162
  __reExport2(index_exports2, require_getExpandedShorthands_native(), module2.exports);
@@ -11620,7 +11625,7 @@ var require_index_native12 = __commonJS({
11620
11625
  return enable2;
11621
11626
  },
11622
11627
  getElementLayoutEvent: function() {
11623
- return getElementLayoutEvent2;
11628
+ return getElementLayoutEvent;
11624
11629
  },
11625
11630
  getElementLayoutEventAsync: function() {
11626
11631
  return getElementLayoutEventAsync;
@@ -11646,7 +11651,7 @@ var require_index_native12 = __commonJS({
11646
11651
  function setOnLayoutStrategy2(state) {
11647
11652
  strategy = state;
11648
11653
  }
11649
- var NodeRectCache = /* @__PURE__ */ new WeakMap(), ParentRectCache = /* @__PURE__ */ new WeakMap(), DebounceTimers = /* @__PURE__ */ new WeakMap(), LastChangeTime = /* @__PURE__ */ new WeakMap(), rAF = typeof window < "u" ? window.requestAnimationFrame : void 0, DEBOUNCE_DELAY = 32, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map();
11654
+ var NodeRectCache = /* @__PURE__ */ new WeakMap(), ParentRectCache = /* @__PURE__ */ new WeakMap(), LastChangeTime = /* @__PURE__ */ new WeakMap(), rAF = typeof window < "u" ? window.requestAnimationFrame : void 0, avoidUpdates = !0, queuedUpdates = /* @__PURE__ */ new Map();
11650
11655
  function enable2() {
11651
11656
  avoidUpdates && (avoidUpdates = !1, queuedUpdates && (queuedUpdates.forEach(function(cb) {
11652
11657
  return cb();
@@ -11657,66 +11662,51 @@ var require_index_native12 = __commonJS({
11657
11662
  var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
11658
11663
  if (lastFrameAt = now, strategy !== "off") {
11659
11664
  var expectedFrameTime = 16.67, hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
11660
- hasRecentSyncWork || Nodes.forEach(updateLayoutIfChanged);
11665
+ hasRecentSyncWork || Nodes.forEach(function(node) {
11666
+ updateLayoutIfChanged(node, lastFrameAt);
11667
+ });
11661
11668
  }
11662
11669
  rAF(layoutOnAnimationFrame);
11663
11670
  }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, lastFrameAt = Date.now(), numDroppedFramesUntilPause = 2;
11664
- async function updateLayoutIfChanged(node) {
11665
- var nodeRect = node.getBoundingClientRect(), parentNode = node.parentElement, parentRect = parentNode == null ? void 0 : parentNode.getBoundingClientRect(), onLayout = LayoutHandlers.get(node);
11666
- if (typeof onLayout == "function") {
11667
- var cachedRect = NodeRectCache.get(node), cachedParentRect = parentNode ? NodeRectCache.get(parentNode) : null;
11668
- if (!cachedRect || // has changed one rect
11669
- !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) if (NodeRectCache.set(node, nodeRect), parentRect && parentNode && ParentRectCache.set(parentNode, parentRect), avoidUpdates) {
11670
- var event = getElementLayoutEvent2(node);
11671
- queuedUpdates.set(node, function() {
11672
- return onLayout(event);
11673
- });
11674
- } else if (strategy === "async") {
11675
- var now = Date.now();
11676
- LastChangeTime.set(node, now);
11677
- var existingTimer = DebounceTimers.get(node);
11678
- existingTimer && clearTimeout(existingTimer);
11679
- var timer = setTimeout(async function() {
11680
- var lastChange = LastChangeTime.get(node) || 0, timeSinceChange = Date.now() - lastChange;
11681
- if (timeSinceChange >= DEBOUNCE_DELAY) {
11682
- var event2 = await getElementLayoutEventAsync(node);
11683
- onLayout(event2), DebounceTimers.delete(node);
11684
- } else {
11685
- var remainingDelay = DEBOUNCE_DELAY - timeSinceChange, newTimer = setTimeout(async function() {
11686
- var event3 = await getElementLayoutEventAsync(node);
11687
- onLayout(event3), DebounceTimers.delete(node);
11688
- }, remainingDelay);
11689
- DebounceTimers.set(node, newTimer);
11671
+ async function updateLayoutIfChanged(node, frameId) {
11672
+ var parentNode = node.parentElement, nodeRect, parentRect;
11673
+ if (strategy === "async") {
11674
+ var [nr, pr] = await Promise.all([
11675
+ getBoundingClientRectAsync(node),
11676
+ getBoundingClientRectAsync(parentNode)
11677
+ ]);
11678
+ if (frameId !== lastFrameAt) return;
11679
+ nodeRect = nr, parentRect = pr;
11680
+ } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode == null ? void 0 : parentNode.getBoundingClientRect();
11681
+ if (parentRect) {
11682
+ var onLayout = LayoutHandlers.get(node);
11683
+ if (typeof onLayout == "function") {
11684
+ var cachedRect = NodeRectCache.get(node), cachedParentRect = parentNode ? NodeRectCache.get(parentNode) : null;
11685
+ if (!cachedRect || // has changed one rect
11686
+ !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
11687
+ if (NodeRectCache.set(node, nodeRect), parentRect && parentNode && ParentRectCache.set(parentNode, parentRect), avoidUpdates) {
11688
+ var event = getElementLayoutEvent(nodeRect, parentRect);
11689
+ queuedUpdates.set(node, function() {
11690
+ return onLayout(event);
11691
+ });
11692
+ } else if (strategy !== "async") {
11693
+ var event1 = getElementLayoutEvent(nodeRect, parentRect);
11694
+ onLayout(event1);
11690
11695
  }
11691
- }, DEBOUNCE_DELAY);
11692
- DebounceTimers.set(node, timer);
11693
- } else {
11694
- var event1 = getElementLayoutEvent2(node);
11695
- onLayout(event1);
11696
+ }
11696
11697
  }
11697
11698
  }
11698
11699
  }
11699
11700
  rAF(layoutOnAnimationFrame);
11700
11701
  }
11701
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, numDroppedFramesUntilPause, getElementLayoutEvent2 = function(target) {
11702
- var res = null;
11703
- if (measureLayout2(target, null, function(x, y, width, height, left, top) {
11704
- res = {
11705
- nativeEvent: {
11706
- layout: {
11707
- x,
11708
- y,
11709
- width,
11710
- height,
11711
- left,
11712
- top
11713
- },
11714
- target
11715
- },
11716
- timeStamp: Date.now()
11717
- };
11718
- }), !res) throw new Error("\u203C\uFE0F");
11719
- return res;
11702
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, numDroppedFramesUntilPause, getElementLayoutEvent = function(nodeRect, parentRect) {
11703
+ return {
11704
+ nativeEvent: {
11705
+ layout: getRelativeDimensions(nodeRect, parentRect),
11706
+ target: nodeRect
11707
+ },
11708
+ timeStamp: Date.now()
11709
+ };
11720
11710
  }, measureLayout2 = function(node, relativeTo, callback) {
11721
11711
  var relativeNode = relativeTo || (node == null ? void 0 : node.parentElement);
11722
11712
  if (relativeNode instanceof HTMLElement) {
@@ -11740,8 +11730,8 @@ var require_index_native12 = __commonJS({
11740
11730
  var relativeNode = relativeTo || (node == null ? void 0 : node.parentElement);
11741
11731
  if (relativeNode instanceof HTMLElement) {
11742
11732
  var [nodeDim, relativeNodeDim] = await Promise.all([
11743
- node.getBoundingClientRect(),
11744
- relativeNode.getBoundingClientRect()
11733
+ getBoundingClientRectAsync(node),
11734
+ getBoundingClientRectAsync(relativeNode)
11745
11735
  ]);
11746
11736
  if (relativeNodeDim && nodeDim) {
11747
11737
  var { x, y, width, height, left, top } = getRelativeDimensions(nodeDim, relativeNodeDim);
@@ -11773,11 +11763,13 @@ var require_index_native12 = __commonJS({
11773
11763
  var _ref_current2;
11774
11764
  if (onLayout) {
11775
11765
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
11776
- if (node2) return LayoutHandlers.set(node2, onLayout), Nodes.add(node2), onLayout(getElementLayoutEvent2(node2)), function() {
11777
- Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2);
11778
- var timer = DebounceTimers.get(node2);
11779
- timer && (clearTimeout(timer), DebounceTimers.delete(node2)), LastChangeTime.delete(node2);
11780
- };
11766
+ if (node2) {
11767
+ LayoutHandlers.set(node2, onLayout), Nodes.add(node2);
11768
+ var parentNode = node2.parentNode;
11769
+ return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
11770
+ Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2);
11771
+ };
11772
+ }
11781
11773
  }
11782
11774
  }, [
11783
11775
  ref,
@@ -11787,7 +11779,18 @@ var require_index_native12 = __commonJS({
11787
11779
  function ensureWebElement(x) {
11788
11780
  if (!(typeof HTMLElement > "u")) return x instanceof HTMLElement ? x : void 0;
11789
11781
  }
11790
- var getBoundingClientRect = function(node) {
11782
+ var getBoundingClientRectAsync = function(node) {
11783
+ return new Promise(function(res) {
11784
+ if (!(!node || node.nodeType !== 1)) {
11785
+ var io = new IntersectionObserver(function(entries) {
11786
+ return io.disconnect(), res(entries[0].boundingClientRect);
11787
+ }, {
11788
+ threshold: 0
11789
+ });
11790
+ io.observe(node);
11791
+ }
11792
+ });
11793
+ }, getBoundingClientRect = function(node) {
11791
11794
  var _node_getBoundingClientRect;
11792
11795
  if (!(!node || node.nodeType !== 1)) return (_node_getBoundingClientRect = node.getBoundingClientRect) === null || _node_getBoundingClientRect === void 0 ? void 0 : _node_getBoundingClientRect.call(node);
11793
11796
  }, getRect2 = function(node) {
@@ -11828,7 +11831,6 @@ __export(index_exports, {
11828
11831
  Text: () => Text,
11829
11832
  View: () => View,
11830
11833
  createTamagui: () => createTamagui,
11831
- getElementLayoutEvent: () => import_use_element_layout2.getElementLayoutEvent,
11832
11834
  setOnLayoutStrategy: () => import_use_element_layout2.setOnLayoutStrategy
11833
11835
  });
11834
11836
  module.exports = __toCommonJS(index_exports);
@@ -12134,7 +12136,6 @@ var dontComposePressabilityKeys = {
12134
12136
  Text,
12135
12137
  View,
12136
12138
  createTamagui,
12137
- getElementLayoutEvent,
12138
12139
  setOnLayoutStrategy
12139
12140
  });
12140
12141
  //# sourceMappingURL=test.js.map