react-transition-preset
Version:
Lightweight, zero-dependency transition component for React with common preset transition
14 lines (12 loc) • 826 B
TypeScript
type ViewChangeHandler = (entry: IntersectionObserverEntry) => void;
type ElementOrSelector = Element | Element[] | NodeListOf<Element> | string;
type MarginValue = `${number}${'px' | '%'}`;
type MarginType = MarginValue | `${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue}` | `${MarginValue} ${MarginValue} ${MarginValue} ${MarginValue}`;
interface InViewOptions {
root?: Element | Document;
margin?: MarginType;
amount?: 'some' | 'all' | number;
}
declare function resolveElements(elements: ElementOrSelector): Element[];
declare function inView(elementOrSelector: ElementOrSelector, onStart: (entry: IntersectionObserverEntry) => void | ViewChangeHandler, { root, margin: rootMargin, amount }?: InViewOptions): VoidFunction;
export { type InViewOptions, inView, resolveElements };