import * as i0 from '@angular/core'; import { InjectionToken, Provider, TemplateRef } from '@angular/core'; import * as tailwind_variants from 'tailwind-variants'; import { VariantProps } from 'tailwind-variants'; import * as rxjs from 'rxjs'; declare const mnAlertVariants: tailwind_variants.TVReturnType<{ kind: { success: string; info: string; warning: string; error: string; default: string; accent: string; }; variant: { fill: string; outline: string; soft: string; }; }, undefined, "flex items-start gap-3 p-4 border rounded-xl shadow-sm transition-all duration-300 w-full ", { kind: { success: string; info: string; warning: string; error: string; default: string; accent: string; }; variant: { fill: string; outline: string; soft: string; }; }, undefined, tailwind_variants.TVReturnType<{ kind: { success: string; info: string; warning: string; error: string; default: string; accent: string; }; variant: { fill: string; outline: string; soft: string; }; }, undefined, "flex items-start gap-3 p-4 border rounded-xl shadow-sm transition-all duration-300 w-full ", unknown, unknown, undefined>>; type MnAlertVariants = VariantProps; type MnAlertId = string; type MnAlert = { id: MnAlertId; title: string; subTitle?: string; icon?: unknown; cssClass?: string; duration?: number; meta?: Record; kind: MnAlertKind; variant?: MnAlertVariants['variant']; }; type MnAlertKind = 'success' | 'info' | 'warning' | 'error' | 'default'; type MnAlertConfig = { durations?: Partial>; cssClasses?: Partial>; icons?: Partial>; fallbackDuration?: number | null; /** * How many alerts may be on screen at once. Showing one past this cap drops the oldest * alert still visible, so a burst of alerts never grows into an unreadable stack. */ maxVisible?: number; finalize?: (a: MnAlert) => MnAlert; }; declare const MN_ALERT_CONFIG: InjectionToken; declare const DEFAULT_MN_ALERT_CONFIG: Required; declare function provideMnAlerts(config?: MnAlertConfig): Provider; type MnShowInput = { title: string; subTitle?: string; duration?: number; icon?: unknown; cssClass?: string; meta?: Record; kind: MnAlertKind; variant?: MnAlertVariants['variant']; }; declare class MnAlertService { private readonly store; private readonly cfg; private readonly userDurations?; private readonly hasUserDurations; constructor(); show(input: MnShowInput): MnAlertId; success(title: string, subTitle?: string, extra?: Partial): string; info(title: string, subTitle?: string, extra?: Partial): string; warning(title: string, subTitle?: string, extra?: Partial): string; error(title: string, subTitle?: string, extra?: Partial): string; dismiss(id: MnAlertId): void; clear(): void; private kind; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } declare class MnAlertStore { private readonly _alerts$; readonly alerts$: rxjs.Observable; /** Host configuration, when the app provided one. Only `maxVisible` is read here — the * per-kind durations are resolved by {@link MnAlertService} before an alert reaches the store. */ private readonly cfg; /** In-flight auto-dismiss timers keyed by alert id, so an alert that leaves early (dismissed * by hand, or pushed out by the visible cap) never fires a stale timeout later. */ private readonly timers; /** How many alerts stay on screen at once; showing more drops the oldest ones. */ private get maxVisible(); show(partial: Omit): MnAlertId; dismiss(id: MnAlertId): void; clear(): void; private clearTimer; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵprov: i0.ɵɵInjectableDeclaration; } type MnAlertTemplateContext = { $implicit: MnAlert; alert: MnAlert; dismiss: () => void; }; /** * A view-owned wrapper around a single {@link MnAlert}. The store's list is the source * of truth for which alerts *exist*; this outlet mirrors it into `views` so a removed * alert can play a leave animation (swipe-fling or fade + height-collapse) before its * node is actually dropped, rather than vanishing instantly. */ type MnAlertView = { alert: MnAlert; /** True once the alert has left the store — the node is animating out and will be removed. */ leaving: boolean; /** True while the user is actively dragging this card (disables the snap transition). */ dragging: boolean; /** Live drag offset (px) along the active swipe axis while swiping. */ drag: number; /** Final offset (px) along the swipe axis the card flings to when a swipe dismisses it. */ fling: number; }; declare class MnAlertOutletComponent { private readonly lang; private readonly store; private readonly destroyRef; /** Drag distance (px) past which a release dismisses regardless of speed. */ private static readonly SWIPE_DISMISS_THRESHOLD; /** Release speed (px/ms) above which a short drag still dismisses — a "flick". */ private static readonly FLICK_VELOCITY; /** Minimum drag distance (px) a flick must cover, so an incidental fast tap never dismisses. */ private static readonly FLICK_MIN_DISTANCE; /** Upper bound for the leave wait; kept a touch longer than the CSS exit so removal never * preempts the animation. Mirrored by the `--mn-alert-exit` duration in the stylesheet. */ private static readonly EXIT_MS; /** Opacity floor a card fades to at the dismiss threshold, for drag feedback. */ private static readonly DRAG_OPACITY_FLOOR; /** * How the dismiss swipe is oriented: * - `'auto'` (default) matches the host platform's convention — Apple platforms * (iOS/iPadOS/macOS) flick a top banner *upward*, so we swipe vertically; Android (and * every other platform) dismisses toasts *to the right*, so we swipe horizontally. * * Either axis is one-directional: only an upward (vertical) or rightward (horizontal) * drag dismisses; dragging the opposite way springs the card back. * - `'vertical'` / `'horizontal'` force the axis regardless of platform. Useful when the * host can't be sniffed reliably (e.g. Chrome DevTools *Responsive* mode does not spoof * the user agent, so `'auto'` there resolves to the desktop/Android horizontal axis). */ swipeAxis: 'auto' | 'vertical' | 'horizontal'; /** Whether the running device is an Apple platform. Sniffed once from `navigator` at * construction (the UA is read at page load and does not change mid-session). */ private readonly isApple; /** The resolved swipe axis: the explicit {@link swipeAxis} override, or the platform * default when left on `'auto'`. */ private get vertical(); /** * Accessible name for this control. Resolved through the conventional * `mnAlert.close` key so an app can translate it, falling back to English when the * key is not defined rather than leaking the raw key into the UI. */ get closeLabel(): string; template?: TemplateRef; /** The view-layer mirror of the store's alerts, retaining alerts mid-leave. A signal so * writes from the (external) store subscription and leave timers schedule change * detection in a zoneless app. */ readonly views: i0.WritableSignal; /** * `touch-action` for the swipe wrapper: reserve the swipe axis for our gesture while * leaving the cross-axis to the browser. Vertical swipe (Apple) claims the Y axis * (`pan-x`); horizontal swipe (Android/other) claims the X axis (`pan-y`). */ get touchAction(): string; /** In-flight leave-removal timers, keyed by alert id, cleared on destroy so a fired * timer never touches a torn-down view. */ private readonly exitTimers; /** The single active swipe, or null. Only one card is dragged at a time. `startCoord` * and the samples are taken along the active axis (Y when vertical, else X). */ private activeDrag; constructor(); trackById: (_: number, v: MnAlertView) => string; getAlertClasses(a: MnAlert): string; /** * The lifetime (ms) to run the countdown bar over, or null when no bar should show: an alert * that never auto-dismisses has nothing to count down, and one already leaving would only * restart the animation mid-exit. */ countdownDuration(v: MnAlertView): number | null; contextFor(a: MnAlert): { readonly $implicit: MnAlert; readonly alert: MnAlert; readonly dismiss: () => void; }; /** Dismisses via the store; the store's removal is turned into a leave animation by * {@link sync}. Used by the close button and the custom-template `dismiss` context. */ dismissAlert(id: MnAlertId): void; /** Reconciles the view list against the store: appends new alerts, updates the alert * reference for still-present ones, and marks vanished ones as leaving (they stay in the * list, animating out, until their removal timer fires). */ private sync; /** Flags a view as leaving and schedules its removal once the exit animation has run. * Idempotent: a card already leaving (e.g. flung by a swipe) is left untouched, so a * synchronous store re-emit cannot overwrite the swipe direction with the default fade. */ private beginLeave; private removeView; onPointerDown(event: PointerEvent, v: MnAlertView): void; onPointerMove(event: PointerEvent, v: MnAlertView): void; onPointerUp(event: PointerEvent, v: MnAlertView): void; private shouldDismiss; /** Offset transform for a card: the fling target while leaving via swipe, otherwise the * live drag offset, translated along the active axis. Returns null when neither applies, * letting the stylesheet own the default (fade-in-place) leave. */ itemTransform(v: MnAlertView): string | null; /** Fades a card toward a floor as it is dragged toward the dismiss threshold. Null (CSS * owns opacity) when at rest or leaving. */ itemOpacity(v: MnAlertView): number | null; private translate; private axisCoord; private viewportExtent; /** Whether the current device runs an Apple OS (iOS/iPadOS/macOS). iPadOS 13+ masquerades * as a Mac, so it is caught by the touch-capable-Mac branch. */ private detectApple; private prefersReducedMotion; static ɵfac: i0.ɵɵFactoryDeclaration; static ɵcmp: i0.ɵɵComponentDeclaration; } export { DEFAULT_MN_ALERT_CONFIG, MN_ALERT_CONFIG, MnAlertOutletComponent, MnAlertService, MnAlertStore, mnAlertVariants, provideMnAlerts }; export type { MnAlert, MnAlertConfig, MnAlertId, MnAlertKind, MnAlertTemplateContext, MnAlertVariants, MnShowInput };