feat: Mermaid header bar, Code/Preview toggle, Copy SVG, Download PNG, fullscreen header
CI / lint (push) Successful in 14s
CI / security (push) Successful in 8s
CI / test (push) Successful in 23s
CI / build (push) Successful in 2s

This commit is contained in:
2026-06-05 08:38:21 -04:00
parent fff658d551
commit 28ced406bc
2 changed files with 369 additions and 105 deletions
+77 -26
View File
@@ -7621,7 +7621,6 @@ body.popup-mode .content-area {
========================================================================== */
.mermaid-container {
position: relative;
margin: 12px 0;
border: 1px solid var(--border);
border-radius: 8px;
@@ -7629,6 +7628,55 @@ body.popup-mode .content-area {
background: var(--bg-secondary);
}
/* ── Header bar ── */
.mermaid-header {
display: flex; align-items: center; justify-content: space-between;
padding: 6px 10px;
background: var(--bg-tertiary, #f0f0f5);
border-bottom: 1px solid var(--border);
min-height: 34px;
}
.mermaid-diagram-type {
font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
font-size: 0.75rem; font-weight: 600;
color: var(--text-secondary);
}
.mermaid-header-actions {
display: flex; align-items: center; gap: 2px;
}
/* ── Buttons ── */
.mermaid-btn {
width: 28px; height: 28px;
border: 1px solid transparent; border-radius: 4px;
background: transparent; color: var(--text-secondary);
cursor: pointer; display: flex; align-items: center; justify-content: center;
transition: background 0.12s, color 0.12s;
}
.mermaid-btn:hover { background: var(--bg-primary); color: var(--accent); border-color: var(--border); }
/* ── Code / Preview toggle ── */
.mermaid-toggle {
display: flex; margin-left: 8px;
border: 1px solid var(--border); border-radius: 5px;
overflow: hidden;
}
.mermaid-toggle-btn {
padding: 2px 10px; font-size: 0.7rem; font-weight: 500;
border: none; background: transparent;
color: var(--text-muted, #999); cursor: pointer;
transition: background 0.12s, color 0.12s;
}
.mermaid-toggle-btn.active {
background: var(--bg-primary); color: var(--text-primary);
box-shadow: 0 0 0 1px var(--border);
}
.mermaid-toggle-btn:first-child { border-right: 1px solid var(--border); }
/* ── Body ── */
.mermaid-body {
position: relative;
}
.mermaid-rendered {
padding: 16px;
overflow: hidden;
@@ -7636,25 +7684,17 @@ body.popup-mode .content-area {
display: flex;
justify-content: center;
}
.mermaid-rendered svg { max-width: 100%; height: auto; }
.mermaid-controls {
position: absolute;
top: 6px; right: 6px;
display: flex; gap: 2px;
opacity: 0; transition: opacity 0.15s;
.mermaid-source { padding: 16px; overflow: auto; }
.mermaid-source pre {
margin: 0; padding: 12px;
background: var(--bg-tertiary, #f5f5f5);
border-radius: 4px;
font-size: 0.78rem; line-height: 1.5;
}
.mermaid-container:hover .mermaid-controls { opacity: 1; }
.mermaid-btn {
width: 28px; height: 28px;
border: 1px solid var(--border); border-radius: 4px;
background: var(--bg-primary); color: var(--text-secondary);
cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.mermaid-btn:hover { color: var(--accent); border-color: var(--accent); }
/* ── Error ── */
.mermaid-error {
margin: 12px 0; padding: 12px 16px;
border: 1px solid rgba(239,68,68,0.3); border-radius: 6px;
@@ -7663,22 +7703,33 @@ body.popup-mode .content-area {
}
.mermaid-error strong { display: block; margin-bottom: 4px; }
/* ── Fullscreen ── */
.mermaid-fullscreen-overlay {
position: fixed; top: 0; left: 0; right: 0; bottom: 0;
z-index: 10000; background: rgba(0,0,0,0.85);
display: flex; align-items: center; justify-content: center;
z-index: 10000; background: rgba(0,0,0,0.92);
display: flex; flex-direction: column;
}
.mermaid-fullscreen-close {
position: absolute; top: 16px; right: 16px;
width: 40px; height: 40px; border: 1px solid rgba(255,255,255,0.2);
border-radius: 8px; background: rgba(0,0,0,0.5); color: #fff;
cursor: pointer; display: flex; align-items: center; justify-content: center;
z-index: 1;
.mermaid-fullscreen-header {
display: flex; align-items: center; justify-content: space-between;
padding: 10px 16px;
background: rgba(255,255,255,0.06);
border-bottom: 1px solid rgba(255,255,255,0.08);
min-height: 46px;
flex-shrink: 0;
}
.mermaid-fullscreen-header .mermaid-diagram-type { color: rgba(255,255,255,0.7); }
.mermaid-fullscreen-header .mermaid-btn {
color: rgba(255,255,255,0.6);
}
.mermaid-fullscreen-header .mermaid-btn:hover {
background: rgba(255,255,255,0.1);
color: #fff;
}
.mermaid-fullscreen-close:hover { background: rgba(255,255,255,0.1); }
.mermaid-fullscreen-content {
width: 95vw; height: 95vh;
flex: 1;
display: flex; align-items: center; justify-content: center;
padding: 16px;
overflow: hidden;
}
.mermaid-fullscreen-content svg {
width: 100%; height: 100%;