UNPKG

react-smooth-flow

Version:

Effortless React animations for entering, exiting, and updating elements

84 lines (62 loc) 2.8 kB
import { DependencyList } from 'react'; import { PropertiesHyphen } from 'csstype'; export declare const cancelTransition: (...tags: FalsyArray<Tag>) => void; export declare interface ConfigurableDefaults { debug: boolean; transitionOptions: ParsedTransitionOptions; } export declare const constructTransition: (mapping: TransitionMapping) => { 'data-transition': string; }; export declare const constructTransitionRoot: (tag: Tag) => { 'data-transitionroot': string; }; declare type ContentAlign = 'topLeft' | 'topCenter' | 'topRight' | 'centerRight' | 'bottomRight' | 'bottomCenter' | 'bottomLeft' | 'centerLeft' | 'center'; export declare const defaults: ConfigurableDefaults; declare type Falsy = false | 0 | '' | null | undefined; export declare type FalsyArray<T> = (T | Falsy)[]; declare interface Keyframe_2 { offset?: number; [key: string]: string | number | undefined; } declare type Keyframes = Keyframe_2[] | PropertyIndexedKeyframes_2; export declare type ParsedTransitionOptions = Required<Omit<TransitionOptions, 'exitKeyframes' | 'contentExitKeyframes' | 'transitionRootTag'>> & { exitKeyframes: Keyframes; contentExitKeyframes: Keyframes; transitionRootTag: Tag | null; }; declare type PositionAnchor = 'topLeft' | 'topRight' | 'bottomRight' | 'bottomLeft'; declare interface PropertyIndexedKeyframes_2 { offset?: number[]; [key: string]: string[] | number[] | undefined; } declare type RelevantStyleProperties = Exclude<keyof PropertiesHyphen, 'pointer-events'>[]; export declare const startTransition: (tags: FalsyArray<Tag>, updateDOM?: () => void, config?: TransitionConfig) => Promise<void>; export declare type Tag = string; export declare interface TransitionConfig { flushSync?: boolean; onBegin?(): void; onCancel?(): void; onFinish?(): void; } export declare type TransitionMapping<T extends TransitionOptions | ParsedTransitionOptions = TransitionOptions> = Record<Tag, T>; export declare interface TransitionOptions { duration?: number; easing?: string; delay?: number; ignoreReducedMotion?: boolean; enterKeyframes?: Keyframes; exitKeyframes?: Keyframes | 'reversedEnter'; contentEnterKeyframes?: Keyframes; contentExitKeyframes?: Keyframes | 'reversedEnter'; contentAlign?: ContentAlign; positionAnchor?: PositionAnchor; forcePresenceTransition?: boolean; transitionRootTag?: Tag; clip?: boolean; relevantStyleProperties?: RelevantStyleProperties; persistBounds?: boolean; disabled?: boolean; } export declare const usePreCommitEffect: (effect: (isInitialRender: boolean) => void | (() => void), deps?: DependencyList) => void; export { }