Skip to content

Commit 2257f22

Browse files
perf(theme): revert full-page transitions to restore fast, lightweight color switches
1 parent 79c17b8 commit 2257f22

4 files changed

Lines changed: 6 additions & 48 deletions

File tree

desktop-app/resources/js/script.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5513,13 +5513,6 @@ document.addEventListener("DOMContentLoaded", function () {
55135513
}
55145514
themeToggle.addEventListener("click", function () {
55155515
_lastRenderedContent = null;
5516-
5517-
if (_themeTransitionTimeout) {
5518-
clearTimeout(_themeTransitionTimeout);
5519-
}
5520-
// Smoothly transition all background, border, text, fill, and stroke colors on the entire page
5521-
document.documentElement.classList.add("theme-transitioning");
5522-
55235516
const theme =
55245517
document.documentElement.getAttribute("data-theme") === "dark"
55255518
? "light"
@@ -5532,10 +5525,6 @@ document.addEventListener("DOMContentLoaded", function () {
55325525
} else {
55335526
themeToggle.innerHTML = '<i class="bi bi-moon"></i>';
55345527
}
5535-
5536-
_themeTransitionTimeout = setTimeout(function() {
5537-
document.documentElement.classList.remove("theme-transitioning");
5538-
}, 300);
55395528

55405529
// PERF-004: Only re-render Mermaid diagrams on theme change instead of full renderMarkdown()
55415530
// CSS custom properties handle all other theme transitions automatically.
@@ -5556,7 +5545,7 @@ document.addEventListener("DOMContentLoaded", function () {
55565545
clearTimeout(_mermaidThemeReinitTimeout);
55575546
}
55585547

5559-
// Wait 150ms for the fade-out animation to complete, then re-render in the background
5548+
// Wait 200ms for the fade-out animation to complete, then re-render in the background
55605549
_mermaidThemeReinitTimeout = setTimeout(function() {
55615550
initMermaid(true); // Force re-init with new theme
55625551
try {
@@ -5600,7 +5589,7 @@ document.addEventListener("DOMContentLoaded", function () {
56005589
c.classList.remove('theme-switching');
56015590
});
56025591
}
5603-
}, 150); // 150ms delay perfectly aligns with our 150ms CSS fade transition!
5592+
}, 200); // 200ms delay perfectly aligns with our CSS fade transition!
56045593
}
56055594
});
56065595

desktop-app/resources/styles.css

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,15 +3633,9 @@ html[lang="ko"] .markdown-body h1, html[lang="ko"] .markdown-body h2, html[lang=
36333633
animation: skeleton-shimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
36343634
}
36353635

3636-
/* Full-page unified theme transition */
3637-
html.theme-transitioning,
3638-
html.theme-transitioning * {
3639-
transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, fill 0.3s ease, stroke 0.3s ease, box-shadow 0.3s ease !important;
3640-
}
3641-
36423636
/* Smooth fade transitions for Mermaid theme switching */
36433637
.mermaid-container .mermaid {
3644-
transition: opacity 0.15s ease-in-out;
3638+
transition: opacity 0.2s ease-in-out;
36453639
opacity: 1;
36463640
}
36473641

@@ -3651,10 +3645,6 @@ html.theme-transitioning * {
36513645

36523646
/* Accessibility: respect user's motion preferences */
36533647
@media (prefers-reduced-motion: reduce) {
3654-
html.theme-transitioning,
3655-
html.theme-transitioning * {
3656-
transition: none !important;
3657-
}
36583648
.mermaid-container .mermaid {
36593649
transition: none;
36603650
}

script.js

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -5513,13 +5513,6 @@ document.addEventListener("DOMContentLoaded", function () {
55135513
}
55145514
themeToggle.addEventListener("click", function () {
55155515
_lastRenderedContent = null;
5516-
5517-
if (_themeTransitionTimeout) {
5518-
clearTimeout(_themeTransitionTimeout);
5519-
}
5520-
// Smoothly transition all background, border, text, fill, and stroke colors on the entire page
5521-
document.documentElement.classList.add("theme-transitioning");
5522-
55235516
const theme =
55245517
document.documentElement.getAttribute("data-theme") === "dark"
55255518
? "light"
@@ -5532,10 +5525,6 @@ document.addEventListener("DOMContentLoaded", function () {
55325525
} else {
55335526
themeToggle.innerHTML = '<i class="bi bi-moon"></i>';
55345527
}
5535-
5536-
_themeTransitionTimeout = setTimeout(function() {
5537-
document.documentElement.classList.remove("theme-transitioning");
5538-
}, 300);
55395528

55405529
// PERF-004: Only re-render Mermaid diagrams on theme change instead of full renderMarkdown()
55415530
// CSS custom properties handle all other theme transitions automatically.
@@ -5556,7 +5545,7 @@ document.addEventListener("DOMContentLoaded", function () {
55565545
clearTimeout(_mermaidThemeReinitTimeout);
55575546
}
55585547

5559-
// Wait 150ms for the fade-out animation to complete, then re-render in the background
5548+
// Wait 200ms for the fade-out animation to complete, then re-render in the background
55605549
_mermaidThemeReinitTimeout = setTimeout(function() {
55615550
initMermaid(true); // Force re-init with new theme
55625551
try {
@@ -5600,7 +5589,7 @@ document.addEventListener("DOMContentLoaded", function () {
56005589
c.classList.remove('theme-switching');
56015590
});
56025591
}
5603-
}, 150); // 150ms delay perfectly aligns with our 150ms CSS fade transition!
5592+
}, 200); // 200ms delay perfectly aligns with our CSS fade transition!
56045593
}
56055594
});
56065595

styles.css

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3633,15 +3633,9 @@ html[lang="ko"] .markdown-body h1, html[lang="ko"] .markdown-body h2, html[lang=
36333633
animation: skeleton-shimmer 1.6s cubic-bezier(0.4, 0, 0.2, 1) infinite;
36343634
}
36353635

3636-
/* Full-page unified theme transition */
3637-
html.theme-transitioning,
3638-
html.theme-transitioning * {
3639-
transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease, fill 0.3s ease, stroke 0.3s ease, box-shadow 0.3s ease !important;
3640-
}
3641-
36423636
/* Smooth fade transitions for Mermaid theme switching */
36433637
.mermaid-container .mermaid {
3644-
transition: opacity 0.15s ease-in-out;
3638+
transition: opacity 0.2s ease-in-out;
36453639
opacity: 1;
36463640
}
36473641

@@ -3651,10 +3645,6 @@ html.theme-transitioning * {
36513645

36523646
/* Accessibility: respect user's motion preferences */
36533647
@media (prefers-reduced-motion: reduce) {
3654-
html.theme-transitioning,
3655-
html.theme-transitioning * {
3656-
transition: none !important;
3657-
}
36583648
.mermaid-container .mermaid {
36593649
transition: none;
36603650
}

0 commit comments

Comments
 (0)