UNPKG

@empoleon/solid-measure

Version:
25 lines (24 loc) 932 B
import { Component } from "solid-js"; import { MeasureProps } from "./get-types"; import { ContentRectCalculations, MeasurementType } from "./get-content-rect"; export interface ContentRectState { entry: Partial<DOMRectReadOnly>; client: any; offset: any; scroll: any; bounds: any; margin: any; } export interface WithContentRectChildrenProps { measure: (entries?: ResizeObserverEntry[]) => void; measureRef: (node: Element) => void; contentRect: ContentRectState; } export interface WithContentRectProps extends MeasureProps { innerRef?: ((el: Element) => void) | { current?: Element | null; }; onResize?: (contentRect: ContentRectCalculations) => void; } declare function withContentRect<T extends WithContentRectProps>(types?: MeasurementType[]): <P extends T>(WrappedComponent: Component<P & WithContentRectChildrenProps>) => Component<P>; export default withContentRect;