@tamagui/use-element-layout 3.0.0-beta.831.1 → 3.0.0-beta.889.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n\tLayoutMeasurementController: () => LayoutMeasurementController,\n\tcreateMeasure: () => createMeasure,\n\tcreateMeasureInWindow: () => createMeasureInWindow,\n\tcreateMeasureLayout: () => createMeasureLayout,\n\tenable: () => enable,\n\tgetBoundingClientRectAsync: () => getBoundingClientRectAsync,\n\tgetElementLayoutEvent: () => getElementLayoutEvent,\n\tmeasure: () => measure,\n\tmeasureInWindow: () => measureInWindow,\n\tmeasureLayout: () => measureLayout,\n\tmeasureNode: () => measureNode,\n\tregisterLayoutNode: () => registerLayoutNode,\n\tuseElementLayout: () => useElementLayout\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_react = require(\"react\");\nfunction _instanceof(left, right) {\n\tif (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);\n\telse return left instanceof right;\n}\nvar LayoutHandlers = /* @__PURE__ */ new WeakMap();\nvar LayoutDisableKey = /* @__PURE__ */ new WeakMap();\nvar Nodes = /* @__PURE__ */ new Set();\nvar usePretransformDimensions = function() {\n\treturn globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === \"1\";\n};\nvar _debugLayout;\nfunction isDebugLayout() {\n\tif (_debugLayout === void 0) _debugLayout = typeof window !== \"undefined\" && new URLSearchParams(window.location.search).has(\"__tamaDebugLayout\");\n\treturn _debugLayout;\n}\nvar DisableLayoutContextValues = {};\nvar DisableLayoutContextKey = /* @__PURE__ */ (0, import_react.createContext)(\"\");\nvar ENABLE = false;\nvar LayoutMeasurementController = function(param) {\n\tvar { disable, children } = param;\n\tvar id = (0, import_react.useId)();\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar wasDisabled = DisableLayoutContextValues[id] === true;\n\t\tDisableLayoutContextValues[id] = disable;\n\t\tif (wasDisabled && !disable) measureOnNextFrame === null || measureOnNextFrame === void 0 || measureOnNextFrame();\n\t}, [disable, id]);\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisableLayoutContextKey.Provider, {\n\t\tvalue: id,\n\t\tchildren\n\t});\n};\nvar strategy = \"async\";\nvar resumeLayoutLoop;\nvar measureOnNextFrame;\nvar NodeRectCache = /* @__PURE__ */ new WeakMap();\nvar avoidUpdates = true;\nvar queuedUpdates = /* @__PURE__ */ new Map();\nfunction enable() {\n\tif (avoidUpdates) {\n\t\tavoidUpdates = false;\n\t\tif (queuedUpdates) {\n\t\t\tqueuedUpdates.forEach(function(cb) {\n\t\t\t\treturn cb();\n\t\t\t});\n\t\t\tqueuedUpdates.clear();\n\t\t}\n\t}\n}\nfunction rectsEqual(a, b) {\n\treturn a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\nif (ENABLE) {\n\tlet ensureRectFetchObserver2 = function() {\n\t\tif (rectFetchObserver) return rectFetchObserver;\n\t\trectFetchObserver = new IntersectionObserver(function(entries) {\n\t\t\tlastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);\n\t\t\tfor (var i = 0; i < entries.length; i++) BoundingRects.set(entries[i].target, entries[i].boundingClientRect);\n\t\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout() && lastCallbackDelay > 50) console.warn(\"[onLayout-io-delay]\", lastCallbackDelay + \"ms\", entries.length, \"entries\");\n\t\t\tif (rectFetchResolve) {\n\t\t\t\trectFetchResolve(true);\n\t\t\t\trectFetchResolve = null;\n\t\t\t}\n\t\t}, { threshold: 0 });\n\t\treturn rectFetchObserver;\n\t}, scheduleLayoutFrame2 = function() {\n\t\tif (frameScheduled || strategy === \"off\" || Nodes.size === 0 || document.hidden) return;\n\t\tframeScheduled = true;\n\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\n\t};\n\tvar BoundingRects = /* @__PURE__ */ new WeakMap();\n\tvar rectFetchObserver = null;\n\tvar rectFetchResolve = null;\n\tvar rectFetchStartTime = 0;\n\tvar lastCallbackDelay = 0;\n\tasync function updateLayoutIfChanged(node) {\n\t\tif (typeof LayoutHandlers.get(node) !== \"function\") return;\n\t\tvar parentNode = node.parentElement;\n\t\tif (!parentNode) return;\n\t\tvar nodeRect;\n\t\tvar parentRect;\n\t\tif (strategy === \"async\") {\n\t\t\tnodeRect = BoundingRects.get(node);\n\t\t\tparentRect = BoundingRects.get(parentNode);\n\t\t\tif (!nodeRect || !parentRect) return;\n\t\t} else {\n\t\t\tnodeRect = node.getBoundingClientRect();\n\t\t\tparentRect = parentNode.getBoundingClientRect();\n\t\t}\n\t\temitLayoutIfChanged(node, parentNode, nodeRect, parentRect);\n\t}\n\tvar rAF = typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : void 0;\n\tvar userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;\n\tvar BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;\n\tvar MAX_SKIP_FRAMES = 20;\n\tvar skipFrames = BASE_SKIP_FRAMES;\n\tvar frameCount = 0;\n\tvar frameScheduled = false;\n\tasync function layoutOnAnimationFrame() {\n\t\tif (frameCount++ % skipFrames !== 0) {\n\t\t\tframeScheduled = false;\n\t\t\tscheduleLayoutFrame2();\n\t\t\treturn;\n\t\t}\n\t\tif (frameCount >= Number.MAX_SAFE_INTEGER) frameCount = 0;\n\t\tif (strategy !== \"off\") {\n\t\t\tvar activeNodes = [];\n\t\t\tvar parentsToObserve = /* @__PURE__ */ new Set();\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar node = _step.value;\n\t\t\t\t\tvar parentElement = node.parentElement;\n\t\t\t\t\tif (!_instanceof(parentElement, HTMLElement)) {\n\t\t\t\t\t\tcleanupNode(node);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar disableKey = LayoutDisableKey.get(node);\n\t\t\t\t\tif (disableKey && DisableLayoutContextValues[disableKey] === true) continue;\n\t\t\t\t\tactiveNodes.push(node);\n\t\t\t\t\tparentsToObserve.add(parentElement);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (activeNodes.length > 0) {\n\t\t\t\tvar io = ensureRectFetchObserver2();\n\t\t\t\trectFetchStartTime = performance.now();\n\t\t\t\tfor (var i = 0; i < activeNodes.length; i++) io.observe(activeNodes[i]);\n\t\t\t\tvar _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator1 = parentsToObserve[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n\t\t\t\t\t\tvar parent = _step1.value;\n\t\t\t\t\t\tio.observe(parent);\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError1 = true;\n\t\t\t\t\t_iteratorError1 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError1) throw _iteratorError1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait new Promise(function(res) {\n\t\t\t\t\trectFetchResolve = res;\n\t\t\t\t});\n\t\t\t\tfor (var i1 = 0; i1 < activeNodes.length; i1++) io.unobserve(activeNodes[i1]);\n\t\t\t\tvar _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator2 = parentsToObserve[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n\t\t\t\t\t\tvar parent1 = _step2.value;\n\t\t\t\t\t\tio.unobserve(parent1);\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError2 = true;\n\t\t\t\t\t_iteratorError2 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError2) throw _iteratorError2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);\n\t\t\t\telse if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);\n\t\t\t\tfor (var i2 = 0; i2 < activeNodes.length; i2++) updateLayoutIfChanged(activeNodes[i2]);\n\t\t\t}\n\t\t}\n\t\tframeScheduled = false;\n\t\tscheduleLayoutFrame2();\n\t}\n\tresumeLayoutLoop = scheduleLayoutFrame2;\n\tmeasureOnNextFrame = function() {\n\t\tframeCount = 0;\n\t\tscheduleLayoutFrame2();\n\t};\n\tdocument.addEventListener(\"visibilitychange\", scheduleLayoutFrame2);\n\tscheduleLayoutFrame2();\n}\nvar getElementLayoutEvent = function(nodeRect, parentRect, node) {\n\treturn {\n\t\tnativeEvent: {\n\t\t\tlayout: getRelativeDimensions(nodeRect, parentRect, node),\n\t\t\ttarget: nodeRect\n\t\t},\n\t\ttimeStamp: Date.now()\n\t};\n};\nvar getPreTransformDimensions = function(node) {\n\treturn {\n\t\twidth: node.offsetWidth,\n\t\theight: node.offsetHeight\n\t};\n};\nvar getRelativeDimensions = function(a, b, aNode) {\n\tvar { left, top } = a;\n\tvar x = left - b.left;\n\tvar y = top - b.top;\n\tvar { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {\n\t\twidth: a.width,\n\t\theight: a.height\n\t};\n\treturn {\n\t\tx,\n\t\ty,\n\t\twidth,\n\t\theight,\n\t\tpageX: a.left,\n\t\tpageY: a.top\n\t};\n};\nfunction emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {\n\tvar onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tvar cachedRect = NodeRectCache.get(node);\n\tvar cachedParentRect = NodeRectCache.get(parentNode);\n\tvar nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);\n\tvar parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);\n\tif (!nodeChanged && !parentChanged) return;\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tvar event = getElementLayoutEvent(nodeRect, parentRect, node);\n\tif (process.env.NODE_ENV === \"development\" && isDebugLayout()) console.log(\"[useElementLayout] change\", {\n\t\ttag: node.tagName,\n\t\tid: node.id || void 0,\n\t\tclassName: (node.className || \"\").slice(0, 60) || void 0,\n\t\tlayout: event.nativeEvent.layout,\n\t\tfirst: !cachedRect\n\t});\n\tif (avoidUpdates) queuedUpdates.set(node, function() {\n\t\treturn onLayout(event);\n\t});\n\telse onLayout(event);\n}\nfunction observeLayoutNode(node, disableKey) {\n\tNodes.add(node);\n\tif (disableKey) LayoutDisableKey.set(node, disableKey);\n\telse LayoutDisableKey.delete(node);\n\tresumeLayoutLoop === null || resumeLayoutLoop === void 0 || resumeLayoutLoop();\n}\nfunction registerLayoutNode(node, onChange, disableKey) {\n\tLayoutHandlers.set(node, onChange);\n\tobserveLayoutNode(node, disableKey);\n\treturn function() {\n\t\treturn cleanupNode(node);\n\t};\n}\nfunction cleanupNode(node) {\n\tNodes.delete(node);\n\tLayoutHandlers.delete(node);\n\tLayoutDisableKey.delete(node);\n\tNodeRectCache.delete(node);\n}\nvar PrevHostNode = /* @__PURE__ */ new WeakMap();\nfunction emitLayoutSync(node) {\n\tvar onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tvar parentNode = node.parentElement;\n\tif (!parentNode) return;\n\tvar nodeRect = node.getBoundingClientRect();\n\tvar parentRect = parentNode.getBoundingClientRect();\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tonLayout(getElementLayoutEvent(nodeRect, parentRect, node));\n}\nfunction useElementLayout(ref, onLayout) {\n\tvar _ref_current;\n\tvar disableKey = (0, import_react.useContext)(DisableLayoutContextKey);\n\tvar node = ensureWebElement((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.host);\n\tif (node && onLayout) {\n\t\tLayoutHandlers.set(node, onLayout);\n\t\tLayoutDisableKey.set(node, disableKey);\n\t}\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar _ref_current2;\n\t\tif (!onLayout) return;\n\t\tvar nextNode = ensureWebElement((_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host);\n\t\tvar prevNode = PrevHostNode.get(ref);\n\t\tif (nextNode === prevNode) return;\n\t\tif (prevNode) cleanupNode(prevNode);\n\t\tPrevHostNode.set(ref, nextNode);\n\t\tif (!nextNode) return;\n\t\tLayoutHandlers.set(nextNode, onLayout);\n\t\tobserveLayoutNode(nextNode, disableKey);\n\t\temitLayoutSync(nextNode);\n\t});\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar _ref_current2;\n\t\tif (!onLayout) return;\n\t\tvar node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;\n\t\tif (!node2) return;\n\t\tLayoutHandlers.set(node2, onLayout);\n\t\tobserveLayoutNode(node2, disableKey);\n\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout()) console.log(\"[useElementLayout] register\", {\n\t\t\ttag: node2.tagName,\n\t\t\tid: node2.id || void 0,\n\t\t\tclassName: (node2.className || \"\").slice(0, 60) || void 0,\n\t\t\ttotalNodes: Nodes.size\n\t\t});\n\t\treturn function() {\n\t\t\tcleanupNode(node2);\n\t\t\tvar swappedNode = PrevHostNode.get(ref);\n\t\t\tif (swappedNode && swappedNode !== node2) cleanupNode(swappedNode);\n\t\t\tPrevHostNode.delete(ref);\n\t\t};\n\t}, [ref, !!onLayout]);\n}\nfunction ensureWebElement(x) {\n\tif (typeof HTMLElement === \"undefined\") return;\n\treturn _instanceof(x, HTMLElement) ? x : void 0;\n}\nvar getBoundingClientRectAsync = function(node) {\n\treturn new Promise(function(res) {\n\t\tif (!node || node.nodeType !== 1) return res(false);\n\t\tvar io = new IntersectionObserver(function(entries) {\n\t\t\tio.disconnect();\n\t\t\treturn res(entries[0].boundingClientRect);\n\t\t}, { threshold: 0 });\n\t\tio.observe(node);\n\t});\n};\nvar measureNode = async function(node, relativeTo) {\n\tvar relativeNode = relativeTo || (node === null || node === void 0 ? void 0 : node.parentElement);\n\tif (_instanceof(relativeNode, HTMLElement)) {\n\t\tvar [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);\n\t\tif (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);\n\t}\n\treturn null;\n};\nvar measure = async function(node, callback) {\n\tvar out = await measureNode(node, _instanceof(node.parentNode, HTMLElement) ? node.parentNode : null);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasure(node) {\n\treturn function(callback) {\n\t\treturn measure(node, callback);\n\t};\n}\nvar measureInWindow = async function(node, callback) {\n\tvar out = await measureNode(node, null);\n\tif (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);\n\treturn out;\n};\nvar createMeasureInWindow = function(node) {\n\treturn function(callback) {\n\t\treturn measureInWindow(node, callback);\n\t};\n};\nvar measureLayout = async function(node, relativeNode, callback) {\n\tvar out = await measureNode(node, relativeNode);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasureLayout(node) {\n\treturn function(relativeTo, callback) {\n\t\treturn measureLayout(node, relativeTo, callback);\n\t};\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;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CAC9C,IAAI,KAAK,aAAa,QAAQ,aAAa,KAAK,KAAK,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,KAAK;CACvH,OAAO;AACR;AACA,SAAS,oBAAoB,MAAM;CAClC,OAAO,SAAS,YAAY,UAAU;EACrC,OAAO,cAAc,MAAM,YAAY,QAAQ;CAChD;AACD"}
1
+ {"version":3,"file":"index.native.js","names":[],"sources":["cjs/index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n\tLayoutMeasurementController: () => LayoutMeasurementController,\n\tcreateMeasure: () => createMeasure,\n\tcreateMeasureInWindow: () => createMeasureInWindow,\n\tcreateMeasureLayout: () => createMeasureLayout,\n\tenable: () => enable,\n\tgetBoundingClientRectAsync: () => getBoundingClientRectAsync,\n\tgetElementLayoutEvent: () => getElementLayoutEvent,\n\tmeasure: () => measure,\n\tmeasureInWindow: () => measureInWindow,\n\tmeasureLayout: () => measureLayout,\n\tmeasureNode: () => measureNode,\n\tregisterLayoutNode: () => registerLayoutNode,\n\tuseElementLayout: () => useElementLayout\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_constants = require(\"@tamagui/constants\");\nvar import_react = require(\"react\");\nfunction _instanceof(left, right) {\n\tif (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);\n\telse return left instanceof right;\n}\nvar LayoutHandlers = /* @__PURE__ */ new WeakMap();\nvar LayoutDisableKey = /* @__PURE__ */ new WeakMap();\nvar Nodes = /* @__PURE__ */ new Set();\nvar NodeRectCache = /* @__PURE__ */ new WeakMap();\nvar PrevHostNode = /* @__PURE__ */ new WeakMap();\nvar usePretransformDimensions = function() {\n\treturn globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === \"1\";\n};\nvar isDebugLayout = function() {\n\tvar _window_location_search, _window_location;\n\treturn typeof window !== \"undefined\" && ((_window_location = window.location) === null || _window_location === void 0 ? void 0 : (_window_location_search = _window_location.search) === null || _window_location_search === void 0 ? void 0 : _window_location_search.includes(\"__tamaDebugLayout\"));\n};\nvar DisableLayoutContextValues = {};\nvar DisableLayoutContextKey = /* @__PURE__ */ (0, import_react.createContext)(\"\");\nvar ENABLE = false;\nvar LayoutMeasurementController = function(param) {\n\tvar { disable, children } = param;\n\tvar id = (0, import_react.useId)();\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar wasDisabled = DisableLayoutContextValues[id] === true;\n\t\tDisableLayoutContextValues[id] = disable;\n\t\tif (wasDisabled && !disable) measureOnNextFrame === null || measureOnNextFrame === void 0 || measureOnNextFrame();\n\t}, [disable, id]);\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisableLayoutContextKey.Provider, {\n\t\tvalue: id,\n\t\tchildren\n\t});\n};\nvar strategy = \"async\";\nvar resumeLayoutLoop;\nvar measureOnNextFrame;\nvar avoidUpdates = true;\nvar queuedUpdates = /* @__PURE__ */ new Map();\nfunction enable() {\n\tif (avoidUpdates) {\n\t\tavoidUpdates = false;\n\t\tif (queuedUpdates) {\n\t\t\tqueuedUpdates.forEach(function(cb) {\n\t\t\t\treturn cb();\n\t\t\t});\n\t\t\tqueuedUpdates.clear();\n\t\t}\n\t}\n}\nfunction rectsEqual(a, b) {\n\treturn a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\nif (ENABLE) {\n\tlet ensureRectFetchObserver2 = function() {\n\t\tif (rectFetchObserver) return rectFetchObserver;\n\t\trectFetchObserver = new IntersectionObserver(function(entries) {\n\t\t\tlastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);\n\t\t\tfor (var i = 0; i < entries.length; i++) BoundingRects.set(entries[i].target, entries[i].boundingClientRect);\n\t\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout() && lastCallbackDelay > 50) console.warn(\"[onLayout-io-delay]\", lastCallbackDelay + \"ms\", entries.length, \"entries\");\n\t\t\tif (rectFetchResolve) {\n\t\t\t\trectFetchResolve(true);\n\t\t\t\trectFetchResolve = null;\n\t\t\t}\n\t\t}, { threshold: 0 });\n\t\treturn rectFetchObserver;\n\t}, updateLayoutIfChanged2 = function(node) {\n\t\tif (typeof LayoutHandlers.get(node) !== \"function\") return;\n\t\tvar parentNode = node.parentElement;\n\t\tif (!parentNode) return;\n\t\tvar nodeRect;\n\t\tvar parentRect;\n\t\tif (strategy === \"async\") {\n\t\t\tnodeRect = BoundingRects.get(node);\n\t\t\tparentRect = BoundingRects.get(parentNode);\n\t\t\tif (!nodeRect || !parentRect) return;\n\t\t} else {\n\t\t\tnodeRect = node.getBoundingClientRect();\n\t\t\tparentRect = parentNode.getBoundingClientRect();\n\t\t}\n\t\temitLayoutIfChanged(node, parentNode, nodeRect, parentRect);\n\t}, scheduleLayoutFrame2 = function() {\n\t\tif (frameScheduled || strategy === \"off\" || Nodes.size === 0 || document.hidden) return;\n\t\tframeScheduled = true;\n\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\n\t};\n\tvar BoundingRects = /* @__PURE__ */ new WeakMap();\n\tvar rectFetchObserver = null;\n\tvar rectFetchResolve = null;\n\tvar rectFetchStartTime = 0;\n\tvar lastCallbackDelay = 0;\n\tvar rAF = typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : void 0;\n\tvar userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;\n\tvar BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;\n\tvar MAX_SKIP_FRAMES = 20;\n\tvar skipFrames = BASE_SKIP_FRAMES;\n\tvar frameCount = 0;\n\tvar frameScheduled = false;\n\tasync function layoutOnAnimationFrame() {\n\t\tif (frameCount++ % skipFrames !== 0) {\n\t\t\tframeScheduled = false;\n\t\t\tscheduleLayoutFrame2();\n\t\t\treturn;\n\t\t}\n\t\tif (frameCount >= Number.MAX_SAFE_INTEGER) frameCount = 0;\n\t\tif (strategy !== \"off\") {\n\t\t\tvar activeNodes = [];\n\t\t\tvar parentsToObserve = /* @__PURE__ */ new Set();\n\t\t\tvar _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;\n\t\t\ttry {\n\t\t\t\tfor (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n\t\t\t\t\tvar node = _step.value;\n\t\t\t\t\tvar parentElement = node.parentElement;\n\t\t\t\t\tif (!_instanceof(parentElement, HTMLElement)) {\n\t\t\t\t\t\tcleanupNode(node);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tvar disableKey = LayoutDisableKey.get(node);\n\t\t\t\t\tif (disableKey && DisableLayoutContextValues[disableKey] === true) continue;\n\t\t\t\t\tactiveNodes.push(node);\n\t\t\t\t\tparentsToObserve.add(parentElement);\n\t\t\t\t}\n\t\t\t} catch (err) {\n\t\t\t\t_didIteratorError = true;\n\t\t\t\t_iteratorError = err;\n\t\t\t} finally {\n\t\t\t\ttry {\n\t\t\t\t\tif (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();\n\t\t\t\t} finally {\n\t\t\t\t\tif (_didIteratorError) throw _iteratorError;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (activeNodes.length > 0) {\n\t\t\t\tvar io = ensureRectFetchObserver2();\n\t\t\t\trectFetchStartTime = performance.now();\n\t\t\t\tfor (var i = 0; i < activeNodes.length; i++) io.observe(activeNodes[i]);\n\t\t\t\tvar _iteratorNormalCompletion1 = true, _didIteratorError1 = false, _iteratorError1 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator1 = parentsToObserve[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {\n\t\t\t\t\t\tvar parent = _step1.value;\n\t\t\t\t\t\tio.observe(parent);\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError1 = true;\n\t\t\t\t\t_iteratorError1 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError1) throw _iteratorError1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tawait new Promise(function(res) {\n\t\t\t\t\trectFetchResolve = res;\n\t\t\t\t});\n\t\t\t\tfor (var i1 = 0; i1 < activeNodes.length; i1++) io.unobserve(activeNodes[i1]);\n\t\t\t\tvar _iteratorNormalCompletion2 = true, _didIteratorError2 = false, _iteratorError2 = void 0;\n\t\t\t\ttry {\n\t\t\t\t\tfor (var _iterator2 = parentsToObserve[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {\n\t\t\t\t\t\tvar parent1 = _step2.value;\n\t\t\t\t\t\tio.unobserve(parent1);\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\t_didIteratorError2 = true;\n\t\t\t\t\t_iteratorError2 = err;\n\t\t\t\t} finally {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tif (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();\n\t\t\t\t\t} finally {\n\t\t\t\t\t\tif (_didIteratorError2) throw _iteratorError2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);\n\t\t\t\telse if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);\n\t\t\t\tfor (var i2 = 0; i2 < activeNodes.length; i2++) updateLayoutIfChanged2(activeNodes[i2]);\n\t\t\t}\n\t\t}\n\t\tframeScheduled = false;\n\t\tscheduleLayoutFrame2();\n\t}\n\tresumeLayoutLoop = scheduleLayoutFrame2;\n\tmeasureOnNextFrame = function() {\n\t\tframeCount = 0;\n\t\tscheduleLayoutFrame2();\n\t};\n\tdocument.addEventListener(\"visibilitychange\", scheduleLayoutFrame2);\n\tscheduleLayoutFrame2();\n}\nvar getElementLayoutEvent = function(nodeRect, parentRect, node) {\n\treturn {\n\t\tnativeEvent: {\n\t\t\tlayout: getRelativeDimensions(nodeRect, parentRect, node),\n\t\t\ttarget: nodeRect\n\t\t},\n\t\ttimeStamp: Date.now()\n\t};\n};\nvar getPreTransformDimensions = function(node) {\n\treturn {\n\t\twidth: node.offsetWidth,\n\t\theight: node.offsetHeight\n\t};\n};\nvar getRelativeDimensions = function(a, b, aNode) {\n\tvar left = a.left - b.left;\n\tvar top = a.top - b.top;\n\tvar { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {\n\t\twidth: a.width,\n\t\theight: a.height\n\t};\n\treturn {\n\t\tx: left,\n\t\ty: top,\n\t\twidth,\n\t\theight,\n\t\tpageX: a.left,\n\t\tpageY: a.top\n\t};\n};\nfunction emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {\n\tvar onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tvar cachedRect = NodeRectCache.get(node);\n\tvar cachedParentRect = NodeRectCache.get(parentNode);\n\tvar nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);\n\tvar parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);\n\tif (!nodeChanged && !parentChanged) return;\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tvar event = getElementLayoutEvent(nodeRect, parentRect, node);\n\tif (avoidUpdates) queuedUpdates.set(node, function() {\n\t\treturn onLayout(event);\n\t});\n\telse onLayout(event);\n}\nfunction observeLayoutNode(node, disableKey) {\n\tNodes.add(node);\n\tif (disableKey) LayoutDisableKey.set(node, disableKey);\n\telse LayoutDisableKey.delete(node);\n\tresumeLayoutLoop === null || resumeLayoutLoop === void 0 || resumeLayoutLoop();\n}\nfunction registerLayoutNode(node, onChange, disableKey) {\n\tLayoutHandlers.set(node, onChange);\n\tobserveLayoutNode(node, disableKey);\n\treturn function() {\n\t\treturn cleanupNode(node);\n\t};\n}\nfunction cleanupNode(node) {\n\tNodes.delete(node);\n\tLayoutHandlers.delete(node);\n\tLayoutDisableKey.delete(node);\n\tNodeRectCache.delete(node);\n}\nfunction emitLayoutSync(node) {\n\tvar onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tvar parentNode = node.parentElement;\n\tif (!parentNode) return;\n\tvar nodeRect = node.getBoundingClientRect();\n\tvar parentRect = parentNode.getBoundingClientRect();\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tonLayout(getElementLayoutEvent(nodeRect, parentRect, node));\n}\nfunction useElementLayout(ref, onLayout) {\n\tvar _ref_current;\n\tvar disableKey = (0, import_react.useContext)(DisableLayoutContextKey);\n\tvar node = ensureWebElement((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.host);\n\tif (node && onLayout) {\n\t\tLayoutHandlers.set(node, onLayout);\n\t\tLayoutDisableKey.set(node, disableKey);\n\t}\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar _ref_current2;\n\t\tif (!onLayout) return;\n\t\tvar nextNode = ensureWebElement((_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host);\n\t\tvar prevNode = PrevHostNode.get(ref);\n\t\tif (nextNode !== prevNode) {\n\t\t\tif (prevNode) cleanupNode(prevNode);\n\t\t\tPrevHostNode.set(ref, nextNode);\n\t\t\tif (nextNode) {\n\t\t\t\tLayoutHandlers.set(nextNode, onLayout);\n\t\t\t\tobserveLayoutNode(nextNode, disableKey);\n\t\t\t\temitLayoutSync(nextNode);\n\t\t\t}\n\t\t}\n\t\treturn function() {\n\t\t\tvar _ref_current3;\n\t\t\tvar activeNode = ensureWebElement((_ref_current3 = ref.current) === null || _ref_current3 === void 0 ? void 0 : _ref_current3.host);\n\t\t\tif (activeNode) cleanupNode(activeNode);\n\t\t\tvar swapped = PrevHostNode.get(ref);\n\t\t\tif (swapped && swapped !== activeNode) cleanupNode(swapped);\n\t\t\tPrevHostNode.delete(ref);\n\t\t};\n\t}, [ref, !!onLayout]);\n}\nfunction ensureWebElement(x) {\n\tif (typeof HTMLElement === \"undefined\") return void 0;\n\treturn _instanceof(x, HTMLElement) ? x : void 0;\n}\nvar getBoundingClientRectAsync = function(node) {\n\treturn new Promise(function(res) {\n\t\tif (!node || node.nodeType !== 1) return res(false);\n\t\tvar io = new IntersectionObserver(function(entries) {\n\t\t\tio.disconnect();\n\t\t\tres(entries[0].boundingClientRect);\n\t\t});\n\t\tio.observe(node);\n\t});\n};\nvar measureNode = async function(node, relativeTo) {\n\tvar relativeNode = relativeTo || (node === null || node === void 0 ? void 0 : node.parentElement);\n\tif (_instanceof(relativeNode, HTMLElement)) {\n\t\tvar [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);\n\t\tif (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);\n\t}\n\treturn null;\n};\nvar measure = async function(node, callback) {\n\tvar out = await measureNode(node, node.parentElement);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nvar createMeasure = function(node) {\n\treturn function(callback) {\n\t\treturn measure(node, callback);\n\t};\n};\nvar measureInWindow = async function(node, callback) {\n\tvar out = await measureNode(node, null);\n\tif (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);\n\treturn out;\n};\nvar createMeasureInWindow = function(node) {\n\treturn function(callback) {\n\t\treturn measureInWindow(node, callback);\n\t};\n};\nvar measureLayout = async function(node, relativeNode, callback) {\n\tvar out = await measureNode(node, relativeNode);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nvar createMeasureLayout = function(node) {\n\treturn function(relativeTo, callback) {\n\t\treturn measureLayout(node, relativeTo, callback);\n\t};\n};\n//# sourceMappingURL=index.js.map\n"],"mappings":";;;AACA,IAAI,YAAY,OAAO;AACvB,IAAI,mBAAmB,OAAO;AAC9B,IAAI,oBAAoB,OAAO;AAC/B,IAAI,eAAe,OAAO,UAAU;AACpC,IAAI,YAAY,QAAQ,QAAQ;CAC/B,KAAK,IAAI,QAAQ,KAAK,UAAU,QAAQ,MAAM;EAC7C,KAAK,IAAI;EACT,YAAY;CACb,CAAC;AACF;AACA,IAAI,eAAe,IAAI,MAAM,QAAQ,SAAS;CAC7C,IAAI,QAAQ,OAAO,SAAS,YAAY,OAAO,SAAS,YAAY;EACnE,KAAK,IAAI,OAAO,kBAAkB,IAAI,GAAG,IAAI,CAAC,aAAa,KAAK,IAAI,GAAG,KAAK,QAAQ,QAAQ,UAAU,IAAI,KAAK;GAC9G,WAAW,KAAK;GAChB,YAAY,EAAE,OAAO,iBAAiB,MAAM,GAAG,MAAM,KAAK;EAC3D,CA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ACtC,IAAI,KAAK,aAAa,QAAQ,aAAa,KAAK,KAAK,SAAS,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,IAAI,MAAM;CACzG,OAAO;AACR;AACA,IAAI,wBAAwB,SAAS,MAAM;CAC1C,OAAO,SAAS,UAAU;EACzB,OAAO,gBAAgB,MAAM,QAAQ;CACtC;AACD;AACA,IAAI,gBAAgB,eAAe,MAAM,cAAc,UAAU;CAChE,IAAI,MAAM,MAAM,YAAY,MAAM,YAAY;CAC9C,IAAI,KAAK,aAAa,QAAQ,aAAa,KAAK,KAAK,SAAS,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,KAAK;CACvH,OAAO;AACR;AACA,IAAI,sBAAsB,SAAS,MAAM;CACxC,OAAO,SAAS,YAAY,UAAU;EACrC,OAAO,cAAc,MAAM,YAAY,QAAQ;CAChD;AACD"}
package/dist/esm/index.js CHANGED
@@ -5,12 +5,10 @@ import { jsx } from "react/jsx-runtime";
5
5
  const LayoutHandlers = /* @__PURE__ */ new WeakMap();
