1
- {
2
- " code" : " <script lang=\" ts\" >
1
+ <script lang =" ts" >
3
2
import manual_image1 from ' ./no.png' ;
4
3
import manual_image2 from ' ./no.svg' ;
5
4
13
12
14
13
{foo }
15
14
16
- < img src = \ " ./foo.png\ " alt=\ " non-enhanced test\ " />
15
+ <img src =" ./foo.png" alt =" non-enhanced test" />
17
16
18
- <picture ><source srcset =\ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 alt=\ " basic test\ " width=1440 height=1440 /></picture>
17
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 alt =" basic test" width =1440 height =1440 /></picture >
19
18
20
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 width=\" 5 \ " height=\ " 10\ " alt=\ " dimensions test\ " /></picture>
19
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 width =" 5 " height =" 10" alt =" dimensions test" /></picture >
21
20
22
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 width=5 height=10 alt=\ " unquoted dimensions test\ " /></picture>
21
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 width =5 height =10 alt =" unquoted dimensions test" /></picture >
23
22
24
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 alt=\ " directive test\ " width=1440 height=1440 /></picture>
23
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 alt =" directive test" width =1440 height =1440 /></picture >
25
24
26
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 {...{foo}} alt=\ " spread attributes test\ " width=1440 height=1440 /></picture>
25
+ <picture ><source srcset ="/1 1440w, /2 960w" sizes = "min(1440px, 100vw)" type ="image/avif" /><source srcset ="/3 1440w, /4 960w" sizes = "min(1440px, 100vw)" type ="image/webp" /><source srcset ="5 1440w, /6 960w" sizes = "min(1440px, 100vw)" type ="image/png" /><img src =/7 {...{foo }} alt =" spread attributes test" width =1440 height =1440 /></picture >
27
26
28
- <picture ><source srcset = \ " /1 1440w, /2 960w\ " sizes=\ " (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw\ " type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\ " sizes=\ " (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw\ " type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\ " sizes=\ " (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw\ " type=\ " image/png\ " /><img src=/7 alt=\ " sizes test\ " width=1440 height=1440 /></picture>
27
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes =" (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw" type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes =" (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw" type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes =" (min-width: 60rem) 80vw, (min-width: 40rem) 90vw, 100vw" type =" image/png" /><img src =/7 alt =" sizes test" width =1440 height =1440 /></picture >
29
28
30
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 on:click={foo = 'clicked an image!'} alt=\ " event handler test\ " width=1440 height=1440 /></picture>
29
+ <picture ><source srcset ="/1 1440w, /2 960w" sizes = "min(1440px, 100vw)" type ="image/avif" /><source srcset ="/3 1440w, /4 960w" sizes = "min(1440px, 100vw)" type ="image/webp" /><source srcset ="5 1440w, /6 960w" sizes = "min(1440px, 100vw)" type ="image/png" /><img src =/7 on:click ={foo = ' clicked an image!' } alt =" event handler test" width =1440 height =1440 /></picture >
31
30
32
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 alt=\ " alias test\ " width=1440 height=1440 /></picture>
31
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 alt =" alias test" width =1440 height =1440 /></picture >
33
32
34
- <picture ><source srcset = \ " /1 1440w, /2 960w\" type=\ " image/avif\ " /><source srcset=\ " /3 1440w, /4 960w\" type=\ " image/webp\ " /><source srcset=\ " 5 1440w, /6 960w\" type=\ " image/png\ " /><img src=/7 alt=\ " absolute path test\ " width=1440 height=1440 /></picture>
33
+ <picture ><source srcset =" /1 1440w, /2 960w" sizes = " min(1440px, 100vw) " type =" image/avif" /><source srcset =" /3 1440w, /4 960w" sizes = " min(1440px, 100vw) " type =" image/webp" /><source srcset =" 5 1440w, /6 960w" sizes = " min(1440px, 100vw) " type =" image/png" /><img src =/7 alt =" absolute path test" width =1440 height =1440 /></picture >
35
34
36
35
{#each images as image }
37
36
{#if typeof image === ' string' }
38
- <img src = {image .img .src} alt = \ " opt-in test\ " width={image.img.w} height={image.img.h} />
37
+ <img src ={image .img .src } alt ="opt-in test" width ={image .img .w } height ={image .img .h } />
39
38
{:else }
40
39
<picture >
41
40
{#each Object .entries (image .sources ) as [format, srcset]}
42
- <source {srcset} type = {' image/' + format} />
41
+ <source {srcset } sizes = "min( { image . img . w } px, 100vw)" type ={' image/' + format } />
43
42
{/each }
44
- <img src = {image .img .src} alt = \ " opt-in test\ " width={image.img.w} height={image.img.h} />
43
+ <img src ={image .img .src } alt ="opt-in test" width ={image .img .w } height ={image .img .h } />
45
44
</picture >
46
45
{/if }
47
46
{/each }
48
47
49
48
<picture >
50
- <source src = \ " ./foo.avif\ " />
51
- <source srcset = \ " ./foo.avif 500v ./bar.avif 100v\ " />
52
- <source srcset = \ " ./foo.avif, ./bar.avif 1v\ " />
49
+ <source src =" ./foo.avif" />
50
+ <source srcset =" ./foo.avif 500v ./bar.avif 100v" />
51
+ <source srcset =" ./foo.avif, ./bar.avif 1v" />
53
52
</picture >
54
- " ,
55
- " dependencies" : [],
56
- " map" : SourceMap {
57
- " mappings" : " " ,
58
- " names" : [],
59
- " sourceRoot" : undefined ,
60
- " sources" : [
61
- " Input.svelte" ,
62
- ],
63
- " version" : 3 ,
64
- },
65
- " toString" : [Function ],
66
- }
0 commit comments