juice-toast 1.3.1 โ†’ 1.3.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
@@ -248,6 +248,17 @@ juiceToast.custom("Hello World");
248
248
 
249
249
  ---
250
250
 
251
+ ## Background image
252
+ ```js
253
+ juiceToast.setup({
254
+ image: { bgImage: "https://cdn.kyrt.my.id/image/ts-logo-128.svg" }
255
+ });
256
+
257
+ juiceToast.image("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,54 @@
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.3
2
+ - Bug Fixes on Closeable Toast & Logic
3
+
4
+ v1.3.2
5
+ - Improved A11Y
6
+ - Adding Background Image
7
+ - Adding more Theme
8
+ - Adding default toast (juiceToast.success|error|info|warning|loading)
9
+
10
+ v1.3.1
11
+ - Improved iOS / Safari (WebKit) compatibility
12
+ - Smoother swipe-to-dismiss on mobile
13
+ - Better pause-on-touch behavior
14
+ - Progress bar sync fixes
15
+ - Accessibility & stability improvements
16
+
17
+ v1.3.0
18
+ - Add CSS Injection System (no external `style.css` needed)
19
+ - Add Reduced Motion Support (prefers-reduced-motion)
20
+ - Improve Animation System (enterAnimation + type animation)
21
+ - Improve Glass UI with intensity control (0โ€“100)
22
+ - Improve Swipe to Dismiss
23
+ - Improve Pause on Hover & Touch
24
+ - Add Plugin System
25
+ - Improve Accessibility (ARIA, keyboard focus)
26
+ - Improve Icon Interaction & Animation
27
+ - Add Animation Preset
28
+ - Add Progress Bar
29
+ - Bug fixes & internal refactor
30
+
31
+ v1.2.0-rc.2026 / v1.2.1
32
+ - Add A11Y support
33
+ - Add Multiple Placement / Position
34
+ - Experimental Glass UI (unstable)
35
+
36
+ NEXT 120/2026
37
+ - Improve Sound API (per-toast sound)
38
+ - Add Exit Animation
39
+ - Add Promise-based Toast API
40
+ - Add Stack Grouping
41
+ - Improve TypeScript Definitions
42
+
43
+ v1.1.0
44
+ - Add Size Preset
45
+ - Add Compact Mode
46
+ - Add Actions Button
47
+ - Improve Style
48
+ - Improve `.d.ts`
49
+
50
+ v1.0.1
51
+ - Add `style.css` file
52
+
53
+ v1.0.0
54
+ - 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 };
@@ -1,15 +1,8 @@
1
- /* JuiceToast v1.3.1
1
+ /* JuiceToast v1.3.2
2
2
  * (C) 2026 OpenDN Foundation
3
3
  * Type Definitions
4
4
  */
5
-
6
- export type ToastType =
7
- | "success"
8
- | "error"
9
- | "warning"
10
- | "info"
11
- | "loading"
12
- | string
5
+ /* ================= CORE TYPES ================= */
13
6
 
14
7
  export type ToastPosition =
15
8
  | "top-left"
@@ -17,113 +10,111 @@ export type ToastPosition =
17
10
  | "bottom-left"
18
11
  | "bottom-right"
19
12
  | "top-center"
20
- | "bottom-center"
21
-
22
- export type ToastSize = "sm" | "md" | "lg"
13
+ | "bottom-center";
23
14
 
24
- export type AnimationType =
25
- | "spin"
26
- | "pulse"
27
- | "shake"
28
- | "bounce"
29
- | "wiggle"
30
- | "pop"
31
- | string
15
+ export type ToastSize = "sm" | "md" | "lg";
32
16
 
33
17
  export interface ToastAction {
34
- label: string
35
- onClick?: (event: MouseEvent) => void
36
- closeOnClick?: boolean
18
+ label: string;
19
+ onClick?: (ev: MouseEvent) => void;
20
+ closeOnClick?: boolean;
37
21
  }
38
22
 
39
23
  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
- }
24
+ title?: string;
25
+ message?: string;
26
+
27
+ theme?: string;
28
+ position?: ToastPosition;
29
+
30
+ duration?: number;
31
+ progress?: boolean;
32
+ progressColor?: string;
33
+
34
+ icon?: string;
35
+ iconPack?: string;
36
+ iconSize?: string;
37
+ iconPosition?: "left" | "right" | "top";
38
+
39
+ iconLink?: string;
40
+ iconAnimate?: string;
41
+
42
+ closable?: boolean;
43
+
44
+ bg?: string;
45
+ color?: string;
46
+ border?: string;
47
+
48
+ width?: string;
49
+ height?: string;
50
+
51
+ size?: ToastSize;
52
+ compact?: boolean;
53
+
54
+ glassUI?: number | boolean;
55
+
56
+ bgImage?: string;
57
+
58
+ enterAnimation?: string;
59
+ animation?: string;
60
+
61
+ actions?: ToastAction[];
83
62
 
84
- export interface JuiceToastConfig {
85
- duration?: number
86
- maxVisible?: number
87
- swipeThreshold?: number
88
- glassUI?: number | boolean
89
- playSound?: string | null
90
- dev?: boolean
91
- injectCSS?: boolean
92
- css?: string
93
-
94
- [type: string]: any
63
+ /* TTS */
64
+ tts?: boolean;
65
+ ttsLang?: string;
66
+ ttsRate?: number;
95
67
  }
96
68
 
97
- export interface ToastPluginContext {
98
- toast: HTMLElement
99
- cfg: ToastOptions
100
- type: ToastType
101
- root: HTMLElement
69
+ /* ================= CONFIG TYPES ================= */
70
+
71
+ export type ToastTypeConfig = Record<string, Partial<ToastOptions>>;
72
+
73
+ /* ================= PLUGIN ================= */
74
+
75
+ export interface JuiceToastPluginContext<T extends string = string> {
76
+ toast: HTMLElement;
77
+ cfg: ToastOptions;
78
+ type: T;
79
+ root: HTMLElement;
102
80
  }
103
81
 
104
- export type JuiceToastPlugin = (ctx: ToastPluginContext) => void
105
-
106
- export interface JuiceToast {
107
- /* core */
108
- setup(config?: JuiceToastConfig): void
109
- clear(): void
110
- destroy(): void
111
-
112
- /* toast types */
113
- [key: string]: any
114
-
115
- /* extension */
116
- use(plugin: JuiceToastPlugin): void
117
- addType(type: ToastType, defaults?: Partial<ToastOptions>): void
118
- defineTheme(name: string, theme: {
119
- bg?: string
120
- color?: string
121
- border?: string
122
- }): void
123
- setTheme(name: string): void
82
+ export type JuiceToastPlugin<T extends string = string> = (
83
+ ctx: JuiceToastPluginContext<T>
84
+ ) => void;
85
+
86
+ /* ================= MAIN INTERFACE ================= */
87
+
88
+ type DynamicToastMethods<T extends string> = {
89
+ [K in T]: (payload?: string | ToastOptions) => void;
90
+ };
91
+
92
+ export interface JuiceToastBase<T extends string = string> {
93
+ /* ===== PUBLIC API ===== */
94
+
95
+ setup<C extends Record<string, Partial<ToastOptions>>>(
96
+ config: C
97
+ ): JuiceToastBase<keyof C & string> &
98
+ DynamicToastMethods<keyof C & string>;
99
+
100
+ use(plugin: JuiceToastPlugin<T>): void;
101
+
102
+ addType(name: string, cfg?: Partial<ToastOptions>): void;
103
+
104
+ defineTheme(name: string, styles: Record<string, string>): void;
105
+
106
+ setTheme(name: string): void;
107
+
108
+ clear(): void;
109
+ destroy(): void;
124
110
  }
125
111
 
126
- declare const juiceToast: JuiceToast
112
+ /* ================= FINAL TYPE ================= */
113
+
114
+ export type JuiceToast<T extends string = string> =
115
+ JuiceToastBase<T> & DynamicToastMethods<T>;
116
+
117
+ declare const juiceToast: JuiceToast;
127
118
 
128
- export default juiceToast
129
- export { juiceToast }
119
+ export default juiceToast;
120
+ export { juiceToast };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 2026 (C) OpenDN Foundation
3
- * v1.3.1 (STABLE)
3
+ * v1.3.3 (STABLE & BUG FIX)
4
4
  * ESM (ECMAScript Module)
5
5
  */
6
6
  let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMotion=isBrowser&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,TYPE_ANIMATION={success:"bounce",error:"shake",warning:"wiggle",info:"pulse",loading:"spin"},__cssInjected=!1,BASE_CSS=`
