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); }