robot-toast 1.0.0-beta.0 → 1.0.0
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/README.md +98 -15
- package/package.json +5 -10
package/README.md
CHANGED
|
@@ -2,10 +2,35 @@
|
|
|
2
2
|
|
|
3
3
|
A lightweight, zero-dependency, framework-agnostic toast notification library featuring an animated robot companion. Fully draggable, typewriter-style messages, multiple themes, rich transitions, and a cast of **16 built-in robots** — or bring your own.
|
|
4
4
|
|
|
5
|
+
<p align="left">
|
|
6
|
+
<a href="https://stackblitz.com/your-demo-link"
|
|
7
|
+
style="color:#e53935; font-weight:600; text-decoration:none;">
|
|
8
|
+
Demo
|
|
9
|
+
</a>
|
|
10
|
+
</p>
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="https://pratham-potfolio.vercel.app/" target="_blank">
|
|
13
|
+
<img src="https://img.shields.io/badge/Portfolio-000?style=for-the-badge&logo=vercel&logoColor=white" />
|
|
14
|
+
</a>
|
|
15
|
+
<a href="https://www.linkedin.com/in/pratham-kumar-a6b672275/" target="_blank">
|
|
16
|
+
<img src="https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white" />
|
|
17
|
+
</a>
|
|
18
|
+
<a href="https://github.com/Pratham2703005" target="_blank">
|
|
19
|
+
<img src="https://img.shields.io/badge/GitHub-000?style=for-the-badge&logo=github&logoColor=white" />
|
|
20
|
+
</a>
|
|
21
|
+
</p>
|
|
22
|
+
<p align="center">
|
|
23
|
+
<a href="https://www.npmjs.com/package/robot-toast">
|
|
24
|
+
<img src="https://img.shields.io/npm/v/robot-toast?style=flat-square" />
|
|
25
|
+
</a>
|
|
26
|
+
<img src="https://img.shields.io/npm/dt/robot-toast?style=flat-square" />
|
|
27
|
+
<img src="https://img.shields.io/bundlephobia/minzip/robot-toast?style=flat-square" />
|
|
28
|
+
</p>
|
|
29
|
+
|
|
5
30
|
<p align="center">
|
|
6
|
-
<img src="public/lightmode.png" alt="Light mode" width="320" />
|
|
7
|
-
<img src="public/darkmode.png" alt="Dark mode" width="320" />
|
|
8
|
-
<img src="public/custom.png" alt="Custom styled" width="320" />
|
|
31
|
+
<img src="https://raw.githubusercontent.com/Pratham2703005/robot-toast/refs/heads/main/public/offiicial-page/lightmode.png" alt="Light mode" width="320" />
|
|
32
|
+
<img src="https://raw.githubusercontent.com/Pratham2703005/robot-toast/refs/heads/main/public/offiicial-page/darkmode.png" alt="Dark mode" width="320" />
|
|
33
|
+
<img src="https://raw.githubusercontent.com/Pratham2703005/robot-toast/refs/heads/main/public/offiicial-page/custom.png" alt="Custom styled" width="320" />
|
|
9
34
|
</p>
|
|
10
35
|
|
|
11
36
|
---
|
|
@@ -58,15 +83,6 @@ toast({
|
|
|
58
83
|
});
|
|
59
84
|
```
|
|
60
85
|
|
|
61
|
-
## Type Shorthands
|
|
62
|
-
|
|
63
|
-
```ts
|
|
64
|
-
toast.success('Saved!');
|
|
65
|
-
toast.error('Something went wrong');
|
|
66
|
-
toast.info('Did you know…');
|
|
67
|
-
toast.warning('Check your input');
|
|
68
|
-
```
|
|
69
|
-
|
|
70
86
|
## Close Programmatically
|
|
71
87
|
|
|
72
88
|
```ts
|
|
@@ -79,7 +95,76 @@ toast.closeAll();
|
|
|
79
95
|
```
|
|
80
96
|
|
|
81
97
|
---
|
|
98
|
+
## All Options at a Glance
|
|
99
|
+
|
|
100
|
+
A single `toast()` call using **every available option** so you can see the full API in one place:
|
|
101
|
+
|
|
102
|
+
```ts
|
|
103
|
+
import { toast } from 'robot-toast';
|
|
104
|
+
|
|
105
|
+
toast({
|
|
106
|
+
// ─── Content ───────────────────────────────────────────
|
|
107
|
+
message: 'This is the full kitchen-sink example!',
|
|
108
|
+
|
|
109
|
+
// ─── Appearance ────────────────────────────────────────
|
|
110
|
+
type: 'success', // 'default' | 'info' | 'success' | 'warning' | 'error'
|
|
111
|
+
theme: 'dark', // 'light' | 'dark' | 'colored'
|
|
112
|
+
transition: 'bounce', // 'bounce' | 'flip' | 'zoom' | 'slide'
|
|
113
|
+
position: 'bottom-right', // 'top-left' | 'top-center' | 'top-right'
|
|
114
|
+
// 'bottom-left' | 'bottom-center' | 'bottom-right'
|
|
115
|
+
|
|
116
|
+
// ─── Robot ─────────────────────────────────────────────
|
|
117
|
+
robotVariant: 'wave', // built-in: 'wave' | 'base' | 'base2' | 'success' | 'error'
|
|
118
|
+
// 'angry' | 'angry2' | 'shock' | 'think' | 'search'
|
|
119
|
+
// 'loading' | 'sleep' | 'head-palm' | 'type'
|
|
120
|
+
// 'validation' | 'validation2'
|
|
121
|
+
// custom: '/path/to/image.png' (svg, png, jpg, jpeg, gif, webp)
|
|
122
|
+
// hide: 'none'
|
|
123
|
+
nearScreen: true, // true = robot near screen edge, false = robot on inner side
|
|
124
|
+
|
|
125
|
+
// ─── Timing ────────────────────────────────────────────
|
|
126
|
+
autoClose: 5000, // milliseconds, or false to disable auto-close
|
|
127
|
+
typeSpeed: 30, // ms per character (0 = instant, no typing effect)
|
|
128
|
+
|
|
129
|
+
// ─── Behaviour ─────────────────────────────────────────
|
|
130
|
+
hideProgressBar: false, // true to hide the countdown bar
|
|
131
|
+
draggable: true, // allow drag & drop with edge-snapping
|
|
132
|
+
pauseOnHover: true, // pause countdown on mouse hover
|
|
133
|
+
pauseOnFocusLoss: true, // pause countdown when tab loses focus
|
|
134
|
+
rtl: false, // right-to-left layout
|
|
135
|
+
|
|
136
|
+
// ─── Multi-toast ───────────────────────────────────────
|
|
137
|
+
limit: 0, // max visible toasts (0 = unlimited, excess is queued)
|
|
138
|
+
newestOnTop: false, // stack new toasts above older ones
|
|
139
|
+
|
|
140
|
+
// ─── Custom Inline Styles ─────────────────────────────
|
|
141
|
+
style: {
|
|
142
|
+
background: 'linear-gradient(135deg, #667eea, #764ba2)',
|
|
143
|
+
color: '#fff',
|
|
144
|
+
borderRadius: '16px',
|
|
145
|
+
fontFamily: 'monospace',
|
|
146
|
+
},
|
|
147
|
+
|
|
148
|
+
// ─── Callbacks ─────────────────────────────────────────
|
|
149
|
+
onOpen: () => console.log('Toast appeared!'),
|
|
150
|
+
onClose: () => console.log('Toast dismissed!'),
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Type Shorthands
|
|
82
155
|
|
|
156
|
+
```ts
|
|
157
|
+
// These set the `type` automatically — you can also pass a full options object
|
|
158
|
+
toast.success('Saved!');
|
|
159
|
+
toast.error('Something went wrong');
|
|
160
|
+
toast.info('Did you know…');
|
|
161
|
+
toast.warning('Check your input');
|
|
162
|
+
|
|
163
|
+
// With additional options
|
|
164
|
+
toast.success({ message: 'Deployed!', theme: 'colored', position: 'top-center', robotVariant: 'success' });
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
---
|
|
83
168
|
## Options
|
|
84
169
|
|
|
85
170
|
| Option | Type | Default | Description |
|
|
@@ -179,11 +264,9 @@ toast({ message: 'Slide!', transition: 'slide' });
|
|
|
179
264
|
```tsx
|
|
180
265
|
'use client';
|
|
181
266
|
import { toast } from 'robot-toast';
|
|
182
|
-
import { useEffect
|
|
267
|
+
import { useEffect } from 'react';
|
|
183
268
|
|
|
184
269
|
export default function App() {
|
|
185
|
-
const shown = useRef(false);
|
|
186
|
-
|
|
187
270
|
useEffect(() => {
|
|
188
271
|
toast({
|
|
189
272
|
message: 'Welcome!',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "robot-toast",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A lightweight, framework-agnostic toast notification library with an animated robot character. Draggable, typed messages, customizable positions, and SVG robot variants.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -15,10 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"*.css",
|
|
18
|
-
"
|
|
19
|
-
"dist/**/*.mjs",
|
|
20
|
-
"./src/styles-injector.ts",
|
|
21
|
-
"./dist/styles-injector.js"
|
|
18
|
+
"./src/styles-injector.ts"
|
|
22
19
|
],
|
|
23
20
|
"files": [
|
|
24
21
|
"dist"
|
|
@@ -43,9 +40,7 @@
|
|
|
43
40
|
"author": "",
|
|
44
41
|
"license": "MIT",
|
|
45
42
|
"devDependencies": {
|
|
46
|
-
"@types/fs-extra": "^11.0.4",
|
|
47
43
|
"@types/node": "^25.3.0",
|
|
48
|
-
"fs-extra": "^11.3.3",
|
|
49
44
|
"rimraf": "^6.1.3",
|
|
50
45
|
"tsup": "^8.0.0",
|
|
51
46
|
"typescript": "^5.0.0"
|
|
@@ -58,10 +53,10 @@
|
|
|
58
53
|
},
|
|
59
54
|
"repository": {
|
|
60
55
|
"type": "git",
|
|
61
|
-
"url": ""
|
|
56
|
+
"url": "https://github.com/Pratham2703005/robot-toast-package"
|
|
62
57
|
},
|
|
63
58
|
"bugs": {
|
|
64
|
-
"url": ""
|
|
59
|
+
"url": "https://github.com/Pratham2703005/robot-toast-package/issues"
|
|
65
60
|
},
|
|
66
|
-
"homepage": ""
|
|
61
|
+
"homepage": "https://robot-toast.vercel.app/"
|
|
67
62
|
}
|