Notification Center Composable

Provides a centralized notification system similar to Visual Studio Code.

import { useNotificationCenter } from '@mlightcad/cad-viewer'

const { info, warning, error, success, notifications, unreadCount } = useNotificationCenter()

// Add different types of notifications
info('Information', 'This is an info message')
warning('Warning', 'This is a warning message')
error('Error', 'This is an error message')
success('Success', 'This is a success message')

// Add notification with actions
error('File Error', 'Failed to load file', {
actions: [
{ label: 'Retry', action: () => retryLoad(), primary: true },
{ label: 'Cancel', action: () => cancel() }
],
persistent: true
})

// Check notification count
console.log(`You have ${unreadCount.value} notifications`)
interface Notification {
    actions?: NotificationAction[];
    id: string;
    message?: string;
    persistent?: boolean;
    timeout?: number;
    timestamp: Date;
    title: string;
    type: "warning" | "info" | "error" | "success";
}

Properties

actions?: NotificationAction[]
id: string
message?: string
persistent?: boolean
timeout?: number
timestamp: Date
title: string
type: "warning" | "info" | "error" | "success"