vert/src/lib/store/index.svelte.ts

31 lines
657 B
TypeScript

import { log } from "$lib/logger";
import type { IFile } from "$lib/types";
class Files {
public files = $state<
{
file: File;
from: string;
to: string;
blobUrl: string;
id: string;
result?: (IFile & { blobUrl: string; animating: boolean }) | null;
}[]
>([]);
public beenToConverterPage = $state(false);
public shouldShowAlert = $derived(
!this.beenToConverterPage && this.files.length > 0,
);
}
class Theme {
public dark = $state(false);
public toggle = () => {
this.dark = !this.dark;
log(["theme"], `set to ${this.dark ? "dark" : "light"}`);
};
}
export const files = new Files();
export const theme = new Theme();