6
6
  const LayoutDisableKey = /* @__PURE__ */ new WeakMap();
7
7
  const Nodes = /* @__PURE__ */ new Set();
8
+ const NodeRectCache = /* @__PURE__ */ new WeakMap();
9
+ const PrevHostNode = /* @__PURE__ */ new WeakMap();
8
10
  const usePretransformDimensions = () => globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === "1";
9
- let _debugLayout;
10
- function isDebugLayout() {
11
- if (_debugLayout === void 0) _debugLayout = typeof window !== "undefined" && new URLSearchParams(window.location.search).has("__tamaDebugLayout");
12
- return _debugLayout;
13
- }
11
+ const isDebugLayout = () => typeof window !== "undefined" && window.location?.search?.includes("__tamaDebugLayout");
14
12
  const DisableLayoutContextValues = {};
15
13
  const DisableLayoutContextKey = createContext("");
16
14
  const ENABLE = typeof IntersectionObserver !== "undefined";
@@ -28,7 +26,6 @@ const LayoutMeasurementController = ({ disable, children }) => {
28
26
  };
29
27
  let resumeLayoutLoop;
30
28
  let measureOnNextFrame;
31
- const NodeRectCache = /* @__PURE__ */ new WeakMap();
32
29
  let avoidUpdates = true;
