@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.
- package/dist/cjs/index.cjs +54 -89
- package/dist/cjs/index.native.cjs +44 -64
- package/dist/cjs/index.native.js +44 -64
- package/dist/cjs/index.native.js.map +1 -1
- package/dist/esm/index.js +53 -88
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.mjs +53 -88
- package/dist/esm/index.mjs.map +1 -1
- package/dist/esm/index.native.js +44 -64
- package/dist/esm/index.native.js.map +1 -1
- package/package.json +4 -4
- package/src/index.tsx +78 -244
- package/types/index.d.ts +6 -6
- package/types/index.d.ts.map +2 -2
package/dist/esm/index.mjs
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
|
-
|
|
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
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
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
|
|
151
|
-
const
|
|
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
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
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
|
-
|
|
249
|
-
|
|
250
|
-
|
|
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
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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.
|
|
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
|
-
|
|
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
|
-
|
|
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.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -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;AACJ,IAAI;AACJ,MAAM,gCAAgC,IAAI,QAAQ;AAClD,IAAI,eAAe;AACnB,MAAM,gCAAgC,IAAI,IAAI;AAC9C,SAAS,SA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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,QAAQ,QAAQ,IAAI,kCAAkC;AAC7I,MAAM,sBAAsB,OAAO,WAAW,eAAe,OAAO,UAAU,QAAQ,SAAS,mBAAmB;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;CACzC,IAAI,wBAAwB,aAAa;EACxC,MAAM,CAAC,SAAS,mBAAmB,MAAM,QAAQ,IAAI,CAAC,2BAA2B,IAAI,GAAG,2BAA2B,YAAY,CAAC,CAAC;EACjI,IAAI,mBAAmB,SAAS,OAAO,sBAAsB,SAAS,iBAAiB,IAAI;CAC5F;CACA,OAAO;AACR;AACA,MAAM,UAAU,OAAO,MAAM,aAAa;CACzC,MAAM,MAAM,MAAM,YAAY,MAAM,KAAK,aAAa;CACtD,IAAI,KAAK,WAAW,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,KAAK;CAC7E,OAAO;AACR;AACA,MAAM,iBAAiB,UAAU,aAAa,QAAQ,MAAM,QAAQ;AACpE,MAAM,kBAAkB,OAAO,MAAM,aAAa;CACjD,MAAM,MAAM,MAAM,YAAY,MAAM,IAAI;CACxC,IAAI,KAAK,WAAW,IAAI,OAAO,IAAI,OAAO,IAAI,OAAO,IAAI,MAAM;CAC/D,OAAO;AACR;AACA,MAAM,yBAAyB,UAAU,aAAa,gBAAgB,MAAM,QAAQ;AACpF,MAAM,gBAAgB,OAAO,MAAM,cAAc,aAAa;CAC7D,MAAM,MAAM,MAAM,YAAY,MAAM,YAAY;CAChD,IAAI,KAAK,WAAW,IAAI,GAAG,IAAI,GAAG,IAAI,OAAO,IAAI,QAAQ,IAAI,OAAO,IAAI,KAAK;CAC7E,OAAO;AACR;AACA,MAAM,uBAAuB,UAAU,YAAY,aAAa,cAAc,MAAM,YAAY,QAAQ"}
|
package/dist/esm/index.native.js
CHANGED
|
@@ -9,14 +9,15 @@ function _instanceof(left, right) {
|
|
|
9
9
|
var LayoutHandlers = /* @__PURE__ */ new WeakMap();
|
|
10
10
|
var LayoutDisableKey = /* @__PURE__ */ new WeakMap();
|
|
11
11
|
var Nodes = /* @__PURE__ */ new Set();
|
|
12
|
+
var NodeRectCache = /* @__PURE__ */ new WeakMap();
|
|
13
|
+
var PrevHostNode = /* @__PURE__ */ new WeakMap();
|
|
12
14
|
var usePretransformDimensions = function() {
|
|
13
15
|
return globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === "1";
|
|
14
16
|
};
|
|
15
|
-
var
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
}
|
|
17
|
+
var isDebugLayout = function() {
|
|
18
|
+
var _window_location_search, _window_location;
|
|
19
|
+
return 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"));
|
|
20
|
+
};
|
|
20
21
|
var DisableLayoutContextValues = {};
|
|
21
22
|
var DisableLayoutContextKey = /* @__PURE__ */ createContext("");
|
|
22
23
|
var ENABLE = false;
|
|
@@ -36,7 +37,6 @@ var LayoutMeasurementController = function(param) {
|
|
|
36
37
|
var strategy = "async";
|
|
37
38
|
var resumeLayoutLoop;
|
|
38
39
|
var measureOnNextFrame;
|
|
39
|
-
var NodeRectCache = /* @__PURE__ */ new WeakMap();
|
|
40
40
|
var avoidUpdates = true;
|
|
41
41
|
var queuedUpdates = /* @__PURE__ */ new Map();
|
|
42
42
|
function enable() {
|
|
@@ -66,17 +66,7 @@ if (ENABLE) {
|
|
|
66
66
|
}
|
|
67
67
|
}, { threshold: 0 });
|
|
68
68
|
return rectFetchObserver;
|
|
69
|
-
},
|
|
70
|
-
if (frameScheduled || strategy === "off" || Nodes.size === 0 || document.hidden) return;
|
|
71
|
-
frameScheduled = true;
|
|
72
|
-
rAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);
|
|
73
|
-
};
|
|
74
|
-
var BoundingRects = /* @__PURE__ */ new WeakMap();
|
|
75
|
-
var rectFetchObserver = null;
|
|
76
|
-
var rectFetchResolve = null;
|
|
77
|
-
var rectFetchStartTime = 0;
|
|
78
|
-
var lastCallbackDelay = 0;
|
|
79
|
-
async function updateLayoutIfChanged(node) {
|
|
69
|
+
}, updateLayoutIfChanged2 = function(node) {
|
|
80
70
|
if (typeof LayoutHandlers.get(node) !== "function") return;
|
|
81
71
|
var parentNode = node.parentElement;
|
|
82
72
|
if (!parentNode) return;
|
|
@@ -91,7 +81,16 @@ if (ENABLE) {
|
|
|
91
81
|
parentRect = parentNode.getBoundingClientRect();
|
|
92
82
|
}
|
|
93
83
|
emitLayoutIfChanged(node, parentNode, nodeRect, parentRect);
|
|
94
|
-
}
|
|
84
|
+
}, scheduleLayoutFrame2 = function() {
|
|
85
|
+
if (frameScheduled || strategy === "off" || Nodes.size === 0 || document.hidden) return;
|
|
86
|
+
frameScheduled = true;
|
|
87
|
+
rAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);
|
|
88
|
+
};
|
|
89
|
+
var BoundingRects = /* @__PURE__ */ new WeakMap();
|
|
90
|
+
var rectFetchObserver = null;
|
|
91
|
+
var rectFetchResolve = null;
|
|
92
|
+
var rectFetchStartTime = 0;
|
|
93
|
+
var lastCallbackDelay = 0;
|
|
95
94
|
var rAF = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : void 0;
|
|
96
95
|
var userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;
|
|
97
96
|
var BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;
|
|
@@ -175,7 +174,7 @@ if (ENABLE) {
|
|
|
175
174
|
}
|
|
176
175
|
if (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);
|
|
177
176
|
else if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);
|
|
178
|
-
for (var i2 = 0; i2 < activeNodes.length; i2++)
|
|
177
|
+
for (var i2 = 0; i2 < activeNodes.length; i2++) updateLayoutIfChanged2(activeNodes[i2]);
|
|
179
178
|
}
|
|
180
179
|
}
|
|
181
180
|
frameScheduled = false;
|
|
@@ -205,16 +204,15 @@ var getPreTransformDimensions = function(node) {
|
|
|
205
204
|
};
|
|
206
205
|
};
|
|
207
206
|
var getRelativeDimensions = function(a, b, aNode) {
|
|
208
|
-
var
|
|
209
|
-
var
|
|
210
|
-
var y = top - b.top;
|
|
207
|
+
var left = a.left - b.left;
|
|
208
|
+
var top = a.top - b.top;
|
|
211
209
|
var { width, height } = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {
|
|
212
210
|
width: a.width,
|
|
213
211
|
height: a.height
|
|
214
212
|
};
|
|
215
213
|
return {
|
|
216
|
-
x,
|
|
217
|
-
y,
|
|
214
|
+
x: left,
|
|
215
|
+
y: top,
|
|
218
216
|
width,
|
|
219
217
|
height,
|
|
220
218
|
pageX: a.left,
|
|
@@ -232,13 +230,6 @@ function emitLayoutIfChanged(node, parentNode, nodeRect, parentRect) {
|
|
|
232
230
|
NodeRectCache.set(node, nodeRect);
|
|
233
231
|
NodeRectCache.set(parentNode, parentRect);
|
|
234
232
|
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
235
|
-
if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] change", {
|
|
236
|
-
tag: node.tagName,
|
|
237
|
-
id: node.id || void 0,
|
|
238
|
-
className: (node.className || "").slice(0, 60) || void 0,
|
|
239
|
-
layout: event.nativeEvent.layout,
|
|
240
|
-
first: !cachedRect
|
|
241
|
-
});
|
|
242
233
|
if (avoidUpdates) queuedUpdates.set(node, function() {
|
|
243
234
|
return onLayout(event);
|
|
244
235
|
});
|
|
@@ -263,7 +254,6 @@ function cleanupNode(node) {
|
|
|
263
254
|
LayoutDisableKey.delete(node);
|
|
264
255
|
NodeRectCache.delete(node);
|
|
265
256
|
}
|
|
266
|
-
var PrevHostNode = /* @__PURE__ */ new WeakMap();
|
|
267
257
|
function emitLayoutSync(node) {
|
|
268
258
|
var onLayout = LayoutHandlers.get(node);
|
|
269
259
|
if (typeof onLayout !== "function") return;
|
|
@@ -288,37 +278,27 @@ function useElementLayout(ref, onLayout) {
|
|
|
288
278
|
if (!onLayout) return;
|
|
289
279
|
var nextNode = ensureWebElement((_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host);
|
|
290
280
|
var prevNode = PrevHostNode.get(ref);
|
|
291
|
-
if (nextNode
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
var _ref_current2;
|
|
301
|
-
if (!onLayout) return;
|
|
302
|
-
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
303
|
-
if (!node2) return;
|
|
304
|
-
LayoutHandlers.set(node2, onLayout);
|
|
305
|
-
observeLayoutNode(node2, disableKey);
|
|
306
|
-
if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] register", {
|
|
307
|
-
tag: node2.tagName,
|
|
308
|
-
id: node2.id || void 0,
|
|
309
|
-
className: (node2.className || "").slice(0, 60) || void 0,
|
|
310
|
-
totalNodes: Nodes.size
|
|
311
|
-
});
|
|
281
|
+
if (nextNode !== prevNode) {
|
|
282
|
+
if (prevNode) cleanupNode(prevNode);
|
|
283
|
+
PrevHostNode.set(ref, nextNode);
|
|
284
|
+
if (nextNode) {
|
|
285
|
+
LayoutHandlers.set(nextNode, onLayout);
|
|
286
|
+
observeLayoutNode(nextNode, disableKey);
|
|
287
|
+
emitLayoutSync(nextNode);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
312
290
|
return function() {
|
|
313
|
-
|
|
314
|
-
var
|
|
315
|
-
if (
|
|
291
|
+
var _ref_current3;
|
|
292
|
+
var activeNode = ensureWebElement((_ref_current3 = ref.current) === null || _ref_current3 === void 0 ? void 0 : _ref_current3.host);
|
|
293
|
+
if (activeNode) cleanupNode(activeNode);
|
|
294
|
+
var swapped = PrevHostNode.get(ref);
|
|
295
|
+
if (swapped && swapped !== activeNode) cleanupNode(swapped);
|
|
316
296
|
PrevHostNode.delete(ref);
|
|
317
297
|
};
|
|
318
298
|
}, [ref, !!onLayout]);
|
|
319
299
|
}
|
|
320
300
|
function ensureWebElement(x) {
|
|
321
|
-
if (typeof HTMLElement === "undefined") return;
|
|
301
|
+
if (typeof HTMLElement === "undefined") return void 0;
|
|
322
302
|
return _instanceof(x, HTMLElement) ? x : void 0;
|
|
323
303
|
}
|
|
324
304
|
var getBoundingClientRectAsync = function(node) {
|
|
@@ -326,8 +306,8 @@ var getBoundingClientRectAsync = function(node) {
|
|
|
326
306
|
if (!node || node.nodeType !== 1) return res(false);
|
|
327
307
|
var io = new IntersectionObserver(function(entries) {
|
|
328
308
|
io.disconnect();
|
|
329
|
-
|
|
330
|
-
}
|
|
309
|
+
res(entries[0].boundingClientRect);
|
|
310
|
+
});
|
|
331
311
|
io.observe(node);
|
|
332
312
|
});
|
|
333
313
|
};
|
|
@@ -340,15 +320,15 @@ var measureNode = async function(node, relativeTo) {
|
|
|
340
320
|
return null;
|
|
341
321
|
};
|
|
342
322
|
var measure = async function(node, callback) {
|
|
343
|
-
var out = await measureNode(node,
|
|
323
|
+
var out = await measureNode(node, node.parentElement);
|
|
344
324
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
345
325
|
return out;
|
|
346
326
|
};
|
|
347
|
-
|
|
327
|
+
var createMeasure = function(node) {
|
|
348
328
|
return function(callback) {
|
|
349
329
|
return measure(node, callback);
|
|
350
330
|
};
|
|
351
|
-
}
|
|
331
|
+
};
|
|
352
332
|
var measureInWindow = async function(node, callback) {
|
|
353
333
|
var out = await measureNode(node, null);
|
|
354
334
|
if (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);
|
|
@@ -364,11 +344,11 @@ var measureLayout = async function(node, relativeNode, callback) {
|
|
|
364
344
|
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
365
345
|
return out;
|
|
366
346
|
};
|
|
367
|
-
|
|
347
|
+
var createMeasureLayout = function(node) {
|
|
368
348
|
return function(relativeTo, callback) {
|
|
369
349
|
return measureLayout(node, relativeTo, callback);
|
|
370
350
|
};
|
|
371
|
-
}
|
|
351
|
+
};
|
|
372
352
|
|
|
373
353
|
export { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };
|
|
374
354
|
//# sourceMappingURL=index.native.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.native.js","names":[],"sources":["esm/index.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useId } from \"react\";\n\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__ */ createContext(\"\");\nvar ENABLE = false;\nvar LayoutMeasurementController = function(param) {\n\tvar { disable, children } = param;\n\tvar id = useId();\n\tuseIsomorphicLayoutEffect(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__ */ 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 = 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\tuseIsomorphicLayoutEffect(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\tuseIsomorphicLayoutEffect(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\nexport { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };"],"mappings":";;;;;AAIA,SAAS,YAAY,MAAM,OAAO;CACjC,IAAI,SAAS,QAAQ,OAAO,WAAW,eAAe,MAAM,OAAO,cAAc,OAAO,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,IAAI;MACnH,OAAO,gBAAgB;AAC7B;AACA,IAAI,iCAAiC,IAAI,QAAQ;AACjD,IAAI,mCAAmC,IAAI,QAAQ;AACnD,IAAI,wBAAwB,IAAI,IAAI;AACpC,IAAI,4BAA4B,WAAW;CAC1C,OAAO,WAAW,oCAAoC,QAAQ,QAAQ,IAAI,kCAAkC;AAC7G;AACA,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,IAAI,6BAA6B,CAAC;AAClC,IAAI,0BAA0C,8BAAc,EAAE;AAC9D,IAAI,SAAS;AACb,IAAI,8BAA8B,SAAS,OAAO;CACjD,IAAI,EAAE,SAAS,aAAa;CAC5B,IAAI,KAAK,MAAM;CACf,0BAA0B,WAAW;EACpC,IAAI,cAAc,2BAA2B,QAAQ;EACrD,2BAA2B,MAAM;EACjC,IAAI,eAAe,CAAC,SAAS,uBAAuB,QAAQ,uBAAuB,KAAK,KAAK,mBAA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CACpG,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,cAAc,MAAM;CAC5B,OAAO,SAAS,UAAU;EACzB,OAAO,QAAQ,MAAM,QAAQ;CAC9B;AACD;AACA,IAAI,kBAAkB,eAAe,MAAM,UAAU;CACpD,IAAI,MAAM,MAAM,YAAY,MAAM,IAAI;CACtC,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,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":["esm/index.native.js"],"sourcesContent":["import { jsx } from \"react/jsx-runtime\";\nimport { useIsomorphicLayoutEffect } from \"@tamagui/constants\";\nimport { createContext, useContext, useId } from \"react\";\n\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__ */ createContext(\"\");\nvar ENABLE = false;\nvar LayoutMeasurementController = function(param) {\n\tvar { disable, children } = param;\n\tvar id = useId();\n\tuseIsomorphicLayoutEffect(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__ */ 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 = 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\tuseIsomorphicLayoutEffect(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\nexport { LayoutMeasurementController, createMeasure, createMeasureInWindow, createMeasureLayout, enable, getBoundingClientRectAsync, getElementLayoutEvent, measure, measureInWindow, measureLayout, measureNode, registerLayoutNode, useElementLayout };"],"mappings":";;;;;AAIA,SAAS,YAAY,MAAM,OAAO;CACjC,IAAI,SAAS,QAAQ,OAAO,WAAW,eAAe,MAAM,OAAO,cAAc,OAAO,CAAC,CAAC,MAAM,OAAO,YAAY,CAAC,IAAI;MACnH,OAAO,gBAAgB;AAC7B;AACA,IAAI,iCAAiC,IAAI,QAAQ;AACjD,IAAI,mCAAmC,IAAI,QAAQ;AACnD,IAAI,wBAAwB,IAAI,IAAI;AACpC,IAAI,gCAAgC,IAAI,QAAQ;AAChD,IAAI,+BAA+B,IAAI,QAAQ;AAC/C,IAAI,4BAA4B,WAAW;CAC1C,OAAO,WAAW,oCAAoC,QAAQ,QAAQ,IAAI,kCAAkC;AAC7G;AACA,IAAI,gBAAgB,WAAW;CAC9B,IAAI,yBAAyB;CAC7B,OAAO,OAAO,WAAW,iBAAiB,mBAAmB,OAAO,cAAc,QAAQ,qBAAqB,KAAK,IAAI,KAAK,KAAK,0BAA0B,iBAAiB,YAAY,QAAQ,4BAA4B,KAAK,IAAI,KAAK,IAAI,wBAAwB,SAAS,mBAAmB;AACpS;AACA,IAAI,6BAA6B,CAAC;AAClC,IAAI,0BAA0C,8BAAc,EAAE;AAC9D,IAAI,SAAS;AACb,IAAI,8BAA8B,SAAS,OAAO;CACjD,IA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