juice-toast 1.3.0 → 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,38 +1,51 @@
1
- v1.3.0
2
- - Add CSS Injection System (no external `style.css` needed)
3
- - Add Reduced Motion Support (prefers-reduced-motion)
4
- - Improve Animation System (enterAnimation + type animation)
5
- - Improve Glass UI with intensity control (0–100)
6
- - Improve Swipe to Dismiss
7
- - Improve Pause on Hover & Touch
8
- - Add Plugin System
9
- - Improve Accessibility (ARIA, keyboard focus)
10
- - Improve Icon Interaction & Animation
11
- - Add Animation Preset
12
- - Add Progress Bar
13
- - Bug fixes & internal refactor
14
-
15
- v1.2.0-rc.2026 / v1.2.1
16
- - Add A11Y support
17
- - Add Multiple Placement / Position
18
- - Experimental Glass UI (unstable)
19
-
20
- NEXT 120/2026
21
- - Improve Sound API (per-toast sound)
22
- - Add Exit Animation
23
- - Add Promise-based Toast API
24
- - Add Stack Grouping
25
- - Improve TypeScript Definitions
26
-
27
- v1.1.0
28
- - Add Size Preset
29
- - Add Compact Mode
30
- - Add Actions Button
31
- - Improve Style
32
- - Improve `.d.ts`
33
-
34
- v1.0.1
35
- - Add `style.css` file
36
-
37
- v1.0.0
38
- - 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
@@ -49,7 +49,7 @@ Here are some ways you can help make Juice Toast a positive community:
49
49
  If you see or experience something that breaks this Code of Conduct:
50
50
 
51
51
  1. **Stay calm** and don’t respond aggressively.
52
- 2. **Report it** to the maintainers at **[your-email@example.com]**.
52
+ 2. **Report it** to the maintainers at **[musickhairy@gmail.com]**.
53
53
  3. Maintainers will **review and respond quickly and fairly**, keeping the reporter anonymous if requested.
54
54
  4. Actions can include **warnings, temporary restrictions, or banning**, depending on severity.
55
55
 
@@ -84,4 +84,4 @@ Juice Toast isn’t just code — it’s a **community of developers who care**.
84
84
  Great ideas come from collaboration, experimentation, and mutual respect.
85
85
  By following this Code of Conduct, you’re helping make Juice Toast a **place where developers of all skill levels can grow, learn, and have fun**.
86
86
 
87
- Let’s build something amazing together! 🚀
87
+ Let’s build something amazing together! 🚀
package/EoL.md CHANGED
@@ -6,5 +6,4 @@ The following versions and distributions have reached End of Life (EoL) and are
6
6
  |--------------------|-----------------|--------|
7
7
  | 1.2.0-rc.2026 | UMD build | UMD distribution has been removed to simplify maintenance and reduce build complexity |
8
8
  | 0.0.0-next.1202026 | Pre-release tag | Versioning structure became inconsistent and difficult to maintain |
9
- | 1.0.0 | 1.0.0 | Stable release | Deprecated due to outdated internal architecture and styling standards |
10
9
  | 1.0.0 | Stable release | Deprecated due to outdated internal architecture and styling standards |
package/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,16 +1,31 @@
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
 
6
- It supports **ESM and UMD**, **dynamic toast types**, **theme management**, **queue handling**, and **legacy API compatibility** out of the box.
21
+ It supports **ESM**, **dynamic toast types**, **theme management**, **queue handling**, and **legacy API compatibility** out of the box.
7
22
 
8
23
  ---
9
24
 
10
25
  ## ✨ Key Features
11
26
 
12
27
  - 🚀 Zero dependencies
13
- - 📦 Supports **ESM** and **UMD**
28
+ - 📦 Supports **ESM**
14
29
  - 🔁 Built-in queue system (one toast displayed at a time)
15
30
  - 🎨 Theme system (light, dark, and custom themes)
16
31
  - 🧩 Dynamic toast types (`success`, `error`, etc.)
@@ -26,26 +41,7 @@ It supports **ESM and UMD**, **dynamic toast types**, **theme management**, **qu
26
41
 
27
42
  ### ESM
28
43
  ```js
29
- import juiceToast from "https://cdn.kyrt.my.id/libs/js/juice-toast/1.1.0/juice-toast.esm.min.js";
30
- ```
31
-
32
- ### UMD (Browser)
33
- ```html
34
- <link
35
- rel="stylesheet"
36
- href="https://cdn.kyrt.my.id/libs/css/fontic/2.0.0/juice-toast/style.min.css"
37
- />
38
- <script src="https://cdn.kyrt.my.id/libs/js/juice-toast/1.1.0/juice-toast.umd.min.js"></script>
39
-
40
- <script>
41
- juiceToast.setup({
42
- success: {
43
- bg: "#01AA38"
44
- }
45
- });
46
-
47
- juiceToast.success("Hello world!");
48
- </script>
44
+ import juiceToast from "https://npdn.kyrt.my.id/npm/juice-toast@1.3.2dist/juice-toast.esm.js";
49
45
  ```
50
46
 
51
47
  ---
