juice-toast 1.2.1 → 1.3.1

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 ADDED
@@ -0,0 +1,262 @@
1
+ # 🍹 JuiceToast API Reference
2
+
3
+ JuiceToast is a lightweight, dependency-free toast notification library with rich customization, animation, accessibility, and plugin support.
4
+
5
+ ---
6
+
7
+ ## 📦 Installation
8
+
9
+ ```bash
10
+ npm install juice-toast
11
+ ```
12
+
13
+ ```js
14
+ import juiceToast from "juice-toast";
15
+ ```
16
+
17
+ ---
18
+
19
+ ## 🚀 Quick Start
20
+
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
+ });
32
+ ```
33
+
34
+ ---
35
+
36
+ ## ⚙️ Global Configuration (`setup`)
37
+
38
+ ```js
39
+ juiceToast.setup(options);
40
+ ```
41
+
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
+ ---
56
+
57
+ ## 🧩 Toast Methods
58
+
59
+ Each toast type is auto-generated from configuration or `addType`.
60
+
61
+ ```js
62
+ juiceToast.success(payload);
63
+ juiceToast.error(payload);
64
+ juiceToast.info(payload);
65
+ juiceToast.warning(payload);
66
+ juiceToast.loading(payload);
67
+ ```
68
+
69
+ Payload can be a **string** or **object**.
70
+
71
+ ---
72
+
73
+ ## 📝 Toast Payload Options
74
+
75
+ ### Basic
76
+
77
+ ```js
78
+ {
79
+ title: "Title",
80
+ message: "Message",
81
+ duration: 3000
82
+ }
83
+ ```
84
+
85
+ ### Appearance
86
+
87
+ ```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
+ }
96
+ ```
97
+
98
+ ---
99
+
100
+ ## 🎬 Animation
101
+
102
+ ```js
103
+ {
104
+ animation: "slide-in" | "fade-in" | "bounce-in",
105
+ enterAnimation: "pop" | "bounce" | "shake" | "wiggle" | "pulse" | "spin"
106
+ }
107
+ ```
108
+
109
+ > `enterAnimation` respects `prefers-reduced-motion` automatically.
110
+
111
+ ---
112
+
113
+ ## 🧊 Glass UI
114
+
115
+ ```js
116
+ {
117
+ glassUI: true // default intensity (60)
118
+ glassUI: 80 // custom intensity
119
+ }
120
+ ```
121
+
122
+ ---
123
+
124
+ ## 📍 Position / Placement
125
+
126
+ ```js
127
+ {
128
+ position: "top-left" |
129
+ "top-right" |
130
+ "top-center" |
131
+ "bottom-left" |
132
+ "bottom-right" |
133
+ "bottom-center"
134
+ }
135
+ ```
136
+
137
+ ---
138
+
139
+ ## 🎯 Icon System
140
+
141
+ ```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
+ }
150
+ ```
151
+
152
+ ---
153
+
154
+ ## 🔘 Actions Button
155
+
156
+ ```js
157
+ {
158
+ actions: [
159
+ {
160
+ label: "Undo",
161
+ onClick: () => {},
162
+ closeOnClick: true
163
+ }
164
+ ]
165
+ }
166
+ ```
167
+
168
+ ---
169
+
170
+ ## ⏳ Progress Bar
171
+
172
+ ```js
173
+ {
174
+ progress: true,
175
+ progressColor: "rgba(255,255,255,.7)"
176
+ }
177
+ ```
178
+
179
+ ---
180
+
181
+ ## 🔊 Sound
182
+
183
+ ```js
184
+ {
185
+ playSound: "ding.mp3"
186
+ }
187
+ ```
188
+
189
+ Supported formats: `.mp3`, `.wav`, `.ogg`, `.opus`, `.aiff`, `.wma`
190
+
191
+ ---
192
+
193
+ ## ✋ Interaction
194
+
195
+ * Swipe to dismiss (touch devices)
196
+ * Pause on hover / touch
197
+ * Click close button (`closable: true`)
198
+
199
+ ```js
200
+ { closable: true }
201
+ ```
202
+
203
+ ---
204
+
205
+ ## ♿ Accessibility (A11Y)
206
+
207
+ * `role="alert"`
208
+ * `aria-live="polite"`
209
+ * Keyboard focusable
210
+ * Reduced motion support
211
+
212
+ ---
213
+
214
+ ## 🔌 Plugin System
215
+
216
+ ```js
217
+ juiceToast.use(ctx => {
218
+ const { toast, cfg, type, root } = ctx;
219
+ });
220
+ ```
221
+
222
+ ---
223
+
224
+ ## 🎨 Theme API
225
+
226
+ ```js
227
+ juiceToast.defineTheme("ocean", {
228
+ bg: "#0ea5e9",
229
+ color: "#fff"
230
+ });
231
+
232
+ juiceToast.setTheme("ocean");
233
+ ```
234
+
235
+ ---
236
+
237
+ ## ➕ Custom Toast Type
238
+
239
+ ```js
240
+ juiceToast.addType("custom", {
241
+ icon: "star",
242
+ bg: "gold",
243
+ color: "#000"
244
+ });
245
+
246
+ juiceToast.custom("Hello World");
247
+ ```
248
+
249
+ ---
250
+
251
+ ## 🧹 Utilities
252
+
253
+ ```js
254
+ juiceToast.clear(); // Clear queue
255
+ juiceToast.destroy(); // Remove all & cleanup
256
+ ```
257
+
258
+ ---
259
+
260
+ ## 📄 License
261
+
262
+ MIT License © 2026 OpenDN Foundation
package/CHANGELOG.md CHANGED
@@ -1,26 +1,46 @@
1
- v1.2.0-rc.2026
2
- - Adding A11Y
3
- - Adding More Placement
4
- - GlassUI Fix (WARNING: Maybe it's Not Working)
5
- - Adding Animation
1
+
2
+ ## v1.3.1
3
+ - Improved iOS / Safari (WebKit) compatibility
4
+ - Smoother swipe-to-dismiss on mobile
5
+ - Better pause-on-touch behavior
6
+ - Progress bar sync fixes
7
+ - Accessibility & stability improvements
8
+
9
+ v1.3.0
10
+ - Add CSS Injection System (no external `style.css` needed)
11
+ - Add Reduced Motion Support (prefers-reduced-motion)
12
+ - Improve Animation System (enterAnimation + type animation)
13
+ - Improve Glass UI with intensity control (0–100)
14
+ - Improve Swipe to Dismiss
15
+ - Improve Pause on Hover & Touch
16
+ - Add Plugin System
17
+ - Improve Accessibility (ARIA, keyboard focus)
18
+ - Improve Icon Interaction & Animation
19
+ - Add Animation Preset
20
+ - Add Progress Bar
21
+ - Bug fixes & internal refactor
22
+
23
+ v1.2.0-rc.2026 / v1.2.1
24
+ - Add A11Y support
25
+ - Add Multiple Placement / Position
26
+ - Experimental Glass UI (unstable)
6
27
 
7
28
  NEXT 120/2026
8
- - Adding Swipe to Dismiss
9
- - Adding Pause on Hover
10
- - Adding `playSound`
11
- - Adding GlassUI
29
+ - Improve Sound API (per-toast sound)
30
+ - Add Exit Animation
31
+ - Add Promise-based Toast API
32
+ - Add Stack Grouping
33
+ - Improve TypeScript Definitions
12
34
 
13
35
  v1.1.0
14
- - Adding **Size Preset**
15
- - Adding Compact
16
- - Improve Style And Fix Bugs
36
+ - Add Size Preset
37
+ - Add Compact Mode
38
+ - Add Actions Button
39
+ - Improve Style
17
40
  - Improve `.d.ts`
18
- - Adding **Actions Button**
19
41
 
20
42
  v1.0.1
21
- - Add Forget File `style.css`
43
+ - Add `style.css` file
22
44
 
23
45
  v1.0.0
24
- - Published In First Time
25
-
26
-
46
+ - Initial release
@@ -49,7 +49,7 @@ Here are some ways you can help make Juice Toast a positive community:
49
49
  If you see or experience something that breaks this Code of Conduct:
50
50
 
51
51
  1. **Stay calm** and don’t respond aggressively.
52
- 2. **Report it** to the maintainers at **[your-email@example.com]**.
52
+ 2. **Report it** to the maintainers at **[musickhairy@gmail.com]**.
53
53
  3. Maintainers will **review and respond quickly and fairly**, keeping the reporter anonymous if requested.
54
54
  4. Actions can include **warnings, temporary restrictions, or banning**, depending on severity.
55
55
 
@@ -84,4 +84,4 @@ Juice Toast isn’t just code — it’s a **community of developers who care**.
84
84
  Great ideas come from collaboration, experimentation, and mutual respect.
85
85
  By following this Code of Conduct, you’re helping make Juice Toast a **place where developers of all skill levels can grow, learn, and have fun**.
86
86
 
87
- Let’s build something amazing together! 🚀
87
+ Let’s build something amazing together! 🚀
package/EoL.md CHANGED
@@ -6,5 +6,4 @@ The following versions and distributions have reached End of Life (EoL) and are
6
6
  |--------------------|-----------------|--------|
7
7
  | 1.2.0-rc.2026 | UMD build | UMD distribution has been removed to simplify maintenance and reduce build complexity |
8
8
  | 0.0.0-next.1202026 | Pre-release tag | Versioning structure became inconsistent and difficult to maintain |
9
- | 1.0.0 | 1.0.0 | Stable release | Deprecated due to outdated internal architecture and styling standards |
10
9
  | 1.0.0 | Stable release | Deprecated due to outdated internal architecture and styling standards |
package/README.md CHANGED
@@ -3,14 +3,14 @@
3
3
  **JuiceToast** is a lightweight, flexible, and dependency-free toast notification library for modern web applications.
4
4
  Designed with a **clean API**, **extensive customization**, and **strong backward compatibility**, JuiceToast fits both small projects and enterprise-scale systems.
5
5
 
6
- It supports **ESM and UMD**, **dynamic toast types**, **theme management**, **queue handling**, and **legacy API compatibility** out of the box.
6
+ It supports **ESM**, **dynamic toast types**, **theme management**, **queue handling**, and **legacy API compatibility** out of the box.
7
7
 
8
8
  ---
9
9
 
10
10
  ## ✨ Key Features
11
11
 
12
12
  - 🚀 Zero dependencies
13
- - 📦 Supports **ESM** and **UMD**
13
+ - 📦 Supports **ESM**
14
14
  - 🔁 Built-in queue system (one toast displayed at a time)
15
15
  - 🎨 Theme system (light, dark, and custom themes)
16
16
  - 🧩 Dynamic toast types (`success`, `error`, etc.)
@@ -26,26 +26,7 @@ It supports **ESM and UMD**, **dynamic toast types**, **theme management**, **qu
26
26
 
27
27
  ### ESM
28
28
  ```js
