import {showInfoToast, showWarningToast, showErrorToast} from './toast.ts'; import type {Toast} from './toast.ts'; import {registerGlobalInitFunc} from './observer.ts'; import {fomanticQuery} from './fomantic/base.ts'; import {createElementFromHTML} from '../utils/dom.ts'; import {html} from '../utils/html.ts'; type LevelMap = Record Toast | null>; function initDevtestPage() { const toastButtons = document.querySelectorAll('.toast-test-button'); if (toastButtons.length) { const levelMap: LevelMap = {info: showInfoToast, warning: showWarningToast, error: showErrorToast}; for (const el of toastButtons) { el.addEventListener('click', () => { const level = el.getAttribute('data-toast-level')!; const message = el.getAttribute('data-toast-message')!; levelMap[level](message); }); } } const modalButtons = document.querySelector('.modal-buttons'); if (modalButtons) { for (const el of document.querySelectorAll('.ui.modal:not([data-skip-button])')) { const btn = createElementFromHTML(html`