UNPKG

3.86 kBSource Map (JSON)View Raw
1{"version":3,"names":[],"sources":["Interfaces.ts"],"sourcesContent":["import type {\n ComponentClass,\n ComponentProps,\n ComponentType,\n FunctionComponent,\n JSXElementConstructor,\n PropsWithChildren,\n ReactNode,\n} from 'react';\nimport type { ImageStyle, LayoutChangeEvent, StyleProp, TextStyle, ViewStyle } from 'react-native';\n\nexport type ComponentStyle<T extends keyof JSX.IntrinsicElements | JSXElementConstructor<any>> =\n ComponentProps<T>['style'] extends StyleProp<infer P> ? P : ComponentProps<T>['style'];\n\nexport type StyledProps<P> = PropsWithChildren<\n P & {\n className?: string;\n inheritedClassName?: string;\n nthChild?: number;\n tw?: string;\n style?: StyleProp<ViewStyle | TextStyle | ImageStyle>;\n }\n>;\n\nexport type EaseFunction =\n | 'linear'\n | 'easeIn'\n | 'easeOut'\n | 'easeInOut'\n | 'circIn'\n | 'circOut'\n | 'circInOut'\n | 'backIn'\n | 'backOut'\n | 'backInOut';\n\ninterface Loopable {\n loop?: number;\n}\n\nexport interface MotionTransitionTween extends Loopable {\n type?: 'tween' | 'timing' | undefined;\n ease?: EaseFunction | ((value: number) => number) | undefined;\n easing?: EaseFunction | ((value: number) => number) | undefined;\n duration: number | undefined;\n delay?: number | undefined;\n}\nexport interface MotionTransitionSpring extends Loopable {\n type: 'spring';\n friction?: number;\n tension?: number;\n speed?: number;\n bounciness?: number;\n stiffness?: number;\n damping?: number;\n mass?: number;\n overshootClamping?: boolean | undefined;\n restDisplacementThreshold?: number | undefined;\n restSpeedThreshold?: number | undefined;\n velocity?: number | { x: number; y: number } | undefined;\n}\n\nexport type MotionTransition = MotionTransitionTween | MotionTransitionSpring;\n\nexport type MotionTransitionRecord<T> = {\n [key in keyof T]: MotionTransition;\n};\nexport type TransformOrigin = `${number}%` | number | `${number}px`;\n\nexport interface MotionComponentProps<\n T extends ComponentType<any>,\n TStyle extends ComponentStyle<T>,\n TAnimate,\n TAnimateProps,\n TExtraProps = unknown\n> {\n style?: ComponentProps<T>['style'];\n animate?: TAnimate | TStyle | PropsTransforms;\n animateProps?: TAnimateProps | (Omit<ComponentProps<T>, 'style'> & TExtraProps);\n initial?: TStyle | PropsTransforms;\n initialProps?: Omit<ComponentProps<T>, 'style'> & TExtraProps;\n transition?: MotionTransition | MotionTransitionRecord<TAnimate | (TAnimateProps & TExtraProps) | { default: '' }>;\n children?: ReactNode;\n onLayout?: (event: LayoutChangeEvent) => void;\n transformOrigin?: { x?: TransformOrigin; y?: TransformOrigin };\n whileTap?: TAnimate | TStyle | PropsTransforms;\n whileHover?: TAnimate | TStyle | PropsTransforms;\n exit?: TAnimate | TStyle | PropsTransforms;\n onAnimationComplete?: (key: string) => void;\n}\nexport interface PropsTransforms {\n x?: number;\n y?: number;\n scale?: number;\n scaleX?: number;\n scaleY?: number;\n skewX?: `${number}deg` | `${number}rad`;\n skewY?: `${number}deg` | `${number}rad`;\n perspective?: number;\n rotate?: `${number}deg` | `${number}rad`;\n rotateX?: `${number}deg` | `${number}rad`;\n rotateY?: `${number}deg` | `${number}rad`;\n rotateZ?: `${number}deg` | `${number}rad`;\n matrix?: number[];\n}\nexport type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;\ndeclare type Component<P> = string | FunctionComponent<P> | ComponentClass<P>;\nexport interface MotionConfig {\n timing?: 'ms' | 's';\n styled?: <P>(Component: Component<P>) => FunctionComponent<StyledProps<P>>;\n}\n"],"mappings":"","ignoreList":[]}
\No newline at end of file