/** * Document Viewer Component * Displays framework documentation with TOC and navigation */ class DocumentViewer { constructor(containerId = 'document-viewer') { this.container = document.getElementById(containerId); this.currentDocument = null; } /** * Render document */ async render(documentSlug) { if (!this.container) { console.error('Document viewer container not found'); return; } try { // Show loading state this.showLoading(); // Fetch document const response = await API.Documents.get(documentSlug); if (!response.success) { throw new Error('Document not found'); } this.currentDocument = response.document; this.showDocument(); } catch (error) { this.showError(error.message); } } /** * Show loading state */ showLoading() { this.container.innerHTML = `
Loading document...
Version ${doc.metadata.version}
` : ''}Created: ${new Date(doc.created_at).toLocaleDateString()}
` : ''} ${doc.updated_at ? `Updated: ${new Date(doc.updated_at).toLocaleDateString()}
` : ''}