Skip to content

Commit 189e7fd

Browse files
committed
docs: Simplify architecture page and fix fullscreen visibility
- Dramatically simplified architecture page (686 → ~150 lines) - Removed overwhelming technical details - Focused on what developers need to know - Fixed fullscreen visibility by using already-rendered SVG directly - Removed complex re-rendering logic that was causing issues - Static scanner properly integrated into main diagram
1 parent 2ccb9e0 commit 189e7fd

2 files changed

Lines changed: 150 additions & 730 deletions

File tree

docs_site/_layouts/default.html

Lines changed: 47 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -578,28 +578,6 @@
578578
const overlay = document.getElementById('diagram-fullscreen-overlay');
579579
const content = overlay.querySelector('.diagram-fullscreen-content');
580580

581-
// Get the original Mermaid code from the source
582-
let mermaidCode = null;
583-
const originalPre = diagramElement.closest('pre');
584-
if (originalPre) {
585-
const codeBlock = originalPre.querySelector('code.language-mermaid');
586-
if (codeBlock) {
587-
mermaidCode = codeBlock.textContent || codeBlock.innerText;
588-
}
589-
}
590-
591-
// If we can't find the code, try to find it from all code blocks
592-
if (!mermaidCode) {
593-
const allCodeBlocks = document.querySelectorAll('code.language-mermaid');
594-
for (const codeBlock of allCodeBlocks) {
595-
const parentPre = codeBlock.closest('pre');
596-
if (parentPre && parentPre.querySelector('.mermaid') === diagramElement) {
597-
mermaidCode = codeBlock.textContent || codeBlock.innerText;
598-
break;
599-
}
600-
}
601-
}
602-
603581
content.innerHTML = '';
604582

605583
// Create wrapper for zoom and drag functionality
@@ -614,66 +592,28 @@
614592
wrapper.style.minWidth = '100%';
615593
wrapper.style.minHeight = '100%';
616594

