@tamagui/use-element-layout 2.7.7 → 3.0.0-beta.643.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,"names":["useIsomorphicLayoutEffect","createContext","useContext","useId","jsx","LayoutHandlers","WeakMap","LayoutDisableKey","Nodes","Set","usePretransformDimensions","globalThis","__TAMAGUI_ONLAYOUT_PRETRANSFORM","process","env","TAMAGUI_ONLAYOUT_PRETRANSFORM","_debugLayout","isDebugLayout","window","URLSearchParams","location","search","has","DisableLayoutContextValues","DisableLayoutContextKey","ENABLE","IntersectionObserver","LayoutMeasurementController","disable","children","id","wasDisabled","measureOnNextFrame","Provider","value","strategy","resumeLayoutLoop","setOnLayoutStrategy","state","NodeRectCache","avoidUpdates","queuedUpdates","Map","enable","forEach","cb","clear","rectsEqual","a","b","x","y","width","height","ensureRectFetchObserver","rectFetchObserver","entries","lastCallbackDelay","Math","round","performance","now","rectFetchStartTime","i","length","BoundingRects","set","target","boundingClientRect","NODE_ENV","console","warn","rectFetchResolve","threshold","scheduleLayoutFrame","frameScheduled","size","document","hidden","rAF","layoutOnAnimationFrame","setTimeout","updateLayoutIfChanged","node","get","parentNode","parentElement","nodeRect","parentRect","getBoundingClientRect","emitLayoutIfChanged","requestAnimationFrame","userSkipVal","TAMAGUI_LAYOUT_FRAME_SKIP","BASE_SKIP_FRAMES","MAX_SKIP_FRAMES","skipFrames","frameCount","Number","MAX_SAFE_INTEGER","activeNodes","parentsToObserve","HTMLElement","cleanupNode","disableKey","push","add","io","observe","parent","Promise","res","unobserve","min","max","addEventListener","getElementLayoutEvent","nativeEvent","layout","getRelativeDimensions","timeStamp","Date","getPreTransformDimensions","offsetWidth","offsetHeight","aNode","left","top","pageX","pageY","onLayout","cachedRect","cachedParentRect","nodeChanged","parentChanged","event","log","tag","tagName","className","slice","first","observeLayoutNode","delete","registerLayoutNode","onChange","PrevHostNode","emitLayoutSync","useElementLayout","ref","ensureWebElement","current","host","nextNode","prevNode","node2","totalNodes","swappedNode","getBoundingClientRectAsync","nodeType","disconnect","measureNode","relativeTo","relativeNode","nodeDim","relativeNodeDim","all","measure","callback","out","createMeasure","measureInWindow","createMeasureInWindow","measureLayout","createMeasureLayout"],"sources":["index.mjs"],"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 strategy = \"async\";\nlet resumeLayoutLoop;\nlet measureOnNextFrame;\nfunction setOnLayoutStrategy(state) {\n\tstrategy = state;\n\tresumeLayoutLoop?.();\n}\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 || strategy === \"off\" || 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\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\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\tif (strategy !== \"off\") {\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, setOnLayoutStrategy, useElementLayout };"],"mappings":"AAAA,SAASA,yBAAyB,QAAQ,oBAAoB;AAC9D,SAASC,aAAa,EAAEC,UAAU,EAAEC,KAAK,QAAQ,OAAO;AACxD,SAASC,GAAG,QAAQ,mBAAmB;AAEvC,MAAMC,cAAc,GAAG,eAAgB,IAAIC,OAAO,CAAC,CAAC;AACpD,MAAMC,gBAAgB,GAAG,eAAgB,IAAID,OAAO,CAAC,CAAC;AACtD,MAAME,KAAK,GAAG,eAAgB,IAAIC,GAAG,CAAC,CAAC;AACvC,MAAMC,yBAAyB,GAAGA,CAAA,KAAMC,UAAU,CAACC,+BAA+B,KAAK,IAAI,IAAIC,OAAO,CAACC,GAAG,CAACC,6BAA6B,KAAK,GAAG;AAChJ,IAAIC,YAAY;AAChB,SAASC,aAAaA,CAAA,EAAG;EACxB,IAAID,YAAY,KAAK,KAAK,CAAC,EAAEA,YAA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AAmB,EAAEnI,MAAM,EAAEmH,0BAA0B,EAAE1C,qBAAqB,EAAEmD,OAAO,EAAEI,eAAe,EAAEE,aAAa,EAAEZ,WAAW,EAAEjB,kBAAkB,EAAE3G,mBAAmB,EAAE+G,gBAAgB","ignoreList":[]}
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 strategy = \"async\";\nlet resumeLayoutLoop;\nlet measureOnNextFrame;\nfunction setOnLayoutStrategy(state) {\n\tstrategy = state;\n\tresumeLayoutLoop?.();\n}\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 || strategy === \"off\" || 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\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\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\tif (strategy !== \"off\") {\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, setOnLayoutStrategy, 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,EAAE,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;E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