@scania-nl/tegel-angular-extensions 0.0.4 → 0.0.6

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.
@@ -1,3 +0,0 @@
1
- import { EnvironmentProviders } from '@angular/core';
2
- import { ToastConfig } from './toast.config';
3
- export declare function provideToast(config?: Partial<ToastConfig>): EnvironmentProviders;
@@ -1,24 +0,0 @@
1
- import { Toast } from './models/toast.model';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Displays toast notifications provided by the ToastService.
5
- *
6
- * Toasts are non-blocking messages that automatically disappear after a set duration
7
- * or can be dismissed manually by the user.
8
- */
9
- export declare class ToastComponent {
10
- private readonly toastService;
11
- /**
12
- * A reactive signal of all currently active toasts (open or closing).
13
- */
14
- readonly toastsSignal: import("@angular/core").Signal<Toast[]>;
15
- /**
16
- * Initiates the closing process for the given toast.
17
- *
18
- * @param toast The toast to be closed.
19
- * @returns void
20
- */
21
- closeToast: (toast: Toast) => void;
22
- static ɵfac: i0.ɵɵFactoryDeclaration<ToastComponent, never>;
23
- static ɵcmp: i0.ɵɵComponentDeclaration<ToastComponent, "tds-ext-toast", never, {}, {}, never, never, true, never>;
24
- }
@@ -1,35 +0,0 @@
1
- import { InjectionToken } from '@angular/core';
2
- import { ToastType } from './models/toast-type';
3
- /**
4
- * Global default configuration for toast behavior.
5
- * Used when individual toast properties are not explicitly set.
6
- */
7
- export interface ToastConfig {
8
- /**
9
- * Default toast type (e.g., 'success', 'information', etc.).
10
- */
11
- type: ToastType;
12
- /**
13
- * Default title to use when none is provided.
14
- */
15
- title: string;
16
- /**
17
- * Default description to use when none is provided.
18
- */
19
- description: string;
20
- /**
21
- * Default duration (ms) before auto-dismiss.
22
- * Use `0` for persistent toasts.
23
- */
24
- duration: number;
25
- /**
26
- * Default duration (ms) for the fade-out animation.
27
- */
28
- closeDuration: number;
29
- /**
30
- * Whether toasts are closable by default.
31
- */
32
- closable: boolean;
33
- }
34
- export declare const TOAST_CONFIG: InjectionToken<ToastConfig>;
35
- export declare const DEFAULT_TOAST_CONFIG: Required<ToastConfig>;
@@ -1,98 +0,0 @@
1
- import { Toast, ToastOptions } from './models/toast.model';
2
- import * as i0 from "@angular/core";
3
- /**
4
- * Service for creating, managing, and removing toast notifications.
5
- * Supports automatic dismissal, manual control, and lifecycle hooks.
6
- */
7
- export declare class ToastService {
8
- private readonly config;
9
- /** Internal ID tracker for unique toast IDs */
10
- private id;
11
- /** Signal state holding all toasts */
12
- private readonly _toasts;
13
- /** Public signal of all toasts */
14
- readonly toasts: import("@angular/core").Signal<Toast[]>;
15
- /** Signal of toasts that are not yet closed (open or closing) */
16
- readonly activeToasts: import("@angular/core").Signal<Toast[]>;
17
- /** Internal stream for auto-closing toasts */
18
- private readonly autoCloseSubject;
19
- /** Internal stream for fade-out/removal of toasts */
20
- private readonly closeSubject;
21
- constructor();
22
- /**
23
- * Creates and adds a new toast.
24
- * @param toastOptions Partial toast definition.
25
- * @returns The toast's unique ID.
26
- */
27
- create(toastOptions: Partial<ToastOptions>): number;
28
- /**
29
- * Initiates the fade-out transition for a toast.
30
- * @param id The toast ID.
31
- */
32
- close(id: number): void;
33
- /**
34
- * Immediately marks a toast as closed and removes it from display.
35
- * @param id The toast ID.
36
- */
37
- remove(id: number): void;
38
- /**
39
- * Closes and removes all toasts immediately without fade-out.
40
- */
41
- removeAll(): void;
42
- /**
43
- * Initiates closing process for all open toasts.
44
- */
45
- closeAll(): void;
46
- /**
47
- * Gets a toast by ID.
48
- * @param id The toast ID.
49
- * @returns The toast instance or undefined.
50
- */
51
- getToast(id: number): Toast | undefined;
52
- /** Whether the toast is eligible for auto-closing */
53
- private shouldAutoClose;
54
- /** Whether the toast is eligible for final removal */
55
- private shouldRemove;
56
- /** Add toast to signal list */
57
- private addToast;
58
- /**
59
- * Updates the state of a toast.
60
- * @param id Toast ID
61
- * @param state New state
62
- * @returns The updated toast or undefined
63
- */
64
- private updateToastState;
65
- /**
66
- * Creates a unique id
67
- * @returns New id
68
- */
69
- private createId;
70
- /**
71
- * Creates a success toast.
72
- * @param props Toast props without type.
73
- */
74
- readonly success: (props?: Partial<Omit<ToastOptions, "type">>) => number;
75
- /**
76
- * Creates an error toast.
77
- * @param props Toast props without type.
78
- */
79
- readonly error: (props?: Partial<Omit<ToastOptions, "type">>) => number;
80
- /**
81
- * Creates a warning toast.
82
- * @param props Toast props without type.
83
- */
84
- readonly warning: (props?: Partial<Omit<ToastOptions, "type">>) => number;
85
- /**
86
- * Creates an informational toast.
87
- * @param props Toast props without type.
88
- */
89
- readonly info: (props?: Partial<Omit<ToastOptions, "type">>) => number;
90
- /**
91
- * Creates a random toast for testing/demo purposes.
92
- * @param props Optional overrides
93
- */
94
- readonly createRandomToast: (props?: Partial<ToastOptions>) => number;
95
- private normalizeDuration;
96
- static ɵfac: i0.ɵɵFactoryDeclaration<ToastService, never>;
97
- static ɵprov: i0.ɵɵInjectableDeclaration<ToastService>;
98
- }
@@ -1,23 +0,0 @@
1
- import { ComponentRef, Type } from '@angular/core';
2
- interface BootstrapGlobalComponentOptions {
3
- /**
4
- * If true, avoids re-creating the component if it's already mounted.
5
- */
6
- reuseIfExists?: boolean;
7
- }
8
- /**
9
- * Bootstraps a global Angular component directly into the <body> element.
10
- * Useful for toasts, modals, and other global overlays.
11
- *
12
- * @param component - The component class to bootstrap.
13
- * @param options - Optional settings like preventing duplicates.
14
- * @returns The created ComponentRef.
15
- */
16
- export declare function bootstrapGlobalComponent<T>(component: Type<T>, options?: BootstrapGlobalComponentOptions): ComponentRef<T>;
17
- /**
18
- * Destroys a previously bootstrapped global component.
19
- *
20
- * @param component - The component class to remove from DOM.
21
- */
22
- export declare function destroyGlobalComponent<T>(component: Type<T>): void;
23
- export {};