33
30
  const queuedUpdates = /* @__PURE__ */ new Map();
34
31
  function enable() {
@@ -56,6 +53,16 @@ if (ENABLE) {
56
53
  }
57
54
  }, { threshold: 0 });
58
55
  return rectFetchObserver;
56
+ }, updateLayoutIfChanged = function(node) {
57
+ if (typeof LayoutHandlers.get(node) !== "function") return;
58
+ const parentNode = node.parentElement;
59
+ if (!parentNode) return;
60
+ let nodeRect;
61
+ let parentRect;
62
+ nodeRect = BoundingRects.get(node);
63
+ parentRect = BoundingRects.get(parentNode);
64
+ if (!nodeRect || !parentRect) return;
65
+ emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
59
66
  }, scheduleLayoutFrame = function() {
60
67
  if (frameScheduled || Nodes.size === 0 || document.hidden) return;
61
68
  frameScheduled = true;
@@ -66,17 +73,6 @@ if (ENABLE) {
66
73
  let rectFetchResolve = null;
67
74
  let rectFetchStartTime = 0;
68
75
  let lastCallbackDelay = 0;
69
- async function updateLayoutIfChanged(node) {
70
- if (typeof LayoutHandlers.get(node) !== "function") return;
71
- const parentNode = node.parentElement;
72
- if (!parentNode) return;
73
- let nodeRect;
74
- let parentRect;
75
- nodeRect = BoundingRects.get(node);
76
- parentRect = BoundingRects.get(parentNode);
77
- if (!nodeRect || !parentRect) return;
78
- emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
79
- }
80
76
  const rAF = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : void 0;
81
77
  const userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;
82
78
  const BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;
@@ -131,32 +127,27 @@ if (ENABLE) {
131
127
  document.addEventListener("visibilitychange", scheduleLayoutFrame);
132
128
  scheduleLayoutFrame();
133
129
  }
134
- const getElementLayoutEvent = (nodeRect, parentRect, node) => {
135
- return {
136
- nativeEvent: {
137
- layout: getRelativeDimensions(nodeRect, parentRect, node),
138
- target: nodeRect
139
- },
140
- timeStamp: Date.now()
141
- };
142
- };
143
- const getPreTransformDimensions = (node) => {
144
- return {
145
- width: node.offsetWidth,
146
- height: node.offsetHeight
147
- };
148
- };
130
+ const getElementLayoutEvent = (nodeRect, parentRect, node) => ({
131
+ nativeEvent: {
132
+ layout: getRelativeDimensions(nodeRect, parentRect, node),
133
+ target: nodeRect
134
+ },
135
+ timeStamp: Date.now()
136
+ });
137
+ const getPreTransformDimensions = (node) => ({
138
+ width: node.offsetWidth,
139
+ height: node.offsetHeight
140
+ });
149
141
  const getRelativeDimensions = (a, b, aNode) => {
150
- const { left, top } = a;
151
- const x = left - b.left;
152
- const y = top - b.top;
142
+ const left = a.left - b.left;
143
+ const top = a.top - b.top;
153
144
  const { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {
154
145
  width: a.width,
155
146
  height: a.height
156
147
  };
157
148
  return {
158
- x,
159
- y,
149
+ x: left,
150
+ y: top,
160
151
  width,
161
152
  height,
162
153
  pageX: a.left,
@@ -174,13 +165,6 @@ function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
174
165
  NodeRectCache.set(node, nodeRect);
175
166
  NodeRectCache.set(parentNode, parentRect);
176
167
  const event = getElementLayoutEvent(nodeRect, parentRect, node);
177
- if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] change", {
178
- tag: node.tagName,
179
- id: node.id || void 0,
180
- className: (node.className || "").slice(0, 60) || void 0,
181
- layout: event.nativeEvent.layout,
182
- first: !cachedRect
183
- });
184
168
  if (avoidUpdates) queuedUpdates.set(node, () => onLayout(event));
185
169
  else onLayout(event);
186
170
  }
@@ -201,7 +185,6 @@ function cleanupNode(node) {
201
185
  LayoutDisableKey.delete(node);
202
186
  NodeRectCache.delete(node);
203
187
  }
204
- const PrevHostNode = /* @__PURE__ */ new WeakMap();
205
188
  function emitLayoutSync(node) {
206
189
  const onLayout = LayoutHandlers.get(node);
207
190
  if (typeof onLayout !== "function") return;
@@ -224,48 +207,36 @@ function useElementLayout(ref, onLayout) {
224
207
  if (!onLayout) return;
225
208
  const nextNode = ensureWebElement(ref.current?.host);
226
209
  const prevNode = PrevHostNode.get(ref);
227
- if (nextNode === prevNode) return;
228
- if (prevNode) cleanupNode(prevNode);
229
- PrevHostNode.set(ref, nextNode);
230
- if (!nextNode) return;
231
- LayoutHandlers.set(nextNode, onLayout);
232
- observeLayoutNode(nextNode, disableKey);
233
- emitLayoutSync(nextNode);
234
- });
235
- useIsomorphicLayoutEffect(() => {
236
- if (!onLayout) return;
237
- const node2 = ref.current?.host;
238
- if (!node2) return;
239
- LayoutHandlers.set(node2, onLayout);
240
- observeLayoutNode(node2, disableKey);
241
- if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] register", {
242
- tag: node2.tagName,
243
- id: node2.id || void 0,
244
- className: (node2.className || "").slice(0, 60) || void 0,
245
- totalNodes: Nodes.size
246
- });
210
+ if (nextNode !== prevNode) {
211
+ if (prevNode) cleanupNode(prevNode);
212
+ PrevHostNode.set(ref, nextNode);
213
+ if (nextNode) {
214
+ LayoutHandlers.set(nextNode, onLayout);
215
+ observeLayoutNode(nextNode, disableKey);
216
+ emitLayoutSync(nextNode);
217
+ }
218
+ }
247
219
  return () => {
248
- cleanupNode(node2);
249
- const swappedNode = PrevHostNode.get(ref);
250
- if (swappedNode && swappedNode !== node2) cleanupNode(swappedNode);
220
+ const activeNode = ensureWebElement(ref.current?.host);
221
+ if (activeNode) cleanupNode(activeNode);
222
+ const swapped = PrevHostNode.get(ref);
223
+ if (swapped && swapped !== activeNode) cleanupNode(swapped);
251
224
  PrevHostNode.delete(ref);
252
225
  };