@@ -0,0 +1,160 @@
1
+ /* JuiceToast v1.3.2 (iOS User)
2
+ * (C) 2026 OpenDN Foundation
3
+ * Type Definitions
4
+ */
5
+
6
+ /* ================= CORE ================= */
7
+
8
+ export type ToastPosition =
9
+ | "top-left"
10
+ | "top-right"
11
+ | "bottom-left"
12
+ | "bottom-right"
13
+ | "top-center"
14
+ | "bottom-center"
15
+ | string;
16
+
17
+ export type ToastSize = "sm" | "md" | "lg";
18
+
19
+ export type ToastAnimation =
20
+ | "spin"
21
+ | "pulse"
22
+ | "shake"
23
+ | "bounce"
24
+ | "wiggle"
25
+ | "pop"
26
+ | string;
27
+
28
+ /* ================= ACTIONS ================= */
29
+
30
+ export interface ToastAction {
31
+ label: string;
32
+ onClick?: (ev: MouseEvent) => void;
33
+ closeOnClick?: boolean;
34
+ }
35
+
36
+ /* ================= OPTIONS ================= */
37
+
38
+ export interface ToastOptions {
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;
85
+ }
86
+
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;
98
+ }
99
+
100
+ /* ================= PLUGIN ================= */
101
+
102
+ export interface JuiceToastPluginContext<T extends string = string> {
103
+ toast: HTMLElement;
104
+ cfg: ToastOptions;
105
+ type: T;
106
+ root: HTMLElement;
107
+ }
108
+
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;
150
+ }
151
+
152
+ /* ================= FINAL TYPE ================= */
153
+
154
+ export type JuiceToast<T extends string = string> =
155
+ JuiceToastBase<T> & DynamicToastMethods<T>;
156
+
157
+ declare const juiceToast: JuiceToast;
158
+
159
+ export default juiceToast;
160
+ export { juiceToast };
@@ -1,186 +1,120 @@
1
- /* --------------------------------------------------
2
- * 2026 (C) OpenDN Foundation
3
- * Juice Toast v1.3.0 Type Definitions
4
- * -------------------------------------------------- */
5
- declare module "juice-toast" {
6
- /* ================= BASIC ================= */
7
-
8
- export type ToastPosition =
9
- | "top-left"
10
- | "top-right"
11
- | "top-center"
12
- | "bottom-left"
13
- | "bottom-right"
14
- | "bottom-center"
15
- | "center"
16
- | "top"
17
- | "bottom";
18
-
19
- export type ToastSize = "sm" | "md" | "lg";
20
-
21
- export type IconPosition = "left" | "right" | "top";
22
-
23
- export type EnterAnimation =
24
- | "spin"
25
- | "pulse"
26
- | "shake"
27
- | "bounce"
28
- | "wiggle"
29
- | "pop";
30
-
31
- export type Animation = string;
32
-
33
- /* ================= ACTION ================= */
34
-
35
- export interface ToastAction {
36
- label: string;
37
- onClick?: (ev: MouseEvent) => void;
38
- closeOnClick?: boolean;
39
- }
40
-
41
- /* ================= PAYLOAD ================= */
42
-
43
- export interface ToastPayload {
44
- /* content */
45
- title?: string;
46
- message?: string;
47
-
48
- /* size / layout */
49
- size?: ToastSize;
50
- width?: string;
51
- height?: string;
52
- compact?: boolean;
53
-
54
- /* position */
55
- position?: ToastPosition;
56
-
57
- /* timing */
58
- duration?: number;
59
-
60
- /* icon */
61
- icon?: string;
62
- iconPack?: string;
63
- iconSize?: string;
64
- iconPosition?: IconPosition;
65
- iconLink?: string;
66
- iconAnimate?: EnterAnimation;
67
-
68
- /* animation */
69
- animation?: Animation;
70
- enterAnimation?: EnterAnimation;
71
-
72
- /* style */
73
- theme?: string;
74
- bg?: string;
75
- color?: string;
76
- border?: string;
77
-
78
- /* glass */
79
- glassUI?: boolean | number;
80
-
81
- /* progress */
82
- progress?: boolean;
83
- progressColor?: string;
84
-
85
- /* close */
86
- closable?: boolean;
87
-
88
- /* sound */
89
- playSound?: string | null;
90
-
91
- /* actions */
92
- actions?: readonly ToastAction[];
93
-
94
- /* backward compatibility */
95
- toast?: ToastPosition;
96
- closeable?: boolean;
97
- icon_left_top?: string;
98
- icon_config?: string;
99
- icon_onClick_url?: string;
100
- icon_onClick_animate?: EnterAnimation;
101
- }
102
-
103
- /* ================= SETUP ================= */
104
-
105
- export interface JuiceToastDefaults {
106
- duration?: number;
107
- maxVisible?: number;
108
- swipeThreshold?: number;
109
- glassUI?: number | boolean;
110
- playSound?: string | null;
111
- dev?: boolean;
112
- injectCSS?: boolean;
113
- css?: string | null;
114
- }
115
-
116
- /**
117
- * setup() config:
118
- * - known global defaults
119
- * - custom toast types via index signature
120
- */
121
- export type JuiceToastSetup =
122
- JuiceToastDefaults & {
123
- readonly [toastType: string]:
124
- | ToastPayload
125
- | number
126
- | string
127
- | boolean
128
- | undefined;
129
- };
130
-
131
- /* ================= PLUGIN ================= */
132
-
133
- export interface JuiceToastPluginContext {
134
- toast: HTMLElement;
135
- cfg: Readonly<ToastPayload>;
136
- type: string;
137
- root: HTMLElement;
138
- }
139
-
140
- export type JuiceToastPlugin = (
141
- ctx: JuiceToastPluginContext
142
- ) => void;
143
-
144
- /* ================= MAIN API ================= */
145
-
146
- export interface JuiceToast {
147
- /* core */
148
- setup(cfg?: JuiceToastSetup): void;
149
- clear(): void;
150
- destroy(): void;
151
-
152
- /* theme */
153
- defineTheme(
154
- name: string,
155
- styles: Readonly<{
156
- bg?: string;
157
- color?: string;
158
- border?: string;
159
- }>
160
- ): void;
161
-
162
- setTheme(name: string): void;
163
-
164
- /* types */
165
- addType(
166
- name: string,
167
- cfg?: Readonly<ToastPayload>
168
- ): void;
169
-
170
- /* plugin */
171
- use(plugin: JuiceToastPlugin): void;
172
-
173
- /**
174
- * Dynamic toast methods
175
- * success(), error(), warning(), info(), loading(), custom...
176
- */
177
- readonly [type: string]:
178
- | ((payload?: Readonly<ToastPayload> | string) => void)
179
- | unknown;
180
- }
181
-
182
- const juiceToast: JuiceToast;
183
-
184
- export default juiceToast;
185
- export { juiceToast };
186
- }
1
+ /* JuiceToast v1.3.2
2
+ * (C) 2026 OpenDN Foundation
3
+ * Type Definitions
4
+ */
5
+ /* ================= CORE TYPES ================= */
6
+
7
+ export type ToastPosition =
8
+ | "top-left"
9
+ | "top-right"
10
+ | "bottom-left"
11
+ | "bottom-right"
12
+ | "top-center"
13
+ | "bottom-center";
14
+
15
+ export type ToastSize = "sm" | "md" | "lg";
16
+
17
+ export interface ToastAction {
18
+ label: string;
19
+ onClick?: (ev: MouseEvent) => void;
20
+ closeOnClick?: boolean;
21
+ }
22
+
23
+ export interface ToastOptions {
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[];
62
+
63
+ /* TTS */
64
+ tts?: boolean;
65
+ ttsLang?: string;
66
+ ttsRate?: number;
67
+ }
68
+
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;
80
+ }
81
+
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;
110
+ }
111
+
112
+ /* ================= FINAL TYPE ================= */
113
+
114
+ export type JuiceToast<T extends string = string> =
115
+ JuiceToastBase<T> & DynamicToastMethods<T>;
116
+
117
+ declare const juiceToast: JuiceToast;
118
+
119
+ export default juiceToast;
120
+ export { juiceToast };
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * 2026 (C) OpenDN Foundation
3
- * v1.3.0 (STABLE)
3
+ * v1.3.2 (STABLE)
4
4
  * ESM (ECMAScript Module)
5
5
  */
