Skip to content
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

feat: View Transition API #3691

Merged
merged 4 commits into from
Apr 20, 2023
Merged

feat: View Transition API #3691

merged 4 commits into from
Apr 20, 2023

Conversation

swwind
Copy link
Contributor

@swwind swwind commented Apr 6, 2023

What is it?

  • Feature / enhancement
  • Bug
  • Docs / tests

Description

#3664

Use cases and why

This is very brute force implement for supporting View Transition API.

I'm not 100% sure this code doesn't introduce other problems, just for showing my solution.

output.mp4

Checklist:

  • My code follows the developer guidelines of this project
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • Added new tests to cover the fix / functionality

@stackblitz
Copy link

stackblitz bot commented Apr 6, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@swwind
Copy link
Contributor Author

swwind commented Apr 6, 2023

@manucorporat what do you think of this 🤔

@manucorporat
Copy link
Contributor

I think this might be closer to the solution:
#3684

We dont want to be blocking for too long, qwik already buffers the dom operations and commits them all in one go!

@swwind
Copy link
Contributor Author

swwind commented Apr 7, 2023

@manucorporat I got your idea. I made some changes accordings to your #3684, and with more stuffs.

  • add an option in <RouterOutlet /> to enable this feature manually.
  • only use view transition when routeLocation has changed. ([wip] feat: View Transitions #3684 seems to have view transition every render, this is not ideal because we may not want to have animations in some simple signal changes)
  • disable view transition if new routeLocation has the same pathname to old one. (this happens in hash link jumps)

However, <Link href="#xxx" /> seems to be broken but I think this is a problem due to an old DOM waiting problem and could be fixed in #3244 hopefully.

@manucorporat
Copy link
Contributor

Interesting approach... I think it's pretty low risk approach!

@manucorporat
Copy link
Contributor

wonder if this is a RouteOutlet o QwikCityProvider api? it really configures a global thing of qwikcity

@manucorporat
Copy link
Contributor

The RouterOutlet, is just an Outlet, not the render itself.

@manucorporat manucorporat marked this pull request as ready for review April 19, 2023 13:45
@manucorporat
Copy link
Contributor

Happy to merge an iterate from here!

@swwind
Copy link
Contributor Author

swwind commented Apr 20, 2023

@manucorporat I moved code from RouterOutlet to QwikCityProvider, and now the API looks like this

<QwikCityProvider enableViewTransitionAPI>
// ...
</QwikCityProvider>

In short, this code will set document.__q_view_transition__ when the SPA nav function is called, and checks this mark inside Qwik to decide whether use ViewTransition API or not.

However, I still doesn't write anything when you click the Back button to go to prior page. There exists a large difference in popstate event handler between main and #3244, if that PR was supposed to be merged, I think it's better to wait for that interface to be stabilized.

@manucorporat
Copy link
Contributor

Gonna merge and do some minor fixes, I think we can enable by default (only for transitions) + disable the html root view-name layer with css. Seems like a no risk API to instruct the browser when the naviagtion happens, then developers can opt-in using CSS

@manucorporat
Copy link
Contributor

Amazing job!

@manucorporat manucorporat merged commit 534148d into QwikDev:main Apr 20, 2023
19 checks passed
@manucorporat
Copy link
Contributor

The other PR, i wanna merge, but it has a big API surface + big changes

kodiakhq bot pushed a commit to ascorbic/unpic-img that referenced this pull request Apr 20, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@builder.io/qwik](https://qwik.builder.io/) ([source](https://togithub.com/BuilderIO/qwik)) | [`0.102.0` -> `0.103.0`](https://renovatebot.com/diffs/npm/@builder.io%2fqwik/0.102.0/0.103.0) | [![age](https://badges.renovateapi.com/packages/npm/@builder.io%2fqwik/0.103.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/@builder.io%2fqwik/0.103.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/@builder.io%2fqwik/0.103.0/compatibility-slim/0.102.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/@builder.io%2fqwik/0.103.0/confidence-slim/0.102.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>BuilderIO/qwik</summary>

### [`v0.103.0`](https://togithub.com/BuilderIO/qwik/releases/tag/v0.103.0)

[Compare Source](https://togithub.com/BuilderIO/qwik/compare/v0.102.0...v0.103.0)

#### What's Changed

-   docs: UX improvements for AI search by [@&#8203;steve8708](https://togithub.com/steve8708) in [QwikDev/qwik#3780
-   docs: improve AIX by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3782
-   fix `Implantation` typo all over the file by [@&#8203;egmaleta](https://togithub.com/egmaleta) in [QwikDev/qwik#3783
-   docs: fix typo in callout.tsx by [@&#8203;eltociear](https://togithub.com/eltociear) in [QwikDev/qwik#3786
-   docs: improve docs ai by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3790
-   docs: fix improve ai docs v2 by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3798
-   fix(eslint-plugin-qwik): remove warning for bigint now that it can be serialized by [@&#8203;steve8708](https://togithub.com/steve8708) in [QwikDev/qwik#3799
-   fix(eslint): allow use method inside other use methods by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3804
-   fix: agressive optimizer inlining by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3803
-   fix: slot creation forgets vdom by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3809
-   docs: fix redirects by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3808
-   Improve use 'use-not-root' behavious in es-lint plugin by [@&#8203;Wimpert](https://togithub.com/Wimpert) in [QwikDev/qwik#3807
-   docs: Semantic HTML update for all docs and playground examples by [@&#8203;AnthonyPAlicea](https://togithub.com/AnthonyPAlicea) in [QwikDev/qwik#3745
-   fix: URL update after SSG Link navigation by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3810
-   feat: use PUBLIC\_ prefix by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3817
-   feat: aggressive client treeshaking by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3816
-   docs: more ai improvements by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3815
-   fix: children types by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3814
-   fix: default prod build for node by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3812
-   feat: server$ this will be defined most of the times by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3813
-   fix: 🐛 Update starters vite-tsconfig-paths dependency to latest by [@&#8203;bjonesy](https://togithub.com/bjonesy) in [QwikDev/qwik#3793
-   fix: allow enum literals by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3819
-   docs: add mobile search by [@&#8203;zanettin](https://togithub.com/zanettin) in [QwikDev/qwik#3791
-   fix: remove jsx warning by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3822
-   feat: serialize server$ exceptions by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3821
-   fix: only treeshake on client mode by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3820
-   docs: speculative module fetching during dev by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3825
-   docs: improve speculative module debugging docs by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3826
-   docs: Endpoints typo by [@&#8203;PatrickJS](https://togithub.com/PatrickJS) in [QwikDev/qwik#3828
-   fix: vite bundling conditionals by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3833
-   feat: add eslint option to pass tsconfigFileNames by [@&#8203;gmfun](https://togithub.com/gmfun) in [QwikDev/qwik#2493
-   feat: relax serialization rules by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#2338
-   docs: speculative module fetching wording improvement   by [@&#8203;hamatoyogi](https://togithub.com/hamatoyogi) in [QwikDev/qwik#3832
-   docs: update slot by [@&#8203;mhevery](https://togithub.com/mhevery) in [QwikDev/qwik#3829
-   fix: relax aggressive treeshaking by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3835
-   chore: deps release by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3836
-   test: publish cli build artifacts by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3837
-   docs: correct typo and update for consistency by [@&#8203;wtlin1228](https://togithub.com/wtlin1228) in [QwikDev/qwik#3834
-   Pr docs cleanup by [@&#8203;mhevery](https://togithub.com/mhevery) in [QwikDev/qwik#3838
-   feat: View Transition API by [@&#8203;swwind](https://togithub.com/swwind) in [QwikDev/qwik#3691
-   refactor: useStore is deep recursive by default by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3678
-   fix: enable View Transition by default by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3839
-   Add live cookie value support to fix stale values by [@&#8203;n8sabes](https://togithub.com/n8sabes) in [QwikDev/qwik#3667
-   fix: pass --mode argument to child build commands by [@&#8203;DustinJSilk](https://togithub.com/DustinJSilk) in [QwikDev/qwik#3841
-   chore: release qwik-city by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3843

#### New Contributors

-   [@&#8203;bjonesy](https://togithub.com/bjonesy) made their first contribution in [QwikDev/qwik#3793
-   [@&#8203;gmfun](https://togithub.com/gmfun) made their first contribution in [QwikDev/qwik#2493

**Full Changelog**: QwikDev/qwik@v0.102.0...v0.103.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm on sunday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ascorbic/unpic-img).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS40MC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTQuMCJ9-->
kodiakhq bot pushed a commit to ascorbic/unpic-img that referenced this pull request Apr 20, 2023
[![Mend Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [eslint-plugin-qwik](https://togithub.com/BuilderIO/qwik) | [`^0.102.0` -> `^0.103.0`](https://renovatebot.com/diffs/npm/eslint-plugin-qwik/0.102.0/0.103.0) | [![age](https://badges.renovateapi.com/packages/npm/eslint-plugin-qwik/0.103.0/age-slim)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://badges.renovateapi.com/packages/npm/eslint-plugin-qwik/0.103.0/adoption-slim)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://badges.renovateapi.com/packages/npm/eslint-plugin-qwik/0.103.0/compatibility-slim/0.102.0)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://badges.renovateapi.com/packages/npm/eslint-plugin-qwik/0.103.0/confidence-slim/0.102.0)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>BuilderIO/qwik</summary>

### [`v0.103.0`](https://togithub.com/BuilderIO/qwik/releases/tag/v0.103.0)

[Compare Source](https://togithub.com/BuilderIO/qwik/compare/v0.102.0...v0.103.0)

#### What's Changed

-   docs: UX improvements for AI search by [@&#8203;steve8708](https://togithub.com/steve8708) in [QwikDev/qwik#3780
-   docs: improve AIX by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3782
-   fix `Implantation` typo all over the file by [@&#8203;egmaleta](https://togithub.com/egmaleta) in [QwikDev/qwik#3783
-   docs: fix typo in callout.tsx by [@&#8203;eltociear](https://togithub.com/eltociear) in [QwikDev/qwik#3786
-   docs: improve docs ai by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3790
-   docs: fix improve ai docs v2 by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3798
-   fix(eslint-plugin-qwik): remove warning for bigint now that it can be serialized by [@&#8203;steve8708](https://togithub.com/steve8708) in [QwikDev/qwik#3799
-   fix(eslint): allow use method inside other use methods by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3804
-   fix: agressive optimizer inlining by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3803
-   fix: slot creation forgets vdom by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3809
-   docs: fix redirects by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3808
-   Improve use 'use-not-root' behavious in es-lint plugin by [@&#8203;Wimpert](https://togithub.com/Wimpert) in [QwikDev/qwik#3807
-   docs: Semantic HTML update for all docs and playground examples by [@&#8203;AnthonyPAlicea](https://togithub.com/AnthonyPAlicea) in [QwikDev/qwik#3745
-   fix: URL update after SSG Link navigation by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3810
-   feat: use PUBLIC\_ prefix by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3817
-   feat: aggressive client treeshaking by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3816
-   docs: more ai improvements by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3815
-   fix: children types by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3814
-   fix: default prod build for node by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3812
-   feat: server$ this will be defined most of the times by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3813
-   fix: 🐛 Update starters vite-tsconfig-paths dependency to latest by [@&#8203;bjonesy](https://togithub.com/bjonesy) in [QwikDev/qwik#3793
-   fix: allow enum literals by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3819
-   docs: add mobile search by [@&#8203;zanettin](https://togithub.com/zanettin) in [QwikDev/qwik#3791
-   fix: remove jsx warning by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3822
-   feat: serialize server$ exceptions by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3821
-   fix: only treeshake on client mode by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3820
-   docs: speculative module fetching during dev by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3825
-   docs: improve speculative module debugging docs by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3826
-   docs: Endpoints typo by [@&#8203;PatrickJS](https://togithub.com/PatrickJS) in [QwikDev/qwik#3828
-   fix: vite bundling conditionals by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3833
-   feat: add eslint option to pass tsconfigFileNames by [@&#8203;gmfun](https://togithub.com/gmfun) in [QwikDev/qwik#2493
-   feat: relax serialization rules by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#2338
-   docs: speculative module fetching wording improvement   by [@&#8203;hamatoyogi](https://togithub.com/hamatoyogi) in [QwikDev/qwik#3832
-   docs: update slot by [@&#8203;mhevery](https://togithub.com/mhevery) in [QwikDev/qwik#3829
-   fix: relax aggressive treeshaking by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3835
-   chore: deps release by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3836
-   test: publish cli build artifacts by [@&#8203;adamdbradley](https://togithub.com/adamdbradley) in [QwikDev/qwik#3837
-   docs: correct typo and update for consistency by [@&#8203;wtlin1228](https://togithub.com/wtlin1228) in [QwikDev/qwik#3834
-   Pr docs cleanup by [@&#8203;mhevery](https://togithub.com/mhevery) in [QwikDev/qwik#3838
-   feat: View Transition API by [@&#8203;swwind](https://togithub.com/swwind) in [QwikDev/qwik#3691
-   refactor: useStore is deep recursive by default by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3678
-   fix: enable View Transition by default by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3839
-   Add live cookie value support to fix stale values by [@&#8203;n8sabes](https://togithub.com/n8sabes) in [QwikDev/qwik#3667
-   fix: pass --mode argument to child build commands by [@&#8203;DustinJSilk](https://togithub.com/DustinJSilk) in [QwikDev/qwik#3841
-   chore: release qwik-city by [@&#8203;manucorporat](https://togithub.com/manucorporat) in [QwikDev/qwik#3843

#### New Contributors

-   [@&#8203;bjonesy](https://togithub.com/bjonesy) made their first contribution in [QwikDev/qwik#3793
-   [@&#8203;gmfun](https://togithub.com/gmfun) made their first contribution in [QwikDev/qwik#2493

**Full Changelog**: QwikDev/qwik@v0.102.0...v0.103.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 9pm on sunday" (UTC), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://app.renovatebot.com/dashboard#github/ascorbic/unpic-img).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNS41NC4wIiwidXBkYXRlZEluVmVyIjoiMzUuNTQuMCJ9-->
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.

None yet

2 participants