/** * Export UI - Dialog and controls for exporting animations as APNG * * Provides a Tasmota-styled dialog with: * - FPS selector (15/30/60 FPS radio buttons) * - Duration input (1-30 seconds) * - Progress bar during export * - Cancel button for in-progress exports * * Part of the Berry Animation Framework Browser Simulator. * Requirements: 11.1.1, 11.1.2, 11.1.6, 11.1.8, 18.4 */ /** * ExportUI - Manages the APNG export dialog and controls */ class ExportUI { /** * Create export UI * @param {Object} options - Configuration options * @param {string} options.dialogId - ID for the dialog overlay (default 'export-dialog') * @param {string} options.exportBtnId - ID of the export button (default 'btn-export') * @param {Function} options.onExport - Callback when export starts (fps, duration) => Promise * @param {Function} options.onCancel - Callback when export is cancelled * @param {Function} options.getStripSize - Function to get current LED strip size */ constructor(options = {}) { this.dialogId = options.dialogId || 'export-dialog'; this.exportBtnId = options.exportBtnId || 'btn-export'; this.onExport = options.onExport || null; this.onCancel = options.onCancel || null; this.getStripSize = options.getStripSize || (() => 30); // State this.isExporting = false; this.isCancelled = false; this.selectedFPS = 30; this.duration = 3; // DOM elements (will be created) this.overlay = null; this.dialog = null; this.exportBtn = null; // Create dialog HTML this._createDialog(); // Setup event handlers this._setupEventHandlers(); } /** * Create the dialog HTML structure * @private */ _createDialog() { // Create overlay this.overlay = document.createElement('div'); this.overlay.id = this.dialogId; this.overlay.className = 'export-dialog-overlay'; // Create dialog content this.overlay.innerHTML = `