@@ -12,15 +12,6 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
12
12
  pointer-events: none;
13
13
  }
14
14
 
15
- /* bottom (default) */
16
- #juice-toast-root[data-position="bottom"] {
17
- bottom: 20px;
18
- left: 50%;
19
- transform: translateX(-50%);
20
- flex-direction: column;
21
- align-items: center;
22
- }
23
-
24
15
  /* top */
25
16
  #juice-toast-root[data-position="top"] {
26
17
  top: 20px;
@@ -89,9 +80,17 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
89
80
  /* visible */
90
81
  .juice-toast.show {
91
82
  opacity: 1;
92
- --jt-y: 0px;
83
+ transform: translate(var(--jt-x), 0px) scale(1);
84
+ transition: transform 0.35s ease, opacity 0.35s ease;
85
+ }
86
+
87
+ /* hide */
88
+ .juice-toast.hide {
89
+ opacity: 0;
90
+ transform: translate(var(--jt-x), 12px) scale(0.95);
93
91
  }
94
92
 
93
+
95
94
  /* ================= ICON ================= */
96
95
 
97
96
  .juice-toast .icon {
@@ -188,9 +187,10 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
188
187
  /* ================= COMPACT ================= */
189
188
 
190
189
  .jt-compact {
191
- padding: 8px 10px;
192
- gap: 8px;
193
- font-size: 0.9em;
190
+ padding: 6px 8px;
191
+ font-size: 0.85em;
192
+ gap: 6px;
193
+ max-width: 280px;
194
194
  }
195
195
 
196
196
  /* ================= GLASS UI ================= */
@@ -233,12 +233,25 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
233
233
  height: 3px;
234
234
  width: 100%;
235
235
 
236
- background: rgba(255,255,255,.7);
236
+ background: linear-gradient(to right, #FFFFFF, #FAFAFA);
237
+ height: 4px;
237
238
  transform-origin: left;
239
+ transition: transform linear;
240
+ border-radius: 2px;
238
241
  transform: scaleX(1);
239
242
  opacity: .85;
240
243
  }
241
244
 
245
+ /* ================= BACKGROUND IMAGE ================= */
246
+
247
+ .juice-toast.bg-image {
248
+ background-size: cover;
249
+ background-position: center;
250
+ background-repeat: no-repeat;
251
+ color: #fff;
252
+ text-shadow: 0 1px 2px rgba(0,0,0,0.6);
253
+ }
254
+
242
255
  /* ================= ANIMATIONS ================= */
243
256
 
244
257
  @keyframes jt-spin {
@@ -276,6 +289,11 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
276
289
  100% { transform: scale(1); }
277
290
  }
278
291
 
292
+ @keyframes jt-slide {
293
+ from { transform: translateY(20 px);opacity: 0; }
294
+ to { transform: translateY(0);opacity: 1; }
295
+ }
296
+
279
297
  /* ================= CLASSES ================= */
280
298
 
281
299
  .spin { animation: jt-spin .6s linear; }
@@ -284,6 +302,7 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
284
302
  .bounce { animation: jt-bounce .45s ease; }
285
303
  .wiggle { animation: jt-wiggle .5s ease; }
286
304
  .pop { animation: jt-pop .35s ease-out; }
305
+ .slide-in { animation: jt-slide .55s ease; }
287
306
 
288
307
  /* ================= ICON INTERACTION ================= */
289
308
 
@@ -309,4 +328,4 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
309
328
  animation: none !important;
310
329
  }
311
330
  }
