From a5156998c089cef18e20e200932413f259f6ba70 Mon Sep 17 00:00:00 2001 From: ubay1 Date: Mon, 27 Jul 2026 14:31:51 +0700 Subject: [PATCH 1/2] add component ClientLink for SPA navigation for generator web --- .gitignore | 5 + src/generators/web/README.md | 38 ++++ .../web/ui/components/ClientLink/index.jsx | 171 ++++++++++++++++++ .../web/ui/components/SideBar/index.jsx | 5 +- 4 files changed, 217 insertions(+), 2 deletions(-) create mode 100644 src/generators/web/ui/components/ClientLink/index.jsx diff --git a/.gitignore b/.gitignore index ac08a4ba..862ff8a7 100644 --- a/.gitignore +++ b/.gitignore @@ -20,3 +20,8 @@ node # Playwright playwright-report/ test-results/ + +# Local documentation (ignored) +LOCAL_LINK_GUIDE.md +WEB_GENERATOR_GUIDE.md +CLIENT_LINK_GUIDE.md diff --git a/src/generators/web/README.md b/src/generators/web/README.md index 17f8e138..7054f0af 100644 --- a/src/generators/web/README.md +++ b/src/generators/web/README.md @@ -128,3 +128,41 @@ Since the template supports arbitrary JS expressions, you can use conditionals a ${importMap} ``` + +### Client-Side SPA Navigation (`ClientLink` & `navigate`) + +`doc-kit` provides a built-in zero-reload navigation solution for static web output without requiring browser storage (`sessionStorage`/`localStorage`). + +#### Features +- **Zero-Reload Navigation**: Intercepts internal link clicks (``), fetches target page HTML in the background, and updates the `#root` container. +- **Scroll Position Preservation**: Retains the sidebar (`