From b75f53b501d13e1422f7a2e96028455000779141 Mon Sep 17 00:00:00 2001 From: ChristopherPHolder Date: Sat, 7 Nov 2026 16:33:46 +0100 Subject: [PATCH] docs: same header on every page, no light flash in dark mode The menu button and the docs drawer only existed on doc pages, so the landing page header lost its hamburger on phones. The drawer is now part of every page: beside the content on doc pages, off-canvas behind the menu button below 900px everywhere, hidden on wide non-doc pages. The prerendered pages inlined only the light theme tokens as critical CSS and loaded the stylesheet with the dark block lazily, so a device in dark mode painted light first and switched a moment later. Critical CSS inlining is off for the production build; the stylesheet is small and blocks the first paint, so the page starts in the right theme. --- packages/docs/project.json | 10 +++++++++- packages/docs/src/app/_sidebar.scss | 9 +++++++++ packages/docs/src/app/app.html | 6 ++---- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/packages/docs/project.json b/packages/docs/project.json index a841a739..f881792d 100644 --- a/packages/docs/project.json +++ b/packages/docs/project.json @@ -56,7 +56,15 @@ "maximumError": "16kb" } ], - "outputHashing": "all" + "outputHashing": "all", + "optimization": { + "scripts": true, + "fonts": true, + "styles": { + "minify": true, + "inlineCritical": false + } + } }, "development": { "optimization": false, diff --git a/packages/docs/src/app/_sidebar.scss b/packages/docs/src/app/_sidebar.scss index b0589a8f..6a069a82 100644 --- a/packages/docs/src/app/_sidebar.scss +++ b/packages/docs/src/app/_sidebar.scss @@ -4,6 +4,11 @@ .sidebar { view-transition-name: sidebar; + // Only doc pages show the sidebar beside the content; everywhere else it is + // the drawer below 900px. + .page:not(.page-docs) > & { + display: none; + } position: sticky; top: calc(var(--header-height) + var(--space-8)); max-height: calc(100vh - var(--header-height) - var(--space-8)); @@ -160,6 +165,10 @@ /* Docs menu below 900px: an off-canvas drawer with a dimmed backdrop. */ @media (max-width: 899px) { + .page:not(.page-docs) > .sidebar { + display: block; + } + .sidebar { position: fixed; z-index: 30; diff --git a/packages/docs/src/app/app.html b/packages/docs/src/app/app.html index d8a7554b..d5373255 100644 --- a/packages/docs/src/app/app.html +++ b/packages/docs/src/app/app.html @@ -90,7 +90,6 @@ /> - @if (isDocs()) { - }