rojeru-toast 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/LICENCE +21 -0
- package/README.md +318 -0
- package/dist/rojeru-toast.css +460 -0
- package/dist/rojeru-toast.esm.js +1 -0
- package/dist/rojeru-toast.js +1 -0
- package/dist/rojeru-toast.min.css +1 -0
- package/dist/rojeru-toast.min.js +1 -0
- package/package.json +55 -0
- package/src/index.js +569 -0
- package/src/styles.css +457 -0
package/src/styles.css
ADDED
|
@@ -0,0 +1,457 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Autor: Rogelio Urieta Camacho
|
|
3
|
+
* Alias: RojeruSan
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* rojeru-toast.css - Estilos modernos para la librería de mensajes toast
|
|
7
|
+
* @version 2.6.0
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* MIT License
|
|
11
|
+
*
|
|
12
|
+
* Copyright (c) 2025 Rogelio Urieta Camacho (RojeruSan)
|
|
13
|
+
*
|
|
14
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
15
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
16
|
+
* in the Software without restriction, including without limitation the rights
|
|
17
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
18
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
19
|
+
* furnished to do so, subject to the following conditions:
|
|
20
|
+
*
|
|
21
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
22
|
+
* copies or substantial portions of the Software.
|
|
23
|
+
*
|
|
24
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
25
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
26
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
27
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
28
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
29
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
30
|
+
* SOFTWARE.
|
|
31
|
+
*/
|
|
32
|
+
.rojeru-toast-container {
|
|
33
|
+
position: fixed;
|
|
34
|
+
z-index: 10000;
|
|
35
|
+
pointer-events: none;
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: 12px;
|
|
39
|
+
max-width: 420px;
|
|
40
|
+
padding: 20px;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.rojeru-toast-container.top-right {
|
|
44
|
+
top: 0;
|
|
45
|
+
right: 0;
|
|
46
|
+
align-items: flex-end;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.rojeru-toast-container.top-left {
|
|
50
|
+
top: 0;
|
|
51
|
+
left: 0;
|
|
52
|
+
align-items: flex-start;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.rojeru-toast-container.top-center {
|
|
56
|
+
top: 0;
|
|
57
|
+
left: 50%;
|
|
58
|
+
transform: translateX(-50%);
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
.rojeru-toast-container.bottom-right {
|
|
63
|
+
bottom: 0;
|
|
64
|
+
right: 0;
|
|
65
|
+
align-items: flex-end;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.rojeru-toast-container.bottom-left {
|
|
69
|
+
bottom: 0;
|
|
70
|
+
left: 0;
|
|
71
|
+
align-items: flex-start;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.rojeru-toast-container.bottom-center {
|
|
75
|
+
bottom: 0;
|
|
76
|
+
left: 50%;
|
|
77
|
+
transform: translateX(-50%);
|
|
78
|
+
align-items: center;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.rojeru-toast {
|
|
82
|
+
pointer-events: all;
|
|
83
|
+
padding: 16px 20px;
|
|
84
|
+
border-radius: 12px;
|
|
85
|
+
backdrop-filter: blur(10px);
|
|
86
|
+
-webkit-backdrop-filter: blur(10px);
|
|
87
|
+
font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
88
|
+
font-size: 14px;
|
|
89
|
+
font-weight: 500;
|
|
90
|
+
line-height: 1.5;
|
|
91
|
+
max-width: 380px;
|
|
92
|
+
display: flex;
|
|
93
|
+
align-items: flex-start;
|
|
94
|
+
gap: 12px;
|
|
95
|
+
transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
|
|
96
|
+
position: relative;
|
|
97
|
+
overflow: hidden;
|
|
98
|
+
border: 1px solid;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.rojeru-toast.rojeru-toast-clickable {
|
|
102
|
+
cursor: pointer;
|
|
103
|
+
transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
.rojeru-toast.rojeru-toast-clickable:hover {
|
|
107
|
+
transform: translateY(-2px);
|
|
108
|
+
box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.rojeru-toast.rojeru-toast-clickable:active {
|
|
112
|
+
transform: translateY(0);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.rojeru-toast::before {
|
|
116
|
+
content: '';
|
|
117
|
+
position: absolute;
|
|
118
|
+
top: 0;
|
|
119
|
+
left: 0;
|
|
120
|
+
right: 0;
|
|
121
|
+
height: 1px;
|
|
122
|
+
background: linear-gradient(90deg, transparent, currentColor, transparent);
|
|
123
|
+
opacity: 0.3;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.rojeru-toast.hiding {
|
|
127
|
+
transform: scale(0.9) translateX(100px);
|
|
128
|
+
opacity: 0;
|
|
129
|
+
pointer-events: none;
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
/* Light Theme */
|
|
133
|
+
.rojeru-toast.light {
|
|
134
|
+
background: rgba(255, 255, 255, 0.95);
|
|
135
|
+
color: #1a1a1a;
|
|
136
|
+
border-color: rgba(0, 0, 0, 0.1);
|
|
137
|
+
box-shadow:
|
|
138
|
+
0 8px 32px rgba(0, 0, 0, 0.1),
|
|
139
|
+
0 2px 8px rgba(0, 0, 0, 0.05),
|
|
140
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.8);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
.rojeru-toast.light.info { color: #0066CC; }
|
|
144
|
+
.rojeru-toast.light.success { color: #00A86B; }
|
|
145
|
+
.rojeru-toast.light.warning { color: #FF6B00; }
|
|
146
|
+
.rojeru-toast.light.error { color: #FF3B30; }
|
|
147
|
+
.rojeru-toast.light.loading { color: #666666; }
|
|
148
|
+
|
|
149
|
+
/* Dark Theme */
|
|
150
|
+
.rojeru-toast.dark {
|
|
151
|
+
background: rgba(28, 28, 30, 0.95);
|
|
152
|
+
color: #ffffff;
|
|
153
|
+
border-color: rgba(255, 255, 255, 0.1);
|
|
154
|
+
box-shadow:
|
|
155
|
+
0 8px 32px rgba(0, 0, 0, 0.3),
|
|
156
|
+
0 2px 8px rgba(0, 0, 0, 0.2),
|
|
157
|
+
inset 0 1px 0 rgba(255, 255, 255, 0.1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
.rojeru-toast.dark.info { color: #5AC8FA; }
|
|
161
|
+
.rojeru-toast.dark.success { color: #30D158; }
|
|
162
|
+
.rojeru-toast.dark.warning { color: #FF9F0A; }
|
|
163
|
+
.rojeru-toast.dark.error { color: #FF453A; }
|
|
164
|
+
.rojeru-toast.dark.loading { color: #8E8E93; }
|
|
165
|
+
|
|
166
|
+
/* Colored Theme - Mejorado para mejor contraste */
|
|
167
|
+
.rojeru-toast.colored {
|
|
168
|
+
color: white;
|
|
169
|
+
border: none;
|
|
170
|
+
box-shadow:
|
|
171
|
+
0 8px 32px rgba(0, 0, 0, 0.25),
|
|
172
|
+
0 4px 16px rgba(0, 0, 0, 0.15);
|
|
173
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.rojeru-toast.colored.info {
|
|
177
|
+
background: linear-gradient(135deg, #0055AA, #0077CC);
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
.rojeru-toast.colored.success {
|
|
181
|
+
background: linear-gradient(135deg, #008755, #00AA66);
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
.rojeru-toast.colored.warning {
|
|
185
|
+
background: linear-gradient(135deg, #CC5500, #EE7700);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
.rojeru-toast.colored.error {
|
|
189
|
+
background: linear-gradient(135deg, #CC2200, #EE4422);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.rojeru-toast.light.loading.info { color: #0066CC; }
|
|
193
|
+
.rojeru-toast.light.loading.success { color: #00A86B; }
|
|
194
|
+
.rojeru-toast.light.loading.warning { color: #FF6B00; }
|
|
195
|
+
.rojeru-toast.light.loading.error { color: #FF3B30; }
|
|
196
|
+
|
|
197
|
+
/* Dark Theme - Loading con tipos específicos */
|
|
198
|
+
.rojeru-toast.dark.loading.info { color: #5AC8FA; }
|
|
199
|
+
.rojeru-toast.dark.loading.success { color: #30D158; }
|
|
200
|
+
.rojeru-toast.dark.loading.warning { color: #FF9F0A; }
|
|
201
|
+
.rojeru-toast.dark.loading.error { color: #FF453A; }
|
|
202
|
+
|
|
203
|
+
/* Colored Theme - Loading con tipos específicos */
|
|
204
|
+
.rojeru-toast.colored.loading.info {
|
|
205
|
+
background: linear-gradient(135deg, #0055AA, #0077CC);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.rojeru-toast.colored.loading.success {
|
|
209
|
+
background: linear-gradient(135deg, #008755, #00AA66);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
.rojeru-toast.colored.loading.warning {
|
|
213
|
+
background: linear-gradient(135deg, #CC5500, #EE7700);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
.rojeru-toast.colored.loading.error {
|
|
217
|
+
background: linear-gradient(135deg, #CC2200, #EE4422);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
.rojeru-toast.colored::before {
|
|
221
|
+
background: linear-gradient(90deg, transparent, rgba(255,255,255,0.4), transparent);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
.rojeru-toast.colored .rojeru-toast-close {
|
|
225
|
+
background: rgba(255, 255, 255, 0.25);
|
|
226
|
+
color: white;
|
|
227
|
+
text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.rojeru-toast.colored .rojeru-toast-close:hover {
|
|
231
|
+
background: rgba(255, 255, 255, 0.35);
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
.rojeru-toast.colored .rojeru-toast-progress {
|
|
235
|
+
background: rgba(255, 255, 255, 0.6);
|
|
236
|
+
box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
/* Icono de loading animado */
|
|
240
|
+
.rojeru-toast-loading-icon {
|
|
241
|
+
animation: rojeru-toast-spin 1s linear infinite;
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
@keyframes rojeru-toast-spin {
|
|
245
|
+
0% {
|
|
246
|
+
transform: rotate(0deg);
|
|
247
|
+
}
|
|
248
|
+
100% {
|
|
249
|
+
transform: rotate(360deg);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.rojeru-toast-icon {
|
|
254
|
+
width: 20px;
|
|
255
|
+
height: 20px;
|
|
256
|
+
flex-shrink: 0;
|
|
257
|
+
margin-top: 1px;
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
.rojeru-toast-icon svg {
|
|
261
|
+
width: 100%;
|
|
262
|
+
height: 100%;
|
|
263
|
+
display: block;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
.rojeru-toast-content {
|
|
267
|
+
flex: 1;
|
|
268
|
+
padding-right: 8px;
|
|
269
|
+
display: flex;
|
|
270
|
+
flex-direction: column;
|
|
271
|
+
gap: 2px;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
.rojeru-toast-title {
|
|
275
|
+
font-weight: 600;
|
|
276
|
+
font-size: 15px;
|
|
277
|
+
display: block;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
.rojeru-toast-message {
|
|
281
|
+
opacity: 0.95;
|
|
282
|
+
font-weight: 400;
|
|
283
|
+
line-height: 1.4;
|
|
284
|
+
}
|
|
285
|
+
|
|
286
|
+
/* Mejor contraste para tema colored */
|
|
287
|
+
.rojeru-toast.colored .rojeru-toast-title {
|
|
288
|
+
opacity: 0.95;
|
|
289
|
+
font-weight: 700;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
.rojeru-toast.colored .rojeru-toast-message {
|
|
293
|
+
opacity: 0.9;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* Estilos para toast simples (sin título) */
|
|
297
|
+
.rojeru-toast:not(:has(.rojeru-toast-title)) .rojeru-toast-content {
|
|
298
|
+
gap: 0;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.rojeru-toast:not(:has(.rojeru-toast-title)) .rojeru-toast-message {
|
|
302
|
+
margin-top: 1px;
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
.rojeru-toast-close {
|
|
306
|
+
background: rgba(0, 0, 0, 0.1);
|
|
307
|
+
border: none;
|
|
308
|
+
width: 24px;
|
|
309
|
+
height: 24px;
|
|
310
|
+
border-radius: 6px;
|
|
311
|
+
cursor: pointer;
|
|
312
|
+
opacity: 0.7;
|
|
313
|
+
display: flex;
|
|
314
|
+
align-items: center;
|
|
315
|
+
justify-content: center;
|
|
316
|
+
transition: all 0.2s ease;
|
|
317
|
+
flex-shrink: 0;
|
|
318
|
+
margin-top: -2px;
|
|
319
|
+
font-size: 16px;
|
|
320
|
+
font-weight: bold;
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
.rojeru-toast-close:hover {
|
|
324
|
+
opacity: 1;
|
|
325
|
+
background: rgba(0, 0, 0, 0.15);
|
|
326
|
+
transform: scale(1.1);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
.rojeru-toast.dark .rojeru-toast-close {
|
|
330
|
+
background: rgba(255, 255, 255, 0.15);
|
|
331
|
+
color: #ffffff;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.rojeru-toast.dark .rojeru-toast-close:hover {
|
|
335
|
+
background: rgba(255, 255, 255, 0.25);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.rojeru-toast-progress {
|
|
339
|
+
position: absolute;
|
|
340
|
+
bottom: 0;
|
|
341
|
+
left: 0;
|
|
342
|
+
height: 3px;
|
|
343
|
+
background: currentColor;
|
|
344
|
+
opacity: 0.3;
|
|
345
|
+
width: 100%;
|
|
346
|
+
transform-origin: left;
|
|
347
|
+
transform: scaleX(1);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
/* Animations */
|
|
351
|
+
.rojeru-toast.slide {
|
|
352
|
+
animation: rojeru-toast-slide-in 0.5s cubic-bezier(0.16, 1, 0.3, 1);
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
.rojeru-toast.fade {
|
|
356
|
+
animation: rojeru-toast-fade-in 0.4s ease-out;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
.rojeru-toast.scale {
|
|
360
|
+
animation: rojeru-toast-scale-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
@keyframes rojeru-toast-slide-in {
|
|
364
|
+
from {
|
|
365
|
+
transform: translateX(100%);
|
|
366
|
+
opacity: 0;
|
|
367
|
+
}
|
|
368
|
+
to {
|
|
369
|
+
transform: translateX(0);
|
|
370
|
+
opacity: 1;
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
@keyframes rojeru-toast-slide-in-left {
|
|
375
|
+
from {
|
|
376
|
+
transform: translateX(-100%);
|
|
377
|
+
opacity: 0;
|
|
378
|
+
}
|
|
379
|
+
to {
|
|
380
|
+
transform: translateX(0);
|
|
381
|
+
opacity: 1;
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
@keyframes rojeru-toast-fade-in {
|
|
386
|
+
from {
|
|
387
|
+
opacity: 0;
|
|
388
|
+
transform: translateY(-20px);
|
|
389
|
+
}
|
|
390
|
+
to {
|
|
391
|
+
opacity: 1;
|
|
392
|
+
transform: translateY(0);
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
@keyframes rojeru-toast-scale-in {
|
|
397
|
+
from {
|
|
398
|
+
opacity: 0;
|
|
399
|
+
transform: scale(0.8);
|
|
400
|
+
}
|
|
401
|
+
to {
|
|
402
|
+
opacity: 1;
|
|
403
|
+
transform: scale(1);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
|
|
407
|
+
/* Nuevas animaciones para actualización */
|
|
408
|
+
@keyframes rojeru-toast-update {
|
|
409
|
+
0% {
|
|
410
|
+
transform: scale(1);
|
|
411
|
+
}
|
|
412
|
+
50% {
|
|
413
|
+
transform: scale(1.02);
|
|
414
|
+
}
|
|
415
|
+
100% {
|
|
416
|
+
transform: scale(1);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
@keyframes rojeru-toast-type-change {
|
|
421
|
+
0% {
|
|
422
|
+
transform: scale(1);
|
|
423
|
+
opacity: 1;
|
|
424
|
+
}
|
|
425
|
+
50% {
|
|
426
|
+
transform: scale(0.95);
|
|
427
|
+
opacity: 0.7;
|
|
428
|
+
}
|
|
429
|
+
100% {
|
|
430
|
+
transform: scale(1);
|
|
431
|
+
opacity: 1;
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
|
|
435
|
+
/* Responsive */
|
|
436
|
+
@media (max-width: 768px) {
|
|
437
|
+
.rojeru-toast-container {
|
|
438
|
+
max-width: 100vw;
|
|
439
|
+
padding: 10px;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
.rojeru-toast {
|
|
443
|
+
max-width: calc(100vw - 20px);
|
|
444
|
+
font-size: 15px;
|
|
445
|
+
padding: 14px 16px;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
.rojeru-toast-container.top-center,
|
|
449
|
+
.rojeru-toast-container.bottom-center {
|
|
450
|
+
width: 100%;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
.rojeru-toast-icon {
|
|
454
|
+
width: 18px;
|
|
455
|
+
height: 18px;
|
|
456
|
+
}
|
|
457
|
+
}
|