starfederation / datastar

A real-time hypermedia framework.
https://data-star.dev/
MIT License
708 stars 40 forks source link

Change `vt` to `view-transition` and add a duration #167

Closed bencroker closed 1 month ago

bencroker commented 1 month ago

This PR changes the fragment event option vt to view-transition and turns it into it a duration. If set to 0, view transitions are not applied, otherwise they are using the provided duration.

delaneyj commented 1 month ago

need all examples and helpers updated too!

bencroker commented 1 month ago

This is ready for review. Please carefully check my work in backend.ts.

bencroker commented 1 month ago

Since all that’s required for View Transition animations is CSS, I no longer think animation duration is something Datastar should handle. We’d only be allowing setting the duration, not any of the other animation effects, so my feeling is that it’s probably better to just allow enabling/disabling View Transition and leave the rest to the user, as is the case now.

I’d still like to see vt renamed to view-transition, but understand that it is a breaking change in the name of ergonomics.