motiondivision / motion

A modern animation library for React and JavaScript
https://motion.dev
MIT License
25.66k stars 842 forks source link

exports DynamicAnimationOptions and DOMKeyframesDefinition #2892

Open CRBroughton opened 4 days ago

CRBroughton commented 4 days ago

Hello there :) Saw a recent video on Motion (thanks Theo) and I've started playing around with it and realised for a Vue or any other framework wrapper, we'll probably need access to some of the underlying types that are currently only exposed via the React implementation.

There's also an open issue with this request (minus a type) - https://github.com/motiondivision/motion/issues/2870

I've exported both the DynamicAnimationOptions and DOMKeyframesDefinition types to help enable this.

If there's anything else I need to do on this PR, please shout. I've run the build locally and all seems fine and my very basic implementation with Vue seems to work with the updated files.

targetlucked69 commented 3 days ago

Hey nice PR! Would love to see MotionProps export too! Maybe create an internal one used by react that has children prop, but the default one doesnt have

CRBroughton commented 3 days ago

Hey there :) I was going to suggest as a potential solution:

export type MotionPropsWithoutChildren = Omit<MotionProps, 'children'>

as the above is a one-liner and achieves what I imagine is needed to help use this type for other frameworks. Any thoughts on the above?

Edit: On second look, seems like the React types are a bit more embedded into that MotionProps type and will require a bit of effort (unknown) to unravel. Might be best to separate that out into another PR as I'm not familiar enough (yet) with the codebase to do that change.