@hanzogui/use-element-layout 2.0.0-rc.41-hanzoai.5
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/LICENSE +21 -0
- package/dist/cjs/index.cjs +363 -0
- package/dist/cjs/index.native.js +436 -0
- package/dist/cjs/index.native.js.map +1 -0
- package/dist/esm/index.js +325 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/index.mjs +325 -0
- package/dist/esm/index.mjs.map +1 -0
- package/dist/esm/index.native.js +395 -0
- package/dist/esm/index.native.js.map +1 -0
- package/package.json +47 -0
- package/src/index.tsx +597 -0
- package/types/index.d.ts +48 -0
- package/types/index.d.ts.map +11 -0
|
@@ -0,0 +1,436 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all) __defProp(target, name, {
|
|
9
|
+
get: all[name],
|
|
10
|
+
enumerable: true
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
16
|
+
get: () => from[key],
|
|
17
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toCommonJS = mod => __copyProps(__defProp({}, "__esModule", {
|
|
23
|
+
value: true
|
|
24
|
+
}), mod);
|
|
25
|
+
var index_exports = {};
|
|
26
|
+
__export(index_exports, {
|
|
27
|
+
LayoutMeasurementController: () => LayoutMeasurementController,
|
|
28
|
+
createMeasure: () => createMeasure,
|
|
29
|
+
createMeasureInWindow: () => createMeasureInWindow,
|
|
30
|
+
createMeasureLayout: () => createMeasureLayout,
|
|
31
|
+
enable: () => enable,
|
|
32
|
+
getBoundingClientRectAsync: () => getBoundingClientRectAsync,
|
|
33
|
+
getElementLayoutEvent: () => getElementLayoutEvent,
|
|
34
|
+
measure: () => measure,
|
|
35
|
+
measureInWindow: () => measureInWindow,
|
|
36
|
+
measureLayout: () => measureLayout,
|
|
37
|
+
measureNode: () => measureNode,
|
|
38
|
+
registerLayoutNode: () => registerLayoutNode,
|
|
39
|
+
setOnLayoutStrategy: () => setOnLayoutStrategy,
|
|
40
|
+
useElementLayout: () => useElementLayout
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(index_exports);
|
|
43
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
44
|
+
var import_constants = require("@hanzogui/constants");
|
|
45
|
+
var import_react = require("react");
|
|
46
|
+
function _instanceof(left, right) {
|
|
47
|
+
if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);else return left instanceof right;
|
|
48
|
+
}
|
|
49
|
+
var LayoutHandlers = /* @__PURE__ */new WeakMap();
|
|
50
|
+
var LayoutDisableKey = /* @__PURE__ */new WeakMap();
|
|
51
|
+
var Nodes = /* @__PURE__ */new Set();
|
|
52
|
+
var IntersectionState = /* @__PURE__ */new WeakMap();
|
|
53
|
+
var usePretransformDimensions = function () {
|
|
54
|
+
return globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === "1";
|
|
55
|
+
};
|
|
56
|
+
var _debugLayout;
|
|
57
|
+
function isDebugLayout() {
|
|
58
|
+
if (_debugLayout === void 0) _debugLayout = typeof window !== "undefined" && new URLSearchParams(window.location.search).has("__tamaDebugLayout");
|
|
59
|
+
return _debugLayout;
|
|
60
|
+
}
|
|
61
|
+
var DisableLayoutContextValues = {};
|
|
62
|
+
var DisableLayoutContextKey = /* @__PURE__ */(0, import_react.createContext)("");
|
|
63
|
+
var ENABLE = false;
|
|
64
|
+
var LayoutMeasurementController = function (param) {
|
|
65
|
+
var {
|
|
66
|
+
disable,
|
|
67
|
+
children
|
|
68
|
+
} = param;
|
|
69
|
+
var id = (0, import_react.useId)();
|
|
70
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
71
|
+
DisableLayoutContextValues[id] = disable;
|
|
72
|
+
}, [disable, id]);
|
|
73
|
+
return /* @__PURE__ */(0, import_jsx_runtime.jsx)(DisableLayoutContextKey.Provider, {
|
|
74
|
+
value: id,
|
|
75
|
+
children
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
var globalIntersectionObserver = null;
|
|
79
|
+
var strategy = "async";
|
|
80
|
+
function setOnLayoutStrategy(state) {
|
|
81
|
+
strategy = state;
|
|
82
|
+
}
|
|
83
|
+
var NodeRectCache = /* @__PURE__ */new WeakMap();
|
|
84
|
+
var avoidUpdates = true;
|
|
85
|
+
var queuedUpdates = /* @__PURE__ */new Map();
|
|
86
|
+
function enable() {
|
|
87
|
+
if (avoidUpdates) {
|
|
88
|
+
avoidUpdates = false;
|
|
89
|
+
if (queuedUpdates) {
|
|
90
|
+
queuedUpdates.forEach(function (cb) {
|
|
91
|
+
return cb();
|
|
92
|
+
});
|
|
93
|
+
queuedUpdates.clear();
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
function startGlobalObservers() {
|
|
98
|
+
if (!ENABLE || globalIntersectionObserver) return;
|
|
99
|
+
globalIntersectionObserver = new IntersectionObserver(function (entries) {
|
|
100
|
+
for (var i = 0; i < entries.length; i++) {
|
|
101
|
+
var entry = entries[i];
|
|
102
|
+
var node = entry.target;
|
|
103
|
+
if (IntersectionState.get(node) !== entry.isIntersecting) IntersectionState.set(node, entry.isIntersecting);
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
threshold: 0
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
function rectsEqual(a, b) {
|
|
110
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
111
|
+
}
|
|
112
|
+
if (ENABLE) {
|
|
113
|
+
let ensureRectFetchObserver = function () {
|
|
114
|
+
if (rectFetchObserver) return rectFetchObserver;
|
|
115
|
+
rectFetchObserver = new IntersectionObserver(function (entries) {
|
|
116
|
+
lastCallbackDelay = Math.round(performance.now() - rectFetchStartTime);
|
|
117
|
+
for (var i = 0; i < entries.length; i++) BoundingRects.set(entries[i].target, entries[i].boundingClientRect);
|
|
118
|
+
if (process.env.NODE_ENV === "development" && isDebugLayout() && lastCallbackDelay > 50) console.warn("[onLayout-io-delay]", lastCallbackDelay + "ms", entries.length, "entries");
|
|
119
|
+
if (rectFetchResolve) {
|
|
120
|
+
rectFetchResolve(true);
|
|
121
|
+
rectFetchResolve = null;
|
|
122
|
+
}
|
|
123
|
+
}, {
|
|
124
|
+
threshold: 0
|
|
125
|
+
});
|
|
126
|
+
return rectFetchObserver;
|
|
127
|
+
};
|
|
128
|
+
var BoundingRects = /* @__PURE__ */new WeakMap();
|
|
129
|
+
var rectFetchObserver = null;
|
|
130
|
+
var rectFetchResolve = null;
|
|
131
|
+
var rectFetchStartTime = 0;
|
|
132
|
+
var lastCallbackDelay = 0;
|
|
133
|
+
async function updateLayoutIfChanged(node) {
|
|
134
|
+
var onLayout = LayoutHandlers.get(node);
|
|
135
|
+
if (typeof onLayout !== "function") return;
|
|
136
|
+
var parentNode = node.parentElement;
|
|
137
|
+
if (!parentNode) return;
|
|
138
|
+
var nodeRect;
|
|
139
|
+
var parentRect;
|
|
140
|
+
if (strategy === "async") {
|
|
141
|
+
nodeRect = BoundingRects.get(node);
|
|
142
|
+
parentRect = BoundingRects.get(parentNode);
|
|
143
|
+
if (!nodeRect || !parentRect) return;
|
|
144
|
+
} else {
|
|
145
|
+
nodeRect = node.getBoundingClientRect();
|
|
146
|
+
parentRect = parentNode.getBoundingClientRect();
|
|
147
|
+
}
|
|
148
|
+
var cachedRect = NodeRectCache.get(node);
|
|
149
|
+
var cachedParentRect = NodeRectCache.get(parentNode);
|
|
150
|
+
var nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);
|
|
151
|
+
var parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);
|
|
152
|
+
if (nodeChanged || parentChanged) {
|
|
153
|
+
NodeRectCache.set(node, nodeRect);
|
|
154
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
155
|
+
var event = getElementLayoutEvent(nodeRect, parentRect, node);
|
|
156
|
+
if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] change", {
|
|
157
|
+
tag: node.tagName,
|
|
158
|
+
id: node.id || void 0,
|
|
159
|
+
className: (node.className || "").slice(0, 60) || void 0,
|
|
160
|
+
layout: event.nativeEvent.layout,
|
|
161
|
+
first: !cachedRect
|
|
162
|
+
});
|
|
163
|
+
if (avoidUpdates) queuedUpdates.set(node, function () {
|
|
164
|
+
return onLayout(event);
|
|
165
|
+
});else onLayout(event);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
var rAF = typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : void 0;
|
|
169
|
+
var userSkipVal = process.env.TAMAGUI_LAYOUT_FRAME_SKIP;
|
|
170
|
+
var BASE_SKIP_FRAMES = userSkipVal ? +userSkipVal : 10;
|
|
171
|
+
var MAX_SKIP_FRAMES = 20;
|
|
172
|
+
var skipFrames = BASE_SKIP_FRAMES;
|
|
173
|
+
var frameCount = 0;
|
|
174
|
+
async function layoutOnAnimationFrame() {
|
|
175
|
+
if (frameCount++ % skipFrames !== 0) {
|
|
176
|
+
rAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (frameCount >= Number.MAX_SAFE_INTEGER) frameCount = 0;
|
|
180
|
+
if (strategy !== "off") {
|
|
181
|
+
var visibleNodes = [];
|
|
182
|
+
var parentsToObserve = /* @__PURE__ */new Set();
|
|
183
|
+
var _iteratorNormalCompletion = true,
|
|
184
|
+
_didIteratorError = false,
|
|
185
|
+
_iteratorError = void 0;
|
|
186
|
+
try {
|
|
187
|
+
for (var _iterator = Nodes[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
188
|
+
var node = _step.value;
|
|
189
|
+
var parentElement = node.parentElement;
|
|
190
|
+
if (!_instanceof(parentElement, HTMLElement)) {
|
|
191
|
+
cleanupNode(node);
|
|
192
|
+
continue;
|
|
193
|
+
}
|
|
194
|
+
var disableKey = LayoutDisableKey.get(node);
|
|
195
|
+
if (disableKey && DisableLayoutContextValues[disableKey] === true) continue;
|
|
196
|
+
if (IntersectionState.get(node) === false) continue;
|
|
197
|
+
visibleNodes.push(node);
|
|
198
|
+
parentsToObserve.add(parentElement);
|
|
199
|
+
}
|
|
200
|
+
} catch (err) {
|
|
201
|
+
_didIteratorError = true;
|
|
202
|
+
_iteratorError = err;
|
|
203
|
+
} finally {
|
|
204
|
+
try {
|
|
205
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) _iterator.return();
|
|
206
|
+
} finally {
|
|
207
|
+
if (_didIteratorError) throw _iteratorError;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
if (visibleNodes.length > 0) {
|
|
211
|
+
var io = ensureRectFetchObserver();
|
|
212
|
+
rectFetchStartTime = performance.now();
|
|
213
|
+
for (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[i]);
|
|
214
|
+
var _iteratorNormalCompletion1 = true,
|
|
215
|
+
_didIteratorError1 = false,
|
|
216
|
+
_iteratorError1 = void 0;
|
|
217
|
+
try {
|
|
218
|
+
for (var _iterator1 = parentsToObserve[Symbol.iterator](), _step1; !(_iteratorNormalCompletion1 = (_step1 = _iterator1.next()).done); _iteratorNormalCompletion1 = true) {
|
|
219
|
+
var parent = _step1.value;
|
|
220
|
+
io.observe(parent);
|
|
221
|
+
}
|
|
222
|
+
} catch (err) {
|
|
223
|
+
_didIteratorError1 = true;
|
|
224
|
+
_iteratorError1 = err;
|
|
225
|
+
} finally {
|
|
226
|
+
try {
|
|
227
|
+
if (!_iteratorNormalCompletion1 && _iterator1.return != null) _iterator1.return();
|
|
228
|
+
} finally {
|
|
229
|
+
if (_didIteratorError1) throw _iteratorError1;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
await new Promise(function (res) {
|
|
233
|
+
rectFetchResolve = res;
|
|
234
|
+
});
|
|
235
|
+
for (var i1 = 0; i1 < visibleNodes.length; i1++) io.unobserve(visibleNodes[i1]);
|
|
236
|
+
var _iteratorNormalCompletion2 = true,
|
|
237
|
+
_didIteratorError2 = false,
|
|
238
|
+
_iteratorError2 = void 0;
|
|
239
|
+
try {
|
|
240
|
+
for (var _iterator2 = parentsToObserve[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
241
|
+
var parent1 = _step2.value;
|
|
242
|
+
io.unobserve(parent1);
|
|
243
|
+
}
|
|
244
|
+
} catch (err) {
|
|
245
|
+
_didIteratorError2 = true;
|
|
246
|
+
_iteratorError2 = err;
|
|
247
|
+
} finally {
|
|
248
|
+
try {
|
|
249
|
+
if (!_iteratorNormalCompletion2 && _iterator2.return != null) _iterator2.return();
|
|
250
|
+
} finally {
|
|
251
|
+
if (_didIteratorError2) throw _iteratorError2;
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
if (lastCallbackDelay > 50) skipFrames = Math.min(skipFrames + 2, MAX_SKIP_FRAMES);else if (lastCallbackDelay < 20) skipFrames = Math.max(skipFrames - 1, BASE_SKIP_FRAMES);
|
|
255
|
+
for (var i2 = 0; i2 < visibleNodes.length; i2++) updateLayoutIfChanged(visibleNodes[i2]);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
rAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);
|
|
259
|
+
}
|
|
260
|
+
layoutOnAnimationFrame();
|
|
261
|
+
}
|
|
262
|
+
var getElementLayoutEvent = function (nodeRect, parentRect, node) {
|
|
263
|
+
return {
|
|
264
|
+
nativeEvent: {
|
|
265
|
+
layout: getRelativeDimensions(nodeRect, parentRect, node),
|
|
266
|
+
target: nodeRect
|
|
267
|
+
},
|
|
268
|
+
timeStamp: Date.now()
|
|
269
|
+
};
|
|
270
|
+
};
|
|
271
|
+
var getPreTransformDimensions = function (node) {
|
|
272
|
+
return {
|
|
273
|
+
width: node.offsetWidth,
|
|
274
|
+
height: node.offsetHeight
|
|
275
|
+
};
|
|
276
|
+
};
|
|
277
|
+
var getRelativeDimensions = function (a, b, aNode) {
|
|
278
|
+
var {
|
|
279
|
+
left,
|
|
280
|
+
top
|
|
281
|
+
} = a;
|
|
282
|
+
var x = left - b.left;
|
|
283
|
+
var y = top - b.top;
|
|
284
|
+
var {
|
|
285
|
+
width,
|
|
286
|
+
height
|
|
287
|
+
} = usePretransformDimensions() && aNode ? getPreTransformDimensions(aNode) : {
|
|
288
|
+
width: a.width,
|
|
289
|
+
height: a.height
|
|
290
|
+
};
|
|
291
|
+
return {
|
|
292
|
+
x,
|
|
293
|
+
y,
|
|
294
|
+
width,
|
|
295
|
+
height,
|
|
296
|
+
pageX: a.left,
|
|
297
|
+
pageY: a.top
|
|
298
|
+
};
|
|
299
|
+
};
|
|
300
|
+
function registerLayoutNode(node, onChange, disableKey) {
|
|
301
|
+
Nodes.add(node);
|
|
302
|
+
LayoutHandlers.set(node, onChange);
|
|
303
|
+
if (disableKey) LayoutDisableKey.set(node, disableKey);
|
|
304
|
+
startGlobalObservers();
|
|
305
|
+
if (globalIntersectionObserver) {
|
|
306
|
+
globalIntersectionObserver.observe(node);
|
|
307
|
+
IntersectionState.set(node, true);
|
|
308
|
+
}
|
|
309
|
+
return function () {
|
|
310
|
+
return cleanupNode(node);
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
function cleanupNode(node) {
|
|
314
|
+
Nodes.delete(node);
|
|
315
|
+
LayoutHandlers.delete(node);
|
|
316
|
+
LayoutDisableKey.delete(node);
|
|
317
|
+
NodeRectCache.delete(node);
|
|
318
|
+
IntersectionState.delete(node);
|
|
319
|
+
if (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);
|
|
320
|
+
}
|
|
321
|
+
var PrevHostNode = /* @__PURE__ */new WeakMap();
|
|
322
|
+
function useElementLayout(ref, onLayout) {
|
|
323
|
+
var _ref_current;
|
|
324
|
+
var disableKey = (0, import_react.useContext)(DisableLayoutContextKey);
|
|
325
|
+
var node = ensureWebElement((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.host);
|
|
326
|
+
if (node && onLayout) {
|
|
327
|
+
LayoutHandlers.set(node, onLayout);
|
|
328
|
+
LayoutDisableKey.set(node, disableKey);
|
|
329
|
+
}
|
|
330
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
331
|
+
var _ref_current2;
|
|
332
|
+
if (!onLayout) return;
|
|
333
|
+
var nextNode = ensureWebElement((_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host);
|
|
334
|
+
var prevNode = PrevHostNode.get(ref);
|
|
335
|
+
if (nextNode === prevNode) return;
|
|
336
|
+
if (prevNode) cleanupNode(prevNode);
|
|
337
|
+
PrevHostNode.set(ref, nextNode);
|
|
338
|
+
if (!nextNode) return;
|
|
339
|
+
Nodes.add(nextNode);
|
|
340
|
+
startGlobalObservers();
|
|
341
|
+
if (globalIntersectionObserver) {
|
|
342
|
+
globalIntersectionObserver.observe(nextNode);
|
|
343
|
+
IntersectionState.set(nextNode, true);
|
|
344
|
+
}
|
|
345
|
+
var handler = LayoutHandlers.get(nextNode);
|
|
346
|
+
if (typeof handler !== "function") return;
|
|
347
|
+
var parentNode = nextNode.parentElement;
|
|
348
|
+
if (!parentNode) return;
|
|
349
|
+
var nodeRect = nextNode.getBoundingClientRect();
|
|
350
|
+
var parentRect = parentNode.getBoundingClientRect();
|
|
351
|
+
NodeRectCache.set(nextNode, nodeRect);
|
|
352
|
+
NodeRectCache.set(parentNode, parentRect);
|
|
353
|
+
handler(getElementLayoutEvent(nodeRect, parentRect, nextNode));
|
|
354
|
+
});
|
|
355
|
+
(0, import_constants.useIsomorphicLayoutEffect)(function () {
|
|
356
|
+
var _ref_current2;
|
|
357
|
+
if (!onLayout) return;
|
|
358
|
+
var node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;
|
|
359
|
+
if (!node2) return;
|
|
360
|
+
Nodes.add(node2);
|
|
361
|
+
startGlobalObservers();
|
|
362
|
+
if (globalIntersectionObserver) {
|
|
363
|
+
globalIntersectionObserver.observe(node2);
|
|
364
|
+
IntersectionState.set(node2, true);
|
|
365
|
+
}
|
|
366
|
+
if (process.env.NODE_ENV === "development" && isDebugLayout()) console.log("[useElementLayout] register", {
|
|
367
|
+
tag: node2.tagName,
|
|
368
|
+
id: node2.id || void 0,
|
|
369
|
+
className: (node2.className || "").slice(0, 60) || void 0,
|
|
370
|
+
totalNodes: Nodes.size
|
|
371
|
+
});
|
|
372
|
+
var parentNode = node2.parentNode;
|
|
373
|
+
if (parentNode) onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect(), node2));
|
|
374
|
+
return function () {
|
|
375
|
+
cleanupNode(node2);
|
|
376
|
+
var swappedNode = PrevHostNode.get(ref);
|
|
377
|
+
if (swappedNode && swappedNode !== node2) cleanupNode(swappedNode);
|
|
378
|
+
PrevHostNode.delete(ref);
|
|
379
|
+
};
|
|
380
|
+
}, [ref, !!onLayout]);
|
|
381
|
+
}
|
|
382
|
+
function ensureWebElement(x) {
|
|
383
|
+
if (typeof HTMLElement === "undefined") return;
|
|
384
|
+
return _instanceof(x, HTMLElement) ? x : void 0;
|
|
385
|
+
}
|
|
386
|
+
var getBoundingClientRectAsync = function (node) {
|
|
387
|
+
return new Promise(function (res) {
|
|
388
|
+
if (!node || node.nodeType !== 1) return res(false);
|
|
389
|
+
var io = new IntersectionObserver(function (entries) {
|
|
390
|
+
io.disconnect();
|
|
391
|
+
return res(entries[0].boundingClientRect);
|
|
392
|
+
}, {
|
|
393
|
+
threshold: 0
|
|
394
|
+
});
|
|
395
|
+
io.observe(node);
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
var measureNode = async function (node, relativeTo) {
|
|
399
|
+
var relativeNode = relativeTo || (node === null || node === void 0 ? void 0 : node.parentElement);
|
|
400
|
+
if (_instanceof(relativeNode, HTMLElement)) {
|
|
401
|
+
var [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);
|
|
402
|
+
if (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);
|
|
403
|
+
}
|
|
404
|
+
return null;
|
|
405
|
+
};
|
|
406
|
+
var measure = async function (node, callback) {
|
|
407
|
+
var out = await measureNode(node, _instanceof(node.parentNode, HTMLElement) ? node.parentNode : null);
|
|
408
|
+
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
409
|
+
return out;
|
|
410
|
+
};
|
|
411
|
+
function createMeasure(node) {
|
|
412
|
+
return function (callback) {
|
|
413
|
+
return measure(node, callback);
|
|
414
|
+
};
|
|
415
|
+
}
|
|
416
|
+
var measureInWindow = async function (node, callback) {
|
|
417
|
+
var out = await measureNode(node, null);
|
|
418
|
+
if (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);
|
|
419
|
+
return out;
|
|
420
|
+
};
|
|
421
|
+
var createMeasureInWindow = function (node) {
|
|
422
|
+
return function (callback) {
|
|
423
|
+
return measureInWindow(node, callback);
|
|
424
|
+
};
|
|
425
|
+
};
|
|
426
|
+
var measureLayout = async function (node, relativeNode, callback) {
|
|
427
|
+
var out = await measureNode(node, relativeNode);
|
|
428
|
+
if (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);
|
|
429
|
+
return out;
|
|
430
|
+
};
|
|
431
|
+
function createMeasureLayout(node) {
|
|
432
|
+
return function (relativeTo, callback) {
|
|
433
|
+
return measureLayout(node, relativeTo, callback);
|
|
434
|
+
};
|
|
435
|
+
}
|
|
436
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["__defProp","Object","defineProperty","__getOwnPropDesc","getOwnPropertyDescriptor","__getOwnPropNames","getOwnPropertyNames","__hasOwnProp","prototype","hasOwnProperty","__export","target","all","name","get","enumerable","__copyProps","to","from","except","desc","key","call","__toCommonJS","mod","value","index_exports","LayoutMeasurementController","createMeasure","createMeasureInWindow","createMeasureLayout","enable","getBoundingClientRectAsync","getElementLayoutEvent","measure","measureInWindow","measureLayout","measureNode","registerLayoutNode","setOnLayoutStrategy","useElementLayout","module","exports","import_jsx_runtime","require","import_constants","import_react","_instanceof","left","right","Symbol","hasInstance","LayoutHandlers","WeakMap","LayoutDisableKey","Nodes","Set","IntersectionState","usePretransformDimensions","globalThis","__TAMAGUI_ONLAYOUT_PRETRANSFORM","process","env","TAMAGUI_ONLAYOUT_PRETRANSFORM","_debugLayout","isDebugLayout","window","URLSearchParams","location","search","has","DisableLayoutContextValues","DisableLayoutContextKey","createContext","ENABLE","param","disable","children","id","useId","useIsomorphicLayoutEffect","jsx","Provider","globalIntersectionObserver","strategy","state","NodeRectCache","avoidUpdates","queuedUpdates","Map","forEach","cb","clear","startGlobalObservers","IntersectionObserver","entries","i","length","entry","node","isIntersecting","set","threshold","rectsEqual","a","b","x","y","width","height","ensureRectFetchObserver","rectFetchObserver","lastCallbackDelay","Math","round","performance","now","rectFetchStartTime","BoundingRects","boundingClientRect","NODE_ENV","console","warn","rectFetchResolve","updateLayoutIfChanged","onLayout","parentNode","parentElement","nodeRect","parentRect","getBoundingClientRect","cachedRect","cachedParentRect","nodeChanged","parentChanged","event","log","tag","tagName","className","slice","layout","nativeEvent","first","rAF","requestAnimationFrame","userSkipVal","TAMAGUI_LAYOUT_FRAME_SKIP","BASE_SKIP_FRAMES","MAX_SKIP_FRAMES","skipFrames","frameCount","layoutOnAnimationFrame","setTimeout","Number","MAX_SAFE_INTEGER","visibleNodes","parentsToObserve","_iteratorNormalCompletion","_didIteratorError","_iteratorError","_iterator","iterator","_step","next","done","HTMLElement","cleanupNode","disableKey","push","add","err","return","io","observe","_iteratorNormalCompletion1","_didIteratorError1","_iteratorError1","_iterator1","_step1","parent","Promise","res","i1","unobserve","_iteratorNormalCompletion2","_didIteratorError2","_iteratorError2","_iterator2","_step2","parent1","min","max","i2","getRelativeDimensions","timeStamp","Date","getPreTransformDimensions","offsetWidth","offsetHeight","aNode","top","pageX","pageY","onChange","delete","PrevHostNode","ref","_ref_current","useContext","ensureWebElement","current","host","_ref_current2","nextNode","prevNode","handler","node2","totalNodes","size","swappedNode","nodeType","disconnect","relativeTo","relativeNode","nodeDim","relativeNodeDim","callback","out"],"sources":["index.native.js"],"sourcesContent":["\"use strict\";\nvar __defProp = Object.defineProperty;\nvar __getOwnPropDesc = Object.getOwnPropertyDescriptor;\nvar __getOwnPropNames = Object.getOwnPropertyNames;\nvar __hasOwnProp = Object.prototype.hasOwnProperty;\nvar __export = (target, all) => {\n\tfor (var name in all) __defProp(target, name, {\n\t\tget: all[name],\n\t\tenumerable: true\n\t});\n};\nvar __copyProps = (to, from, except, desc) => {\n\tif (from && typeof from === \"object\" || typeof from === \"function\") {\n\t\tfor (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {\n\t\t\tget: () => from[key],\n\t\t\tenumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable\n\t\t});\n\t}\n\treturn to;\n};\nvar __toCommonJS = (mod) => __copyProps(__defProp({}, \"__esModule\", { value: true }), mod);\nvar index_exports = {};\n__export(index_exports, {\n\tLayoutMeasurementController: () => LayoutMeasurementController,\n\tcreateMeasure: () => createMeasure,\n\tcreateMeasureInWindow: () => createMeasureInWindow,\n\tcreateMeasureLayout: () => createMeasureLayout,\n\tenable: () => enable,\n\tgetBoundingClientRectAsync: () => getBoundingClientRectAsync,\n\tgetElementLayoutEvent: () => getElementLayoutEvent,\n\tmeasure: () => measure,\n\tmeasureInWindow: () => measureInWindow,\n\tmeasureLayout: () => measureLayout,\n\tmeasureNode: () => measureNode,\n\tregisterLayoutNode: () => registerLayoutNode,\n\tsetOnLayoutStrategy: () => setOnLayoutStrategy,\n\tuseElementLayout: () => useElementLayout\n});\nmodule.exports = __toCommonJS(index_exports);\nvar import_jsx_runtime = require(\"react/jsx-runtime\");\nvar import_constants = require(\"@hanzogui/constants\");\nvar import_react = require(\"react\");\nfunction _instanceof(left, right) {\n\tif (right != null && typeof Symbol !== \"undefined\" && right[Symbol.hasInstance]) return !!right[Symbol.hasInstance](left);\n\telse return left instanceof right;\n}\nvar LayoutHandlers = /* @__PURE__ */ new WeakMap();\nvar LayoutDisableKey = /* @__PURE__ */ new WeakMap();\nvar Nodes = /* @__PURE__ */ new Set();\nvar IntersectionState = /* @__PURE__ */ new WeakMap();\nvar usePretransformDimensions = function() {\n\treturn globalThis.__TAMAGUI_ONLAYOUT_PRETRANSFORM === true || process.env.TAMAGUI_ONLAYOUT_PRETRANSFORM === \"1\";\n};\nvar _debugLayout;\nfunction isDebugLayout() {\n\tif (_debugLayout === void 0) _debugLayout = typeof window !== \"undefined\" && new URLSearchParams(window.location.search).has(\"__tamaDebugLayout\");\n\treturn _debugLayout;\n}\nvar DisableLayoutContextValues = {};\nvar DisableLayoutContextKey = /* @__PURE__ */ (0, import_react.createContext)(\"\");\nvar ENABLE = false;\nvar LayoutMeasurementController = function(param) {\n\tvar { disable, children } = param;\n\tvar id = (0, import_react.useId)();\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tDisableLayoutContextValues[id] = disable;\n\t}, [disable, id]);\n\treturn /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DisableLayoutContextKey.Provider, {\n\t\tvalue: id,\n\t\tchildren\n\t});\n};\nvar globalIntersectionObserver = null;\nvar strategy = \"async\";\nfunction setOnLayoutStrategy(state) {\n\tstrategy = state;\n}\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 startGlobalObservers() {\n\tif (!ENABLE || globalIntersectionObserver) return;\n\tglobalIntersectionObserver = new IntersectionObserver(function(entries) {\n\t\tfor (var i = 0; i < entries.length; i++) {\n\t\t\tvar entry = entries[i];\n\t\t\tvar node = entry.target;\n\t\t\tif (IntersectionState.get(node) !== entry.isIntersecting) IntersectionState.set(node, entry.isIntersecting);\n\t\t}\n\t}, { threshold: 0 });\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(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};\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\tvar onLayout = LayoutHandlers.get(node);\n\t\tif (typeof onLayout !== \"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\tvar cachedRect = NodeRectCache.get(node);\n\t\tvar cachedParentRect = NodeRectCache.get(parentNode);\n\t\tvar nodeChanged = !cachedRect || !rectsEqual(cachedRect, nodeRect);\n\t\tvar parentChanged = !cachedParentRect || !rectsEqual(cachedParentRect, parentRect);\n\t\tif (nodeChanged || parentChanged) {\n\t\t\tNodeRectCache.set(node, nodeRect);\n\t\t\tNodeRectCache.set(parentNode, parentRect);\n\t\t\tvar event = getElementLayoutEvent(nodeRect, parentRect, node);\n\t\t\tif (process.env.NODE_ENV === \"development\" && isDebugLayout()) console.log(\"[useElementLayout] change\", {\n\t\t\t\ttag: node.tagName,\n\t\t\t\tid: node.id || void 0,\n\t\t\t\tclassName: (node.className || \"\").slice(0, 60) || void 0,\n\t\t\t\tlayout: event.nativeEvent.layout,\n\t\t\t\tfirst: !cachedRect\n\t\t\t});\n\t\t\tif (avoidUpdates) queuedUpdates.set(node, function() {\n\t\t\t\treturn onLayout(event);\n\t\t\t});\n\t\t\telse onLayout(event);\n\t\t}\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\tasync function layoutOnAnimationFrame() {\n\t\tif (frameCount++ % skipFrames !== 0) {\n\t\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\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 visibleNodes = [];\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\tif (IntersectionState.get(node) === false) continue;\n\t\t\t\t\tvisibleNodes.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 (visibleNodes.length > 0) {\n\t\t\t\tvar io = ensureRectFetchObserver();\n\t\t\t\trectFetchStartTime = performance.now();\n\t\t\t\tfor (var i = 0; i < visibleNodes.length; i++) io.observe(visibleNodes[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 < visibleNodes.length; i1++) io.unobserve(visibleNodes[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 < visibleNodes.length; i2++) updateLayoutIfChanged(visibleNodes[i2]);\n\t\t\t}\n\t\t}\n\t\trAF ? rAF(layoutOnAnimationFrame) : setTimeout(layoutOnAnimationFrame, 16);\n\t}\n\tlayoutOnAnimationFrame();\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 registerLayoutNode(node, onChange, disableKey) {\n\tNodes.add(node);\n\tLayoutHandlers.set(node, onChange);\n\tif (disableKey) LayoutDisableKey.set(node, disableKey);\n\tstartGlobalObservers();\n\tif (globalIntersectionObserver) {\n\t\tglobalIntersectionObserver.observe(node);\n\t\tIntersectionState.set(node, true);\n\t}\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\tIntersectionState.delete(node);\n\tif (globalIntersectionObserver) globalIntersectionObserver.unobserve(node);\n}\nvar PrevHostNode = /* @__PURE__ */ new WeakMap();\nfunction useElementLayout(ref, onLayout) {\n\tvar _ref_current;\n\tvar disableKey = (0, import_react.useContext)(DisableLayoutContextKey);\n\tvar node = ensureWebElement((_ref_current = ref.current) === null || _ref_current === void 0 ? void 0 : _ref_current.host);\n\tif (node && onLayout) {\n\t\tLayoutHandlers.set(node, onLayout);\n\t\tLayoutDisableKey.set(node, disableKey);\n\t}\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar _ref_current2;\n\t\tif (!onLayout) return;\n\t\tvar nextNode = ensureWebElement((_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host);\n\t\tvar prevNode = PrevHostNode.get(ref);\n\t\tif (nextNode === prevNode) return;\n\t\tif (prevNode) cleanupNode(prevNode);\n\t\tPrevHostNode.set(ref, nextNode);\n\t\tif (!nextNode) return;\n\t\tNodes.add(nextNode);\n\t\tstartGlobalObservers();\n\t\tif (globalIntersectionObserver) {\n\t\t\tglobalIntersectionObserver.observe(nextNode);\n\t\t\tIntersectionState.set(nextNode, true);\n\t\t}\n\t\tvar handler = LayoutHandlers.get(nextNode);\n\t\tif (typeof handler !== \"function\") return;\n\t\tvar parentNode = nextNode.parentElement;\n\t\tif (!parentNode) return;\n\t\tvar nodeRect = nextNode.getBoundingClientRect();\n\t\tvar parentRect = parentNode.getBoundingClientRect();\n\t\tNodeRectCache.set(nextNode, nodeRect);\n\t\tNodeRectCache.set(parentNode, parentRect);\n\t\thandler(getElementLayoutEvent(nodeRect, parentRect, nextNode));\n\t});\n\t(0, import_constants.useIsomorphicLayoutEffect)(function() {\n\t\tvar _ref_current2;\n\t\tif (!onLayout) return;\n\t\tvar node2 = (_ref_current2 = ref.current) === null || _ref_current2 === void 0 ? void 0 : _ref_current2.host;\n\t\tif (!node2) return;\n\t\tNodes.add(node2);\n\t\tstartGlobalObservers();\n\t\tif (globalIntersectionObserver) {\n\t\t\tglobalIntersectionObserver.observe(node2);\n\t\t\tIntersectionState.set(node2, true);\n\t\t}\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\tvar parentNode = node2.parentNode;\n\t\tif (parentNode) onLayout(getElementLayoutEvent(node2.getBoundingClientRect(), parentNode.getBoundingClientRect(), node2));\n\t\treturn function() {\n\t\t\tcleanupNode(node2);\n\t\t\tvar swappedNode = PrevHostNode.get(ref);\n\t\t\tif (swappedNode && swappedNode !== node2) cleanupNode(swappedNode);\n\t\t\tPrevHostNode.delete(ref);\n\t\t};\n\t}, [ref, !!onLayout]);\n}\nfunction ensureWebElement(x) {\n\tif (typeof HTMLElement === \"undefined\") return;\n\treturn _instanceof(x, HTMLElement) ? x : void 0;\n}\nvar getBoundingClientRectAsync = function(node) {\n\treturn new Promise(function(res) {\n\t\tif (!node || node.nodeType !== 1) return res(false);\n\t\tvar io = new IntersectionObserver(function(entries) {\n\t\t\tio.disconnect();\n\t\t\treturn res(entries[0].boundingClientRect);\n\t\t}, { threshold: 0 });\n\t\tio.observe(node);\n\t});\n};\nvar measureNode = async function(node, relativeTo) {\n\tvar relativeNode = relativeTo || (node === null || node === void 0 ? void 0 : node.parentElement);\n\tif (_instanceof(relativeNode, HTMLElement)) {\n\t\tvar [nodeDim, relativeNodeDim] = await Promise.all([getBoundingClientRectAsync(node), getBoundingClientRectAsync(relativeNode)]);\n\t\tif (relativeNodeDim && nodeDim) return getRelativeDimensions(nodeDim, relativeNodeDim, node);\n\t}\n\treturn null;\n};\nvar measure = async function(node, callback) {\n\tvar out = await measureNode(node, _instanceof(node.parentNode, HTMLElement) ? node.parentNode : null);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasure(node) {\n\treturn function(callback) {\n\t\treturn measure(node, callback);\n\t};\n}\nvar measureInWindow = async function(node, callback) {\n\tvar out = await measureNode(node, null);\n\tif (out) callback === null || callback === void 0 || callback(out.pageX, out.pageY, out.width, out.height);\n\treturn out;\n};\nvar createMeasureInWindow = function(node) {\n\treturn function(callback) {\n\t\treturn measureInWindow(node, callback);\n\t};\n};\nvar measureLayout = async function(node, relativeNode, callback) {\n\tvar out = await measureNode(node, relativeNode);\n\tif (out) callback === null || callback === void 0 || callback(out.x, out.y, out.width, out.height, out.pageX, out.pageY);\n\treturn out;\n};\nfunction createMeasureLayout(node) {\n\treturn function(relativeTo, callback) {\n\t\treturn measureLayout(node, relativeTo, callback);\n\t};\n}\n//# sourceMappingURL=index.js.map\n"],"mappings":"AAAA,YAAY;;AACZ,IAAIA,SAAS,GAAGC,MAAM,CAACC,cAAc;AACrC,IAAIC,gBAAgB,GAAGF,MAAM,CAACG,wBAAwB;AACtD,IAAIC,iBAAiB,GAAGJ,MAAM,CAACK,mBAAmB;AAClD,IAAIC,YAAY,GAAGN,MAAM,CAACO,SAAS,CAACC,cAAc;AAClD,IAAIC,QAAQ,GAAGA,CAACC,MAAM,EAAEC,GAAG,KAAK;EAC/B,KAAK,IAAIC,IAAI,IAAID,GAAG,EAAEZ,SAAS,CAACW,MAAM,EAAEE,IAAI,EAAE;IAC7CC,GAAG,EAAEF,GAAG,CAACC,IAAI,CAAC;IACdE,UAAU,EAAE;EACb,CAAC,CAAC;AACH,CAAC;AACD,IAAIC,WAAW,GAAGA,CAACC,EAAE,EAAEC,IAAI,EAAEC,MAAM,EAAEC,IAAI,KAAK;EAC7C,IAAIF,IAAI,IAAI,OAAOA,IAAI,KAAK,QAAQ,IAAI,OAAOA,IAAI,KAAK,UAAU,EAAE;IACnE,KAAK,IAAIG,GAAG,IAAIhB,iBAAiB,CAACa,IAAI,C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