mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Allow the Image component to get transitions (#7836)
* Images and view transitions * Upgrade compiler * Adding a changeset
This commit is contained in:
parent
9fe1089e3e
commit
59b5562326
9 changed files with 44 additions and 9 deletions
5
.changeset/healthy-glasses-smash.md
Normal file
5
.changeset/healthy-glasses-smash.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'astro': patch
|
||||
---
|
||||
|
||||
Upgrade compiler to bring in Image view transition support
|
|
@ -4,5 +4,6 @@ import { defineConfig } from 'astro/config';
|
|||
export default defineConfig({
|
||||
experimental: {
|
||||
viewTransitions: true,
|
||||
assets: true,
|
||||
},
|
||||
});
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 330 KiB |
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
import { Image } from 'astro:assets';
|
||||
import penguinSrc from '../assets/penguin.jpg';
|
||||
---
|
||||
<Image src={penguinSrc} alt="a cute penguin" height="400" transition:name="penguin" />
|
|
@ -0,0 +1,9 @@
|
|||
---
|
||||
import Layout from '../components/Layout.astro';
|
||||
import Penguin from '../components/Penguin.astro';
|
||||
---
|
||||
<Layout>
|
||||
<Penguin />
|
||||
<p id="image-one">Page 1</p>
|
||||
<a id="click-two" href="/image-two">go to 2</a>
|
||||
</Layout>
|
|
@ -0,0 +1,8 @@
|
|||
---
|
||||
import Layout from '../components/Layout.astro';
|
||||
import Penguin from '../components/Penguin.astro';
|
||||
---
|
||||
<Layout>
|
||||
<p id="image-two">Page 2</p>
|
||||
<Penguin />
|
||||
</Layout>
|
|
@ -182,4 +182,11 @@ test.describe('View Transitions', () => {
|
|||
await page.click('#click-one');
|
||||
await expect(p, 'should have content').toHaveText('Page 1');
|
||||
});
|
||||
|
||||
test('<Image /> component forwards transitions to the <img>', async ({ page, astro }) => {
|
||||
// Go to page 1
|
||||
await page.goto(astro.resolveUrl('/image-one'));
|
||||
const img = page.locator('img[data-astro-transition-scope]');
|
||||
await expect(img).toBeVisible('The image tag should have the transition scope attribute.');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
"test:e2e:match": "playwright test -g"
|
||||
},
|
||||
"dependencies": {
|
||||
"@astrojs/compiler": "^1.6.0",
|
||||
"@astrojs/compiler": "^1.6.3",
|
||||
"@astrojs/internal-helpers": "^0.1.1",
|
||||
"@astrojs/language-server": "^1.0.0",
|
||||
"@astrojs/markdown-remark": "^2.2.1",
|
||||
|
|
|
@ -486,8 +486,8 @@ importers:
|
|||
packages/astro:
|
||||
dependencies:
|
||||
'@astrojs/compiler':
|
||||
specifier: ^1.6.0
|
||||
version: 1.6.0
|
||||
specifier: ^1.6.3
|
||||
version: 1.6.3
|
||||
'@astrojs/internal-helpers':
|
||||
specifier: ^0.1.1
|
||||
version: link:../internal-helpers
|
||||
|
@ -5584,8 +5584,8 @@ packages:
|
|||
sisteransi: 1.0.5
|
||||
dev: false
|
||||
|
||||
/@astrojs/compiler@1.6.0:
|
||||
resolution: {integrity: sha512-vxuzp09jAW/ZQ8C4Itf6/OsF76TNjBQC06FNpcayKOzxYkCGHTLh7+0lF4ywmG/fDgSc+f1x7kKxxEKl4nqXvQ==}
|
||||
/@astrojs/compiler@1.6.3:
|
||||
resolution: {integrity: sha512-n0xTuBznKspc0plk6RHBOlSv/EwQGyMNSxEOPj7HMeiRNnXX4woeSopN9hQsLkqraDds1eRvB4u99buWgVNJig==}
|
||||
|
||||
/@astrojs/internal-helpers@0.1.1:
|
||||
resolution: {integrity: sha512-+LySbvFbjv2nO2m/e78suleQOGEru4Cnx73VsZbrQgB2u7A4ddsQg3P2T0zC0e10jgcT+c6nNlKeLpa6nRhQIg==}
|
||||
|
@ -5595,7 +5595,7 @@ packages:
|
|||
resolution: {integrity: sha512-oEw7AwJmzjgy6HC9f5IdrphZ1GVgfV/+7xQuyf52cpTiRWd/tJISK3MsKP0cDkVlfodmNABNFnAaAWuLZEiiiA==}
|
||||
hasBin: true
|
||||
dependencies:
|
||||
'@astrojs/compiler': 1.6.0
|
||||
'@astrojs/compiler': 1.6.3
|
||||
'@jridgewell/trace-mapping': 0.3.18
|
||||
'@vscode/emmet-helper': 2.8.8
|
||||
events: 3.3.0
|
||||
|
@ -15666,7 +15666,7 @@ packages:
|
|||
resolution: {integrity: sha512-dPzop0gKZyVGpTDQmfy+e7FKXC9JT3mlpfYA2diOVz+Ui+QR1U4G/s+OesKl2Hib2JJOtAYJs/l+ovgT0ljlFA==}
|
||||
engines: {node: ^14.15.0 || >=16.0.0, pnpm: '>=7.14.0'}
|
||||
dependencies:
|
||||
'@astrojs/compiler': 1.6.0
|
||||
'@astrojs/compiler': 1.6.3
|
||||
prettier: 2.8.8
|
||||
sass-formatter: 0.7.6
|
||||
dev: true
|
||||
|
@ -15675,7 +15675,7 @@ packages:
|
|||
resolution: {integrity: sha512-lJ/mG/Lz/ccSwNtwqpFS126mtMVzFVyYv0ddTF9wqwrEG4seECjKDAyw/oGv915rAcJi8jr89990nqfpmG+qdg==}
|
||||
engines: {node: ^14.15.0 || >=16.0.0, pnpm: '>=7.14.0'}
|
||||
dependencies:
|
||||
'@astrojs/compiler': 1.6.0
|
||||
'@astrojs/compiler': 1.6.3
|
||||
prettier: 2.8.8
|
||||
sass-formatter: 0.7.6
|
||||
synckit: 0.8.5
|
||||
|
@ -18684,7 +18684,7 @@ packages:
|
|||
sharp:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@astrojs/compiler': 1.6.0
|
||||
'@astrojs/compiler': 1.6.3
|
||||
'@astrojs/internal-helpers': 0.1.1
|
||||
'@astrojs/language-server': 1.0.0
|
||||
'@astrojs/markdown-remark': 2.2.1(astro@2.9.3)
|
||||
|
|
Loading…
Reference in a new issue