export declare type Props = {
[key: string]: any;
};
export declare type NumberPropFactory = (props: Props) => number;
export declare type BooleanPropFactory = (props: Props) => boolean;
export declare type StaggerDirectionPropFactory = (props: Props) => 1 | -1;
export declare type TransitionFactory = (props: Props) => TD | A | false;
export declare type ApplyResolve = (props: Props) => string | number;
export declare type ApplyMap = {
[key: string]: ApplyResolve | string | number;
};
export declare type TransitionMap = {
[key: string]: TD | A | false | TransitionFactory;
};
export declare type TransitionMapFactory = (props: Props) => TransitionMap;
export declare type Pose = {
transition?: TransitionMap | TransitionMapFactory;
delay?: number | NumberPropFactory;
delayChildren?: number | NumberPropFactory;
staggerChildren?: number | NumberPropFactory;
staggerDirection?: 1 | -1 | StaggerDirectionPropFactory;
beforeChildren?: boolean | BooleanPropFactory;
afterChildren?: boolean | BooleanPropFactory;
preTransform?: () => any;
preTransition?: (props: Props) => any;
applyAtStart?: ApplyMap;
applyAtEnd?: ApplyMap;
[key: string]: any;
};
export declare type ValueMap = Map;
export declare type AncestorValue = {
label?: string;
values: ValueMap;
};
export declare type AncestorValueList = Array>;
export declare type Transformer = (v: any) => any;
export declare type PassiveValueMap = {
[key: string]: [string, any, boolean | string | void];
};
export declare type OnChangeCallbacks = {
[key: string]: (v: any) => any;
};
export declare type ActiveActions = Map;
export declare type ActivePoses = Map;
export declare type ChildPosers = Set>;
export declare type PoseMap = {
[key: string]: Pose;
};
export declare type PoserFactory = (config: PoserConfig) => Poser;
export interface Poser {
set: (next: string, props?: Props) => Promise;
unset: (toUnset: string, props?: Props) => Promise;
get: (key?: string) => any;
has: (key: string) => boolean;
setProps: (props: Props) => void;
destroy: () => void;
_addChild: (config: PoserConfig, factory: PoserFactory) => Poser;
removeChild: (child: Poser) => void;
clearChildren: () => void;
}
export declare type PoserState = {
activeActions: ActiveActions;
activePoses: ActivePoses;
children: ChildPosers;
values: ValueMap;
props: Props;
};
export declare type PoserConfig = {
[key: string]: any;
label?: string;
props?: Props;
values?: {
[key: string]: V;
};
parentValues?: ValueMap;
ancestorValues?: AncestorValueList;
onChange?: OnChangeCallbacks;
passive?: PassiveValueMap;
initialPose?: string | string[];
};
export declare type ReadValue = (value: V) => any;
export declare type ResolveTarget = (value: V, target: any) => any;
export declare type CreateValueProps = any;
export declare type CreateValue = (init: any, key: string, props: Props, createValueProps?: CreateValueProps) => V;
export declare type ConvertValue = (value: any, key: string, props: Props) => V;
export declare type StartAction = (value: V, action: A, complete: () => any) => C;
export declare type StopAction = (controls: C) => any;
export declare type GetInstantTransition = (value: V, props: Props) => A;
export declare type AddTransitionDelay = (delay: number, transition: A) => A;
export declare type ExtendAPI = (api: Poser, state: PoserState, config: PoserConfig) => Poser;
export declare type GetTransitionProps = (value: V, target: number, props: Props) => Props;
export declare type SelectValueToRead = (value: V) => any;
export declare type TransformPose = (pose: Pose, key: string, state: PoserState) => Pose;
export declare type ReadValueFromSource = (key: string, props: Props) => any;
export declare type SetValue = (v: V, value: any) => void;
export declare type SetValueNative = (key: string, value: any, props: Props) => void;
export declare type ConvertTransitionDefinition = (value: V, transitionDef: TD | A, props: Props) => A;
export declare type PoseFactoryConfig = {
getDefaultProps?: (config: PoserConfig) => Props;
defaultTransitions?: Map>;
bindOnChange: (values: ValueMap, onChange: OnChangeCallbacks) => (key: string) => any;
readValue: ReadValue;
readValueFromSource?: ReadValueFromSource;
setValue: SetValue;
setValueNative: SetValueNative;
createValue: CreateValue;
convertValue: ConvertValue;
resolveTarget: ResolveTarget;
getTransitionProps: GetTransitionProps;
convertTransitionDefinition: ConvertTransitionDefinition;
startAction: StartAction;
stopAction: StopAction;
getInstantTransition: GetInstantTransition;
addActionDelay: AddTransitionDelay;
selectValueToRead: SelectValueToRead;
extendAPI: ExtendAPI;
transformPose?: TransformPose;
posePriority?: string[];
forceRender?: (props: Props) => any;
};