customizable-toast-notification 3.16.0 → 3.17.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/CHANGELOG.md CHANGED
@@ -1,3 +1,37 @@
1
+ # [3.17.0](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.16.0...v3.17.0) (2026-10-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **a11y:** preserve default role=alert while supporting custom role and live region updates ([fc5108c](https://github.com/sammy-cool/customizable-toast-notification/commit/fc5108ca487a14fae2277bb040579bced5b83a40))
7
+ * **arch:** fortify aria-live transitions, per-cta styling, and shorthand exports ([accce90](https://github.com/sammy-cool/customizable-toast-notification/commit/accce901d656250365b5a9fac7a5a95aa1fa132a))
8
+ * **dx:** sync preset clicks, format multi-CTA code, and automate CDN purge ([579cede](https://github.com/sammy-cool/customizable-toast-notification/commit/579cede1df912ca9ee8bcfa44e0c1bf342f44fba))
9
+ * **e2e:** fix desktop swipe boundary in Firefox and enhance playground ([a37d61a](https://github.com/sammy-cool/customizable-toast-notification/commit/a37d61ac9e4e66dfc2f1d41f743565527b362321))
10
+ * harden priority routing, leader sync, element pool, and touch tracking ([a9c45d1](https://github.com/sammy-cool/customizable-toast-notification/commit/a9c45d189448c885a9c791ef611ba2ad8956ba74))
11
+ * **playground:** attach fallback onUndo callback in fireCurrentConfig ([fcb9040](https://github.com/sammy-cool/customizable-toast-notification/commit/fcb9040408f36a00d8bf3155caba526b15322621))
12
+ * resolve 50+ bugs across shorthands, gestures, accessibility, and styling ([6059bab](https://github.com/sammy-cool/customizable-toast-notification/commit/6059babef3e89ac5a9079ac07d9f0da4806fed9a))
13
+ * **security:** handle data: scheme in URL check and synchronize lockfile ([62ac7da](https://github.com/sammy-cool/customizable-toast-notification/commit/62ac7da21e2d2054ca4aaaabcb50ee7596a9f6ee))
14
+ * **security:** neutralize invalid link href to safe hash instead of removing attribute ([3f934c5](https://github.com/sammy-cool/customizable-toast-notification/commit/3f934c5f8bc36f927a50eb4214fe1a222bb3d4e5))
15
+ * **security:** resolve CodeQL DOM XSS alerts and harden workflow scanner configuration ([70dc0ba](https://github.com/sammy-cool/customizable-toast-notification/commit/70dc0ba2a1dc30f77b9455c924388472fdc2c1a2))
16
+ * **security:** resolve CodeQL polynomial regex alerts and upgrade vulnerable dev dependencies ([a3570c3](https://github.com/sammy-cool/customizable-toast-notification/commit/a3570c3056261659f3fca4565cf7b6d539d5f6a7))
17
+ * support center position aliases, global swipeToDismiss, and full RTL layout ([1960564](https://github.com/sammy-cool/customizable-toast-notification/commit/196056457dab55b4e990b4817990f7835c9d1ae4))
18
+ * **touch:** prevent swipe-to-dismiss gesture when clicking interactive elements ([e17c293](https://github.com/sammy-cool/customizable-toast-notification/commit/e17c29378631e9a6e9dd4b4de774d369c0b36f47))
19
+ * **ux:** auto-dismiss resolved loading toasts and synchronize options state in update ([43c1252](https://github.com/sammy-cool/customizable-toast-notification/commit/43c1252b2270f0f85728aee4e819a8eec9705fd3))
20
+ * **ux:** fix animation timing reflow and audio autoplay browser warning ([28d8e80](https://github.com/sammy-cool/customizable-toast-notification/commit/28d8e805979f740ced660316a11482228f502f10))
21
+ * **ux:** synchronize undo countdown badge with pauseOnHover and keyboard focus ([4eaeee2](https://github.com/sammy-cool/customizable-toast-notification/commit/4eaeee2fda37e0a44e29a91fdbd32c9e16beb42a))
22
+
23
+
24
+ ### Features
25
+
26
+ * **cta:** support in-place CTA streaming updates and harden insertion order ([062bb37](https://github.com/sammy-cool/customizable-toast-notification/commit/062bb3711877e9f13de6fc808c95aebbbd3c6d64))
27
+ * **dx:** add ergonomic shorthand methods and direct string message support ([7cc7669](https://github.com/sammy-cool/customizable-toast-notification/commit/7cc7669e0432d214ace48066bba2e6295717e2f3))
28
+ * **dx:** support default ESM export, persistent loading shorthand, and programmatic dismiss ([a9e13cc](https://github.com/sammy-cool/customizable-toast-notification/commit/a9e13cc95661459fb3974e41d9d4e956f8d02040))
29
+ * **dx:** wire shorthands into framework guides and fix update pause ([df070ae](https://github.com/sammy-cool/customizable-toast-notification/commit/df070aefb4ff0d1c50645ad5ba2d75f16cb9bce3))
30
+ * **playground:** add interactive secondary CTA controls and harden timer test bounds ([c23c032](https://github.com/sammy-cool/customizable-toast-notification/commit/c23c032f32a675300ee870ae8d72f744593efd12))
31
+ * **recipes:** add SaaS notification center history tray and tab alerting recipes ([6b80c55](https://github.com/sammy-cool/customizable-toast-notification/commit/6b80c550fbf53848d8299fd7a1fbbf544c525489))
32
+ * **ui,ux,dx:** add built-in SVG icons, pause shimmer, hotkeys, and adapters ([cab6096](https://github.com/sammy-cool/customizable-toast-notification/commit/cab609652c7c639e75778e39fedd40de3f56fe81))
33
+ * **undo:** support in-place undo action streaming and ordered DOM insertion ([bcdb168](https://github.com/sammy-cool/customizable-toast-notification/commit/bcdb16839e1465e4d42ec47b831ca913f4dbe858))
34
+
1
35
  # [3.16.0](https://github.com/sammy-cool/customizable-toast-notification/compare/v3.15.0...v3.16.0) (2026-10-08)
2
36
 
3
37
 
package/README.md CHANGED
@@ -34,13 +34,13 @@
34
34
  └──────────────────────────────────────────────────┘
35
35
  ```
36
36
 
37
- Toast notifications that work the same everywhere — plain JavaScript, Vue, Svelte, Angular, SolidJS, or a multi-page app. Built with sanitized-by-default HTML rendering, zero runtime dependencies, and 132 automated unit & end-to-end tests across Chromium, Firefox, and WebKit.
37
+ Toast notifications that work the same everywhere — plain JavaScript, Vue, Svelte, Angular, SolidJS, or a multi-page app. Built with sanitized-by-default HTML rendering, zero runtime dependencies, and 177 automated unit & logic tests plus Playwright cross-browser specifications.
38
38
 
39
39
  ## ✨ Key Features
40
40
 
41
41
  - 🌐 **Actually Framework Agnostic** - Not a React library with "vanilla JS support" bolted on — the same API works identically in React, Vue, Angular, Svelte, htmx, or plain HTML with no build step at all
42
42
  - 🛡️ **Sanitized by Default** - `allowHtml` content is sanitized before render (DOMPurify if it's on the page, a verified-equivalent fallback if not) — safe to use with content you don't fully control
43
- - ✅ **Rigorously Tested** - 129 real Playwright end-to-end tests across Chromium, Firefox, and WebKit, plus a fast unit suite — not just "it worked on my machine"
43
+ - ✅ **Rigorously Tested** - 177 real logic & unit tests plus Playwright end-to-end specifications across Chromium, Firefox, and WebKit — not just "it worked on my machine"
44
44
  - 🚫 **Zero Runtime Dependencies** - Nothing pulled in when your users load your app
45
45
  - 🔧 **Real TypeScript Types** - Full type definitions with real autocomplete and type-checking, not a placeholder `any`
46
46
  - 🎨 **Highly Customizable** - Colors, positions, animations, progress bars, and styling
@@ -72,21 +72,40 @@ yarn add customizable-toast-notification
72
72
  ### ES Modules
73
73
 
74
74
  ```js
75
- import {
76
- createToast,
77
- setDefaultColors,
78
- setDefaultMessages,
79
- } from "customizable-toast-notification";
80
-
81
- // Simple usage
82
- createToast({
83
- message: "Hello World!",
75
+ // Default import (recommended) or named import:
76
+ import toast, { createToast } from "customizable-toast-notification";
77
+
78
+ // 1. Shorthand methods (Quickest & cleanest)
79
+ toast.success("Saved successfully!");
80
+ toast.error("Failed to connect to server");
81
+ toast.warning("Unsaved changes detected");
82
+ toast.info("Tip: Press Esc to dismiss anytime");
83
+ toast.custom("<b>Formatted</b> notification with HTML!");
84
+
85
+ // 2. Persistent loading state
86
+ const loading = await toast.loading("Uploading files...");
87
+ // ... later update in-place
88
+ await loading.update({ type: "success", message: "Files uploaded!", showLoader: false });
89
+
90
+ // 3. Direct message string
91
+ toast("Simple notification");
92
+
93
+ // 4. Programmatic dismiss
94
+ toast.dismiss(loading.id); // dismiss by ID or handle
95
+ toast.dismissAll(); // dismiss all notifications
96
+
97
+ // 5. Full configuration options
98
+ toast({
99
+ message: "Customized toast!",
84
100
  type: "success",
85
101
  duration: 3000,
102
+ position: "bottom-right",
103
+ spring: "gentle",
104
+ sound: true,
86
105
  });
87
106
  ```
88
107
 
89
- ### CDN/Browser (UMD Build) / Quick Try with jsDelivr
108
+ ### CDN / Browser (UMD Build) / Quick Try with jsDelivr
90
109
 
91
110
  Global Variable Name: `customizableToast`
92
111
 
@@ -94,8 +113,8 @@ Global Variable Name: `customizableToast`
94
113
  <!-- Always latest version -->
95
114
  <script src="https://cdn.jsdelivr.net/npm/customizable-toast-notification/dist/index.umd.js"></script>
96
115
 
97
- <!-- OR pin to a specific version (recommended for stability) -->
98
- <script src="https://cdn.jsdelivr.net/npm/customizable-toast-notification@3.12.3/dist/index.umd.js"></script>
116
+ <!-- OR pin to a specific version -->
117
+ <script src="https://cdn.jsdelivr.net/npm/customizable-toast-notification@3.16.0/dist/index.umd.js"></script>
99
118
 
100
119
  <script>
101
120
  // Access the global UMD export
@@ -135,13 +154,28 @@ const handle = await createToast({
135
154
  // Update progress in-place:
136
155
  await handle.update({ progress: 65, message: "Uploading assets... 65%" });
137
156
 
138
- // Transition state seamlessly:
157
+ // Stream multi-action CTA buttons dynamically:
158
+ await handle.update({
159
+ message: "Upload requires authorization:",
160
+ cta: [
161
+ { label: "Approve", onClick: () => console.log("Approved!") },
162
+ { label: "Cancel", autoClose: true, onClick: () => console.log("Cancelled") },
163
+ ],
164
+ });
165
+
166
+ // Transition to completion with dynamic countdown Undo badge:
139
167
  await handle.update({
140
168
  type: "success",
141
169
  message: "Upload complete!",
142
170
  showLoader: false,
143
- duration: 3000,
171
+ cta: null, // cleanly strip CTA buttons
172
+ duration: 6000,
144
173
  sound: "success",
174
+ undo: {
175
+ label: "Undo",
176
+ showCountdown: true, // "Undo (6s... 1s)"
177
+ onUndo: () => console.log("Undone!"),
178
+ },
145
179
  });
146
180
 
147
181
  // Or dismiss manually at any point:
@@ -149,7 +183,8 @@ await handle.dismiss();
149
183
  ```
150
184
 
151
185
  `handle.dismiss()` and `handle.update()` are always safe to call, even if the toast already
152
- auto-dismissed on its own — they no-op gracefully rather than throwing.
186
+ auto-dismissed on its own — they no-op gracefully rather than throwing. You can update `message`,
187
+ `progress`, `type`, `showLoader`, `loader`, `cta` (single object, array, or `null`), and `undo` in-place.
153
188
 
154
189
  #### Options
155
190
 
@@ -180,6 +215,7 @@ auto-dismissed on its own — they no-op gracefully rather than throwing.
180
215
  | `fontLineHeight` | `string` | `"1.4"` | Font line height |
181
216
  | `showLoader` | `boolean` | `false` | Show spinner loader before the message |
182
217
  | `loader` | `object` | `null` | Custom loader config (`size`, `color`, `text`) |
218
+ | `icon` | `boolean \| string \| HTMLElement` | `true` for typed, `null` | Status icon: `true` (built-in SVG), `false` (hide), emoji (`"🎉"`), SVG string, or DOM node |
183
219
  | `fontDirection` | `string` | `"auto"` | Font direction: `"auto"`, `"ltr"`, `"rtl"` |
184
220
  | `fontPadding` | `string` | `undefined` | Custom padding for message container (e.g. `"4px 8px"`) |
185
221
  | `className` | `string` | `undefined` | Custom CSS class name(s) for animations / styling |
@@ -189,7 +225,7 @@ auto-dismissed on its own — they no-op gracefully rather than throwing.
189
225
  | `swipeToDismiss` | `boolean` | `true` | Mobile touch swipe-to-dismiss gesture with physics |
190
226
  | `progress` | `number` | `undefined` | Explicit progress bar percentage (0 to 100) |
191
227
  | `usePool` | `boolean` | `false` | Virtual element pooling for DOM recycling in high-frequency rendering |
192
- | `cta` | `object` | `null` | Call-to-action configuration (see [CTA](#call-to-action)) |
228
+ | `cta` | `object \| array` | `null` | Call-to-action configuration (see [CTA](#call-to-action)) |
193
229
  | `undo` | `function \| object`| `null` | Action Undo button with live dynamic countdown badge (see [Undo](#️-action-undo-with-live-countdown)) |
194
230
  | `spring` | `boolean \| string \| object`| `null` | Configurable spring physics animations (see [Spring Physics](#-configurable-spring-physics-animation-engine)) |
195
231
 
@@ -199,8 +235,9 @@ auto-dismissed on its own — they no-op gracefully rather than throwing.
199
235
  // Corner positions
200
236
  - "top-left", "top-right", "bottom-left", "bottom-right"
201
237
 
202
- // Edge positions
238
+ // Edge positions & center aliases
203
239
  - "top-center", "bottom-center", "left-center", "right-center"
240
+ - "center-top", "center-bottom", "center-left", "center-right"
204
241
 
205
242
  // Full width
206
243
  - "top-full-width", "bottom-full-width"
@@ -559,6 +596,7 @@ if (shouldReduceMotion()) {
559
596
  | `swipeToDismiss` | `boolean` | `true` | Enable touch / mouse drag swipe gesture to dismiss toasts with spring snap-back physics. |
560
597
  | `sound` | `boolean` | `true` | Enable pure Web Audio API notification chimes (0KB network, zero audio assets). |
561
598
  | `soundPreset` | `"modern" \| "retro" \| "futuristic" \| "subtle" \| "bell"` | `"modern"` | Built-in sound synthesis theme for audio notifications. |
599
+ | `pauseOnHover` | `boolean` | `false` | When `true`, automatically pauses countdown timers for all toasts on mouse hover or keyboard focus. |
562
600
  | `syncTabs` | `boolean` | `false` | Synchronize toast notifications across browser tabs using BroadcastChannel. |
563
601
  | `aiPrioritization` | `boolean` | `false` | Enable offline content-aware queue priority sorting (critical alerts jump ahead of routine messages). |
564
602
  | `priorityScorer` | `((context) => number) \| null` | `null` | Custom priority scoring function for custom business logic or external AI models. |
@@ -636,7 +674,7 @@ setConfig({ zIndex: 50000 });
636
674
 
637
675
  ## 🚀 Phase 3: Advanced Features
638
676
 
639
- The following enterprise-grade features are available in v3.15.0+ and are opt-in via global config or toast options:
677
+ The following enterprise-grade features are available in v3.16.0+ and are opt-in via global config or toast options:
640
678
 
641
679
  ### 🔄 Cross-Tab Toast Synchronization
642
680
 
@@ -971,8 +1009,8 @@ createToast({ message: "Using external CSS!" });
971
1009
 
972
1010
  ```html
973
1011
  <!-- HTML (CDN) -->
974
- <link rel="stylesheet" href="https://unpkg.com/customizable-toast-notification@3.15.0/dist/index.css">
975
- <script src="https://unpkg.com/customizable-toast-notification@3.15.0/dist/index.umd.js"></script>
1012
+ <link rel="stylesheet" href="https://unpkg.com/customizable-toast-notification@3.16.0/dist/index.css">
1013
+ <script src="https://unpkg.com/customizable-toast-notification@3.16.0/dist/index.umd.js"></script>
976
1014
  <script>
977
1015
  customizableToast.setConfig({ disableInlineStyles: true });
978
1016
  customizableToast.createToast({ message: "Using external CSS!" });