@seaverse/auth-sdk 0.4.0 → 0.4.1
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 +14 -0
- package/dist/index.cjs +36 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +9 -0
- package/dist/index.js +36 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1581,6 +1581,7 @@ declare class Toast {
|
|
|
1581
1581
|
private static toasts;
|
|
1582
1582
|
private static nextId;
|
|
1583
1583
|
private static cssInjected;
|
|
1584
|
+
private static timers;
|
|
1584
1585
|
/**
|
|
1585
1586
|
* Show a toast notification
|
|
1586
1587
|
*/
|
|
@@ -1608,6 +1609,14 @@ declare class Toast {
|
|
|
1608
1609
|
* Create close button SVG
|
|
1609
1610
|
*/
|
|
1610
1611
|
private static createCloseSVG;
|
|
1612
|
+
/**
|
|
1613
|
+
* Schedule auto-dismiss for a toast
|
|
1614
|
+
*/
|
|
1615
|
+
private static scheduleAutoDismiss;
|
|
1616
|
+
/**
|
|
1617
|
+
* Clear auto-dismiss timer for a toast
|
|
1618
|
+
*/
|
|
1619
|
+
private static clearAutoDismiss;
|
|
1611
1620
|
/**
|
|
1612
1621
|
* Dismiss a toast
|
|
1613
1622
|
*/
|
package/dist/index.js
CHANGED
|
@@ -2224,6 +2224,7 @@ class Toast {
|
|
|
2224
2224
|
}
|
|
2225
2225
|
// Create toast element
|
|
2226
2226
|
const toast = this.createToast(type, title, message, onClose);
|
|
2227
|
+
const toastId = toast.id;
|
|
2227
2228
|
// Add to container
|
|
2228
2229
|
this.container.appendChild(toast);
|
|
2229
2230
|
this.toasts.push(toast);
|
|
@@ -2231,11 +2232,17 @@ class Toast {
|
|
|
2231
2232
|
requestAnimationFrame(() => {
|
|
2232
2233
|
toast.classList.add('toast-show');
|
|
2233
2234
|
});
|
|
2234
|
-
// Auto-dismiss
|
|
2235
|
+
// Auto-dismiss with hover support
|
|
2235
2236
|
if (duration > 0) {
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2237
|
+
this.scheduleAutoDismiss(toast, duration, onClose);
|
|
2238
|
+
// Pause auto-dismiss on hover
|
|
2239
|
+
toast.addEventListener('mouseenter', () => {
|
|
2240
|
+
this.clearAutoDismiss(toastId);
|
|
2241
|
+
});
|
|
2242
|
+
// Resume auto-dismiss on leave
|
|
2243
|
+
toast.addEventListener('mouseleave', () => {
|
|
2244
|
+
this.scheduleAutoDismiss(toast, duration, onClose);
|
|
2245
|
+
});
|
|
2239
2246
|
}
|
|
2240
2247
|
}
|
|
2241
2248
|
/**
|
|
@@ -2449,6 +2456,30 @@ class Toast {
|
|
|
2449
2456
|
svg.appendChild(path);
|
|
2450
2457
|
return svg;
|
|
2451
2458
|
}
|
|
2459
|
+
/**
|
|
2460
|
+
* Schedule auto-dismiss for a toast
|
|
2461
|
+
*/
|
|
2462
|
+
static scheduleAutoDismiss(toast, duration, onClose) {
|
|
2463
|
+
const toastId = toast.id;
|
|
2464
|
+
// Clear existing timer if any
|
|
2465
|
+
this.clearAutoDismiss(toastId);
|
|
2466
|
+
// Schedule new timer
|
|
2467
|
+
const timer = setTimeout(() => {
|
|
2468
|
+
this.dismiss(toast, onClose);
|
|
2469
|
+
this.timers.delete(toastId);
|
|
2470
|
+
}, duration);
|
|
2471
|
+
this.timers.set(toastId, timer);
|
|
2472
|
+
}
|
|
2473
|
+
/**
|
|
2474
|
+
* Clear auto-dismiss timer for a toast
|
|
2475
|
+
*/
|
|
2476
|
+
static clearAutoDismiss(toastId) {
|
|
2477
|
+
const timer = this.timers.get(toastId);
|
|
2478
|
+
if (timer) {
|
|
2479
|
+
clearTimeout(timer);
|
|
2480
|
+
this.timers.delete(toastId);
|
|
2481
|
+
}
|
|
2482
|
+
}
|
|
2452
2483
|
/**
|
|
2453
2484
|
* Dismiss a toast
|
|
2454
2485
|
*/
|
|
@@ -2741,6 +2772,7 @@ Toast.container = null;
|
|
|
2741
2772
|
Toast.toasts = [];
|
|
2742
2773
|
Toast.nextId = 0;
|
|
2743
2774
|
Toast.cssInjected = false;
|
|
2775
|
+
Toast.timers = new Map();
|
|
2744
2776
|
|
|
2745
2777
|
class AuthModal {
|
|
2746
2778
|
constructor(options) {
|