@tanstack/virtual-core
Advanced tools
Comparing version 3.10.8 to 3.10.9
@@ -34,4 +34,5 @@ export * from './utils.js'; | ||
export declare const observeWindowRect: (instance: Virtualizer<Window, any>, cb: (rect: Rect) => void) => (() => void) | undefined; | ||
export declare const observeElementOffset: <T extends Element>(instance: Virtualizer<T, any>, cb: (offset: number, isScrolling: boolean) => void) => (() => void) | undefined; | ||
export declare const observeWindowOffset: (instance: Virtualizer<Window, any>, cb: (offset: number, isScrolling: boolean) => void) => (() => void) | undefined; | ||
type ObserveOffsetCallBack = (offset: number, isScrolling: boolean) => void; | ||
export declare const observeElementOffset: <T extends Element>(instance: Virtualizer<T, any>, cb: ObserveOffsetCallBack) => (() => void) | undefined; | ||
export declare const observeWindowOffset: (instance: Virtualizer<Window, any>, cb: ObserveOffsetCallBack) => (() => void) | undefined; | ||
export declare const measureElement: <TItemElement extends Element>(element: TItemElement, entry: ResizeObserverEntry | undefined, instance: Virtualizer<any, TItemElement>) => number; | ||
@@ -55,3 +56,3 @@ export declare const windowScroll: <T extends Window>(offset: number, { adjustments, behavior, }: { | ||
observeElementRect: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (rect: Rect) => void) => void | (() => void); | ||
observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: (offset: number, isScrolling: boolean) => void) => void | (() => void); | ||
observeElementOffset: (instance: Virtualizer<TScrollElement, TItemElement>, cb: ObserveOffsetCallBack) => void | (() => void); | ||
debug?: boolean; | ||
@@ -76,2 +77,3 @@ initialRect?: Rect; | ||
isScrollingResetDelay?: number; | ||
useScrollendEvent?: boolean; | ||
enabled?: boolean; | ||
@@ -78,0 +80,0 @@ isRtl?: boolean; |
@@ -74,3 +74,3 @@ import { debounce, memo, notUndefined, approxEqual } from "./utils.js"; | ||
let offset = 0; | ||
const fallback = supportsScrollend ? () => void 0 : debounce( | ||
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce( | ||
targetWindow, | ||
@@ -108,3 +108,3 @@ () => { | ||
let offset = 0; | ||
const fallback = supportsScrollend ? () => void 0 : debounce( | ||
const fallback = instance.options.useScrollendEvent && supportsScrollend ? () => void 0 : debounce( | ||
targetWindow, | ||
@@ -241,2 +241,3 @@ () => { | ||
isRtl: false, | ||
useScrollendEvent: true, | ||
...opts2 | ||
@@ -243,0 +244,0 @@ }; |
{ | ||
"name": "@tanstack/virtual-core", | ||
"version": "3.10.8", | ||
"version": "3.10.9", | ||
"description": "Headless UI for virtualizing scrollable elements in TS/JS + Frameworks", | ||
@@ -5,0 +5,0 @@ "author": "Tanner Linsley", |
@@ -133,5 +133,7 @@ import { approxEqual, debounce, memo, notUndefined } from './utils' | ||
type ObserveOffsetCallBack = (offset: number, isScrolling: boolean) => void | ||
export const observeElementOffset = <T extends Element>( | ||
instance: Virtualizer<T, any>, | ||
cb: (offset: number, isScrolling: boolean) => void, | ||
cb: ObserveOffsetCallBack, | ||
) => { | ||
@@ -148,11 +150,12 @@ const element = instance.scrollElement | ||
let offset = 0 | ||
const fallback = supportsScrollend | ||
? () => undefined | ||
: debounce( | ||
targetWindow, | ||
() => { | ||
cb(offset, false) | ||
}, | ||
instance.options.isScrollingResetDelay, | ||
) | ||
const fallback = | ||
instance.options.useScrollendEvent && supportsScrollend | ||
? () => undefined | ||
: debounce( | ||
targetWindow, | ||
() => { | ||
cb(offset, false) | ||
}, | ||
instance.options.isScrollingResetDelay, | ||
) | ||
@@ -182,3 +185,3 @@ const createHandler = (isScrolling: boolean) => () => { | ||
instance: Virtualizer<Window, any>, | ||
cb: (offset: number, isScrolling: boolean) => void, | ||
cb: ObserveOffsetCallBack, | ||
) => { | ||
@@ -195,11 +198,12 @@ const element = instance.scrollElement | ||
let offset = 0 | ||
const fallback = supportsScrollend | ||
? () => undefined | ||
: debounce( | ||
targetWindow, | ||
() => { | ||
cb(offset, false) | ||
}, | ||
instance.options.isScrollingResetDelay, | ||
) | ||
const fallback = | ||
instance.options.useScrollendEvent && supportsScrollend | ||
? () => undefined | ||
: debounce( | ||
targetWindow, | ||
() => { | ||
cb(offset, false) | ||
}, | ||
instance.options.isScrollingResetDelay, | ||
) | ||
@@ -298,5 +302,4 @@ const createHandler = (isScrolling: boolean) => () => { | ||
instance: Virtualizer<TScrollElement, TItemElement>, | ||
cb: (offset: number, isScrolling: boolean) => void, | ||
cb: ObserveOffsetCallBack, | ||
) => void | (() => void) | ||
// Optional | ||
@@ -329,2 +332,3 @@ debug?: boolean | ||
isScrollingResetDelay?: number | ||
useScrollendEvent?: boolean | ||
enabled?: boolean | ||
@@ -421,2 +425,3 @@ isRtl?: boolean | ||
isRtl: false, | ||
useScrollendEvent: true, | ||
...opts, | ||
@@ -423,0 +428,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
195658
2749