base.ts 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  1. export type ArrayElement<ArrayType extends readonly unknown[]> =
  2. ArrayType extends readonly (infer ElementType)[] ? ElementType : never;
  3. export type Motion<P extends Record<string, any> = any> = boolean | MotionObject | MotionFunction<P>;
  4. export type MotionFunction<P> = (props: P) => MotionObject;
  5. export interface MotionObject {
  6. [x: string]: any;
  7. children?: React.ReactNode | ((props: MotionChildrenProps) => React.ReactNode);
  8. willEnter?: () => void;
  9. didEnter?: () => void;
  10. willLeave?: () => void;
  11. didLeave?: () => void;
  12. onStart?: () => void;
  13. onRest?: () => void;
  14. state?: string;
  15. }
  16. export interface MotionChildrenProps {
  17. animateCls?: string;
  18. animateStyle?: {
  19. animationTimingFunction?: string;
  20. animationName?: string;
  21. animationDuration?: number | string;
  22. animationDelay?: number | string;
  23. animationIterationCount?: number | string;
  24. animationDirection?: 'alternate' | 'normal';
  25. animationFillMode?: string;
  26. };
  27. animateEvents?: {
  28. onAnimationIteration?: React.AnimationEventHandler<any> | undefined;
  29. onAnimationStart?: React.AnimationEventHandler<any> | undefined;
  30. onAnimationEnd?: React.AnimationEventHandler<any> | undefined;
  31. };
  32. }