import { NonInertableComponent } from '@a11d/non-inertable-component'; /** The kinds of notifications. */ export declare enum NotificationType { Info = "info", Success = "success", Warning = "warning", Error = "error" } /** A notification to show: its message, with an optional type and actions. */ export type Notification = { type?: NotificationType; message: string; actions?: Array; }; /** An action of a notification, with the title of its button and what clicking it does. */ type NotificationAction = { title: string; handleClick: () => void | PromiseLike; }; type NonTypedNotification = Omit; type NonTypedNotificationParameters = [notification: NonTypedNotification] | [message: string, ...actions: Array]; type NonTypedNotificationWithErrorParameters = [notification: NonTypedNotification] | [errorMessage: string, ...actions: Array] | [error: Error, ...actions: Array]; /** * The base class of the element showing notifications, whose static `notify` methods send them. * * Implement `show` to show the `notification`, and register the implementation with `@NotificationComponent.defaultComponent()`. * Each notification gets its own instance, appended to the application's top layer while it is shown. */ export declare abstract class NotificationComponent extends NonInertableComponent { static readonly shownNotifications: Set; private static DefaultComponentConstructor?; /** Registers the decorated class as the component that notifications sent through `NotificationComponent` are shown with. */ static defaultComponent: () => (Constructor: Constructor) => void; static notifyInfo(...parameters: NonTypedNotificationParameters): Promise; static notifySuccess(...parameters: NonTypedNotificationParameters): Promise; static notifyWarning(...parameters: NonTypedNotificationParameters): Promise; static notifyError(...parameters: NonTypedNotificationParameters): Promise; /** Shows an error notification, then throws the given error, or an `Error` with the given message. */ static notifyAndThrowError(...parameters: NonTypedNotificationWithErrorParameters): void; /** Shows the notification with this class, or with the default component if called on `NotificationComponent` itself. */ static notify(notification: Notification): Promise; /** The notification to show, set before `show` is called. */ abstract notification: Notification; /** Shows the `notification`, resolving once it is done showing. */ abstract show(): Promise; } export {}; //# sourceMappingURL=NotificationComponent.d.ts.map