/** * Ritz Debug Bar Controller */ class RitzDebug { constructor() { this.debugBar = document.getElementById('ritz-debug'); this.isOpen = false; // Setup keyboard shortcut (Ctrl+`) document.addEventListener('keydown', (e) => { if (e.ctrlKey && e.key === '`') { e.preventDefault(); this.toggle(); } }); // Show hint on first load this.showHint(); } toggle() { this.isOpen = !this.isOpen; if (this.debugBar) { if (this.isOpen) { this.debugBar.classList.remove('hidden'); document.body.classList.add('debug-open'); } else { this.debugBar.classList.add('hidden'); document.body.classList.remove('debug-open'); } } } open() { this.isOpen = true; if (this.debugBar) { this.debugBar.classList.remove('hidden'); document.body.classList.add('debug-open'); } } close() { this.isOpen = false; if (this.debugBar) { this.debugBar.classList.add('hidden'); document.body.classList.remove('debug-open'); } } showHint() { // Show toggle hint for 3 seconds const hint = document.createElement('div'); hint.className = 'debug-toggle-hint'; hint.textContent = 'Press Ctrl+` to toggle debug'; document.body.appendChild(hint); setTimeout(() => { hint.remove(); }, 3000); } log(message, type = 'info') { const status = document.getElementById('status'); if (status) { status.textContent = message; status.className = 'status ' + type; } console.log(`[Ritz] ${message}`); } } // Initialize debug controller const ritzDebug = new RitzDebug(); // Export if (typeof module !== 'undefined' && module.exports) { module.exports = RitzDebug; } else { window.RitzDebug = RitzDebug; window.ritzDebug = ritzDebug; }