312
- `;function injectCSS(e){if(!isBrowser||__cssInjected)return;let t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),__cssInjected=!0}let themes={light:{bg:"#ffffff",color:"#111",border:"1px solid #e5e7eb"},dark:{bg:"#1f2937",color:"#fff",border:"1px solid rgba(255,255,255,.08)"}},sizePreset={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},juiceToast={_config:{},_queue:[],_showing:!1,_theme:"dark",_plugins:[],setup(e={}){this._config=e,this._defaults={...this._defaults,...e},this._registerTypes()},use(e){"function"==typeof e&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){themes[e]={...themes[e]||{},...t}},setTheme(e){if(this._theme=e,!isBrowser)return;let t=document.getElementById("juice-toast-root");t&&(t.dataset.theme=e)},clear(){this._queue.length=0},destroy(){this.clear(),isBrowser&&document.getElementById("juice-toast-root")?.remove()},_registerTypes(){Object.keys(this._config).forEach(e=>{if("function"==typeof this[e]&&!this[e].__auto)return;let t=t=>this._enqueue(e,t);t.__auto=!0,this[e]=t})},_enqueue(e,t){this._queue.push({type:e,payload:t}),this._showing||this._next()},_next(){if(!this._queue.length){this._showing=!1;return}this._showing=!0;let e=this._queue.shift();this._showToast(e.type,e.payload)},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(s){this._warn("Plugin error: "+s.message)}})},_normalizeGlass(e){if(!0===e)return 60;if(!1===e||null==e)return 0;let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},_getRoot(e="bottom-right"){if(!isBrowser)return null;let t=document.getElementById(`juice-toast-root-${e}`);if(!t){switch((t=document.createElement("div")).id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.position="fixed",t.style.zIndex=9999,e){case"top-left":t.style.top="20px",t.style.left="20px";break;case"top-right":t.style.top="20px",t.style.right="20px";break;case"bottom-left":t.style.bottom="20px",t.style.left="20px";break;case"bottom-right":t.style.bottom="20px",t.style.right="20px";break;case"top-center":t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;case"bottom-center":t.style.bottom="20px",t.style.left="50%",t.style.transform="translateX(-50%)"}document.body.appendChild(t)}return t},_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_warn(e){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",e)},_playSound(e){if(!isBrowser)return;let t="string"==typeof e&&e?e:this._defaults.playSound;if(t)try{let s=new Audio(t);s.volume=.6,s.play().catch(()=>{})}catch{}},_showToast(e,t){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);let s=this._config[e]||{},i="object"==typeof t?t:{message:String(t)},a={...s,...i};a.icon=a.icon??a.icon_left_top,a.iconPack=a.iconPack??a.icon_config,a.iconLink=a.iconLink??a.icon_onClick_url,a.iconAnimate=a.iconAnimate??a.icon_onClick_animate,a.position=a.position??a.toast,a.closable=a.closable??a.closeable,a.iconPosition=a.iconPosition||"left",a.compact=!!a.compact;let o=themes[a.theme||this._theme]||{},n=document.createElement("div");n.className="juice-toast";let r=a.animation||"slide-in";if(a.enterAnimation||(n.style.animation=`${r} 0.4s ease forwards`),n.setAttribute("role","alert"),n.setAttribute("aria-live","polite"),n.tabIndex=0,a.size&&sizePreset[a.size]){let l=sizePreset[a.size];l.width&&(n.style.width=l.width),l.padding&&(n.style.padding=l.padding)}let c=null;a.progress&&(a.duration??this._defaults.duration)>0&&((c=document.createElement("div")).className="jt-progress",a.progressColor&&(c.style.background=a.progressColor||"rgba(255,255,255,.7)"),n.appendChild(c));let p=this._normalizeGlass(a.glassUI??this._defaults.glassUI);p>0&&(n.classList.add("jt-glass"),n.style.setProperty("--jt-glass",p)),p||(n.style.background=a.bg||o.bg),n.style.color=a.color||o.color,n.style.border=a.border||o.border,a.compact&&n.classList.add("jt-compact"),(a.glassUI??this._defaults.glassUI)&&n.classList.add("jt-glass"),a.width&&(n.style.width=a.width),a.height&&(n.style.height=a.height);let d=null;if(a.icon){(d=document.createElement("i")).className=["icon",a.iconPack||"",a.icon].join(" ").trim(),a.iconSize&&(d.style.fontSize=a.iconSize),(a.iconLink||a.iconAnimate)&&(d.classList.add("icon-clickable"),d.onclick=e=>{e.stopPropagation(),a.iconAnimate&&(d.classList.remove(a.iconAnimate),d.offsetWidth,d.classList.add(a.iconAnimate)),a.iconLink&&window.open(a.iconLink,"_blank","noopener")});let u=a.iconAnimate??TYPE_ANIMATION[e];u&&(d.classList.add(u),d.addEventListener("click",()=>{d.classList.remove(u),d.offsetWidth,d.classList.add(u)}))}reduceMotion&&(n.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),d?.classList.remove("bounce","shake","wiggle","pulse","spin")),a.message||a.title||this._warn("Toast created without message or title"),a.icon&&!a.iconPack&&this._warn("icon provided without iconPack"),a.duration<0&&this._warn("duration cannot be negative");let h=0,m=0;n.addEventListener("touchstart",e=>{h=e.touches[0].clientX}),n.addEventListener("touchmove",e=>{m=e.touches[0].clientX-h,n.style.transform=`translateX(${m}px)`}),n.addEventListener("touchend",()=>{Math.abs(m)>this._defaults.swipeThreshold?(n.style.transform=`translateX(${m>0?1e3:-1e3}px)`,setTimeout(()=>{n.remove(),this._next()},200)):n.style.transform="",h=m=0});let f=document.createElement("div");f.className="jt-content";let g=a.enterAnimation??"pop";if(g&&!reduceMotion&&n.classList.add(g),a.title){let $=document.createElement("div");$.className="jt-title",$.textContent=a.title,f.appendChild($)}let x=document.createElement("div");if(x.className="jt-message",x.textContent=a.message||"",f.appendChild(x),d&&"top"===a.iconPosition?(n.classList.add("jt-icon-top"),n.appendChild(d),n.appendChild(f)):d&&"right"===a.iconPosition?(n.appendChild(f),n.appendChild(d)):(d&&n.appendChild(d),n.appendChild(f)),Array.isArray(a.actions)&&a.actions.length){let b=document.createElement("div");b.className="jt-actions",a.actions.forEach(e=>{let t=document.createElement("button");t.className="jt-action",t.textContent=e.label,t.onclick=t=>{t.stopPropagation(),e.onClick?.(t),e.closeOnClick&&(n.remove(),this._next())},b.appendChild(t)}),f.appendChild(b)}if(a.closable){let y=document.createElement("span");y.className="juice-toast-close",y.innerHTML="\xd7",y.onclick=()=>{n.remove(),this._next()},n.appendChild(y)}let _=this._getRoot(a.position),j=this._defaults.maxVisible;j&&_.children.length>=j&&_.firstChild.remove(),_.appendChild(n),this._runPlugins({toast:n,cfg:a,type:e,root:_}),requestAnimationFrame(()=>n.classList.add("show"));let w=a.duration??2500;if(0===w)return;let k=Date.now(),v=a.duration??this._defaults.duration,C,E=()=>{if(n.__paused)k=Date.now();else{let e=Date.now();v-=e-k,k=e}v<=0?(n.classList.remove("show"),setTimeout(()=>{n.remove(),this._next()},300)):C=requestAnimationFrame(E),c&&(c.style.transform=`scaleX(${Math.max(0,v/w)})`)};n.addEventListener("mouseenter",()=>n.__paused=!0),n.addEventListener("mouseleave",()=>n.__paused=!1),n.addEventListener("touchstart",()=>n.__paused=!0),n.addEventListener("touchend",()=>n.__paused=!1),requestAnimationFrame(E)}};export default juiceToast;export{juiceToast};
331
+ `;function injectCSS(e){if(!isBrowser||__cssInjected)return;let t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),__cssInjected=!0}let themes={light:{bg:"#ffffff",color:"#111",border:"1px solid #e5e7eb"},dark:{bg:"#1f2937",color:"#fff",border:"1px solid rgba(255,255,255,.08)"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.15)"},midnight:{bg:"#0f172a",color:"#e5e7eb",border:"1px solid rgba(255,255,255,.06)"},soft:{bg:"#f8fafc",color:"#0f172a",border:"1px solid #e2e8f0"},neutral:{bg:"#ffffff",color:"#374151",border:"1px solid #d1d5db"},brand:{bg:"#6366f1",color:"#fff",border:"none"},gradient:{bg:"linear-gradient(135deg,#6366f1,#ec4899)",color:"#fff",border:"none"},outline:{bg:"transparent",color:"#111",border:"2px solid currentColor"}},sizePreset={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},juiceToast={_config:{},_queue:[],_showing:!1,_theme:"dark",_plugins:[],setup(e={}){let{duration:t,maxVisible:s,...a}=e;this._defaults={...this._defaults,duration:t,maxVisible:s},this._config=a,this._registerTypes()},use(e){"function"==typeof e&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){themes[e]={...themes[e]||{},...t}},setTheme(e){if(this._theme=e,!isBrowser)return;let t=document.getElementById("juice-toast-root");t&&(t.dataset.theme=e)},clear(){this._queue.length=0},destroy(){this.clear(),isBrowser&&document.getElementById("juice-toast-root")?.remove()},_registerTypes(){Object.keys(this._config).forEach(e=>{if("function"==typeof this[e]&&!this[e].__auto)return;let t=t=>this._enqueue(e,t);t.__auto=!0,this[e]=t})},_enqueue(e,t){this._queue.push({type:e,payload:t}),this._showing||this._next()},_next(){if(!this._queue.length){this._showing=!1;return}this._showing=!0;let e=this._queue.shift();this._showToast(e.type,e.payload)},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(s){this._warn("Plugin error: "+s.message)}})},_normalizeGlass(e){if(!0===e)return 60;if(!1===e||null==e)return 0;let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},_getRoot(e="bottom-right"){if(!isBrowser)return null;let t=document.getElementById(`juice-toast-root-${e}`);if(!t){switch((t=document.createElement("div")).id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.position="fixed",t.style.zIndex=9999,e){case"top-left":t.style.top="20px",t.style.left="20px";break;case"top-right":t.style.top="20px",t.style.right="20px";break;case"bottom-left":t.style.bottom="20px",t.style.left="20px";break;case"bottom-right":t.style.bottom="20px",t.style.right="20px";break;case"top-center":t.style.top="20px",t.style.left="50%",t.style.transform="translateX(-50%)";break;case"bottom-center":t.style.bottom="20px",t.style.left="50%",t.style.transform="translateX(-50%)"}document.body.appendChild(t)}return t},_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_warn(e){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",e)},_playSound(e){if(!isBrowser)return;let t="string"==typeof e&&e?e:this._defaults.playSound;if(t)try{let s=new Audio(t);s.volume=.6,s.play().catch(()=>{})}catch{}},_showToast(e,t){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);let s=this._config[e]||{},a="object"==typeof t?t:{message:String(t)},i={...s,...a};i.icon=i.icon??i.icon_left_top,i.iconPack=i.iconPack??i.icon_config,i.iconLink=i.iconLink??i.icon_onClick_url,i.iconAnimate=i.iconAnimate??i.icon_onClick_animate,i.position=i.position??i.toast,i.closable=i.closable??i.closeable,i.iconPosition=i.iconPosition||"left",i.compact=!!i.compact;let o=themes[i.theme||this._theme]||{},n=document.createElement("div");n.className="juice-toast";let r=i.animation||"slide-in";if(i.enterAnimation||(n.style.animation=`${r} 0.4s ease forwards`),n.setAttribute("role","alert"),n.setAttribute("aria-live","error"===e?"assertive":"polite"),n.setAttribute("aria-atomic","true"),n.tabIndex=0,i.closable){let l=document.createElement("span");l.tabIndex=0,l.className="juice-toast-close",l.textContent="\xd7",l.addEventListener("keydown",e=>{("Enter"===e.key||" "===e.key)&&(n.remove(),this._next())})}if(i.size&&sizePreset[i.size]){let c=sizePreset[i.size];c.width&&(n.style.width=c.width),c.padding&&(n.style.padding=c.padding)}let d=null;if(i.progress&&(i.duration??this._defaults.duration)>0&&((d=document.createElement("div")).className="jt-progress",i.progressColor&&(d.style.background=i.progressColor||"rgba(255,255,255,.7)"),n.appendChild(d)),i.tts&&"speechSynthesis"in window)try{let p=new SpeechSynthesisUtterance(i.message||i.title||"");p.lang=i.ttsLang||"en-US",p.rate=i.ttsRate??1,window.speechSynthesis.speak(p)}catch(f){this._warn("TTS failed: "+f.message)}let g=this._normalizeGlass(i.glassUI??this._defaults.glassUI);g>0&&(n.style.setProperty("--jt-glass",i.glassUI??50),n.classList.add("jt-glass")),g||(n.style.background=i.bg||o.bg),n.style.color=i.color||o.color,n.style.border=i.border||o.border,i.compact&&n.classList.add("jt-compact"),i.width&&(n.style.width=i.width),i.height&&(n.style.height=i.height),i.bgImage&&(n.style.backgroundImage=`url(${i.bgImage})`,n.classList.add("bg-image"));let u=null;if(i.icon){(u=document.createElement("i")).className=["icon",i.iconPack||"",i.icon].join(" ").trim(),i.iconSize&&(u.style.fontSize=i.iconSize),(i.iconLink||i.iconAnimate)&&(u.classList.add("icon-clickable"),u.onclick=e=>{e.stopPropagation(),i.iconAnimate&&(u.classList.remove(i.iconAnimate),u.offsetWidth,u.classList.add(i.iconAnimate)),i.iconLink&&window.open(i.iconLink,"_blank","noopener")});let m=i.iconAnimate??TYPE_ANIMATION[e];m&&(u.classList.add(m),u.addEventListener("click",()=>{u.classList.remove(m),u.offsetWidth,u.classList.add(m)}))}reduceMotion&&(n.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),u?.classList.remove("bounce","shake","wiggle","pulse","spin")),i.message||i.title||this._warn("Toast created without message or title"),i.icon&&!i.iconPack&&this._warn("icon provided without iconPack"),i.duration<0&&this._warn("duration cannot be negative");let h=0,$=0;n.addEventListener("touchstart",e=>{h=e.touches[0].clientX}),n.addEventListener("touchmove",e=>{$=e.touches[0].clientX-h,n.style.transform=`translateX(${$}px)`}),n.addEventListener("touchend",()=>{Math.abs($)>this._defaults.swipeThreshold?(n.style.transform=`translateX(${$>0?1e3:-1e3}px)`,setTimeout(()=>{n.remove(),this._next()},200)):n.style.transform="",h=$=0});let x=document.createElement("div");x.className="jt-content";let b=i.enterAnimation??"pop";if(b&&!reduceMotion&&n.classList.add(b),i.title){let y=document.createElement("div");y.className="jt-title",y.textContent=i.title,x.appendChild(y)}let _=document.createElement("div");if(_.className="jt-message",_.textContent=i.message||"",x.appendChild(_),u&&"top"===i.iconPosition?(n.classList.add("jt-icon-top"),n.appendChild(u),n.appendChild(x)):u&&"right"===i.iconPosition?(n.appendChild(x),n.appendChild(u)):(u&&n.appendChild(u),n.appendChild(x)),Array.isArray(i.actions)&&i.actions.length){let j=document.createElement("div");j.className="jt-actions",i.actions.forEach(e=>{let t=document.createElement("button");t.className="jt-action",t.textContent=e.label,t.onclick=t=>{t.stopPropagation(),e.onClick?.(t),e.closeOnClick&&(n.remove(),this._next())},j.appendChild(t)}),x.appendChild(j)}if(i.closable){let k=document.createElement("span");k.className="juice-toast-close",k.textContent="\xd7",k.onclick=()=>{n.remove(),this._next()},n.appendChild(k)}let w=this._getRoot(i.position),v=this._defaults.maxVisible;v&&w.children.length>=v&&w.firstChild.remove(),w.appendChild(n),this._runPlugins({toast:n,cfg:i,type:e,root:w}),requestAnimationFrame(()=>n.classList.add("show"));let C=i.duration??this._defaults.duration;if(0===C)return;let E=Date.now(),S=i.duration??this._defaults.duration,A,I=()=>{if(n.__paused)E=Date.now();else{let e=Date.now();S-=e-E,E=e}S<=0?(n.classList.remove("show"),setTimeout(()=>{n.remove(),this._next()},300)):A=requestAnimationFrame(I),d&&(d.style.transform=`scaleX(${Math.max(0,S/C)})`)};n.addEventListener("mouseenter",()=>n.__paused=!0),n.addEventListener("mouseleave",()=>n.__paused=!1),n.addEventListener("touchstart",()=>n.__paused=!0),n.addEventListener("touchend",()=>n.__paused=!1),requestAnimationFrame(I)}};juiceToast.setup({success:{icon:"fa-check",iconPack:"fas",bg:"#16a34a",progress:!0,duration:3e3},error:{icon:"fa-xmark",iconPack:"fas",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fas",bg:"#2563eb",progress:!0},warning:{icon:"fa-triangle-exclamation",iconPack:"fas",bg:"#f59e0b",progress:!0},loading:{icon:"fa-spinner",iconPack:"fas",iconAnimate:"spin",duration:0,progress:!1,closable:!1}});export default juiceToast;export{juiceToast};
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * OpenDN Foundation (C) 2026
3
- * Source Of Juice Toast v1.3.1 (NEW: For iOS user)
3
+ * Source Of Juice Toast v1.3.3 (iOS user)
4
4
  * Read CONTRIBUTE.md To Contribute
5
5
  */
6
- let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMotion=isBrowser&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,isTouch=isBrowser&&("ontouchstart"in window||navigator&&navigator.maxTouchPoints>0),isIOS=isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent||""),isIOSStandalone=isBrowser&&(!0===window.navigator.standalone||window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches),TYPE_ANIMATION={success:"bounce",error:"shake",warning:"wiggle",info:"pulse",loading:"spin"},__cssInjected=!1,BASE_CSS=`
6
+ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMotion=isBrowser&&window.matchMedia("(prefers-reduced-motion: reduce)").matches,isTouch=isBrowser&&("ontouchstart"in window||navigator&&navigator.maxTouchPoints>0),isIOS=isBrowser&&/iPad|iPhone|iPod/.test(navigator.userAgent||""),isIOSStandalone=isBrowser&&(!0===window.navigator.standalone||window.matchMedia&&window.matchMedia("(display-mode: standalone)").matches);function speakTTS(e,t="en-US",s=1){if(!("speechSynthesis"in window))return;let a=new SpeechSynthesisUtterance(e);a.lang=t,a.rate=s;let i=()=>{window.speechSynthesis.speak(a),document.body.removeEventListener("touchstart",i),document.body.removeEventListener("click",i)},o=/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream;o&&!1===window.speechSynthesis.speaking?(document.body.addEventListener("touchstart",i,{once:!0}),document.body.addEventListener("click",i,{once:!0})):i()}let raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||(e=>setTimeout(e,16)),TYPE_ANIMATION={success:"bounce",error:"shake",warning:"wiggle",info:"pulse",loading:"spin"},__cssInjected=!1,BASE_CSS=`
7
7
  :root {
8
8
  --jt-safe-top: env(safe-area-inset-top, 0px);
9
9
  --jt-safe-bottom: env(safe-area-inset-bottom, 0px);
@@ -17,15 +17,6 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
17
17
  pointer-events: none;
18
18
  }
