@tanstack/virtual-core 3.19.5 → 3.19.6
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 +4 -12
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/esm/index.js +4 -12
- package/dist/esm/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +4 -12
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -74,8 +74,8 @@ export interface Rect {
|
|
|
74
74
|
//
|
|
75
75
|
|
|
76
76
|
const getRect = (element: HTMLElement): Rect => {
|
|
77
|
-
const {
|
|
78
|
-
return { width:
|
|
77
|
+
const { clientWidth, clientHeight } = element
|
|
78
|
+
return { width: clientWidth, height: clientHeight }
|
|
79
79
|
}
|
|
80
80
|
|
|
81
81
|
// Animation frames for `useAnimationFrameWithResizeObserver`, requested from
|
|
@@ -141,16 +141,8 @@ export const observeElementRect = <T extends Element>(
|
|
|
141
141
|
}
|
|
142
142
|
|
|
143
143
|
const frames = createFrameQueue(targetWindow)
|
|
144
|
-
const observer = new targetWindow.ResizeObserver((
|
|
144
|
+
const observer = new targetWindow.ResizeObserver(() => {
|
|
145
145
|
const run = () => {
|
|
146
|
-
const entry = entries[0]
|
|
147
|
-
if (entry?.borderBoxSize) {
|
|
148
|
-
const box = entry.borderBoxSize[0]
|
|
149
|
-
if (box) {
|
|
150
|
-
handler({ width: box.inlineSize, height: box.blockSize })
|
|
151
|
-
return
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
146
|
handler(getRect(element as unknown as HTMLElement))
|
|
155
147
|
}
|
|
156
148
|
|
|
@@ -159,7 +151,7 @@ export const observeElementRect = <T extends Element>(
|
|
|
159
151
|
: run()
|
|
160
152
|
})
|
|
161
153
|
|
|
162
|
-
observer.observe(element, { box: '
|
|
154
|
+
observer.observe(element, { box: 'content-box' })
|
|
163
155
|
|
|
164
156
|
return () => {
|
|
165
157
|
observer.unobserve(element)
|