feat(ui): add photo file handling in Vite config

* include new image assets in static/photos
* define __PHOTO_FILES__ for dynamic photo URLs
* update package.json and package-lock.json with @types/node
This commit is contained in:
2026-08-12 00:30:27 +02:00
parent 1377d2791c
commit 89f19cc048
39 changed files with 37 additions and 9 deletions
+3
View File
@@ -8,6 +8,9 @@ declare global {
// interface PageState {}
// interface Platform {}
}
// Filenames in static/photos, injected at build time (see vite.config.ts).
const __PHOTO_FILES__: string[];
}
export {};
+4 -9
View File
@@ -2,14 +2,9 @@
import { backOut, cubicIn } from "svelte/easing";
import { browser } from "$app/environment";
const modules = import.meta.glob(
"../../../assets/photos/*.{jpg,jpeg,png,JPG,JPEG,PNG}",
{
eager: true,
import: "default",
query: "?url",
},
) as Record<string, string>;
const photoUrls = __PHOTO_FILES__.map(
(name) => `/photos/${encodeURIComponent(name)}`,
);
function shuffle<T>(items: T[]): T[] {
const result = [...items];
@@ -56,7 +51,7 @@
$effect(() => {
if (!browser) return;
photos = shuffle(Object.values(modules));
photos = shuffle(photoUrls);
});
$effect(() => {