Skip to content

feat: View Transition hook #7237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
Feb 28, 2025
Merged

Conversation

GrandSchtroumpf
Copy link
Contributor

@GrandSchtroumpf GrandSchtroumpf commented Jan 9, 2025

What is it?

  • Feature / enhancement

Description

Emit an event when view transition start with the ViewTransition object in the detail.
Fix QwikDev/qwik-evolution#135

The goal is to hook into the view transition process to create animation in with JS :

useDocument('qviewTransition', $(async (event: CustomEvent<ViewTransition>) => {
  const transition = event.detail;
  await transition.ready; // Wait for ::view-transition-old pseudo class to exist
  document.documentElement.animate([
    // keyframes
  ], {
    pseudoElement: `::view-transition-old(.cards)`,
  })
}))

Checklist

  • My code follows the developer guidelines of this project
  • I performed a self-review of my own code
  • I added a changeset with pnpm change
  • I made corresponding changes to the Qwik docs

@GrandSchtroumpf GrandSchtroumpf requested review from a team as code owners January 9, 2025 20:19
Copy link

changeset-bot bot commented Jan 9, 2025

🦋 Changeset detected

Latest commit: 3cace67

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@builder.io/qwik Patch
eslint-plugin-qwik Patch
@builder.io/qwik-city Patch
create-qwik Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

pkg-pr-new bot commented Jan 9, 2025

Open in Stackblitz

npm i https://pkg.pr.new/@builder.io/qwik@7237
npm i https://pkg.pr.new/@builder.io/qwik-city@7237
npm i https://pkg.pr.new/eslint-plugin-qwik@7237
npm i https://pkg.pr.new/create-qwik@7237

commit: 3cace67

Copy link
Contributor

github-actions bot commented Jan 9, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 3cace67

@GrandSchtroumpf GrandSchtroumpf changed the title View Transition hook feat: View Transition hook Jan 10, 2025
Copy link
Contributor

@mhevery mhevery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks very reasonable to me, but I must say I am not the expert on view transitions.

@Varixo Varixo moved this from Backlog to Waiting For Review in Qwik Development Feb 28, 2025
@wmertens wmertens merged commit 73e8fcc into QwikDev:main Feb 28, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this from Waiting For Review to Done in Qwik Development Feb 28, 2025
@shairez shairez moved this from Done to Waiting For Review in Qwik Development Mar 4, 2025
@shairez shairez moved this from Waiting For Review to Done in Qwik Development Mar 11, 2025
@github-actions github-actions bot mentioned this pull request Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants