update to svelte 5

This commit is contained in:
2024-10-29 16:26:07 +01:00
parent d39ccba927
commit 66f09cf5a3
9 changed files with 558 additions and 1244 deletions

View File

@ -1,11 +1,13 @@
<script lang="ts">
import type { Account } from '$lib/mastodon/response';
export let account: Account;
let avatarDescription: string;
let sourceSetHtml: string;
$: avatarDescription = `Avatar for ${account.acct}`;
$: {
interface Props {
account: Account;
}
let { account }: Props = $props();
let avatarDescription: string = $derived(`Avatar for ${account.acct}`);
let sourceSetHtml: string = $derived.by(() => {
// Sort thumbnails by file type. This is important, because the order of the srcset entries matter.
// We need the best format to be first
const formatPriority = new Map<string, number>([
@ -33,8 +35,8 @@
const srcset = entry[1].join(', ');
html += `<source srcset="${srcset}" type="${entry[0]}" />`;
}
sourceSetHtml = html;
}
return html;
});
</script>
<picture>