/** * Debug Control - Displays debug information and system messages * Implements the Robustness Principle with Fail Fast mode support */ class DebugControl { constructor() { this.control = Object.create(Control); this.control.config = { icon: '🪲', title: 'Debug', className: 'debug-control', defaultContent: 'Click to view debug information', ariaLabel: 'Debug Control', position: 'w' }; // Bind methods to control this.control.buildContent = () => { const content = this.control.element.querySelector('.control-content'); const messages = window.MarkitectDebugSystem ? window.MarkitectDebugSystem.getMessages() : []; content.innerHTML = `

Debug Messages

${messages.length > 0 ? messages.slice(-10).map(msg => `
[${msg.category}] ${msg.component}: ${msg.message}
${msg.displayTime}
` ).join('') : '

No debug messages yet

' }
`; this.control.isExpanded = true; }; this.control.toggle = () => { if (this.control.isExpanded) { this.control.element.querySelector('.control-content').style.display = 'none'; this.control.isExpanded = false; } else { this.control.buildContent(); this.control.element.querySelector('.control-content').style.display = 'block'; } }; } createControl() { return this.control.createControl(); } } window.DebugControl = DebugControl;