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 +12 -1
- package/CHANGELOG.md +51 -46
- package/LICENSE.md +54 -0
- package/README.md +16 -4
- package/dist/juice-toast-ios.d.ts +126 -107
- package/dist/juice-toast.d.ts +96 -105
- package/dist/juice-toast.esm.js +2 -308
- package/dist/juice-toast.ios.js +2 -312
- package/package.json +10 -4
- package/LICENSE +0 -21
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
|
-
|
|
3
|
-
-
|
|
4
|
-
-
|
|
5
|
-
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
-
|
|
16
|
-
- Add
|
|
17
|
-
- Improve
|
|
18
|
-
- Improve
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
- Add
|
|
25
|
-
- Add
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
-
|
|
30
|
-
- Add
|
|
31
|
-
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
- Add
|
|
37
|
-
- Add
|
|
38
|
-
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
- Add
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
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
|
+

|
|
5
|
+

|
|
6
|
+

|
|
7
|
+

|
|
8
|
+

|
|
9
|
+

|
|
10
|
+

|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+

|
|
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.
|
|
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
|
+
/* JuiceToast v1.3.2 (iOS User)
|
|
2
2
|
* (C) 2026 OpenDN Foundation
|
|
3
3
|
* Type Definitions
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
|
|
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
|
|
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?: (
|
|
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
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
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 =
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
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
|
-
|
|
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 };
|