juice-toast 1.4.1 โ†’ 1.4.2

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,311 @@
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
20
-
21
- ```js
22
- juiceToast.setup({
23
- duration: 3000,
24
- maxVisible: 3,
25
- glassUI: true
26
- });
29
+ # UMD
27
30
 
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
58
50
 
59
- Each toast type is auto-generated from configuration or `addType`.
51
+ ## `juiceToast.setup(options)`
52
+
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
+ ---
124
+
125
+ # Positions
108
126
 
109
- > `enterAnimation` respects `prefers-reduced-motion` automatically.
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
194
221
 
195
- * Swipe to dismiss (touch devices)
196
- * Pause on hover / touch
197
- * Click close button (`closable: true`)
222
+ ```js
223
+ juiceToast.clear();
224
+ ```
225
+
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:
239
+
240
+ - `low`
241
+ - `normal`
242
+ - `high`
243
+ - `urgent`
213
244
 
214
- ## ๐Ÿ”Œ Plugin System
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
263
294
 
264
295
  ```js
265
- juiceToast.clear(); // Clear queue
266
- juiceToast.destroy(); // Remove all & cleanup
296
+ {
297
+ duration: 2500,
298
+ maxVisible: 3,
299
+ swipeThreshold: 60,
300
+ glassUI: 0,
301
+ playSound: null,
302
+ dev: false,
303
+ injectCSS: true
304
+ }
267
305
  ```
268
306
 
269
307
  ---
270
308
 
271
- ## ๐Ÿ“„ License
309
+ # License
272
310
 
273
- MIT License ยฉ 2026 OpenDN Foundation
311
+ MIT License
package/CHANGELOG.md CHANGED
@@ -1,4 +1,9 @@
1
- ## v1.4.0
1
+ ## v1.4.2
2
+ - Add modal
3
+ - Bug fixes
4
+ - improve documentation
5
+
6
+ v1.4.0 / v1.4.1
2
7
  - Add Smart Queue
3
8
  - Bugs fixed & Logic fixes
4
9
  - Fix the toast speed
@@ -8,7 +13,7 @@
8
13
 
9
14
  v1.3.4
10
15
  - Bug Fixes
11
- - Add profile image
16
+ - Add Avatar
12
17
 
13
18
  v1.3.3
14
19
  - Bug Fixes on Closeable Toast & Logic
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,7 +1,7 @@
1
1
  # MIT License
2
2
 
3
3
  **Project:** JuiceToast
4
- **Copyright (c) 2026 OpenDN Foundation (Sholehuddin Khairy)**
4
+ **Copyright (c) 2026 OpenDN Foundation (Sholehuddin Khairy / KhairyK)**
5
5
 
6
6
  ---
7
7