6
- const 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"};let __cssInjected=!1;const BASE_CSS='\n#juice-toast-root {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n}\n\n/* bottom (default) */\n#juice-toast-root[data-position="bottom"] {\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* top */\n#juice-toast-root[data-position="top"] {\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* center */\n#juice-toast-root[data-position="center"] {\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n flex-direction: column;\n align-items: center;\n}\n\n[id^="juice-toast-root-"] {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n}\n\n\n/* ================= TOAST ================= */\n\n.juice-toast {\n /* animation vars (safe for swipe) */\n --jt-x: 0px;\n --jt-y: 12px;\n\n pointer-events: auto;\n display: flex;\n gap: 12px;\n align-items: flex-start;\n\n min-width: 220px;\n max-width: 420px;\n padding: 12px 16px;\n margin: 6px 0;\n\n border-radius: 8px;\n background: #333;\n color: #fff;\n\n font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;\n font-size: 14px;\n\n opacity: 0;\n transform: translate(var(--jt-x), var(--jt-y));\n transition:\n opacity .25s ease,\n transform .25s ease,\n background .25s ease,\n color .25s ease,\n box-shadow .25s ease;\n\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n/* visible */\n.juice-toast.show {\n opacity: 1;\n --jt-y: 0px;\n}\n\n/* ================= ICON ================= */\n\n.juice-toast .icon {\n width: 28px;\n height: 28px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n line-height: 1;\n flex: 0 0 28px;\n}\n\n/* clickable icon */\n.icon-clickable {\n opacity: 0.85;\n cursor: pointer;\n}\n\n.icon-clickable:hover {\n opacity: 1;\n}\n\n/* ================= CONTENT ================= */\n\n.juice-toast .jt-content {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1 1 auto;\n}\n\n/* title */\n.juice-toast .jt-title {\n font-weight: 700;\n font-size: 13px;\n line-height: 1.1;\n}\n\n/* message */\n.juice-toast .jt-message {\n font-size: 13px;\n line-height: 1.3;\n opacity: 0.95;\n}\n\n/* ================= ICON POSITION ================= */\n\n.jt-icon-top {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.jt-icon-top .icon {\n align-self: center;\n margin-bottom: 6px;\n}\n\n/* ================= CLOSE ================= */\n\n.juice-toast-close {\n position: absolute;\n top: 6px;\n right: 8px;\n cursor: pointer;\n font-size: 16px;\n opacity: 0.75;\n padding: 4px;\n border-radius: 4px;\n}\n\n.juice-toast-close:hover {\n opacity: 1;\n background: rgba(255,255,255,0.06);\n}\n\n/* ================= ACTIONS ================= */\n\n.jt-actions {\n display: flex;\n gap: 8px;\n margin-top: 10px;\n}\n\n.jt-action {\n background: transparent;\n border: 1px solid currentColor;\n padding: 4px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 12px;\n}\n\n/* ================= COMPACT ================= */\n\n.jt-compact {\n padding: 8px 10px;\n gap: 8px;\n font-size: 0.9em;\n}\n\n/* ================= GLASS UI ================= */\n\n.jt-glass {\n --g: calc(var(--jt-glass, 60) / 100);\n\n background: rgba(30, 30, 30, calc(0.2 + var(--g)));\n backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n -webkit-backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n}\n\n/* light theme support */\n[data-theme="light"] .jt-glass {\n background:\n linear-gradient(\n rgba(255,255,255, calc(0.6 * var(--g))),\n rgba(255,255,255, calc(0.35 * var(--g)))\n ),\n rgba(255,255,255, calc(0.55 - (0.25 * var(--g))));\n\n color: #111;\n\n border:\n 1px solid rgba(0,0,0, calc(0.05 + 0.12 * var(--g)));\n\n box-shadow:\n 0 10px 30px rgba(0,0,0, calc(0.08 + 0.18 * var(--g))),\n inset 0 1px 0 rgba(255,255,255, calc(0.4 * var(--g)));\n}\n\n/* ================= PROGRESS BAR ================= */\n.jt-progress {\n position: absolute;\n left: 0;\n bottom: 0;\n\n height: 3px;\n width: 100%;\n\n background: rgba(255,255,255,.7);\n transform-origin: left;\n transform: scaleX(1);\n opacity: .85;\n}\n\n/* ================= ANIMATIONS ================= */\n\n@keyframes jt-spin {\n to { transform: rotate(360deg); }\n}\n\n@keyframes jt-pulse {\n 50% { transform: scale(1.15); }\n}\n\n@keyframes jt-shake {\n 25% { transform: translateX(-3px); }\n 50% { transform: translateX(3px); }\n 75% { transform: translateX(-3px); }\n}\n\n@keyframes jt-bounce {\n 0% { transform: scale(1); }\n 30% { transform: scale(1.25); }\n 60% { transform: scale(.95); }\n 100% { transform: scale(1); }\n}\n\n@keyframes jt-wiggle {\n 0% { transform: rotate(0); }\n 25% { transform: rotate(-10deg); }\n 50% { transform: rotate(10deg); }\n 75% { transform: rotate(-6deg); }\n 100% { transform: rotate(0); }\n}\n\n@keyframes jt-pop {\n 0% { transform: scale(.7); opacity: 0; }\n 70% { transform: scale(1.05); opacity: 1; }\n 100% { transform: scale(1); }\n}\n\n/* ================= CLASSES ================= */\n\n.spin { animation: jt-spin .6s linear; }\n.pulse { animation: jt-pulse .4s ease; }\n.shake { animation: jt-shake .4s ease; }\n.bounce { animation: jt-bounce .45s ease; }\n.wiggle { animation: jt-wiggle .5s ease; }\n.pop { animation: jt-pop .35s ease-out; }\n\n/* ================= ICON INTERACTION ================= */\n\n.icon-clickable {\n cursor: pointer;\n transition: transform .15s ease, opacity .15s ease;\n}\n\n.icon-clickable:hover {\n transform: scale(1.1);\n opacity: .85;\n}\n\n/* ================= ACCESSIBILITY ================= */\n\n@media (prefers-reduced-motion: reduce) {\n .spin,\n .pulse,\n .shake,\n .bounce,\n .wiggle,\n .pop {\n animation: none !important;\n }\n}\n';function injectCSS(n){if(!isBrowser||__cssInjected)return;const t=document.createElement("style");t.id="juice-toast-style",t.textContent=n,document.head.appendChild(t),__cssInjected=!0}const 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(n={}){this._config=n,this._defaults={...this._defaults,...n},this._registerTypes()},use(n){"function"==typeof n&&this._plugins.push(n)},addType(n,t={}){this._config[n]=t,this._registerTypes()},defineTheme(n,t={}){themes[n]={...themes[n]||{},...t}},setTheme(n){if(this._theme=n,!isBrowser)return;const t=document.getElementById("juice-toast-root");t&&(t.dataset.theme=n)},clear(){this._queue.length=0},destroy(){this.clear(),isBrowser&&document.getElementById("juice-toast-root")?.remove()},_registerTypes(){Object.keys(this._config).forEach((n=>{if("function"==typeof this[n]&&!this[n].__auto)return;const t=t=>this._enqueue(n,t);t.__auto=!0,this[n]=t}))},_enqueue(n,t){this._queue.push({type:n,payload:t}),this._showing||this._next()},_next(){if(!this._queue.length)return void(this._showing=!1);this._showing=!0;const n=this._queue.shift();this._showToast(n.type,n.payload)},_runPlugins(n){this._plugins.forEach((t=>{try{t(n)}catch(n){this._warn("Plugin error: "+n.message)}}))},_normalizeGlass(n){if(!0===n)return 60;if(!1===n||null==n)return 0;const t=Number(n);return Number.isFinite(t)?Math.max(0,Math.min(100,t)):0},_getRoot(n="bottom-right"){if(!isBrowser)return null;let t=document.getElementById(`juice-toast-root-${n}`);if(!t){switch(t=document.createElement("div"),t.id=`juice-toast-root-${n}`,t.dataset.position=n,t.dataset.theme=this._theme,t.style.position="fixed",t.style.zIndex=9999,n){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(n){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",n)},_playSound(n){if(!isBrowser)return;const t="string"==typeof n&&n?n:this._defaults.playSound;if(t)try{const n=new Audio(t);n.volume=.6,n.play().catch((()=>{}))}catch{}},_showToast(n,t){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);const e={...this._config[n]||{},..."object"==typeof t?t:{message:String(t)}};e.icon=e.icon??e.icon_left_top,e.iconPack=e.iconPack??e.icon_config,e.iconLink=e.iconLink??e.icon_onClick_url,e.iconAnimate=e.iconAnimate??e.icon_onClick_animate,e.position=e.position??e.toast,e.closable=e.closable??e.closeable,e.iconPosition=e.iconPosition||"left",e.compact=!!e.compact;const s=themes[e.theme||this._theme]||{},o=document.createElement("div");o.className="juice-toast";const i=e.animation||"slide-in";if(e.enterAnimation||(o.style.animation=`${i} 0.4s ease forwards`),o.setAttribute("role","alert"),o.setAttribute("aria-live","polite"),o.tabIndex=0,e.size&&sizePreset[e.size]){const n=sizePreset[e.size];n.width&&(o.style.width=n.width),n.padding&&(o.style.padding=n.padding)}let a=null;e.progress&&(e.duration??this._defaults.duration)>0&&(a=document.createElement("div"),a.className="jt-progress",e.progressColor&&(a.style.background=e.progressColor||"rgba(255,255,255,.7)"),o.appendChild(a));const r=this._normalizeGlass(e.glassUI??this._defaults.glassUI);r>0&&(o.classList.add("jt-glass"),o.style.setProperty("--jt-glass",r)),r||(o.style.background=e.bg||s.bg),o.style.color=e.color||s.color,o.style.border=e.border||s.border,e.compact&&o.classList.add("jt-compact"),(e.glassUI??this._defaults.glassUI)&&o.classList.add("jt-glass"),e.width&&(o.style.width=e.width),e.height&&(o.style.height=e.height);let c=null;if(e.icon){c=document.createElement("i"),c.className=["icon",e.iconPack||"",e.icon].join(" ").trim(),e.iconSize&&(c.style.fontSize=e.iconSize),(e.iconLink||e.iconAnimate)&&(c.classList.add("icon-clickable"),c.onclick=n=>{n.stopPropagation(),e.iconAnimate&&(c.classList.remove(e.iconAnimate),c.offsetWidth,c.classList.add(e.iconAnimate)),e.iconLink&&window.open(e.iconLink,"_blank","noopener")});const t=e.iconAnimate??TYPE_ANIMATION[n];t&&(c.classList.add(t),c.addEventListener("click",(()=>{c.classList.remove(t),c.offsetWidth,c.classList.add(t)})))}reduceMotion&&(o.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),c?.classList.remove("bounce","shake","wiggle","pulse","spin")),e.message||e.title||this._warn("Toast created without message or title"),e.icon&&!e.iconPack&&this._warn("icon provided without iconPack"),e.duration<0&&this._warn("duration cannot be negative");let l=0,d=0;o.addEventListener("touchstart",(n=>{l=n.touches[0].clientX})),o.addEventListener("touchmove",(n=>{d=n.touches[0].clientX-l,o.style.transform=`translateX(${d}px)`})),o.addEventListener("touchend",(()=>{Math.abs(d)>this._defaults.swipeThreshold?(o.style.transform=`translateX(${d>0?1e3:-1e3}px)`,setTimeout((()=>{o.remove(),this._next()}),200)):o.style.transform="",l=d=0}));const p=document.createElement("div");p.className="jt-content";const u=e.enterAnimation??"pop";if(u&&!reduceMotion&&o.classList.add(u),e.title){const n=document.createElement("div");n.className="jt-title",n.textContent=e.title,p.appendChild(n)}const m=document.createElement("div");if(m.className="jt-message",m.textContent=e.message||"",p.appendChild(m),c&&"top"===e.iconPosition?(o.classList.add("jt-icon-top"),o.appendChild(c),o.appendChild(p)):c&&"right"===e.iconPosition?(o.appendChild(p),o.appendChild(c)):(c&&o.appendChild(c),o.appendChild(p)),Array.isArray(e.actions)&&e.actions.length){const n=document.createElement("div");n.className="jt-actions",e.actions.forEach((t=>{const e=document.createElement("button");e.className="jt-action",e.textContent=t.label,e.onclick=n=>{n.stopPropagation(),t.onClick?.(n),t.closeOnClick&&(o.remove(),this._next())},n.appendChild(e)})),p.appendChild(n)}if(e.closable){const n=document.createElement("span");n.className="juice-toast-close",n.innerHTML="×",n.onclick=()=>{o.remove(),this._next()},o.appendChild(n)}const h=this._getRoot(e.position),f=this._defaults.maxVisible;f&&h.children.length>=f&&h.firstChild.remove(),h.appendChild(o),this._runPlugins({toast:o,cfg:e,type:n,root:h}),requestAnimationFrame((()=>o.classList.add("show")));const g=e.duration??2500;if(0===g)return;let x,b=Date.now(),y=e.duration??this._defaults.duration;const _=()=>{if(o.__paused)b=Date.now();else{const n=Date.now();y-=n-b,b=n}y<=0?(o.classList.remove("show"),setTimeout((()=>{o.remove(),this._next()}),300)):x=requestAnimationFrame(_),a&&(a.style.transform=`scaleX(${Math.max(0,y/g)})`)};o.addEventListener("mouseenter",(()=>o.__paused=!0)),o.addEventListener("mouseleave",(()=>o.__paused=!1)),o.addEventListener("touchstart",(()=>o.__paused=!0)),o.addEventListener("touchend",(()=>o.__paused=!1)),requestAnimationFrame(_)}};export default juiceToast;export{juiceToast};
6
+ const 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"};let __cssInjected=!1;const BASE_CSS='\n#juice-toast-root {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n}\n\n/* bottom (default) */\n#juice-toast-root[data-position="bottom"] {\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* top */\n#juice-toast-root[data-position="top"] {\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* center */\n#juice-toast-root[data-position="center"] {\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n flex-direction: column;\n align-items: center;\n}\n\n[id^="juice-toast-root-"] {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n}\n\n\n/* ================= TOAST ================= */\n\n.juice-toast {\n /* animation vars (safe for swipe) */\n --jt-x: 0px;\n --jt-y: 12px;\n\n pointer-events: auto;\n display: flex;\n gap: 12px;\n align-items: flex-start;\n\n min-width: 220px;\n max-width: 420px;\n padding: 12px 16px;\n margin: 6px 0;\n\n border-radius: 8px;\n background: #333;\n color: #fff;\n\n font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;\n font-size: 14px;\n\n opacity: 0;\n transform: translate(var(--jt-x), var(--jt-y));\n transition:\n opacity .25s ease,\n transform .25s ease,\n background .25s ease,\n color .25s ease,\n box-shadow .25s ease;\n\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n}\n\n/* visible */\n.juice-toast.show {\n opacity: 1;\n transform: translate(var(--jt-x), 0px) scale(1);\n transition: transform 0.35s ease, opacity 0.35s ease;\n}\n\n/* hide */\n.juice-toast.hide {\n opacity: 0;\n transform: translate(var(--jt-x), 12px) scale(0.95);\n}\n\n\n/* ================= ICON ================= */\n\n.juice-toast .icon {\n width: 28px;\n height: 28px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n line-height: 1;\n flex: 0 0 28px;\n}\n\n/* clickable icon */\n.icon-clickable {\n opacity: 0.85;\n cursor: pointer;\n}\n\n.icon-clickable:hover {\n opacity: 1;\n}\n\n/* ================= CONTENT ================= */\n\n.juice-toast .jt-content {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1 1 auto;\n}\n\n/* title */\n.juice-toast .jt-title {\n font-weight: 700;\n font-size: 13px;\n line-height: 1.1;\n}\n\n/* message */\n.juice-toast .jt-message {\n font-size: 13px;\n line-height: 1.3;\n opacity: 0.95;\n}\n\n/* ================= ICON POSITION ================= */\n\n.jt-icon-top {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.jt-icon-top .icon {\n align-self: center;\n margin-bottom: 6px;\n}\n\n/* ================= CLOSE ================= */\n\n.juice-toast-close {\n position: absolute;\n top: 6px;\n right: 8px;\n cursor: pointer;\n font-size: 16px;\n opacity: 0.75;\n padding: 4px;\n border-radius: 4px;\n}\n\n.juice-toast-close:hover {\n opacity: 1;\n background: rgba(255,255,255,0.06);\n}\n\n/* ================= ACTIONS ================= */\n\n.jt-actions {\n display: flex;\n gap: 8px;\n margin-top: 10px;\n}\n\n.jt-action {\n background: transparent;\n border: 1px solid currentColor;\n padding: 4px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 12px;\n}\n\n/* ================= COMPACT ================= */\n\n.jt-compact {\n padding: 6px 8px;\n font-size: 0.85em;\n gap: 6px;\n max-width: 280px;\n}\n\n/* ================= GLASS UI ================= */\n\n.jt-glass {\n --g: calc(var(--jt-glass, 60) / 100);\n\n background: rgba(30, 30, 30, calc(0.2 + var(--g)));\n backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n -webkit-backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n}\n\n/* light theme support */\n[data-theme="light"] .jt-glass {\n background:\n linear-gradient(\n rgba(255,255,255, calc(0.6 * var(--g))),\n rgba(255,255,255, calc(0.35 * var(--g)))\n ),\n rgba(255,255,255, calc(0.55 - (0.25 * var(--g))));\n\n color: #111;\n\n border:\n 1px solid rgba(0,0,0, calc(0.05 + 0.12 * var(--g)));\n\n box-shadow:\n 0 10px 30px rgba(0,0,0, calc(0.08 + 0.18 * var(--g))),\n inset 0 1px 0 rgba(255,255,255, calc(0.4 * var(--g)));\n}\n\n/* ================= PROGRESS BAR ================= */\n.jt-progress {\n position: absolute;\n left: 0;\n bottom: 0;\n\n height: 3px;\n width: 100%;\n\n background: linear-gradient(to right, #FFFFFF, #FAFAFA);\n height: 4px;\n transform-origin: left;\n transition: transform linear;\n border-radius: 2px;\n transform: scaleX(1);\n opacity: .85;\n}\n\n/* ================= BACKGROUND IMAGE ================= */\n\n.juice-toast.bg-image {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0,0,0,0.6);\n}\n\n/* ================= ANIMATIONS ================= */\n\n@keyframes jt-spin {\n to { transform: rotate(360deg); }\n}\n\n@keyframes jt-pulse {\n 50% { transform: scale(1.15); }\n}\n\n@keyframes jt-shake {\n 25% { transform: translateX(-3px); }\n 50% { transform: translateX(3px); }\n 75% { transform: translateX(-3px); }\n}\n\n@keyframes jt-bounce {\n 0% { transform: scale(1); }\n 30% { transform: scale(1.25); }\n 60% { transform: scale(.95); }\n 100% { transform: scale(1); }\n}\n\n@keyframes jt-wiggle {\n 0% { transform: rotate(0); }\n 25% { transform: rotate(-10deg); }\n 50% { transform: rotate(10deg); }\n 75% { transform: rotate(-6deg); }\n 100% { transform: rotate(0); }\n}\n\n@keyframes jt-pop {\n 0% { transform: scale(.7); opacity: 0; }\n 70% { transform: scale(1.05); opacity: 1; }\n 100% { transform: scale(1); }\n}\n\n/* ================= CLASSES ================= */\n\n.spin { animation: jt-spin .6s linear; }\n.pulse { animation: jt-pulse .4s ease; }\n.shake { animation: jt-shake .4s ease; }\n.bounce { animation: jt-bounce .45s ease; }\n.wiggle { animation: jt-wiggle .5s ease; }\n.pop { animation: jt-pop .35s ease-out; }\n\n/* ================= ICON INTERACTION ================= */\n\n.icon-clickable {\n cursor: pointer;\n transition: transform .15s ease, opacity .15s ease;\n}\n\n.icon-clickable:hover {\n transform: scale(1.1);\n opacity: .85;\n}\n\n/* ================= ACCESSIBILITY ================= */\n\n@media (prefers-reduced-motion: reduce) {\n .spin,\n .pulse,\n .shake,\n .bounce,\n .wiggle,\n .pop {\n animation: none !important;\n }\n}\n';function injectCSS(n){if(!isBrowser||__cssInjected)return;const e=document.createElement("style");e.id="juice-toast-style",e.textContent=n,document.head.appendChild(e),__cssInjected=!0}const 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(n={}){this._config=n,this._defaults={...this._defaults,...n},this._registerTypes()},use(n){"function"==typeof n&&this._plugins.push(n)},addType(n,e={}){this._config[n]=e,this._registerTypes()},defineTheme(n,e={}){themes[n]={...themes[n]||{},...e}},setTheme(n){if(this._theme=n,!isBrowser)return;const e=document.getElementById("juice-toast-root");e&&(e.dataset.theme=n)},clear(){this._queue.length=0},destroy(){this.clear(),isBrowser&&document.getElementById("juice-toast-root")?.remove()},_registerTypes(){Object.keys(this._config).forEach((n=>{if("function"==typeof this[n]&&!this[n].__auto)return;const e=e=>this._enqueue(n,e);e.__auto=!0,this[n]=e}))},_enqueue(n,e){this._queue.push({type:n,payload:e}),this._showing||this._next()},_next(){if(!this._queue.length)return void(this._showing=!1);this._showing=!0;const n=this._queue.shift();this._showToast(n.type,n.payload)},_runPlugins(n){this._plugins.forEach((e=>{try{e(n)}catch(n){this._warn("Plugin error: "+n.message)}}))},_normalizeGlass(n){if(!0===n)return 60;if(!1===n||null==n)return 0;const e=Number(n);return Number.isFinite(e)?Math.max(0,Math.min(100,e)):0},_getRoot(n="bottom-right"){if(!isBrowser)return null;let e=document.getElementById(`juice-toast-root-${n}`);if(!e){switch(e=document.createElement("div"),e.id=`juice-toast-root-${n}`,e.dataset.position=n,e.dataset.theme=this._theme,e.style.position="fixed",e.style.zIndex=9999,n){case"top-left":e.style.top="20px",e.style.left="20px";break;case"top-right":e.style.top="20px",e.style.right="20px";break;case"bottom-left":e.style.bottom="20px",e.style.left="20px";break;case"bottom-right":e.style.bottom="20px",e.style.right="20px";break;case"top-center":e.style.top="20px",e.style.left="50%",e.style.transform="translateX(-50%)";break;case"bottom-center":e.style.bottom="20px",e.style.left="50%",e.style.transform="translateX(-50%)"}document.body.appendChild(e)}return e},_defaults:{duration:2500,maxVisible:3,swipeThreshold:60,glassUI:0,playSound:null,dev:!1,injectCSS:!0,css:null},_warn(n){this._defaults.dev&&"undefined"!=typeof console&&console.warn("[JuiceToast]",n)},_playSound(n){if(!isBrowser)return;const e="string"==typeof n&&n?n:this._defaults.playSound;if(e)try{const n=new Audio(e);n.volume=.6,n.play().catch((()=>{}))}catch{}},_showToast(n,e){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);const t={...this._config[n]||{},..."object"==typeof e?e:{message:String(e)}};t.icon=t.icon??t.icon_left_top,t.iconPack=t.iconPack??t.icon_config,t.iconLink=t.iconLink??t.icon_onClick_url,t.iconAnimate=t.iconAnimate??t.icon_onClick_animate,t.position=t.position??t.toast,t.closable=t.closable??t.closeable,t.iconPosition=t.iconPosition||"left",t.compact=!!t.compact;const s=themes[t.theme||this._theme]||{},o=document.createElement("div");o.className="juice-toast";const i=t.animation||"slide-in";if(t.enterAnimation||(o.style.animation=`${i} 0.4s ease forwards`),o.setAttribute("role","alert"),o.setAttribute("aria-live","error"===n?"assertive":"polite"),o.setAttribute("aria-atomic","true"),o.tabIndex=0,t.closable&&(close.tabIndex=0,close.addEventListener("keydown",(n=>{"Enter"!==n.key&&" "!==n.key||(o.remove(),this._next())}))),t.size&&sizePreset[t.size]){const n=sizePreset[t.size];n.width&&(o.style.width=n.width),n.padding&&(o.style.padding=n.padding)}let a=null;if(t.progress&&(t.duration??this._defaults.duration)>0&&(a=document.createElement("div"),a.className="jt-progress",t.progressColor&&(a.style.background=t.progressColor||"rgba(255,255,255,.7)"),o.appendChild(a)),t.tts&&"speechSynthesis"in window)try{const n=new SpeechSynthesisUtterance(t.message||t.title||"");n.lang=t.ttsLang||"en-US",n.rate=t.ttsRate??1,window.speechSynthesis.speak(n)}catch(n){this._warn("TTS failed: "+n.message)}const r=this._normalizeGlass(t.glassUI??this._defaults.glassUI);r>0&&(o.style.setProperty("--jt-glass",t.glassUI??50),o.classList.add("jt-glass")),r||(o.style.background=t.bg||s.bg),o.style.color=t.color||s.color,o.style.border=t.border||s.border,t.compact&&o.classList.add("jt-compact"),(t.glassUI??this._defaults.glassUI)&&o.classList.add("jt-glass"),t.width&&(o.style.width=t.width),t.height&&(o.style.height=t.height),t.bgImage&&(o.style.backgroundImage=`url(${t.bgImage})`,o.classList.add("bg-image"));let c=null;if(t.icon){c=document.createElement("i"),c.className=["icon",t.iconPack||"",t.icon].join(" ").trim(),t.iconSize&&(c.style.fontSize=t.iconSize),(t.iconLink||t.iconAnimate)&&(c.classList.add("icon-clickable"),c.onclick=n=>{n.stopPropagation(),t.iconAnimate&&(c.classList.remove(t.iconAnimate),c.offsetWidth,c.classList.add(t.iconAnimate)),t.iconLink&&window.open(t.iconLink,"_blank","noopener")});const e=t.iconAnimate??TYPE_ANIMATION[n];e&&(c.classList.add(e),c.addEventListener("click",(()=>{c.classList.remove(e),c.offsetWidth,c.classList.add(e)})))}reduceMotion&&(o.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),c?.classList.remove("bounce","shake","wiggle","pulse","spin")),t.message||t.title||this._warn("Toast created without message or title"),t.icon&&!t.iconPack&&this._warn("icon provided without iconPack"),t.duration<0&&this._warn("duration cannot be negative");let l=0,d=0;o.addEventListener("touchstart",(n=>{l=n.touches[0].clientX})),o.addEventListener("touchmove",(n=>{d=n.touches[0].clientX-l,o.style.transform=`translateX(${d}px)`})),o.addEventListener("touchend",(()=>{Math.abs(d)>this._defaults.swipeThreshold?(o.style.transform=`translateX(${d>0?1e3:-1e3}px)`,setTimeout((()=>{o.remove(),this._next()}),200)):o.style.transform="",l=d=0}));const p=document.createElement("div");p.className="jt-content";const u=t.enterAnimation??"pop";if(u&&!reduceMotion&&o.classList.add(u),t.title){const n=document.createElement("div");n.className="jt-title",n.textContent=t.title,p.appendChild(n)}const m=document.createElement("div");if(m.className="jt-message",m.textContent=t.message||"",p.appendChild(m),c&&"top"===t.iconPosition?(o.classList.add("jt-icon-top"),o.appendChild(c),o.appendChild(p)):c&&"right"===t.iconPosition?(o.appendChild(p),o.appendChild(c)):(c&&o.appendChild(c),o.appendChild(p)),Array.isArray(t.actions)&&t.actions.length){const n=document.createElement("div");n.className="jt-actions",t.actions.forEach((e=>{const t=document.createElement("button");t.className="jt-action",t.textContent=e.label,t.onclick=n=>{n.stopPropagation(),e.onClick?.(n),e.closeOnClick&&(o.remove(),this._next())},n.appendChild(t)})),p.appendChild(n)}if(t.closable){const n=document.createElement("span");n.className="juice-toast-close",n.innerHTML="×",n.onclick=()=>{o.remove(),this._next()},o.appendChild(n)}const f=this._getRoot(t.position),g=this._defaults.maxVisible;g&&f.children.length>=g&&f.firstChild.remove(),f.appendChild(o),this._runPlugins({toast:o,cfg:t,type:n,root:f}),requestAnimationFrame((()=>o.classList.add("show")));const h=t.duration??2500;if(0===h)return;let b,x=Date.now(),y=t.duration??this._defaults.duration;const _=()=>{if(o.__paused)x=Date.now();else{const n=Date.now();y-=n-x,x=n}y<=0?(o.classList.remove("show"),setTimeout((()=>{o.remove(),this._next()}),300)):b=requestAnimationFrame(_),a&&(a.style.transform=`scaleX(${Math.max(0,y/h)})`)};o.addEventListener("mouseenter",(()=>o.__paused=!0)),o.addEventListener("mouseleave",(()=>o.__paused=!1)),o.addEventListener("touchstart",(()=>o.__paused=!0)),o.addEventListener("touchend",(()=>o.__paused=!1)),requestAnimationFrame(_)}};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};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * OpenDN Foundation (C) 2026
3
+ * Source Of Juice Toast v1.3.1 (iOS user)
4
+ * Read CONTRIBUTE.md To Contribute
5
+ */
6
+ const 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,n="en-US",t=1){if(!("speechSynthesis"in window))return;const s=new SpeechSynthesisUtterance(e);s.lang=n,s.rate=t;const o=()=>{window.speechSynthesis.speak(s),document.body.removeEventListener("touchstart",o),document.body.removeEventListener("click",o)};/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream&&!1===window.speechSynthesis.speaking?(document.body.addEventListener("touchstart",o,{once:!0}),document.body.addEventListener("click",o,{once:!0})):o()}const raf=window.requestAnimationFrame||window.webkitRequestAnimationFrame||(e=>setTimeout(e,16)),TYPE_ANIMATION={success:"bounce",error:"shake",warning:"wiggle",info:"pulse",loading:"spin"};let __cssInjected=!1;const BASE_CSS='\n:root {\n --jt-safe-top: env(safe-area-inset-top, 0px);\n --jt-safe-bottom: env(safe-area-inset-bottom, 0px);\n}\n\n#juice-toast-root {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n}\n\n/* bottom (default) */\n#juice-toast-root[data-position="bottom"] {\n bottom: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* top */\n#juice-toast-root[data-position="top"] {\n top: 20px;\n left: 50%;\n transform: translateX(-50%);\n flex-direction: column;\n align-items: center;\n}\n\n/* center */\n#juice-toast-root[data-position="center"] {\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n flex-direction: column;\n align-items: center;\n}\n\n[id^="juice-toast-root-"] {\n position: fixed;\n z-index: 9999;\n display: flex;\n gap: 10px;\n pointer-events: none;\n padding-top: var(--jt-safe-top);\n padding-bottom: var(--jt-safe-bottom);\n}\n\n\n/* ================= TOAST ================= */\n\n.juice-toast {\n --jt-x: 0px;\n --jt-y: 12px;\n\n pointer-events: auto;\n display: flex;\n gap: 12px;\n align-items: flex-start;\n\n min-width: 220px;\n max-width: 420px;\n padding: 12px 16px;\n margin: 6px 0;\n\n border-radius: 8px;\n background: #333;\n color: #fff;\n\n font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial;\n font-size: 14px;\n\n opacity: 0;\n transform: translate(var(--jt-x), var(--jt-y));\n transition:\n opacity .25s ease,\n transform .25s ease,\n background .25s ease,\n color .25s ease,\n box-shadow .25s ease;\n\n position: relative;\n box-sizing: border-box;\n overflow: hidden;\n\n scroll-behavior: contains;\n -webkit-overflow-scrolling: touch;\n\n will-change: transform, opacity;\n backface-visibility: hidden;\n -webkit-backface-visibility: hidden;\n\n touch-action: pan-y;\n\n}\n\n/* visible */\n.juice-toast.show {\n opacity: 1;\n --jt-y: 0px;\n}\n\n/* ================= ICON ================= */\n\n.juice-toast .icon {\n width: 28px;\n height: 28px;\n display: inline-flex;\n align-items: center;\n justify-content: center;\n font-size: 16px;\n line-height: 1;\n flex: 0 0 28px;\n}\n\n/* clickable icon */\n.icon-clickable {\n opacity: 0.85;\n cursor: pointer;\n}\n\n.icon-clickable:hover {\n opacity: 1;\n}\n\n/* ================= CONTENT ================= */\n\n.juice-toast .jt-content {\n display: flex;\n flex-direction: column;\n gap: 4px;\n flex: 1 1 auto;\n}\n\n/* title */\n.juice-toast .jt-title {\n font-weight: 700;\n font-size: 13px;\n line-height: 1.1;\n}\n\n/* message */\n.juice-toast .jt-message {\n font-size: 13px;\n line-height: 1.3;\n opacity: 0.95;\n}\n\n/* ================= ICON POSITION ================= */\n\n.jt-icon-top {\n flex-direction: column;\n align-items: flex-start;\n}\n\n.jt-icon-top .icon {\n align-self: center;\n margin-bottom: 6px;\n}\n\n/* ================= CLOSE ================= */\n\n.juice-toast-close {\n position: absolute;\n top: 6px;\n right: 8px;\n cursor: pointer;\n font-size: 16px;\n opacity: 0.75;\n padding: 4px;\n border-radius: 4px;\n}\n\n.juice-toast-close:hover {\n opacity: 1;\n background: rgba(255,255,255,0.06);\n}\n\n/* ================= ACTIONS ================= */\n\n.jt-actions {\n display: flex;\n gap: 8px;\n margin-top: 10px;\n}\n\n.jt-action {\n background: transparent;\n border: 1px solid currentColor;\n padding: 4px 10px;\n border-radius: 6px;\n cursor: pointer;\n font-size: 12px;\n}\n\n/* ================= COMPACT ================= */\n\n.jt-compact {\n padding: 8px 10px;\n gap: 8px;\n font-size: 0.9em;\n}\n\n/* ================= GLASS UI ================= */\n\n.jt-glass {\n --g: calc(var(--jt-glass, 60) / 100);\n\n background: rgba(30, 30, 30, calc(0.2 + var(--g)));\n backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n -webkit-backdrop-filter: blur(calc(6px + (14px * var(--g))))\n saturate(calc(1 + (0.4 * var(--g))));\n}\n\n/* light theme support */\n[data-theme="light"] .jt-glass {\n background:\n linear-gradient(\n rgba(255,255,255, calc(0.6 * var(--g))),\n rgba(255,255,255, calc(0.35 * var(--g)))\n ),\n rgba(255,255,255, calc(0.55 - (0.25 * var(--g))));\n\n color: #111;\n\n border:\n 1px solid rgba(0,0,0, calc(0.05 + 0.12 * var(--g)));\n\n box-shadow:\n 0 10px 30px rgba(0,0,0, calc(0.08 + 0.18 * var(--g))),\n inset 0 1px 0 rgba(255,255,255, calc(0.4 * var(--g)));\n}\n\n/* ================= PROGRESS BAR ================= */\n.jt-progress {\n position: absolute;\n left: 0;\n bottom: 0;\n\n height: 3px;\n width: 100%;\n\n background: linear-gradient(to right, #FFFFFF, #FAFAFA);\n height: 4px;\n transform-origin: left;\n transition: transform linear;\n border-radius: 2px;\n transform: scaleX(1);\n opacity: .85;\n}\n\n.juice-toast.bg-image {\n background-size: cover;\n background-position: center;\n background-repeat: no-repeat;\n color: #fff;\n text-shadow: 0 1px 2px rgba(0,0,0,0.6);\n}\n\n/* ================= ANIMATIONS ================= */\n\n@keyframes jt-spin {\n to { transform: rotate(360deg); }\n}\n\n@keyframes jt-pulse {\n 50% { transform: scale(1.15); }\n}\n\n@keyframes jt-shake {\n 25% { transform: translateX(-3px); }\n 50% { transform: translateX(3px); }\n 75% { transform: translateX(-3px); }\n}\n\n@keyframes jt-bounce {\n 0% { transform: scale(1); }\n 30% { transform: scale(1.25); }\n 60% { transform: scale(.95); }\n 100% { transform: scale(1); }\n}\n\n@keyframes jt-wiggle {\n 0% { transform: rotate(0); }\n 25% { transform: rotate(-10deg); }\n 50% { transform: rotate(10deg); }\n 75% { transform: rotate(-6deg); }\n 100% { transform: rotate(0); }\n}\n\n@keyframes jt-pop {\n 0% { transform: scale(.7); opacity: 0; }\n 70% { transform: scale(1.05); opacity: 1; }\n 100% { transform: scale(1); }\n}\n\n/* ================= CLASSES ================= */\n\n.spin { animation: jt-spin .6s linear; }\n.pulse { animation: jt-pulse .4s ease; }\n.shake { animation: jt-shake .4s ease; }\n.bounce { animation: jt-bounce .45s ease; }\n.wiggle { animation: jt-wiggle .5s ease; }\n.pop { animation: jt-pop .35s ease-out; }\n\n.icon-clickable {\n cursor: pointer;\n transition: transform .15s ease, opacity .15s ease;\n}\n\n.icon-clickable:hover {\n transform: scale(1.1);\n opacity: .85;\n}\n\n/* ================= ACCESSIBILITY ================= */\n\n@media (prefers-reduced-motion: reduce) {\n .spin,\n .pulse,\n .shake,\n .bounce,\n .wiggle,\n .pop {\n animation: none !important;\n }\n}\n';function injectCSS(e){if(!isBrowser||__cssInjected)return;const n=document.createElement("style");n.id="juice-toast-style",n.textContent=e,document.head.appendChild(n),__cssInjected=!0}const 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={}){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,n={}){this._config[e]=n,this._registerTypes()},defineTheme(e,n={}){themes[e]={...themes[e]||{},...n}},setTheme(e){if(this._theme=e,!isBrowser)return;const n=document.querySelector('[id^="juice-toast-root-"]');n&&(n.dataset.theme=e)},clear(){this._queue.length=0},destroy(){if(this.clear(),!isBrowser)return;document.querySelectorAll('[id^="juice-toast-root-"]').forEach((e=>e.remove()))},_registerTypes(){Object.keys(this._config).forEach((e=>{if("function"==typeof this[e]&&!this[e].__auto)return;const n=n=>this._enqueue(e,n);n.__auto=!0,this[e]=n}))},_enqueue(e,n){this._queue.push({type:e,payload:n}),this._showing||this._next()},_next(){if(!this._queue.length)return void(this._showing=!1);this._showing=!0;const e=this._queue.shift();this._showToast(e.type,e.payload)},_runPlugins(e){this._plugins.forEach((n=>{try{n(e)}catch(e){this._warn("Plugin error: "+(e&&e.message?e.message:String(e)))}}))},_normalizeGlass(e){if(!0===e)return 60;if(!1===e||null==e)return 0;const n=Number(e);return Number.isFinite(n)?Math.max(0,Math.min(100,n)):0},_getRoot(e="bottom-right"){if(!isBrowser)return null;let n=document.getElementById(`juice-toast-root-${e}`);if(!n){switch(n=document.createElement("div"),n.id=`juice-toast-root-${e}`,n.dataset.position=e,n.dataset.theme=this._theme,n.style.position="fixed",n.style.zIndex=9999,n.style.display="flex",n.style.flexDirection="column",n.style.gap="8px",n.style.pointerEvents="none",e){case"top-left":n.style.top="calc(20px + env(safe-area-inset-top))",n.style.left="20px",n.style.alignItems="flex-start";break;case"top-right":n.style.top="calc(20px + env(safe-area-inset-top))",n.style.right="20px",n.style.alignItems="flex-end";break;case"bottom-left":n.style.bottom="calc(20px + env(safe-area-inset-bottom))",n.style.left="20px",n.style.alignItems="flex-start";break;case"bottom-right":n.style.bottom="calc(20px + env(safe-area-inset-bottom))",n.style.right="20px",n.style.alignItems="flex-end";break;case"top-center":n.style.top="calc(20px + env(safe-area-inset-top))",n.style.left="50%",n.style.transform="translateX(-50%)",n.style.alignItems="center";break;case"bottom-center":n.style.bottom="calc(20px + env(safe-area-inset-bottom))",n.style.left="50%",n.style.transform="translateX(-50%)",n.style.alignItems="center";break;default:n.style.bottom="calc(20px + env(safe-area-inset-bottom))",n.style.right="20px"}document.body.appendChild(n)}return n},_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;const n="string"==typeof e&&e?e:this._defaults.playSound;if(n)try{const e=new Audio(n);e.volume=.6;const t=()=>{e.play().catch((()=>{})),window.removeEventListener("touchstart",t),window.removeEventListener("click",t)};e.play().catch((()=>{window.addEventListener("touchstart",t,{once:!0}),window.addEventListener("click",t,{once:!0})}))}catch(e){}},_showToast(e,n){if(!isBrowser)return;!1!==this._defaults.injectCSS&&injectCSS(this._defaults.css||BASE_CSS);const t={...this._config[e]||{},..."object"==typeof n?n:{message:String(n)}};t.icon=t.icon??t.icon_left_top,t.iconPack=t.iconPack??t.icon_config,t.iconLink=t.iconLink??t.icon_onClick_url,t.iconAnimate=t.iconAnimate??t.icon_onClick_animate,t.position=t.position??t.toast,t.closable=t.closable??t.closeable,t.iconPosition=t.iconPosition||"left",t.compact=!!t.compact;const s=themes[t.theme||this._theme]||{},o=document.createElement("div");o.className="juice-toast";const i=t.animation||"slide-in";if(t.enterAnimation||(o.style.animation=`${i} 0.4s ease forwards`),o.setAttribute("role","alert"),o.setAttribute("aria-live","error"===e?"assertive":"polite"),o.setAttribute("aria-atomic","true"),o.tabIndex=0,t.closable&&(close.tabIndex=0,close.addEventListener("keydown",(e=>{"Enter"!==e.key&&" "!==e.key||(o.remove(),this._next())}))),t.size&&sizePreset[t.size]){const e=sizePreset[t.size];e.width&&(o.style.width=e.width),e.padding&&(o.style.padding=e.padding)}let a=null;const r=t.duration??this._defaults.duration;t.progress&&r>0&&(a=document.createElement("div"),a.className="jt-progress",t.progressColor&&(a.style.background=t.progressColor||"rgba(255,255,255,.7)"),o.appendChild(a)),t.tts&&t.message&&speakTTS(t.message,t.ttsLang??"en-US",t.ttsRate??1);const c=this._normalizeGlass(t.glassUI??this._defaults.glassUI);c>0&&(o.style.setProperty("--jt-glass",t.glassUI??50),o.classList.add("jt-glass")),c||(o.style.background=t.bg||s.bg),o.style.color=t.color||s.color,o.style.border=t.border||s.border,t.compact&&o.classList.add("jt-compact"),(t.glassUI??this._defaults.glassUI)&&o.classList.add("jt-glass"),t.width&&(o.style.width=t.width),t.height&&(o.style.height=t.height),t.bgImage&&(o.style.backgroundImage=`url(${t.bgImage})`,o.classList.add("bg-image"));let l=null;if(t.icon){l=document.createElement("i"),l.className=["icon",t.iconPack||"",t.icon].join(" ").trim(),t.iconSize&&(l.style.fontSize=t.iconSize),(t.iconLink||t.iconAnimate)&&(l.classList.add("icon-clickable"),l.onclick=e=>{e.stopPropagation(),t.iconAnimate&&(l.classList.remove(t.iconAnimate),l.offsetWidth,l.classList.add(t.iconAnimate)),t.iconLink&&window.open(t.iconLink,"_blank","noopener")});const n=t.iconAnimate??TYPE_ANIMATION[e];n&&(l.classList.add(n),l.addEventListener("click",(()=>{l.classList.remove(n),l.offsetWidth,l.classList.add(n)})))}reduceMotion&&(o.classList.remove("pop","bounce","shake","wiggle","pulse","spin"),l?.classList.remove("bounce","shake","wiggle","pulse","spin")),t.message||t.title||this._warn("Toast created without message or title"),t.icon&&!t.iconPack&&this._warn("icon provided without iconPack"),t.duration<0&&this._warn("duration cannot be negative");let d=0,p=0,u=!1;const m=e=>{const n=e.touches?e.touches[0]:e;d=n.clientX,p=0,u=!0,o.__paused=!0},f=e=>{if(!u)return;const n=e.touches?e.touches[0]:e;p=n.clientX-d,o.style.transform=`translate3d(${p}px, 0, 0)`},h=()=>{u&&(u=!1,Math.abs(p)>(this._defaults.swipeThreshold||60)?(o.style.transition="transform .25s ease, opacity .2s ease",o.style.transform=`translate3d(${p>0?1e3:-1e3}px, 0, 0)`,setTimeout((()=>{o.replaceWith(),o.onclick=null,o.onmousedown=null,o.remove(),this._next()}),220)):(o.style.transition="transform .2s ease",o.style.transform=""),setTimeout((()=>{o.__paused=!1}),60),d=p=0)};isTouch?(o.addEventListener("touchstart",m,{passive:!0}),o.addEventListener("touchmove",f,{passive:!0}),o.addEventListener("touchend",h),o.addEventListener("touchcancel",h)):o.addEventListener("mousedown",(e=>{d=e.clientX,p=0,u=!0,o.__paused=!0;const n=e=>{p=e.clientX-d,o.style.transform=`translate3d(${p}px, 0, 0)`},t=()=>{document.removeEventListener("mousemove",n),document.removeEventListener("mouseup",t),h()};document.addEventListener("mousemove",n),document.addEventListener("mouseup",t)}));const g=document.createElement("div");g.className="jt-content";const b=t.enterAnimation??"pop";if(b&&!reduceMotion&&o.classList.add(b),t.title){const e=document.createElement("div");e.className="jt-title",e.textContent=t.title,g.appendChild(e)}const x=document.createElement("div");if(x.className="jt-message",x.textContent=t.message||"",g.appendChild(x),l&&"top"===t.iconPosition?(o.classList.add("jt-icon-top"),o.appendChild(l),o.appendChild(g)):l&&"right"===t.iconPosition?(o.appendChild(g),o.appendChild(l)):(l&&o.appendChild(l),o.appendChild(g)),Array.isArray(t.actions)&&t.actions.length){const e=document.createElement("div");e.className="jt-actions",t.actions.forEach((n=>{const t=document.createElement("button");t.className="jt-action",t.textContent=n.label,t.onclick=e=>{e.stopPropagation(),n.onClick?.(e),n.closeOnClick&&(o.replaceWith(),o.onclick=null,o.onmousedown=null,o.remove(),this._next())},e.appendChild(t)})),g.appendChild(e)}if(t.closable){const e=document.createElement("span");e.className="juice-toast-close",e.innerHTML="×",e.onclick=()=>{o.replaceWith(),o.onclick=null,o.onmousedown=null,o.remove(),this._next()},o.appendChild(e)}isIOSStandalone&&(o.style.borderRadius=o.style.borderRadius||"14px");const y=this._getRoot(t.position),w=this._defaults.maxVisible;if(w&&y.children.length>=w&&y.firstChild.remove(),y.appendChild(o),this._runPlugins({toast:o,cfg:t,type:e,root:y}),requestAnimationFrame((()=>{o.classList.add("show")})),0===r)return;let v=Date.now(),_=r;const k=()=>{if(o.__paused)v=Date.now();else{const e=Date.now();_-=e-v,v=e}if(_<=0?(o.classList.remove("show"),setTimeout((()=>{o.replaceWith(),o.onclick=null,o.onmousedown=null,o.remove(),this._next()}),300)):raf(k),a){const e=Math.max(0,Math.min(1,_/r));a.style.transform=`scaleX(${e})`}};isTouch||(o.addEventListener("mouseenter",(()=>o.__paused=!0)),o.addEventListener("mouseleave",(()=>o.__paused=!1))),o.addEventListener("touchstart",(()=>{o.__paused=!0}),{passive:!0}),o.addEventListener("touchend",(()=>{o.__paused=!1})),v=Date.now(),raf(k),(t.playSound||this._defaults.playSound)&&this._playSound(t.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.0",
3
+ "version": "1.3.2",
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": ">=15"
26
+ "node": ">=18"
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,6 +34,10 @@
31
34
  ".": {
32
35
  "import": "./dist/juice-toast.esm.js",
33
36
  "types": "./dist/juice-toast.d.ts"
37
+ },
38
+ "./ios": {
39
+ "import": "./dist/juice-toast.ios.js",
40
+ "types": "./dist/juice-toast-ios.d.ts"
34
41
  }
35
42
  },
36
43
  "files": [
@@ -50,5 +57,8 @@
50
57
  "access": "public"
51
58
  },
52
59
  "unpkg": "dist/juice-toast.esm.js",
53
- "jsdelivr": "dist/juice-toast.esm.js"
60
+ "jsdelivr": "dist/juice-toast.esm.js",
61
+ "devDependencies": {
62
+ "prettier": "^3.8.1"
63
+ }
54
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.
package/NEW_FUNCTION.md DELETED
@@ -1,41 +0,0 @@
1
- # Juice Toast Release Candidate 2026 for v1.2.0/v1.2.1
2
-
3
- ```js
4
- animation: "slide-in" | "fade-in" | "bounce-in";
5
- glassUI: true | false | number
6
- playSound: "soundName.mp3" // You can play `.wav`, `.aiff/.aif`, `.ogg`, `.wma`, `.opus`, etc.
7
- swipeThreshold: number; // default 60
8
- pauseOnHover: true; // implicit via mouseenter
9
- ```
10
-
11
- # Juice Toast Release v1.3.0
12
- ```js
13
- animation: "slide-in" | "fade-in" | "bounce-in"; // legacy / css animation
14
- enterAnimation: "pop" | "bounce" | "shake" | "wiggle" | "pulse" | "spin"; // class-based
15
- progress: true;
16
- progressColor: "rgba(255,255,255,.7)";
17
- juiceToast.use(ctx => {
18
- // ctx.toast
19
- // ctx.cfg
20
- // ctx.type
21
- // ctx.root
22
- });
23
-
24
- // Global Setup
25
- juiceToast.setup({
26
- duration: 2500,
27
- maxVisible: 3,
28
- playSound: "ding.mp3",
29
- glassUI: 40,
30
- injectCSS: true,
31
- css: "custom css",
32
- dev: true
33
- });
34
-
35
- ```
36
-
37
- ```A11Y
38
- role="alert"
39
- aria-live="polite"
40
- prefers-reduced-motion supported
41
- ```