diff --git a/docs/about.md b/docs/about.md index b570699..06fe908 100644 --- a/docs/about.md +++ b/docs/about.md @@ -13,7 +13,8 @@ XRobot 前身为 [qdu-rm-mcu](https://gitee.com/qsheeeeen/qdu-rm-mcu.git),由 以下名单按人工维护,不包含 bot 账号。 - @Jiu-xiao avatar [@Jiu-xiao](https://github.com/Jiu-xiao) - 框架设计者,`STM32 / CH32 / Linux` 驱动开发 -- @molqzone avatar [@molqzone](https://github.com/molqzone) - `MSPM0`、`DAPLink` +- @molqzone avatar [@molqzone](https://github.com/molqzone) - `DAPLink` +- @xiaoshuaijie avatar [@xiaoshuaijie](https://github.com/xiaoshuaijie) - 网站 UI、`MSPM0` - @CaFeZn avatar [@CaFeZn](https://github.com/CaFeZn) - `HPM` 系列 - @llLeo306 avatar [@llLeo306](https://github.com/llLeo306) - 控制与实时系统 diff --git a/docusaurus.config.js b/docusaurus.config.js index eb8722d..2f90415 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -12,6 +12,11 @@ module.exports = { projectName: 'xrobot-org.github.io', scripts: [ + { + // Page animation switch, applied before first paint: must run synchronously in . + src: '/motion-init.js', + async: false, + }, { src: 'https://static.cloudflareinsights.com/beacon.min.js', defer: true, @@ -63,6 +68,7 @@ module.exports = { theme: { customCss: [ require.resolve('./src/css/xrstyle-tokens.css'), + require.resolve('./src/css/xrstyle-reading.css'), require.resolve('./src/css/xrstyle-components.css'), require.resolve('./src/css/xrstyle-materials.css'), require.resolve('./src/css/custom.css'), @@ -169,10 +175,10 @@ module.exports = { label: '邮箱', href: 'mailto:Cong.Liu_Xiao@outlook.com', }, - { - label: 'QQ群: 608182228', - href: 'https://qm.qq.com/q/RPgE71OXmw', - } + { + label: 'QQ群', + to: '/qq', + } ], }, ], @@ -180,7 +186,7 @@ module.exports = { }, mermaid: { - theme: { light: 'neutral', dark: 'forest' }, + theme: { light: 'neutral', dark: 'dark' }, }, // XRobot Style colours code through CSS (src/css/custom.css), so both Prism themes are empty. diff --git a/i18n/en/code.json b/i18n/en/code.json index 3e31622..32c97c5 100644 --- a/i18n/en/code.json +++ b/i18n/en/code.json @@ -1537,5 +1537,169 @@ }, "home.route.port.more3": { "message": "About Performance" + }, + "appearance.colorModeToggle": { + "message": "Toggle color mode", + "description": "The aria-label of the light/dark mode toggle button" + }, + "appearance.scrollProgress.aria": { + "message": "Page scroll progress {n}%", + "description": "The aria-label of the reading progress circle; {n} is the percentage" + }, + "home.hero.tags": { + "message": "Contact us" + }, + "home.hero.tag.bilibili": { + "message": "Bilibili" + }, + "home.hero.tag.github": { + "message": "GitHub" + }, + "home.hero.tag.email": { + "message": "Email, click to copy" + }, + "home.hero.tag.emailName": { + "message": "Email" + }, + "home.hero.tag.copied": { + "message": "Copied ✓" + }, + "qq.title": { + "message": "Join the community" + }, + "qq.description": { + "message": "Join the XRobot QQ group: scan the QR code, search the group ID or join in one click, plus links to all organization repositories and docs." + }, + "qq.lead": { + "message": "QQ group of the XRobot organization (Qingdao University embedded-software open source) and its derived projects. Questions about using them can be raised directly in the group." + }, + "qq.groupCard": { + "message": "Group QR code" + }, + "qq.groupName": { + "message": "XRobot Group" + }, + "qq.qrAlt": { + "message": "QR code of the XRobot QQ group" + }, + "qq.groupNumber": { + "message": "Group ID" + }, + "qq.copy": { + "message": "Copy" + }, + "qq.copied": { + "message": "Copied ✓" + }, + "qq.join": { + "message": "Join via QQ" + }, + "qq.hint": { + "message": "Scan the QR code with QQ on your phone, or search the group ID in QQ." + }, + "qq.repos": { + "message": "Organization & projects" + }, + "qq.repo.github": { + "message": "GitHub" + }, + "qq.repo.gitee": { + "message": "Gitee" + }, + "qq.repo.docs": { + "message": "Docs" + }, + "appearance.backToTop": { + "message": "Back to top", + "description": "The aria-label and hover label of the back-to-top floating button" + }, + "appearance.codeFold.expand": { + "message": "Show more", + "description": "Button label to expand a collapsed long code block" + }, + "appearance.codeFold.collapse": { + "message": "Show less", + "description": "Button label to collapse a long code block again" + }, + "appearance.codeFold.expanded": { + "message": "Code block expanded", + "description": "Screen-reader announcement after a code block is expanded" + }, + "appearance.codeFold.collapsed": { + "message": "Code block collapsed", + "description": "Screen-reader announcement after a code block is collapsed" + }, + "home.hero.tag.docs": { + "message": "Docs" + }, + "home.hero.tag.qq": { + "message": "QQ Group" + }, + "theme.colorToggle.ariaLabel.mode.system": { + "message": "system mode", + "description": "The name for the system color mode" + }, + "theme.docs.DocCard.categoryDescription.plurals": { + "message": "1 item|{count} items", + "description": "The default description for a category card in the generated index about how many items this category includes" + }, + "theme.admonition.warning": { + "message": "warning", + "description": "The default label used for the Warning admonition (:::warning)" + }, + "theme.DocSidebarItem.expandCategoryAriaLabel": { + "message": "Expand sidebar category '{label}'", + "description": "The ARIA label to expand the sidebar category" + }, + "theme.DocSidebarItem.collapseCategoryAriaLabel": { + "message": "Collapse sidebar category '{label}'", + "description": "The ARIA label to collapse the sidebar category" + }, + "theme.IconExternalLink.ariaLabel": { + "message": "(opens in new tab)", + "description": "The ARIA label for the external link icon" + }, + "theme.navbar.mobileDropdown.collapseButton.expandAriaLabel": { + "message": "Expand the dropdown", + "description": "The ARIA label of the button to expand the mobile dropdown navbar item" + }, + "theme.navbar.mobileDropdown.collapseButton.collapseAriaLabel": { + "message": "Collapse the dropdown", + "description": "The ARIA label of the button to collapse the mobile dropdown navbar item" + }, + "theme.blog.author.pageTitle": { + "message": "{authorName} - {nPosts}", + "description": "The title of the page for a blog author" + }, + "theme.blog.authorsList.pageTitle": { + "message": "Authors", + "description": "The title of the authors page" + }, + "theme.blog.authorsList.viewAll": { + "message": "View all authors", + "description": "The label of the link targeting the blog authors page" + }, + "theme.blog.author.noPosts": { + "message": "This author has not written any posts yet.", + "description": "The text for authors with 0 blog post" + }, + "theme.contentVisibility.unlistedBanner.title": { + "message": "Unlisted page", + "description": "The unlisted content banner title" + }, + "theme.contentVisibility.unlistedBanner.message": { + "message": "This page is unlisted. Search engines will not index it, and only users having a direct link can access it.", + "description": "The unlisted content banner message" + }, + "theme.contentVisibility.draftBanner.title": { + "message": "Draft page", + "description": "The draft content banner title" + }, + "theme.contentVisibility.draftBanner.message": { + "message": "This page is a draft. It will only be visible in dev and be excluded from the production build.", + "description": "The draft content banner message" + }, + "qq.copyFailed": { + "message": "Copy failed" } } diff --git a/i18n/en/docusaurus-plugin-content-docs/current.json b/i18n/en/docusaurus-plugin-content-docs/current.json index dd30528..9be0036 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current.json +++ b/i18n/en/docusaurus-plugin-content-docs/current.json @@ -2,5 +2,97 @@ "version.label": { "message": "Next", "description": "The label for version current" + }, + "sidebar.docs.category.Environment Setup": { + "message": "Environment Setup", + "description": "The label for category 'Environment Setup' in sidebar 'docs'" + }, + "sidebar.docs.category.Basic Programming (LibXR)": { + "message": "Basic Programming (LibXR)", + "description": "The label for category 'Basic Programming (LibXR)' in sidebar 'docs'" + }, + "sidebar.docs.category.Core API": { + "message": "Core API", + "description": "The label for category 'Core API' in sidebar 'docs'" + }, + "sidebar.docs.category.Data Structures": { + "message": "Data Structures", + "description": "The label for category 'Data Structures' in sidebar 'docs'" + }, + "sidebar.docs.category.Middleware": { + "message": "Middleware", + "description": "The label for category 'Middleware' in sidebar 'docs'" + }, + "sidebar.docs.category.消息系统": { + "message": "Message System", + "description": "The label for category '消息系统' in sidebar 'docs'" + }, + "sidebar.docs.category.Operating System": { + "message": "Operating System", + "description": "The label for category 'Operating System' in sidebar 'docs'" + }, + "sidebar.docs.category.Device Drivers": { + "message": "Device Drivers", + "description": "The label for category 'Device Drivers' in sidebar 'docs'" + }, + "sidebar.docs.category.Utilities and Math": { + "message": "Utilities and Math", + "description": "The label for category 'Utilities and Math' in sidebar 'docs'" + }, + "sidebar.docs.category.Code Generation": { + "message": "Code Generation", + "description": "The label for category 'Code Generation' in sidebar 'docs'" + }, + "sidebar.docs.category.STM32 Code Generation": { + "message": "STM32 Code Generation", + "description": "The label for category 'STM32 Code Generation' in sidebar 'docs'" + }, + "sidebar.docs.category.Project Management (XRobot)": { + "message": "Project Management (XRobot)", + "description": "The label for category 'Project Management (XRobot)' in sidebar 'docs'" + }, + "sidebar.docs.category.Debug Interfaces": { + "message": "Debug Interfaces", + "description": "The label for category 'Debug Interfaces' in sidebar 'docs'" + }, + "sidebar.docs.category.SWD Debug Interface": { + "message": "SWD Debug Interface", + "description": "The label for category 'SWD Debug Interface' in sidebar 'docs'" + }, + "sidebar.docs.category.XRUSB Stack": { + "message": "XRUSB Stack", + "description": "The label for category 'XRUSB Stack' in sidebar 'docs'" + }, + "sidebar.docs.category.Platform-Specific Implementations": { + "message": "Platform-Specific Implementations", + "description": "The label for category 'Platform-Specific Implementations' in sidebar 'docs'" + }, + "sidebar.docs.category.Device Stack": { + "message": "Device Stack", + "description": "The label for category 'Device Stack' in sidebar 'docs'" + }, + "sidebar.docs.category.Advanced Programming": { + "message": "Advanced Programming", + "description": "The label for category 'Advanced Programming' in sidebar 'docs'" + }, + "sidebar.docs.category.Core Mechanisms": { + "message": "Core Mechanisms", + "description": "The label for category 'Core Mechanisms' in sidebar 'docs'" + }, + "sidebar.docs.category.Middleware Internals": { + "message": "Middleware Internals", + "description": "The label for category 'Middleware Internals' in sidebar 'docs'" + }, + "sidebar.docs.category.Driver Development": { + "message": "Driver Development", + "description": "The label for category 'Driver Development' in sidebar 'docs'" + }, + "sidebar.docs.category.About Performance": { + "message": "About Performance", + "description": "The label for category 'About Performance' in sidebar 'docs'" + }, + "sidebar.docs.category.Contribution Guide": { + "message": "Contribution Guide", + "description": "The label for category 'Contribution Guide' in sidebar 'docs'" } } diff --git a/i18n/en/docusaurus-plugin-content-docs/current/about.md b/i18n/en/docusaurus-plugin-content-docs/current/about.md index 7d28aee..8e24789 100644 --- a/i18n/en/docusaurus-plugin-content-docs/current/about.md +++ b/i18n/en/docusaurus-plugin-content-docs/current/about.md @@ -15,7 +15,8 @@ Over the years, XRobot has evolved from a Keil MDK-based MCU codebase for a comb This list is maintained by hand and does not include bot accounts. - @Jiu-xiao avatar [@Jiu-xiao](https://github.com/Jiu-xiao) - framework designer, `STM32 / CH32 / Linux` drivers -- @molqzone avatar [@molqzone](https://github.com/molqzone) - `MSPM0`, `DAPLink` +- @molqzone avatar [@molqzone](https://github.com/molqzone) - `DAPLink` +- @xiaoshuaijie avatar [@xiaoshuaijie](https://github.com/xiaoshuaijie) - website UI, `MSPM0` - @CaFeZn avatar [@CaFeZn](https://github.com/CaFeZn) - `HPM` series - @llLeo306 avatar [@llLeo306](https://github.com/llLeo306) - control and real-time systems diff --git a/i18n/en/docusaurus-theme-classic/footer.json b/i18n/en/docusaurus-theme-classic/footer.json index b332adb..cf5ec4b 100644 --- a/i18n/en/docusaurus-theme-classic/footer.json +++ b/i18n/en/docusaurus-theme-classic/footer.json @@ -17,7 +17,7 @@ }, "link.item.label.入门": { "message": "Start here", - "description": "The label of footer link with label=入门 linking to /" + "description": "The label of footer link with label=入门 linking to /docs/intro" }, "link.item.label.LibXR 类文档": { "message": "LibXR API Reference", @@ -59,8 +59,16 @@ "message": "Email", "description": "The label of footer link with label=邮箱 linking to mailto:Cong.Liu_Xiao@outlook.com" }, - "link.item.label.QQ群: 608182228": { - "message": "QQ Group: 608182228", - "description": "The label of footer link with label=QQ群: 608182228 linking to https://qm.qq.com/q/RPgE71OXmw" + "link.item.label.XRobot": { + "message": "XRobot", + "description": "The label of footer link with label=XRobot linking to https://github.com/xrobot-org/XRobot" + }, + "link.item.label.QQ群": { + "message": "QQ Group", + "description": "The label of footer link with label=QQ群 linking to /qq" + }, + "copyright": { + "message": "Copyright © 2026 XRobot", + "description": "The footer copyright" } } diff --git a/package-lock.json b/package-lock.json index 84c7038..ececdfe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,10 @@ "@docusaurus/core": "3.9.2", "@docusaurus/preset-classic": "3.9.2", "@docusaurus/theme-mermaid": "3.9.2", - "prism-react-renderer": "^2.4.1" + "@types/react": "^18.3.31", + "@types/react-dom": "^18.3.7", + "prism-react-renderer": "^2.4.1", + "typescript": "^5.9.3" } }, "node_modules/@ai-sdk/gateway": { @@ -463,7 +466,6 @@ "integrity": "sha512-pO/LpVnQlbJpcHRk+AroWyyFnh01eOlO6/uLZRUmYvr/hpKZKxI6n7ufgTawbo0KrAu2CePfiOkStYOmDuRjzQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/client-common": "4.25.2", "@algolia/requester-common": "4.25.2", @@ -735,7 +737,6 @@ "integrity": "sha512-2BCOP7TN8M+gVDj7/ht3hsaO/B/n5oDbiAyyvnRlNOs+u1o+JWNYTQrmpuNp1/Wq2gcFrI01JAW+paEKDMx/CA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/code-frame": "^7.27.1", "@babel/generator": "^7.28.3", @@ -2776,7 +2777,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" }, @@ -2800,7 +2800,6 @@ } ], "license": "MIT", - "peer": true, "engines": { "node": ">=18" } @@ -2915,7 +2914,6 @@ "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -3353,7 +3351,6 @@ "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -4070,7 +4067,6 @@ "integrity": "sha512-Mw6pAUF121MfngQtcUb5quZVqMC68pSYYjCRZkSITC085S3zdk+h/g7i6FxnVdbSU6OztxikSDMh1r7Z+4iPlA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/client-common": "5.40.1", "@algolia/requester-browser-xhr": "5.40.1", @@ -4129,7 +4125,6 @@ "integrity": "sha512-iUNxcXUNg9085TJx0HJLjqtDE0r1RZ0GOGrt8KNQqQT5ugu8lZsHuMUYW/e0lHhq6xBvmktU9Bw4CXP9VQeKrg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/abtesting": "1.6.1", "@algolia/client-abtesting": "5.40.1", @@ -4227,7 +4222,6 @@ "integrity": "sha512-HbjwKeC+pHUFBfLMNzuSjqFE/58+rLVKmOU3lxQrpsxLBOGosYco/Q0GduBb0/jEMRiyEqjNT/01rRdOMWq5pw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@docusaurus/babel": "3.9.2", "@docusaurus/bundler": "3.9.2", @@ -4415,7 +4409,6 @@ "integrity": "sha512-C5wZsGuKTY8jEYsqdxhhFOe1ZDjH0uIYJ9T/jebHwkyxqnr4wW0jTkB72OMqNjsoQRcb0JN3PcSeTwFlVgzCZg==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@docusaurus/core": "3.9.2", "@docusaurus/logger": "3.9.2", @@ -5359,7 +5352,6 @@ "integrity": "sha512-f++rKLQgUVYDAtECQ6fn/is15GkEH9+nZPM3MS0RcxVqoTfawHvDlSCH7JbMhAM6uJ32v3eXLvLmLvjGu7PTQw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/mdx": "^2.0.0" }, @@ -5979,7 +5971,6 @@ "integrity": "sha512-8QqtOQT5ACVlmsvKOJNEaWmRPmcojMOzCz4Hs2BGG/toAp/K38LcsMRyLp349glq5AzJbCEeimEoxaX6v/fLrA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/core": "^7.21.3", "@svgr/babel-preset": "8.1.0", @@ -6670,6 +6661,13 @@ "dev": true, "license": "MIT" }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/qs": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.14.0.tgz", @@ -6685,14 +6683,24 @@ "license": "MIT" }, "node_modules/@types/react": { - "version": "19.2.2", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.2.2.tgz", - "integrity": "sha512-6mDvHUFSjyT2B2yeNx2nUgMxh9LtOWvkhIU3uePn2I2oyNymUAX1NIsdgviM4CH+JSrp2D2hsMvJOkxY+0wNRA==", + "version": "18.3.31", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz", + "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { - "csstype": "^3.0.2" + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" } }, "node_modules/@types/react-router": { @@ -7033,8 +7041,7 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/@xterm/xterm/-/xterm-5.5.0.tgz", "integrity": "sha512-hqJHYaQb5OptNunnyAnkHyM8aCjZ1MEIDTQu1iIbbTD/xops91NB5yq1ZK/dC2JDbVWtF23zUtl9JE2NqwT87A==", - "license": "MIT", - "peer": true + "license": "MIT" }, "node_modules/@xtuc/ieee754": { "version": "1.2.0", @@ -7080,7 +7087,6 @@ "integrity": "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg==", "dev": true, "license": "MIT", - "peer": true, "bin": { "acorn": "bin/acorn" }, @@ -7173,7 +7179,6 @@ "integrity": "sha512-B/gBuNg5SiMTrPkC+A2+cW0RszwxYmn6VYxB/inlBStS5nx6xHIt/ehKRhIMhqusl7a8LjQoZnjCs5vhwxOQ1g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.3", "fast-uri": "^3.0.1", @@ -7222,7 +7227,6 @@ "integrity": "sha512-lYx98L6kb1VvXypbPI7Z54C4BJB2VT5QvOYthvPq6/POufZj+YdyeZSKjoLBKHJgGmYWQTHOKtcCTdKf98WOCA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@algolia/cache-browser-local-storage": "4.25.2", "@algolia/cache-common": "4.25.2", @@ -7751,7 +7755,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "baseline-browser-mapping": "^2.8.9", "caniuse-lite": "^1.0.30001746", @@ -8071,7 +8074,6 @@ "integrity": "sha512-ci2iJH6LeIkvP9eJW6gpueU8cnZhv85ELY8w8WiFtNjMHA5ad6pQLaJo9mEly/9qUyCpvqX8/POVUTf18/HFdw==", "dev": true, "license": "Apache-2.0", - "peer": true, "dependencies": { "@chevrotain/cst-dts-gen": "11.0.3", "@chevrotain/gast": "11.0.3", @@ -8831,7 +8833,6 @@ "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -9154,9 +9155,9 @@ "license": "CC0-1.0" }, "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", "dev": true, "license": "MIT" }, @@ -9166,7 +9167,6 @@ "integrity": "sha512-iJc4TwyANnOGR1OmWhsS9ayRS3s+XQ185FmuHObThD+5AeJCakAAbWv8KimMTt08xCCLNgneQwFp+JRJOr9qGQ==", "dev": true, "license": "MIT", - "peer": true, "engines": { "node": ">=0.10" } @@ -9611,7 +9611,6 @@ "integrity": "sha512-fmTRWbNMmsmWq6xJV8D19U/gw/bwrHfNXxrIN+HfZgnzqTHp9jOmKMhsTUjXOJnZOdZY9Q28y4yebKzqDKlxlQ==", "dev": true, "license": "ISC", - "peer": true, "engines": { "node": ">=12" } @@ -10928,7 +10927,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -15965,7 +15963,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -16585,7 +16582,6 @@ } ], "license": "MIT", - "peer": true, "dependencies": { "nanoid": "^3.3.11", "picocolors": "^1.1.1", @@ -17537,7 +17533,6 @@ "integrity": "sha512-8sLjZwK0R+JlxlYcTuVnyT2v+htpdrjDOKuMcOVdYjt52Lh8hWRYpxBPoKx/Zg+bcjc3wx6fmQevMmUztS/ccA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "cssesc": "^3.0.0", "util-deprecate": "^1.0.2" @@ -18431,7 +18426,6 @@ "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", "license": "MIT", - "peer": true, "dependencies": { "loose-envify": "^1.1.0" }, @@ -18444,7 +18438,6 @@ "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", "license": "MIT", - "peer": true, "dependencies": { "loose-envify": "^1.1.0", "scheduler": "^0.23.2" @@ -18506,7 +18499,6 @@ "integrity": "sha512-YMMxTUQV/QFSnbgrP3tjDzLHRg7vsbMn8e9HAa8o/1iXoiomo48b7sk/kkmWEuWNDPJVlKSJRB6Y2fHqdJk+SQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/react": "*" }, @@ -18537,7 +18529,6 @@ "integrity": "sha512-Ys9K+ppnJah3QuaRiLxk+jDWOR1MekYQrlytiXxC1RyfbdsZkS5pvKAzCCr031xHixZwpnsYNT5xysdFHQaYsA==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@babel/runtime": "^7.12.13", "history": "^4.9.0", @@ -20541,8 +20532,7 @@ "version": "2.8.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", - "license": "0BSD", - "peer": true + "license": "0BSD" }, "node_modules/type-fest": { "version": "2.19.0", @@ -20581,6 +20571,20 @@ "is-typedarray": "^1.0.0" } }, + "node_modules/typescript": { + "version": "5.9.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz", + "integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, "node_modules/ufo": { "version": "1.6.1", "resolved": "https://registry.npmjs.org/ufo/-/ufo-1.6.1.tgz", @@ -20955,7 +20959,6 @@ "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -21219,7 +21222,6 @@ "integrity": "sha512-7h/weGm9d/ywQ6qzJ+Xy+r9n/3qgp/thalBbpOi5i223dPXKi04IBtqPN9nTd+jBc7QKfvDbaBnFipYp4sJAUQ==", "dev": true, "license": "MIT", - "peer": true, "dependencies": { "@types/eslint-scope": "^3.7.7", "@types/estree": "^1.0.8", @@ -21843,7 +21845,6 @@ "integrity": "sha512-JInaHOamG8pt5+Ey8kGmdcAcg3OL9reK8ltczgHTAwNhMys/6ThXHityHxVV2p3fkw/c+MAvBHFVYHFZDmjMCQ==", "dev": true, "license": "MIT", - "peer": true, "funding": { "url": "https://github.com/sponsors/colinhacks" } diff --git a/package.json b/package.json index c386be4..c9b8254 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,8 @@ "prebuild": "node scripts/fetch-commits.js", "build": "docusaurus build", "deploy": "docusaurus deploy", - "serve": "docusaurus serve" + "serve": "docusaurus serve", + "postbuild": "node scripts/strip-nul.js" }, "dependencies": { "@cmfcmf/docusaurus-search-local": "^2.0.0", @@ -25,6 +26,9 @@ "@docusaurus/core": "3.9.2", "@docusaurus/preset-classic": "3.9.2", "@docusaurus/theme-mermaid": "3.9.2", - "prism-react-renderer": "^2.4.1" + "@types/react": "^18.3.31", + "@types/react-dom": "^18.3.7", + "prism-react-renderer": "^2.4.1", + "typescript": "^5.9.3" } } diff --git a/scripts/strip-nul.js b/scripts/strip-nul.js new file mode 100644 index 0000000..e8a4a82 --- /dev/null +++ b/scripts/strip-nul.js @@ -0,0 +1,34 @@ +/** + * Removes spurious NUL (\u0000) characters from built HTML. + * + * React 18.3 streaming SSR inserts \u0000 segment markers into long text and + * heading ids/anchors; the HTML parser then turns them into U+FFFD, which + * garbles body text and breaks anchor links (href/id mismatch). The docs + * sources contain no NUL characters, so every NUL in the output is an + * injected marker and stripping it restores the intended text and ids. + * Wired as the `postbuild` npm script. + */ +const fs = require('fs'); +const path = require('path'); + +const buildDir = path.join(__dirname, '..', 'build'); +let files = 0; +let removed = 0; + +(function walk(dir) { + for (const entry of fs.readdirSync(dir)) { + const full = path.join(dir, entry); + if (fs.statSync(full).isDirectory()) { + walk(full); + } else if (full.endsWith('.html')) { + const html = fs.readFileSync(full, 'utf8'); + if (!html.includes('\u0000')) continue; + const count = html.split('\u0000').length - 1; + fs.writeFileSync(full, html.replace(/\u0000/g, ''), 'utf8'); + files += 1; + removed += count; + } + } +})(buildDir); + +console.log(`[strip-nul] removed ${removed} NUL characters from ${files} HTML files.`); diff --git a/src/components/home/AgentPromptDialog.tsx b/src/components/home/AgentPromptDialog.tsx index c99bc5d..da8bd4d 100644 --- a/src/components/home/AgentPromptDialog.tsx +++ b/src/components/home/AgentPromptDialog.tsx @@ -38,6 +38,7 @@ export default function AgentPromptDialog({ }): JSX.Element | null { const [status, setStatus] = useState('idle'); const closeRef = useRef(null); + const dialogRef = useRef(null); const prompt = isEnglish ? agentPromptEn : agentPromptZh; useEffect(() => { @@ -48,7 +49,31 @@ export default function AgentPromptDialog({ document.body.style.overflow = 'hidden'; closeRef.current?.focus(); const onKey = (event: KeyboardEvent) => { - if (event.key === 'Escape') onClose(); + if (event.key === 'Escape') { + onClose(); + return; + } + if (event.key !== 'Tab') return; + // aria-modal dialog: keep keyboard focus cycling inside the dialog. + const dialog = dialogRef.current; + if (!dialog) return; + const focusables = dialog.querySelectorAll( + 'button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])', + ); + if (focusables.length === 0) { + event.preventDefault(); + return; + } + const first = focusables[0]; + const last = focusables[focusables.length - 1]; + const current = document.activeElement as HTMLElement; + if (event.shiftKey && (current === first || !dialog.contains(current))) { + event.preventDefault(); + last.focus(); + } else if (!event.shiftKey && (current === last || !dialog.contains(current))) { + event.preventDefault(); + first.focus(); + } }; window.addEventListener('keydown', onKey); return () => { @@ -92,6 +117,7 @@ export default function AgentPromptDialog({ return (
0 ? Math.min(1, Math.max(0, scrollTop / max)) : 0; + const percent = Math.round(progress * 100); + + const bar = document.querySelector('.xr-progress-bar'); + if (bar) { + bar.style.transform = `scaleX(${progress})`; + } + const circleValue = document.querySelector('.xr-progress-circle__value'); + if (circleValue) { + circleValue.style.strokeDashoffset = String(100 - progress * 100); + } + const label = document.querySelector('.xr-progress-circle__label'); + if (label) { + label.textContent = `${percent}%`; + } + const circle = document.querySelector('.xr-progress-circle'); + if (circle) { + circle.setAttribute('aria-label', ariaTemplate.replace('{n}', String(percent))); + } + const topBtn = document.querySelector('.xr-top-btn'); + if (topBtn) { + topBtn.classList.toggle('xr-top-btn--show', window.scrollY > 200); + } +} + +export default function ReadingProgress(): JSX.Element { + const { pathname } = useLocation(); + // Docs routes live at /docs/... (zh) and /en/docs/... (en locale). + const showCircle = /^\/(en\/)?docs(\/|$)/.test(pathname); + + React.useEffect(() => { + let raf = 0; + const schedule = () => { + if (!raf) { + raf = window.requestAnimationFrame(() => { + raf = 0; + updateProgress(); + }); + } + }; + updateProgress(); + window.addEventListener('scroll', schedule, { passive: true }); + window.addEventListener('resize', schedule, { passive: true }); + return () => { + if (raf) window.cancelAnimationFrame(raf); + window.removeEventListener('scroll', schedule); + window.removeEventListener('resize', schedule); + }; + }, [pathname, showCircle]); + + return ( + <> +