Skip to content

Improve view transitions extension point - #3918

Open
MichaelWest22 wants to merge 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:viewTransitionext
Open

Improve view transitions extension point#3918
MichaelWest22 wants to merge 3 commits into
bigskysoftware:four-devfrom
MichaelWest22:viewTransitionext

Conversation

@MichaelWest22

Copy link
Copy Markdown
Collaborator

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

  • I have read the contribution guidelines
  • I have targeted this PR against the correct branch (master for website changes, dev for
    source changes)
  • This is either a bugfix, a documentation update, or a new feature that has been explicitly
    approved via an issue
  • I ran the test suite locally (npm run test) and verified that it succeeded

@bkuhlmann

Copy link
Copy Markdown
Contributor

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.

@MichaelWest22

Copy link
Copy Markdown
Collaborator Author

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants