juice-toast 1.4.1 β†’ 1.4.3

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/API.md CHANGED
@@ -1,273 +1,318 @@
1
- # 🍹 JuiceToast API Reference
1
+ # JuiceToast API Documentation
2
2
 
3
- JuiceToast is a lightweight, dependency-free toast notification library with rich customization, animation, accessibility, and plugin support.
3
+ JuiceToast is a lightweight, customizable toast notification library with support for:
4
+
5
+ - Priority queue system
6
+ - Promise handling
7
+ - Theming
8
+ - Plugin system
9
+ - Grouping
10
+ - Swipe-to-dismiss
11
+ - Progress bar
12
+ - Sound support
13
+ - Avatar & Icon support
4
14
 
5
15
  ---
6
16
 
7
- ## πŸ“¦ Installation
17
+ # Installation
8
18
 
9
19
  ```bash
10
20
  npm install juice-toast
11
21
  ```
12
22
 
23
+ # ESM
24
+
13
25
  ```js
14
- import juiceToast from "juice-toast";
26
+ import juiceToast from "https://cdn.jsdelivr.net/npm/juice-toast/dist/juice-toast.esm.js";
15
27
  ```
16
28
 
17
- ---
18
-
19
- ## πŸš€ Quick Start
29
+ # UMD
20
30
 
21
- ```js
22
- juiceToast.setup({
23
- duration: 3000,
24
- maxVisible: 3,
25
- glassUI: true
26
- });
27
-
28
- juiceToast.success({
29
- title: "Success",
30
- message: "Data saved successfully"
31
- });
31
+ ```html
32
+ <script src="https://cdn.jsdelivr.net/npm/juice-toast/dist/juice-toast.umd.js"></script>
32
33
  ```
33
34
 
34
35
  ---
35
36
 
36
- ## βš™οΈ Global Configuration (`setup`)
37
+ # Basic Usage
37
38
 
38
39
  ```js
39
- juiceToast.setup(options);
40
+ juiceToast.success("Success message");
41
+ juiceToast.error("Error message");
42
+ juiceToast.info("Information");
43
+ juiceToast.warning("Warning message");
44
+ juiceToast.loading("Loading...");
40
45
  ```
41
46
 
42
- ### Options
43
-
44
- | Option | Type | Default | Description |
45
- | ---------------- | ---------------- | ------- | ------------------------------- |
46
- | `duration` | number | `2500` | Toast display duration (ms) |
47
- | `maxVisible` | number | `3` | Max visible toasts per position |
48
- | `glassUI` | boolean | number | `0` | Enable glass effect (0–100) |
49
- | `playSound` | string | null | `null` | Global sound file |
50
- | `injectCSS` | boolean | `true` | Auto inject base CSS |
51
- | `css` | string | null | `null` | Custom CSS override |
52
- | `swipeThreshold` | number | `60` | Swipe distance to dismiss |
53
- | `dev` | boolean | `false` | Enable console warnings |
54
-
55
47
  ---
56
48
 
57
- ## 🧩 Toast Methods
49
+ # Global Configuration
50
+
51
+ ## `juiceToast.setup(options)`
58
52
 
59
- Each toast type is auto-generated from configuration or `addType`.
53
+ Configure global defaults.
60
54
 
61
55
  ```js
62
- juiceToast.success(payload);
63
- juiceToast.error(payload);
64
- juiceToast.info(payload);
65
- juiceToast.warning(payload);
66
- juiceToast.loading(payload);
56
+ juiceToast.setup({
57
+ duration: 3000,
58
+ maxVisible: 5,
59
+ swipeThreshold: 80,
60
+ injectCSS: true,
61
+ dev: true
62
+ });
67
63
  ```
68
64
 
69
- Payload can be a **string** or **object**.
65
+ ### Options
66
+
67
+ | Option | Type | Default | Description |
68
+ |--------|------|----------|-------------|
69
+ | duration | number | 2500 | Default auto-dismiss duration (ms) |
70
+ | maxVisible | number | 3 | Maximum visible toasts per position |
71
+ | swipeThreshold | number | 60 | Swipe distance required to dismiss |
72
+ | injectCSS | boolean | true | Automatically inject base CSS |
73
+ | css | string | internal | Custom CSS override |
74
+ | dev | boolean | false | Enable debug logs |
75
+ | playSound | string | null | Sound URL |
70
76
 
71
77
  ---
72
78
 
73
- ## πŸ“ Toast Payload Options
79
+ # Toast Methods
74
80
 
75
- ### Basic
81
+ Each toast type can accept:
76
82
 
77
83
  ```js
78
- {
79
- title: "Title",
80
- message: "Message",
81
- duration: 3000
82
- }
84
+ juiceToast.success(options)
83
85
  ```
84
86
 
85
- ### Appearance
87
+ Or shortcut:
86
88
 
87
89
  ```js
88
- {
89
- theme: "dark",
90
- bg: "#333",
91
- color: "#fff",
92
- border: "1px solid #000",
93
- size: "sm" | "md" | "lg",
94
- compact: true
95
- }
90
+ juiceToast.success("Message")
96
91
  ```
97
92
 
98
93
  ---
99
94
 
100
- ## 🎬 Animation
95
+ # Toast Options
96
+
97
+ | Option | Type | Description |
98
+ |--------|------|-------------|
99
+ | message | string | Main text |
100
+ | title | string | Toast title |
101
+ | html | string | Render sanitized HTML |
102
+ | duration | number | Auto close duration |
103
+ | position | string | Toast position |
104
+ | theme | string | Theme name |
105
+ | icon | string | Icon class |
106
+ | iconPack | string | Icon library prefix |
107
+ | iconAnim | string | Icon animation class |
108
+ | iconSize | string | Icon font size |
109
+ | avatar | string | Avatar image URL |
110
+ | avatarAlt | string | Avatar alt text |
111
+ | avatarPosition | left/right/top | Avatar position |
112
+ | closable | boolean | Show close button |
113
+ | progress | boolean | Show progress bar |
114
+ | progressColor | string | Custom progress color |
115
+ | actions | array | Custom buttons |
116
+ | undo | function | Undo callback |
117
+ | undoTimeout | number | Timeout before auto-close |
118
+ | groupId | string | Group multiple toasts |
119
+ | dedupeKey | string | Prevent duplicate toasts |
120
+ | priority | low/normal/high/urgent | Priority queue level |
121
+ | playSound | string | Override sound |
101
122
 
102
- ```js
103
- {
104
- animation: "slide-in" | "fade-in" | "bounce-in",
105
- enterAnimation: "pop" | "bounce" | "shake" | "wiggle" | "pulse" | "spin"
106
- }
107
- ```
123
+ ---
108
124
 
109
- > `enterAnimation` respects `prefers-reduced-motion` automatically.
125
+ # Positions
126
+
127
+ Available positions:
128
+
129
+ - `top-left`
130
+ - `top-right`
131
+ - `bottom-left`
132
+ - `bottom-right`
133
+ - `top-center`
134
+ - `bottom-center`
135
+
136
+ Default: `bottom-right`
110
137
 
111
138
  ---
112
139
 
113
- ## 🧊 Glass UI
140
+ # Themes
141
+
142
+ Built-in themes:
143
+
144
+ - `dark`
145
+ - `light`
146
+ - `glass`
147
+
148
+ ## Define Custom Theme
114
149
 
115
150
  ```js
116
- {
117
- glassUI: true // default intensity (60)
118
- glassUI: 80 // custom intensity
119
- }
151
+ juiceToast.defineTheme("custom", {
152
+ bg: "#111",
153
+ color: "#fff",
154
+ border: "1px solid #333"
155
+ });
120
156
  ```
121
157
 
122
- ---
123
-
124
- ## πŸ“ Position / Placement
158
+ ## Set Theme
125
159
 
126
160
  ```js
