1 | import type { ShareableRef, StyleProps, TransformArrayItem, EasingFunction } from '../../commonTypes';
|
2 | export type LayoutAnimationsOptions = 'originX' | 'originY' | 'width' | 'height' | 'borderRadius' | 'globalOriginX' | 'globalOriginY';
|
3 | type CurrentLayoutAnimationsValues = {
|
4 | [K in LayoutAnimationsOptions as `current${Capitalize<string & K>}`]: number;
|
5 | };
|
6 | type TargetLayoutAnimationsValues = {
|
7 | [K in LayoutAnimationsOptions as `target${Capitalize<string & K>}`]: number;
|
8 | };
|
9 | interface WindowDimensions {
|
10 | windowWidth: number;
|
11 | windowHeight: number;
|
12 | }
|
13 | export interface KeyframeProps extends StyleProps {
|
14 | easing?: EasingFunction;
|
15 | }
|
16 | type FirstFrame = {
|
17 | 0: KeyframeProps & {
|
18 | easing?: never;
|
19 | };
|
20 | from?: never;
|
21 | } | {
|
22 | 0?: never;
|
23 | from: KeyframeProps & {
|
24 | easing?: never;
|
25 | };
|
26 | };
|
27 | type LastFrame = {
|
28 | 100?: KeyframeProps;
|
29 | to?: never;
|
30 | } | {
|
31 | 100?: never;
|
32 | to: KeyframeProps;
|
33 | };
|
34 | export type ValidKeyframeProps = FirstFrame & LastFrame & Record<number, KeyframeProps>;
|
35 | export type MaybeInvalidKeyframeProps = Record<number, KeyframeProps> & {
|
36 | to?: KeyframeProps;
|
37 | from?: KeyframeProps;
|
38 | };
|
39 | export type LayoutAnimation = {
|
40 | initialValues: StyleProps;
|
41 | animations: StyleProps;
|
42 | callback?: (finished: boolean) => void;
|
43 | };
|
44 | export type AnimationFunction = (a?: any, b?: any, c?: any) => any;
|
45 | export type EntryAnimationsValues = TargetLayoutAnimationsValues & WindowDimensions;
|
46 | export type ExitAnimationsValues = CurrentLayoutAnimationsValues & WindowDimensions;
|
47 | export type EntryExitAnimationFunction = ((targetValues: EntryAnimationsValues) => LayoutAnimation) | ((targetValues: ExitAnimationsValues) => LayoutAnimation) | (() => LayoutAnimation);
|
48 | export type AnimationConfigFunction<T> = (targetValues: T) => LayoutAnimation;
|
49 | export type LayoutAnimationsValues = CurrentLayoutAnimationsValues & TargetLayoutAnimationsValues & WindowDimensions;
|
50 | export interface SharedTransitionAnimationsValues extends LayoutAnimationsValues {
|
51 | currentTransformMatrix: number[];
|
52 | targetTransformMatrix: number[];
|
53 | }
|
54 | export type SharedTransitionAnimationsFunction = (values: SharedTransitionAnimationsValues) => LayoutAnimation;
|
55 | export declare enum LayoutAnimationType {
|
56 | ENTERING = 1,
|
57 | EXITING = 2,
|
58 | LAYOUT = 3,
|
59 | SHARED_ELEMENT_TRANSITION = 4,
|
60 | SHARED_ELEMENT_TRANSITION_PROGRESS = 5
|
61 | }
|
62 | export type LayoutAnimationFunction = (targetValues: LayoutAnimationsValues) => LayoutAnimation;
|
63 | export type LayoutAnimationStartFunction = (tag: number, type: LayoutAnimationType, yogaValues: Partial<SharedTransitionAnimationsValues>, config: (arg: Partial<SharedTransitionAnimationsValues>) => LayoutAnimation) => void;
|
64 | export interface ILayoutAnimationBuilder {
|
65 | build: () => LayoutAnimationFunction;
|
66 | }
|
67 | export interface BaseLayoutAnimationConfig {
|
68 | duration?: number;
|
69 | easing?: EasingFunction;
|
70 | type?: AnimationFunction;
|
71 | damping?: number;
|
72 | dampingRatio?: number;
|
73 | mass?: number;
|
74 | stiffness?: number;
|
75 | overshootClamping?: number;
|
76 | restDisplacementThreshold?: number;
|
77 | restSpeedThreshold?: number;
|
78 | }
|
79 | export interface BaseBuilderAnimationConfig extends BaseLayoutAnimationConfig {
|
80 | rotate?: number | string;
|
81 | }
|
82 | export type LayoutAnimationAndConfig = [
|
83 | AnimationFunction,
|
84 | BaseBuilderAnimationConfig
|
85 | ];
|
86 | export interface IEntryExitAnimationBuilder {
|
87 | build: () => EntryExitAnimationFunction;
|
88 | }
|
89 | export interface IEntryAnimationBuilder {
|
90 | build: () => AnimationConfigFunction<EntryAnimationsValues>;
|
91 | }
|
92 | export interface IExitAnimationBuilder {
|
93 | build: () => AnimationConfigFunction<ExitAnimationsValues>;
|
94 | }
|
95 | export type ProgressAnimationCallback = (viewTag: number, progress: number) => void;
|
96 | export type ProgressAnimation = (viewTag: number, values: SharedTransitionAnimationsValues, progress: number) => void;
|
97 | export type CustomProgressAnimation = (values: SharedTransitionAnimationsValues, progress: number) => StyleProps;
|
98 |
|
99 |
|
100 |
|
101 |
|
102 |
|
103 | export declare enum SharedTransitionType {
|
104 | ANIMATION = "animation",
|
105 | PROGRESS_ANIMATION = "progressAnimation"
|
106 | }
|
107 | export type EntryExitAnimationsValues = EntryAnimationsValues | ExitAnimationsValues;
|
108 | export type StylePropsWithArrayTransform = StyleProps & {
|
109 | transform?: TransformArrayItem[];
|
110 | };
|
111 | export interface LayoutAnimationBatchItem {
|
112 | viewTag: number;
|
113 | type: LayoutAnimationType;
|
114 | config: ShareableRef<Keyframe | LayoutAnimationFunction | SharedTransitionAnimationsFunction | ProgressAnimationCallback> | undefined;
|
115 | sharedTransitionTag?: string;
|
116 | }
|
117 | export {};
|
118 |
|
\ | No newline at end of file |