29
- import juiceToast from "https://cdn.kyrt.my.id/libs/js/juice-toast/1.1.0/juice-toast.esm.min.js";
30
- ```
31
-
32
- ### UMD (Browser)
33
- ```html
34
- <link
35
- rel="stylesheet"
36
- href="https://cdn.kyrt.my.id/libs/css/fontic/2.0.0/juice-toast/style.min.css"
37
- />
38
- <script src="https://cdn.kyrt.my.id/libs/js/juice-toast/1.1.0/juice-toast.umd.min.js"></script>
39
-
40
- <script>
41
- juiceToast.setup({
42
- success: {
43
- bg: "#01AA38"
44
- }
45
- });
46
-
47
- juiceToast.success("Hello world!");
48
- </script>
29
+ import juiceToast from "https://npdn.kyrt.my.id/npm/juice-toast@1.3.0/dist/juice-toast.esm.js";
49
30
  ```
50
31
 
51
32
  ---
@@ -241,6 +222,9 @@ dark: {
241
222
  - Browser-only (DOM required)
242
223
  - Root element is automatically created: `#juice-toast-root`
243
224
  - Suitable for frameworks, custom runtimes, etc.
225
+ - For JuiceToast ^v1.3.0, You don't need import `style.css` manually.
226
+ - UMD Are deprecated for maintain reason
227
+ - Need Improvment for Handphone user or WebKit user
244
228
 