127
- {
128
- position: "top-left" |
129
- "top-right" |
130
- "top-center" |
131
- "bottom-left" |
132
- "bottom-right" |
133
- "bottom-center"
134
- }
161
+ juiceToast.setTheme("custom");
135
162
  ```
136
163
 
137
164
  ---
138
165
 
139
- ## 🎯 Icon System
166
+ # Custom Toast Types
167
+
168
+ ## `juiceToast.addType(name, config)`
140
169
 
141
170
  ```js
142
- {
143
- icon: "check-circle",
144
- iconPack: "fa fa-solid",
145
- iconSize: "18px",
146
- iconPosition: "left" | "right" | "top",
147
- iconAnimate: "bounce",
148
- iconLink: "https://example.com"
149
- }
171
+ juiceToast.addType("custom", {
172
+ bg: "#9333ea",
173
+ icon: "fa-star",
174
+ duration: 5000
175
+ });
176
+
177
+ juiceToast.custom("Hello!");
150
178
  ```
151
179
 
152
180
  ---
153
181
 
154
- ## πŸ”˜ Actions Button
182
+ # Promise Toast
183
+
184
+ ## `juiceToast.promise(promise, options)`
155
185
 
156
186
  ```js
157
- {
158
- actions: [
159
- {
160
- label: "Undo",
161
- onClick: () => {},
162
- closeOnClick: true
163
- }
164
- ]
165
- }
187
+ juiceToast.promise(fetch("/api"), {
188
+ loading: "Loading...",
189
+ success: "Success!",
190
+ error: "Failed",
191
+ timeout: 5000,
192
+ timeoutMessage: "Request timeout"
193
+ });
166
194
  ```
167
195
 
168
- ---
169
-
170
- ## ⏳ Progress Bar
196
+ ### Returns
171
197
 
172
198
  ```js
173
199
  {
174
- progress: true,
175
- progressColor: "rgba(255,255,255,.7)"
200
+ cancel: Function
176
201
  }
177
202
  ```
178
203
 
179
204
  ---
180
205
 
181
- ## πŸ”Š Sound
206
+ # Plugin System
207
+
208
+ ## `juiceToast.use(pluginFunction)`
182
209
 
183
210
  ```js
184
- {
185
- playSound: "ding.mp3"
186
- }
211
+ juiceToast.use(({ toast, cfg, type, root }) => {
212
+ console.log("Toast created:", type);
213
+ });
187
214
  ```
188
215
 
189
- Supported formats: `.mp3`, `.wav`, `.ogg`, `.opus`, `.aiff`, `.wma`
190
-
191
216
  ---
192
217
 
193
- ## βœ‹ Interaction
218
+ # Queue Management
219
+
220
+ ## Clear Queue
221
+
222
+ ```js
223
+ juiceToast.clear();
224
+ ```
194
225
 
195
- * Swipe to dismiss (touch devices)
196
- * Pause on hover / touch
197
- * Click close button (`closable: true`)
226
+ ## Destroy All Toast Roots
198
227
 
199
228
  ```js
200
- { closable: true }
229
+ juiceToast.destroy();
201
230
  ```
202
231
 
203
232
  ---
204
233
 
205
- ## β™Ώ Accessibility (A11Y)
234
+ # Advanced Features
206
235
 
207
- * `role="alert"`
208
- * `aria-live="polite"`
209
- * Keyboard focusable
210
- * Reduced motion support
236
+ ## Priority Queue
211
237
 
212
- ---
238
+ Available priorities:
213
239
 
214
- ## πŸ”Œ Plugin System
240
+ - `low`
241
+ - `normal`
242
+ - `high`
243
+ - `urgent`
244
+
245
+ Example:
215
246
 
216
247
  ```js
