Improve view transitions extension point - #3918
Conversation
|
Thanks for doing this. 🙇 I would need to test this with Terminus and htmx Slide to see if this finally allows me to dynamically swap out the desired View Transition at runtime. I'm still traveling back from Big Sky Dev Con but should be able to investigate this more at the end of this week. |
|
@bkuhlmann Just updated my change to include a useful sourceElement to the triggered event and the full internal ctx object which you can use to make conditional decisions on what to change in the transition. You can perform an action before the transition starts and in the before event update the event.detail.task which is an async function to be your own async function that wraps the original task function allowing you to run some custom code before or after the swap inside the transition call. There is then an after event where you could do another action if needed. I think the after event is likely not needed in practice so we could probably remove this. Let me know if you can think of any use for the after event so we know if its worth keeping or not. |
Description
Add an async extension point for view transitions by allowing the wrapping of the task object
Corresponding issue:
Testing
Please explain how you tested this change manually, and, if applicable, what new tests you added. If
you're making a change to just the website, you can omit this section.
Checklist
masterfor website changes,devforsource changes)
approved via an issue
npm run test) and verified that it succeeded