customizable-toast-notification 3.19.0 → 3.20.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/dist/index.d.ts CHANGED
@@ -62,6 +62,8 @@ type ToastGlobalConfig$1 = {
62
62
  pauseOnHover?: boolean;
63
63
  syncTabs: boolean;
64
64
  aiPrioritization: boolean;
65
+ shadowDom?: boolean;
66
+ trapFocus?: boolean;
65
67
  debug?: boolean;
66
68
  priorityScorer?: ((context: {
67
69
  type: string;
@@ -74,6 +76,60 @@ type ToastGlobalConfig$1 = {
74
76
  onMetrics?: ((metrics: ToastMetrics$1) => void) | null;
75
77
  };
76
78
 
79
+ /**
80
+ * Returns a read-only snapshot copy of the notification history ring buffer.
81
+ * @returns {ToastHistoryEntry[]}
82
+ */
83
+ declare function getToastHistory(): ToastHistoryEntry$1[];
84
+ /**
85
+ * Clears all entries from the notification history ring buffer.
86
+ */
87
+ declare function clearToastHistory(): void;
88
+ /**
89
+ * Sets the maximum capacity of the history ring buffer.
90
+ * @param {number} capacity - Maximum number of items to retain (minimum 1)
91
+ */
92
+ declare function setHistoryCapacity(capacity: number): void;
93
+ /**
94
+ * Resets the history buffer back to empty and restores default capacity.
95
+ */
96
+ declare function resetToastHistory(): void;
97
+ type ToastType$1 = "info" | "success" | "error" | "warning";
98
+ type ToastHistoryEntry$1 = {
99
+ /**
100
+ * - Unique toast key or identifier
101
+ */
102
+ id: string;
103
+ /**
104
+ * - Notification text message
105
+ */
106
+ message: string;
107
+ /**
108
+ * - Notification status type
109
+ */
110
+ type: ToastType$1;
111
+ /**
112
+ * - Toast placement coordinates
113
+ */
114
+ position: string;
115
+ /**
116
+ * - Unix timestamp (ms) when created
117
+ */
118
+ timestamp: number;
119
+ /**
120
+ * - Unix timestamp (ms) when dismissed
121
+ */
122
+ dismissedAt?: number;
123
+ /**
124
+ * - Current lifecycle status
125
+ */
126
+ status: "active" | "dismissed" | "dropped";
127
+ /**
128
+ * - Snapshot of configured options
129
+ */
130
+ options?: Record<string, unknown>;
131
+ };
132
+
77
133
  /**
78
134
  * Returns a real-time snapshot of toast manager telemetry metrics.
79
135
  * @returns {import('../utils/config.js').ToastMetrics}
@@ -560,6 +616,63 @@ type SpringConfig$1 = {
560
616
  };
561
617
  type SpringPreset$1 = "default" | "gentle" | "wobbly" | "stiff" | "bouncy" | string;
562
618
 
619
+ /**
620
+ * Sets the active global locale for toast notifications.
621
+ * @param {string} locale - Locale code (e.g. 'en', 'hi', 'es', 'fr', 'de', 'ar', 'ja')
622
+ * @returns {string} The active locale code
623
+ */
624
+ declare function setLocale(locale: string): string;
625
+ /**
626
+ * Returns the currently active global locale code.
627
+ * @returns {string} Current locale code
628
+ */
629
+ declare function getLocale(): string;
630
+ /**
631
+ * Returns a list of all currently supported locale codes.
632
+ * @returns {string[]} Array of locale codes
633
+ */
634
+ declare function getAvailableLocales(): string[];
635
+ /**
636
+ * Registers or overrides localized messages for a given locale code.
637
+ * @param {string} locale - Locale code (e.g. 'it', 'pt', 'zh')
638
+ * @param {LocaleMessages} messages - Dictionary of localized messages
639
+ */
640
+ declare function registerLocale(locale: string, messages: LocaleMessages): void;
641
+ /**
642
+ * Resets the active locale back to 'en' and clears any registered custom locales.
643
+ */
644
+ declare function resetLocale(): void;
645
+ type LocaleMessages = {
646
+ /**
647
+ * - Default success message
648
+ */
649
+ success?: string;
650
+ /**
651
+ * - Default error message
652
+ */
653
+ error?: string;
654
+ /**
655
+ * - Default warning message
656
+ */
657
+ warning?: string;
658
+ /**
659
+ * - Default information message
660
+ */
661
+ info?: string;
662
+ /**
663
+ * - Default loading message
664
+ */
665
+ loading?: string;
666
+ /**
667
+ * - Default Undo action label
668
+ */
669
+ undo?: string;
670
+ /**
671
+ * - Default Close button aria-label
672
+ */
673
+ close?: string;
674
+ };
675
+
563
676
  type SoundPreset = "modern" | "retro" | "futuristic" | "subtle" | "bell" | string;
564
677
  type ToastType = "info" | "success" | "error" | "warning";
565
678
  type ToastPosition = "top-left" | "top-right" | "bottom-left" | "bottom-right" | "top-center" | "bottom-center" | "left-center" | "right-center" | "top-full-width" | "bottom-full-width" | "center";
@@ -663,9 +776,60 @@ type ToastOptions = {
663
776
  progress?: number | string | "indeterminate";
664
777
  progressNormalized?: boolean;
665
778
  syncTabs?: boolean;
779
+ syncDismiss?: boolean;
666
780
  aiPrioritization?: boolean;
667
781
  priority?: number;
668
782
  usePool?: boolean;
783
+ /**
784
+ * - Optional thread/tag identifier for replacement/updating
785
+ */
786
+ tag?: string;
787
+ /**
788
+ * - Optional group identifier for grouping related toasts
789
+ */
790
+ groupId?: string;
791
+ /**
792
+ * - Whether to trap keyboard Tab focus within the toast
793
+ */
794
+ trapFocus?: boolean;
795
+ /**
796
+ * - Whether to isolate the container in an attached Shadow DOM root
797
+ */
798
+ shadowDom?: boolean;
799
+ };
800
+ type ToastHistoryEntry = {
801
+ /**
802
+ * - Unique toast key or identifier
803
+ */
804
+ id: string;
805
+ /**
806
+ * - Notification text message
807
+ */
808
+ message: string;
809
+ /**
810
+ * - Notification status type
811
+ */
812
+ type: ToastType;
813
+ /**
814
+ * - Toast placement coordinates
815
+ */
816
+ position: string;
817
+ /**
818
+ * - Unix timestamp (ms) when created
819
+ */
820
+ timestamp: number;
821
+ /**
822
+ * - Unix timestamp (ms) when dismissed
823
+ */
824
+ dismissedAt?: number;
825
+ /**
826
+ * - Current lifecycle status
827
+ */
828
+ status: "active" | "dismissed" | "dropped";
829
+ /**
830
+ * - Snapshot of configured options
831
+ */
832
+ options?: Record<string, unknown>;
669
833
  };
670
834
  type ReducedMotionMode = "auto" | "always" | "never";
671
835
  type ToastTheme = "light" | "dark" | "high-contrast" | "compact" | "spacious" | "glass";
@@ -707,6 +871,8 @@ type ToastGlobalConfig = {
707
871
  soundPreset?: SoundPreset;
708
872
  syncTabs?: boolean;
709
873
  aiPrioritization?: boolean;
874
+ shadowDom?: boolean;
875
+ trapFocus?: boolean;
710
876
  debug?: boolean;
711
877
  priorityScorer?: ((context: {
712
878
  type: string;
@@ -787,6 +953,8 @@ declare namespace createToastWithPriority {
787
953
  export { dismissToast as dismiss };
788
954
  export { noopAll as dismissAll };
789
955
  export { noopAll as clear };
956
+ export { getToastHistory as getHistory };
957
+ export { clearToastHistory as clearHistory };
790
958
  }
791
959
  /**
792
960
  * Displays a success toast notification.
@@ -861,5 +1029,5 @@ declare const version: string;
861
1029
  */
862
1030
  declare function toastPromise<T>(promiseOrFn: Promise<T> | (() => Promise<T> | T), messages?: ToastPromiseMessages, options?: ToastOptions): Promise<T>;
863
1031
 
864
- export { calculateSpringSettlingDuration, calculateToastPriority, calculateVelocity, categorizeToast, clear, createGestureDetector, createToastWithPriority as createToast, custom, createToastWithPriority as default, detectPinch, dismissToast as dismiss, dismissAll, error, generateSpringLinearEasing, generateToastId, getAudioAnalyser, getAudioContext, getConfig, getSoundPresets, getSpringPresets, getSpringTransition, getToastBroadcaster, getToastMetrics, getToastPool, info, isAudioEnabled, isFlick, loading, noopAll as noop, playTone, registerSoundPreset, registerSpringPreset, resetAudioContext, resetConfig, resetContainerRegistry, resetSoundPresets, resetSpringPresets, resetToastBroadcaster, resetToastIdCounter, resetToastManager, resetToastPool, resolveSpringConfig, setAudioEnabled, setConfig, setDefaultColors, setDefaultMessages, shouldReduceMotion, solveSpring, success, toastPromise, updateToastByKey, version, warning };
865
- export type { CTAOptions, ReducedMotionMode, SoundPreset, SpringConfig, SpringPreset, ToastGlobalConfig, ToastHandle, ToastLoaderOptions, ToastMetrics, ToastMountTarget, ToastOptions, ToastPosition, ToastPromiseMessages, ToastTheme, ToastType, UndoOptions };
1032
+ export { calculateSpringSettlingDuration, calculateToastPriority, calculateVelocity, categorizeToast, clear, clearToastHistory, createGestureDetector, createToastWithPriority as createToast, custom, createToastWithPriority as default, detectPinch, dismissToast as dismiss, dismissAll, error, generateSpringLinearEasing, generateToastId, getAudioAnalyser, getAudioContext, getAvailableLocales, getConfig, getLocale, getSoundPresets, getSpringPresets, getSpringTransition, getToastBroadcaster, getToastHistory, getToastMetrics, getToastPool, info, isAudioEnabled, isFlick, loading, noopAll as noop, playTone, registerLocale, registerSoundPreset, registerSpringPreset, resetAudioContext, resetConfig, resetContainerRegistry, resetLocale, resetSoundPresets, resetSpringPresets, resetToastBroadcaster, resetToastHistory, resetToastIdCounter, resetToastManager, resetToastPool, resolveSpringConfig, setAudioEnabled, setConfig, setDefaultColors, setDefaultMessages, setHistoryCapacity, setLocale, shouldReduceMotion, solveSpring, success, toastPromise, updateToastByKey, version, warning };
1033
+ export type { CTAOptions, ReducedMotionMode, SoundPreset, SpringConfig, SpringPreset, ToastGlobalConfig, ToastHandle, ToastHistoryEntry, ToastLoaderOptions, ToastMetrics, ToastMountTarget, ToastOptions, ToastPosition, ToastPromiseMessages, ToastTheme, ToastType, UndoOptions };