ng-primitives 0.59.0 → 0.61.0
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.
- package/fesm2022/ng-primitives-a11y.mjs +3 -3
- package/fesm2022/ng-primitives-a11y.mjs.map +1 -1
- package/fesm2022/ng-primitives-internal.mjs +1 -1
- package/fesm2022/ng-primitives-internal.mjs.map +1 -1
- package/fesm2022/ng-primitives-popover.mjs +18 -6
- package/fesm2022/ng-primitives-popover.mjs.map +1 -1
- package/fesm2022/ng-primitives-toast.mjs +405 -160
- package/fesm2022/ng-primitives-toast.mjs.map +1 -1
- package/package.json +27 -27
- package/popover/popover-trigger/popover-trigger.d.ts +9 -3
- package/schematics/ng-generate/templates/toast/toast.__fileSuffix@dasherize__.ts.template +104 -36
- package/toast/config/toast-config.d.ts +36 -7
- package/toast/index.d.ts +2 -1
- package/toast/toast/toast-context.d.ts +3 -0
- package/toast/toast/toast-manager.d.ts +50 -0
- package/toast/toast/toast-options.d.ts +34 -0
- package/toast/toast/toast-timer.d.ts +14 -0
- package/toast/toast/toast.d.ts +60 -37
- package/toast/toast/toast-ref.d.ts +0 -49
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare class NgpToastTimer {
|
|
2
|
+
private duration;
|
|
3
|
+
private callback;
|
|
4
|
+
private startTime;
|
|
5
|
+
private remaining;
|
|
6
|
+
private timeoutId;
|
|
7
|
+
private isRunning;
|
|
8
|
+
constructor(duration: number, callback: () => void);
|
|
9
|
+
start(): void;
|
|
10
|
+
pause(): void;
|
|
11
|
+
stop(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function toastTimer(duration: number, callback: () => void): NgpToastTimer;
|
|
14
|
+
export {};
|
package/toast/toast/toast.d.ts
CHANGED
|
@@ -1,52 +1,75 @@
|
|
|
1
|
-
import { BooleanInput, NumberInput } from '@angular/cdk/coercion';
|
|
2
|
-
import { NgpToastGravity, NgpToastPosition } from './toast-ref';
|
|
3
1
|
import * as i0 from "@angular/core";
|
|
4
|
-
export interface NgpToastContext {
|
|
5
|
-
dismiss: () => void;
|
|
6
|
-
}
|
|
7
2
|
export declare class NgpToast {
|
|
8
|
-
private readonly
|
|
9
|
-
/** Access the ng-template */
|
|
10
|
-
private readonly template;
|
|
11
|
-
/** Access the view container */
|
|
12
|
-
private readonly viewContainer;
|
|
13
|
-
/** Access the injector */
|
|
3
|
+
private readonly manager;
|
|
14
4
|
private readonly injector;
|
|
15
|
-
|
|
16
|
-
|
|
5
|
+
protected readonly config: import("../config/toast-config").NgpToastConfig;
|
|
6
|
+
/** @internal */
|
|
7
|
+
readonly context: import("./toast-options").NgpToastOptions;
|
|
8
|
+
private readonly interactivityChecker;
|
|
9
|
+
private readonly isInteracting;
|
|
10
|
+
private pointerStartRef;
|
|
11
|
+
private dragStartTime;
|
|
12
|
+
protected readonly swiping: import("@angular/core").WritableSignal<boolean>;
|
|
13
|
+
protected readonly swipeDirection: import("@angular/core").WritableSignal<"x" | "y" | null>;
|
|
14
|
+
protected readonly swipeAmount: import("@angular/core").WritableSignal<{
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
}>;
|
|
18
|
+
protected readonly swipeOutDirection: import("@angular/core").Signal<"right" | "left" | "bottom" | "top" | null>;
|
|
19
|
+
/**
|
|
20
|
+
* Get all toasts that are currently being displayed in the same position.
|
|
21
|
+
*/
|
|
22
|
+
private readonly toasts;
|
|
23
|
+
/**
|
|
24
|
+
* The number of toasts that are currently being displayed before this toast.
|
|
25
|
+
*/
|
|
26
|
+
protected readonly index: import("@angular/core").Signal<number>;
|
|
27
|
+
/**
|
|
28
|
+
* Determine the position of the toast in the list of toasts.
|
|
29
|
+
* This is the combination of the heights of all the toasts before this one, plus the gap between them.
|
|
30
|
+
*/
|
|
31
|
+
protected readonly offset: import("@angular/core").Signal<number>;
|
|
32
|
+
/**
|
|
33
|
+
* Determine if this toast is visible.
|
|
34
|
+
* Visible considers the maximum number of toasts that can be displayed at once, and the last x toasts that are currently being displayed.
|
|
35
|
+
*/
|
|
36
|
+
protected readonly visible: import("@angular/core").Signal<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* Determine the height of the front toast.
|
|
39
|
+
* This is used to determine the height of the toast when it is not expanded.
|
|
40
|
+
*/
|
|
41
|
+
protected readonly frontToastHeight: import("@angular/core").Signal<number>;
|
|
17
42
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
43
|
+
* Determine the z-index of the toast. This is the inverse of the index.
|
|
44
|
+
* The first toast will have the highest z-index, and the last toast will have the lowest z-index.
|
|
45
|
+
* This is used to ensure that the first toast is always on top of the others.
|
|
20
46
|
*/
|
|
21
|
-
readonly
|
|
47
|
+
protected readonly zIndex: import("@angular/core").Signal<number>;
|
|
22
48
|
/**
|
|
23
|
-
* The
|
|
24
|
-
* @default 'top'
|
|
49
|
+
* The height of the toast in pixels.
|
|
25
50
|
*/
|
|
26
|
-
readonly
|
|
51
|
+
protected readonly dimensions: import("@angular/core").WritableSignal<{
|
|
52
|
+
width: number;
|
|
53
|
+
height: number;
|
|
54
|
+
mounted: boolean;
|
|
55
|
+
}>;
|
|
27
56
|
/**
|
|
28
|
-
* The position the toast
|
|
29
|
-
* @default 'end'
|
|
57
|
+
* The x position of the toast.
|
|
30
58
|
*/
|
|
31
|
-
readonly
|
|
59
|
+
readonly x: string;
|
|
32
60
|
/**
|
|
33
|
-
*
|
|
34
|
-
* @default true
|
|
61
|
+
* The y position of the toast.
|
|
35
62
|
*/
|
|
36
|
-
readonly
|
|
63
|
+
readonly y: string;
|
|
37
64
|
/**
|
|
38
|
-
*
|
|
39
|
-
* @default 'polite'
|
|
65
|
+
* The toast timer instance.
|
|
40
66
|
*/
|
|
41
|
-
readonly
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/** Build the toast */
|
|
47
|
-
private createToast;
|
|
48
|
-
/** Position the toast on the DOM */
|
|
49
|
-
private reposition;
|
|
67
|
+
private readonly timer;
|
|
68
|
+
constructor();
|
|
69
|
+
protected onPointerDown(event: PointerEvent): void;
|
|
70
|
+
protected onPointerMove(event: PointerEvent): void;
|
|
71
|
+
protected onPointerUp(): void;
|
|
50
72
|
static ɵfac: i0.ɵɵFactoryDeclaration<NgpToast, never>;
|
|
51
|
-
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpToast, "[ngpToast]", ["ngpToast"], {
|
|
73
|
+
static ɵdir: i0.ɵɵDirectiveDeclaration<NgpToast, "[ngpToast]", ["ngpToast"], {}, {}, never, never, true, never>;
|
|
52
74
|
}
|
|
75
|
+
export type NgpToastSwipeDirection = 'top' | 'right' | 'bottom' | 'left';
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export type NgpToastPosition = 'start' | 'center' | 'end';
|
|
2
|
-
export type NgpToastGravity = 'top' | 'bottom';
|
|
3
|
-
export declare class NgpToastRef {
|
|
4
|
-
/** Store the toast element */
|
|
5
|
-
private readonly toastElement;
|
|
6
|
-
/** Store the duration */
|
|
7
|
-
private readonly duration;
|
|
8
|
-
/** The position of the toast */
|
|
9
|
-
readonly position: NgpToastPosition;
|
|
10
|
-
/** The gravity of the toast */
|
|
11
|
-
readonly gravity: NgpToastGravity;
|
|
12
|
-
/** Whether we should stop on focus */
|
|
13
|
-
private readonly stopOnHover;
|
|
14
|
-
/** The aria live setting */
|
|
15
|
-
private readonly ariaLive;
|
|
16
|
-
private readonly onDismiss;
|
|
17
|
-
/** Store the current timeout */
|
|
18
|
-
private timeoutId;
|
|
19
|
-
/** Get the toast height */
|
|
20
|
-
get height(): number;
|
|
21
|
-
constructor(
|
|
22
|
-
/** Store the toast element */
|
|
23
|
-
toastElement: HTMLElement,
|
|
24
|
-
/** Store the duration */
|
|
25
|
-
duration: number,
|
|
26
|
-
/** The position of the toast */
|
|
27
|
-
position: NgpToastPosition,
|
|
28
|
-
/** The gravity of the toast */
|
|
29
|
-
gravity: NgpToastGravity,
|
|
30
|
-
/** Whether we should stop on focus */
|
|
31
|
-
stopOnHover: boolean,
|
|
32
|
-
/** The aria live setting */
|
|
33
|
-
ariaLive: string, onDismiss: () => void);
|
|
34
|
-
dismiss(): void;
|
|
35
|
-
private removeElement;
|
|
36
|
-
/** Setup duration timeouts */
|
|
37
|
-
private setupTimeouts;
|
|
38
|
-
private setupListeners;
|
|
39
|
-
/** Set the position attribute */
|
|
40
|
-
private setPosition;
|
|
41
|
-
/** Set the gravity attribute */
|
|
42
|
-
private setGravity;
|
|
43
|
-
/** Set the aria live attribute */
|
|
44
|
-
private setAriaLive;
|
|
45
|
-
/**
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
setInset(property: 'top' | 'bottom', value: string): void;
|
|
49
|
-
}
|