@appius-fr/apx 2.4.0 → 2.5.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/APX.mjs CHANGED
@@ -1,6 +1,7 @@
1
1
  import augmentWithListen from './modules/listen/listen.mjs';
2
2
  import augmentWithTristate from './modules/tristate/tristate.mjs';
3
3
  import dialog from './modules/dialog/dialog.mjs';
4
+ import toast from './modules/toast/toast.mjs';
4
5
  import { loadCss } from './modules/common.mjs';
5
6
 
6
7
  /**
@@ -107,6 +108,7 @@ const APX = function (input, context = document) {
107
108
 
108
109
  APX.loadCss = loadCss;
109
110
  APX.dialog = dialog;
111
+ APX.toast = toast;
110
112
  APX.isAPXObject = function (obj) {
111
113
  return obj && obj._isAPXObject === true;
112
114
  }
package/README.md CHANGED
@@ -53,6 +53,41 @@ const myDialog = APX.dialog({
53
53
  myDialog.open();
54
54
  ```
55
55
 
56
+ ### `toast` (since 2.5.0)
57
+
58
+ Minimal, framework‑agnostic toast notifications with auto‑loaded CSS and a small API. Exposed as `APX.toast`.
59
+
60
+ Quick start:
61
+
62
+ ```javascript
63
+ // One‑liners on the default manager
64
+ APX.toast.success('Saved!');
65
+ APX.toast.warning('Heads up', { durationMs: 4000 });
66
+
67
+ // Callable shorthand (equivalent to show)
68
+ APX.toast({ message: 'Processing…', type: 'info', durationMs: 0 });
69
+
70
+ // Configure defaults
71
+ APX.toast.configure({ position: 'top-right', maxToasts: 4, dedupe: true });
72
+
73
+ // Dedupe requires a stable id
74
+ APX.toast.show({ id: 'status', message: 'Working…', type: 'info', durationMs: 0 });
75
+ APX.toast.show({ id: 'status', message: 'Done', type: 'success', durationMs: 1500 });
76
+
77
+ // Named managers (profiles)
78
+ APX.toast.create('admin', { position: 'bottom-left' });
79
+ APX.toast.use('admin').info('Admin ready');
80
+ ```
81
+
82
+ Notes:
83
+ - CSS is auto‑imported by the toast module; no `<link>` needed.
84
+ - Overflow policy enforces a strict cap: if `maxToasts` is exceeded, the oldest is removed immediately.
85
+ - Named managers are accessible via `APX.toast.use('<name>')`.
86
+
87
+ Demo pages (work from file:// via standalone build):
88
+ - `demo/index.html` (landing)
89
+ - `demo/modules/toast/index.html` (basic and advanced examples with code viewer)
90
+
56
91
  ### Utilities
57
92
 
58
93
  - **`loadCss`**: Dynamically load CSS files into your document.