Migrates to svelte 5

This commit is contained in:
Christian Beutel
2025-01-24 17:46:13 +01:00
parent 7571f6e9b9
commit 3721b7f537
106 changed files with 5524 additions and 4232 deletions

View File

@@ -1,24 +1,36 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import { _ } from "svelte-i18n";
export let src: string;
export let isThumbnail: boolean = false;
export let showThumbnailControls: boolean = true;
export let showExifControls: boolean = false;
interface Props {
src: string;
isThumbnail?: boolean;
showThumbnailControls?: boolean;
showExifControls?: boolean;
onthumbnail?: (src: string) => void;
onexif?: (src: string) => void;
ondelete?: (src: string) => void;
}
const dispatch = createEventDispatcher();
let {
src,
isThumbnail = false,
showThumbnailControls = true,
showExifControls = false,
onthumbnail,
onexif,
ondelete,
}: Props = $props();
function handleThumbnailClick() {
dispatch("thumbnail", src);
onthumbnail?.(src);
}
function handleExifClick() {
dispatch("exif", src);
onexif?.(src);
}
function handleDeleteClick() {
dispatch("delete", src);
ondelete?.(src);
}
</script>
@@ -36,26 +48,30 @@
>
{#if showThumbnailControls}
<button
aria-label="Make thumbnail"
type="button"
class="tooltip"
data-title={$_("make-thumbnail")}
on:click={handleThumbnailClick}
onclick={handleThumbnailClick}
><i class="fa fa-file-image text-content"></i></button
>
{/if}
{#if showExifControls}
<button
aria-label="Get EXIF coordinates"
type="button"
class="tooltip"
data-title={$_("get-position-from-exif")}
on:click={handleExifClick}
><i class="fa fa-magnifying-glass-location text-content"></i></button
onclick={handleExifClick}
><i class="fa fa-magnifying-glass-location text-content"
></i></button
>
{/if}
<button
aria-label="Delete photo"
class="tooltip"
data-title={$_("delete")}
on:click={handleDeleteClick}
onclick={handleDeleteClick}
type="button"><i class="fa fa-trash text-red-500"></i></button
>
</div>