19
19
 
20
- /* bottom (default) */
21
- #juice-toast-root[data-position="bottom"] {
22
- bottom: 20px;
23
- left: 50%;
24
- transform: translateX(-50%);
25
- flex-direction: column;
26
- align-items: center;
27
- }
28
-
29
20
  /* top */
30
21
  #juice-toast-root[data-position="top"] {
31
22
  top: 20px;
@@ -90,6 +81,16 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
90
81
  position: relative;
91
82
  box-sizing: border-box;
92
83
  overflow: hidden;
84
+
85
+ scroll-behavior: contains;
86
+ -webkit-overflow-scrolling: touch;
87
+
88
+ will-change: transform, opacity;
89
+ backface-visibility: hidden;
90
+ -webkit-backface-visibility: hidden;
91
+
92
+ touch-action: pan-y;
93
+
93
94
  }
94
95
 
95
96
  /* visible */
@@ -239,12 +240,23 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
239
240
  height: 3px;
240
241
  width: 100%;
241
242
 
242
- background: rgba(255,255,255,.7);
243
+ background: linear-gradient(to right, #FFFFFF, #FAFAFA);
244
+ height: 4px;
243
245
  transform-origin: left;
246
+ transition: transform linear;
247
+ border-radius: 2px;
244
248
  transform: scaleX(1);
245
249
  opacity: .85;
246
250
  }