245
229
  ---
246
230
 
@@ -0,0 +1,141 @@
1
+ /* JuiceToast v1.3.1 (iOS Enhanced)
2
+ * (C) 2026 OpenDN Foundation
3
+ * Type Definitions
4
+ */
5
+
6
+ export type ToastType =
7
+ | "success"
8
+ | "error"
9
+ | "warning"
10
+ | "info"
11
+ | "loading"
12
+ | string
13
+
14
+ export type ToastPosition =
15
+ | "top-left"
16
+ | "top-right"
17
+ | "bottom-left"
18
+ | "bottom-right"
19
+ | "top-center"
20
+ | "bottom-center"
21
+
22
+ export type ToastSize = "sm" | "md" | "lg"
23
+
24
+ export type AnimationType =
25
+ | "spin"
26
+ | "pulse"
27
+ | "shake"
28
+ | "bounce"
29
+ | "wiggle"
30
+ | "pop"
31
+ | string
32
+
33
+ export interface ToastAction {
34
+ label: string
35
+ onClick?: (event: MouseEvent) => void
36
+ closeOnClick?: boolean
37
+ }
38
+
39
+ export interface ToastOptions {
40
+ /* content */
41
+ title?: string
42
+ message?: string
43
+
44
+ /* icon */
45
+ icon?: string
46
+ iconPack?: string
47
+ iconSize?: string | number
48
+ iconPosition?: "left" | "right" | "top"
49
+ iconLink?: string
50
+ iconAnimate?: AnimationType
51
+
52
+ /* layout */
53
+ position?: ToastPosition
54
+ size?: ToastSize
55
+ width?: string
56
+ height?: string
57
+ compact?: boolean
58
+
59
+ /* behavior */
60
+ duration?: number
61
+ closable?: boolean
62
+ progress?: boolean
63
+ progressColor?: string
64
+ swipeThreshold?: number
65
+
66
+ /* style */
67
+ theme?: string
68
+ bg?: string
69
+ color?: string
70
+ border?: string
71
+ glassUI?: boolean | number
72
+
73
+ /* animation */
74
+ animation?: AnimationType
75
+ enterAnimation?: AnimationType
76
+
77
+ /* actions */
78
+ actions?: ToastAction[]
79
+
80
+ /* sound */
81
+ playSound?: string | null
82
+
83
+ /* legacy / alias (still supported internally) */
84
+ toast?: ToastPosition
85
+ closeable?: boolean
86
+ icon_left_top?: string
87
+ icon_config?: string
88
+ icon_onClick_url?: string
89
+ icon_onClick_animate?: AnimationType
90
+ }
91
+
92
+ export interface JuiceToastConfig {
93
+ duration?: number
94
+ maxVisible?: number
95
+ swipeThreshold?: number
96
+ glassUI?: number | boolean
97
+ playSound?: string | null
98
+ dev?: boolean
99
+ injectCSS?: boolean
100
+ css?: string
101
+
102
+ /* custom toast type defaults */
103
+ [type: string]: any
104
+ }
105
+
106
+ export interface ToastPluginContext {
107
+ toast: HTMLElement
108
+ cfg: ToastOptions
109
+ type: ToastType
110
+ root: HTMLElement
111
+ }
112
+
113
+ export type JuiceToastPlugin = (ctx: ToastPluginContext) => void
114
+
115
+ export interface JuiceToast {
116
+ /* lifecycle */
117
+ setup(config?: JuiceToastConfig): void
118
+ clear(): void
119
+ destroy(): void
120
+
121
+ /* extension */
122
+ use(plugin: JuiceToastPlugin): void
123
+ addType(type: ToastType, defaults?: Partial<ToastOptions>): void
124
+ defineTheme(
125
+ name: string,
126
+ theme: {
127
+ bg?: string
128
+ color?: string
129
+ border?: string
130
+ }
131
+ ): void
132
+ setTheme(name: string): void
133
+
134
+ /* dynamic toast functions (success, error, custom, dll) */
135
+ [key: string]: any
136
+ }
137
+
138
+ declare const juiceToast: JuiceToast
139
+
140
+ export default juiceToast
141
+ export { juiceToast }