From dda52424a3e7a69a01bb745033185429c8d11941 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 22 Jan 2026 22:26:53 -0800 Subject: fix(notifications): Replace svelte-notifications with custom store for Svelte 5 --- src/lib/Notification/store.ts | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/lib/Notification/store.ts (limited to 'src/lib/Notification/store.ts') diff --git a/src/lib/Notification/store.ts b/src/lib/Notification/store.ts new file mode 100644 index 00000000..0cb4cf96 --- /dev/null +++ b/src/lib/Notification/store.ts @@ -0,0 +1,32 @@ +import { writable } from 'svelte/store'; + +export interface Notification { + id: string; + heading: string; + description?: string; + duration?: number; +} + +function createNotificationStore() { + const { subscribe, update } = writable([]); + + return { + subscribe, + add: (notification: Omit) => { + const id = crypto.randomUUID(); + + update((notifications) => [...notifications, { ...notification, id }]); + + return id; + }, + remove: (id: string) => { + update((notifications) => notifications.filter((n) => n.id !== id)); + } + }; +} + +export const notifications = createNotificationStore(); + +export function addNotification(notification: Omit) { + return notifications.add(notification); +} -- cgit v1.2.3