247
251
 
252
+ .juice-toast.bg-image {
253
+ background-size: cover;
254
+ background-position: center;
255
+ background-repeat: no-repeat;
256
+ color: #fff;
257
+ text-shadow: 0 1px 2px rgba(0,0,0,0.6);
258
+ }
259
+
248
260
  /* ================= ANIMATIONS ================= */
249
261
 
250
262
  @keyframes jt-spin {
@@ -313,4 +325,4 @@ let isBrowser="undefined"!=typeof window&&"undefined"!=typeof document,reduceMot
313
325
  animation: none !important;
314
326
  }
315
327
  }
316
- `;function injectCSS(e){if(!isBrowser||__cssInjected)return;let t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),__cssInjected=!0}let themes={light:{bg:"#ffffff",color:"#111",border:"1px solid #e5e7eb"},dark:{bg:"#1f2937",color:"#fff",border:"1px solid rgba(255,255,255,.08)"}},sizePreset={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},juiceToast={_config:{},_queue:[],_showing:!1,_theme:"dark",_plugins:[],setup(e={}){this._config=e,this._defaults={...this._defaults,...e},isIOS&&(this._defaults.swipeThreshold=Math.min(this._defaults.swipeThreshold||60,50),this._defaults.glassUI=this._defaults.glassUI||60,this._defaults.duration=this._defaults.duration??2200),this._registerTypes()},use(e){"function"==typeof e&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){themes[e]={...themes[e]||{},...t}},setTheme(e){if(this._theme=e,!isBrowser)return;let t=document.querySelector('[id^="juice-toast-root-"]');t&&(t.dataset.theme=e)},clear(){this._queue.length=0},destroy(){if(this.clear(),!isBrowser)return;let e=document.querySelectorAll('[id^="juice-toast-root-"]');e.forEach(e=>e.remove())},_registerTypes(){Object.keys(this._config).forEach(e=>{if("function"==typeof this[e]&&!this[e].__auto)return;let t=t=>this._enqueue(e,t);t.__auto=!0,this[e]=t})},_enqueue(e,t){this._queue.push({type:e,payload:t}),this._showing||this._next()},_next(){if(!this._queue.length){this._showing=!1;return}this._showing=!0;let e=this._queue.shift();this._showToast(e.type,e.payload)},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(s){this._warn("Plugin error: "+(s&&s.message?s.message:String(s)))}})},_normalizeGlass(e){if(!0===e)return 60;if(!1===e||null==e)return 0;let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},_getRoot(e="bottom-right"){if(!isBrowser)return null;let t=document.getElementById(`juice-toast-root-${e}`);if(!t){switch((t=document.createElement("div")).id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.position="fixed",t.style.zIndex=9999,t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.pointerEvents="none",e){case"top-left":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.left="20px",t.style.alignItems="flex-start";break;case"top-right":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.right="20px",t.style.alignItems="flex-end";break;case"bottom-left":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.left="20px",t.style.alignItems="flex-start";break;case"bottom-right":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.right="20px",t.style.alignItems="flex-end";break;case"top-center":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.alignItems="center";break;case"bottom-center":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.alignItems="center";break;default:t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.right="20px"}document.body.appendChild(t)}return t},_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_warn(e){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",e)},_playSound(e){if(!isBrowser)return;let t="string"==typeof e&&e?e:this._defaults.playSound;if(t)try{let s=new Audio(t);s.volume=.6;let a=()=>{s.play().catch(()=>{}),window.removeEventListener("touchstart",a),window.removeEventListener("click",a)};s.play().catch(()=>{window.addEventListener("touchstart",a,{once:!0}),window.addEventListener("click",a,{once:!0})})}catch(i){}},_showToast(e,t){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);let s=this._config[e]||{},a="object"==typeof t?t:{message:String(t)},i={...s,...a};i.icon=i.icon??i.icon_left_top,i.iconPack=i.iconPack??i.icon_config,i.iconLink=i.iconLink??i.icon_onClick_url,i.iconAnimate=i.iconAnimate??i.icon_onClick_animate,i.position=i.position??i.toast,i.closable=i.closable??i.closeable,i.iconPosition=i.iconPosition||"left",i.compact=!!i.compact;let o=themes[i.theme||this._theme]||{},n=document.createElement("div");n.className="juice-toast";let r=i.animation||"slide-in";if(i.enterAnimation||(n.style.animation=`${r} 0.4s ease forwards`),n.setAttribute("role","alert"),n.setAttribute("aria-live","polite"),n.tabIndex=0,i.size&&sizePreset[i.size]){let l=sizePreset[i.size];l.width&&(n.style.width=l.width),l.padding&&(n.style.padding=l.padding)}let c=null,d=i.duration??this._defaults.duration;i.progress&&d>0&&((c=document.createElement("div")).className="jt-progress",i.progressColor&&(c.style.background=i.progressColor||"rgba(255,255,255,.7)"),n.appendChild(c));let p=this._normalizeGlass(i.glassUI??this._defaults.glassUI);p>0&&(n.classList.add("jt-glass"),n.style.setProperty("--jt-glass",p)),p||(n.style.background=i.bg||o.bg),n.style.color=i.color||o.color,n.style.border=i.border||o.border,i.compact&&n.classList.add("jt-compact"),(i.glassUI??this._defaults.glassUI)&&n.classList.add("jt-glass"),i.width&&(n.style.width=i.width),i.height&&(n.style.height=i.height);let u=null;if(i.icon){(u=document.createElement("i")).className=["icon",i.iconPack||"",i.icon].join(" ").trim(),i.iconSize&&(u.style.fontSize=i.iconSize),(i.iconLink||i.iconAnimate)&&(u.classList.add("icon-clickable"),u.onclick=e=>{e.stopPropagation(),i.iconAnimate&&(u.classList.remove(i.iconAnimate),u.offsetWidth,u.classList.add(i.iconAnimate)),i.iconLink&&window.open(i.iconLink,"_blank","noopener")});let m=i.iconAnimate??TYPE_ANIMATION[e];m&&(u.classList.add(m),u.addEventListener("click",()=>{u.classList.remove(m),u.offsetWidth,u.classList.add(m)}))}reduceMotion&&(n.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),u?.classList.remove("bounce","shake","wiggle","pulse","spin")),i.message||i.title||this._warn("Toast created without message or title"),i.icon&&!i.iconPack&&this._warn("icon provided without iconPack"),i.duration<0&&this._warn("duration cannot be negative");let h=0,f=0,$=!1,g=e=>{let t=e.touches?e.touches[0]:e;h=t.clientX,f=0,$=!0,n.__paused=!0},x=e=>{if(!$)return;let t=e.touches?e.touches[0]:e;f=t.clientX-h,n.style.transform=`translate3d(${f}px, 0, 0)`},y=()=>{$&&($=!1,Math.abs(f)>(this._defaults.swipeThreshold||60)?(n.style.transition="transform .25s ease, opacity .2s ease",n.style.transform=`translate3d(${f>0?1e3:-1e3}px, 0, 0)`,setTimeout(()=>{n.remove(),this._next()},220)):(n.style.transition="transform .2s ease",n.style.transform=""),setTimeout(()=>{n.__paused=!1},60),h=f=0)};isTouch?(n.addEventListener("touchstart",g,{passive:!0}),n.addEventListener("touchmove",x,{passive:!0}),n.addEventListener("touchend",y),n.addEventListener("touchcancel",y)):n.addEventListener("mousedown",e=>{h=e.clientX,f=0,$=!0,n.__paused=!0;let t=e=>{f=e.clientX-h,n.style.transform=`translate3d(${f}px, 0, 0)`},s=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",s),y()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",s)});let b=document.createElement("div");b.className="jt-content";let v=i.enterAnimation??"pop";if(v&&!reduceMotion&&n.classList.add(v),i.title){let _=document.createElement("div");_.className="jt-title",_.textContent=i.title,b.appendChild(_)}let j=document.createElement("div");if(j.className="jt-message",j.textContent=i.message||"",b.appendChild(j),u&&"top"===i.iconPosition?(n.classList.add("jt-icon-top"),n.appendChild(u),n.appendChild(b)):u&&"right"===i.iconPosition?(n.appendChild(b),n.appendChild(u)):(u&&n.appendChild(u),n.appendChild(b)),Array.isArray(i.actions)&&i.actions.length){let w=document.createElement("div");w.className="jt-actions",i.actions.forEach(e=>{let t=document.createElement("button");t.className="jt-action",t.textContent=e.label,t.onclick=t=>{t.stopPropagation(),e.onClick?.(t),e.closeOnClick&&(n.remove(),this._next())},w.appendChild(t)}),b.appendChild(w)}if(i.closable){let k=document.createElement("span");k.className="juice-toast-close",k.innerHTML="\xd7",k.onclick=()=>{n.remove(),this._next()},n.appendChild(k)}isIOSStandalone&&(n.style.borderRadius=n.style.borderRadius||"14px");let S=this._getRoot(i.position),E=this._defaults.maxVisible;if(E&&S.children.length>=E&&S.firstChild.remove(),S.appendChild(n),this._runPlugins({toast:n,cfg:i,type:e,root:S}),requestAnimationFrame(()=>{n.classList.add("show")}),0===d)return;let C=Date.now(),L=d,I,T=()=>{if(n.__paused)C=Date.now();else{let e=Date.now();L-=e-C,C=e}if(L<=0?(n.classList.remove("show"),setTimeout(()=>{n.remove(),this._next()},300)):I=requestAnimationFrame(T),c){let t=Math.max(0,Math.min(1,L/d));c.style.transform=`scaleX(${t})`}};isTouch||(n.addEventListener("mouseenter",()=>n.__paused=!0),n.addEventListener("mouseleave",()=>n.__paused=!1)),n.addEventListener("touchstart",()=>{n.__paused=!0},{passive:!0}),n.addEventListener("touchend",()=>{n.__paused=!1}),C=Date.now(),I=requestAnimationFrame(T),(i.playSound||this._defaults.playSound)&&this._playSound(i.playSound)}};export default juiceToast;export{juiceToast};
328
+ `;function injectCSS(e){if(!isBrowser||__cssInjected)return;let t=document.createElement("style");t.id="juice-toast-style",t.textContent=e,document.head.appendChild(t),__cssInjected=!0}let themes={light:{bg:"#ffffff",color:"#111",border:"1px solid #e5e7eb"},dark:{bg:"#1f2937",color:"#fff",border:"1px solid rgba(255,255,255,.08)"},glass:{bg:"rgba(30,30,30,.35)",color:"#fff",border:"1px solid rgba(255,255,255,.15)"},midnight:{bg:"#0f172a",color:"#e5e7eb",border:"1px solid rgba(255,255,255,.06)"},soft:{bg:"#f8fafc",color:"#0f172a",border:"1px solid #e2e8f0"},neutral:{bg:"#ffffff",color:"#374151",border:"1px solid #d1d5db"},brand:{bg:"#6366f1",color:"#fff",border:"none"},gradient:{bg:"linear-gradient(135deg,#6366f1,#ec4899)",color:"#fff",border:"none"},outline:{bg:"transparent",color:"#111",border:"2px solid currentColor"}},sizePreset={sm:{width:"260px",padding:"10px"},md:{width:"320px",padding:"14px"},lg:{width:"420px",padding:"18px"}},juiceToast={_config:{},_queue:[],_showing:!1,_theme:"dark",_plugins:[],setup(e={}){let{duration:t,maxVisible:s,...a}=e;this._defaults={...this._defaults,duration:t,maxVisible:s},this._config=a,isIOS&&(this._defaults.swipeThreshold=Math.min(this._defaults.swipeThreshold||60,50),this._defaults.glassUI=this._defaults.glassUI||60,this._defaults.duration=this._defaults.duration??2200),this._registerTypes()},use(e){"function"==typeof e&&this._plugins.push(e)},addType(e,t={}){this._config[e]=t,this._registerTypes()},defineTheme(e,t={}){themes[e]={...themes[e]||{},...t}},setTheme(e){if(this._theme=e,!isBrowser)return;let t=document.querySelector('[id^="juice-toast-root-"]');t&&(t.dataset.theme=e)},clear(){this._queue.length=0},destroy(){if(this.clear(),!isBrowser)return;let e=document.querySelectorAll('[id^="juice-toast-root-"]');e.forEach(e=>e.remove())},_registerTypes(){Object.keys(this._config).forEach(e=>{if("function"==typeof this[e]&&!this[e].__auto)return;let t=t=>this._enqueue(e,t);t.__auto=!0,this[e]=t})},_enqueue(e,t){this._queue.push({type:e,payload:t}),this._showing||this._next()},_next(){if(!this._queue.length){this._showing=!1;return}this._showing=!0;let e=this._queue.shift();this._showToast(e.type,e.payload)},_runPlugins(e){this._plugins.forEach(t=>{try{t(e)}catch(s){this._warn("Plugin error: "+(s&&s.message?s.message:String(s)))}})},_normalizeGlass(e){if(!0===e)return 60;if(!1===e||null==e)return 0;let t=Number(e);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},_getRoot(e="bottom-right"){if(!isBrowser)return null;let t=document.getElementById(`juice-toast-root-${e}`);if(!t){switch((t=document.createElement("div")).id=`juice-toast-root-${e}`,t.dataset.position=e,t.dataset.theme=this._theme,t.style.position="fixed",t.style.zIndex=9999,t.style.display="flex",t.style.flexDirection="column",t.style.gap="8px",t.style.pointerEvents="none",e){case"top-left":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.left="20px",t.style.alignItems="flex-start";break;case"top-right":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.right="20px",t.style.alignItems="flex-end";break;case"bottom-left":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.left="20px",t.style.alignItems="flex-start";break;case"bottom-right":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.right="20px",t.style.alignItems="flex-end";break;case"top-center":t.style.top="calc(20px + env(safe-area-inset-top))",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.alignItems="center";break;case"bottom-center":t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.left="50%",t.style.transform="translateX(-50%)",t.style.alignItems="center";break;default:t.style.bottom="calc(20px + env(safe-area-inset-bottom))",t.style.right="20px"}document.body.appendChild(t)}return t},_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_warn(e){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",e)},_playSound(e){if(!isBrowser)return;let t="string"==typeof e&&e?e:this._defaults.playSound;if(t)try{let s=new Audio(t);s.volume=.6;let a=()=>{s.play().catch(()=>{}),window.removeEventListener("touchstart",a),window.removeEventListener("click",a)};s.play().catch(()=>{window.addEventListener("touchstart",a,{once:!0}),window.addEventListener("click",a,{once:!0})})}catch(i){}},_showToast(e,t){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);let s=this._config[e]||{},a="object"==typeof t?t:{message:String(t)},i={...s,...a};i.icon=i.icon??i.icon_left_top,i.iconPack=i.iconPack??i.icon_config,i.iconLink=i.iconLink??i.icon_onClick_url,i.iconAnimate=i.iconAnimate??i.icon_onClick_animate,i.position=i.position??i.toast,i.closable=i.closable??i.closeable,i.iconPosition=i.iconPosition||"left",i.compact=!!i.compact;let o=themes[i.theme||this._theme]||{},n=document.createElement("div");n.className="juice-toast";let r=i.animation||"slide-in";if(i.enterAnimation||(n.style.animation=`${r} 0.4s ease forwards`),n.setAttribute("role","alert"),n.setAttribute("aria-live","error"===e?"assertive":"polite"),n.setAttribute("aria-atomic","true"),n.tabIndex=0,i.closable){let l=document.createElement("span");l.className="juice-toast-close",l.textContent="\xd7",l.tabIndex=0,l.addEventListener("keydown",e=>{("Enter"===e.key||" "===e.key)&&(n.remove(),this._next())})}if(i.size&&sizePreset[i.size]){let c=sizePreset[i.size];c.width&&(n.style.width=c.width),c.padding&&(n.style.padding=c.padding)}let d=null,p=i.duration??this._defaults.duration;i.progress&&p>0&&((d=document.createElement("div")).className="jt-progress",i.progressColor&&(d.style.background=i.progressColor||"rgba(255,255,255,.7)"),n.appendChild(d)),i.tts&&i.message&&speakTTS(i.message,i.ttsLang??"en-US",i.ttsRate??1);let u=this._normalizeGlass(i.glassUI??this._defaults.glassUI);u>0&&(n.style.setProperty("--jt-glass",i.glassUI??50),n.classList.add("jt-glass")),u||(n.style.background=i.bg||o.bg),n.style.color=i.color||o.color,n.style.border=i.border||o.border,i.compact&&n.classList.add("jt-compact"),i.width&&(n.style.width=i.width),i.height&&(n.style.height=i.height),i.bgImage&&(n.style.backgroundImage=`url(${i.bgImage})`,n.classList.add("bg-image"));let f=null;if(i.icon){(f=document.createElement("i")).className=["icon",i.iconPack||"",i.icon].join(" ").trim(),i.iconSize&&(f.style.fontSize=i.iconSize),(i.iconLink||i.iconAnimate)&&(f.classList.add("icon-clickable"),f.onclick=e=>{e.stopPropagation(),i.iconAnimate&&(f.classList.remove(i.iconAnimate),f.offsetWidth,f.classList.add(i.iconAnimate)),i.iconLink&&window.open(i.iconLink,"_blank","noopener")});let m=i.iconAnimate??TYPE_ANIMATION[e];m&&(f.classList.add(m),f.addEventListener("click",()=>{f.classList.remove(m),f.offsetWidth,f.classList.add(m)}))}reduceMotion&&(n.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),f?.classList.remove("bounce","shake","wiggle","pulse","spin")),i.message||i.title||this._warn("Toast created without message or title"),i.icon&&!i.iconPack&&this._warn("icon provided without iconPack"),i.duration<0&&this._warn("duration cannot be negative");let h=0,g=0,$=!1,b=e=>{let t=e.touches?e.touches[0]:e;h=t.clientX,g=0,$=!0,n.__paused=!0},x=e=>{if(!$)return;let t=e.touches?e.touches[0]:e;g=t.clientX-h,n.style.transform=`translate3d(${g}px, 0, 0)`},y=()=>{$&&($=!1,Math.abs(g)>(this._defaults.swipeThreshold||60)?(n.style.transition="transform .25s ease, opacity .2s ease",n.style.transform=`translate3d(${g>0?1e3:-1e3}px, 0, 0)`,setTimeout(()=>{n.replaceWith(),n.onclick=null,n.onmousedown=null,n.remove(),this._next()},220)):(n.style.transition="transform .2s ease",n.style.transform=""),setTimeout(()=>{n.__paused=!1},60),h=g=0)};isTouch?(n.addEventListener("touchstart",b,{passive:!0}),n.addEventListener("touchmove",x,{passive:!0}),n.addEventListener("touchend",y),n.addEventListener("touchcancel",y)):n.addEventListener("mousedown",e=>{h=e.clientX,g=0,$=!0,n.__paused=!0;let t=e=>{g=e.clientX-h,n.style.transform=`translate3d(${g}px, 0, 0)`},s=()=>{document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",s),y()};document.addEventListener("mousemove",t),document.addEventListener("mouseup",s)});let _=document.createElement("div");_.className="jt-content";let v=i.enterAnimation??"pop";if(v&&!reduceMotion&&n.classList.add(v),i.title){let k=document.createElement("div");k.className="jt-title",k.textContent=i.title,_.appendChild(k)}let w=document.createElement("div");if(w.className="jt-message",w.textContent=i.message||"",_.appendChild(w),f&&"top"===i.iconPosition?(n.classList.add("jt-icon-top"),n.appendChild(f),n.appendChild(_)):f&&"right"===i.iconPosition?(n.appendChild(_),n.appendChild(f)):(f&&n.appendChild(f),n.appendChild(_)),Array.isArray(i.actions)&&i.actions.length){let j=document.createElement("div");j.className="jt-actions",i.actions.forEach(e=>{let t=document.createElement("button");t.className="jt-action",t.textContent=e.label,t.onclick=t=>{t.stopPropagation(),e.onClick?.(t),e.closeOnClick&&(n.replaceWith(),n.onclick=null,n.onmousedown=null,n.remove(),this._next())},j.appendChild(t)}),_.appendChild(j)}if(i.closable){let S=document.createElement("span");S.className="juice-toast-close",S.textContent="\xd7",S.onclick=()=>{n.replaceWith(),n.onclick=null,n.onmousedown=null,n.remove(),this._next()},n.appendChild(S)}isIOSStandalone&&(n.style.borderRadius=n.style.borderRadius||"14px");let E=this._getRoot(i.position),L=this._defaults.maxVisible;if(L&&E.children.length>=L&&E.firstChild.remove(),E.appendChild(n),this._runPlugins({toast:n,cfg:i,type:e,root:E}),requestAnimationFrame(()=>{n.classList.add("show")}),0===p)return;let C=Date.now(),I=p,T=()=>{if(n.__paused)C=Date.now();else{let e=Date.now();I-=e-C,C=e}if(I<=0?(n.classList.remove("show"),setTimeout(()=>{n.replaceWith(),n.onclick=null,n.onmousedown=null,n.remove(),this._next()},300)):raf(T),d){let t=Math.max(0,Math.min(1,I/p));d.style.transform=`scaleX(${t})`}};isTouch||(n.addEventListener("mouseenter",()=>n.__paused=!0),n.addEventListener("mouseleave",()=>n.__paused=!1)),n.addEventListener("touchstart",()=>{n.__paused=!0},{passive:!0}),n.addEventListener("touchend",()=>{n.__paused=!1}),C=Date.now(),raf(T),(i.playSound||this._defaults.playSound)&&this._playSound(i.playSound)}};juiceToast.setup({success:{icon:"fa-check",iconPack:"fa-solid",bg:"#16a34a",progress:!0,duration:3e3},error:{icon:"fa-xmark",iconPack:"fa-solid",bg:"#dc2626",progress:!0,duration:4e3},info:{icon:"fa-circle-info",iconPack:"fa-solid",bg:"#2563eb",progress:!0},warning:{icon:"fa-triangle-exclamation",iconPack:"fa-solid",bg:"#f59e0b",progress:!0},loading:{icon:"fa-spinner",iconPack:"fa-solid",iconAnimate:"spin",duration:0,progress:!1,closable:!1}});export default juiceToast;export{juiceToast};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "juice-toast",
3
- "version": "1.3.1",
3
+ "version": "1.3.3",
4
4
  "description": "Lightweight, dependency-free toast notification library",
