chore: ⬆️ merge with upsteam a8e5c55228

This commit is contained in:
sevichecc 2023-02-03 23:37:25 +08:00
parent 09ad19e627
commit 17a039a043

View file

@ -7,7 +7,7 @@
h: number h: number
} }
const sources = import.meta.glob<Image[]>(['/static/**/*.{jpg,jpeg,png,webp,avif}', '!/static/assets'], { const sources = import.meta.glob<Image[]>(['/src/static/**/*.{jpg,jpeg,png,webp,avif}', '!/src/static/assets'], {
query: { query: {
format: 'avif', format: 'avif',
quality: '80', quality: '80',
@ -24,7 +24,7 @@
export let alt: string = src export let alt: string = src
export let loading: 'eager' | 'lazy' = 'lazy' export let loading: 'eager' | 'lazy' = 'lazy'
export let decoding: 'async' | 'sync' | 'auto' = 'async' export let decoding: 'async' | 'sync' | 'auto' = 'async'
let source: Image[] | undefined = sources[`/static${src}`] let source: Image[] | undefined = sources[`/src/static${src}`]
</script> </script>
{#if source} {#if source}
@ -34,4 +34,4 @@
</picture> </picture>
{:else} {:else}
<img {src} {alt} class={className ?? 'rounded-lg my-2'} {loading} {decoding} /> <img {src} {alt} class={className ?? 'rounded-lg my-2'} {loading} {decoding} />
{/if} {/if}