(msg,ms,type)
| 6893 | _copyText(text).then(done).catch(()=>{}); |
| 6894 | } |
| 6895 | function showToast(msg,ms,type){ |
| 6896 | const el=$('toast');if(!el)return; |
| 6897 | const s=String(msg==null?'':msg);let t=type; |
| 6898 | if(!t){const low=s.toLowerCase();if(/fail|error|denied|invalid|unavailable|no active|no workspace match|no model match|no personalities/.test(low))t='error';else if(/warn|queued|takes effect|skipped|fallback/.test(low))t='warning';else if(/saved|created|imported|restored|switched|set to|updated|duplicated|moved to|renamed|deleted|complete|pinned|archived|cleared|stopped/.test(low))t='success';else t='info';} |
| 6899 | const duration=(ms==null)?(t==='error'?TOAST_ERROR_DEFAULT_MS:TOAST_DEFAULT_MS):ms; |
| 6900 | el.className='toast show '+t; |
| 6901 | el.dataset.toastMessage=s; |
| 6902 | if(t==='error') el.innerHTML=`<span class="toast-message">${esc(s)}</span><button class="toast-copy" type="button" data-toast-copy="1" onclick="copyToastText(this);event.stopPropagation()">Copy</button><button class="toast-dismiss" type="button" aria-label="Dismiss error toast" data-toast-dismiss="1" onclick="dismissToast(this);event.stopPropagation()">Dismiss</button>`; |
| 6903 | else el.textContent=s; |
| 6904 | el.onmouseenter=()=>clearToastDismissTimer(el); |
| 6905 | el.onmouseleave=()=>setToastDismissTimer(el,duration); |
| 6906 | el.onfocusin=()=>clearToastDismissTimer(el); |
| 6907 | el.onfocusout=()=>setToastDismissTimer(el,duration); |
| 6908 | el.onclick=t==='error'?null:()=>dismissToast(el); |
| 6909 | setToastDismissTimer(el,duration); |
| 6910 | } |
| 6911 | |
| 6912 | // ── Shared app dialogs ─────────────────────────────────────────────────────── |
| 6913 | // showConfirmDialog(opts) and showPromptDialog(opts) replace browser-native dialog calls |
no test coverage detected