ng-primitives 0.60.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.
@@ -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 config;
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
- /** Access the document */
16
- private readonly document;
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
- * The duration the toast will display for before it is automatically dismissed in milliseconds.
19
- * @default 3000
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 duration: import("@angular/core").InputSignalWithTransform<number, NumberInput>;
47
+ protected readonly zIndex: import("@angular/core").Signal<number>;
22
48
  /**
23
- * The direction the toast will appear from.
24
- * @default 'top'
49
+ * The height of the toast in pixels.
25
50
  */
26
- readonly gravity: import("@angular/core").InputSignal<NgpToastGravity>;
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 will on the horizontal axis.
29
- * @default 'end'
57
+ * The x position of the toast.
30
58
  */
31
- readonly position: import("@angular/core").InputSignal<NgpToastPosition>;
59
+ readonly x: string;
32
60
  /**
33
- * Whether the automatic dismissal of the toast should be paused when the user hovers over it.
34
- * @default true
61
+ * The y position of the toast.
35
62
  */
36
- readonly stopOnHover: import("@angular/core").InputSignalWithTransform<boolean, BooleanInput>;
63
+ readonly y: string;
37
64
  /**
38
- * Whether the toast should be announced to assistive technologies.
39
- * @default 'polite'
65
+ * The toast timer instance.
40
66
  */
41
- readonly ariaLive: import("@angular/core").InputSignal<string>;
42
- /** Store the list of toasts */
43
- private static toasts;
44
- /** Show the toast. */
45
- show(): void;
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"], { "duration": { "alias": "ngpToastDuration"; "required": false; "isSignal": true; }; "gravity": { "alias": "ngpToastGravity"; "required": false; "isSignal": true; }; "position": { "alias": "ngpToastPosition"; "required": false; "isSignal": true; }; "stopOnHover": { "alias": "ngpToastStopOnHover"; "required": false; "isSignal": true; }; "ariaLive": { "alias": "ngpToastAriaLive"; "required": false; "isSignal": true; }; }, {}, never, never, true, never>;
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
- }