617-
// If we have the Mermaid code, create a new div and let Mermaid render it
618-
if (mermaidCode) {
619-
const mermaidDiv = document.createElement('div');
620-
mermaidDiv.className = 'mermaid';
621-
mermaidDiv.textContent = mermaidCode;
622-
mermaidDiv.style.display = 'block';
623-
mermaidDiv.style.visibility = 'visible';
624-
mermaidDiv.style.opacity = '1';
625-
mermaidDiv.style.width = 'auto';
626-
mermaidDiv.style.height = 'auto';
627-
wrapper.appendChild(mermaidDiv);
628-
629-
// Re-render with Mermaid
630-
mermaid.run({ nodes: [mermaidDiv] }).then(() => {
631-
const svg = mermaidDiv.querySelector('svg');
632-
if (svg) {
633-
svg.style.display = 'block';
634-
svg.style.visibility = 'visible';
635-
svg.style.opacity = '1';
636-
svg.style.width = 'auto';
637-
svg.style.height = 'auto';
638-
svg.style.maxWidth = 'none';
639-
svg.style.maxHeight = 'none';
640-
svg.removeAttribute('style'); // Remove any inline styles that might hide it
641-
svg.setAttribute('style', 'display: block !important; visibility: visible !important; opacity: 1 !important; width: auto !important; height: auto !important;');
642-
}
643-
644-
// Also ensure the mermaid div itself is visible
645-
mermaidDiv.style.display = 'block';
646-
mermaidDiv.style.visibility = 'visible';
647-
mermaidDiv.style.opacity = '1';
648-
}).catch((err) => {
649-
console.error('Mermaid rendering error:', err);
650-
// Fallback: clone the existing diagram
651-
const clone = diagramElement.cloneNode(true);
652-
clone.style.display = 'block';
653-
clone.style.visibility = 'visible';
654-
clone.style.opacity = '1';
655-
wrapper.appendChild(clone);
656-
});
657-
} else {
658-
// Fallback: clone the existing diagram
659-
const clone = diagramElement.cloneNode(true);
660-
clone.style.display = 'block';
661-
clone.style.visibility = 'visible';
662-
clone.style.opacity = '1';
663-
664-
// Ensure SVG in clone is visible
665-
const svg = clone.querySelector('svg');
666-
if (svg) {
667-
svg.style.display = 'block';
668-
svg.style.visibility = 'visible';
669-
svg.style.opacity = '1';
670-
svg.style.width = 'auto';
671-
svg.style.height = 'auto';
672-
}
673-
674-
wrapper.appendChild(clone);
595+
// Clone the existing rendered diagram (already has SVG)
596+
const clone = diagramElement.cloneNode(true);
597+
clone.style.display = 'block';
598+
clone.style.visibility = 'visible';
599+
clone.style.opacity = '1';
600+
clone.style.width = 'auto';
601+
clone.style.height = 'auto';
602+
603+
// Ensure SVG in clone is visible
604+
const svg = clone.querySelector('svg');
605+
if (svg) {
606+
// Remove any existing styles that might hide it
607+
svg.removeAttribute('style');
608+
// Set explicit visible styles
609+
svg.style.cssText = 'display: block !important; visibility: visible !important; opacity: 1 !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important;';
610+
svg.style.display = 'block';
611+
svg.style.visibility = 'visible';
612+
svg.style.opacity = '1';
675613
}
676614

615+
wrapper.appendChild(clone);
616+
677617
content.appendChild(wrapper);
678618

679619
// Ensure content can scroll to show entire diagram
@@ -697,46 +637,36 @@
697637
overlay.classList.add('active');
698638
document.body.style.overflow = 'hidden';
699639

700-
// Ensure visibility and center after rendering
640+
// Ensure visibility immediately (no need to wait, SVG is already rendered)
641+
wrapper.style.display = 'flex';
642+
wrapper.style.visibility = 'visible';
643+
wrapper.style.opacity = '1';
644+
wrapper.style.width = 'fit-content';
645+
wrapper.style.height = 'fit-content';
646+
647+
const mermaidEl = wrapper.querySelector('.mermaid');
648+
if (mermaidEl) {
649+
mermaidEl.style.display = 'block';
650+
mermaidEl.style.visibility = 'visible';
651+
mermaidEl.style.opacity = '1';
652+
mermaidEl.style.width = 'auto';
653+
mermaidEl.style.height = 'auto';
654+
}
655+
656+
const svg = wrapper.querySelector('svg');
657+
if (svg) {
658+
svg.style.cssText = 'display: block !important; visibility: visible !important; opacity: 1 !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important;';
659+
}
660+
661+
// Center scroll position after a brief moment
701662
setTimeout(() => {
702-
wrapper.style.display = 'flex';
703-
wrapper.style.visibility = 'visible';
704-
wrapper.style.opacity = '1';
705-
wrapper.style.width = 'fit-content';
706-
wrapper.style.height = 'fit-content';
707-
708-
const mermaidEl = wrapper.querySelector('.mermaid');
709-
if (mermaidEl) {
710-
mermaidEl.style.display = 'block';
711-
mermaidEl.style.visibility = 'visible';
712-
mermaidEl.style.opacity = '1';
713-
mermaidEl.style.width = 'auto';
714-
mermaidEl.style.height = 'auto';
663+
if (content.scrollHeight > content.clientHeight) {
664+
content.scrollTop = (content.scrollHeight - content.clientHeight) / 2;
715665
}
716-
717-
const svg = wrapper.querySelector('svg');
718-
if (svg) {
719-
svg.style.display = 'block';
720-
svg.style.visibility = 'visible';
721-
svg.style.opacity = '1';
722-
svg.style.width = 'auto';
723-
svg.style.height = 'auto';
724-
svg.style.maxWidth = 'none';
725-
svg.style.maxHeight = 'none';
726-
// Force visibility with important
727-
svg.setAttribute('style', 'display: block !important; visibility: visible !important; opacity: 1 !important; width: auto !important; height: auto !important; max-width: none !important; max-height: none !important;');
666+
if (content.scrollWidth > content.clientWidth) {
667+
content.scrollLeft = (content.scrollWidth - content.clientWidth) / 2;
728668
}
729-
730-
// Center scroll position
731-
setTimeout(() => {
732-
if (content.scrollHeight > content.clientHeight) {
733-
content.scrollTop = (content.scrollHeight - content.clientHeight) / 2;
734-
}
735-
if (content.scrollWidth > content.clientWidth) {
736-
content.scrollLeft = (content.scrollWidth - content.clientWidth) / 2;
737-
}
738-
}, 200);
739-
}, 500); // Increased timeout to ensure Mermaid has finished rendering
669+
}, 100);
740670

741671
// Focus on close button for accessibility
742672
const closeBtn = overlay.querySelector('.close-fullscreen-btn');

0 commit comments

Comments
 (0)