const container = () => document.getElementById('modal-container'); export function showModal(html) { container().innerHTML = ``; } export function closeModal() { container().innerHTML = ''; } export function closeOnBg(e) { if (e.target.classList.contains('modal-overlay')) closeModal(); } export function stepperHtml(id, value, step, placeholder, inputmode = 'decimal') { const v = value !== '' && value != null ? value : ''; return `
`; } export function stepValue(id, delta) { const input = document.getElementById(id); if (!input) return; const current = parseFloat(input.value) || 0; const step = parseFloat(input.step) || 1; const newVal = Math.max(0, current + delta); input.value = parseFloat((Math.round(newVal / step) * step).toFixed(4)); } window.ModalBase = { showModal, closeModal, close: closeModal, closeOnBg, stepValue };