5
5
  "keywords": [
6
6
  "toast",
@@ -23,7 +23,10 @@
23
23
  },
24
24
  "funding": "https://patreon.com/Khairy47",
25
25
  "engines": {
26
- "node": ">=18"
26
+ "node": ">=19"
27
+ },
28
+ "scripts": {
29
+ "format": "npx prettier --write src/"
27
30
  },
28
31
  "module": "dist/juice-toast.esm.js",
29
32
  "types": "dist/juice-toast.d.ts",
@@ -31,9 +34,9 @@
31
34
  ".": {
32
35
  "import": "./dist/juice-toast.esm.js",
33
36
  "types": "./dist/juice-toast.d.ts"
34
- },
37
+ },
35
38
  "./ios": {
36
- "import": "./dist/juice-toast.ios.js",
39
+ "import": "./dist/juice-toast.ios.js",
37
40
  "types": "./dist/juice-toast-ios.d.ts"
38
41
  }
39
42
  },
@@ -54,5 +57,8 @@
54
57
  "access": "public"
55
58
  },
56
59
  "unpkg": "dist/juice-toast.esm.js",
57
- "jsdelivr": "dist/juice-toast.esm.js"
60
+ "jsdelivr": "dist/juice-toast.esm.js",
61
+ "devDependencies": {
62
+ "prettier": "^3.8.1"
63
+ }
58
64
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Sholehuddin Khairy
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.