11<script lang =" ts" >
2- import Picture from ' ./Picture .svelte'
2+ import SveltePicture from ' ./SveltePicture .svelte'
33import { len , lqipToBackground } from ' ./utils.js'
44import type { HTMLImgAttributes } from ' svelte/elements'
5- import type { Picture as PictureType } from ' vite-imagetools'
5+ import type { Picture } from ' vite-imagetools'
66
77interface $$Props extends Omit <HTMLImgAttributes , ' src' > {
88 /** imagetools import */
9- src: PictureType
9+ src: Picture
1010
1111 /** img tag `sizes` attr */
1212 sizes? : string
@@ -35,8 +35,8 @@ export let loading: $$Props['loading'] = 'lazy'
3535export let decoding: $$Props [' decoding' ] = ' async'
3636export let ref: $$Props [' ref' ] = undefined
3737
38- let sources: PictureType [' sources' ] | undefined
39- let img: (PictureType [' img' ] & { lqip? : string }) | undefined
38+ let sources: Picture [' sources' ] | undefined
39+ let img: (Picture [' img' ] & { lqip? : string }) | undefined
4040let background: string | undefined
4141
4242$ : sources = src ?.sources
@@ -47,7 +47,7 @@ $: if (len(img)) {
4747 </script >
4848
4949{#if len (img )}
50- <Picture {sources } {sizes }>
50+ <SveltePicture {sources } {sizes }>
5151 <!-- svelte-ignore a11y-missing-attribute a11y-no-noninteractive-element-interactions -->
5252 <img
5353 {loading }
@@ -61,24 +61,28 @@ $: if (len(img)) {
6161 {...$$restProps }
6262 src ={img ?.src }
6363 />
64- </Picture >
64+ </SveltePicture >
6565{/if }
6666
6767<!--
68- @component
69- High-performance responsive/progressive images for SvelteKit
70-
71- ## Usage
72- ```tsx
73- <Img class="cool kitty" src="{cat}" alt="Very meow" />
74- ```
75-
76- ## Props
77- - `src: PictureType` - imagetools import
78- - `sizes?: string` - img tag `sizes` attr
79- - `width?: number` - img `width` override
80- - `height?: number` - img `height` override
81- - `loading?: 'lazy' | 'eager'` - img tag `loading` attr
82- - `decoding?: 'async' | 'auto' | 'sync'` - img tag `decoding` attr
83- - `ref?: HTMLImageElement` - bindable reference to `<img>` element
84- -->
68+ @component
69+ High-performance responsive/progressive images for SvelteKit
70+
71+ ## Usage
72+ ```html
73+ <script>
74+ import Img from '@zerodevx/svelte-img'
75+ import cat from '$lib/assets/cat.jpg?as=run'
76+ </script>
77+ <Img class="cool kitty" src="{cat}" alt="Very meow" />
78+ ```
79+
80+ ## Props
81+ - `src: Picture` - imagetools import
82+ - `sizes?: string` - img tag `sizes` attr
83+ - `width?: number` - img `width` override
84+ - `height?: number` - img `height` override
85+ - `loading?: 'lazy' | 'eager'` - img tag `loading` attr
86+ - `decoding?: 'async' | 'auto' | 'sync'` - img tag `decoding` attr
87+ - `ref?: HTMLImageElement` - bindable reference to `<img>` element
88+ -->
0 commit comments