import { writable } from 'svelte/store'; export const sidebarOpen = writable(true); export const selectedDocId = writable(null); // Toast 시스템 interface Toast { id: number; type: 'success' | 'error' | 'warning' | 'info'; message: string; } let toastId = 0; export const toasts = writable([]); export function addToast(type: Toast['type'], message: string, duration = 5000) { const id = ++toastId; toasts.update(t => [...t, { id, type, message }]); if (duration > 0) { setTimeout(() => removeToast(id), duration); } return id; } export function removeToast(id: number) { toasts.update(t => t.filter(toast => toast.id !== id)); }