better-toast 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,543 @@
1
+ import * as _angular_core from '@angular/core';
2
+ import { Type, OnInit } from '@angular/core';
3
+
4
+ declare const TOASTER_POSITIONS: readonly ["top-left", "top-center", "top-right", "bottom-left", "bottom-center", "bottom-right"];
5
+ type ToasterPosition = (typeof TOASTER_POSITIONS)[number];
6
+ /** Visual palette for the toast stack: follow the OS (`system`), or pin light / dark. */
7
+ type ToasterTheme = 'light' | 'dark' | 'system';
8
+ /**
9
+ * Viewport inset from `<app-toaster [offset]>` or `<app-toaster [mobileOffset]>`.
10
+ *
11
+ * Used with **`[offset]`** for `--toast-offset-*` (wide layout / shared vars) and **`[mobileOffset]`** for `--toast-offset-mobile-*` (narrow layout in `toaster.css`).
12
+ *
13
+ * - A **string** sets all four sides to the same CSS value (e.g. `"24px"`, `"1rem env(safe-area-inset-top)"`).
14
+ * - An **object** sets only the sides you pass; omitted sides keep the defaults from `toaster.css`.
15
+ */
16
+ type ToasterOffset = string | {
17
+ top?: string;
18
+ right?: string;
19
+ bottom?: string;
20
+ left?: string;
21
+ };
22
+ /**
23
+ * Milliseconds as a number, or the literal string **`"Infinity"`** (manual dismiss only). No other string values are supported.
24
+ * Used by `<app-toaster [duration]>` and {@link ToastOptions.durationMs}.
25
+ */
26
+ type ToasterDuration = number | 'Infinity';
27
+ /** Default `aria-label` for the toaster live region (`<section>`). */
28
+ declare const DEFAULT_TOASTER_ARIA_NOTIFICATIONS_REGION = "Notifications";
29
+ /** Default `aria-label` for the per-toast dismiss (close) control. */
30
+ declare const DEFAULT_TOASTER_ARIA_DISMISS_BUTTON = "Dismiss";
31
+ /**
32
+ * Overrides for built-in English accessibility strings on `<better-toaster [accessibilityLabels]>`.
33
+ * Omitted keys keep the library defaults.
34
+ */
35
+ interface ToasterAccessibilityLabels {
36
+ /**
37
+ * `aria-label` on the polite live region wrapper (`<section>`).
38
+ * Default {@link DEFAULT_TOASTER_ARIA_NOTIFICATIONS_REGION}.
39
+ */
40
+ notificationsRegion?: string;
41
+ /**
42
+ * `aria-label` on the dismiss control when `<better-toaster [closeButton]>` is true.
43
+ * Default {@link DEFAULT_TOASTER_ARIA_DISMISS_BUTTON}.
44
+ */
45
+ dismissButton?: string;
46
+ }
47
+ declare const TOAST_VARIANTS: readonly ["default", "description", "success", "error", "info", "warning", "loading"];
48
+ type ToastVariant = (typeof TOAST_VARIANTS)[number];
49
+ /**
50
+ * Per-variant icon overrides for `<app-toaster [icons]>`.
51
+ *
52
+ * Each value is either an **Angular standalone component** class (rendered with `NgComponentOutlet`),
53
+ * or **`null`** to show no icon for that variant. Omitted keys keep the library defaults.
54
+ *
55
+ * The **`default`** variant has no built-in icon; set `default` here (or pass {@link ToastOptions.icon}
56
+ * on a single toast) to show one. Omitting `default` keeps default toasts text-only.
57
+ */
58
+ type ToasterIcons = Partial<Record<ToastVariant, Type<unknown> | null>>;
59
+ /**
60
+ * Extra classes for host, message, and close control only.
61
+ * Used by {@link ToastOptions.classNames} and {@link HeadlessToastOptions.classNames}.
62
+ *
63
+ * Row button defaults (`.action-btn` / `.cancel-btn`) can be set on {@link ToasterToastOptions.classNames} ({@link ToastChromeClassNames})
64
+ * or overridden per call via {@link ToastActionChromeClassNames} / {@link ToastCancelChromeClassNames}.
65
+ *
66
+ * The library ships encapsulated styles (`toast-item.css`, etc.). Global rules for your class names often **lose to those defaults**, so properties you expect to change **usually need `!important`** (or stronger specificity) to actually apply.
67
+ */
68
+ type ToastBaseChromeClassNames = Partial<Record<'toast' | 'message' | 'description' | 'closeButton', string>>;
69
+ /**
70
+ * Merged shape after combining toaster defaults with a toast item (may include row-button keys when that toast has a row button).
71
+ * The library still uses this internally on {@link ToasterItem} and for `[class]` resolution.
72
+ */
73
+ type ToastChromeClassNames = ToastBaseChromeClassNames & {
74
+ actionButton?: string;
75
+ cancelButton?: string;
76
+ };
77
+ /** `classNames` for {@link ToasterService.action} — includes `.action-btn` only among row buttons. */
78
+ type ToastActionChromeClassNames = ToastBaseChromeClassNames & {
79
+ actionButton?: string;
80
+ };
81
+ /** `classNames` for {@link ToasterService.cancel} — includes `.cancel-btn` only among row buttons. */
82
+ type ToastCancelChromeClassNames = ToastBaseChromeClassNames & {
83
+ cancelButton?: string;
84
+ };
85
+ /**
86
+ * Defaults for every toast from `<app-toaster [toastOptions]>`.
87
+ * Per-toast {@link ToastOptions} override these (e.g. `style` / `classNames` keys on a single toast win over the same keys here).
88
+ */
89
+ interface ToasterToastOptions {
90
+ /**
91
+ * Inline CSS on each toast host (`li.toast` / `AppToastItem`).
92
+ * Merged with per-toast {@link ToastOptions.style}; toast-specific values override.
93
+ */
94
+ style?: Record<string, string | number | undefined>;
95
+ /**
96
+ * Extra CSS class strings merged onto toast chrome via Angular **`[class]`** bindings (from `<app-toaster [toastOptions]>`).
97
+ *
98
+ * - **`toast`** — list item host (`li.toast` / `AppToastItem`), alongside the built-in `toast` class.
99
+ * - **`message`** — the title line (`.msg`) when the toast is not a headless body or {@link ToasterItem.contentComponent} body.
100
+ * - **`description`** — the secondary line (`.description`) when {@link ToastOptions.description} is set or for the **`description`** variant.
101
+ * - **`closeButton`** — the dismiss control (`.close-btn`) when `<app-toaster [closeButton]>` is enabled.
102
+ * - **`actionButton`** / **`cancelButton`** — defaults for `.action-btn` / `.cancel-btn` when you use {@link ToasterService.action} / {@link ToasterService.cancel}; ignored on toasts without a row button.
103
+ *
104
+ * Per-toast {@link ToastOptions.classNames} cannot set row-button keys; override them on each {@link ToastActionMethodOptions} / {@link ToastCancelMethodOptions} call instead.
105
+ *
106
+ * Omitted keys add no extra classes for that part; values are typically space-separated class names (same as a static `class` attribute).
107
+ *
108
+ * **Overriding built-in look:** your CSS generally needs **`!important`** on the declarations that must win.
109
+ */
110
+ classNames?: ToastChromeClassNames;
111
+ }
112
+ /** Label + handler for {@link ToasterService.action} / {@link ToasterService.cancel}. */
113
+ interface ToastMethodButtonConfig {
114
+ /** Visible button text; defaults to `"Action"` or `"Cancel"` depending on the method. */
115
+ label?: string;
116
+ /**
117
+ * Receives the row button click event. Call {@link Event.preventDefault} to keep the toast open
118
+ * (the library skips {@link ToasterService.dismiss} when `defaultPrevented` is true).
119
+ */
120
+ onClick: (event: Event) => void;
121
+ }
122
+ /**
123
+ * Options for {@link ToasterService.action} only. Use the `action` field (not available on {@link ToastOptions}).
124
+ */
125
+ type ToastActionMethodOptions = Omit<ToastOptions, 'icon' | 'classNames'> & {
126
+ action: ToastMethodButtonConfig;
127
+ classNames?: ToastActionChromeClassNames;
128
+ };
129
+ /**
130
+ * Options for {@link ToasterService.cancel} only. Use the `cancel` field (not available on {@link ToastOptions}).
131
+ */
132
+ type ToastCancelMethodOptions = Omit<ToastOptions, 'icon' | 'classNames'> & {
133
+ cancel: ToastMethodButtonConfig;
134
+ classNames?: ToastCancelChromeClassNames;
135
+ };
136
+ /**
137
+ * Options for {@link ToasterService.custom}.
138
+ * {@link CustomToastOptions.inputs} is merged into the body component (same pattern as {@link HeadlessToastOptions.inputs});
139
+ * **`toastId`** is always injected after your inputs. The component must declare a matching `input()` / `@Input()` for **`toastId`**
140
+ * so `NgComponentOutlet` can bind it (same requirement as {@link ToasterService.headless}).
141
+ */
142
+ interface CustomToastOptions extends ToastOptions {
143
+ inputs?: Record<string, unknown>;
144
+ }
145
+ /**
146
+ * Options for the second argument of `show`, `success`, `error`, `info`, `warning`, `loading`,
147
+ * and {@link ToasterService#description}.
148
+ * {@link ToasterService.custom} uses {@link CustomToastOptions} instead.
149
+ * Not used by `ToasterService.promise()` (that API uses {@link ToastPromiseLabels}).
150
+ */
151
+ interface ToastOptions {
152
+ /**
153
+ * Omit to use `<app-toaster [duration]>` (or the library default).
154
+ * Use the literal **`"Infinity"`**, `Number.POSITIVE_INFINITY`, or `TOAST_DURATION_MANUAL_DISMISS` to persist until dismissed; `0` is still accepted for the same behavior.
155
+ * `loading()` defaults to manual dismiss when `durationMs` is omitted.
156
+ */
157
+ durationMs?: ToasterDuration;
158
+ /**
159
+ * `undefined` = use global `[icons]` on `<app-toaster>` or built-in SVGs.
160
+ * `null` = no icon for this toast.
161
+ * Otherwise a standalone component class rendered like `[icons]` overrides.
162
+ */
163
+ icon?: Type<unknown> | null;
164
+ /**
165
+ * Inline CSS on the toast host (`li.toast` / `AppToastItem`).
166
+ * Merged after `<app-toaster [toastOptions]>` `style` (if any); per-toast keys override the same keys from the toaster.
167
+ */
168
+ style?: Record<string, string | number | undefined>;
169
+ /**
170
+ * Secondary line below {@link ToasterItem.message} in a column layout. Works on every toast helper
171
+ * (`show`, `success`, `error`, …). {@link ToasterService#description} uses the **`description`** variant
172
+ * (neutral chrome like `default`); you can still pass this on other variants for the same layout with their icons/colors.
173
+ */
174
+ description?: string;
175
+ /**
176
+ * Extra **`[class]`** strings for this toast only — same keys and **`!important`** guidance as {@link ToasterToastOptions.classNames}.
177
+ * Merged with `<app-toaster [toastOptions]>` `classNames` (if any); per-toast keys replace the same keys from the toaster.
178
+ *
179
+ * Row button keys (`actionButton` / `cancelButton`) are only valid on {@link ToastActionMethodOptions} / {@link ToastCancelMethodOptions}.
180
+ */
181
+ classNames?: ToastBaseChromeClassNames;
182
+ /**
183
+ * Called when the toast is removed for any reason other than auto-dismiss: close control, swipe,
184
+ * {@link ToasterService.dismiss}, or {@link ToasterService.clear}.
185
+ */
186
+ onDismiss?: () => void;
187
+ /**
188
+ * Called when the toast is removed because its auto-dismiss timer finished (including after hover
189
+ * pause when the remaining time elapses).
190
+ */
191
+ onAutoClose?: () => void;
192
+ }
193
+ /**
194
+ * Options for {@link ToasterService.headless}.
195
+ * The component must be **standalone** (or otherwise valid for `NgComponentOutlet`).
196
+ * Headless toasts ignore `<app-toaster [closeButton]>`: no dismiss control is rendered.
197
+ *
198
+ * Per-toast **`icon`** and **`style`** are omitted: the inner component owns visuals; use
199
+ * `<app-toaster [toastOptions]>` for shared host styling if needed. **`classNames`** still applies to the list-item host
200
+ * (and to `.msg` / `.close-btn` when that chrome exists).
201
+ *
202
+ * The host always passes a **`toastId`** input (same value as the id returned from `headless()`)
203
+ * so the component can call {@link ToasterService.dismiss} or read its own id. User `inputs` are
204
+ * merged first; **`toastId` always wins** if also present in `inputs`.
205
+ */
206
+ interface HeadlessToastOptions extends Omit<ToastOptions, 'icon' | 'style'> {
207
+ /**
208
+ * Values passed to the component’s `input()` / `@Input()` bindings
209
+ * (same shape as `NgComponentOutlet` `inputs`).
210
+ */
211
+ inputs?: Record<string, unknown>;
212
+ }
213
+ interface ToasterItem {
214
+ readonly id: string;
215
+ readonly message: string;
216
+ /** Secondary line; see {@link ToastOptions.description}. */
217
+ readonly description?: string;
218
+ readonly variant: ToastVariant;
219
+ /**
220
+ * When set, the toast body is this standalone component rendered **inside** normal chrome (icon column when applicable, `.msg` host, close button),
221
+ * via {@link ToasterService.custom}.
222
+ */
223
+ readonly contentComponent?: Type<unknown>;
224
+ /** Bound to {@link ToasterItem.contentComponent} via `NgComponentOutlet` (includes auto **`toastId`**). */
225
+ readonly contentComponentInputs?: Record<string, unknown>;
226
+ /**
227
+ * When set (without {@link ToasterItem.contentComponent}), the toast body is this standalone component only — same stack and motion as other toasts, without host chrome or a close button.
228
+ */
229
+ readonly component?: Type<unknown>;
230
+ /** Bound to the headless component via `NgComponentOutlet`. */
231
+ readonly componentInputs?: Record<string, unknown>;
232
+ /** Per-toast override; see {@link ToastOptions.icon}. */
233
+ readonly icon?: Type<unknown> | null;
234
+ /** Per-toast host inline styles; see {@link ToastOptions.style}. */
235
+ readonly style?: Record<string, string | number | undefined>;
236
+ /** Per-toast extra classes; see {@link ToastOptions.classNames}. */
237
+ readonly classNames?: ToastChromeClassNames;
238
+ /** See {@link ToastOptions.onDismiss}. */
239
+ readonly onDismiss?: () => void;
240
+ /** See {@link ToastOptions.onAutoClose}. */
241
+ readonly onAutoClose?: () => void;
242
+ /**
243
+ * Primary row action from {@link ToasterService.action} or {@link ToasterService.cancel}.
244
+ * Renders a text button next to the message (no icon column).
245
+ */
246
+ readonly toastAction?: {
247
+ readonly role: 'action' | 'cancel';
248
+ readonly label: string;
249
+ /** Same contract as {@link ToastMethodButtonConfig.onClick}. */
250
+ readonly onClick: (event: Event) => void;
251
+ };
252
+ }
253
+ /**
254
+ * Labels for `ToasterService.promise` (loading vs settled states).
255
+ * `success` / `error` may be static strings or functions that receive the settled value / rejection reason.
256
+ */
257
+ interface ToastPromiseLabels<T = unknown> {
258
+ readonly loading: string;
259
+ readonly success: string | ((data: T) => string);
260
+ readonly error: string | ((reason: unknown) => string);
261
+ }
262
+
263
+ /** Fallback when `<app-toaster [duration]>` is absent and a helper omits `durationMs`. */
264
+ declare const DEFAULT_TOAST_DURATION_MS = 4000;
265
+ /** Default label for {@link ToasterService.action} when {@link ToastMethodButtonConfig.label} is omitted. */
266
+ declare const DEFAULT_TOAST_ACTION_LABEL = "Action";
267
+ /** Default label for {@link ToasterService.cancel} when {@link ToastMethodButtonConfig.label} is omitted. */
268
+ declare const DEFAULT_TOAST_CANCEL_LABEL = "Cancel";
269
+ /**
270
+ * Use with `[duration]` or `options.durationMs` so a toast stays until manually dismissed.
271
+ * (`0` is still treated as non-auto-dismiss for backward compatibility.)
272
+ */
273
+ declare const TOAST_DURATION_MANUAL_DISMISS: number;
274
+ declare class ToasterService {
275
+ private readonly _toasts;
276
+ private readonly autoDismissByToastId;
277
+ /** Updated by `<better-toaster [duration]>`; initial value is {@link DEFAULT_TOAST_DURATION_MS}. */
278
+ private defaultDurationMs;
279
+ /** Active messages, oldest first. */
280
+ readonly toasts: _angular_core.Signal<readonly ToasterItem[]>;
281
+ /**
282
+ * Synced from `<better-toaster [duration]>`; used when a service call omits `durationMs`.
283
+ * Does not change timers on toasts already shown.
284
+ */
285
+ setDefaultDurationMs(ms: number): void;
286
+ private resolveDuration;
287
+ /**
288
+ * Stops any auto-dismiss for this toast: clears a running timeout if present and drops timer state.
289
+ */
290
+ private cancelAutoDismiss;
291
+ /**
292
+ * (Re)starts auto-dismiss from a concrete duration in milliseconds.
293
+ * Idempotent per toast: always cancels any existing timer first.
294
+ * Manual dismiss (`Infinity`) and non-positive values do not schedule a timer.
295
+ */
296
+ private scheduleAutoDismiss;
297
+ /**
298
+ * Pauses the auto-dismiss timer while the pointer is over the toast (e.g. hover).
299
+ * No-op if the toast has no active auto-dismiss.
300
+ *
301
+ * @param id The toast ID.
302
+ */
303
+ pauseAutoDismiss(id: string): void;
304
+ /**
305
+ * Resumes a paused auto-dismiss with the remaining time from {@link pauseAutoDismiss}.
306
+ *
307
+ * @param id The toast ID.
308
+ */
309
+ resumeAutoDismiss(id: string): void;
310
+ /**
311
+ * Display a neutral (default) toast notification.
312
+ *
313
+ * @param message The toast content.
314
+ * @param options Optional configuration object {@link ToastOptions}.
315
+ * @returns The toast ID, useful for programmatic dismissal.
316
+ */
317
+ show(message: string, options?: ToastOptions): string;
318
+ /**
319
+ * Display a toast using the **`description`** variant: same neutral chrome as **`default`**.
320
+ *
321
+ * @param message Title line.
322
+ * @param options Optional configuration object {@link ToastOptions}.
323
+ * @returns The toast ID, useful for programmatic dismissal.
324
+ */
325
+ description(message: string, options?: ToastOptions): string;
326
+ /**
327
+ * Display a success toast notification.
328
+ *
329
+ * @param message The toast content.
330
+ * @param options Optional configuration object {@link ToastOptions}.
331
+ * @returns The toast ID, useful for programmatic dismissal.
332
+ */
333
+ success(message: string, options?: ToastOptions): string;
334
+ /**
335
+ * Display an error toast notification.
336
+ *
337
+ * @param message The toast content.
338
+ * @param options Optional configuration object {@link ToastOptions}.
339
+ * @returns The toast ID, useful for programmatic dismissal.
340
+ */
341
+ error(message: string, options?: ToastOptions): string;
342
+ /**
343
+ * Display an info toast notification.
344
+ *
345
+ * @param message The toast content.
346
+ * @param options Optional configuration object {@link ToastOptions}.
347
+ * @returns The toast ID, useful for programmatic dismissal.
348
+ */
349
+ info(message: string, options?: ToastOptions): string;
350
+ /**
351
+ * Display a warning toast notification.
352
+ *
353
+ * @param message The toast content.
354
+ * @param options Optional configuration object {@link ToastOptions}.
355
+ * @returns The toast ID, useful for programmatic dismissal.
356
+ */
357
+ warning(message: string, options?: ToastOptions): string;
358
+ /**
359
+ * Show a toast whose **message area** is a standalone Angular component while keeping normal toast chrome
360
+ * (surface, icon column when applicable, close button, stack motion).
361
+ *
362
+ * Pass {@link CustomToastOptions.inputs} for `input()` / `@Input()` on that component.
363
+ * The component also receives **`toastId`** (matches the returned id) for programmatic dismiss.
364
+ *
365
+ * @param component The component class (must be usable with `NgComponentOutlet`).
366
+ * @param options Optional configuration object {@link CustomToastOptions}.
367
+ * @returns The toast ID, useful for programmatic dismissal.
368
+ */
369
+ custom(component: Type<unknown>, options?: CustomToastOptions): string;
370
+ /**
371
+ * Show a toast whose body is a **standalone** Angular component on a headless host: no default border,
372
+ * padding, shadow, or surface color — only stack position and enter/leave animations; the component supplies all visuals.
373
+ *
374
+ * Pass {@link HeadlessToastOptions.inputs} to feed `input()` on that component.
375
+ * The component also automatically receives **`toastId`** (matches the returned id) for programmatic dismiss inside the component.
376
+ *
377
+ * @param component The component class (must be usable with `NgComponentOutlet`).
378
+ * @param options Optional configuration object {@link HeadlessToastOptions}.
379
+ * @returns The toast ID, useful for programmatic dismissal.
380
+ */
381
+ headless(component: Type<unknown>, options?: HeadlessToastOptions): string;
382
+ /**
383
+ * Display a loading toast notification.
384
+ *
385
+ * If `options.durationMs` is omitted, the toast stays until you dismiss or replace it (same as {@link TOAST_DURATION_MANUAL_DISMISS}).
386
+ * Passing a finite positive `durationMs` schedules auto-dismiss for loading toasts like other variants.
387
+ * The literal **`"Infinity"`** (or {@link TOAST_DURATION_MANUAL_DISMISS} / `0`) keeps the toast until dismissed.
388
+ *
389
+ * @param message The toast content.
390
+ * @param options Optional configuration object {@link ToastOptions}.
391
+ * @returns The toast ID, useful for programmatic dismissal.
392
+ */
393
+ loading(message: string, options?: ToastOptions): string;
394
+ /**
395
+ * Toast with message and a single **action** button. Default action button label is {@link DEFAULT_TOAST_ACTION_LABEL}.
396
+ * Pass `action.label` and `action.onClick` in {@link ToastActionMethodOptions} to customize the action button.
397
+ *
398
+ * @param message The toast content.
399
+ * @param options Optional configuration object {@link ToastActionMethodOptions}.
400
+ * @returns The toast ID, useful for programmatic dismissal.
401
+ */
402
+ action(message: string, options: ToastActionMethodOptions): string;
403
+ /**
404
+ * Toast with message and a **cancel**-style button. Default cancel button label is {@link DEFAULT_TOAST_CANCEL_LABEL}.
405
+ * Pass `cancel.label` and `cancel.onClick` in {@link ToastCancelMethodOptions} to customize the cancel button.
406
+ *
407
+ * @param message The toast content.
408
+ * @param options Optional configuration object {@link ToastCancelMethodOptions}.
409
+ * @returns The toast ID, useful for programmatic dismissal.
410
+ */
411
+ cancel(message: string, options: ToastCancelMethodOptions): string;
412
+ /**
413
+ * Shows one toast: loading until `userPromise` settles, then the same toast updates to success or error.
414
+ * Returns the same promise (fulfillment/rejection preserved for callers).
415
+ *
416
+ * @param userPromise The promise to display.
417
+ * @param labels The labels for the loading, success, and error states.
418
+ * @returns The promise (fulfillment/rejection preserved for callers).
419
+ */
420
+ promise<T>(userPromise: PromiseLike<T>, labels: ToastPromiseLabels<T>): Promise<T>;
421
+ /**
422
+ * Dismiss a toast notification.
423
+ *
424
+ * @param id The toast ID.
425
+ */
426
+ dismiss(id: string): void;
427
+ /**
428
+ * Clear all toast notifications.
429
+ */
430
+ clear(): void;
431
+ private add;
432
+ private addContentComponent;
433
+ private addComponent;
434
+ private updateToast;
435
+ private removeToast;
436
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<ToasterService, never>;
437
+ static ɵprov: _angular_core.ɵɵInjectableDeclaration<ToasterService>;
438
+ }
439
+
440
+ /**
441
+ * Renders the toaster stack. Add once near the root of your app (e.g. in `App`).
442
+ * Variant-colored surfaces are off by default; set `[richColors]="true"` to enable them.
443
+ * Set `[duration]` for auto-dismiss when service helpers omit their duration argument.
444
+ * Use **`duration="Infinity"`** (that exact literal) or `[duration]="…"` with a number / {@link TOAST_DURATION_MANUAL_DISMISS} for persist until dismissed; `0` still works.
445
+ * Pass `[icons]` with optional **standalone** components for `default` / `description` / `success` / `error` / `info` / `warning` / `loading`:
446
+ * replace the default artwork (or add an icon for the neutral `default` variant), or use **`null`** to hide that variant’s icon.
447
+ * Each component should render an **SVG** (import its class where you configure `[icons]`).
448
+ * Set `[closeButton]="false"` to hide the per-toast dismiss button.
449
+ * Set `[accessibilityLabels]` to override default English `aria-label` strings (live region and dismiss control).
450
+ * Set `[offset]` for `--toast-offset-*` and `[mobileOffset]` for `--toast-offset-mobile-*` (string all sides, or per-side object).
451
+ * Set `[theme]` to `light`, `dark`, or `system` (default): semantic colors follow the chosen mode; `system` uses `prefers-color-scheme`.
452
+ * {@link ToasterService.action} / {@link ToasterService.cancel} render a message plus one text button (no icon column).
453
+ */
454
+ declare class BetterToaster implements OnInit {
455
+ protected readonly toaster: ToasterService;
456
+ /**
457
+ * Default auto-dismiss time in ms for `show` / `success` / `error` / `info` / `warning` when the second argument omits `durationMs`.
458
+ * Bind **`duration="Infinity"`** (literal only) or a numeric ms value via `[duration]`; {@link TOAST_DURATION_MANUAL_DISMISS} is accepted as a number.
459
+ * `0` still works. Does not apply to `loading()`. Defaults to the library default (4000ms).
460
+ */
461
+ readonly durationMs: _angular_core.InputSignalWithTransform<number, ToasterDuration>;
462
+ /** Where the stack is anchored on the viewport. */
463
+ readonly position: _angular_core.InputSignal<"top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right">;
464
+ /**
465
+ * Viewport inset for the toast stack: a single CSS value for all sides, or an object with any of `top` / `right` / `bottom` / `left`.
466
+ * Binds `--toast-offset-top` / `right` / `bottom` / `left` on `.toast-container`.
467
+ */
468
+ readonly offset: _angular_core.InputSignal<ToasterOffset | undefined>;
469
+ /**
470
+ * Viewport inset for narrow layouts: binds `--toast-offset-mobile-top` / `right` / `bottom` / `left` on `.toast-container`.
471
+ * Same shape as {@link offset}.
472
+ */
473
+ readonly mobileOffset: _angular_core.InputSignal<ToasterOffset | undefined>;
474
+ /**
475
+ * When true, success/error/info/warning use semantic background and border colors.
476
+ */
477
+ readonly richColors: _angular_core.InputSignal<boolean>;
478
+ /**
479
+ * Color palette for the stack. `system` (default) follows `prefers-color-scheme`; `light` / `dark` pin the palette regardless of OS.
480
+ * Reflected as `data-theme` on the toast container (`<ol class="toast-container">`).
481
+ */
482
+ readonly theme: _angular_core.InputSignal<ToasterTheme>;
483
+ /**
484
+ * Optional per-variant **standalone** components that replace the default SVG (or loading indicator).
485
+ * Import each icon component in the host and pass its class here; each one should render an SVG
486
+ * (e.g. root `<svg>` with `stroke="currentColor"` / `fill="currentColor"` where appropriate).
487
+ * Omitted keys keep the built-in icons (the `default` variant has none unless you set `default` here).
488
+ * **`null`** for a variant hides that variant’s icon.
489
+ */
490
+ readonly icons: _angular_core.InputSignal<Partial<Record<"default" | "description" | "success" | "error" | "info" | "warning" | "loading", _angular_core.Type<unknown> | null>> | undefined>;
491
+ /**
492
+ * Defaults for every toast — shape is {@link ToasterToastOptions}.
493
+ *
494
+ * - **`style`** — merged onto each toast host with per-toast {@link ToastOptions.style}; identical keys from the service call win.
495
+ * - **`classNames`** — extra classes on host / `.msg` / `.description` / `.close-btn` / row buttons via **`[class]`**; see {@link ToasterToastOptions.classNames} (**`!important`** is usually required for overrides). Per-toast {@link ToastOptions.classNames} replaces host/message/close keys; row overrides come from {@link ToasterService.action} / {@link ToasterService.cancel}.
496
+ */
497
+ readonly toastOptions: _angular_core.InputSignal<ToasterToastOptions | undefined>;
498
+ /** When true, each toast shows a dismiss button. */
499
+ readonly closeButton: _angular_core.InputSignal<boolean>;
500
+ /**
501
+ * Overrides for built-in English `aria-label` values (live region and per-toast dismiss).
502
+ * Omitted keys keep {@link DEFAULT_TOASTER_ARIA_NOTIFICATIONS_REGION} and {@link DEFAULT_TOASTER_ARIA_DISMISS_BUTTON}.
503
+ */
504
+ readonly accessibilityLabels: _angular_core.InputSignal<ToasterAccessibilityLabels | undefined>;
505
+ /** Measured height in px per toast id, updated when a toast item reports `heightChange`. */
506
+ readonly heights: _angular_core.WritableSignal<Record<string, number>>;
507
+ /** Resolved `aria-label` for the outer `<section>` live region. */
508
+ protected readonly notificationsRegionAriaLabel: _angular_core.Signal<string>;
509
+ /** Resolved `aria-label` for each toast’s dismiss control. */
510
+ protected readonly dismissButtonAriaLabel: _angular_core.Signal<string>;
511
+ /** Vertical offset in px for the toast stack. */
512
+ protected readonly offsetTop: _angular_core.Signal<string | undefined>;
513
+ /** Horizontal offset in px for the toast stack. */
514
+ protected readonly offsetRight: _angular_core.Signal<string | undefined>;
515
+ /** Vertical offset in px for the toast stack. */
516
+ protected readonly offsetBottom: _angular_core.Signal<string | undefined>;
517
+ /** Horizontal offset in px for the toast stack. */
518
+ protected readonly offsetLeft: _angular_core.Signal<string | undefined>;
519
+ /** Vertical offset in px for the toast stack on narrow layouts. */
520
+ protected readonly mobileOffsetTop: _angular_core.Signal<string | undefined>;
521
+ /** Horizontal offset in px for the toast stack on narrow layouts. */
522
+ protected readonly mobileOffsetRight: _angular_core.Signal<string | undefined>;
523
+ /** Vertical offset in px for the toast stack on narrow layouts. */
524
+ protected readonly mobileOffsetBottom: _angular_core.Signal<string | undefined>;
525
+ /** Horizontal offset in px for the toast stack on narrow layouts. */
526
+ protected readonly mobileOffsetLeft: _angular_core.Signal<string | undefined>;
527
+ /**
528
+ * Vertical offset in px for each toast id so stacked toasts do not overlap.
529
+ * Walks newest-to-oldest (end of the list first): the latest toast has offset 0; each older toast sits above by the sum of heights below plus the inter-toast gap.
530
+ */
531
+ readonly offsets: _angular_core.Signal<Record<string, number>>;
532
+ /** Merges a toast item’s reported height into `heights` so `offsets` can recompute. */
533
+ onHeightChange(toastId: string, height: number): void;
534
+ /**
535
+ * Initializes the toaster service with the default duration.
536
+ */
537
+ ngOnInit(): void;
538
+ static ɵfac: _angular_core.ɵɵFactoryDeclaration<BetterToaster, never>;
539
+ static ɵcmp: _angular_core.ɵɵComponentDeclaration<BetterToaster, "better-toaster", never, { "durationMs": { "alias": "duration"; "required": false; "isSignal": true; }; "position": { "alias": "position"; "required": false; "isSignal": true; }; "offset": { "alias": "offset"; "required": false; "isSignal": true; }; "mobileOffset": { "alias": "mobileOffset"; "required": false; "isSignal": true; }; "richColors": { "alias": "richColors"; "required": false; "isSignal": true; }; "theme": { "alias": "theme"; "required": false; "isSignal": true; }; "icons": { "alias": "icons"; "required": false; "isSignal": true; }; "toastOptions": { "alias": "toastOptions"; "required": false; "isSignal": true; }; "closeButton": { "alias": "closeButton"; "required": false; "isSignal": true; }; "accessibilityLabels": { "alias": "accessibilityLabels"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
540
+ }
541
+
542
+ export { BetterToaster, DEFAULT_TOASTER_ARIA_DISMISS_BUTTON, DEFAULT_TOASTER_ARIA_NOTIFICATIONS_REGION, DEFAULT_TOAST_ACTION_LABEL, DEFAULT_TOAST_CANCEL_LABEL, DEFAULT_TOAST_DURATION_MS, TOASTER_POSITIONS, TOAST_DURATION_MANUAL_DISMISS, TOAST_VARIANTS, ToasterService };
543
+ export type { CustomToastOptions, HeadlessToastOptions, ToastActionChromeClassNames, ToastActionMethodOptions, ToastBaseChromeClassNames, ToastCancelChromeClassNames, ToastCancelMethodOptions, ToastChromeClassNames, ToastMethodButtonConfig, ToastOptions, ToastPromiseLabels, ToastVariant, ToasterAccessibilityLabels, ToasterDuration, ToasterIcons, ToasterItem, ToasterOffset, ToasterPosition, ToasterTheme, ToasterToastOptions };