ga-toasts 2.1.1 → 2.2.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 +5 -0
- package/dist/ga-toasts.css +52 -2
- package/dist/ga-toasts.global.js +1 -1
- package/dist/index.cjs +50 -14
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +50 -14
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Modern, accessible, **dependency-free** toast notifications for the web.
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/ga-toasts)
|
|
6
|
+
[](https://bundlephobia.com/package/ga-toasts)
|
|
6
7
|
[](#typescript)
|
|
7
8
|
[](#)
|
|
8
9
|
[](./LICENSE)
|
|
@@ -18,6 +19,10 @@ Modern, accessible, **dependency-free** toast notifications for the web.
|
|
|
18
19
|
|
|
19
20
|
**Live demo:** https://gatoasts.vercel.app/
|
|
20
21
|
|
|
22
|
+
<!-- Tip: a short screen-capture GIF here is the single biggest lever for GitHub stars & click-through.
|
|
23
|
+
Record the live demo, save it as images/demo.gif, then uncomment the line below:
|
|
24
|
+
 -->
|
|
25
|
+
|
|
21
26
|
---
|
|
22
27
|
|
|
23
28
|
## Install
|
package/dist/ga-toasts.css
CHANGED
|
@@ -149,8 +149,8 @@
|
|
|
149
149
|
opacity: 0;
|
|
150
150
|
transform: translateY(-140%);
|
|
151
151
|
transition:
|
|
152
|
-
transform 0.5s var(--gat-ease),
|
|
153
|
-
opacity 0.35s ease,
|
|
152
|
+
transform var(--gat-move-dur, 0.5s) var(--gat-move-ease, var(--gat-ease)),
|
|
153
|
+
opacity var(--gat-fade-dur, 0.35s) ease,
|
|
154
154
|
box-shadow 0.2s ease;
|
|
155
155
|
will-change: transform, opacity;
|
|
156
156
|
overflow: hidden;
|
|
@@ -205,6 +205,56 @@
|
|
|
205
205
|
|
|
206
206
|
.ga-toast-hide { pointer-events: none; }
|
|
207
207
|
|
|
208
|
+
/* ---------------- Enter/exit animations (`animation` option) ----------------
|
|
209
|
+
The engine writes `transform` inline on every frame it stacks or swipes, so
|
|
210
|
+
a variant cannot ship keyframes or a transform rule of its own — the inline
|
|
211
|
+
value outranks both. Each one instead retimes the transform the engine is
|
|
212
|
+
already interpolating, while offscreenTransform() in index.ts picks the
|
|
213
|
+
matching starting point. `fade` and `slide` are the defaults, so they need
|
|
214
|
+
no declarations; they exist as classes purely as styling hooks. */
|
|
215
|
+
Opacity timing is what separates `scale` from `fade`. Run them at the same
|
|
216
|
+
speed and the card is still translucent while it grows, so the eye reads the
|
|
217
|
+
opacity and the geometry is lost — the two variants become the same effect.
|
|
218
|
+
`scale` therefore snaps opaque early and lets the pop play out on a solid
|
|
219
|
+
card, while `fade` stretches opacity to become the whole animation. */
|
|
220
|
+
.ga-toast-anim-fade {
|
|
221
|
+
--gat-fade-dur: 0.4s;
|
|
222
|
+
}
|
|
223
|
+
.ga-toast-anim-scale {
|
|
224
|
+
--gat-move-dur: 0.42s;
|
|
225
|
+
--gat-move-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
226
|
+
--gat-fade-dur: 0.16s;
|
|
227
|
+
}
|
|
228
|
+
.ga-toast-anim-bounce {
|
|
229
|
+
--gat-move-dur: 0.62s;
|
|
230
|
+
--gat-move-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
231
|
+
}
|
|
232
|
+
/* Shrinking into place, so no overshoot — it would dip under 1 and squash. */
|
|
233
|
+
.ga-toast-anim-zoom {
|
|
234
|
+
--gat-move-dur: 0.36s;
|
|
235
|
+
--gat-move-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
236
|
+
--gat-fade-dur: 0.16s;
|
|
237
|
+
}
|
|
238
|
+
.ga-toast-anim-swing {
|
|
239
|
+
--gat-move-dur: 0.58s;
|
|
240
|
+
--gat-move-ease: cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
241
|
+
}
|
|
242
|
+
/* A control point below 0 winds up before the fall; one above 1 lands hard. */
|
|
243
|
+
.ga-toast-anim-drop {
|
|
244
|
+
--gat-move-dur: 0.52s;
|
|
245
|
+
--gat-move-ease: cubic-bezier(0.6, -0.28, 0.735, 1.28);
|
|
246
|
+
--gat-fade-dur: 0.18s;
|
|
247
|
+
}
|
|
248
|
+
.ga-toast-anim-flip {
|
|
249
|
+
--gat-move-dur: 0.5s;
|
|
250
|
+
--gat-move-ease: cubic-bezier(0.22, 1, 0.36, 1);
|
|
251
|
+
--gat-fade-dur: 0.14s;
|
|
252
|
+
}
|
|
253
|
+
/* Opt out entirely: the toast is simply there, then simply gone. */
|
|
254
|
+
.ga-toast-anim-none {
|
|
255
|
+
transition: none;
|
|
256
|
+
}
|
|
257
|
+
|
|
208
258
|
/* While a horizontal swipe-to-dismiss is in progress, don't let the drag
|
|
209
259
|
paint a text selection. Text is fully selectable at rest. */
|
|
210
260
|
.ga-toast-swiping,
|
package/dist/ga-toasts.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var GaToasts=(()=>{var et=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var ve=(o,u)=>{for(var h in u)et(o,h,{get:u[h],enumerable:!0})},xe=(o,u,h,p)=>{if(u&&typeof u=="object"||typeof u=="function")for(let b of he(u))!be.call(o,b)&&b!==h&&et(o,b,{get:()=>u[b],enumerable:!(p=me(u,b))||p.enumerable});return o};var Te=o=>xe(et({},"__esModule",{value:!0}),o);var ze={};ve(ze,{default:()=>$e});var St='.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform .5s var(--gat-ease),opacity .35s ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';var x=typeof window<"u"&&typeof document<"u",ye="ga-toast",at="ga-toasts-styles",we=450,Ee=140,ke=3,Ce=14,Me=14,Le=.05,H='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">',Se={success:`${H}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M7.75 12.5l2.75 2.75L16.5 9" class="ga-ic-draw"/></svg>`,error:`${H}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M15 9l-6 6M9 9l6 6" class="ga-ic-draw"/></svg>`,warning:`${H}<path d="M12 3.6 2.4 20.4h19.2L12 3.6z" class="ga-ic-ring"/><path d="M12 10v4" class="ga-ic-draw"/><path d="M12 17.4v.01"/></svg>`,info:`${H}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M12 11v5" class="ga-ic-draw"/><path d="M12 7.6v.01"/></svg>`,primary:`${H}<path d="M12 3.5l2.6 5.27 5.82.85-4.21 4.1.99 5.79L12 16.77 6.8 19.5l.99-5.79-4.21-4.1 5.82-.85L12 3.5z" class="ga-ic-draw"/></svg>`,secondary:`${H}<path d="M6 9a6 6 0 0112 0c0 4.5 1.8 5.6 1.8 5.6H4.2S6 13.5 6 9z" class="ga-ic-draw"/><path d="M10 19a2 2 0 004 0"/></svg>`,loading:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true" class="ga-toast-spinner"><circle cx="12" cy="12" r="9" opacity="0.25"/><path d="M12 3a9 9 0 019 9"/></svg>'},He='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg>',Ht=new Set(["error","warning"]),Ae=["top-start","top-center","top-end","middle-start","middle-center","middle-end","bottom-start","bottom-center","bottom-end"],Oe={success:5e3,error:8e3,warning:6e3,info:4e3,primary:5e3,secondary:5e3,loading:0},At={soft:{},solid:{surface:"solid",elevation:"raised"},minimal:{surface:"outline",elevation:"flat",radius:10,accentEdge:0},sharp:{radius:4},material:{surface:"solid",elevation:"floating",radius:12}},Ot={compact:["8px","13px","0.82rem"],comfortable:["12px","16px","0.875rem"],spacious:["16px","20px","0.94rem"]},Nt={flat:"0 1px 2px rgba(15,23,42,0.06)",raised:"0 1px 2px rgba(15,23,42,0.05), 0 8px 20px -12px rgba(15,23,42,0.16)",floating:"0 4px 10px -3px rgba(15,23,42,0.12), 0 20px 44px -14px rgba(15,23,42,0.34)"};function I(o){return typeof o=="number"?`${o}px`:String(o)}function nt(o){if(!o)return{};if(typeof o=="string")return{...At[o]||{}};let{preset:u,...h}=o;return{...u?At[u]||{}:{},...h}}function Pt(o){let u={};if(o.width!=null&&(u["--gat-width"]=I(o.width)),o.radius!=null&&(u["--gat-radius"]=I(o.radius)),o.gap!=null&&(u["--gat-gap"]=I(o.gap)),o.edge!=null&&(u["--gat-edge"]=I(o.edge)),o.font&&(u["--gat-font"]=o.font),o.density&&Ot[o.density]){let[h,p,b]=Ot[o.density];u["--gat-pad-y"]=h,u["--gat-pad-x"]=p,u["--gat-font-size"]=b}if(o.elevation&&Nt[o.elevation]&&(u["--gat-shadow"]=Nt[o.elevation]),o.accentEdge!=null&&(u["--gat-accent-edge"]=I(o.accentEdge)),o.accent&&(u["--gat-primary"]=o.accent),o.colors)for(let h of Object.keys(o.colors))o.colors[h]&&(u[`--gat-${h}`]=o.colors[h]);return o.text&&(u["--gat-text"]=o.text),o.textSoft&&(u["--gat-text-soft"]=o.textSoft),o.textMuted&&(u["--gat-text-muted"]=o.textMuted),o.surfaceColor&&(u["--gat-surface"]=o.surfaceColor,u["--gat-surface-solid"]=o.surfaceColor),o.border&&(u["--gat-border"]=o.border),o.shadow&&(u["--gat-shadow"]=o.shadow),o.chip&&(u["--gat-chip"]=o.chip),o.ease&&(u["--gat-ease"]=o.ease),u}function $t(o){return o.startsWith("bottom")?-1:1}function Ne(){return x?(document.documentElement.getAttribute("dir")||document.body&&document.body.getAttribute("dir"))==="rtl":!1}function It(o){let u="translateX(-115%)",h="translateX(115%)",p=Ne();return o.endsWith("start")?p?h:u:o.endsWith("end")?p?u:h:$t(o)===1?"translateY(-140%)":"translateY(140%)"}function Pe(o){return Math.max(.15,1-Math.abs(o)/220)}function V(o){return o.startsWith("#")?o.slice(1):o}function Rt(){return typeof performance<"u"?performance.now():Date.now()}function Ie(){return x&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var Re=0;function zt(o={}){let u=Re+=1,h=`ga-toaster-${u}`,p=new Map,b=new Map,_={...o.defaults||{}},R=o.logger||null,k=null,st=!1,rt=!1,it=0,C=null,y=null,Y={...Se},lt=He,$={...Oe},z=ke,ct=Ce,U=Me,dt=Le,M="hover",gt=!1,ut=o.injectStyles!==!1,F=o.styleNonce,ft=o.render||null,D={},B,G="bar",w=null,A=o.root||(x?document.body:null),L=!!o.root&&typeof o.root.host<"u"?o.root:x?document.head:null;function pt(t){if(t)for(let e of Object.keys(t))typeof t[e]=="number"&&($[e]=t[e])}function mt(t){if(t)for(let e of Object.keys(t)){if(e==="close"){t.close&&(lt=t.close);continue}Y[e]=t[e]}}function ht(t){t&&(typeof t.peek=="number"&&(ct=t.peek),typeof t.gap=="number"&&(U=t.gap),typeof t.scaleStep=="number"&&(dt=t.scaleStep),t.expand&&(M=t.expand),typeof t.newestOnTop=="boolean"&&(gt=t.newestOnTop))}pt(o.durations),mt(o.icons),ht(o.stack),typeof o.maxVisible=="number"&&(z=Math.max(1,Math.floor(o.maxVisible)||1));function bt(){it+=1;let t=Math.random().toString(36).slice(2,8);return`${ye}-${it}-${t}`}function S(t,e){if(R)try{R(t,e)}catch{}}function vt(){if(!x||!ut||!L)return;let t=document;if(L.querySelector?.(`#${at}`)||L===t.head&&t.getElementById(at))return;let e=t.createElement("style");e.id=at,F&&e.setAttribute("nonce",F),e.textContent=St,L.appendChild(e)}function W(){if(!x||!L)return;let t=D;B=t.surface,G=t.progress||"bar";let e=`.${h}.ga-toast-container`,a=Pt(t),n=Object.entries(a).map(([l,i])=>`${l}:${i}`).join(";"),c=t.dark?Pt(t.dark):{},d=Object.entries(c).map(([l,i])=>`${l}:${i}`).join(";"),s="";if(n&&(s+=`${e}{${n}}`),d&&(s+=`[data-ga-theme="dark"] ${e},.ga-theme-dark ${e}{${d}}`),!s){w?.remove(),w=null;return}w||(w=document.createElement("style"),w.id=`ga-toasts-theme-${u}`,F&&w.setAttribute("nonce",F),L.appendChild(w)),w.textContent=s}function Dt(){if(!x||!A||k&&k.polite.isConnected&&k.assertive.isConnected)return;let t=e=>{let a=document.createElement("div");return a.className="ga-toast-live-region",a.setAttribute("aria-live",e),a.setAttribute("aria-atomic","true"),a.setAttribute("role",e==="assertive"?"alert":"status"),A.appendChild(a),a};k={polite:t("polite"),assertive:t("assertive")}}function Bt(t,e){if(!t||(Dt(),!k))return;let a=e?k.assertive:k.polite;a.textContent="",window.setTimeout(()=>{a.textContent=t},50)}function jt(t){let e=b.get(t);if(e&&e.isConnected)return e;let a=document.createElement("div");if(a.className=`ga-toast-container ga-toast-container-${t} ${h}`,a.setAttribute("data-ga-position",t),a.setAttribute("role","region"),a.setAttribute("aria-label","Notifications"),M==="always"&&(a.dataset.gaExpanded="true"),M==="hover"){let n=null,c=()=>{n!=null&&(clearTimeout(n),n=null)},d=()=>{c(),xt(a,!0)},s=()=>{c(),n=setTimeout(()=>{n=null,xt(a,!1)},Ee)};a.addEventListener("pointerenter",d),a.addEventListener("pointerleave",s),a.addEventListener("focusin",d),a.addEventListener("focusout",l=>{a.contains(l.relatedTarget)||s()})}return A?.appendChild(a),b.set(t,a),a}function xt(t,e){M==="hover"&&t.dataset.gaExpanded==="true"!==e&&(t.dataset.gaExpanded=e?"true":"false",T(t))}function Xt(t){return Array.from(t.children).map(e=>p.get(e.id)).filter(e=>!!e)}function T(t){let e=Xt(t),a=t.dataset.gaPosition||"top-end",n=$t(a),c=M==="always"||M==="hover"&&t.dataset.gaExpanded==="true",d=Ie(),s=gt?e.slice():e.slice().reverse();t.style.setProperty("--ga-toasts-count",String(s.length));let l=0;s.forEach((i,f)=>{if(i.closing)return;if(!i.el.dataset.gaMounted){l+=i.height+U;return}let r,g,m,E=f>=z;E?O(i,"overflow"):N(i,"overflow"),c||d?(r=n*l,g=1,m=1):(r=n*f*ct,g=Math.max(1-f*dt,.85),m=E?0:1);let Lt=i.swipeX?` translateX(${i.swipeX}px)`:"",pe=a.startsWith("middle")?`calc(-50% + ${r}px)`:`${r}px`;i.el.style.transform=`translateY(${pe})${Lt} scale(${g})`,i.el.style.opacity=i.swipeX?String(Pe(i.swipeX)):String(m),i.el.style.zIndex=String(1e3+s.length-f),i.el.style.pointerEvents=m===0?"none":"auto",i.el.setAttribute("aria-hidden",m===0?"true":"false"),l+=i.height+U})}function Tt(t){let e=t.el.offsetHeight;e>0&&(t.height=e)}function Vt(t){let e={type:"info",duration:5e3,closable:!0,position:"top-end",animation:"slide",swipeToClose:!0,closeOnEscape:!0,progress:!0,progressPosition:"bottom",pauseOnHover:!0,pauseOnPageHidden:!0,autoIcon:!0,glassmorphism:!0,html:!1,..._,...t};return e.position=e.position||"top-end",Ae.includes(e.position)||(e.position="top-end"),e}function yt(t){return Y[t]??Y.info??null}function K(){let t=document.createElement("button");return t.type="button",t.className="ga-toast-close",t.setAttribute("aria-label","Close notification"),t.setAttribute("data-ga-close",""),t.innerHTML=lt,t}function wt(t,e,a){if(G==="ring"||!e.progress||(e.duration||0)<=0||e.progressPosition==="none")return null;let n=document.createElement("div");return n.className=`ga-toast-progress ga-toast-progress-${a}`+(e.progressPosition==="top"?" ga-toast-progress-top":""),t.appendChild(n),n}function qt(t,e){let a=document.createElement("div");if(a.className="ga-toast-icon",a.innerHTML=t,!(G==="ring"&&e.progress!==!1&&(e.duration||0)>0))return{el:a,ring:null};a.classList.add("ga-toast-icon-ring");let c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg");d.setAttribute("class","ga-toast-ring"),d.setAttribute("viewBox","0 0 36 36"),d.setAttribute("aria-hidden","true");let s=document.createElementNS(c,"circle");s.setAttribute("class","ga-toast-ring-track"),s.setAttribute("cx","18"),s.setAttribute("cy","18"),s.setAttribute("r","16");let l=document.createElementNS(c,"circle");return l.setAttribute("class","ga-toast-ring-bar"),l.setAttribute("cx","18"),l.setAttribute("cy","18"),l.setAttribute("r","16"),d.appendChild(s),d.appendChild(l),a.appendChild(d),{el:a,ring:l}}function _t(t,e){let a=t.type||"info",n=document.createElement("div");n.id=e;let c=B==="glass"||B===void 0&&t.glassmorphism;n.className=["ga-toast",`ga-toast-${a}`,t.size?`ga-toast-${t.size}`:"",t.variant?`ga-toast-${a}-${t.variant}`:"",t.animation||"",t.compact?"ga-toast-compact":"",c?"ga-toast-glass":"",B==="outline"?"ga-toast-outline":"",a==="loading"?"ga-toast-loading":"",t.className||""].filter(Boolean).join(" ");let d=t.role||(Ht.has(a)?"alert":"status");if(n.setAttribute("role",d),n.setAttribute("aria-live","off"),n.setAttribute("data-ga-type",a),d==="alertdialog"||d==="dialog"){let r=[t.title,t.message].filter(Boolean).join(". ");r&&n.setAttribute("aria-label",r)}let s=null;if(t.content!=null)s=typeof t.content=="function"?t.content():t.content;else if(ft){let r=ft(t,{id:e,close:()=>v(e)});r&&(s=r)}if(s!=null){n.classList.add("ga-toast-has-custom");let r=document.createElement("div");return r.className="ga-toast-custom",typeof s=="string"?r.innerHTML=s:r.appendChild(s),n.appendChild(r),t.closable&&n.appendChild(K()),{el:n,progressEl:wt(n,t,a),ring:null}}if(t.avatar){let r=document.createElement("img");r.className="ga-toast-avatar",r.src=t.avatar,r.alt=t.avatarAlt||t.title||"Notification",n.appendChild(r)}let l=null;t.icon?l=String(t.icon):t.icon!==!1&&t.autoIcon!==!1&&!t.avatar&&(l=yt(a));let i=null;if(l){let r=qt(l,t);i=r.ring,n.appendChild(r.el)}let f=document.createElement("div");if(f.className="ga-toast-content",t.title||t.showStatus||t.unread){let r=document.createElement("div");if(r.className="ga-toast-header",t.unread){let g=document.createElement("span");g.className="ga-toast-unread-dot",r.appendChild(g)}if(t.title){let g=document.createElement("div");g.className="ga-toast-title"+(t.truncateTitle?" ga-toast-title-truncate":""),g.textContent=t.title,r.appendChild(g)}if(t.showStatus){let g=document.createElement("span");g.className="ga-toast-status";let m=String(t.statusText||a);g.textContent=m.charAt(0).toUpperCase()+m.slice(1),r.appendChild(g)}f.appendChild(r)}if(t.message||t.meta){let r=document.createElement("div");if(r.className="ga-toast-body",t.meta){let g=document.createElement("div");g.className="ga-toast-meta",g.textContent=t.meta,r.appendChild(g)}if(t.message){let g=document.createElement("div");g.className="ga-toast-message",t.html?g.innerHTML=t.message:g.textContent=t.message,r.appendChild(g)}f.appendChild(r)}if(t.actions&&t.actions.length&&!t.compact){let r=document.createElement("div");r.className="ga-toast-actions";for(let g of t.actions){let m=document.createElement("button");m.type="button",m.className=["ga-toast-btn",g.className||g.class||"ga-toast-btn-secondary"].join(" "),m.textContent=g.text,m.setAttribute("data-ga-action",""),r.appendChild(m)}f.appendChild(r)}if(t.steps&&t.steps>1){let r=document.createElement("div");r.className="ga-toast-steps";let g=Math.min(t.steps,Math.max(1,t.currentStep||1));for(let m=1;m<=t.steps;m+=1){let E=document.createElement("div");E.className="ga-toast-step"+(m<=g?" ga-toast-step-active":""),r.appendChild(E)}f.appendChild(r)}return n.appendChild(f),t.closable&&n.appendChild(K()),{el:n,progressEl:wt(n,t,a),ring:i}}let j=2*Math.PI*16;function J(t){let{timer:e}=t;e.duration<=0||e.remaining<=0||e.holds.size>0||(e.startedAt=Rt(),e.handle=setTimeout(()=>v(t.id),e.remaining),Yt(t,e.remaining))}function O(t,e){let{timer:a}=t,n=a.holds.size>0;if(a.holds.add(e),n||a.handle==null)return;clearTimeout(a.handle),a.handle=null;let c=Rt()-a.startedAt;a.remaining=Math.max(0,a.remaining-c),Ut(t)}function N(t,e){let{timer:a}=t;a.holds.delete(e)&&(a.holds.size>0||J(t))}function Yt(t,e){let a=t.timer.duration>0?e/t.timer.duration:0;if(t.ring){let c=t.ring;c.style.transition="none",c.style.strokeDasharray=String(j),c.style.strokeDashoffset=String(j*(1-a)),c.getBoundingClientRect?.(),c.style.transition=`stroke-dashoffset ${e}ms linear`,c.style.strokeDashoffset=String(j);return}let n=t.progressEl;n&&(n.style.transition="none",n.style.transform=`scaleX(${a})`,n.offsetWidth,n.style.transition=`transform ${e}ms linear`,n.style.transform="scaleX(0)")}function Ut(t){let e=t.timer.duration>0?t.timer.remaining/t.timer.duration:0;if(t.ring){t.ring.style.transition="none",t.ring.style.strokeDashoffset=String(j*(1-e));return}let a=t.progressEl;a&&(a.style.transition="none",a.style.transform=`scaleX(${e})`)}function Gt(t,e){let{el:a,controller:n}=t,c=n.signal;a.addEventListener("click",d=>{let s=d.target;if(s.closest("[data-ga-close]")){d.preventDefault(),v(t.id);return}let l=s.closest("[data-ga-action]");if(l&&e.actions){let i=Array.from(l.parentElement?.children||[]).indexOf(l),f=e.actions[i];if(f){let r=f.onClick||f.click;r&&r(d,t.handle),f.closeOnClick!==!1&&v(t.id)}return}e.clickToClose&&!s.closest(".ga-toast-actions")&&v(t.id)},{signal:c}),e.pauseOnHover&&(a.addEventListener("pointerenter",()=>O(t,"hover"),{signal:c}),a.addEventListener("pointerleave",()=>N(t,"hover"),{signal:c}),a.addEventListener("focusin",()=>O(t,"focus"),{signal:c}),a.addEventListener("focusout",()=>N(t,"focus"),{signal:c})),e.swipeToClose&&Wt(t),e.modal&&a.addEventListener("keydown",d=>{if(d.key!=="Tab")return;let s=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!s.length)return;let l=s[0],i=s[s.length-1],f=document.activeElement;d.shiftKey&&f===l?(d.preventDefault(),i.focus()):!d.shiftKey&&f===i&&(d.preventDefault(),l.focus())},{signal:c})}function Wt(t){let{el:e,controller:a}=t,n=a.signal,c=70,d=!1,s=!1,l=0,i=0;e.addEventListener("pointerdown",r=>{if(!(r.pointerType==="mouse"&&r.button!==0)&&!r.target.closest("button, a, input, textarea, select")){d=!0,s=!1,l=r.clientX,i=r.clientY,O(t,"swipe");try{e.setPointerCapture(r.pointerId)}catch{}}},{signal:n}),e.addEventListener("pointermove",r=>{if(!d)return;let g=r.clientX-l,m=r.clientY-i;if(Math.abs(g)<6||Math.abs(g)<Math.abs(m))return;r.preventDefault(),s||(s=!0,e.classList.add("ga-toast-swiping"),(typeof window<"u"&&typeof window.getSelection=="function"?window.getSelection():null)?.removeAllRanges()),t.swipeX=g;let E=e.parentElement;E&&T(E)},{signal:n});let f=r=>{if(!d)return;d=!1,s=!1,e.classList.remove("ga-toast-swiping");let g=r.clientX-l;if(Math.abs(g)>c){let m=g>0?1:-1;t.el.style.transition="transform 0.2s ease, opacity 0.2s ease",t.el.style.transform=`translateX(${m*400}px)`,t.el.style.opacity="0",v(t.id)}else{t.swipeX=0;let m=e.parentElement;m&&T(m),N(t,"swipe")}};e.addEventListener("pointerup",f,{signal:n}),e.addEventListener("pointercancel",f,{signal:n})}function Kt(){st||!x||(st=!0,document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let e=null;for(let a of p.values())a.closing||a.opts.closeOnEscape===!1||!a.opts.closable||(e=a);e&&v(e.id)}))}function Jt(){rt||!x||typeof document.addEventListener!="function"||(rt=!0,document.addEventListener("visibilitychange",()=>{let t=document.hidden;for(let e of p.values())e.closing||e.opts.pauseOnPageHidden===!1||(t?O(e,"tab"):N(e,"tab"))}))}function Qt(){if(!x||!A)return;y||(y=document.createElement("div"),y.className="ga-toast-backdrop"),y.isConnected||A.appendChild(y);let t=y;requestAnimationFrame(()=>t.classList.add("ga-toast-backdrop-show"))}function Zt(){if(!y)return;let t=y;t.classList.remove("ga-toast-backdrop-show"),setTimeout(()=>{C==null&&t.parentNode&&t.remove()},220)}function Et(t){let e={id:t,el:x?document.createElement("div"):{},update:()=>e,close:()=>{}};return e}function P(t={}){if(!x)return Et(t.id||bt());let e=Vt(t);if(e.id&&p.has(e.id))return Q(e.id,t)||Et(e.id);if(e.modal){if(C&&p.has(C))return p.get(C).handle;e.swipeToClose=!1,e.closeOnEscape=!1,e.moveFocus=!0}vt(),Kt(),Jt();let a=e.id||bt(),{el:n,progressEl:c,ring:d}=_t(e,a),s=new AbortController,l={duration:e.duration||0,remaining:e.duration||0,startedAt:0,handle:null,holds:new Set},i={id:a,el:n,update:g=>(Q(a,g),i),close:()=>v(a)},f={id:a,el:n,handle:i,opts:e,controller:s,progressEl:c,ring:d,timer:l,height:0,closing:!1,swipeX:0,resizeObserver:null,prevFocus:e.moveFocus?document.activeElement:null};p.set(a,f),e.modal&&(C=a,n.setAttribute("aria-modal","true"),Qt());let r=jt(e.position);if(n.style.transform=It(e.position),n.style.opacity="0",r.appendChild(n),Gt(f,e),typeof ResizeObserver<"u"&&(f.resizeObserver=new ResizeObserver(()=>{Tt(f);let g=n.parentElement;g&&T(g)}),f.resizeObserver.observe(n)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(p.has(a)&&(Tt(f),n.dataset.gaMounted="true",n.style.opacity="1",T(r),J(f),e.moveFocus)){let g=n.querySelector("[data-ga-action]")||n;g===n&&(n.tabIndex=-1);try{g.focus({preventScroll:!0})}catch{}}})}),!e.modal&&e.role!=="alertdialog"&&Bt([e.title,e.message].filter(Boolean).join(". "),Ht.has(e.type||"info")),e.onShow)try{e.onShow(i)}catch(g){S("toast:onShow:error",g)}return S("toast:show",{id:a,type:e.type}),i}function v(t){if(!t)return;let e=typeof t=="string"?V(t):t.id,a=p.get(e);if(!a||a.closing)return;a.closing=!0,a.timer.handle!=null&&(clearTimeout(a.timer.handle),a.timer.handle=null),a.controller.abort(),a.resizeObserver?.disconnect();let{el:n}=a,c=n.parentElement;a.swipeX||(n.style.transition="",n.classList.add("ga-toast-hide"),n.style.transform=It(a.opts.position),n.style.opacity="0");let d=!1,s=()=>{if(d)return;d=!0,n.removeEventListener("transitionend",l),p.delete(e),n.remove(),C===e&&(C=null,Zt()),c&&T(c);let i=a.prevFocus;if(i&&typeof i.focus=="function"&&document.contains(i))try{i.focus({preventScroll:!0})}catch{}if(a.opts.onClose)try{a.opts.onClose(a.handle)}catch(f){S("toast:onClose:error",f)}S("toast:close",{id:e})},l=i=>{i.target===n&&(i.propertyName==="transform"||i.propertyName==="opacity")&&s()};n.addEventListener("transitionend",l),setTimeout(s,we)}function Q(t,e){let a=typeof t=="string"?V(t):t.id,n=p.get(a);if(!n)return S("toast:update:not-found",a),null;let c=n.opts;if(e.title!==void 0){let s=n.el.querySelector(".ga-toast-title");if(!s&&e.title){let l=n.el.querySelector(".ga-toast-content");if(l){let i=l.querySelector(".ga-toast-header");i||(i=document.createElement("div"),i.className="ga-toast-header",l.insertBefore(i,l.firstChild)),s=document.createElement("div"),s.className="ga-toast-title",i.appendChild(s)}}s&&(s.textContent=e.title),c.title=e.title}if(e.message!==void 0){let s=e.html??c.html,l=n.el.querySelector(".ga-toast-message");if(!l&&e.message){let i=n.el.querySelector(".ga-toast-body");if(!i){i=document.createElement("div"),i.className="ga-toast-body";let f=n.el.querySelector(".ga-toast-content"),r=f?.querySelector(".ga-toast-actions, .ga-toast-steps");r?f.insertBefore(i,r):f?.appendChild(i)}l=document.createElement("div"),l.className="ga-toast-message",i.appendChild(l)}l&&(s?l.innerHTML=e.message:l.textContent=e.message),c.message=e.message}if(e.type&&e.type!==c.type){let s=c.type;n.el.classList.remove(`ga-toast-${s}`,"ga-toast-loading"),n.el.classList.add(`ga-toast-${e.type}`),n.el.setAttribute("data-ga-type",e.type),e.type==="loading"&&n.el.classList.add("ga-toast-loading"),n.progressEl&&(n.progressEl.className=n.progressEl.className.replace(/ga-toast-progress-\w+/,`ga-toast-progress-${e.type}`));let l=n.el.querySelector(".ga-toast-icon");if(l&&c.autoIcon!==!1&&!e.icon){let i=yt(e.type);i!=null&&(l.innerHTML=i)}c.type=e.type}if(e.icon!==void 0){let s=n.el.querySelector(".ga-toast-icon");if(e.icon){if(!s){s=document.createElement("div"),s.className="ga-toast-icon";let l=n.el.querySelector(".ga-toast-content");n.el.insertBefore(s,l)}s.innerHTML=String(e.icon)}else s&&s.remove()}if(e.closable!==void 0){let s=n.el.querySelector(":scope > .ga-toast-close");e.closable&&!s?n.el.insertBefore(K(),n.progressEl||null):!e.closable&&s&&s.remove(),c.closable=e.closable}e.duration!==void 0&&(n.timer.handle!=null&&clearTimeout(n.timer.handle),n.timer.duration=e.duration,n.timer.remaining=e.duration,c.duration=e.duration,e.duration>0&&n.el.dataset.gaMounted&&J(n));let d=n.el.parentElement;return d&&T(d),S("toast:update",{id:a}),n.handle}function Z(){for(let t of Array.from(p.keys()))v(t)}function te(t){if(!t)return Z();for(let e of Array.from(p.values()))e.opts.type===t&&v(e.id)}function ee(t){if(!t)return p.size;let e=0;for(let a of p.values())a.opts.type===t&&(e+=1);return e}function ae(t){return p.has(V(t))}function ne(t){return p.get(V(t))?.el||null}function X(t){return(e,a={})=>P({...a,type:t,message:e,duration:a.duration??$[t]})}let oe=X("success"),se=X("error"),re=X("warning"),kt=X("info");function Ct(t="Loading\u2026",e={}){return P({closable:!1,...e,type:"loading",message:t,duration:0,progress:!1})}function ie(t,e={}){let{confirmText:a,cancelText:n,onConfirm:c,onCancel:d,...s}=e;return P({type:"warning",duration:0,closable:!1,swipeToClose:!1,role:"alertdialog",moveFocus:!0,modal:!0,position:"middle-center",...s,message:t,actions:[{text:n||"Cancel",className:"ga-toast-btn-secondary",onClick:()=>d?.()},{text:a||"Confirm",className:"ga-toast-btn-primary",onClick:()=>c?.()}]})}function le(t,e,a={}){let n=typeof t=="function"?t():t,c=Ct(e.loading,a);return n.then(d=>(c.update({type:"success",message:typeof e.success=="function"?e.success(d):e.success,duration:a.duration??$.success,closable:!0}),d),d=>{throw c.update({type:"error",message:typeof e.error=="function"?e.error(d):e.error,duration:a.duration??$.error,closable:!0}),d})}function ce(t,e={}){return P({...e,content:t})}function Mt(t){_={..._,...t}}function de(t){R=typeof t=="function"?t:null}function ge(t){z=Math.max(1,Math.floor(t)||1),b.forEach(e=>T(e))}function ue(t){return D=nt(t),W(),b.forEach(e=>T(e)),tt}function fe(t){return t.defaults&&Mt(t.defaults),t.logger!==void 0&&(R=t.logger),pt(t.durations),mt(t.icons),ht(t.stack),typeof t.maxVisible=="number"&&(z=Math.max(1,Math.floor(t.maxVisible)||1)),t.injectStyles!==void 0&&(ut=t.injectStyles!==!1),t.theme!==void 0&&(D=nt(t.theme),W()),b.forEach(e=>T(e)),tt}let tt=Object.assign((t,e)=>kt(t,e),{show:P,success:oe,error:se,warning:re,info:kt,loading:Ct,confirm:ie,promise:le,custom:ce,close:v,closeAll:Z,dismiss:v,dismissAll:Z,clear:te,update:Q,get:ne,exists:ae,getCount:ee,setDefaults:Mt,setMaxVisible:ge,setLogger:de,configure:fe,theme:ue,injectStyles:vt});return o.theme!==void 0&&(D=nt(o.theme),W()),tt}function Ft(o={}){return zt(o)}var ot=zt(),q=ot;q.toast=ot;q.createToaster=Ft;var $e=q;return Te(ze);})();
|
|
1
|
+
"use strict";var GaToasts=(()=>{var nt=Object.defineProperty;var me=Object.getOwnPropertyDescriptor;var he=Object.getOwnPropertyNames;var be=Object.prototype.hasOwnProperty;var ve=(o,g)=>{for(var m in g)nt(o,m,{get:g[m],enumerable:!0})},xe=(o,g,m,p)=>{if(g&&typeof g=="object"||typeof g=="function")for(let b of he(g))!be.call(o,b)&&b!==m&&nt(o,b,{get:()=>g[b],enumerable:!(p=me(g,b))||p.enumerable});return o};var ye=o=>xe(nt({},"__esModule",{value:!0}),o);var Re={};ve(Re,{default:()=>$e});var Ht='.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform var(--gat-move-dur, .5s) var(--gat-move-ease, var(--gat-ease)),opacity var(--gat-fade-dur, .35s) ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}Opacity timing is what separates `scale` from `fade`. Run them at the same speed and the card is still translucent while it grows,so the eye reads the opacity and the geometry is lost \\2014 the two variants become the same effect. `scale` therefore snaps opaque early and lets the pop play out on a solid card,while `fade` stretches opacity to become the whole animation. */ .ga-toast-anim-fade{--gat-fade-dur: .4s}.ga-toast-anim-scale{--gat-move-dur: .42s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1);--gat-fade-dur: .16s}.ga-toast-anim-bounce{--gat-move-dur: .62s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-zoom{--gat-move-dur: .36s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .16s}.ga-toast-anim-swing{--gat-move-dur: .58s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-drop{--gat-move-dur: .52s;--gat-move-ease: cubic-bezier(.6, -.28, .735, 1.28);--gat-fade-dur: .18s}.ga-toast-anim-flip{--gat-move-dur: .5s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .14s}.ga-toast-anim-none{transition:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';var x=typeof window<"u"&&typeof document<"u",Te="ga-toast",ot="ga-toasts-styles",we=450,Ee=140,ke=3,Ce=14,Me=14,Le=.05,O='<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.1" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">',Se={success:`${O}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M7.75 12.5l2.75 2.75L16.5 9" class="ga-ic-draw"/></svg>`,error:`${O}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M15 9l-6 6M9 9l6 6" class="ga-ic-draw"/></svg>`,warning:`${O}<path d="M12 3.6 2.4 20.4h19.2L12 3.6z" class="ga-ic-ring"/><path d="M12 10v4" class="ga-ic-draw"/><path d="M12 17.4v.01"/></svg>`,info:`${O}<circle cx="12" cy="12" r="9" class="ga-ic-ring"/><path d="M12 11v5" class="ga-ic-draw"/><path d="M12 7.6v.01"/></svg>`,primary:`${O}<path d="M12 3.5l2.6 5.27 5.82.85-4.21 4.1.99 5.79L12 16.77 6.8 19.5l.99-5.79-4.21-4.1 5.82-.85L12 3.5z" class="ga-ic-draw"/></svg>`,secondary:`${O}<path d="M6 9a6 6 0 0112 0c0 4.5 1.8 5.6 1.8 5.6H4.2S6 13.5 6 9z" class="ga-ic-draw"/><path d="M10 19a2 2 0 004 0"/></svg>`,loading:'<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.4" stroke-linecap="round" aria-hidden="true" class="ga-toast-spinner"><circle cx="12" cy="12" r="9" opacity="0.25"/><path d="M12 3a9 9 0 019 9"/></svg>'},He='<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" aria-hidden="true"><path d="M6 6l12 12M18 6 6 18"/></svg>',At=new Set(["error","warning"]),Ae=["top-start","top-center","top-end","middle-start","middle-center","middle-end","bottom-start","bottom-center","bottom-end"],Oe={success:5e3,error:8e3,warning:6e3,info:4e3,primary:5e3,secondary:5e3,loading:0},Ot={soft:{},solid:{surface:"solid",elevation:"raised"},minimal:{surface:"outline",elevation:"flat",radius:10,accentEdge:0},sharp:{radius:4},material:{surface:"solid",elevation:"floating",radius:12}},Nt={compact:["8px","13px","0.82rem"],comfortable:["12px","16px","0.875rem"],spacious:["16px","20px","0.94rem"]},Pt={flat:"0 1px 2px rgba(15,23,42,0.06)",raised:"0 1px 2px rgba(15,23,42,0.05), 0 8px 20px -12px rgba(15,23,42,0.16)",floating:"0 4px 10px -3px rgba(15,23,42,0.12), 0 20px 44px -14px rgba(15,23,42,0.34)"};function $(o){return typeof o=="number"?`${o}px`:String(o)}function st(o){if(!o)return{};if(typeof o=="string")return{...Ot[o]||{}};let{preset:g,...m}=o;return{...g?Ot[g]||{}:{},...m}}function zt(o){let g={};if(o.width!=null&&(g["--gat-width"]=$(o.width)),o.radius!=null&&(g["--gat-radius"]=$(o.radius)),o.gap!=null&&(g["--gat-gap"]=$(o.gap)),o.edge!=null&&(g["--gat-edge"]=$(o.edge)),o.font&&(g["--gat-font"]=o.font),o.density&&Nt[o.density]){let[m,p,b]=Nt[o.density];g["--gat-pad-y"]=m,g["--gat-pad-x"]=p,g["--gat-font-size"]=b}if(o.elevation&&Pt[o.elevation]&&(g["--gat-shadow"]=Pt[o.elevation]),o.accentEdge!=null&&(g["--gat-accent-edge"]=$(o.accentEdge)),o.accent&&(g["--gat-primary"]=o.accent),o.colors)for(let m of Object.keys(o.colors))o.colors[m]&&(g[`--gat-${m}`]=o.colors[m]);return o.text&&(g["--gat-text"]=o.text),o.textSoft&&(g["--gat-text-soft"]=o.textSoft),o.textMuted&&(g["--gat-text-muted"]=o.textMuted),o.surfaceColor&&(g["--gat-surface"]=o.surfaceColor,g["--gat-surface-solid"]=o.surfaceColor),o.border&&(g["--gat-border"]=o.border),o.shadow&&(g["--gat-shadow"]=o.shadow),o.chip&&(g["--gat-chip"]=o.chip),o.ease&&(g["--gat-ease"]=o.ease),g}function Rt(o){return o.startsWith("bottom")?-1:1}function Ne(){return x?(document.documentElement.getAttribute("dir")||document.body&&document.body.getAttribute("dir"))==="rtl":!1}function y({y:o="0px",x:g="0px",scale:m=1,rotate:p=0}){return`translateY(${o}) translateX(${g}) scale(${m}) rotate(${p}deg)`}function R(o,g="0px"){if(!o.startsWith("middle"))return g;let m=g.startsWith("-");return`calc(-50% ${m?"-":"+"} ${m?g.slice(1):g})`}function It(o,g){let m=R(o),p=Ne(),b=o.endsWith("start")?p?"115%":"-115%":o.endsWith("end")?p?"-115%":"115%":null,L=R(o,Rt(o)===1?"-140%":"140%");switch(g){case"none":case"fade":return y({y:m});case"scale":return y({y:m,scale:.75});case"zoom":return y({y:m,scale:1.25});case"drop":return y({y:R(o,"-160%")});case"flip":return`${y({y:m})} perspective(900px) rotateX(-88deg)`;case"swing":return y(b?{y:m,x:b,rotate:b.startsWith("-")?-7:7}:{y:L,rotate:-7});default:return y(b?{y:m,x:b}:{y:L})}}function Pe(o){return Math.max(.15,1-Math.abs(o)/220)}function Y(o){return o.startsWith("#")?o.slice(1):o}function $t(){return typeof performance<"u"?performance.now():Date.now()}function ze(){return x&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}var Ie=0;function Ft(o={}){let g=Ie+=1,m=`ga-toaster-${g}`,p=new Map,b=new Map,L={...o.defaults||{}},F=o.logger||null,C=null,it=!1,lt=!1,ct=0,M=null,w=null,G={...Se},dt=He,D={...Oe},B=ke,gt=Ce,W=Me,ut=Le,S="hover",ft=!1,pt=o.injectStyles!==!1,j=o.styleNonce,mt=o.render||null,V={},q,K="bar",E=null,N=o.root||(x?document.body:null),H=!!o.root&&typeof o.root.host<"u"?o.root:x?document.head:null;function ht(t){if(t)for(let e of Object.keys(t))typeof t[e]=="number"&&(D[e]=t[e])}function bt(t){if(t)for(let e of Object.keys(t)){if(e==="close"){t.close&&(dt=t.close);continue}G[e]=t[e]}}function vt(t){t&&(typeof t.peek=="number"&&(gt=t.peek),typeof t.gap=="number"&&(W=t.gap),typeof t.scaleStep=="number"&&(ut=t.scaleStep),t.expand&&(S=t.expand),typeof t.newestOnTop=="boolean"&&(ft=t.newestOnTop))}ht(o.durations),bt(o.icons),vt(o.stack),typeof o.maxVisible=="number"&&(B=Math.max(1,Math.floor(o.maxVisible)||1));function xt(){ct+=1;let t=Math.random().toString(36).slice(2,8);return`${Te}-${ct}-${t}`}function A(t,e){if(F)try{F(t,e)}catch{}}function yt(){if(!x||!pt||!H)return;let t=document;if(H.querySelector?.(`#${ot}`)||H===t.head&&t.getElementById(ot))return;let e=t.createElement("style");e.id=ot,j&&e.setAttribute("nonce",j),e.textContent=Ht,H.appendChild(e)}function J(){if(!x||!H)return;let t=V;q=t.surface,K=t.progress||"bar";let e=`.${m}.ga-toast-container`,a=zt(t),n=Object.entries(a).map(([l,i])=>`${l}:${i}`).join(";"),c=t.dark?zt(t.dark):{},d=Object.entries(c).map(([l,i])=>`${l}:${i}`).join(";"),s="";if(n&&(s+=`${e}{${n}}`),d&&(s+=`[data-ga-theme="dark"] ${e},.ga-theme-dark ${e}{${d}}`),!s){E?.remove(),E=null;return}E||(E=document.createElement("style"),E.id=`ga-toasts-theme-${g}`,j&&E.setAttribute("nonce",j),H.appendChild(E)),E.textContent=s}function Bt(){if(!x||!N||C&&C.polite.isConnected&&C.assertive.isConnected)return;let t=e=>{let a=document.createElement("div");return a.className="ga-toast-live-region",a.setAttribute("aria-live",e),a.setAttribute("aria-atomic","true"),a.setAttribute("role",e==="assertive"?"alert":"status"),N.appendChild(a),a};C={polite:t("polite"),assertive:t("assertive")}}function jt(t,e){if(!t||(Bt(),!C))return;let a=e?C.assertive:C.polite;a.textContent="",window.setTimeout(()=>{a.textContent=t},50)}function Vt(t){let e=b.get(t);if(e&&e.isConnected)return e;let a=document.createElement("div");if(a.className=`ga-toast-container ga-toast-container-${t} ${m}`,a.setAttribute("data-ga-position",t),a.setAttribute("role","region"),a.setAttribute("aria-label","Notifications"),S==="always"&&(a.dataset.gaExpanded="true"),S==="hover"){let n=null,c=()=>{n!=null&&(clearTimeout(n),n=null)},d=()=>{c(),Tt(a,!0)},s=()=>{c(),n=setTimeout(()=>{n=null,Tt(a,!1)},Ee)};a.addEventListener("pointerenter",d),a.addEventListener("pointerleave",s),a.addEventListener("focusin",d),a.addEventListener("focusout",l=>{a.contains(l.relatedTarget)||s()})}return N?.appendChild(a),b.set(t,a),a}function Tt(t,e){S==="hover"&&t.dataset.gaExpanded==="true"!==e&&(t.dataset.gaExpanded=e?"true":"false",T(t))}function qt(t){return Array.from(t.children).map(e=>p.get(e.id)).filter(e=>!!e)}function T(t){let e=qt(t),a=t.dataset.gaPosition||"top-end",n=Rt(a),c=S==="always"||S==="hover"&&t.dataset.gaExpanded==="true",d=ze(),s=ft?e.slice():e.slice().reverse();t.style.setProperty("--ga-toasts-count",String(s.length));let l=0;s.forEach((i,f)=>{if(i.closing)return;if(!i.el.dataset.gaMounted){l+=i.height+W;return}let r,u,h,k=f>=B;k?P(i,"overflow"):z(i,"overflow"),c||d?(r=n*l,u=1,h=1):(r=n*f*gt,u=Math.max(1-f*ut,.85),h=k?0:1),i.el.style.transform=y({y:R(a,`${r}px`),x:i.swipeX?`${i.swipeX}px`:"0px",scale:u}),i.el.style.opacity=i.swipeX?String(Pe(i.swipeX)):String(h),i.el.style.zIndex=String(1e3+s.length-f),i.el.style.pointerEvents=h===0?"none":"auto",i.el.setAttribute("aria-hidden",h===0?"true":"false"),l+=i.height+W})}function wt(t){let e=t.el.offsetHeight;e>0&&(t.height=e)}function Xt(t){let e={type:"info",duration:5e3,closable:!0,position:"top-end",animation:"slide",swipeToClose:!0,closeOnEscape:!0,progress:!0,progressPosition:"bottom",pauseOnHover:!0,pauseOnPageHidden:!0,autoIcon:!0,glassmorphism:!0,html:!1,...L,...t};return e.position=e.position||"top-end",Ae.includes(e.position)||(e.position="top-end"),e}function Et(t){return G[t]??G.info??null}function Q(){let t=document.createElement("button");return t.type="button",t.className="ga-toast-close",t.setAttribute("aria-label","Close notification"),t.setAttribute("data-ga-close",""),t.innerHTML=dt,t}function kt(t,e,a){if(K==="ring"||!e.progress||(e.duration||0)<=0||e.progressPosition==="none")return null;let n=document.createElement("div");return n.className=`ga-toast-progress ga-toast-progress-${a}`+(e.progressPosition==="top"?" ga-toast-progress-top":""),t.appendChild(n),n}function _t(t,e){let a=document.createElement("div");if(a.className="ga-toast-icon",a.innerHTML=t,!(K==="ring"&&e.progress!==!1&&(e.duration||0)>0))return{el:a,ring:null};a.classList.add("ga-toast-icon-ring");let c="http://www.w3.org/2000/svg",d=document.createElementNS(c,"svg");d.setAttribute("class","ga-toast-ring"),d.setAttribute("viewBox","0 0 36 36"),d.setAttribute("aria-hidden","true");let s=document.createElementNS(c,"circle");s.setAttribute("class","ga-toast-ring-track"),s.setAttribute("cx","18"),s.setAttribute("cy","18"),s.setAttribute("r","16");let l=document.createElementNS(c,"circle");return l.setAttribute("class","ga-toast-ring-bar"),l.setAttribute("cx","18"),l.setAttribute("cy","18"),l.setAttribute("r","16"),d.appendChild(s),d.appendChild(l),a.appendChild(d),{el:a,ring:l}}function Yt(t,e){let a=t.type||"info",n=document.createElement("div");n.id=e;let c=q==="glass"||q===void 0&&t.glassmorphism;n.className=["ga-toast",`ga-toast-${a}`,t.size?`ga-toast-${t.size}`:"",t.variant?`ga-toast-${a}-${t.variant}`:"",t.animation?`ga-toast-anim-${t.animation}`:"",t.compact?"ga-toast-compact":"",c?"ga-toast-glass":"",q==="outline"?"ga-toast-outline":"",a==="loading"?"ga-toast-loading":"",t.className||""].filter(Boolean).join(" ");let d=t.role||(At.has(a)?"alert":"status");if(n.setAttribute("role",d),n.setAttribute("aria-live","off"),n.setAttribute("data-ga-type",a),d==="alertdialog"||d==="dialog"){let r=[t.title,t.message].filter(Boolean).join(". ");r&&n.setAttribute("aria-label",r)}let s=null;if(t.content!=null)s=typeof t.content=="function"?t.content():t.content;else if(mt){let r=mt(t,{id:e,close:()=>v(e)});r&&(s=r)}if(s!=null){n.classList.add("ga-toast-has-custom");let r=document.createElement("div");return r.className="ga-toast-custom",typeof s=="string"?r.innerHTML=s:r.appendChild(s),n.appendChild(r),t.closable&&n.appendChild(Q()),{el:n,progressEl:kt(n,t,a),ring:null}}if(t.avatar){let r=document.createElement("img");r.className="ga-toast-avatar",r.src=t.avatar,r.alt=t.avatarAlt||t.title||"Notification",n.appendChild(r)}let l=null;t.icon?l=String(t.icon):t.icon!==!1&&t.autoIcon!==!1&&!t.avatar&&(l=Et(a));let i=null;if(l){let r=_t(l,t);i=r.ring,n.appendChild(r.el)}let f=document.createElement("div");if(f.className="ga-toast-content",t.title||t.showStatus||t.unread){let r=document.createElement("div");if(r.className="ga-toast-header",t.unread){let u=document.createElement("span");u.className="ga-toast-unread-dot",r.appendChild(u)}if(t.title){let u=document.createElement("div");u.className="ga-toast-title"+(t.truncateTitle?" ga-toast-title-truncate":""),u.textContent=t.title,r.appendChild(u)}if(t.showStatus){let u=document.createElement("span");u.className="ga-toast-status";let h=String(t.statusText||a);u.textContent=h.charAt(0).toUpperCase()+h.slice(1),r.appendChild(u)}f.appendChild(r)}if(t.message||t.meta){let r=document.createElement("div");if(r.className="ga-toast-body",t.meta){let u=document.createElement("div");u.className="ga-toast-meta",u.textContent=t.meta,r.appendChild(u)}if(t.message){let u=document.createElement("div");u.className="ga-toast-message",t.html?u.innerHTML=t.message:u.textContent=t.message,r.appendChild(u)}f.appendChild(r)}if(t.actions&&t.actions.length&&!t.compact){let r=document.createElement("div");r.className="ga-toast-actions";for(let u of t.actions){let h=document.createElement("button");h.type="button",h.className=["ga-toast-btn",u.className||u.class||"ga-toast-btn-secondary"].join(" "),h.textContent=u.text,h.setAttribute("data-ga-action",""),r.appendChild(h)}f.appendChild(r)}if(t.steps&&t.steps>1){let r=document.createElement("div");r.className="ga-toast-steps";let u=Math.min(t.steps,Math.max(1,t.currentStep||1));for(let h=1;h<=t.steps;h+=1){let k=document.createElement("div");k.className="ga-toast-step"+(h<=u?" ga-toast-step-active":""),r.appendChild(k)}f.appendChild(r)}return n.appendChild(f),t.closable&&n.appendChild(Q()),{el:n,progressEl:kt(n,t,a),ring:i}}let X=2*Math.PI*16;function Z(t){let{timer:e}=t;e.duration<=0||e.remaining<=0||e.holds.size>0||(e.startedAt=$t(),e.handle=setTimeout(()=>v(t.id),e.remaining),Ut(t,e.remaining))}function P(t,e){let{timer:a}=t,n=a.holds.size>0;if(a.holds.add(e),n||a.handle==null)return;clearTimeout(a.handle),a.handle=null;let c=$t()-a.startedAt;a.remaining=Math.max(0,a.remaining-c),Gt(t)}function z(t,e){let{timer:a}=t;a.holds.delete(e)&&(a.holds.size>0||Z(t))}function Ut(t,e){let a=t.timer.duration>0?e/t.timer.duration:0;if(t.ring){let c=t.ring;c.style.transition="none",c.style.strokeDasharray=String(X),c.style.strokeDashoffset=String(X*(1-a)),c.getBoundingClientRect?.(),c.style.transition=`stroke-dashoffset ${e}ms linear`,c.style.strokeDashoffset=String(X);return}let n=t.progressEl;n&&(n.style.transition="none",n.style.transform=`scaleX(${a})`,n.offsetWidth,n.style.transition=`transform ${e}ms linear`,n.style.transform="scaleX(0)")}function Gt(t){let e=t.timer.duration>0?t.timer.remaining/t.timer.duration:0;if(t.ring){t.ring.style.transition="none",t.ring.style.strokeDashoffset=String(X*(1-e));return}let a=t.progressEl;a&&(a.style.transition="none",a.style.transform=`scaleX(${e})`)}function Wt(t,e){let{el:a,controller:n}=t,c=n.signal;a.addEventListener("click",d=>{let s=d.target;if(s.closest("[data-ga-close]")){d.preventDefault(),v(t.id);return}let l=s.closest("[data-ga-action]");if(l&&e.actions){let i=Array.from(l.parentElement?.children||[]).indexOf(l),f=e.actions[i];if(f){let r=f.onClick||f.click;r&&r(d,t.handle),f.closeOnClick!==!1&&v(t.id)}return}e.clickToClose&&!s.closest(".ga-toast-actions")&&v(t.id)},{signal:c}),e.pauseOnHover&&(a.addEventListener("pointerenter",()=>P(t,"hover"),{signal:c}),a.addEventListener("pointerleave",()=>z(t,"hover"),{signal:c}),a.addEventListener("focusin",()=>P(t,"focus"),{signal:c}),a.addEventListener("focusout",()=>z(t,"focus"),{signal:c})),e.swipeToClose&&Kt(t),e.modal&&a.addEventListener("keydown",d=>{if(d.key!=="Tab")return;let s=a.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])');if(!s.length)return;let l=s[0],i=s[s.length-1],f=document.activeElement;d.shiftKey&&f===l?(d.preventDefault(),i.focus()):!d.shiftKey&&f===i&&(d.preventDefault(),l.focus())},{signal:c})}function Kt(t){let{el:e,controller:a}=t,n=a.signal,c=70,d=!1,s=!1,l=0,i=0;e.addEventListener("pointerdown",r=>{if(!(r.pointerType==="mouse"&&r.button!==0)&&!r.target.closest("button, a, input, textarea, select")){d=!0,s=!1,l=r.clientX,i=r.clientY,P(t,"swipe");try{e.setPointerCapture(r.pointerId)}catch{}}},{signal:n}),e.addEventListener("pointermove",r=>{if(!d)return;let u=r.clientX-l,h=r.clientY-i;if(Math.abs(u)<6||Math.abs(u)<Math.abs(h))return;r.preventDefault(),s||(s=!0,e.classList.add("ga-toast-swiping"),(typeof window<"u"&&typeof window.getSelection=="function"?window.getSelection():null)?.removeAllRanges()),t.swipeX=u;let k=e.parentElement;k&&T(k)},{signal:n});let f=r=>{if(!d)return;d=!1,s=!1,e.classList.remove("ga-toast-swiping");let u=r.clientX-l;if(Math.abs(u)>c){let h=u>0?1:-1;t.el.style.transition="transform 0.2s ease, opacity 0.2s ease",t.el.style.transform=y({y:R(t.opts.position),x:`${h*400}px`}),t.el.style.opacity="0",v(t.id)}else{t.swipeX=0;let h=e.parentElement;h&&T(h),z(t,"swipe")}};e.addEventListener("pointerup",f,{signal:n}),e.addEventListener("pointercancel",f,{signal:n})}function Jt(){it||!x||(it=!0,document.addEventListener("keydown",t=>{if(t.key!=="Escape")return;let e=null;for(let a of p.values())a.closing||a.opts.closeOnEscape===!1||!a.opts.closable||(e=a);e&&v(e.id)}))}function Qt(){lt||!x||typeof document.addEventListener!="function"||(lt=!0,document.addEventListener("visibilitychange",()=>{let t=document.hidden;for(let e of p.values())e.closing||e.opts.pauseOnPageHidden===!1||(t?P(e,"tab"):z(e,"tab"))}))}function Zt(){if(!x||!N)return;w||(w=document.createElement("div"),w.className="ga-toast-backdrop"),w.isConnected||N.appendChild(w);let t=w;requestAnimationFrame(()=>t.classList.add("ga-toast-backdrop-show"))}function te(){if(!w)return;let t=w;t.classList.remove("ga-toast-backdrop-show"),setTimeout(()=>{M==null&&t.parentNode&&t.remove()},220)}function Ct(t){let e={id:t,el:x?document.createElement("div"):{},update:()=>e,close:()=>{}};return e}function I(t={}){if(!x)return Ct(t.id||xt());let e=Xt(t);if(e.id&&p.has(e.id))return tt(e.id,t)||Ct(e.id);if(e.modal){if(M&&p.has(M))return p.get(M).handle;e.swipeToClose=!1,e.closeOnEscape=!1,e.moveFocus=!0}yt(),Jt(),Qt();let a=e.id||xt(),{el:n,progressEl:c,ring:d}=Yt(e,a),s=new AbortController,l={duration:e.duration||0,remaining:e.duration||0,startedAt:0,handle:null,holds:new Set},i={id:a,el:n,update:u=>(tt(a,u),i),close:()=>v(a)},f={id:a,el:n,handle:i,opts:e,controller:s,progressEl:c,ring:d,timer:l,height:0,closing:!1,swipeX:0,resizeObserver:null,prevFocus:e.moveFocus?document.activeElement:null};p.set(a,f),e.modal&&(M=a,n.setAttribute("aria-modal","true"),Zt());let r=Vt(e.position);if(n.style.transform=It(e.position,e.animation),n.style.opacity="0",r.appendChild(n),Wt(f,e),typeof ResizeObserver<"u"&&(f.resizeObserver=new ResizeObserver(()=>{wt(f);let u=n.parentElement;u&&T(u)}),f.resizeObserver.observe(n)),requestAnimationFrame(()=>{requestAnimationFrame(()=>{if(p.has(a)&&(wt(f),n.dataset.gaMounted="true",n.style.opacity="1",T(r),Z(f),e.moveFocus)){let u=n.querySelector("[data-ga-action]")||n;u===n&&(n.tabIndex=-1);try{u.focus({preventScroll:!0})}catch{}}})}),!e.modal&&e.role!=="alertdialog"&&jt([e.title,e.message].filter(Boolean).join(". "),At.has(e.type||"info")),e.onShow)try{e.onShow(i)}catch(u){A("toast:onShow:error",u)}return A("toast:show",{id:a,type:e.type}),i}function v(t){if(!t)return;let e=typeof t=="string"?Y(t):t.id,a=p.get(e);if(!a||a.closing)return;a.closing=!0,a.timer.handle!=null&&(clearTimeout(a.timer.handle),a.timer.handle=null),a.controller.abort(),a.resizeObserver?.disconnect();let{el:n}=a,c=n.parentElement;a.swipeX||(n.style.transition="",n.classList.add("ga-toast-hide"),n.style.transform=It(a.opts.position,a.opts.animation),n.style.opacity="0");let d=!1,s=()=>{if(d)return;d=!0,n.removeEventListener("transitionend",l),p.delete(e),n.remove(),M===e&&(M=null,te()),c&&T(c);let i=a.prevFocus;if(i&&typeof i.focus=="function"&&document.contains(i))try{i.focus({preventScroll:!0})}catch{}if(a.opts.onClose)try{a.opts.onClose(a.handle)}catch(f){A("toast:onClose:error",f)}A("toast:close",{id:e})},l=i=>{i.target===n&&(i.propertyName==="transform"||i.propertyName==="opacity")&&s()};n.addEventListener("transitionend",l),setTimeout(s,we)}function tt(t,e){let a=typeof t=="string"?Y(t):t.id,n=p.get(a);if(!n)return A("toast:update:not-found",a),null;let c=n.opts;if(e.title!==void 0){let s=n.el.querySelector(".ga-toast-title");if(!s&&e.title){let l=n.el.querySelector(".ga-toast-content");if(l){let i=l.querySelector(".ga-toast-header");i||(i=document.createElement("div"),i.className="ga-toast-header",l.insertBefore(i,l.firstChild)),s=document.createElement("div"),s.className="ga-toast-title",i.appendChild(s)}}s&&(s.textContent=e.title),c.title=e.title}if(e.message!==void 0){let s=e.html??c.html,l=n.el.querySelector(".ga-toast-message");if(!l&&e.message){let i=n.el.querySelector(".ga-toast-body");if(!i){i=document.createElement("div"),i.className="ga-toast-body";let f=n.el.querySelector(".ga-toast-content"),r=f?.querySelector(".ga-toast-actions, .ga-toast-steps");r?f.insertBefore(i,r):f?.appendChild(i)}l=document.createElement("div"),l.className="ga-toast-message",i.appendChild(l)}l&&(s?l.innerHTML=e.message:l.textContent=e.message),c.message=e.message}if(e.type&&e.type!==c.type){let s=c.type;n.el.classList.remove(`ga-toast-${s}`,"ga-toast-loading"),n.el.classList.add(`ga-toast-${e.type}`),n.el.setAttribute("data-ga-type",e.type),e.type==="loading"&&n.el.classList.add("ga-toast-loading"),n.progressEl&&(n.progressEl.className=n.progressEl.className.replace(/ga-toast-progress-\w+/,`ga-toast-progress-${e.type}`));let l=n.el.querySelector(".ga-toast-icon");if(l&&c.autoIcon!==!1&&!e.icon){let i=Et(e.type);i!=null&&(l.innerHTML=i)}c.type=e.type}if(e.icon!==void 0){let s=n.el.querySelector(".ga-toast-icon");if(e.icon){if(!s){s=document.createElement("div"),s.className="ga-toast-icon";let l=n.el.querySelector(".ga-toast-content");n.el.insertBefore(s,l)}s.innerHTML=String(e.icon)}else s&&s.remove()}if(e.closable!==void 0){let s=n.el.querySelector(":scope > .ga-toast-close");e.closable&&!s?n.el.insertBefore(Q(),n.progressEl||null):!e.closable&&s&&s.remove(),c.closable=e.closable}e.duration!==void 0&&(n.timer.handle!=null&&clearTimeout(n.timer.handle),n.timer.duration=e.duration,n.timer.remaining=e.duration,c.duration=e.duration,e.duration>0&&n.el.dataset.gaMounted&&Z(n));let d=n.el.parentElement;return d&&T(d),A("toast:update",{id:a}),n.handle}function et(){for(let t of Array.from(p.keys()))v(t)}function ee(t){if(!t)return et();for(let e of Array.from(p.values()))e.opts.type===t&&v(e.id)}function ae(t){if(!t)return p.size;let e=0;for(let a of p.values())a.opts.type===t&&(e+=1);return e}function ne(t){return p.has(Y(t))}function oe(t){return p.get(Y(t))?.el||null}function _(t){return(e,a={})=>I({...a,type:t,message:e,duration:a.duration??D[t]})}let se=_("success"),re=_("error"),ie=_("warning"),Mt=_("info");function Lt(t="Loading\u2026",e={}){return I({closable:!1,...e,type:"loading",message:t,duration:0,progress:!1})}function le(t,e={}){let{confirmText:a,cancelText:n,onConfirm:c,onCancel:d,...s}=e;return I({type:"warning",duration:0,closable:!1,swipeToClose:!1,role:"alertdialog",moveFocus:!0,modal:!0,position:"middle-center",...s,message:t,actions:[{text:n||"Cancel",className:"ga-toast-btn-secondary",onClick:()=>d?.()},{text:a||"Confirm",className:"ga-toast-btn-primary",onClick:()=>c?.()}]})}function ce(t,e,a={}){let n=typeof t=="function"?t():t,c=Lt(e.loading,a);return n.then(d=>(c.update({type:"success",message:typeof e.success=="function"?e.success(d):e.success,duration:a.duration??D.success,closable:!0}),d),d=>{throw c.update({type:"error",message:typeof e.error=="function"?e.error(d):e.error,duration:a.duration??D.error,closable:!0}),d})}function de(t,e={}){return I({...e,content:t})}function St(t){L={...L,...t}}function ge(t){F=typeof t=="function"?t:null}function ue(t){B=Math.max(1,Math.floor(t)||1),b.forEach(e=>T(e))}function fe(t){return V=st(t),J(),b.forEach(e=>T(e)),at}function pe(t){return t.defaults&&St(t.defaults),t.logger!==void 0&&(F=t.logger),ht(t.durations),bt(t.icons),vt(t.stack),typeof t.maxVisible=="number"&&(B=Math.max(1,Math.floor(t.maxVisible)||1)),t.injectStyles!==void 0&&(pt=t.injectStyles!==!1),t.theme!==void 0&&(V=st(t.theme),J()),b.forEach(e=>T(e)),at}let at=Object.assign((t,e)=>Mt(t,e),{show:I,success:se,error:re,warning:ie,info:Mt,loading:Lt,confirm:le,promise:ce,custom:de,close:v,closeAll:et,dismiss:v,dismissAll:et,clear:ee,update:tt,get:oe,exists:ne,getCount:ae,setDefaults:St,setMaxVisible:ue,setLogger:ge,configure:pe,theme:fe,injectStyles:yt});return o.theme!==void 0&&(V=st(o.theme),J()),at}function Dt(o={}){return Ft(o)}var rt=Ft(),U=rt;U.toast=rt;U.createToaster=Dt;var $e=U;return ye(Re);})();
|
|
2
2
|
GaToasts=GaToasts.default;
|
package/dist/index.cjs
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
// src/styles.generated.ts
|
|
6
|
-
var css = '.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform .5s var(--gat-ease),opacity .35s ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';
|
|
6
|
+
var css = '.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform var(--gat-move-dur, .5s) var(--gat-move-ease, var(--gat-ease)),opacity var(--gat-fade-dur, .35s) ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}Opacity timing is what separates `scale` from `fade`. Run them at the same speed and the card is still translucent while it grows,so the eye reads the opacity and the geometry is lost \\2014 the two variants become the same effect. `scale` therefore snaps opaque early and lets the pop play out on a solid card,while `fade` stretches opacity to become the whole animation. */ .ga-toast-anim-fade{--gat-fade-dur: .4s}.ga-toast-anim-scale{--gat-move-dur: .42s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1);--gat-fade-dur: .16s}.ga-toast-anim-bounce{--gat-move-dur: .62s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-zoom{--gat-move-dur: .36s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .16s}.ga-toast-anim-swing{--gat-move-dur: .58s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-drop{--gat-move-dur: .52s;--gat-move-ease: cubic-bezier(.6, -.28, .735, 1.28);--gat-fade-dur: .18s}.ga-toast-anim-flip{--gat-move-dur: .5s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .14s}.ga-toast-anim-none{transition:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
var canUseDOM = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -116,13 +116,41 @@ function isRTL() {
|
|
|
116
116
|
const dir = document.documentElement.getAttribute("dir") || document.body && document.body.getAttribute("dir");
|
|
117
117
|
return dir === "rtl";
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
function composeTransform({
|
|
120
|
+
y = "0px",
|
|
121
|
+
x = "0px",
|
|
122
|
+
scale = 1,
|
|
123
|
+
rotate = 0
|
|
124
|
+
}) {
|
|
125
|
+
return `translateY(${y}) translateX(${x}) scale(${scale}) rotate(${rotate}deg)`;
|
|
126
|
+
}
|
|
127
|
+
function stackY(position, offset = "0px") {
|
|
128
|
+
if (!position.startsWith("middle")) return offset;
|
|
129
|
+
const negative = offset.startsWith("-");
|
|
130
|
+
return `calc(-50% ${negative ? "-" : "+"} ${negative ? offset.slice(1) : offset})`;
|
|
131
|
+
}
|
|
132
|
+
function offscreenTransform(position, animation) {
|
|
133
|
+
const y = stackY(position);
|
|
122
134
|
const rtl = isRTL();
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
135
|
+
const edge = position.endsWith("start") ? rtl ? "115%" : "-115%" : position.endsWith("end") ? rtl ? "-115%" : "115%" : null;
|
|
136
|
+
const offY = stackY(position, verticalDir(position) === 1 ? "-140%" : "140%");
|
|
137
|
+
switch (animation) {
|
|
138
|
+
case "none":
|
|
139
|
+
case "fade":
|
|
140
|
+
return composeTransform({ y });
|
|
141
|
+
case "scale":
|
|
142
|
+
return composeTransform({ y, scale: 0.75 });
|
|
143
|
+
case "zoom":
|
|
144
|
+
return composeTransform({ y, scale: 1.25 });
|
|
145
|
+
case "drop":
|
|
146
|
+
return composeTransform({ y: stackY(position, "-160%") });
|
|
147
|
+
case "flip":
|
|
148
|
+
return `${composeTransform({ y })} perspective(900px) rotateX(-88deg)`;
|
|
149
|
+
case "swing":
|
|
150
|
+
return edge ? composeTransform({ y, x: edge, rotate: edge.startsWith("-") ? -7 : 7 }) : composeTransform({ y: offY, rotate: -7 });
|
|
151
|
+
default:
|
|
152
|
+
return edge ? composeTransform({ y, x: edge }) : composeTransform({ y: offY });
|
|
153
|
+
}
|
|
126
154
|
}
|
|
127
155
|
function swipeOpacity(dx) {
|
|
128
156
|
return Math.max(0.15, 1 - Math.abs(dx) / 220);
|
|
@@ -351,9 +379,11 @@ function makeToaster(config = {}) {
|
|
|
351
379
|
scale = Math.max(1 - frontIndex * scaleStep, 0.85);
|
|
352
380
|
opacity = overflow ? 0 : 1;
|
|
353
381
|
}
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
382
|
+
inst.el.style.transform = composeTransform({
|
|
383
|
+
y: stackY(position, `${translateY}px`),
|
|
384
|
+
x: inst.swipeX ? `${inst.swipeX}px` : "0px",
|
|
385
|
+
scale
|
|
386
|
+
});
|
|
357
387
|
inst.el.style.opacity = inst.swipeX ? String(swipeOpacity(inst.swipeX)) : String(opacity);
|
|
358
388
|
inst.el.style.zIndex = String(1e3 + front.length - frontIndex);
|
|
359
389
|
inst.el.style.pointerEvents = opacity === 0 ? "none" : "auto";
|
|
@@ -445,7 +475,7 @@ function makeToaster(config = {}) {
|
|
|
445
475
|
`ga-toast-${type}`,
|
|
446
476
|
opts.size ? `ga-toast-${opts.size}` : "",
|
|
447
477
|
opts.variant ? `ga-toast-${type}-${opts.variant}` : "",
|
|
448
|
-
opts.animation
|
|
478
|
+
opts.animation ? `ga-toast-anim-${opts.animation}` : "",
|
|
449
479
|
opts.compact ? "ga-toast-compact" : "",
|
|
450
480
|
glass ? "ga-toast-glass" : "",
|
|
451
481
|
surfaceMode === "outline" ? "ga-toast-outline" : "",
|
|
@@ -743,7 +773,10 @@ function makeToaster(config = {}) {
|
|
|
743
773
|
if (Math.abs(dx) > THRESHOLD) {
|
|
744
774
|
const dir = dx > 0 ? 1 : -1;
|
|
745
775
|
inst.el.style.transition = "transform 0.2s ease, opacity 0.2s ease";
|
|
746
|
-
inst.el.style.transform =
|
|
776
|
+
inst.el.style.transform = composeTransform({
|
|
777
|
+
y: stackY(inst.opts.position),
|
|
778
|
+
x: `${dir * 400}px`
|
|
779
|
+
});
|
|
747
780
|
inst.el.style.opacity = "0";
|
|
748
781
|
close(inst.id);
|
|
749
782
|
} else {
|
|
@@ -866,7 +899,7 @@ function makeToaster(config = {}) {
|
|
|
866
899
|
showBackdrop();
|
|
867
900
|
}
|
|
868
901
|
const container = getContainer(opts.position);
|
|
869
|
-
el.style.transform = offscreenTransform(opts.position);
|
|
902
|
+
el.style.transform = offscreenTransform(opts.position, opts.animation);
|
|
870
903
|
el.style.opacity = "0";
|
|
871
904
|
container.appendChild(el);
|
|
872
905
|
attachHandlers(inst, opts);
|
|
@@ -929,7 +962,10 @@ function makeToaster(config = {}) {
|
|
|
929
962
|
if (!inst.swipeX) {
|
|
930
963
|
el.style.transition = "";
|
|
931
964
|
el.classList.add("ga-toast-hide");
|
|
932
|
-
el.style.transform = offscreenTransform(
|
|
965
|
+
el.style.transform = offscreenTransform(
|
|
966
|
+
inst.opts.position,
|
|
967
|
+
inst.opts.animation
|
|
968
|
+
);
|
|
933
969
|
el.style.opacity = "0";
|
|
934
970
|
}
|
|
935
971
|
let removed = false;
|
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
type ToastType = 'success' | 'error' | 'warning' | 'info' | 'primary' | 'secondary' | 'loading';
|
|
20
20
|
type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
21
|
-
type ToastAnimation = 'fade' | 'slide' | 'bounce' | 'scale';
|
|
21
|
+
type ToastAnimation = 'fade' | 'slide' | 'bounce' | 'scale' | 'zoom' | 'flip' | 'swing' | 'drop' | 'none';
|
|
22
22
|
type ToastVariant = '' | 'filled' | 'light';
|
|
23
23
|
type ToastSize = '' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
24
24
|
type ToastProgressPosition = 'top' | 'bottom' | 'none';
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
type ToastType = 'success' | 'error' | 'warning' | 'info' | 'primary' | 'secondary' | 'loading';
|
|
20
20
|
type ToastPosition = 'top-start' | 'top-center' | 'top-end' | 'middle-start' | 'middle-center' | 'middle-end' | 'bottom-start' | 'bottom-center' | 'bottom-end';
|
|
21
|
-
type ToastAnimation = 'fade' | 'slide' | 'bounce' | 'scale';
|
|
21
|
+
type ToastAnimation = 'fade' | 'slide' | 'bounce' | 'scale' | 'zoom' | 'flip' | 'swing' | 'drop' | 'none';
|
|
22
22
|
type ToastVariant = '' | 'filled' | 'light';
|
|
23
23
|
type ToastSize = '' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
|
|
24
24
|
type ToastProgressPosition = 'top' | 'bottom' | 'none';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/styles.generated.ts
|
|
2
|
-
var css = '.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform .5s var(--gat-ease),opacity .35s ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';
|
|
2
|
+
var css = '.ga-toast-container{--gat-width: 380px;--gat-radius: 14px;--gat-gap: 14px;--gat-edge: 22px;--gat-pad-y: 12px;--gat-pad-x: 16px;--gat-font-size: .875rem;--gat-accent-edge: 0px;--gat-font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;--gat-surface: rgba(255, 255, 255, .82);--gat-surface-solid: #ffffff;--gat-border: rgba(15, 23, 42, .07);--gat-ring: rgba(15, 23, 42, .05);--gat-highlight: rgba(255, 255, 255, .75);--gat-text: #0f172a;--gat-text-soft: #475569;--gat-text-muted: #64748b;--gat-shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 8px 20px -12px rgba(15, 23, 42, .16);--gat-shadow-hover: 0 2px 4px -2px rgba(15, 23, 42, .12), 0 14px 32px -12px rgba(15, 23, 42, .26);--gat-chip: rgba(15, 23, 42, .05);--gat-success: #16a34a;--gat-error: #e11d48;--gat-warning: #d97706;--gat-info: #2563eb;--gat-primary: #6366f1;--gat-secondary: #64748b;--gat-loading: #2563eb;--gat-ease: cubic-bezier(.22, 1, .36, 1)}[data-ga-theme=dark] .ga-toast-container,.ga-theme-dark .ga-toast-container,.ga-toast-container.ga-theme-dark{--gat-surface: rgba(30, 34, 44, .72);--gat-surface-solid: #22262f;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-shadow-hover: 0 2px 6px -2px rgba(0, 0, 0, .5), 0 16px 38px -12px rgba(0, 0, 0, .64);--gat-chip: rgba(255, 255, 255, .08)}@media(prefers-color-scheme:dark){:root:not([data-ga-theme]):not(.ga-theme-light):not(.ga-theme-dark) .ga-toast-container{--gat-surface: rgba(24, 27, 34, .82);--gat-surface-solid: #191c22;--gat-border: rgba(255, 255, 255, .09);--gat-ring: rgba(255, 255, 255, .06);--gat-highlight: rgba(255, 255, 255, .07);--gat-text: #f8fafc;--gat-text-soft: #cbd5e1;--gat-text-muted: #9aa7ba;--gat-shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 10px 28px -14px rgba(0, 0, 0, .5);--gat-chip: rgba(255, 255, 255, .08)}}.ga-toast-backdrop{position:fixed;inset:0;z-index:2147482990;background:#0a0c146b;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(2px);opacity:0;transition:opacity .22s ease}.ga-toast-backdrop-show{opacity:1}@media(prefers-reduced-transparency:reduce){.ga-toast-backdrop{backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-container{position:fixed;z-index:2147483000;width:var(--gat-width);max-width:calc(100vw - 2 * var(--gat-edge));pointer-events:none;font-family:var(--gat-font)}.ga-toast-container-top-start{inset-block-start:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-top-end{inset-block-start:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-top-center{inset-block-start:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-bottom-start{inset-block-end:var(--gat-edge);inset-inline-start:var(--gat-edge)}.ga-toast-container-bottom-end{inset-block-end:var(--gat-edge);inset-inline-end:var(--gat-edge)}.ga-toast-container-bottom-center{inset-block-end:var(--gat-edge);left:50%;transform:translate(-50%)}.ga-toast-container-middle-start{top:50%;inset-inline-start:var(--gat-edge)}.ga-toast-container-middle-end{top:50%;inset-inline-end:var(--gat-edge)}.ga-toast-container-middle-center{top:50%;left:50%;transform:translate(-50%)}.ga-toast{position:absolute;inset-inline:0;width:100%;box-sizing:border-box;display:flex;flex-direction:row;align-items:flex-start;gap:11px;padding:var(--gat-pad-y, 12px) var(--gat-pad-x, 16px);color:var(--gat-text);background:var(--gat-surface-solid);border:none;border-radius:var(--gat-radius);box-shadow:var(--gat-shadow),inset 0 1px 0 var(--gat-highlight);pointer-events:auto;opacity:0;transform:translateY(-140%);transition:transform var(--gat-move-dur, .5s) var(--gat-move-ease, var(--gat-ease)),opacity var(--gat-fade-dur, .35s) ease,box-shadow .2s ease;will-change:transform,opacity;overflow:hidden;font-size:var(--gat-font-size, .875rem);line-height:1.5;-webkit-font-smoothing:antialiased;text-align:start;touch-action:pan-y;overscroll-behavior:contain}@media(hover:hover){.ga-toast:hover{box-shadow:var(--gat-shadow-hover),inset 0 1px 0 var(--gat-highlight)}}[data-ga-position^=top] .ga-toast,[data-ga-position^=middle] .ga-toast{top:0;transform-origin:top center}[data-ga-position^=bottom] .ga-toast{bottom:0;transform-origin:bottom center}.ga-toast-glass{background:var(--gat-surface);backdrop-filter:blur(16px) saturate(160%);-webkit-backdrop-filter:blur(16px) saturate(160%)}.ga-toast-outline{background:transparent;border:1px solid var(--gat-border);box-shadow:var(--gat-shadow);backdrop-filter:none;-webkit-backdrop-filter:none}.ga-toast:before{content:"";position:absolute;inset-block:0;inset-inline-start:0;width:var(--gat-accent-edge, 0px);background:var(--gat-accent, var(--gat-info));pointer-events:none}.ga-toast-hide{pointer-events:none}Opacity timing is what separates `scale` from `fade`. Run them at the same speed and the card is still translucent while it grows,so the eye reads the opacity and the geometry is lost \\2014 the two variants become the same effect. `scale` therefore snaps opaque early and lets the pop play out on a solid card,while `fade` stretches opacity to become the whole animation. */ .ga-toast-anim-fade{--gat-fade-dur: .4s}.ga-toast-anim-scale{--gat-move-dur: .42s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1);--gat-fade-dur: .16s}.ga-toast-anim-bounce{--gat-move-dur: .62s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-zoom{--gat-move-dur: .36s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .16s}.ga-toast-anim-swing{--gat-move-dur: .58s;--gat-move-ease: cubic-bezier(.34, 1.56, .64, 1)}.ga-toast-anim-drop{--gat-move-dur: .52s;--gat-move-ease: cubic-bezier(.6, -.28, .735, 1.28);--gat-fade-dur: .18s}.ga-toast-anim-flip{--gat-move-dur: .5s;--gat-move-ease: cubic-bezier(.22, 1, .36, 1);--gat-fade-dur: .14s}.ga-toast-anim-none{transition:none}.ga-toast-swiping,.ga-toast-swiping *{user-select:none;-webkit-user-select:none;cursor:grabbing}.ga-toast-success{--gat-accent: var(--gat-success)}.ga-toast-error{--gat-accent: var(--gat-error)}.ga-toast-warning{--gat-accent: var(--gat-warning)}.ga-toast-info{--gat-accent: var(--gat-info)}.ga-toast-primary{--gat-accent: var(--gat-primary)}.ga-toast-secondary{--gat-accent: var(--gat-secondary)}.ga-toast-loading{--gat-accent: var(--gat-loading)}.ga-toast-content{display:flex;flex-direction:column;gap:4px;flex:1;min-width:0}.ga-toast-header{display:flex;align-items:center;gap:8px;min-width:0}.ga-toast-icon{flex-shrink:0;display:inline-flex;align-items:center;justify-content:center;margin-top:1px;color:var(--gat-accent, var(--gat-info))}.ga-toast-icon svg{width:1.25rem;height:1.25rem;display:block;overflow:visible}.ga-toast-spinner{animation:ga-toast-spin .8s linear infinite}.ga-toast-icon-ring{position:relative;width:2rem;height:2rem;margin-top:0}.ga-toast-icon-ring>svg:not(.ga-toast-ring){width:1.1rem;height:1.1rem}.ga-toast-ring{position:absolute;inset:0;width:100%!important;height:100%!important;transform:rotate(-90deg);overflow:visible}.ga-toast-ring-track{fill:none;stroke:var(--gat-chip);stroke-width:2.4}.ga-toast-ring-bar{fill:none;stroke:var(--gat-accent, var(--gat-info));stroke-width:2.4;stroke-linecap:round}@media(prefers-reduced-motion:no-preference){.ga-toast-icon .ga-ic-ring{stroke-dasharray:64;stroke-dashoffset:64;animation:ga-toast-ic-draw .5s var(--gat-ease) .02s forwards}.ga-toast-icon .ga-ic-draw{stroke-dasharray:28;stroke-dashoffset:28;animation:ga-toast-ic-draw .4s var(--gat-ease) .16s forwards}}@keyframes ga-toast-ic-draw{to{stroke-dashoffset:0}}.ga-toast-avatar{flex-shrink:0;width:34px;height:34px;border-radius:50%;object-fit:cover;border:1px solid var(--gat-border)}.ga-toast-unread-dot{flex-shrink:0;width:8px;height:8px;border-radius:50%;background:var(--gat-accent, var(--gat-info))}.ga-toast-title{font-weight:600;font-size:.9rem;color:var(--gat-text);flex:1;min-width:0;letter-spacing:-.011em}.ga-toast-title-truncate{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ga-toast-status{flex-shrink:0;padding:2px 9px;border-radius:999px;font-size:.6875rem;font-weight:600;text-transform:uppercase;letter-spacing:.04em;color:var(--gat-accent, var(--gat-info));color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 58%,var(--gat-text));background:var(--gat-chip);background:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 18%,transparent)}.ga-toast-close{flex-shrink:0;align-self:flex-start;margin-top:-1px;margin-inline-end:-4px;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:none;border-radius:7px;color:var(--gat-text-muted);background:transparent;cursor:pointer;opacity:.9;transition:background .15s ease,color .15s ease,opacity .15s ease}.ga-toast:hover .ga-toast-close,.ga-toast:focus-within .ga-toast-close{opacity:1}.ga-toast-close svg{width:15px;height:15px;display:block}.ga-toast-close:hover{background:var(--gat-chip);color:var(--gat-text)}.ga-toast-close:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-body{min-width:0}.ga-toast-meta{font-size:.75rem;color:var(--gat-text-muted);margin-bottom:2px}.ga-toast-message{color:var(--gat-text-soft);font-size:.85rem;word-break:break-word;max-height:40vh;overflow-y:auto;overscroll-behavior:contain}.ga-toast-message a{color:var(--gat-accent, var(--gat-info));font-weight:500;text-decoration:underline}.ga-toast:not([class*=-filled]) .ga-toast-content>.ga-toast-body:only-child .ga-toast-message{color:var(--gat-text)}.ga-toast-actions{display:flex;gap:8px;margin-top:2px}.ga-toast-btn{flex:1;padding:8px 14px;font:inherit;font-size:.8125rem;font-weight:600;border-radius:9px;border:1px solid var(--gat-border);background:var(--gat-chip);color:var(--gat-text);cursor:pointer;transition:filter .15s ease,background .15s ease}.ga-toast-btn:hover{filter:brightness(.97)}.ga-toast-btn:focus-visible{outline:2px solid currentColor;outline-offset:2px}.ga-toast-btn-primary{background:var(--gat-accent, var(--gat-primary));border-color:transparent;color:#fff}.ga-toast-btn-primary:hover{filter:brightness(1.06)}.ga-toast-progress{position:absolute;left:0;bottom:0;height:2px;width:100%;transform:scaleX(1);transform-origin:left center;background:var(--gat-accent, var(--gat-info));opacity:.4}.ga-toast-progress-top{top:0;bottom:auto}.ga-toast-steps{display:flex;gap:4px;margin-top:4px}.ga-toast-step{flex:1;height:3px;border-radius:999px;background:var(--gat-chip)}.ga-toast-step-active{background:var(--gat-accent, var(--gat-info))}.ga-toast[class*=-filled]{background:var(--gat-accent, var(--gat-info));border-color:transparent;color:#fff}.ga-toast-success[class*=-filled]{background:#15803d}.ga-toast-primary[class*=-filled]{background:#4f46e5}.ga-toast[class*=-filled] .ga-toast-title,.ga-toast[class*=-filled] .ga-toast-message,.ga-toast[class*=-filled] .ga-toast-meta,.ga-toast[class*=-filled] .ga-toast-icon,.ga-toast[class*=-filled] .ga-toast-close{color:#fff}.ga-toast[class*=-filled] .ga-toast-close:hover{background:#fff3}.ga-toast[class*=-filled] .ga-toast-progress{background:#fff;opacity:.55}.ga-toast[class*=-filled] .ga-toast-step{background:#ffffff47}.ga-toast[class*=-filled] .ga-toast-step-active{background:#fff}.ga-toast[class*=-filled] .ga-toast-status{color:#fff;background:#ffffff38}.ga-toast[class*=-filled] .ga-toast-message a{color:#fff;text-decoration:underline}.ga-toast-warning[class*=-filled],.ga-toast-warning[class*=-filled] .ga-toast-title,.ga-toast-warning[class*=-filled] .ga-toast-message,.ga-toast-warning[class*=-filled] .ga-toast-meta,.ga-toast-warning[class*=-filled] .ga-toast-icon,.ga-toast-warning[class*=-filled] .ga-toast-close,.ga-toast-warning[class*=-filled] .ga-toast-message a{color:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-progress{background:#2e2100;opacity:.6}.ga-toast-warning[class*=-filled] .ga-toast-step{background:#0000002e}.ga-toast-warning[class*=-filled] .ga-toast-step-active{background:#2e2100}.ga-toast-warning[class*=-filled] .ga-toast-status{color:#2e2100;background:#00000029}.ga-toast-warning[class*=-filled] .ga-toast-close:hover{background:#00000024}.ga-toast[class*=-light]{background:var(--gat-surface);background-image:linear-gradient(0deg,color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent),color-mix(in srgb,var(--gat-accent, var(--gat-info)) 14%,transparent));border-color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 38%,var(--gat-border))}.ga-toast[class*=-light] .ga-toast-meta{color:var(--gat-text-soft)}.ga-toast[class*=-light] .ga-toast-message a{color:color-mix(in srgb,var(--gat-accent, var(--gat-info)) 55%,var(--gat-text));text-decoration:underline}.ga-toast-xs{padding:10px 13px;font-size:.78rem}.ga-toast-xs .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-xs .ga-toast-message{font-size:.78rem}.ga-toast-sm{padding:11px 14px;gap:9px}.ga-toast-lg{padding:18px 20px}.ga-toast-lg .ga-toast-title{font-size:1rem}.ga-toast-lg .ga-toast-message{font-size:.95rem}.ga-toast-lg .ga-toast-icon svg{width:1.4rem;height:1.4rem}.ga-toast-xl{padding:22px 24px}.ga-toast-xl .ga-toast-title{font-size:1.125rem}.ga-toast-xl .ga-toast-message{font-size:1.05rem}.ga-toast-xl .ga-toast-icon svg{width:1.6rem;height:1.6rem}.ga-toast-compact{align-items:center;gap:10px;padding:10px 14px}.ga-toast-compact .ga-toast-content{gap:2px}.ga-toast-compact .ga-toast-icon{margin-top:0}.ga-toast-compact .ga-toast-close{align-self:center;margin-top:0}.ga-toast-compact .ga-toast-steps{display:none}.ga-toast-compact .ga-toast-icon svg{width:1.05rem;height:1.05rem}.ga-toast-live-region{position:fixed;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);clip-path:inset(50%);white-space:nowrap;border:0}@media(max-width:520px){.ga-toast-container{--gat-width: auto;left:var(--gat-edge);right:var(--gat-edge);transform:none}.ga-toast-container-top-center,.ga-toast-container-bottom-center,.ga-toast-container-middle-center{transform:none}}[dir=rtl] .ga-toast-progress{transform-origin:right center}@media(prefers-reduced-motion:reduce){.ga-toast{transition:opacity .15s ease}.ga-toast-spinner{animation-duration:1.4s}}@media(prefers-reduced-transparency:reduce){.ga-toast-glass{background:var(--gat-surface-solid);backdrop-filter:none;-webkit-backdrop-filter:none}}.ga-toast-custom{min-width:0}.ga-toast-has-custom{padding:0}.ga-toast-has-custom .ga-toast-close{position:absolute;inset-block-start:8px;inset-inline-end:8px;z-index:1}@keyframes ga-toast-spin{to{transform:rotate(360deg)}}';
|
|
3
3
|
|
|
4
4
|
// src/index.ts
|
|
5
5
|
var canUseDOM = typeof window !== "undefined" && typeof document !== "undefined";
|
|
@@ -112,13 +112,41 @@ function isRTL() {
|
|
|
112
112
|
const dir = document.documentElement.getAttribute("dir") || document.body && document.body.getAttribute("dir");
|
|
113
113
|
return dir === "rtl";
|
|
114
114
|
}
|
|
115
|
-
function
|
|
116
|
-
|
|
117
|
-
|
|
115
|
+
function composeTransform({
|
|
116
|
+
y = "0px",
|
|
117
|
+
x = "0px",
|
|
118
|
+
scale = 1,
|
|
119
|
+
rotate = 0
|
|
120
|
+
}) {
|
|
121
|
+
return `translateY(${y}) translateX(${x}) scale(${scale}) rotate(${rotate}deg)`;
|
|
122
|
+
}
|
|
123
|
+
function stackY(position, offset = "0px") {
|
|
124
|
+
if (!position.startsWith("middle")) return offset;
|
|
125
|
+
const negative = offset.startsWith("-");
|
|
126
|
+
return `calc(-50% ${negative ? "-" : "+"} ${negative ? offset.slice(1) : offset})`;
|
|
127
|
+
}
|
|
128
|
+
function offscreenTransform(position, animation) {
|
|
129
|
+
const y = stackY(position);
|
|
118
130
|
const rtl = isRTL();
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
131
|
+
const edge = position.endsWith("start") ? rtl ? "115%" : "-115%" : position.endsWith("end") ? rtl ? "-115%" : "115%" : null;
|
|
132
|
+
const offY = stackY(position, verticalDir(position) === 1 ? "-140%" : "140%");
|
|
133
|
+
switch (animation) {
|
|
134
|
+
case "none":
|
|
135
|
+
case "fade":
|
|
136
|
+
return composeTransform({ y });
|
|
137
|
+
case "scale":
|
|
138
|
+
return composeTransform({ y, scale: 0.75 });
|
|
139
|
+
case "zoom":
|
|
140
|
+
return composeTransform({ y, scale: 1.25 });
|
|
141
|
+
case "drop":
|
|
142
|
+
return composeTransform({ y: stackY(position, "-160%") });
|
|
143
|
+
case "flip":
|
|
144
|
+
return `${composeTransform({ y })} perspective(900px) rotateX(-88deg)`;
|
|
145
|
+
case "swing":
|
|
146
|
+
return edge ? composeTransform({ y, x: edge, rotate: edge.startsWith("-") ? -7 : 7 }) : composeTransform({ y: offY, rotate: -7 });
|
|
147
|
+
default:
|
|
148
|
+
return edge ? composeTransform({ y, x: edge }) : composeTransform({ y: offY });
|
|
149
|
+
}
|
|
122
150
|
}
|
|
123
151
|
function swipeOpacity(dx) {
|
|
124
152
|
return Math.max(0.15, 1 - Math.abs(dx) / 220);
|
|
@@ -347,9 +375,11 @@ function makeToaster(config = {}) {
|
|
|
347
375
|
scale = Math.max(1 - frontIndex * scaleStep, 0.85);
|
|
348
376
|
opacity = overflow ? 0 : 1;
|
|
349
377
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
378
|
+
inst.el.style.transform = composeTransform({
|
|
379
|
+
y: stackY(position, `${translateY}px`),
|
|
380
|
+
x: inst.swipeX ? `${inst.swipeX}px` : "0px",
|
|
381
|
+
scale
|
|
382
|
+
});
|
|
353
383
|
inst.el.style.opacity = inst.swipeX ? String(swipeOpacity(inst.swipeX)) : String(opacity);
|
|
354
384
|
inst.el.style.zIndex = String(1e3 + front.length - frontIndex);
|
|
355
385
|
inst.el.style.pointerEvents = opacity === 0 ? "none" : "auto";
|
|
@@ -441,7 +471,7 @@ function makeToaster(config = {}) {
|
|
|
441
471
|
`ga-toast-${type}`,
|
|
442
472
|
opts.size ? `ga-toast-${opts.size}` : "",
|
|
443
473
|
opts.variant ? `ga-toast-${type}-${opts.variant}` : "",
|
|
444
|
-
opts.animation
|
|
474
|
+
opts.animation ? `ga-toast-anim-${opts.animation}` : "",
|
|
445
475
|
opts.compact ? "ga-toast-compact" : "",
|
|
446
476
|
glass ? "ga-toast-glass" : "",
|
|
447
477
|
surfaceMode === "outline" ? "ga-toast-outline" : "",
|
|
@@ -739,7 +769,10 @@ function makeToaster(config = {}) {
|
|
|
739
769
|
if (Math.abs(dx) > THRESHOLD) {
|
|
740
770
|
const dir = dx > 0 ? 1 : -1;
|
|
741
771
|
inst.el.style.transition = "transform 0.2s ease, opacity 0.2s ease";
|
|
742
|
-
inst.el.style.transform =
|
|
772
|
+
inst.el.style.transform = composeTransform({
|
|
773
|
+
y: stackY(inst.opts.position),
|
|
774
|
+
x: `${dir * 400}px`
|
|
775
|
+
});
|
|
743
776
|
inst.el.style.opacity = "0";
|
|
744
777
|
close(inst.id);
|
|
745
778
|
} else {
|
|
@@ -862,7 +895,7 @@ function makeToaster(config = {}) {
|
|
|
862
895
|
showBackdrop();
|
|
863
896
|
}
|
|
864
897
|
const container = getContainer(opts.position);
|
|
865
|
-
el.style.transform = offscreenTransform(opts.position);
|
|
898
|
+
el.style.transform = offscreenTransform(opts.position, opts.animation);
|
|
866
899
|
el.style.opacity = "0";
|
|
867
900
|
container.appendChild(el);
|
|
868
901
|
attachHandlers(inst, opts);
|
|
@@ -925,7 +958,10 @@ function makeToaster(config = {}) {
|
|
|
925
958
|
if (!inst.swipeX) {
|
|
926
959
|
el.style.transition = "";
|
|
927
960
|
el.classList.add("ga-toast-hide");
|
|
928
|
-
el.style.transform = offscreenTransform(
|
|
961
|
+
el.style.transform = offscreenTransform(
|
|
962
|
+
inst.opts.position,
|
|
963
|
+
inst.opts.animation
|
|
964
|
+
);
|
|
929
965
|
el.style.opacity = "0";
|
|
930
966
|
}
|
|
931
967
|
let removed = false;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ga-toasts",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0",
|
|
4
4
|
"description": "Modern, accessible, dependency-free toast notifications for the web. Fully themeable (createToaster + design tokens), stacked animations, 7 types, 9 positions, dark mode, swipe-to-dismiss, and first-class TypeScript support.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -44,6 +44,10 @@
|
|
|
44
44
|
"keywords": [
|
|
45
45
|
"toast",
|
|
46
46
|
"toasts",
|
|
47
|
+
"toast notifications",
|
|
48
|
+
"javascript toast",
|
|
49
|
+
"toast notification library",
|
|
50
|
+
"toastify alternative",
|
|
47
51
|
"notification",
|
|
48
52
|
"notifications",
|
|
49
53
|
"snackbar",
|