juice-toast 1.3.1 โ†’ 1.3.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
@@ -248,6 +248,17 @@ juiceToast.custom("Hello World");
248
248
 
249
249
  ---
250
250
 
251
+ ## Background image
252
+ ```js
253
+ juiceToast.setup({
254
+ bgImage: { "bgImage": "https://cdn.kyrt.my.id/image/ts-logo-128.svg" }
255
+ });
256
+
257
+ juiceToast.bgImage("Hi");
258
+ ```
259
+
260
+ ---
261
+
251
262
  ## ๐Ÿงน Utilities
252
263
 
253
264
  ```js
@@ -259,4 +270,4 @@ juiceToast.destroy(); // Remove all & cleanup
259
270
 
260
271
  ## ๐Ÿ“„ License
261
272
 
262
- MIT License ยฉ 2026 OpenDN Foundation
273
+ MIT License ยฉ 2026 OpenDN Foundation
package/CHANGELOG.md CHANGED
@@ -1,46 +1,51 @@
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)
27
-
28
- NEXT 120/2026
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
34
-
35
- v1.1.0
36
- - Add Size Preset
37
- - Add Compact Mode
38
- - Add Actions Button
39
- - Improve Style
40
- - Improve `.d.ts`
41
-
42
- v1.0.1
43
- - Add `style.css` file
44
-
45
- v1.0.0
46
- - Initial release
1
+ ## v1.3.2
2
+ - Improved A11Y
3
+ - Adding **Background Image**
4
+ - Adding more Theme
5
+ - Adding default toast (juiceToast.success|error|info|warning|loading)
6
+
7
+ v1.3.1
8
+ - Improved iOS / Safari (WebKit) compatibility
9
+ - Smoother swipe-to-dismiss on mobile
10
+ - Better pause-on-touch behavior
11
+ - Progress bar sync fixes
12
+ - Accessibility & stability improvements
13
+
14
+ v1.3.0
15
+ - Add CSS Injection System (no external `style.css` needed)
16
+ - Add Reduced Motion Support (prefers-reduced-motion)
17
+ - Improve Animation System (enterAnimation + type animation)
18
+ - Improve Glass UI with intensity control (0โ€“100)
19
+ - Improve Swipe to Dismiss
20
+ - Improve Pause on Hover & Touch
21
+ - Add Plugin System
22
+ - Improve Accessibility (ARIA, keyboard focus)
23
+ - Improve Icon Interaction & Animation
24
+ - Add Animation Preset
25
+ - Add Progress Bar
26
+ - Bug fixes & internal refactor
27
+
28
+ v1.2.0-rc.2026 / v1.2.1
29
+ - Add A11Y support
30
+ - Add Multiple Placement / Position
31
+ - Experimental Glass UI (unstable)
32
+
33
+ NEXT 120/2026
34
+ - Improve Sound API (per-toast sound)
35
+ - Add Exit Animation
36
+ - Add Promise-based Toast API
37
+ - Add Stack Grouping
38
+ - Improve TypeScript Definitions
39
+
40
+ v1.1.0
41
+ - Add Size Preset
42
+ - Add Compact Mode
43
+ - Add Actions Button
44
+ - Improve Style
45
+ - Improve `.d.ts`
46
+
47
+ v1.0.1
48
+ - Add `style.css` file
49
+
50
+ v1.0.0
51
+ - Initial release
package/LICENSE.md ADDED
@@ -0,0 +1,54 @@
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.*
package/README.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # ๐Ÿน JuiceToast
2
2
 
3
+
4
+ ![npm download wekkly](https://img.shields.io/npm/dw/juice-toast)
5
+ ![npm download](https://img.shields.io/npm/dt/juice-toast)
6
+ ![npm version](https://img.shields.io/npm/v/juice-toast)
7
+ ![license](https://img.shields.io/npm/l/juice-toast)
8
+ ![stars](https://img.shields.io/github/stars/KhairyK/juiceToast)
9
+ ![issues](https://img.shields.io/github/issues/KhairyK/juiceToast)
10
+ ![repo size](https://img.shields.io/github/repo-size/KhairyK/juiceToast)
11
+ ![browser](https://img.shields.io/badge/browser-all%20modern-brightgreen)
12
+ ![deps](https://img.shields.io/badge/dependencies-0-brightgreen)
13
+ ![ts](https://img.shields.io/badge/types-TypeScript-blue)
14
+ ![last commit](https://img.shields.io/github/last-commit/KhairyK/juiceToast)
15
+
16
+ ---
17
+
3
18
  **JuiceToast** is a lightweight, flexible, and dependency-free toast notification library for modern web applications.
4
19
  Designed with a **clean API**, **extensive customization**, and **strong backward compatibility**, JuiceToast fits both small projects and enterprise-scale systems.
5
20
 
@@ -26,7 +41,7 @@ It supports **ESM**, **dynamic toast types**, **theme management**, **queue hand
26
41
 
27
42
  ### ESM
28
43
  ```js
29
- import juiceToast from "https://npdn.kyrt.my.id/npm/juice-toast@1.3.0/dist/juice-toast.esm.js";
44
+ import juiceToast from "https://npdn.kyrt.my.id/npm/juice-toast@1.3.2dist/juice-toast.esm.js";
30
45
  ```
31
46
 
32
47
  ---
@@ -222,9 +237,6 @@ dark: {
222
237
  - Browser-only (DOM required)
223
238
  - Root element is automatically created: `#juice-toast-root`
224
239
  - 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
228
240
 
229
241
  ---
230
242
 