217
- juiceToast.use(ctx => {
218
- const { toast, cfg, type, root } = ctx;
248
+ juiceToast.success({
249
+ message: "Important",
250
+ priority: "urgent"
219
251
  });
220
252
  ```
221
253
 
222
254
  ---
223
255
 
224
- ## 🎨 Theme API
256
+ ## Grouped Toast
225
257
 
226
258
  ```js
227
- juiceToast.defineTheme("ocean", {
228
- bg: "#0ea5e9",
229
- color: "#fff"
259
+ juiceToast.info({
260
+ message: "Grouped",
261
+ groupId: "network"
230
262
  });
231
-
232
- juiceToast.setTheme("ocean");
233
263
  ```
234
264
 
235
265
  ---
236
266
 
237
- ## βž• Custom Toast Type
267
+ ## Action Buttons
238
268
 
239
269
  ```js
240
- juiceToast.addType("custom", {
241
- icon: "star",
242
- bg: "gold",
243
- color: "#000"
270
+ juiceToast.success({
271
+ message: "Saved",
272
+ actions: [
273
+ {
274
+ label: "Undo",
275
+ onClick: () => console.log("Undo"),
276
+ closeOnClick: true
277
+ }
278
+ ]
244
279
  });
245
-
246
- juiceToast.custom("Hello World");
247
280
  ```
248
281
 
249
282
  ---
250
283
 
251
- ## Background image
252
- ```js
253
- juiceToast.setup({
254
- image: { bgImage: "https://cdn.kyrt.my.id/image/ts-logo-128.svg" }
255
- });
284
+ # Accessibility
256
285
 
257
- juiceToast.image("Hi");
258
- ```
286
+ - Uses `role="status"`
287
+ - Keyboard focus support
288
+ - Pause on hover & focus
289
+ - Swipe support (touch & mouse)
259
290
 
260
291
  ---
261
292
 
262
- ## 🧹 Utilities
293
+ # Internal Defaults
294
+
295
+ ```js
296
+ {
297
+ duration: 2500,
298
+ maxVisible: 3,
299
+ swipeThreshold: 60,
300
+ glassUI: 0,
301
+ playSound: null,
302
+ dev: false,
303
+ injectCSS: true
304
+ }
305
+ ```
263
306
 
307
+ # Parallax Mode
264
308
  ```js
265
- juiceToast.clear(); // Clear queue
266
- juiceToast.destroy(); // Remove all & cleanup
309
+ juiceToast.success({
310
+ parallaxMode: true
311
+ });
267
312
  ```
268
313
 
269
314
  ---
270
315
 
271
- ## πŸ“„ License
316
+ # License
272
317
 
273
- MIT License Β© 2026 OpenDN Foundation
318
+ Atrosfer 1.0 License
package/CHANGELOG.md CHANGED
@@ -1,4 +1,15 @@
1
- ## v1.4.0
1
+ ## v1.4.3
2
+ - Add Parallax Mode
3
+ - Fixes Animation
4
+ - Auto-fecth **Font Awesome** Icons
5
+ - Smart Dedup
6
+
7
+ v1.4.2
8
+ - Add modal
9
+ - Bug fixes
10
+ - improve documentation
11
+
12
+ v1.4.0 / v1.4.1
2
13
  - Add Smart Queue
3
14
  - Bugs fixed & Logic fixes
4
15
  - Fix the toast speed
@@ -8,7 +19,7 @@
8
19
 
9
20
  v1.3.4
10
21
  - Bug Fixes
11
- - Add profile image
22
+ - Add Avatar
12
23
 
13
24
  v1.3.3
14
25
  - Bug Fixes on Closeable Toast & Logic
package/CONTRIBUTING.md CHANGED
@@ -62,4 +62,4 @@ git push origin feature/your-feature-name
62
62
  ## Code of Conduct
63
63
  Read the [Code Of Conduct](https://github.com/KhairyK/juiceToast/blob/main/CODE_OF_CONDUCT.md)
64
64
 
65
- 2026 (C) OpenDN Foundation / Released under MIT LICENSE
65
+ 2026 (C) OpenDN Foundation / Released under Atrosfer 1.0LICENSE
package/EoL.md CHANGED
@@ -1,12 +1,42 @@
1
- ## End of Life (EoL) Notice
2
-
3
- The following versions and distributions have reached End of Life (EoL) and are no longer maintained.
4
-
5
- | EoL Version | Affected Target | Reason |
6
- |--------------------|-----------------|--------|
7
- | 1.2.1 | None | This version is End of Support, update to ^1.3.0 |
8
- | 1.2.0-rc.2026 | UMD build | UMD distribution has been removed to simplify maintenance and reduce build complexity |
9
- | 0.0.1-next.1202026 | None | This next version are ended, use Release Candidate version |
10
- | 0.0.0-next.1202026 | Pre-release tag | Versioning structure became inconsistent and difficult to maintain |
11
- | 1.1.0 | None | This version is End of Support, update to ^1.2.0 |
12
- | 1.0.0 | Unstable release | Deprecated due to outdated internal architecture and styling standards |
1
+ # End of Life (EoL) & End of Support (EoS) Notice
2
+
3
+ This document outlines versions that are no longer maintained.
4
+
5
+ ---
6
+
7
+ ## πŸ”΄ End of Life (EoL)
8
+
9
+ The following versions are fully discontinued and **should not be used in production**.
10
+
11
+ | Version | Affected Target | Replacement | Reason |
12
+ |----------|----------------|------------|--------|
13
+ | 1.4.0 | Distribution files | 1.4.1 | Distribution files were unintentionally identical to v1.3.4 |
14
+ | 1.2.0-rc.2026 | UMD build | ^1.3.0 | UMD distribution was removed to simplify maintenance and reduce build complexity |
15
+ | 0.0.0-next.1202026 | Pre-release tag | 0.0.1-next.1202026 or stable releases | Versioning structure became inconsistent and difficult to maintain |
16
+ | 1.0.0 | Entire release | ^1.2.0 | Deprecated due to legacy architecture that does not meet current stability and performance standards |
17
+
18
+ ---
19
+
20
+ ## 🟑 End of Support (EoS)
21
+
22
+ The following versions remain functional but **will no longer receive updates, fixes, or improvements**.
23
+
24
+ | Version Range | Replacement | Notes |
25
+ |---------------|------------|-------|
26
+ | 1.3.x | 1.3.4 (LTS) or ^1.4.x | Maintenance has ended for this minor series |
27
+ | 1.2.1 | ^1.3.0 | Superseded by newer improvements and fixes |
28
+ | 1.1.0 | ^1.2.0 | Maintenance discontinued |
29
+ | 0.0.1-next.1202026 | Release Candidate or stable releases | Pre-release cycle has ended |
30
+
31
+ ---
32
+
33
+ ## πŸ“Œ Recommendation
34
+
35
+ Users are strongly encouraged to upgrade to the latest stable version to ensure:
36
+
37
+ - Improved performance
38
+ - Ongoing security updates
39
+ - Bug fixes and stability improvements
40
+ - Better long-term compatibility
41
+
42
+ For migration guidance, please refer to the official documentation or release notes.
package/LICENSE.md CHANGED
@@ -1,54 +1,72 @@
1
- # MIT License
2
-
3
- **Project:** JuiceToast
4
- **Copyright (c) 2026 OpenDN Foundation (Sholehuddin Khairy)**
5
-
6
- ---
7
-
8
- ## Permission
9
-
10
- Permission is hereby granted, free of charge, to any person obtaining a copy
11
- of this software and associated documentation files (the β€œSoftware”), to deal
12
- in the Software **without restriction**, including without limitation the rights to:
13
-
14
- - use
15
- - copy
16
- - modify
17
- - merge
18
- - publish
19
- - distribute
20
- - sublicense
21
- - and/or sell copies of the Software
22
-
23
- and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
24
-
25
- ---
26
-
27
- ## Conditions
28
-
29
- The above copyright notice and this permission notice shall be included in all
30
- copies or substantial portions of the Software.
31
-
32
- ---
33
-
34
- ## Disclaimer
35
-
36
- THE SOFTWARE IS PROVIDED **β€œAS IS”**, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
37
- INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
38
- AND NONINFRINGEMENT.
39
-
40
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES,
41
- OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM,
42
- OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
43
-
44
- ---
45
-
46
- ## Additional Notes (Project-Specific)
47
-
48
- - You are free to use JuiceToast in **personal, educational, and commercial projects**.
49
- - Attribution is appreciated but not required beyond the MIT notice.
50
- - Contributions, improvements, and community extensions are welcome.
51
-
52
- ---
53
-
54
- *Lightweight. Modern. Developer-friendly.*
1
+ Atrosfer License 1.0
2
+
3
+ Copyright (c) 2026 Sholehuddin Khairy
4
+ All rights reserved.
5
+
6
+ 1. Grant of License:
7
+ - Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ of this software and associated documentation files (the "Software"), to deal
9
+ in the Software without restriction, including without limitation the rights
10
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, subject to the conditions stated herein.
12
+
13
+ 2. Conditions:
14
+ a. License Notice:
15
+ - The above copyright notice and this permission notice shall be included
16
+ in all copies or substantial portions of the Software.
17
+ b. Attribution:
18
+ - When distributing the Software in any form, credit must be given to the
19
+ original author, Sholehuddin Khairy, including a link to the official
20
+ repository or project page, if applicable.
21
+ c. Modifications:
22
+ - Any modified versions of the Software must clearly state the changes made
23
+ and retain this license in its entirety.
24
+
25
+ 3. Source Code Distribution:
26
+ - The Software may be distributed in source code or compiled/binary form.
27
+ - Redistribution must include this license and the original copyright notice.
28
+
29
+ 4. Commercial Use:
30
+ - The Software may be used for commercial purposes.
31
+ - Distribution or sale of modified versions for profit requires compliance
32
+ with all terms of this license, including proper attribution.
33
+
34
+ 5. Contributions:
35
+ - Contributions to the Software are encouraged.
36
+ - By submitting contributions, contributors grant the right to use, modify,
37
+ and distribute them under the terms of this license.
38
+
39
+ 6. Patent Clause:
40
+ - The license grants no rights to any patents owned by the copyright holder
41
+ or contributors. Use of the Software does not grant any patent license.
42
+
43
+ 7. Trademarks:
44
+ - This license does not grant any rights to use the trademarks, service marks,
45
+ or trade names of the copyright holder, except as required for reasonable
46
+ attribution of the Software.
47
+
48
+ 8. Warranty Disclaimer:
49
+ - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
50
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
51
+ FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
52
+ - THE COPYRIGHT HOLDER SHALL NOT BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER
53
+ LIABILITY ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR
54
+ THE USE OR OTHER DEALINGS IN THE SOFTWARE.
55
+
56
+ 9. Indemnity:
57
+ - Users agree to indemnify, defend, and hold harmless the copyright holder
58
+ from and against any claims, damages, or liabilities arising from their
59
+ use, modification, or distribution of the Software.
60
+
61
+ 10. International Use:
62
+ - This license is governed by international copyright law.
63
+ - Use of the Software constitutes acceptance of the terms in any jurisdiction.
64
+
65
+ 11. Termination:
66
+ - Any violation of the terms of this license will result in automatic
67
+ termination of rights granted herein.
68
+ - Termination does not affect rights accrued prior to the violation.
69
+
70
+ 12. Acceptance:
71
+ - By using, copying, modifying, or distributing this Software, you acknowledge
72
+ that you have read, understood, and agree to be bound by the terms of this license.