253
226
  }, [ref, !!onLayout]);
254
227
  }
255
228
  function ensureWebElement(x) {
256
- if (typeof HTMLElement === "undefined") return;
229
+ if (typeof HTMLElement === "undefined") return void 0;
257
230
  return x instanceof HTMLElement ? x : void 0;
258
231
  }
259
- const getBoundingClientRectAsync = (node) => {
260
- return new Promise((res) => {
261
- if (!node || node.nodeType !== 1) return res(false);
262
- const io = new IntersectionObserver((entries) => {
263
- io.disconnect();
264
- return res(entries[0].boundingClientRect);
265
- }, { threshold: 0 });
266
- io.observe(node);
232
+ const getBoundingClientRectAsync = (node) => new Promise((res) => {
233
+ if (!node || node.nodeType !== 1) return res(false);
234
+ const io = new IntersectionObserver((entries) => {
235
+ io.disconnect();
236
+ res(entries[0].boundingClientRect);
267
237
  });
268
- };
238
+ io.observe(node);
239
+ });
269
240
  const measureNode = async (node, relativeTo) => {
270
241
  const relativeNode = relativeTo || node?.parentElement;
271
242
  if (relativeNode instanceof HTMLElement) {
@@ -275,29 +246,23 @@ const measureNode = async (node, relativeTo) => {
275
246
  return null;
276
247
  };
277
248
  const measure = async (node, callback) => {
278
- const out = await measureNode(node, node.parentNode instanceof HTMLElement ? node.parentNode : null);
249
+ const out = await measureNode(node, node.parentElement);
279
250
  if (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
280
251
  return out;
281
252
  };
282
- function createMeasure(node) {
283
- return (callback) => measure(node, callback);
284
- }
253
+ const createMeasure = (node) => (callback) => measure(node, callback);
285
254
  const measureInWindow = async (node, callback) => {
286
255
  const out = await measureNode(node, null);
287
256
  if (out) callback?.(out.pageX, out.pageY, out.width, out.height);
288
257
  return out;
289
258
  };
290
- const createMeasureInWindow = (node) => {
291
- return (callback) => measureInWindow(node, callback);
292
- };
259
+ const createMeasureInWindow = (node) => (callback) => measureInWindow(node, callback);
293
260
  const measureLayout = async (node, relativeNode, callback) => {
294
261
  const out = await measureNode(node, relativeNode);
295
262
  if (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
296
263
  return out;
297
264
  };
298
- function createMeasureLayout(node) {
299
- return (relativeTo, callback) => measureLayout(node, relativeTo, callback);
300
- }
265
+ const createMeasureLayout = (node) => (relativeTo, callback) => measureLayout(node, relativeTo, callback);
301
266
 
302
267
  export { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };
303
268
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useId } from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst LayoutHandlers = /* @__PURE__ */ new WeakMap();\nconst LayoutDisableKey = /* @__PURE__ */ new WeakMap();\nconst Nodes = /* @__PURE__ */ new Set();\nconst usePretransformDimensions = () => globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === \"1\";\nlet _debugLayout;\nfunction isDebugLayout() {\n\tif (_debugLayout === void 0) _debugLayout = typeof window !== \"undefined\" && new URLSearchParams(window.location.search).has(\"__tamaDebugLayout\");\n\treturn _debugLayout;\n}\nconst DisableLayoutContextValues = {};\nconst DisableLayoutContextKey = createContext(\"\");\nconst ENABLE = typeof IntersectionObserver !== \"undefined\";\nconst LayoutMeasurementController = ({ disable, children }) => {\n\tconst id = useId();\n\tuseIsomorphicLayoutEffect(() => {\n\t\tconst wasDisabled = DisableLayoutContextValues[id] === true;\n\t\tDisableLayoutContextValues[id] = disable;\n\t\tif (wasDisabled && !disable) measureOnNextFrame?.();\n\t}, [disable, id]);\n\treturn /* @__PURE__ */ jsx(DisableLayoutContextKey.Provider, {\n\t\tvalue: id,\n\t\tchildren\n\t});\n};\nlet resumeLayoutLoop;\nlet measureOnNextFrame;\nconst NodeRectCache = /* @__PURE__ */ new WeakMap();\nlet avoidUpdates = true;\nconst queuedUpdates = /* @__PURE__ */ new Map();\nfunction enable() {\n\tif (avoidUpdates) {\n\t\tavoidUpdates = false;\n\t\tif (queuedUpdates) {\n\t\t\tqueuedUpdates.forEach((cb) => cb());\n\t\t\tqueuedUpdates.clear();\n\t\t}\n\t}\n}\nfunction rectsEqual(a, b) {\n\treturn a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\nif (ENABLE) {\n\tlet ensureRectFetchObserver = function() {\n\t\tif (rectFetchObserver) return rectFetchObserver;\n\t\trectFetchObserver = new IntersectionObserver((entries) => {\n\t\t\tlastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);\n\t\t\tfor (let i = 0; i < entries.length; i++) BoundingRects.set(entries[i].target, entries[i].boundingClientRect);\n\t\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout() && lastCallbackDelay > 50) console.warn(\"[onLayout-io-delay]\", lastCallbackDelay + \"ms\", entries.length, \"entries\");\n\t\t\tif (rectFetchResolve) {\n\t\t\t\trectFetchResolve(true);\n\t\t\t\trectFetchResolve = null;\n\t\t\t}\n\t\t}, { threshold: 0 });\n\t\treturn rectFetchObserver;\n\t}, scheduleLayoutFrame = function() {\n\t\tif (frameScheduled || Nodes.size === 0 || document.hidden) return;\n\t\tframeScheduled = true;\n\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\n\t};\n\tconst BoundingRects = /* @__PURE__ */ new WeakMap();\n\tlet rectFetchObserver = null;\n\tlet rectFetchResolve = null;\n\tlet rectFetchStartTime = 0;\n\tlet lastCallbackDelay = 0;\n\tasync function updateLayoutIfChanged(node) {\n\t\tif (typeof LayoutHandlers.get(node) !== \"function\") return;\n\t\tconst parentNode = node.parentElement;\n\t\tif (!parentNode) return;\n\t\tlet nodeRect;\n\t\tlet parentRect;\n\t\tnodeRect = BoundingRects.get(node);\n\t\tparentRect = BoundingRects.get(parentNode);\n\t\tif (!nodeRect || !parentRect) return;\n\t\temitLayoutIfChanged(node, parentNode, nodeRect, parentRect);\n\t}\n\tconst rAF = typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : void 0;\n\tconst userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;\n\tconst BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;\n\tconst MAX_SKIP_FRAMES = 20;\n\tlet skipFrames = BASE_SKIP_FRAMES;\n\tlet frameCount = 0;\n\tlet frameScheduled = false;\n\tasync function layoutOnAnimationFrame() {\n\t\tif (frameCount++ % skipFrames !== 0) {\n\t\t\tframeScheduled = false;\n\t\t\tscheduleLayoutFrame();\n\t\t\treturn;\n\t\t}\n\t\tif (frameCount >= Number.MAX_SAFE_INTEGER) frameCount = 0;\n\t\t{\n\t\t\tconst activeNodes = [];\n\t\t\tconst parentsToObserve = /* @__PURE__ */ new Set();\n\t\t\tfor (const node of Nodes) {\n\t\t\t\tconst parentElement = node.parentElement;\n\t\t\t\tif (!(parentElement instanceof HTMLElement)) {\n\t\t\t\t\tcleanupNode(node);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst disableKey = LayoutDisableKey.get(node);\n\t\t\t\tif (disableKey && DisableLayoutContextValues[disableKey] === true) continue;\n\t\t\t\tactiveNodes.push(node);\n\t\t\t\tparentsToObserve.add(parentElement);\n\t\t\t}\n\t\t\tif (activeNodes.length > 0) {\n\t\t\t\tconst io = ensureRectFetchObserver();\n\t\t\t\trectFetchStartTime = performance.now();\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) io.observe(activeNodes[i]);\n\t\t\t\tfor (const parent of parentsToObserve) io.observe(parent);\n\t\t\t\tawait new Promise((res) => {\n\t\t\t\t\trectFetchResolve = res;\n\t\t\t\t});\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) io.unobserve(activeNodes[i]);\n\t\t\t\tfor (const parent of parentsToObserve) io.unobserve(parent);\n\t\t\t\tif (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);\n\t\t\t\telse if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) updateLayoutIfChanged(activeNodes[i]);\n\t\t\t}\n\t\t}\n\t\tframeScheduled = false;\n\t\tscheduleLayoutFrame();\n\t}\n\tresumeLayoutLoop = scheduleLayoutFrame;\n\tmeasureOnNextFrame = () => {\n\t\tframeCount = 0;\n\t\tscheduleLayoutFrame();\n\t};\n\tdocument.addEventListener(\"visibilitychange\", scheduleLayoutFrame);\n\tscheduleLayoutFrame();\n}\nconst getElementLayoutEvent = (nodeRect, parentRect, node) => {\n\treturn {\n\t\tnativeEvent: {\n\t\t\tlayout: getRelativeDimensions(nodeRect, parentRect, node),\n\t\t\ttarget: nodeRect\n\t\t},\n\t\ttimeStamp: Date.now()\n\t};\n};\nconst getPreTransformDimensions = (node) => {\n\treturn {\n\t\twidth: node.offsetWidth,\n\t\theight: node.offsetHeight\n\t};\n};\nconst getRelativeDimensions = (a, b, aNode) => {\n\tconst { left, top } = a;\n\tconst x = left - b.left;\n\tconst y = top - b.top;\n\tconst { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {\n\t\twidth: a.width,\n\t\theight: a.height\n\t};\n\treturn {\n\t\tx,\n\t\ty,\n\t\twidth,\n\t\theight,\n\t\tpageX: a.left,\n\t\tpageY: a.top\n\t};\n};\nfunction emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {\n\tconst onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tconst cachedRect = NodeRectCache.get(node);\n\tconst cachedParentRect = NodeRectCache.get(parentNode);\n\tconst nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);\n\tconst parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);\n\tif (!nodeChanged && !parentChanged) return;\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tconst event = getElementLayoutEvent(nodeRect, parentRect, node);\n\tif (process.env.NODE_ENV === \"development\" && isDebugLayout()) console.log(\"[useElementLayout] change\", {\n\t\ttag: node.tagName,\n\t\tid: node.id || void 0,\n\t\tclassName: (node.className || \"\").slice(0, 60) || void 0,\n\t\tlayout: event.nativeEvent.layout,\n\t\tfirst: !cachedRect\n\t});\n\tif (avoidUpdates) queuedUpdates.set(node, () => onLayout(event));\n\telse onLayout(event);\n}\nfunction observeLayoutNode(node, disableKey) {\n\tNodes.add(node);\n\tif (disableKey) LayoutDisableKey.set(node, disableKey);\n\telse LayoutDisableKey.delete(node);\n\tresumeLayoutLoop?.();\n}\nfunction registerLayoutNode(node, onChange, disableKey) {\n\tLayoutHandlers.set(node, onChange);\n\tobserveLayoutNode(node, disableKey);\n\treturn () => cleanupNode(node);\n}\nfunction cleanupNode(node) {\n\tNodes.delete(node);\n\tLayoutHandlers.delete(node);\n\tLayoutDisableKey.delete(node);\n\tNodeRectCache.delete(node);\n}\nconst PrevHostNode = /* @__PURE__ */ new WeakMap();\nfunction emitLayoutSync(node) {\n\tconst onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tconst parentNode = node.parentElement;\n\tif (!parentNode) return;\n\tconst nodeRect = node.getBoundingClientRect();\n\tconst parentRect = parentNode.getBoundingClientRect();\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tonLayout(getElementLayoutEvent(nodeRect, parentRect, node));\n}\nfunction useElementLayout(ref, onLayout) {\n\tconst disableKey = useContext(DisableLayoutContextKey);\n\tconst node = ensureWebElement(ref.current?.host);\n\tif (node && onLayout) {\n\t\tLayoutHandlers.set(node, onLayout);\n\t\tLayoutDisableKey.set(node, disableKey);\n\t}\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!onLayout) return;\n\t\tconst nextNode = ensureWebElement(ref.current?.host);\n\t\tconst prevNode = PrevHostNode.get(ref);\n\t\tif (nextNode === prevNode) return;\n\t\tif (prevNode) cleanupNode(prevNode);\n\t\tPrevHostNode.set(ref, nextNode);\n\t\tif (!nextNode) return;\n\t\tLayoutHandlers.set(nextNode, onLayout);\n\t\tobserveLayoutNode(nextNode, disableKey);\n\t\temitLayoutSync(nextNode);\n\t});\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!onLayout) return;\n\t\tconst node2 = ref.current?.host;\n\t\tif (!node2) return;\n\t\tLayoutHandlers.set(node2, onLayout);\n\t\tobserveLayoutNode(node2, disableKey);\n\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout()) console.log(\"[useElementLayout] register\", {\n\t\t\ttag: node2.tagName,\n\t\t\tid: node2.id || void 0,\n\t\t\tclassName: (node2.className || \"\").slice(0, 60) || void 0,\n\t\t\ttotalNodes: Nodes.size\n\t\t});\n\t\treturn () => {\n\t\t\tcleanupNode(node2);\n\t\t\tconst swappedNode = PrevHostNode.get(ref);\n\t\t\tif (swappedNode && swappedNode !== node2) cleanupNode(swappedNode);\n\t\t\tPrevHostNode.delete(ref);\n\t\t};\n\t}, [ref, !!onLayout]);\n}\nfunction ensureWebElement(x) {\n\tif (typeof HTMLElement === \"undefined\") return;\n\treturn x instanceof HTMLElement ? x : void 0;\n}\nconst getBoundingClientRectAsync = (node) => {\n\treturn new Promise((res) => {\n\t\tif (!node || node.nodeType !== 1) return res(false);\n\t\tconst io = new IntersectionObserver((entries) => {\n\t\t\tio.disconnect();\n\t\t\treturn res(entries[0].boundingClientRect);\n\t\t}, { threshold: 0 });\n\t\tio.observe(node);\n\t});\n};\nconst measureNode = async (node, relativeTo) => {\n\tconst relativeNode = relativeTo || node?.parentElement;\n\tif (relativeNode instanceof HTMLElement) {\n\t\tconst [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);\n\t\tif (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);\n\t}\n\treturn null;\n};\nconst measure = async (node, callback) => {\n\tconst out = await measureNode(node, node.parentNode instanceof HTMLElement ? node.parentNode : null);\n\tif (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasure(node) {\n\treturn (callback) => measure(node, callback);\n}\nconst measureInWindow = async (node, callback) => {\n\tconst out = await measureNode(node, null);\n\tif (out) callback?.(out.pageX, out.pageY, out.width, out.height);\n\treturn out;\n};\nconst createMeasureInWindow = (node) => {\n\treturn (callback) => measureInWindow(node, callback);\n};\nconst measureLayout = async (node, relativeNode, callback) => {\n\tconst out = await measureNode(node, relativeNode);\n\tif (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasureLayout(node) {\n\treturn (relativeTo, callback) => measureLayout(node, relativeTo, callback);\n}\n\nexport { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };"],"mappings":";;;;;AAIA,MAAM,iCAAiC,IAAI,QAAQ;AACnD,MAAM,mCAAmC,IAAI,QAAQ;AACrD,MAAM,wBAAwB,IAAI,IAAI;AACtC,MAAM,kCAAkC,WAAW,oCAAoC,QAAQ,QAAQ,IAAI,kCAAkC;AAC7I,IAAI;AACJ,SAAS,gBAAgB;CACxB,IAAI,iBAAiB,KAAK,GAAG,eAAe,OAAO,WAAW,eAAe,IAAI,gBAAgB,OAAO,SAAS,MAAM,CAAC,CAAC,IAAI,mBAAmB;CAChJ,OAAO;AACR;AACA,MAAM,6BAA6B,CAAC;AACpC,MAAM,0BAA0B,cAAc,EAAE;AAChD,MAAM,SAAS,OAAO,yBAAyB;AAC/C,MAAM,+BAA+B,EAAE,SAAS,eAAe;CAC9D,MAAM,KAAK,MAAM;CACjB,gCAAgC;EAC/B,MAAM,cAAc,2BAA2B,QAAQ;EACvD,2BAA2B,MAAM;EACjC,IAAI,eAAe,CAAC,SAAS,qBAAqB;CACnD,GAAG,CAAC,SAAS,EAAE,CAAC;CAChB,OAAuB,oBAAI,wBAAwB,UAAU;EAC5D,OAAO;EACP;CACD,CAAC;AACF;AACA,IAAI;A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AAQ,IAAI,OAAO,IAAI,KAAK;CAC7E,OAAO;AACR;AACA,SAAS,oBAAoB,MAAM;CAClC,QAAQ,YAAY,aAAa,cAAc,MAAM,YAAY,QAAQ;AAC1E"}
1
+ {"version":3,"file":"index.js","names":[],"sources":["esm/index.js"],"sourcesContent":["import { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useId } from \"react\";\nimport { jsx } from \"react/jsx-runtime\";\n\nconst LayoutHandlers = /* @__PURE__ */ new WeakMap();\nconst LayoutDisableKey = /* @__PURE__ */ new WeakMap();\nconst Nodes = /* @__PURE__ */ new Set();\nconst NodeRectCache = /* @__PURE__ */ new WeakMap();\nconst PrevHostNode = /* @__PURE__ */ new WeakMap();\nconst usePretransformDimensions = () => globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === \"1\";\nconst isDebugLayout = () => typeof window !== \"undefined\" && window.location?.search?.includes(\"__tamaDebugLayout\");\nconst DisableLayoutContextValues = {};\nconst DisableLayoutContextKey = createContext(\"\");\nconst ENABLE = typeof IntersectionObserver !== \"undefined\";\nconst LayoutMeasurementController = ({ disable, children }) => {\n\tconst id = useId();\n\tuseIsomorphicLayoutEffect(() => {\n\t\tconst wasDisabled = DisableLayoutContextValues[id] === true;\n\t\tDisableLayoutContextValues[id] = disable;\n\t\tif (wasDisabled && !disable) measureOnNextFrame?.();\n\t}, [disable, id]);\n\treturn /* @__PURE__ */ jsx(DisableLayoutContextKey.Provider, {\n\t\tvalue: id,\n\t\tchildren\n\t});\n};\nlet resumeLayoutLoop;\nlet measureOnNextFrame;\nlet avoidUpdates = true;\nconst queuedUpdates = /* @__PURE__ */ new Map();\nfunction enable() {\n\tif (avoidUpdates) {\n\t\tavoidUpdates = false;\n\t\tif (queuedUpdates) {\n\t\t\tqueuedUpdates.forEach((cb) => cb());\n\t\t\tqueuedUpdates.clear();\n\t\t}\n\t}\n}\nfunction rectsEqual(a, b) {\n\treturn a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;\n}\nif (ENABLE) {\n\tlet ensureRectFetchObserver = function() {\n\t\tif (rectFetchObserver) return rectFetchObserver;\n\t\trectFetchObserver = new IntersectionObserver((entries) => {\n\t\t\tlastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);\n\t\t\tfor (let i = 0; i < entries.length; i++) BoundingRects.set(entries[i].target, entries[i].boundingClientRect);\n\t\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout() && lastCallbackDelay > 50) console.warn(\"[onLayout-io-delay]\", lastCallbackDelay + \"ms\", entries.length, \"entries\");\n\t\t\tif (rectFetchResolve) {\n\t\t\t\trectFetchResolve(true);\n\t\t\t\trectFetchResolve = null;\n\t\t\t}\n\t\t}, { threshold: 0 });\n\t\treturn rectFetchObserver;\n\t}, updateLayoutIfChanged = function(node) {\n\t\tif (typeof LayoutHandlers.get(node) !== \"function\") return;\n\t\tconst parentNode = node.parentElement;\n\t\tif (!parentNode) return;\n\t\tlet nodeRect;\n\t\tlet parentRect;\n\t\tnodeRect = BoundingRects.get(node);\n\t\tparentRect = BoundingRects.get(parentNode);\n\t\tif (!nodeRect || !parentRect) return;\n\t\temitLayoutIfChanged(node, parentNode, nodeRect, parentRect);\n\t}, scheduleLayoutFrame = function() {\n\t\tif (frameScheduled || Nodes.size === 0 || document.hidden) return;\n\t\tframeScheduled = true;\n\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\n\t};\n\tconst BoundingRects = /* @__PURE__ */ new WeakMap();\n\tlet rectFetchObserver = null;\n\tlet rectFetchResolve = null;\n\tlet rectFetchStartTime = 0;\n\tlet lastCallbackDelay = 0;\n\tconst rAF = typeof requestAnimationFrame !== \"undefined\" ? requestAnimationFrame : void 0;\n\tconst userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;\n\tconst BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;\n\tconst MAX_SKIP_FRAMES = 20;\n\tlet skipFrames = BASE_SKIP_FRAMES;\n\tlet frameCount = 0;\n\tlet frameScheduled = false;\n\tasync function layoutOnAnimationFrame() {\n\t\tif (frameCount++ % skipFrames !== 0) {\n\t\t\tframeScheduled = false;\n\t\t\tscheduleLayoutFrame();\n\t\t\treturn;\n\t\t}\n\t\tif (frameCount >= Number.MAX_SAFE_INTEGER) frameCount = 0;\n\t\t{\n\t\t\tconst activeNodes = [];\n\t\t\tconst parentsToObserve = /* @__PURE__ */ new Set();\n\t\t\tfor (const node of Nodes) {\n\t\t\t\tconst parentElement = node.parentElement;\n\t\t\t\tif (!(parentElement instanceof HTMLElement)) {\n\t\t\t\t\tcleanupNode(node);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tconst disableKey = LayoutDisableKey.get(node);\n\t\t\t\tif (disableKey && DisableLayoutContextValues[disableKey] === true) continue;\n\t\t\t\tactiveNodes.push(node);\n\t\t\t\tparentsToObserve.add(parentElement);\n\t\t\t}\n\t\t\tif (activeNodes.length > 0) {\n\t\t\t\tconst io = ensureRectFetchObserver();\n\t\t\t\trectFetchStartTime = performance.now();\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) io.observe(activeNodes[i]);\n\t\t\t\tfor (const parent of parentsToObserve) io.observe(parent);\n\t\t\t\tawait new Promise((res) => {\n\t\t\t\t\trectFetchResolve = res;\n\t\t\t\t});\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) io.unobserve(activeNodes[i]);\n\t\t\t\tfor (const parent of parentsToObserve) io.unobserve(parent);\n\t\t\t\tif (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);\n\t\t\t\telse if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);\n\t\t\t\tfor (let i = 0; i < activeNodes.length; i++) updateLayoutIfChanged(activeNodes[i]);\n\t\t\t}\n\t\t}\n\t\tframeScheduled = false;\n\t\tscheduleLayoutFrame();\n\t}\n\tresumeLayoutLoop = scheduleLayoutFrame;\n\tmeasureOnNextFrame = () => {\n\t\tframeCount = 0;\n\t\tscheduleLayoutFrame();\n\t};\n\tdocument.addEventListener(\"visibilitychange\", scheduleLayoutFrame);\n\tscheduleLayoutFrame();\n}\nconst getElementLayoutEvent = (nodeRect, parentRect, node) => ({\n\tnativeEvent: {\n\t\tlayout: getRelativeDimensions(nodeRect, parentRect, node),\n\t\ttarget: nodeRect\n\t},\n\ttimeStamp: Date.now()\n});\nconst getPreTransformDimensions = (node) => ({\n\twidth: node.offsetWidth,\n\theight: node.offsetHeight\n});\nconst getRelativeDimensions = (a, b, aNode) => {\n\tconst left = a.left - b.left;\n\tconst top = a.top - b.top;\n\tconst { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {\n\t\twidth: a.width,\n\t\theight: a.height\n\t};\n\treturn {\n\t\tx: left,\n\t\ty: top,\n\t\twidth,\n\t\theight,\n\t\tpageX: a.left,\n\t\tpageY: a.top\n\t};\n};\nfunction emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {\n\tconst onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tconst cachedRect = NodeRectCache.get(node);\n\tconst cachedParentRect = NodeRectCache.get(parentNode);\n\tconst nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);\n\tconst parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);\n\tif (!nodeChanged && !parentChanged) return;\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tconst event = getElementLayoutEvent(nodeRect, parentRect, node);\n\tif (avoidUpdates) queuedUpdates.set(node, () => onLayout(event));\n\telse onLayout(event);\n}\nfunction observeLayoutNode(node, disableKey) {\n\tNodes.add(node);\n\tif (disableKey) LayoutDisableKey.set(node, disableKey);\n\telse LayoutDisableKey.delete(node);\n\tresumeLayoutLoop?.();\n}\nfunction registerLayoutNode(node, onChange, disableKey) {\n\tLayoutHandlers.set(node, onChange);\n\tobserveLayoutNode(node, disableKey);\n\treturn () => cleanupNode(node);\n}\nfunction cleanupNode(node) {\n\tNodes.delete(node);\n\tLayoutHandlers.delete(node);\n\tLayoutDisableKey.delete(node);\n\tNodeRectCache.delete(node);\n}\nfunction emitLayoutSync(node) {\n\tconst onLayout = LayoutHandlers.get(node);\n\tif (typeof onLayout !== \"function\") return;\n\tconst parentNode = node.parentElement;\n\tif (!parentNode) return;\n\tconst nodeRect = node.getBoundingClientRect();\n\tconst parentRect = parentNode.getBoundingClientRect();\n\tNodeRectCache.set(node, nodeRect);\n\tNodeRectCache.set(parentNode, parentRect);\n\tonLayout(getElementLayoutEvent(nodeRect, parentRect, node));\n}\nfunction useElementLayout(ref, onLayout) {\n\tconst disableKey = useContext(DisableLayoutContextKey);\n\tconst node = ensureWebElement(ref.current?.host);\n\tif (node && onLayout) {\n\t\tLayoutHandlers.set(node, onLayout);\n\t\tLayoutDisableKey.set(node, disableKey);\n\t}\n\tuseIsomorphicLayoutEffect(() => {\n\t\tif (!onLayout) return;\n\t\tconst nextNode = ensureWebElement(ref.current?.host);\n\t\tconst prevNode = PrevHostNode.get(ref);\n\t\tif (nextNode !== prevNode) {\n\t\t\tif (prevNode) cleanupNode(prevNode);\n\t\t\tPrevHostNode.set(ref, nextNode);\n\t\t\tif (nextNode) {\n\t\t\t\tLayoutHandlers.set(nextNode, onLayout);\n\t\t\t\tobserveLayoutNode(nextNode, disableKey);\n\t\t\t\temitLayoutSync(nextNode);\n\t\t\t}\n\t\t}\n\t\treturn () => {\n\t\t\tconst activeNode = ensureWebElement(ref.current?.host);\n\t\t\tif (activeNode) cleanupNode(activeNode);\n\t\t\tconst swapped = PrevHostNode.get(ref);\n\t\t\tif (swapped && swapped !== activeNode) cleanupNode(swapped);\n\t\t\tPrevHostNode.delete(ref);\n\t\t};\n\t}, [ref, !!onLayout]);\n}\nfunction ensureWebElement(x) {\n\tif (typeof HTMLElement === \"undefined\") return void 0;\n\treturn x instanceof HTMLElement ? x : void 0;\n}\nconst getBoundingClientRectAsync = (node) => new Promise((res) => {\n\tif (!node || node.nodeType !== 1) return res(false);\n\tconst io = new IntersectionObserver((entries) => {\n\t\tio.disconnect();\n\t\tres(entries[0].boundingClientRect);\n\t});\n\tio.observe(node);\n});\nconst measureNode = async (node, relativeTo) => {\n\tconst relativeNode = relativeTo || node?.parentElement;\n\tif (relativeNode instanceof HTMLElement) {\n\t\tconst [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);\n\t\tif (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);\n\t}\n\treturn null;\n};\nconst measure = async (node, callback) => {\n\tconst out = await measureNode(node, node.parentElement);\n\tif (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nconst createMeasure = (node) => (callback) => measure(node, callback);\nconst measureInWindow = async (node, callback) => {\n\tconst out = await measureNode(node, null);\n\tif (out) callback?.(out.pageX, out.pageY, out.width, out.height);\n\treturn out;\n};\nconst createMeasureInWindow = (node) => (callback) => measureInWindow(node, callback);\nconst measureLayout = async (node, relativeNode, callback) => {\n\tconst out = await measureNode(node, relativeNode);\n\tif (out) callback?.(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nconst createMeasureLayout = (node) => (relativeTo, callback) => measureLayout(node, relativeTo, callback);\n\nexport { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };"],"mappings":";;;;;AAIA,MAAM,iCAAiC,IAAI,QAAQ;AACnD,MAAM,mCAAmC,IAAI,QAAQ;AACrD,MAAM,wBAAwB,IAAI,IAAI;AACtC,MAAM,gCAAgC,IAAI,QAAQ;AAClD,MAAM,+BAA+B,IAAI,QAAQ;AACjD,MAAM,kCAAkC,WAAW,oCAAoC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