mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
chore(web): migration svelte 5 syntax (#13883)
This commit is contained in:
parent
9203a61709
commit
0b3742cf13
310 changed files with 6435 additions and 4176 deletions
|
|
@ -1,4 +1,4 @@
|
|||
<script context="module" lang="ts">
|
||||
<script module lang="ts">
|
||||
export enum ProgressBarStatus {
|
||||
Playing = 'playing',
|
||||
Paused = 'paused',
|
||||
|
|
@ -11,41 +11,49 @@
|
|||
import { onMount } from 'svelte';
|
||||
import { tweened } from 'svelte/motion';
|
||||
|
||||
/**
|
||||
* Autoplay on mount
|
||||
* @default false
|
||||
*/
|
||||
export let autoplay = false;
|
||||
interface Props {
|
||||
/**
|
||||
* Autoplay on mount
|
||||
* @default false
|
||||
*/
|
||||
autoplay?: boolean;
|
||||
/**
|
||||
* Progress bar status
|
||||
*/
|
||||
status?: ProgressBarStatus;
|
||||
hidden?: boolean;
|
||||
duration?: number;
|
||||
onDone: () => void;
|
||||
onPlaying?: () => void;
|
||||
onPaused?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* Progress bar status
|
||||
*/
|
||||
export let status: ProgressBarStatus = ProgressBarStatus.Paused;
|
||||
let {
|
||||
autoplay = false,
|
||||
status = $bindable(),
|
||||
hidden = false,
|
||||
duration = 5,
|
||||
onDone,
|
||||
onPlaying = () => {},
|
||||
onPaused = () => {},
|
||||
}: Props = $props();
|
||||
|
||||
export let hidden = false;
|
||||
|
||||
export let duration = 5;
|
||||
|
||||
export let onDone: () => void;
|
||||
export let onPlaying: () => void = () => {};
|
||||
export let onPaused: () => void = () => {};
|
||||
|
||||
const onChange = async () => {
|
||||
progress = setDuration(duration);
|
||||
const onChange = async (progressDuration: number) => {
|
||||
progress = setDuration(progressDuration);
|
||||
await play();
|
||||
};
|
||||
|
||||
let progress = setDuration(duration);
|
||||
|
||||
// svelte 5, again....
|
||||
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
||||
$: duration, handlePromiseError(onChange());
|
||||
$effect(() => {
|
||||
handlePromiseError(onChange(duration));
|
||||
});
|
||||
|
||||
$: {
|
||||
$effect(() => {
|
||||
if ($progress === 1) {
|
||||
onDone();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
if (autoplay) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue