import { CSSProperties, RefObject } from 'react'; import { ElementSize } from '../size'; export type { CanvasBoxSize, CanvasBoxSizeInput } from '../canvas-box'; export { resolveCanvasBoxSize } from '../canvas-box'; export interface UseElementSizeOptions { /** 为 false 时不观察 */ enabled?: boolean; } /** 观察元素尺寸(clientWidth / clientHeight) */ export declare const useElementSize: (ref: RefObject, options?: UseElementSizeOptions) => ElementSize; export interface UseCanvasBoxOptions { /** 为 true 时铺满父容器(父级需有明确高度) */ fill?: boolean; width?: number; height?: number; defaultWidth: number; defaultHeight: number; } export interface UseCanvasBoxResult { hostRef: RefObject; width: number; height: number; /** 挂到宿主容器的样式(fill 时为 100%×100%) */ hostStyle: CSSProperties; fill: boolean; /** 是否处于 fill 模式且尚未量到有效尺寸 */ pending: boolean; } /** 画布/效果宿主尺寸:fill 时跟随父容器,否则用显式宽高或默认值 */ export declare const useCanvasBox: ({ fill, width: widthProp, height: heightProp, defaultWidth, defaultHeight, }: UseCanvasBoxOptions) => UseCanvasBoxResult;