mn-angular-lib 1.0.178 → 1.0.179
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/mn-angular-lib-alert.mjs +535 -0
- package/fesm2022/mn-angular-lib-alert.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs +356 -0
- package/fesm2022/mn-angular-lib-bottom-sheet.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-button.mjs +382 -0
- package/fesm2022/mn-angular-lib-button.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-calendar-core.mjs +377 -0
- package/fesm2022/mn-angular-lib-calendar-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-calendar.mjs +1513 -0
- package/fesm2022/mn-angular-lib-calendar.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-collection.mjs +2277 -0
- package/fesm2022/mn-angular-lib-collection.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-core.mjs +1232 -0
- package/fesm2022/mn-angular-lib-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-display.mjs +728 -0
- package/fesm2022/mn-angular-lib-display.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-forms.mjs +4260 -0
- package/fesm2022/mn-angular-lib-forms.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-keyboard.mjs +195 -0
- package/fesm2022/mn-angular-lib-keyboard.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal-core.mjs +945 -0
- package/fesm2022/mn-angular-lib-modal-core.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal-ui.mjs +2016 -0
- package/fesm2022/mn-angular-lib-modal-ui.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-modal.mjs +126 -0
- package/fesm2022/mn-angular-lib-modal.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs +275 -0
- package/fesm2022/mn-angular-lib-rich-text-editor.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-segmented.mjs +246 -0
- package/fesm2022/mn-angular-lib-segmented.mjs.map +1 -0
- package/fesm2022/mn-angular-lib-tab.mjs +573 -0
- package/fesm2022/mn-angular-lib-tab.mjs.map +1 -0
- package/fesm2022/mn-angular-lib.mjs +21 -15517
- package/fesm2022/mn-angular-lib.mjs.map +1 -1
- package/package.json +66 -1
- package/src/lib/styles/index.css +2 -2
- package/types/mn-angular-lib-alert.d.ts +258 -0
- package/types/mn-angular-lib-bottom-sheet.d.ts +173 -0
- package/types/mn-angular-lib-button.d.ts +318 -0
- package/types/mn-angular-lib-calendar-core.d.ts +378 -0
- package/types/mn-angular-lib-calendar.d.ts +636 -0
- package/types/mn-angular-lib-collection.d.ts +1550 -0
- package/types/mn-angular-lib-core.d.ts +756 -0
- package/types/mn-angular-lib-display.d.ts +1075 -0
- package/types/mn-angular-lib-forms.d.ts +3235 -0
- package/types/mn-angular-lib-keyboard.d.ts +128 -0
- package/types/mn-angular-lib-modal-core.d.ts +1130 -0
- package/types/mn-angular-lib-modal-ui.d.ts +492 -0
- package/types/mn-angular-lib-modal.d.ts +27 -0
- package/types/mn-angular-lib-rich-text-editor.d.ts +157 -0
- package/types/mn-angular-lib-segmented.d.ts +395 -0
- package/types/mn-angular-lib-tab.d.ts +313 -0
- package/types/mn-angular-lib.d.ts +16 -10822
- /package/{src/lib/features → alert/src}/mn-alert/mn-alert-outlet/mn-alert-outlet.css +0 -0
- /package/{src/lib/features → bottom-sheet/src}/mn-bottom-sheet/mn-bottom-sheet.component.css +0 -0
- /package/{src/lib/features → button/src}/mn-skeleton/mn-skeleton.css +0 -0
- /package/{src/lib/features → collection/src}/mn-list/mn-list.component.css +0 -0
- /package/{src/lib/features → forms/src}/mn-checkbox/mn-checkbox.css +0 -0
- /package/{src/lib/features → forms/src}/mn-dropdown/mn-dropdown.css +0 -0
- /package/{src/lib/features → forms/src}/mn-multi-select/mn-multi-select.css +0 -0
- /package/{src/lib/features → keyboard/src}/mn-keyboard/mn-keyboard.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-confirmation-body/mn-confirmation-body.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-form-body/mn-form-body.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-modal-shell/mn-modal-shell.component.css +0 -0
- /package/{src/lib/features → modal-ui/src}/mn-modal/components/mn-wizard-body/mn-wizard-body.component.css +0 -0
- /package/{src/lib/features → rich-text-editor/src}/mn-rich-text-editor/mn-rich-text-editor.component.css +0 -0
package/package.json
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mn-angular-lib",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.179",
|
|
4
4
|
"peerDependencies": {
|
|
5
5
|
"@angular/common": "^21.1.3",
|
|
6
6
|
"@angular/core": "^21.1.3",
|
|
7
7
|
"@angular/router": "^21.1.3",
|
|
8
8
|
"@lucide/angular": "^1.18.0",
|
|
9
|
+
"lucide": "^1.27.0",
|
|
9
10
|
"quill": "^2.0.3"
|
|
10
11
|
},
|
|
11
12
|
"peerDependenciesMeta": {
|
|
@@ -34,6 +35,70 @@
|
|
|
34
35
|
".": {
|
|
35
36
|
"types": "./types/mn-angular-lib.d.ts",
|
|
36
37
|
"default": "./fesm2022/mn-angular-lib.mjs"
|
|
38
|
+
},
|
|
39
|
+
"./alert": {
|
|
40
|
+
"types": "./types/mn-angular-lib-alert.d.ts",
|
|
41
|
+
"default": "./fesm2022/mn-angular-lib-alert.mjs"
|
|
42
|
+
},
|
|
43
|
+
"./bottom-sheet": {
|
|
44
|
+
"types": "./types/mn-angular-lib-bottom-sheet.d.ts",
|
|
45
|
+
"default": "./fesm2022/mn-angular-lib-bottom-sheet.mjs"
|
|
46
|
+
},
|
|
47
|
+
"./button": {
|
|
48
|
+
"types": "./types/mn-angular-lib-button.d.ts",
|
|
49
|
+
"default": "./fesm2022/mn-angular-lib-button.mjs"
|
|
50
|
+
},
|
|
51
|
+
"./calendar": {
|
|
52
|
+
"types": "./types/mn-angular-lib-calendar.d.ts",
|
|
53
|
+
"default": "./fesm2022/mn-angular-lib-calendar.mjs"
|
|
54
|
+
},
|
|
55
|
+
"./calendar-core": {
|
|
56
|
+
"types": "./types/mn-angular-lib-calendar-core.d.ts",
|
|
57
|
+
"default": "./fesm2022/mn-angular-lib-calendar-core.mjs"
|
|
58
|
+
},
|
|
59
|
+
"./collection": {
|
|
60
|
+
"types": "./types/mn-angular-lib-collection.d.ts",
|
|
61
|
+
"default": "./fesm2022/mn-angular-lib-collection.mjs"
|
|
62
|
+
},
|
|
63
|
+
"./core": {
|
|
64
|
+
"types": "./types/mn-angular-lib-core.d.ts",
|
|
65
|
+
"default": "./fesm2022/mn-angular-lib-core.mjs"
|
|
66
|
+
},
|
|
67
|
+
"./display": {
|
|
68
|
+
"types": "./types/mn-angular-lib-display.d.ts",
|
|
69
|
+
"default": "./fesm2022/mn-angular-lib-display.mjs"
|
|
70
|
+
},
|
|
71
|
+
"./forms": {
|
|
72
|
+
"types": "./types/mn-angular-lib-forms.d.ts",
|
|
73
|
+
"default": "./fesm2022/mn-angular-lib-forms.mjs"
|
|
74
|
+
},
|
|
75
|
+
"./keyboard": {
|
|
76
|
+
"types": "./types/mn-angular-lib-keyboard.d.ts",
|
|
77
|
+
"default": "./fesm2022/mn-angular-lib-keyboard.mjs"
|
|
78
|
+
},
|
|
79
|
+
"./modal": {
|
|
80
|
+
"types": "./types/mn-angular-lib-modal.d.ts",
|
|
81
|
+
"default": "./fesm2022/mn-angular-lib-modal.mjs"
|
|
82
|
+
},
|
|
83
|
+
"./modal-core": {
|
|
84
|
+
"types": "./types/mn-angular-lib-modal-core.d.ts",
|
|
85
|
+
"default": "./fesm2022/mn-angular-lib-modal-core.mjs"
|
|
86
|
+
},
|
|
87
|
+
"./modal-ui": {
|
|
88
|
+
"types": "./types/mn-angular-lib-modal-ui.d.ts",
|
|
89
|
+
"default": "./fesm2022/mn-angular-lib-modal-ui.mjs"
|
|
90
|
+
},
|
|
91
|
+
"./rich-text-editor": {
|
|
92
|
+
"types": "./types/mn-angular-lib-rich-text-editor.d.ts",
|
|
93
|
+
"default": "./fesm2022/mn-angular-lib-rich-text-editor.mjs"
|
|
94
|
+
},
|
|
95
|
+
"./segmented": {
|
|
96
|
+
"types": "./types/mn-angular-lib-segmented.d.ts",
|
|
97
|
+
"default": "./fesm2022/mn-angular-lib-segmented.mjs"
|
|
98
|
+
},
|
|
99
|
+
"./tab": {
|
|
100
|
+
"types": "./types/mn-angular-lib-tab.d.ts",
|
|
101
|
+
"default": "./fesm2022/mn-angular-lib-tab.mjs"
|
|
37
102
|
}
|
|
38
103
|
},
|
|
39
104
|
"type": "module"
|
package/src/lib/styles/index.css
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* Aggregate CSS entry for consumers. This file is included in the package assets. */
|
|
2
2
|
@import './styles.css';
|
|
3
3
|
/* Feature styles */
|
|
4
|
-
@import '
|
|
5
|
-
@import '
|
|
4
|
+
@import '../../../alert/src/mn-alert/mn-alert-outlet/mn-alert-outlet.css';
|
|
5
|
+
@import '../../../rich-text-editor/src/mn-rich-text-editor/mn-rich-text-editor.component.css';
|
|
6
6
|
@import "tailwindcss";
|
|
7
7
|
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { InjectionToken, Provider, TemplateRef } from '@angular/core';
|
|
3
|
+
import * as tailwind_variants from 'tailwind-variants';
|
|
4
|
+
import { VariantProps } from 'tailwind-variants';
|
|
5
|
+
import * as rxjs from 'rxjs';
|
|
6
|
+
|
|
7
|
+
declare const mnAlertVariants: tailwind_variants.TVReturnType<{
|
|
8
|
+
kind: {
|
|
9
|
+
success: string;
|
|
10
|
+
info: string;
|
|
11
|
+
warning: string;
|
|
12
|
+
error: string;
|
|
13
|
+
default: string;
|
|
14
|
+
accent: string;
|
|
15
|
+
};
|
|
16
|
+
variant: {
|
|
17
|
+
fill: string;
|
|
18
|
+
outline: string;
|
|
19
|
+
soft: string;
|
|
20
|
+
};
|
|
21
|
+
}, undefined, "flex items-start gap-3 p-4 border rounded-xl shadow-sm transition-all duration-300 w-full ", {
|
|
22
|
+
kind: {
|
|
23
|
+
success: string;
|
|
24
|
+
info: string;
|
|
25
|
+
warning: string;
|
|
26
|
+
error: string;
|
|
27
|
+
default: string;
|
|
28
|
+
accent: string;
|
|
29
|
+
};
|
|
30
|
+
variant: {
|
|
31
|
+
fill: string;
|
|
32
|
+
outline: string;
|
|
33
|
+
soft: string;
|
|
34
|
+
};
|
|
35
|
+
}, undefined, tailwind_variants.TVReturnType<{
|
|
36
|
+
kind: {
|
|
37
|
+
success: string;
|
|
38
|
+
info: string;
|
|
39
|
+
warning: string;
|
|
40
|
+
error: string;
|
|
41
|
+
default: string;
|
|
42
|
+
accent: string;
|
|
43
|
+
};
|
|
44
|
+
variant: {
|
|
45
|
+
fill: string;
|
|
46
|
+
outline: string;
|
|
47
|
+
soft: string;
|
|
48
|
+
};
|
|
49
|
+
}, undefined, "flex items-start gap-3 p-4 border rounded-xl shadow-sm transition-all duration-300 w-full ", unknown, unknown, undefined>>;
|
|
50
|
+
type MnAlertVariants = VariantProps<typeof mnAlertVariants>;
|
|
51
|
+
|
|
52
|
+
type MnAlertId = string;
|
|
53
|
+
type MnAlert = {
|
|
54
|
+
id: MnAlertId;
|
|
55
|
+
title: string;
|
|
56
|
+
subTitle?: string;
|
|
57
|
+
icon?: unknown;
|
|
58
|
+
cssClass?: string;
|
|
59
|
+
duration?: number;
|
|
60
|
+
meta?: Record<string, unknown>;
|
|
61
|
+
kind: MnAlertKind;
|
|
62
|
+
variant?: MnAlertVariants['variant'];
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type MnAlertKind = 'success' | 'info' | 'warning' | 'error' | 'default';
|
|
66
|
+
type MnAlertConfig = {
|
|
67
|
+
durations?: Partial<Record<MnAlertKind, number | null>>;
|
|
68
|
+
cssClasses?: Partial<Record<MnAlertKind, string>>;
|
|
69
|
+
icons?: Partial<Record<MnAlertKind, unknown>>;
|
|
70
|
+
fallbackDuration?: number | null;
|
|
71
|
+
/**
|
|
72
|
+
* How many alerts may be on screen at once. Showing one past this cap drops the oldest
|
|
73
|
+
* alert still visible, so a burst of alerts never grows into an unreadable stack.
|
|
74
|
+
*/
|
|
75
|
+
maxVisible?: number;
|
|
76
|
+
finalize?: (a: MnAlert) => MnAlert;
|
|
77
|
+
};
|
|
78
|
+
declare const MN_ALERT_CONFIG: InjectionToken<MnAlertConfig>;
|
|
79
|
+
declare const DEFAULT_MN_ALERT_CONFIG: Required<MnAlertConfig>;
|
|
80
|
+
|
|
81
|
+
declare function provideMnAlerts(config?: MnAlertConfig): Provider;
|
|
82
|
+
|
|
83
|
+
type MnShowInput = {
|
|
84
|
+
title: string;
|
|
85
|
+
subTitle?: string;
|
|
86
|
+
duration?: number;
|
|
87
|
+
icon?: unknown;
|
|
88
|
+
cssClass?: string;
|
|
89
|
+
meta?: Record<string, unknown>;
|
|
90
|
+
kind: MnAlertKind;
|
|
91
|
+
variant?: MnAlertVariants['variant'];
|
|
92
|
+
};
|
|
93
|
+
declare class MnAlertService {
|
|
94
|
+
private readonly store;
|
|
95
|
+
private readonly cfg;
|
|
96
|
+
private readonly userDurations?;
|
|
97
|
+
private readonly hasUserDurations;
|
|
98
|
+
constructor();
|
|
99
|
+
show(input: MnShowInput): MnAlertId;
|
|
100
|
+
success(title: string, subTitle?: string, extra?: Partial<MnShowInput>): string;
|
|
101
|
+
info(title: string, subTitle?: string, extra?: Partial<MnShowInput>): string;
|
|
102
|
+
warning(title: string, subTitle?: string, extra?: Partial<MnShowInput>): string;
|
|
103
|
+
error(title: string, subTitle?: string, extra?: Partial<MnShowInput>): string;
|
|
104
|
+
dismiss(id: MnAlertId): void;
|
|
105
|
+
clear(): void;
|
|
106
|
+
private kind;
|
|
107
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnAlertService, never>;
|
|
108
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MnAlertService>;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
declare class MnAlertStore {
|
|
112
|
+
private readonly _alerts$;
|
|
113
|
+
readonly alerts$: rxjs.Observable<MnAlert[]>;
|
|
114
|
+
/** Host configuration, when the app provided one. Only `maxVisible` is read here — the
|
|
115
|
+
* per-kind durations are resolved by {@link MnAlertService} before an alert reaches the store. */
|
|
116
|
+
private readonly cfg;
|
|
117
|
+
/** In-flight auto-dismiss timers keyed by alert id, so an alert that leaves early (dismissed
|
|
118
|
+
* by hand, or pushed out by the visible cap) never fires a stale timeout later. */
|
|
119
|
+
private readonly timers;
|
|
120
|
+
/** How many alerts stay on screen at once; showing more drops the oldest ones. */
|
|
121
|
+
private get maxVisible();
|
|
122
|
+
show(partial: Omit<MnAlert, 'id'>): MnAlertId;
|
|
123
|
+
dismiss(id: MnAlertId): void;
|
|
124
|
+
clear(): void;
|
|
125
|
+
private clearTimer;
|
|
126
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnAlertStore, never>;
|
|
127
|
+
static ɵprov: i0.ɵɵInjectableDeclaration<MnAlertStore>;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
type MnAlertTemplateContext = {
|
|
131
|
+
$implicit: MnAlert;
|
|
132
|
+
alert: MnAlert;
|
|
133
|
+
dismiss: () => void;
|
|
134
|
+
};
|
|
135
|
+
/**
|
|
136
|
+
* A view-owned wrapper around a single {@link MnAlert}. The store's list is the source
|
|
137
|
+
* of truth for which alerts *exist*; this outlet mirrors it into `views` so a removed
|
|
138
|
+
* alert can play a leave animation (swipe-fling or fade + height-collapse) before its
|
|
139
|
+
* node is actually dropped, rather than vanishing instantly.
|
|
140
|
+
*/
|
|
141
|
+
type MnAlertView = {
|
|
142
|
+
alert: MnAlert;
|
|
143
|
+
/** True once the alert has left the store — the node is animating out and will be removed. */
|
|
144
|
+
leaving: boolean;
|
|
145
|
+
/** True while the user is actively dragging this card (disables the snap transition). */
|
|
146
|
+
dragging: boolean;
|
|
147
|
+
/** Live drag offset (px) along the active swipe axis while swiping. */
|
|
148
|
+
drag: number;
|
|
149
|
+
/** Final offset (px) along the swipe axis the card flings to when a swipe dismisses it. */
|
|
150
|
+
fling: number;
|
|
151
|
+
};
|
|
152
|
+
declare class MnAlertOutletComponent {
|
|
153
|
+
private readonly lang;
|
|
154
|
+
private readonly store;
|
|
155
|
+
private readonly destroyRef;
|
|
156
|
+
/** Drag distance (px) past which a release dismisses regardless of speed. */
|
|
157
|
+
private static readonly SWIPE_DISMISS_THRESHOLD;
|
|
158
|
+
/** Release speed (px/ms) above which a short drag still dismisses — a "flick". */
|
|
159
|
+
private static readonly FLICK_VELOCITY;
|
|
160
|
+
/** Minimum drag distance (px) a flick must cover, so an incidental fast tap never dismisses. */
|
|
161
|
+
private static readonly FLICK_MIN_DISTANCE;
|
|
162
|
+
/** Upper bound for the leave wait; kept a touch longer than the CSS exit so removal never
|
|
163
|
+
* preempts the animation. Mirrored by the `--mn-alert-exit` duration in the stylesheet. */
|
|
164
|
+
private static readonly EXIT_MS;
|
|
165
|
+
/** Opacity floor a card fades to at the dismiss threshold, for drag feedback. */
|
|
166
|
+
private static readonly DRAG_OPACITY_FLOOR;
|
|
167
|
+
/**
|
|
168
|
+
* How the dismiss swipe is oriented:
|
|
169
|
+
* - `'auto'` (default) matches the host platform's convention — Apple platforms
|
|
170
|
+
* (iOS/iPadOS/macOS) flick a top banner *upward*, so we swipe vertically; Android (and
|
|
171
|
+
* every other platform) dismisses toasts *to the right*, so we swipe horizontally.
|
|
172
|
+
*
|
|
173
|
+
* Either axis is one-directional: only an upward (vertical) or rightward (horizontal)
|
|
174
|
+
* drag dismisses; dragging the opposite way springs the card back.
|
|
175
|
+
* - `'vertical'` / `'horizontal'` force the axis regardless of platform. Useful when the
|
|
176
|
+
* host can't be sniffed reliably (e.g. Chrome DevTools *Responsive* mode does not spoof
|
|
177
|
+
* the user agent, so `'auto'` there resolves to the desktop/Android horizontal axis).
|
|
178
|
+
*/
|
|
179
|
+
swipeAxis: 'auto' | 'vertical' | 'horizontal';
|
|
180
|
+
/** Whether the running device is an Apple platform. Sniffed once from `navigator` at
|
|
181
|
+
* construction (the UA is read at page load and does not change mid-session). */
|
|
182
|
+
private readonly isApple;
|
|
183
|
+
/** The resolved swipe axis: the explicit {@link swipeAxis} override, or the platform
|
|
184
|
+
* default when left on `'auto'`. */
|
|
185
|
+
private get vertical();
|
|
186
|
+
/**
|
|
187
|
+
* Accessible name for this control. Resolved through the conventional
|
|
188
|
+
* `mnAlert.close` key so an app can translate it, falling back to English when the
|
|
189
|
+
* key is not defined rather than leaking the raw key into the UI.
|
|
190
|
+
*/
|
|
191
|
+
get closeLabel(): string;
|
|
192
|
+
template?: TemplateRef<MnAlertTemplateContext>;
|
|
193
|
+
/** The view-layer mirror of the store's alerts, retaining alerts mid-leave. A signal so
|
|
194
|
+
* writes from the (external) store subscription and leave timers schedule change
|
|
195
|
+
* detection in a zoneless app. */
|
|
196
|
+
readonly views: i0.WritableSignal<MnAlertView[]>;
|
|
197
|
+
/**
|
|
198
|
+
* `touch-action` for the swipe wrapper: reserve the swipe axis for our gesture while
|
|
199
|
+
* leaving the cross-axis to the browser. Vertical swipe (Apple) claims the Y axis
|
|
200
|
+
* (`pan-x`); horizontal swipe (Android/other) claims the X axis (`pan-y`).
|
|
201
|
+
*/
|
|
202
|
+
get touchAction(): string;
|
|
203
|
+
/** In-flight leave-removal timers, keyed by alert id, cleared on destroy so a fired
|
|
204
|
+
* timer never touches a torn-down view. */
|
|
205
|
+
private readonly exitTimers;
|
|
206
|
+
/** The single active swipe, or null. Only one card is dragged at a time. `startCoord`
|
|
207
|
+
* and the samples are taken along the active axis (Y when vertical, else X). */
|
|
208
|
+
private activeDrag;
|
|
209
|
+
constructor();
|
|
210
|
+
trackById: (_: number, v: MnAlertView) => string;
|
|
211
|
+
getAlertClasses(a: MnAlert): string;
|
|
212
|
+
/**
|
|
213
|
+
* The lifetime (ms) to run the countdown bar over, or null when no bar should show: an alert
|
|
214
|
+
* that never auto-dismisses has nothing to count down, and one already leaving would only
|
|
215
|
+
* restart the animation mid-exit.
|
|
216
|
+
*/
|
|
217
|
+
countdownDuration(v: MnAlertView): number | null;
|
|
218
|
+
contextFor(a: MnAlert): {
|
|
219
|
+
readonly $implicit: MnAlert;
|
|
220
|
+
readonly alert: MnAlert;
|
|
221
|
+
readonly dismiss: () => void;
|
|
222
|
+
};
|
|
223
|
+
/** Dismisses via the store; the store's removal is turned into a leave animation by
|
|
224
|
+
* {@link sync}. Used by the close button and the custom-template `dismiss` context. */
|
|
225
|
+
dismissAlert(id: MnAlertId): void;
|
|
226
|
+
/** Reconciles the view list against the store: appends new alerts, updates the alert
|
|
227
|
+
* reference for still-present ones, and marks vanished ones as leaving (they stay in the
|
|
228
|
+
* list, animating out, until their removal timer fires). */
|
|
229
|
+
private sync;
|
|
230
|
+
/** Flags a view as leaving and schedules its removal once the exit animation has run.
|
|
231
|
+
* Idempotent: a card already leaving (e.g. flung by a swipe) is left untouched, so a
|
|
232
|
+
* synchronous store re-emit cannot overwrite the swipe direction with the default fade. */
|
|
233
|
+
private beginLeave;
|
|
234
|
+
private removeView;
|
|
235
|
+
onPointerDown(event: PointerEvent, v: MnAlertView): void;
|
|
236
|
+
onPointerMove(event: PointerEvent, v: MnAlertView): void;
|
|
237
|
+
onPointerUp(event: PointerEvent, v: MnAlertView): void;
|
|
238
|
+
private shouldDismiss;
|
|
239
|
+
/** Offset transform for a card: the fling target while leaving via swipe, otherwise the
|
|
240
|
+
* live drag offset, translated along the active axis. Returns null when neither applies,
|
|
241
|
+
* letting the stylesheet own the default (fade-in-place) leave. */
|
|
242
|
+
itemTransform(v: MnAlertView): string | null;
|
|
243
|
+
/** Fades a card toward a floor as it is dragged toward the dismiss threshold. Null (CSS
|
|
244
|
+
* owns opacity) when at rest or leaving. */
|
|
245
|
+
itemOpacity(v: MnAlertView): number | null;
|
|
246
|
+
private translate;
|
|
247
|
+
private axisCoord;
|
|
248
|
+
private viewportExtent;
|
|
249
|
+
/** Whether the current device runs an Apple OS (iOS/iPadOS/macOS). iPadOS 13+ masquerades
|
|
250
|
+
* as a Mac, so it is caught by the touch-capable-Mac branch. */
|
|
251
|
+
private detectApple;
|
|
252
|
+
private prefersReducedMotion;
|
|
253
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnAlertOutletComponent, never>;
|
|
254
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnAlertOutletComponent, "mn-alert-outlet", never, { "swipeAxis": { "alias": "swipeAxis"; "required": false; }; "template": { "alias": "template"; "required": false; }; }, {}, never, never, true, never>;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
export { DEFAULT_MN_ALERT_CONFIG, MN_ALERT_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, mnAlertVariants, provideMnAlerts };
|
|
258
|
+
export type { MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnShowInput };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { OnInit, OnDestroy, EventEmitter } from '@angular/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* A viewport-anchored bottom sheet — the mobile presentation shared by the modal
|
|
6
|
+
* shell and the multi-select dropdown.
|
|
7
|
+
*
|
|
8
|
+
* It owns only the sheet *chrome and gestures*: a bottom-anchored, full-width,
|
|
9
|
+
* rounded-top surface with an optional dimming backdrop and drag grabber, a
|
|
10
|
+
* slide-up entrance, swipe/flick-to-dismiss, and a promise-based slide-down exit.
|
|
11
|
+
* It is deliberately presentational: the body is projected via `<ng-content>`, and
|
|
12
|
+
* dismissal is reported through {@link dismiss} for the host to act on (run a close
|
|
13
|
+
* guard, tear down its overlay, …) rather than being handled here.
|
|
14
|
+
*
|
|
15
|
+
* Positioning is `position: fixed` against the viewport, so the host relocates itself
|
|
16
|
+
* to `document.body` on init and blocks scrolling behind it while open. Both are
|
|
17
|
+
* unconditional: rendering viewport-fixed chrome in place made correctness depend on
|
|
18
|
+
* where a consumer happened to write the tag. A `transform`/`filter`/`contain`
|
|
19
|
+
* ancestor becomes the containing block and pushes the sheet to the middle of the
|
|
20
|
+
* screen — which a *stacked* modal did to its own sheet — and, because `position:
|
|
21
|
+
* fixed` moves where an element paints but not where it sits in the DOM, a gesture on
|
|
22
|
+
* the backdrop still scrolled whichever ancestor was the scroll container.
|
|
23
|
+
*
|
|
24
|
+
* The multi-select and dropdown used to do the relocating themselves; that is why the
|
|
25
|
+
* behaviour reads as new here but is not new to them.
|
|
26
|
+
*/
|
|
27
|
+
declare class MnBottomSheet implements OnInit, OnDestroy {
|
|
28
|
+
/** Tailwind's `sm` breakpoint — at or below this the swipe gesture is armed.
|
|
29
|
+
* Kept in step with the same constant in the modal shell and multi-select. */
|
|
30
|
+
private static readonly SHEET_MAX_WIDTH;
|
|
31
|
+
/** Drag distance (px) past which a release dismisses regardless of speed. */
|
|
32
|
+
private static readonly SWIPE_DISMISS_THRESHOLD;
|
|
33
|
+
/** Downward release speed (px/ms) above which a short drag still dismisses — a "flick". */
|
|
34
|
+
private static readonly FLICK_VELOCITY;
|
|
35
|
+
/** Minimum drag distance (px) a flick must cover, so an incidental fast tap never dismisses. */
|
|
36
|
+
private static readonly FLICK_MIN_DISTANCE;
|
|
37
|
+
/** Upper bound for the exit wait if no `transitionend` fires (e.g. animation suppressed). */
|
|
38
|
+
private static readonly CLOSE_FALLBACK_MS;
|
|
39
|
+
/** Whether to render the dimming backdrop behind the sheet (default: true).
|
|
40
|
+
* A host that already paints its own backdrop (the modal shell) sets this false. */
|
|
41
|
+
showBackdrop: boolean;
|
|
42
|
+
/** Whether to render the drag grabber handle that arms swipe-to-dismiss (default: true). */
|
|
43
|
+
showGrabber: boolean;
|
|
44
|
+
/** Whether the sheet can be dismissed by the user via swipe/flick or backdrop tap
|
|
45
|
+
* (default: true). When false the gestures are inert and the backdrop is non-closing. */
|
|
46
|
+
dismissible: boolean;
|
|
47
|
+
/** Optional `min-height` floor (px) for the container, so filtering its content
|
|
48
|
+
* shorter cannot shrink the sheet mid-interaction. Null leaves it content-sized. */
|
|
49
|
+
minHeightPx: number | null;
|
|
50
|
+
/** Cap on the sheet height as a fraction of the viewport, in vh (default: 80). */
|
|
51
|
+
maxHeightVh: number;
|
|
52
|
+
/** Extra class(es) applied to the sheet container, so a host can attach the hooks
|
|
53
|
+
* its own CSS depends on (e.g. the modal shell's `modal-container`). */
|
|
54
|
+
containerClass: string;
|
|
55
|
+
/** Accessible name for the sheet dialog. */
|
|
56
|
+
ariaLabel?: string;
|
|
57
|
+
/** Id of the element that labels this dialog (takes precedence over `ariaLabel`). */
|
|
58
|
+
ariaLabelledby?: string;
|
|
59
|
+
/**
|
|
60
|
+
* When true, the sheet grows to its `maxHeightVh` while the host app marks the soft
|
|
61
|
+
* keyboard open (a `.mn-keyboard-open` class on a document ancestor), guaranteeing
|
|
62
|
+
* scroll room to lift a focused field above an overlaying keyboard. Off by default so
|
|
63
|
+
* a keyboard opened over an unrelated sheet (a multi-select search) does not resize it.
|
|
64
|
+
*/
|
|
65
|
+
growWithKeyboard: boolean;
|
|
66
|
+
/**
|
|
67
|
+
* Optional async gate consulted before a user-initiated dismissal (swipe/flick/backdrop
|
|
68
|
+
* tap) is committed. Resolving false aborts the dismissal and springs the sheet back —
|
|
69
|
+
* used by the modal to run its close guard (e.g. an unsaved-changes prompt). A
|
|
70
|
+
* programmatic {@link startClosing} bypasses it.
|
|
71
|
+
*/
|
|
72
|
+
dismissGuard?: () => boolean | Promise<boolean>;
|
|
73
|
+
/**
|
|
74
|
+
* Emitted once the user has dismissed the sheet — after the slide-down exit has
|
|
75
|
+
* finished, so the host can remove the sheet from the DOM without cutting the
|
|
76
|
+
* animation short. The host decides what dismissal means (close, run a guard, …).
|
|
77
|
+
*/
|
|
78
|
+
dismiss: EventEmitter<void>;
|
|
79
|
+
/** Current downward drag offset (px) applied to the sheet while swiping. */
|
|
80
|
+
sheetDragY: number;
|
|
81
|
+
/** True while the user is actively dragging the grabber (disables the snap transition). */
|
|
82
|
+
isDraggingSheet: boolean;
|
|
83
|
+
/** True once a dismissal has committed — the sheet glides off-screen via its transition. */
|
|
84
|
+
isDismissing: boolean;
|
|
85
|
+
private readonly cdr;
|
|
86
|
+
private readonly el;
|
|
87
|
+
/** The sheet container element, used to measure its height and drive the exit. */
|
|
88
|
+
private readonly containerRef;
|
|
89
|
+
private dragStartY;
|
|
90
|
+
/** The two most recent (y, timestamp) pointer samples, for estimating flick velocity.
|
|
91
|
+
* `t` uses the event timestamp (monotonic), so no wall-clock is read. */
|
|
92
|
+
private lastSample;
|
|
93
|
+
private prevSample;
|
|
94
|
+
/** In-flight exit animation, so a swipe-dismiss and a follow-up programmatic
|
|
95
|
+
* {@link startClosing} share one glide instead of re-triggering it. */
|
|
96
|
+
private exitPromise;
|
|
97
|
+
/** The host node once moved to `document.body`, so it is only detached if we moved it. */
|
|
98
|
+
private portalledHost;
|
|
99
|
+
/** Blocks scroll gestures aimed at anything behind the sheet, while it is open. */
|
|
100
|
+
private scrollGuard;
|
|
101
|
+
/** Moves the host out to `document.body` and stops the page behind scrolling. */
|
|
102
|
+
ngOnInit(): void;
|
|
103
|
+
/**
|
|
104
|
+
* Stops pointer scrolling behind the sheet for as long as it is open.
|
|
105
|
+
*
|
|
106
|
+
* Cancels the gesture rather than setting `overflow: hidden` on `document.body`: an
|
|
107
|
+
* app whose scroll container is a layout element (a `<main>`, a drawer body) leaves
|
|
108
|
+
* `body` unscrollable, so locking it there is a no-op and the page still slides about
|
|
109
|
+
* under the sheet. Cancelling `wheel` and `touchmove` before anything acts on them
|
|
110
|
+
* holds regardless of which element does the scrolling.
|
|
111
|
+
*
|
|
112
|
+
* Gestures that begin inside the sheet are let through so its own content still
|
|
113
|
+
* scrolls; `overscroll-behavior: contain` keeps those from chaining out at the ends.
|
|
114
|
+
*
|
|
115
|
+
* Pointer input only. Page Down and the arrows still reach the page behind when focus
|
|
116
|
+
* is left there — closing that needs either a key filter or moving focus into the
|
|
117
|
+
* sheet, and neither belongs in this change.
|
|
118
|
+
*/
|
|
119
|
+
private lockScroll;
|
|
120
|
+
/** Releases the scroll guard. Idempotent. */
|
|
121
|
+
private unlockScroll;
|
|
122
|
+
/**
|
|
123
|
+
* Detaches the relocated host.
|
|
124
|
+
*
|
|
125
|
+
* Angular tears a view down by removing the nodes it created from their parent; a
|
|
126
|
+
* host we moved to `body` is no longer among the parent's children, so without
|
|
127
|
+
* this the sheet would outlive the view that declared it.
|
|
128
|
+
*/
|
|
129
|
+
ngOnDestroy(): void;
|
|
130
|
+
get hostClasses(): string;
|
|
131
|
+
/** Whether the viewport is currently narrow enough for the sheet to accept a swipe. */
|
|
132
|
+
private get isNarrow();
|
|
133
|
+
onSheetPointerDown(event: PointerEvent): void;
|
|
134
|
+
onSheetPointerMove(event: PointerEvent): void;
|
|
135
|
+
onSheetPointerUp(): void;
|
|
136
|
+
onBackdropClick(): void;
|
|
137
|
+
/**
|
|
138
|
+
* Plays the slide-down exit and resolves once it has finished. Exposed so a host that
|
|
139
|
+
* dismisses the sheet programmatically (not via a gesture) can await the same exit
|
|
140
|
+
* before tearing the sheet down. Idempotent: a swipe-dismiss already in flight and a
|
|
141
|
+
* subsequent programmatic close share the one glide rather than restarting it.
|
|
142
|
+
*/
|
|
143
|
+
startClosing(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Runs the optional {@link dismissGuard}, then either commits the dismissal (glide out
|
|
146
|
+
* + emit) or springs the sheet back if the guard rejects. A non-dismissible sheet never
|
|
147
|
+
* gets here from a gesture, but the guard is still short-circuited defensively.
|
|
148
|
+
*/
|
|
149
|
+
private attemptDismiss;
|
|
150
|
+
/** Whether the release should dismiss: a long-enough drag OR a fast downward flick. */
|
|
151
|
+
private shouldDismiss;
|
|
152
|
+
/** Downward release speed (px/ms) from the last two pointer samples; 0 when unusable. */
|
|
153
|
+
private releaseVelocity;
|
|
154
|
+
/** Springs the sheet back to its resting position after a drag that didn't dismiss. */
|
|
155
|
+
private snapBack;
|
|
156
|
+
/**
|
|
157
|
+
* Commits a dismissal: glides the sheet the rest of the way off-screen, then emits
|
|
158
|
+
* {@link dismiss} once the exit animation settles. Continuing the gesture (rather than
|
|
159
|
+
* snapping back to 0 first) keeps a swipe feeling like one unbroken motion.
|
|
160
|
+
*/
|
|
161
|
+
private commitDismiss;
|
|
162
|
+
/** Commits the exit animation exactly once and returns the shared in-flight promise.
|
|
163
|
+
* Short-circuits under reduced motion and falls back to a timeout if no event fires. */
|
|
164
|
+
private playExit;
|
|
165
|
+
/** Waits for the container's exit transition to end, with a reduced-motion short-circuit
|
|
166
|
+
* and a fallback timeout so it always resolves. */
|
|
167
|
+
private awaitExit;
|
|
168
|
+
private prefersReducedMotion;
|
|
169
|
+
static ɵfac: i0.ɵɵFactoryDeclaration<MnBottomSheet, never>;
|
|
170
|
+
static ɵcmp: i0.ɵɵComponentDeclaration<MnBottomSheet, "mn-bottom-sheet", never, { "showBackdrop": { "alias": "showBackdrop"; "required": false; }; "showGrabber": { "alias": "showGrabber"; "required": false; }; "dismissible": { "alias": "dismissible"; "required": false; }; "minHeightPx": { "alias": "minHeightPx"; "required": false; }; "maxHeightVh": { "alias": "maxHeightVh"; "required": false; }; "containerClass": { "alias": "containerClass"; "required": false; }; "ariaLabel": { "alias": "ariaLabel"; "required": false; }; "ariaLabelledby": { "alias": "ariaLabelledby"; "required": false; }; "growWithKeyboard": { "alias": "growWithKeyboard"; "required": false; }; "dismissGuard": { "alias": "dismissGuard"; "required": false; }; }, { "dismiss": "dismiss"; }, never, ["*"], true, never>;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { MnBottomSheet };
|