@@ -1,15 +1,9 @@
1
- /* JuiceToast v1.3.1 (iOS Enhanced)
1
+ /* JuiceToast v1.3.2 (iOS User)
2
2
  * (C) 2026 OpenDN Foundation
3
3
  * Type Definitions
4
4
  */
5
5
 
6
- export type ToastType =
7
- | "success"
8
- | "error"
9
- | "warning"
10
- | "info"
11
- | "loading"
12
- | string
6
+ /* ================= CORE ================= */
13
7
 
14
8
  export type ToastPosition =
15
9
  | "top-left"
@@ -18,124 +12,149 @@ export type ToastPosition =
18
12
  | "bottom-right"
19
13
  | "top-center"
20
14
  | "bottom-center"
15
+ | string;
21
16
 
22
- export type ToastSize = "sm" | "md" | "lg"
17
+ export type ToastSize = "sm" | "md" | "lg";
23
18
 
24
- export type AnimationType =
19
+ export type ToastAnimation =
25
20
  | "spin"
26
21
  | "pulse"
27
22
  | "shake"
28
23
  | "bounce"
29
24
  | "wiggle"
30
25
  | "pop"
31
- | string
26
+ | string;
27
+
28
+ /* ================= ACTIONS ================= */
32
29
 
33
30
  export interface ToastAction {
34
- label: string
35
- onClick?: (event: MouseEvent) => void
36
- closeOnClick?: boolean
31
+ label: string;
32
+ onClick?: (ev: MouseEvent) => void;
33
+ closeOnClick?: boolean;
37
34
  }
38
35
 
36
+ /* ================= OPTIONS ================= */
37
+
39
38
  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
39
+ title?: string;
40
+ message?: string;
41
+
42
+ theme?: string;
43
+ position?: ToastPosition;
44
+
45
+ duration?: number;
46
+ progress?: boolean;
47
+ progressColor?: string;
48
+
49
+ icon?: string;
50
+ iconPack?: string;
51
+ iconSize?: string;
52
+ iconPosition?: "left" | "right" | "top";
53
+
54
+ iconLink?: string;
55
+ iconAnimate?: ToastAnimation;
56
+
57
+ closable?: boolean;
58
+
59
+ bg?: string;
60
+ color?: string;
61
+ border?: string;
62
+
63
+ width?: string;
64
+ height?: string;
65
+
66
+ size?: ToastSize;
67
+ compact?: boolean;
68
+
69
+ glassUI?: number | boolean;
70
+
71
+ bgImage?: string;
72
+
73
+ enterAnimation?: ToastAnimation;
74
+ animation?: string;
75
+
76
+ actions?: ToastAction[];
77
+
78
+ /* AUDIO */
79
+ playSound?: string;
80
+
81
+ /* TTS */
82
+ tts?: boolean;
83
+ ttsLang?: string;
84
+ ttsRate?: number;
90
85
  }
91
86
 
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
87
+ /* ================= INTERNAL DEFAULTS ================= */
88
+
89
+ export interface JuiceToastDefaults {
90
+ duration: number;
91
+ maxVisible: number;
92
+ swipeThreshold: number;
93
+ glassUI: number;
94
+ playSound: string | null;
95
+ dev: boolean;
96
+ injectCSS: boolean;
97
+ css: string | null;
104
98
  }
105
99
 
106
- export interface ToastPluginContext {
107
- toast: HTMLElement
108
- cfg: ToastOptions
109
- type: ToastType
110
- root: HTMLElement
100
+ /* ================= PLUGIN ================= */
101
+
102
+ export interface JuiceToastPluginContext<T extends string = string> {
103
+ toast: HTMLElement;
104
+ cfg: ToastOptions;
105
+ type: T;
106
+ root: HTMLElement;
111
107
  }
112
108
 
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
109
+ export type JuiceToastPlugin<T extends string = string> = (
110
+ ctx: JuiceToastPluginContext<T>
111
+ ) => void;
112
+
113
+ /* ================= CONFIG ================= */
114
+
115
+ export type ToastTypeConfig = Record<string, Partial<ToastOptions>>;
116
+
117
+ /* ================= DYNAMIC METHODS ================= */
118
+
119
+ type DynamicToastMethods<T extends string> = {
120
+ [K in T]: (payload?: string | ToastOptions) => void;
121
+ };
122
+
123
+ /* ================= CORE INSTANCE ================= */
124
+
125
+ export interface JuiceToastBase<T extends string = string> {
126
+ _config: ToastTypeConfig;
127
+ _queue: any[];
128
+ _showing: boolean;
129
+ _theme: string;
130
+ _plugins: JuiceToastPlugin<T>[];
131
+ _defaults: JuiceToastDefaults;
132
+
133
+ /* ===== PUBLIC API ===== */
134
+
135
+ setup<C extends ToastTypeConfig>(
136
+ config: C
137
+ ): JuiceToastBase<keyof C & string> &
138
+ DynamicToastMethods<keyof C & string>;
139
+
140
+ use(plugin: JuiceToastPlugin<T>): void;
141
+
142
+ addType(name: string, cfg?: Partial<ToastOptions>): void;
143
+
144
+ defineTheme(name: string, styles: Record<string, string>): void;
145
+
146
+ setTheme(name: string): void;
147
+
148
+ clear(): void;
149
+ destroy(): void;
136
150
  }
137
151
 
138
- declare const juiceToast: JuiceToast
152
+ /* ================= FINAL TYPE ================= */
153
+
154
+ export type JuiceToast<T extends string = string> =
155
+ JuiceToastBase<T> & DynamicToastMethods<T>;
156
+
157
+ declare const juiceToast: JuiceToast;
139
158
 
140
- export default juiceToast
141
- export { juiceToast }
159
+ export default juiceToast;
160
+ export { juiceToast };