tamagui 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.
package/dist/native.js CHANGED
@@ -2542,7 +2542,7 @@ var require_insertStyleRule_native = __commonJS({
2542
2542
  return getAllTransforms;
2543
2543
  },
2544
2544
  insertStyleRules: function() {
2545
- return insertStyleRules;
2545
+ return insertStyleRules2;
2546
2546
  },
2547
2547
  insertedTransforms: function() {
2548
2548
  return insertedTransforms;
@@ -2805,7 +2805,7 @@ var require_insertStyleRule_native = __commonJS({
2805
2805
  function setNonce2(_) {
2806
2806
  nonce = _;
2807
2807
  }
2808
- function insertStyleRules(rulesToInsert) {
2808
+ function insertStyleRules2(rulesToInsert) {
2809
2809
  if (!sheet && import_constants4.isClient && document.head) {
2810
2810
  var styleTag = document.createElement("style");
2811
2811
  nonce && (styleTag.nonce = nonce), sheet = document.head.appendChild(styleTag).sheet;
@@ -6500,7 +6500,7 @@ var require_getSplitStyles_native = __commonJS({
6500
6500
  try {
6501
6501
  for (var _iterator2 = pseudoStyles[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = !0) {
6502
6502
  var psuedoStyle = _step2.value, fullKey = `${psuedoStyle[import_helpers.StyleObjectProperty]}${PROP_SPLIT}${descriptor.name}`;
6503
- fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
6503
+ fullKey in usedKeys || (addStyleToInsertRules(rulesToInsert, psuedoStyle, startedUnhydrated), classNames[fullKey] = psuedoStyle[import_helpers.StyleObjectIdentifier]);
6504
6504
  }
6505
6505
  } catch (err) {
6506
6506
  _didIteratorError2 = !0, _iteratorError2 = err;
@@ -6578,7 +6578,7 @@ var require_getSplitStyles_native = __commonJS({
6578
6578
  var out = (0, import_createMediaStyle.createMediaStyle)(style3, mediaKeyShort, import_useMedia.mediaQueryConfig, isMedia, !1, priority);
6579
6579
  process.env.NODE_ENV === "development" && debug === "verbose" && (0, import_log.log)("\u{1F4FA} media style:", out);
6580
6580
  var subKey = isSubStyle ? style3[2] : "", fullKey1 = `${style3[import_helpers.StyleObjectProperty]}${subKey}${PROP_SPLIT}${mediaKeyShort}${style3[import_helpers.StyleObjectPseudo] || ""}`;
6581
- fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out), classNames[fullKey1] = out[import_helpers.StyleObjectIdentifier]);
6581
+ fullKey1 in usedKeys || (addStyleToInsertRules(rulesToInsert, out, startedUnhydrated), classNames[fullKey1] = out[import_helpers.StyleObjectIdentifier]);
6582
6582
  }
6583
6583
  }
6584
6584
  } catch (err) {
@@ -8007,14 +8007,14 @@ var require_wrapStyleTags_native = __commonJS({
8007
8007
  }), mod);
8008
8008
  }, wrapStyleTags_exports = {};
8009
8009
  __export2(wrapStyleTags_exports, {
8010
- wrapStyleTags: function() {
8011
- return wrapStyleTags;
8010
+ getStyleTags: function() {
8011
+ return getStyleTags;
8012
8012
  }
8013
8013
  });
8014
8014
  module2.exports = __toCommonJS2(wrapStyleTags_exports);
8015
- var import_jsx_runtime6 = require("react/jsx-runtime"), import_helpers = require_index_native7(), import_constants4 = require_index_native6();
8016
- function wrapStyleTags(styles, content) {
8017
- return import_constants4.IS_REACT_19, content;
8015
+ var import_jsx_runtime6 = require("react/jsx-runtime"), import_constants4 = require_index_native6(), import_helpers = require_index_native7();
8016
+ function getStyleTags(styles, content) {
8017
+ import_constants4.IS_REACT_19;
8018
8018
  }
8019
8019
  }
8020
8020
  });
@@ -8199,8 +8199,8 @@ var require_useComponentState_native = __commonJS({
8199
8199
  }
8200
8200
  });
8201
8201
  module2.exports = __toCommonJS2(useComponentState_exports);
8202
- var import_constants4 = require_index_native6(), import_use_did_finish_ssr = require_index_native14(), 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_native13(), useComponentState = function(props, param, staticConfig, config) {
8203
- 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_constants4.IS_REACT_19 ? !isHydrated : !1), useAnimations = animationDriver == null ? void 0 : animationDriver.useAnimations, stateRef = (0, import_react3.useRef)(void 0);
8202
+ var import_constants4 = require_index_native6(), import_is_equal_shallow = require_index_native13(), import_use_did_finish_ssr = require_index_native14(), 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) {
8203
+ 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);
8204
8204
  stateRef.current || (stateRef.current = {});
8205
8205
  var hasAnimationProp = !!("animation" in props || props.style && hasAnimatedStyleValue(props.style)), supportsCSSVars = animationDriver == null ? void 0 : animationDriver.supportsCSSVars, curStateRef = stateRef.current;
8206
8206
  !needsHydration && hasAnimationProp && (curStateRef.hasAnimated = !0);
@@ -8726,7 +8726,7 @@ var require_createComponent_native = __commonJS({
8726
8726
  ]), canAvoidReRender = Object.keys(next).every(function(key3) {
8727
8727
  return avoidReRenderKeys.has(key3);
8728
8728
  });
8729
- if (canAvoidReRender) {
8729
+ if (canAvoidReRender && styleListener) {
8730
8730
  var updatedState = {
8731
8731
  ...state,
8732
8732
  ...next
@@ -9037,7 +9037,8 @@ If you meant to do this, you can disable this warning - either change untilMeasu
9037
9037
  children: content
9038
9038
  });
9039
9039
  }
9040
- if (process.env.NODE_ENV === "development" && time2 && time2`context-override`, process.env.NODE_ENV === "development" && time2 && time2`style-tags`, process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
9040
+ if (process.env.NODE_ENV === "development" && time2 && time2`context-override`, 0) var styleTags;
9041
+ if (process.env.NODE_ENV === "development" && time2 && time2`style-tags`, process.env.NODE_ENV === "development" && debugProp && debugProp !== "profile") {
9041
9042
  var element1 = typeof elementType == "string" ? elementType : "Component", title = `render <${element1} /> (${internalID}) with props`;
9042
9043
  if (import_constants4.isWeb) {
9043
9044
  console.groupCollapsed(title);
@@ -11612,6 +11613,9 @@ var require_index_native15 = __commonJS({
11612
11613
  getTokens: function() {
11613
11614
  return import_config.getTokens;
11614
11615
  },
11616
+ insertStyleRules: function() {
11617
+ return import_insertStyleRule2.insertStyleRules;
11618
+ },
11615
11619
  mediaKeyMatch: function() {
11616
11620
  return import_useMedia.mediaKeyMatch;
11617
11621
  },
@@ -11661,6 +11665,7 @@ var require_index_native15 = __commonJS({
11661
11665
  __reExport2(index_exports2, require_createMediaStyle_native(), module2.exports);
11662
11666
  __reExport2(index_exports2, require_getShorthandValue_native(), module2.exports);
11663
11667
  __reExport2(index_exports2, require_index_native13(), module2.exports);
11668
+ var import_insertStyleRule2 = require_insertStyleRule_native();
11664
11669
  __reExport2(index_exports2, require_createStyledContext_native(), module2.exports);
11665
11670
  __reExport2(index_exports2, require_expandStyles_native(), module2.exports);
11666
11671
  __reExport2(index_exports2, require_getExpandedShorthands_native(), module2.exports);
@@ -13318,7 +13323,7 @@ var require_index_native19 = __commonJS({
13318
13323
  return enable;
13319
13324
  },
13320
13325
  getElementLayoutEvent: function() {
13321
- return getElementLayoutEvent2;
13326
+ return getElementLayoutEvent;
13322
13327
  },
13323
13328
  getElementLayoutEventAsync: function() {
13324
13329
  return getElementLayoutEventAsync;
@@ -13344,7 +13349,7 @@ var require_index_native19 = __commonJS({
13344
13349
  function setOnLayoutStrategy3(state) {
13345
13350
  strategy = state;
13346
13351
  }
13347
- 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();
13352
+ 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();
13348
13353
  function enable() {
13349
13354
  avoidUpdates && (avoidUpdates = !1, queuedUpdates && (queuedUpdates.forEach(function(cb) {
13350
13355
  return cb();
@@ -13355,66 +13360,51 @@ var require_index_native19 = __commonJS({
13355
13360
  var now = Date.now(), timeSinceLastFrame = now - lastFrameAt;
13356
13361
  if (lastFrameAt = now, strategy !== "off") {
13357
13362
  var expectedFrameTime = 16.67, hasRecentSyncWork = timeSinceLastFrame > expectedFrameTime * numDroppedFramesUntilPause;
13358
- hasRecentSyncWork || Nodes.forEach(updateLayoutIfChanged);
13363
+ hasRecentSyncWork || Nodes.forEach(function(node) {
13364
+ updateLayoutIfChanged(node, lastFrameAt);
13365
+ });
13359
13366
  }
13360
13367
  rAF(layoutOnAnimationFrame);
13361
13368
  }, layoutOnAnimationFrame2 = layoutOnAnimationFrame, lastFrameAt = Date.now(), numDroppedFramesUntilPause = 2;
13362
- async function updateLayoutIfChanged(node) {
13363
- var nodeRect = node.getBoundingClientRect(), parentNode = node.parentElement, parentRect = parentNode == null ? void 0 : parentNode.getBoundingClientRect(), onLayout = LayoutHandlers.get(node);
13364
- if (typeof onLayout == "function") {
13365
- var cachedRect = NodeRectCache.get(node), cachedParentRect = parentNode ? NodeRectCache.get(parentNode) : null;
13366
- if (!cachedRect || // has changed one rect
13367
- !(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) {
13368
- var event = getElementLayoutEvent2(node);
13369
- queuedUpdates.set(node, function() {
13370
- return onLayout(event);
13371
- });
13372
- } else if (strategy === "async") {
13373
- var now = Date.now();
13374
- LastChangeTime.set(node, now);
13375
- var existingTimer = DebounceTimers.get(node);
13376
- existingTimer && clearTimeout(existingTimer);
13377
- var timer = setTimeout(async function() {
13378
- var lastChange = LastChangeTime.get(node) || 0, timeSinceChange = Date.now() - lastChange;
13379
- if (timeSinceChange >= DEBOUNCE_DELAY) {
13380
- var event2 = await getElementLayoutEventAsync(node);
13381
- onLayout(event2), DebounceTimers.delete(node);
13382
- } else {
13383
- var remainingDelay = DEBOUNCE_DELAY - timeSinceChange, newTimer = setTimeout(async function() {
13384
- var event3 = await getElementLayoutEventAsync(node);
13385
- onLayout(event3), DebounceTimers.delete(node);
13386
- }, remainingDelay);
13387
- DebounceTimers.set(node, newTimer);
13369
+ async function updateLayoutIfChanged(node, frameId) {
13370
+ var parentNode = node.parentElement, nodeRect, parentRect;
13371
+ if (strategy === "async") {
13372
+ var [nr, pr] = await Promise.all([
13373
+ getBoundingClientRectAsync(node),
13374
+ getBoundingClientRectAsync(parentNode)
13375
+ ]);
13376
+ if (frameId !== lastFrameAt) return;
13377
+ nodeRect = nr, parentRect = pr;
13378
+ } else nodeRect = node.getBoundingClientRect(), parentRect = parentNode == null ? void 0 : parentNode.getBoundingClientRect();
13379
+ if (parentRect) {
13380
+ var onLayout = LayoutHandlers.get(node);
13381
+ if (typeof onLayout == "function") {
13382
+ var cachedRect = NodeRectCache.get(node), cachedParentRect = parentNode ? NodeRectCache.get(parentNode) : null;
13383
+ if (!cachedRect || // has changed one rect
13384
+ !(0, import_is_equal_shallow.isEqualShallow)(cachedRect, nodeRect) && (!cachedParentRect || !(0, import_is_equal_shallow.isEqualShallow)(cachedParentRect, parentRect))) {
13385
+ if (NodeRectCache.set(node, nodeRect), parentRect && parentNode && ParentRectCache.set(parentNode, parentRect), avoidUpdates) {
13386
+ var event = getElementLayoutEvent(nodeRect, parentRect);
13387
+ queuedUpdates.set(node, function() {
13388
+ return onLayout(event);
13389
+ });
13390
+ } else if (strategy !== "async") {
13391
+ var event1 = getElementLayoutEvent(nodeRect, parentRect);
13392
+ onLayout(event1);
13388
13393
  }
13389
- }, DEBOUNCE_DELAY);
13390
- DebounceTimers.set(node, timer);
13391
- } else {
13392
- var event1 = getElementLayoutEvent2(node);
13393
- onLayout(event1);
13394
+ }
13394
13395
  }
13395
13396
  }
13396
13397
  }
13397
13398
  rAF(layoutOnAnimationFrame);
13398
13399
  } else process.env.NODE_ENV === "development" && console.warn("No requestAnimationFrame - please polyfill for onLayout to work correctly");
13399
- var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, numDroppedFramesUntilPause, getElementLayoutEvent2 = function(target) {
13400
- var res = null;
13401
- if (measureLayout(target, null, function(x, y, width, height, left, top) {
13402
- res = {
13403
- nativeEvent: {
13404
- layout: {
13405
- x,
13406
- y,
13407
- width,
13408
- height,
13409
- left,
13410
- top
13411
- },
13412
- target
13413
- },
13414
- timeStamp: Date.now()
13415
- };
13416
- }), !res) throw new Error("\u203C\uFE0F");
13417
- return res;
13400
+ var layoutOnAnimationFrame, layoutOnAnimationFrame2, lastFrameAt, numDroppedFramesUntilPause, getElementLayoutEvent = function(nodeRect, parentRect) {
13401
+ return {
13402
+ nativeEvent: {
13403
+ layout: getRelativeDimensions(nodeRect, parentRect),
13404
+ target: nodeRect
13405
+ },
13406
+ timeStamp: Date.now()
13407
+ };
13418
13408
  }, measureLayout = function(node, relativeTo, callback) {
13419
13409
  var relativeNode = relativeTo || (node == null ? void 0 : node.parentElement);
13420
13410
  if (relativeNode instanceof HTMLElement) {
@@ -13438,8 +13428,8 @@ var require_index_native19 = __commonJS({
13438
13428
  var relativeNode = relativeTo || (node == null ? void 0 : node.parentElement);
13439
13429
  if (relativeNode instanceof HTMLElement) {
13440
13430
  var [nodeDim, relativeNodeDim] = await Promise.all([
13441
- node.getBoundingClientRect(),
13442
- relativeNode.getBoundingClientRect()
13431
+ getBoundingClientRectAsync(node),
13432
+ getBoundingClientRectAsync(relativeNode)
13443
13433
  ]);
13444
13434
  if (relativeNodeDim && nodeDim) {
13445
13435
  var { x, y, width, height, left, top } = getRelativeDimensions(nodeDim, relativeNodeDim);
@@ -13471,11 +13461,13 @@ var require_index_native19 = __commonJS({
13471
13461
  var _ref_current2;
13472
13462
  if (onLayout) {
13473
13463
  var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
13474
- if (node2) return LayoutHandlers.set(node2, onLayout), Nodes.add(node2), onLayout(getElementLayoutEvent2(node2)), function() {
13475
- Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2);
13476
- var timer = DebounceTimers.get(node2);
13477
- timer && (clearTimeout(timer), DebounceTimers.delete(node2)), LastChangeTime.delete(node2);
13478
- };
13464
+ if (node2) {
13465
+ LayoutHandlers.set(node2, onLayout), Nodes.add(node2);
13466
+ var parentNode = node2.parentNode;
13467
+ return parentNode && onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect())), function() {
13468
+ Nodes.delete(node2), LayoutHandlers.delete(node2), NodeRectCache.delete(node2), LastChangeTime.delete(node2);
13469
+ };
13470
+ }
13479
13471
  }
13480
13472
  }, [
13481
13473
  ref,
@@ -13485,7 +13477,18 @@ var require_index_native19 = __commonJS({
13485
13477
  function ensureWebElement(x) {
13486
13478
  if (!(typeof HTMLElement > "u")) return x instanceof HTMLElement ? x : void 0;
13487
13479
  }
13488
- var getBoundingClientRect = function(node) {
13480
+ var getBoundingClientRectAsync = function(node) {
13481
+ return new Promise(function(res) {
13482
+ if (!(!node || node.nodeType !== 1)) {
13483
+ var io = new IntersectionObserver(function(entries) {
13484
+ return io.disconnect(), res(entries[0].boundingClientRect);
13485
+ }, {
13486
+ threshold: 0
13487
+ });
13488
+ io.observe(node);
13489
+ }
13490
+ });
13491
+ }, getBoundingClientRect = function(node) {
13489
13492
  var _node_getBoundingClientRect;
13490
13493
  if (!(!node || node.nodeType !== 1)) return (_node_getBoundingClientRect = node.getBoundingClientRect) === null || _node_getBoundingClientRect === void 0 ? void 0 : _node_getBoundingClientRect.call(node);
13491
13494
  }, getRect = function(node) {
@@ -14046,9 +14049,6 @@ var require_index_native20 = __commonJS({
14046
14049
  createTamagui: function() {
14047
14050
  return createTamagui2;
14048
14051
  },
14049
- getElementLayoutEvent: function() {
14050
- return import_use_element_layout2.getElementLayoutEvent;
14051
- },
14052
14052
  setOnLayoutStrategy: function() {
14053
14053
  return import_use_element_layout2.setOnLayoutStrategy;
14054
14054
  }