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](https://github.com/Jiu-xiao) - 框架设计者,`STM32 / CH32 / Linux` 驱动开发
-- [@molqzone](https://github.com/molqzone) - `MSPM0`、`DAPLink`
+- [@molqzone](https://github.com/molqzone) - `DAPLink`
+- [@xiaoshuaijie](https://github.com/xiaoshuaijie) - 网站 UI、`MSPM0`
- [@CaFeZn](https://github.com/CaFeZn) - `HPM` 系列
- [@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](https://github.com/Jiu-xiao) - framework designer, `STM32 / CH32 / Linux` drivers
-- [@molqzone](https://github.com/molqzone) - `MSPM0`, `DAPLink`
+- [@molqzone](https://github.com/molqzone) - `DAPLink`
+- [@xiaoshuaijie](https://github.com/xiaoshuaijie) - website UI, `MSPM0`
- [@CaFeZn](https://github.com/CaFeZn) - `HPM` series
- [@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 (
+ <>
+
+
+ {showCircle ? (
+
+
+
+
+
+ 0%
+
+ ) : null}
+
+
+
+
+
+
+
+ Top
+
+
+
+ >
+ );
+}
diff --git a/src/components/showcase/RingBuffer/sim.ts b/src/components/showcase/RingBuffer/sim.ts
index 619fc7c..3ba78ac 100644
--- a/src/components/showcase/RingBuffer/sim.ts
+++ b/src/components/showcase/RingBuffer/sim.ts
@@ -639,7 +639,7 @@ export class Sim {
// an interrupt request: NVIC keeps one pending bit per line (a second request before the handler runs is merged)
irq(line: string, src: string, prio: number, genFn: () => Gen): Ctx {
const pend = this.isrQ.find((c) => c.line === line && !c.started);
- if (pend) { if (!(pend.src || '').split('+').includes(src)) { pend.src += '+' + src; pend.label = pend.src; } return pend; }
+ if (pend) { if (!(pend.src || '').split('+').includes(src)) { pend.src += '+' + src; pend.label = pend.src ?? ''; } return pend; }
const c = this.spawn(src, 'isr', prio, genFn(), { row: 1, src });
c.line = line; c.seq = this.heap.seq++; c.pendT = this.t; c.started = false;
return c;
diff --git a/src/components/showcase/Showcase.tsx b/src/components/showcase/Showcase.tsx
index a42c372..b98b359 100644
--- a/src/components/showcase/Showcase.tsx
+++ b/src/components/showcase/Showcase.tsx
@@ -7,12 +7,13 @@
* comes within LOAD_MARGIN of the viewport, inside BrowserOnly + Suspense.
* - `active` is true while the frame intersects the viewport and the page is visible; widgets
* stop their timers when it turns false (they are not unmounted).
- * - `reducedMotion` follows the page animation switch (see useReducedMotion below), not the OS setting.
+ * - `reducedMotion` follows the page animation switch (see src/utils/motion.ts), not the OS setting.
*/
import React, { Suspense, useEffect, useRef, useState } from 'react';
import BrowserOnly from '@docusaurus/BrowserOnly';
import Link from '@docusaurus/Link';
import { translate } from '@docusaurus/Translate';
+import { useReducedMotion } from '@site/src/utils/motion';
import styles from './showcase.module.css';
export type ShowcaseWidgetProps = {
@@ -57,40 +58,6 @@ function lazyWidget(name: string) {
/** Mount a little before the frame scrolls in, so the chunk is ready when it is seen. */
const LOAD_MARGIN = '400px 0px';
-/**
- * Page-level animation switch (the "动画 开 / 关" control in the hero). Animation is on by default,
- * independent of the OS `prefers-reduced-motion` setting; the choice is stored in localStorage and
- * broadcast with the `xr-motion` event so every widget follows it at once.
- */
-export const MOTION_KEY = 'xr-motion';
-export function readMotionOff(): boolean {
- try {
- return window.localStorage.getItem(MOTION_KEY) === 'off';
- } catch {
- return false;
- }
-}
-export function setMotionOff(off: boolean): void {
- try {
- window.localStorage.setItem(MOTION_KEY, off ? 'off' : 'on');
- } catch {
- /* storage unavailable: the switch still works for this page view */
- }
- document.documentElement.dataset.motion = off ? 'off' : 'on';
- window.dispatchEvent(new CustomEvent('xr-motion', { detail: off }));
-}
-
-export function useReducedMotion(): boolean {
- const [reduced, setReduced] = useState(false);
- useEffect(() => {
- const update = (e?: Event) => setReduced(e instanceof CustomEvent ? Boolean(e.detail) : readMotionOff());
- update();
- window.addEventListener('xr-motion', update);
- return () => window.removeEventListener('xr-motion', update);
- }, []);
- return reduced;
-}
-
function usePageVisible(): boolean {
const [visible, setVisible] = useState(true);
useEffect(() => {
diff --git a/src/css/xrstyle-reading.css b/src/css/xrstyle-reading.css
new file mode 100644
index 0000000..32f697a
--- /dev/null
+++ b/src/css/xrstyle-reading.css
@@ -0,0 +1,520 @@
+/* XRobot Style reading layer for the documentation pages (loaded by docusaurus.config.js
+ * customCss after xrstyle-tokens.css): theme-switch colour fade, reading progress and the
+ * back-to-top button, prose details, current-page indication, long-code folding.
+ * Ink on paper, square corners, 1px lines; motion follows html[data-motion] (the page
+ * animation switch, src/utils/motion.ts).
+ */
+
+/* ==========================================================================
+ b) Theme-switch color fade
+ ========================================================================== */
+
+/* The React toggle sets html.is-theme-transitioning for ~360ms and every
+ * color-ish property fades in place over 320ms. We intentionally do NOT use
+ * document.startViewTransition: its snapshot crossfade freezes the whole page
+ * and stalls rendering for seconds in some environments, while this in-place
+ * fade keeps the page live (rAF sampling shows no dropped frames). Colour-ish
+ * properties only, so transform is never animated. */
+html.is-theme-transitioning *,
+html.is-theme-transitioning *::before,
+html.is-theme-transitioning *::after {
+ transition-property: color, background-color, border-color, outline-color,
+ fill, stroke, box-shadow !important;
+ transition-duration: 320ms !important;
+ transition-timing-function: cubic-bezier(0.16, 1, 0.3, 1) !important;
+}
+
+/* ==========================================================================
+ c) Reading progress: top bar + corner circle
+ ========================================================================== */
+
+/* Top bar (all routes). React renders:
+ *
+ * and writes scaleX(progress) on the bar. */
+.xr-progress-track {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ height: 3px;
+ overflow: hidden;
+ pointer-events: none;
+ /* Above the fixed navbar (Infima --ifm-z-index-fixed: 200) and the overlay
+ * layer (400); sit on the View Transitions root snapshot as well. */
+ z-index: 2010;
+}
+
+.xr-progress-bar {
+ width: 100%;
+ height: 100%;
+ transform: scaleX(0);
+ transform-origin: 0 50%;
+ will-change: transform;
+ background: var(--ink);
+ transition: transform 80ms linear;
+}
+
+/* Bottom-right floating dock: the reading circle
+ * (/docs only) sits above the back-to-top button, right-aligned column.
+ * React renders:
+ *
+ */
+.xr-float-dock {
+ position: fixed;
+ right: 1.25rem;
+ bottom: 1.25rem;
+ display: flex;
+ flex-direction: column;
+ align-items: flex-end;
+ gap: 0.6rem;
+ /* Above page content and the fixed navbar, below the overlay layer
+ * (Infima --ifm-z-index-overlay: 400), so menus can cover it. */
+ z-index: 300;
+ pointer-events: none;
+}
+
+.xr-float-dock > * {
+ pointer-events: auto;
+}
+
+.xr-progress-circle {
+ position: relative;
+ width: 3rem;
+ height: 3rem;
+ pointer-events: none;
+ border: var(--stroke) solid var(--line);
+ border-radius: 0;
+ background: var(--paper-raised);
+}
+
+.xr-progress-circle > svg {
+ position: absolute;
+ inset: 0.18rem;
+ transform: rotate(-90deg);
+}
+
+.xr-progress-circle circle {
+ fill: none;
+ stroke-width: 3.5;
+ stroke-linecap: round;
+}
+
+.xr-progress-circle__track {
+ stroke: var(--line-strong);
+}
+
+.xr-progress-circle__value {
+ stroke: var(--ink);
+ stroke-dasharray: 100;
+ stroke-dashoffset: 100;
+ transition: stroke-dashoffset 120ms linear;
+}
+
+.xr-progress-circle__label {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-family: var(--font-mono);
+ font-size: var(--type-label-size);
+ line-height: var(--type-label-line);
+ color: var(--ink);
+}
+
+/* Back-to-top button (dock style: outlined square, inverted on hover, icon
+ * flies up while the "Top" label slides in). Hidden until scrollY > 200
+ * (toggled by the progress component with .xr-top-btn--show). */
+.xr-top-btn {
+ position: relative;
+ display: inline-flex;
+ align-items: center;
+ justify-content: center;
+ width: 3rem;
+ height: 3rem;
+ padding: 0;
+ overflow: hidden;
+ border: 2px solid var(--ink);
+ border-radius: 0;
+ background: var(--paper-raised);
+ color: var(--ink);
+ cursor: pointer;
+ opacity: 0;
+ transform: translateY(0.5rem);
+ visibility: hidden;
+ transition: opacity 200ms ease, transform 200ms ease, visibility 200ms,
+ background-color 200ms ease, color 200ms ease, border-color 200ms ease;
+}
+
+.xr-top-btn--show {
+ opacity: 1;
+ transform: none;
+ visibility: visible;
+}
+
+.xr-top-btn:hover {
+ background: var(--ink);
+ border-color: var(--ink);
+ color: var(--paper-raised);
+}
+
+.xr-top-btn:focus-visible {
+ outline: 2px solid var(--focus);
+ outline-offset: 2px;
+}
+
+.xr-top-btn__icon,
+.xr-top-btn__label {
+ position: absolute;
+ inset: 0;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ transition: transform 200ms ease-out, opacity 200ms ease-out;
+}
+
+.xr-top-btn__label {
+ font-family: var(--font-mono);
+ font-size: 0.8rem;
+ font-weight: 700;
+ opacity: 0;
+ transform: translateY(8px);
+}
+
+.xr-top-btn:hover .xr-top-btn__icon,
+.xr-top-btn:focus-visible .xr-top-btn__icon {
+ transform: translateY(-8px);
+ opacity: 0;
+}
+
+.xr-top-btn:hover .xr-top-btn__label,
+.xr-top-btn:focus-visible .xr-top-btn__label {
+ opacity: 1;
+ transform: none;
+}
+
+@media (max-width: 480px) {
+ .xr-float-dock {
+ right: 0.9rem;
+ bottom: 0.9rem;
+ }
+
+ .xr-progress-circle,
+ .xr-top-btn {
+ width: 2.6rem;
+ height: 2.6rem;
+ }
+}
+
+/* ==========================================================================
+ g) Prose polish (markdown). Token-driven and always on; tuned to sit
+ inside the ink language (hairlines, sunken panels, no new hues).
+ ========================================================================== */
+
+/* Heading anchors: Docusaurus already keeps them opacity:0; ease them in and
+ * rest them at half strength until they are hovered themselves. */
+.markdown .hash-link {
+ opacity: 0;
+ transition: opacity var(--duration-base, 160ms) ease;
+}
+
+.markdown :is(h1, h2, h3, h4, h5, h6):hover .hash-link,
+.markdown .hash-link:focus-visible {
+ opacity: 0.55;
+}
+
+.markdown .hash-link:hover {
+ opacity: 1;
+}
+
+/* Blockquote: a 3px accent bar (round-cornered) on a sunken panel. */
+.markdown blockquote {
+ padding: var(--space-3) var(--space-4);
+ background-color: color-mix(in oklch, var(--paper-sunken) 60%, transparent);
+ border-left: 3px solid var(--ink-muted);
+ border-radius: 3px;
+}
+
+/* Tables: one outer frame, hairline row rules, no double borders. Infima's
+ * block display + overflow:auto stays, so wide tables still scroll inside
+ * the rounded frame. */
+.markdown table {
+ border-collapse: separate;
+ border-spacing: 0;
+ border: var(--stroke) solid var(--line);
+ border-radius: 4px;
+}
+
+.markdown table :is(th, td) {
+ border: none;
+ border-bottom: var(--stroke) solid var(--line);
+}
+
+.markdown table th {
+ background-color: var(--paper-sunken);
+}
+
+.markdown table tbody tr:last-child td {
+ border-bottom: none;
+}
+
+.markdown table tr:nth-child(2n) {
+ background-color: color-mix(in oklch, var(--paper-sunken) 45%, transparent);
+}
+
+/* Inline code: sunken chip with a hairline frame (pre code is excluded). */
+.markdown :not(pre) > code {
+ background-color: var(--paper-sunken);
+ border: var(--stroke) solid var(--line);
+ border-radius: 3px;
+ padding: 0.15em 0.4em;
+ font-size: 0.875em;
+}
+
+/* Theme-aware images: the intro-page logo PNG is ink-on-transparent, which
+ * disappears on the dark card (the md file keeps its plain image syntax; match by filename —
+ * Docusaurus rewrites markdown image URLs to hashed /assets/images paths).
+ * Inverting in the dark theme turns the ink strokes white (paper variant). */
+html[data-theme='dark'] .markdown img[src*='XRobot'] {
+ filter: invert(1);
+}
+
+/* Links: the underline is a half-strength accent, full strength on hover.
+ * mono = half-strength ink, close to the current look. */
+.markdown a {
+ text-decoration-color: var(--ink-muted);
+ transition: text-decoration-color var(--duration-base, 160ms) ease;
+}
+
+.markdown a:hover {
+ text-decoration-color: var(--ink);
+}
+
+/* hr fades out at both ends (Infima's border:0/height stay in charge). */
+.markdown hr {
+ background: linear-gradient(
+ 90deg,
+ transparent,
+ var(--line-strong) 18%,
+ var(--line-strong) 82%,
+ transparent
+ );
+}
+
+/* Figures get a hairline frame and a small radius (site emoji stay bare). */
+.markdown img:not(.emoji) {
+ border: var(--stroke) solid var(--line);
+ border-radius: 2px;
+}
+
+/* Breadcrumbs and the prev/next cards pick up a quiet accent on hover. */
+.breadcrumbs__link,
+.pagination-nav__link {
+ transition: border-color var(--duration-base, 160ms) ease,
+ background-color var(--duration-base, 160ms) ease;
+}
+
+.breadcrumbs__link:hover {
+ border-color: var(--line-strong);
+}
+
+.pagination-nav__link:hover {
+ border-color: var(--line-strong);
+}
+
+/* ==========================================================================
+ g2) Current-page indication: sidebar, TOC, breadcrumbs. The active state
+ is marked by a left indicator bar, weight and a tinted background, not by hue.
+ ========================================================================== */
+
+/* Exact current page: sunken background + ink bar on the left edge. */
+.theme-doc-sidebar-container .menu__link--active:not(.menu__link--sublist) {
+ position: relative;
+ color: var(--ink);
+ font-weight: 650;
+ background: var(--paper-sunken);
+}
+
+.theme-doc-sidebar-container .menu__link--active:not(.menu__link--sublist)::before {
+ position: absolute;
+ top: 0.3rem;
+ bottom: 0.3rem;
+ left: 0.1rem;
+ width: 3px;
+ content: '';
+ background: var(--ink);
+}
+
+/* Category whose section contains the current page: bold ink text. */
+.sidebar .menu__link--sublist.menu__link--active {
+ color: var(--ink);
+ font-weight: 650;
+}
+
+/* Right TOC: the heading of the section on screen. */
+.table-of-contents .table-of-contents__link--active {
+ color: var(--ink);
+ font-weight: 650;
+}
+
+/* Breadcrumb tail = current page. */
+.breadcrumbs__item--active .breadcrumbs__link {
+ color: var(--ink);
+ font-weight: 650;
+}
+
+/* ==========================================================================
+ h) Page animation switch (html[data-motion='off']), print
+ ========================================================================== */
+
+/* data-motion='off' zeroes every duration this layer adds (same approach as
+ * the tail of xrstyle-tokens.css / xrstyle-components.css). */
+html[data-motion='off'] .xr-progress-bar,
+html[data-motion='off'] .xr-progress-circle__value,
+html[data-motion='off'] .markdown .hash-link,
+html[data-motion='off'] .markdown a,
+html[data-motion='off'] .breadcrumbs__link,
+html[data-motion='off'] .pagination-nav__link {
+ transition: none;
+}
+
+html[data-motion='off'].is-theme-transitioning *,
+html[data-motion='off'].is-theme-transitioning *::before,
+html[data-motion='off'].is-theme-transitioning *::after {
+ transition-duration: 0ms !important;
+}
+
+@media print {
+ .xr-progress-track,
+ .xr-progress-circle {
+ display: none !important;
+ }
+
+}
+
+/* ==========================================================================
+ i) Long-code folding (>15 lines): 8 preview lines + fade gradient + a
+ toggle button at the bottom centre.
+ The React CodeBlock wrapper renders:
+
+
+
+ and writes --xr-fold-preview-height after measuring the real line height.
+ ========================================================================== */
+
+.xr-code-fold--collapsed .theme-code-block pre {
+ max-height: var(--xr-fold-preview-height, calc(8 * 1.5em + 2rem));
+ overflow: hidden;
+}
+
+.xr-code-fold--collapsed .theme-code-block {
+ position: relative;
+}
+
+.xr-code-fold--collapsed .theme-code-block::after {
+ position: absolute;
+ right: 1px;
+ bottom: 1px;
+ left: 1px;
+ height: 6.5rem;
+ content: "";
+ background: linear-gradient(
+ to bottom,
+ transparent,
+ var(--prism-background-color, var(--paper-sunken))
+ );
+ pointer-events: none;
+ transition: opacity 0.3s ease;
+}
+
+.xr-code-fold {
+ position: relative;
+}
+
+.xr-fold-toggle {
+ position: absolute;
+ bottom: 12px;
+ left: 50%;
+ z-index: 20;
+ display: inline-flex;
+ align-items: center;
+ gap: 0.35rem;
+ padding: 6px 16px;
+ border: 1px solid var(--line-strong);
+ border-radius: 0;
+ background: var(--paper-raised);
+ color: var(--ink);
+ font-size: 0.8rem;
+ font-weight: 600;
+ line-height: 1.4;
+ cursor: pointer;
+ transform: translateX(-50%);
+ transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease;
+}
+
+.xr-fold-toggle:hover {
+ border-color: var(--ink);
+ color: var(--ink);
+}
+
+.xr-fold-toggle:focus-visible {
+ outline: 2px solid var(--focus);
+ outline-offset: 2px;
+}
+
+.xr-fold-toggle svg {
+ transition: transform 200ms ease;
+}
+
+/* Expanded: the toggle drops back into normal flow under the block. */
+.xr-code-fold:not(.xr-code-fold--collapsed) .xr-fold-toggle {
+ position: relative;
+ bottom: auto;
+ left: auto;
+ display: flex;
+ width: fit-content;
+ margin: 10px auto 0;
+ transform: none;
+}
+
+.xr-code-fold:not(.xr-code-fold--collapsed) .xr-fold-toggle svg {
+ transform: rotate(180deg);
+}
+
+.xr-fold-status {
+ position: absolute;
+ width: 1px;
+ height: 1px;
+ overflow: hidden;
+ clip: rect(0 0 0 0);
+ white-space: nowrap;
+}
+
+html[data-motion='off'] .xr-fold-toggle svg,
+html[data-motion='off'] .xr-code-fold--collapsed .theme-code-block::after,
+html[data-motion='off'] .xr-top-btn,
+html[data-motion='off'] .xr-top-btn__icon,
+html[data-motion='off'] .xr-top-btn__label {
+ transition: none;
+}
+
+@media print {
+ .xr-float-dock,
+ .xr-fold-toggle,
+ .xr-fold-status {
+ display: none !important;
+ }
+
+ .xr-code-fold--collapsed .theme-code-block pre {
+ max-height: none;
+ }
+
+ .xr-code-fold--collapsed .theme-code-block::after {
+ display: none;
+ }
+}
diff --git a/src/pages/index.module.css b/src/pages/index.module.css
index 4178736..be9e427 100644
--- a/src/pages/index.module.css
+++ b/src/pages/index.module.css
@@ -39,6 +39,80 @@
}
}
+/* slogan + contact tags under the hero wordmark: a row of separate square tags,
+ * each filled with its own colour (--tag-color / --tag-ink, set in index.tsx) */
+.heroTagZone {
+ margin: 0 0 var(--space-8) auto;
+ text-align: right;
+}
+
+.heroSlogan {
+ margin: 0 0 var(--space-3);
+ font: 700 12px/16px var(--font-mono);
+ letter-spacing: 0.08em;
+ color: var(--ink-muted);
+}
+
+.heroTags {
+ display: inline-flex;
+ gap: var(--space-2);
+}
+
+.heroTag {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ gap: var(--space-1);
+ width: 64px;
+ height: 56px;
+ margin: 0;
+ padding: 0;
+ border: var(--stroke) solid var(--line-strong);
+ border-radius: 0;
+ color: var(--tag-ink, var(--ink));
+ font: inherit;
+ font-size: 12px;
+ font-weight: 700;
+ line-height: 1;
+ text-decoration: none;
+ background: var(--tag-color, var(--paper-raised));
+ cursor: pointer;
+ transition: background-color var(--duration-fast) linear, color var(--duration-fast) linear;
+}
+
+.heroTagIcon {
+ display: flex;
+}
+
+.heroTagIcon svg {
+ display: block;
+ width: 18px;
+ height: 18px;
+}
+
+.heroTagName {
+ white-space: nowrap;
+}
+
+.heroTag:hover,
+.heroTag:focus-visible {
+ color: var(--on-ink);
+ text-decoration: none;
+ background: var(--ink);
+}
+
+.heroTag:focus-visible {
+ outline: var(--stroke-strong) solid var(--focus);
+ outline-offset: 2px;
+}
+
+@media (max-width: 996px) {
+ .heroTagZone {
+ display: none;
+ }
+}
+
.heroCopy {
min-width: 0;
}
diff --git a/src/pages/index.tsx b/src/pages/index.tsx
index d074767..99bb213 100644
--- a/src/pages/index.tsx
+++ b/src/pages/index.tsx
@@ -9,7 +9,9 @@ import Link from '@docusaurus/Link';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { translate } from '@docusaurus/Translate';
import { Button, Card, Logo, PathLabel, Tag, inlineCode } from '@site/src/components/xr';
-import Showcase, { readMotionOff, setMotionOff, useReducedMotion } from '@site/src/components/showcase/Showcase';
+import Showcase from '@site/src/components/showcase/Showcase';
+import { readMotionOff, setMotionOff, useReducedMotion } from '@site/src/utils/motion';
+import { copyTextToClipboard } from '@site/src/utils/clipboard';
import ShowcaseSection, { StaticFigure } from '@site/src/components/showcase/ShowcaseSection';
import AgentPromptDialog from '@site/src/components/home/AgentPromptDialog';
import { capabilities, chapters, heroActions, links, recent, routes, scenarios, versionRows, type FigureSpec } from '@site/src/data/home';
@@ -31,7 +33,7 @@ function Figure({ spec }: { spec: FigureSpec }): JSX.Element {
);
}
-/** Page-wide animation switch; on by default, stored in localStorage (see Showcase.tsx). */
+/** Page-wide animation switch; on by default, stored in localStorage (see src/utils/motion.ts). */
function MotionSwitch(): JSX.Element {
const off = useReducedMotion();
useEffect(() => {
@@ -51,6 +53,127 @@ function MotionSwitch(): JSX.Element {
);
}
+const BILIBILI_ICON =
+ 'M17.813 4.653h.854q2.266.08 3.773 1.574Q23.946 7.72 24 9.987v7.36q-.054 2.266-1.56 3.773c-1.506 1.507-2.262 1.524-3.773 1.56H5.333q-2.266-.054-3.773-1.56C.053 19.614.036 18.858 0 17.347v-7.36q.054-2.267 1.56-3.76t3.773-1.574h.774l-1.174-1.12a1.23 1.23 0 0 1-.373-.906q0-.534.373-.907l.027-.027q.4-.373.92-.373t.92.373L9.653 4.44q.107.106.187.213h4.267a.8.8 0 0 1 .16-.213l2.853-2.747q.4-.373.92-.373c.347 0 .662.151.929.4s.391.551.391.907q0 .532-.373.906zM5.333 7.24q-1.12.027-1.88.773q-.76.748-.786 1.894v7.52q.026 1.146.786 1.893t1.88.773h13.334q1.12-.026 1.88-.773t.786-1.893v-7.52q-.026-1.147-.786-1.894t-1.88-.773zM8 11.107q.56 0 .933.373q.375.374.4.96v1.173q-.025.586-.4.96q-.373.375-.933.374c-.56-.001-.684-.125-.933-.374q-.375-.373-.4-.96V12.44q0-.56.386-.947q.387-.386.947-.386m8 0q.56 0 .933.373q.375.374.4.96v1.173q-.025.586-.4.96q-.373.375-.933.374c-.56-.001-.684-.125-.933-.374q-.375-.373-.4-.96V12.44q.025-.586.4-.96q.373-.373.933-.373';
+
+const GITHUB_ICON =
+ 'M12 .297c-6.63 0-12 5.373-12 12c0 5.303 3.438 9.8 8.205 11.385c.6.113.82-.258.82-.577c0-.285-.01-1.04-.015-2.04c-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729c1.205.084 1.838 1.236 1.838 1.236c1.07 1.835 2.809 1.305 3.495.998c.108-.776.417-1.305.76-1.605c-2.665-.3-5.466-1.332-5.466-5.93c0-1.31.465-2.38 1.235-3.22c-.135-.303-.54-1.523.105-3.176c0 0 1.005-.322 3.3 1.23c.96-.267 1.98-.399 3-.405c1.02.006 2.04.138 3 .405c2.28-1.552 3.285-1.23 3.285-1.23c.645 1.653.24 2.873.12 3.176c.765.84 1.23 1.91 1.23 3.22c0 4.61-2.805 5.625-5.475 5.92c.42.36.81 1.096.81 2.22c0 1.606-.015 2.896-.015 3.286c0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12';
+
+const MAIL_ICON = 'M4 20q-.825 0-1.412-.587T2 18V6q0-.825.588-1.412T4 4h16q.825 0 1.413.588T22 6v12q0 .825-.587 1.413T20 20zm8-7L4 8v10h16V8zm0-2l8-5H4zM4 8V6v12z';
+
+const QQ_ICON =
+ 'M21.395 15.035a40 40 0 0 0-.803-2.264l-1.079-2.695c.001-.032.014-.562.014-.836C19.526 4.632 17.351 0 12 0S4.474 4.632 4.474 9.241c0 .274.013.804.014.836l-1.08 2.695a39 39 0 0 0-.802 2.264c-1.021 3.283-.69 4.643-.438 4.673c.54.065 2.103-2.472 2.103-2.472c0 1.469.756 3.387 2.394 4.771c-.612.188-1.363.479-1.845.835c-.434.32-.379.646-.301.778c.343.578 5.883.369 7.482.189c1.6.18 7.14.389 7.483-.189c.078-.132.132-.458-.301-.778c-.483-.356-1.233-.646-1.846-.836c1.637-1.384 2.393-3.302 2.393-4.771c0 0 1.563 2.537 2.103 2.472c.251-.03.581-1.39-.438-4.673';
+
+const BOOK_ICON =
+ 'M21 5c-1.11-.35-2.33-.5-3.5-.5-1.95 0-4.05.4-5.5 1.5-1.45-1.1-3.55-1.5-5.5-1.5S2.45 4.9 1 6v14.65c0 .25.25.5.5.5.1 0 .15-.05.25-.05C3.1 20.45 5.05 20 6.5 20c1.95 0 4.05.4 5.5 1.5 1.35-.85 3.8-1.5 5.5-1.5 1.65 0 3.35.3 4.75 1.05.1.05.15.05.25.05.25 0 .5-.25.5-.5V6c-.6-.45-1.25-.75-2-1zm0 13.5c-1.1-.35-2.3-.5-3.5-.5-1.7 0-4.15.65-5.5 1.5V8c1.35-.85 3.8-1.5 5.5-1.5 1.2 0 2.4.15 3.5.5v11.5z';
+
+/** Contact tags under the hero wordmark (bilibili / GitHub / email / QQ group / docs). */
+function HeroTags(): JSX.Element {
+ const [copied, setCopied] = useState(false);
+ const copyEmail = () => {
+ void copyTextToClipboard('Cong.Liu_Xiao@outlook.com').then((ok) => {
+ if (!ok) return; // never claim success when every copy strategy failed
+ setCopied(true);
+ window.setTimeout(() => setCopied(false), 1600);
+ });
+ };
+ const tags: Array<{
+ key: string;
+ color: string;
+ ink: string;
+ label: string;
+ icon: string;
+ href?: string;
+ onClick?: () => void;
+ }> = [
+ {
+ key: 'bilibili',
+ color: 'rgb(255 150 165 / 0.95)',
+ ink: '#5a1020',
+ label: translate({ id: 'home.hero.tag.bilibili', message: 'B站' }),
+ icon: BILIBILI_ICON,
+ href: 'https://space.bilibili.com/339766655',
+ },
+ {
+ key: 'github',
+ color: 'rgb(255 210 80 / 0.95)',
+ ink: '#553500',
+ label: translate({ id: 'home.hero.tag.github', message: 'GitHub' }),
+ icon: GITHUB_ICON,
+ href: 'https://github.com/xrobot-org',
+ },
+ {
+ key: 'email',
+ color: 'rgb(144 211 173 / 0.95)',
+ ink: '#174b38',
+ label: copied
+ ? translate({ id: 'home.hero.tag.copied', message: '已复制 ✓' })
+ : translate({ id: 'home.hero.tag.email', message: '邮箱' }),
+ icon: MAIL_ICON,
+ onClick: () => void copyEmail(),
+ },
+ {
+ key: 'qq',
+ color: 'rgb(135 190 236 / 0.95)',
+ ink: '#173b61',
+ label: translate({ id: 'home.hero.tag.qq', message: 'QQ群' }),
+ icon: QQ_ICON,
+ href: '/qq',
+ },
+ {
+ key: 'docs',
+ color: 'rgb(246 184 98 / 0.95)',
+ ink: '#5b3510',
+ label: translate({ id: 'home.hero.tag.docs', message: '文档' }),
+ icon: BOOK_ICON,
+ href: '/docs/intro',
+ },
+ ];
+ return (
+
+
XRobot is all you need
+
+ {tags.map((tag) => {
+ const style = {
+ ['--tag-color' as string]: tag.color,
+ ['--tag-ink' as string]: tag.ink,
+ } as React.CSSProperties;
+ const inner = (
+ <>
+
+
+
+
+
+
{tag.label}
+ >
+ );
+ if (tag.href) {
+ return tag.href.startsWith('/')
+ ? (
+
+ {inner}
+
+ )
+ : (
+
+ {inner}
+
+ );
+ }
+ return (
+
+ {inner}
+
+ );
+ })}
+
+
+ );
+}
+
function Hero({ isEnglish }: { isEnglish: boolean }): JSX.Element {
return (
@@ -88,6 +211,7 @@ function Hero({ isEnglish }: { isEnglish: boolean }): JSX.Element {
+
{translate({ id: 'home.hero.chapters', message: '文档章节' })}
diff --git a/src/pages/qq.module.css b/src/pages/qq.module.css
new file mode 100644
index 0000000..5227b51
--- /dev/null
+++ b/src/pages/qq.module.css
@@ -0,0 +1,177 @@
+/* QQ group page (/qq). XRobot Style tokens only (src/css/xrstyle-tokens.css). */
+
+.page {
+ background: var(--paper);
+ color: var(--ink);
+}
+
+.inner {
+ max-width: var(--measure-page);
+ margin: 0 auto;
+ padding: var(--space-12) var(--space-8) var(--space-16);
+}
+
+.header {
+ max-width: var(--measure-prose);
+ margin-bottom: var(--space-8);
+}
+
+.title {
+ margin: var(--space-2) 0 var(--space-3);
+ font-size: var(--type-display-size);
+ line-height: var(--type-display-line);
+ font-weight: 700;
+ color: var(--ink);
+}
+
+.lead {
+ margin: 0;
+ color: var(--ink-muted);
+}
+
+/* ---- Group: QR on the left, ID and join link on the right ---- */
+
+.group {
+ display: grid;
+ grid-template-columns: auto minmax(0, 1fr);
+ gap: var(--space-8);
+ align-items: start;
+ padding: var(--space-8) 0;
+ border-top: var(--stroke) solid var(--line);
+ border-bottom: var(--stroke) solid var(--line);
+}
+
+/* The QR code is light-on-dark; it keeps its own dark ground in both themes. */
+.qrFrame {
+ margin: 0;
+ padding: var(--space-4);
+ border: var(--stroke) solid var(--line-strong);
+ background: #1b1b1b;
+}
+
+.qrImg {
+ display: block;
+ width: 240px;
+ height: 240px;
+}
+
+.groupInfo {
+ display: flex;
+ flex-direction: column;
+ align-items: flex-start;
+ gap: var(--space-4);
+ min-width: 0;
+}
+
+.groupName {
+ margin: 0;
+ font-size: var(--type-title-size);
+ line-height: var(--type-title-line);
+}
+
+.fields {
+ margin: 0;
+}
+
+.field {
+ display: flex;
+ align-items: center;
+ gap: var(--space-4);
+}
+
+.field dt {
+ font: 700 12px/16px var(--font-mono);
+ letter-spacing: 0.08em;
+ color: var(--ink-muted);
+}
+
+.field dd {
+ display: flex;
+ align-items: center;
+ gap: var(--space-3);
+ margin: 0;
+}
+
+.mono {
+ padding: 0;
+ border: 0;
+ background: transparent;
+ font: 700 20px/28px var(--font-mono);
+ color: var(--ink);
+}
+
+.copyBtn {
+ height: 28px;
+ padding: 0 var(--space-3);
+ font-size: 12px;
+ line-height: 16px;
+}
+
+.hint {
+ margin: 0;
+ font-size: var(--type-small-size);
+ line-height: var(--type-small-line);
+ color: var(--ink-muted);
+}
+
+/* ---- Repositories ---- */
+
+.repos {
+ padding-top: var(--space-12);
+}
+
+.sectionTitle {
+ margin: 0 0 var(--space-4);
+ font-size: var(--type-heading-size);
+ line-height: var(--type-heading-line);
+}
+
+.repoList {
+ margin: 0;
+ padding: 0;
+ list-style: none;
+ border-top: var(--stroke) solid var(--line);
+}
+
+.repoRow {
+ display: grid;
+ grid-template-columns: 9rem minmax(0, 1fr) auto;
+ gap: var(--space-4);
+ align-items: center;
+ padding: var(--space-3) 0;
+ border-bottom: var(--stroke) solid var(--line);
+}
+
+.repoName {
+ font-weight: 700;
+}
+
+.repoUrl {
+ overflow-wrap: anywhere;
+ font-family: var(--font-mono);
+ font-size: 14px;
+}
+
+@media (max-width: 720px) {
+ .inner {
+ padding: var(--space-8) var(--space-4) var(--space-12);
+ }
+
+ .title {
+ font-size: var(--type-title-size);
+ line-height: var(--type-title-line);
+ }
+
+ .group {
+ grid-template-columns: minmax(0, 1fr);
+ }
+
+ .repoRow {
+ grid-template-columns: minmax(0, 1fr) auto;
+ }
+
+ .repoUrl {
+ grid-column: 1 / -1;
+ grid-row: 2;
+ }
+}
diff --git a/src/pages/qq.tsx b/src/pages/qq.tsx
new file mode 100644
index 0000000..9aa3cb6
--- /dev/null
+++ b/src/pages/qq.tsx
@@ -0,0 +1,120 @@
+/**
+ * QQ group page (/qq): the group QR code, the group ID with a copy button, a join link, and the
+ * organization's repositories. XRobot Style: ink on paper, 1px lines, square corners.
+ */
+import React, { useCallback, useState } from 'react';
+import Layout from '@theme/Layout';
+import { translate } from '@docusaurus/Translate';
+import { PathLabel } from '@site/src/components/xr';
+import { copyTextToClipboard } from '@site/src/utils/clipboard';
+import styles from './qq.module.css';
+
+const GROUP = {
+ name: translate({ id: 'qq.groupName', message: 'XRobot 交流群' }),
+ number: '608182228',
+ joinUrl: 'https://qm.qq.com/q/RPgE71OXmw',
+ qr: '/img/qq-group-qr.jpg',
+};
+
+const REPOS: Array<{ name: string; url: string }> = [
+ { name: translate({ id: 'qq.repo.github', message: 'GitHub' }), url: 'https://github.com/xrobot-org/XRobot.git' },
+ { name: translate({ id: 'qq.repo.gitee', message: 'Gitee' }), url: 'https://gitee.com/x-robot/XRobot.git' },
+ { name: translate({ id: 'qq.repo.docs', message: '文档' }), url: 'https://xrobot-org.github.io/' },
+ { name: 'OneMessage', url: 'https://github.com/Jiu-xiao/OneMessage.git' },
+ { name: 'MiniShell', url: 'https://github.com/Jiu-xiao/mini_shell.git' },
+ { name: 'MiniFlashDB', url: 'https://github.com/Jiu-xiao/MiniFlashDB.git' },
+];
+
+/** Copy button; reports "copied" only when the clipboard write succeeded. */
+function CopyButton({ text }: { text: string }): JSX.Element {
+ const [copied, setCopied] = useState(null);
+ const onCopy = useCallback(() => {
+ void copyTextToClipboard(text).then((ok) => {
+ setCopied(ok);
+ window.setTimeout(() => setCopied(null), 1600);
+ });
+ }, [text]);
+ const label =
+ copied === null
+ ? translate({ id: 'qq.copy', message: '复制' })
+ : copied
+ ? translate({ id: 'qq.copied', message: '已复制 ✓' })
+ : translate({ id: 'qq.copyFailed', message: '复制失败' });
+ return (
+
+ {label}
+
+ );
+}
+
+export default function QqPage(): JSX.Element {
+ return (
+
+
+
+
+
+ {translate({ id: 'qq.title', message: '加入交流' })}
+
+ {translate({
+ id: 'qq.lead',
+ message: 'XRobot 组织(青岛大学嵌入式软件开源)及其衍生项目的交流群。使用中遇到的问题可以直接在群里提出。',
+ })}
+
+
+
+
+
+
+
+
+
+
+
+ {translate({ id: 'qq.repos', message: '组织与项目' })}
+
+
+
+
+
+ );
+}
diff --git a/src/theme-modules.d.ts b/src/theme-modules.d.ts
new file mode 100644
index 0000000..c35f919
--- /dev/null
+++ b/src/theme-modules.d.ts
@@ -0,0 +1,57 @@
+/**
+ * Ambient module declarations for the Docusaurus webpack module aliases and
+ * CSS modules, which TypeScript cannot resolve from node_modules:
+ * - `@theme/*` resolves to the active theme or src/theme overrides;
+ * - `@theme-original/*` resolves to the overridden implementation (swizzle);
+ * - `@docusaurus/` are build-time aliases defined by
+ * @docusaurus/core/module-type-aliases;
+ * - `*.module.css` are CSS modules processed by the bundler.
+ */
+declare module '@theme/*';
+declare module '@theme-original/*';
+
+declare module '@docusaurus/Translate' {
+ import type React from 'react';
+ export function translate(
+ translation: {id?: string; message: string; description?: string},
+ values?: Record,
+ ): string;
+ const Translate: React.FC<{
+ id?: string;
+ message?: string;
+ description?: string;
+ values?: Record;
+ children?: React.ReactNode;
+ }>;
+ export default Translate;
+}
+
+declare module '@docusaurus/Link';
+declare module '@docusaurus/BrowserOnly' {
+ import type React from 'react';
+ export default function BrowserOnly({
+ children,
+ fallback,
+ }: {
+ children: () => React.ReactNode;
+ fallback?: React.ReactNode;
+ }): React.ReactNode;
+}
+declare module '@docusaurus/router' {
+ export function useLocation(): {pathname: string; search: string; hash: string};
+}
+declare module '@docusaurus/useBaseUrl';
+declare module '@docusaurus/useDocusaurusContext' {
+ export default function useDocusaurusContext(): {
+ siteConfig: {title: string; tagline: string; url: string; baseUrl: string; [key: string]: unknown};
+ i18n: {currentLocale: string; [key: string]: unknown};
+ [key: string]: unknown;
+ };
+}
+
+declare module '*.module.css' {
+ const classes: {readonly [key: string]: string};
+ export default classes;
+}
+
+declare module '*.css';
diff --git a/src/theme/CodeBlock/index.tsx b/src/theme/CodeBlock/index.tsx
new file mode 100644
index 0000000..5d0cabc
--- /dev/null
+++ b/src/theme/CodeBlock/index.tsx
@@ -0,0 +1,124 @@
+import React, { useEffect, useId, useRef, useState, type ReactNode } from 'react';
+import CodeBlock from '@theme-original/CodeBlock';
+import type CodeBlockType from '@theme/CodeBlock';
+import type { WrapperProps } from '@docusaurus/types';
+import { translate } from '@docusaurus/Translate';
+
+type Props = WrapperProps;
+
+/**
+ * Long-code folding: blocks with more than 15 lines start
+ * collapsed to 8 preview lines with a fade-out gradient and a toggle at
+ * the bottom center; expanding returns the toggle to normal flow below the
+ * block, collapsing again scrolls the block back into view when needed.
+ *
+ * The line count comes from the `children` string, so the collapsed state is
+ * decided on the server render — no full-height flash before hydration. The
+ * preview height is measured once on mount (real line-height + pre padding)
+ * and written to a CSS variable, with a line-height-based CSS fallback.
+ */
+
+const LINE_THRESHOLD = 15;
+const PREVIEW_LINES = 8;
+
+function instantMotion(): boolean {
+ if (typeof document === 'undefined') return true;
+ return document.documentElement.dataset.motion === 'off';
+}
+
+export default function CodeBlockWrapper(props: Props): ReactNode {
+ const text = typeof props.children === 'string' ? props.children : String(props.children ?? '');
+ const lineCount = text.length === 0 ? 0 : text.replace(/\n+$/, '').split('\n').length;
+ const foldable = lineCount > LINE_THRESHOLD;
+ const [collapsed, setCollapsed] = useState(foldable);
+ const wrapperRef = useRef(null);
+ const contentId = useId();
+
+ useEffect(() => {
+ if (!foldable) return undefined;
+ const el = wrapperRef.current;
+ if (!el) return undefined;
+ const measure = () => {
+ const line = el.querySelector('.token-line');
+ const pre = el.querySelector('pre');
+ if (!line || !pre) return;
+ const styles = getComputedStyle(line);
+ const lineHeight = Number.parseFloat(styles.lineHeight) || line.offsetHeight || 21.6;
+ const preStyles = getComputedStyle(pre);
+ const padding =
+ (Number.parseFloat(preStyles.paddingTop) || 0) + (Number.parseFloat(preStyles.paddingBottom) || 0);
+ el.style.setProperty('--xr-fold-preview-height', `${Math.round(PREVIEW_LINES * lineHeight + padding)}px`);
+ };
+ measure();
+ // Web fonts can change the metrics after the first paint.
+ document.fonts?.ready.then(measure).catch(() => {});
+ return undefined;
+ }, [foldable]);
+
+ if (!foldable) {
+ return ;
+ }
+
+ const expandText = translate({
+ id: 'appearance.codeFold.expand',
+ message: '展开',
+ description: 'Button label to expand a collapsed long code block',
+ });
+ const collapseText = translate({
+ id: 'appearance.codeFold.collapse',
+ message: '收起',
+ description: 'Button label to collapse a long code block again',
+ });
+ const expandedMsg = translate({
+ id: 'appearance.codeFold.expanded',
+ message: '代码块已展开',
+ description: 'Screen-reader announcement after a code block is expanded',
+ });
+ const collapsedMsg = translate({
+ id: 'appearance.codeFold.collapsed',
+ message: '代码块已折叠',
+ description: 'Screen-reader announcement after a code block is collapsed',
+ });
+
+ const toggle = () => {
+ const next = !collapsed;
+ setCollapsed(next);
+ if (next && !instantMotion()) {
+ const rect = wrapperRef.current?.getBoundingClientRect();
+ // Collapsing again: bring the block header back into view if it
+ // scrolled above the viewport while expanded.
+ if (rect && rect.top < 0) {
+ wrapperRef.current?.scrollIntoView({ behavior: 'smooth', block: 'nearest' });
+ }
+ }
+ };
+
+ return (
+
+ {/* aria-controls target: the region that actually expands/collapses. The
+ code stays in the DOM when collapsed (max-height only), so screen
+ readers can still read it. */}
+
+
+
+
+ {collapsed ? collapsedMsg : expandedMsg}
+
+
+
+
+
+ {collapsed ? expandText : collapseText}
+
+
+ );
+}
diff --git a/src/theme/ColorModeToggle/index.module.css b/src/theme/ColorModeToggle/index.module.css
new file mode 100644
index 0000000..e6be1cb
--- /dev/null
+++ b/src/theme/ColorModeToggle/index.module.css
@@ -0,0 +1,53 @@
+/* Light/dark toggle button: two stacked icons cross-fade and rotate on
+ html[data-theme='dark']. */
+
+.toggle {
+ position: relative;
+ width: 2.25rem;
+ height: 2.25rem;
+ padding: 0;
+ border: none;
+ border-radius: var(--ifm-button-border-radius);
+ background: transparent;
+ color: inherit;
+ cursor: pointer;
+ transition: background-color 0.15s ease;
+}
+
+.toggle:hover {
+ background: var(--paper-sunken);
+}
+
+.icon {
+ position: absolute;
+ inset: 0;
+ display: grid;
+ place-items: center;
+ opacity: 1;
+ transform: rotate(0deg);
+ transition:
+ opacity 0.3s ease,
+ transform 0.3s ease;
+}
+
+/* light: sun visible, moon hidden (rotated away) */
+.iconMoon {
+ opacity: 0;
+ transform: rotate(-90deg);
+}
+
+/* dark: moon visible, sun hidden */
+html[data-theme='dark'] .iconSun {
+ opacity: 0;
+ transform: rotate(90deg);
+}
+
+html[data-theme='dark'] .iconMoon {
+ opacity: 1;
+ transform: rotate(0deg);
+}
+
+/* page animation switch off (src/utils/motion.ts) */
+:global(html[data-motion='off']) .icon {
+ transition: none;
+}
diff --git a/src/theme/ColorModeToggle/index.tsx b/src/theme/ColorModeToggle/index.tsx
new file mode 100644
index 0000000..196848f
--- /dev/null
+++ b/src/theme/ColorModeToggle/index.tsx
@@ -0,0 +1,64 @@
+import React, {type ReactNode} from 'react';
+import ColorModeToggle from '@theme-original/ColorModeToggle';
+import type ColorModeToggleType from '@theme/ColorModeToggle';
+import type {WrapperProps} from '@docusaurus/types';
+import {useColorMode} from '@docusaurus/theme-common';
+import {translate} from '@docusaurus/Translate';
+import {animateColorModeSwitch} from '@site/src/utils/themeTransition';
+import styles from './index.module.css';
+
+type Props = WrapperProps;
+
+// The original toggle is kept imported as a fallback: rendering
+// instead of the JSX below restores the
+// stock Docusaurus button.
+
+export default function ColorModeToggleWrapper(_props: Props): ReactNode {
+ const {colorMode, setColorMode} = useColorMode();
+ const isDark = colorMode === 'dark';
+
+ const toggle = () => {
+ const next = isDark ? 'light' : 'dark';
+ animateColorModeSwitch(() => setColorMode(next));
+ };
+
+ return (
+
+
+
+
+
+
+
+
+
+
+
+
+
+ );
+}
diff --git a/src/theme/Root/index.tsx b/src/theme/Root/index.tsx
new file mode 100644
index 0000000..defd25c
--- /dev/null
+++ b/src/theme/Root/index.tsx
@@ -0,0 +1,20 @@
+import React, {type ReactNode} from 'react';
+import OriginalRoot from '@theme-original/Root';
+import ReadingProgress from '@site/src/components/reading/ReadingProgress';
+
+/**
+ * App-level wrapper (wrapped `@theme/Root`, which Docusaurus core provides as
+ * a fallback theme component — hence the hand-written `@theme-original/Root`
+ * import, matching the swizzle wrap template).
+ *
+ * Hosts the reading progress bar / circle and the back-to-top button, which
+ * live outside the per-route layout.
+ */
+export default function Root({children}: {children: ReactNode}): ReactNode {
+ return (
+
+ {children}
+
+
+ );
+}
diff --git a/src/utils/clipboard.ts b/src/utils/clipboard.ts
new file mode 100644
index 0000000..6c9211b
--- /dev/null
+++ b/src/utils/clipboard.ts
@@ -0,0 +1,26 @@
+/**
+ * Clipboard write with an execCommand fallback, reporting actual success so
+ * callers never show "copied" when every strategy was rejected.
+ */
+export async function copyTextToClipboard(text: string): Promise {
+ try {
+ await navigator.clipboard.writeText(text);
+ return true;
+ } catch {
+ /* clipboard API rejected or unavailable: try the legacy path */
+ }
+ const area = document.createElement('textarea');
+ area.value = text;
+ area.setAttribute('readonly', 'true');
+ area.style.position = 'fixed';
+ area.style.opacity = '0';
+ try {
+ document.body.appendChild(area);
+ area.select();
+ return document.execCommand('copy');
+ } catch {
+ return false;
+ } finally {
+ area.remove();
+ }
+}
diff --git a/src/utils/motion.ts b/src/utils/motion.ts
new file mode 100644
index 0000000..f4f5514
--- /dev/null
+++ b/src/utils/motion.ts
@@ -0,0 +1,53 @@
+/**
+ * Page-level animation switch, shared by every UI that reads or writes it.
+ *
+ * Used by the "动画 开 / 关" control in the home page hero and by the showcase widgets;
+ * static/motion-init.js applies the stored value before first paint.
+ *
+ * Animation is on by default, independent of the OS `prefers-reduced-motion` setting;
+ * the choice is stored in localStorage and broadcast with the `xr-motion` event so every
+ * widget follows it at once. CSS keys off `html[data-motion]`.
+ */
+import { useEffect, useState } from 'react';
+
+export const MOTION_KEY = 'xr-motion';
+
+export function readMotionOff(): boolean {
+ try {
+ return window.localStorage.getItem(MOTION_KEY) === 'off';
+ } catch {
+ return false;
+ }
+}
+
+export function setMotionOff(off: boolean): void {
+ try {
+ window.localStorage.setItem(MOTION_KEY, off ? 'off' : 'on');
+ } catch {
+ /* storage unavailable: the switch still works for this page view */
+ }
+ document.documentElement.dataset.motion = off ? 'off' : 'on';
+ window.dispatchEvent(new CustomEvent('xr-motion', { detail: off }));
+}
+
+export function useReducedMotion(): boolean {
+ const [reduced, setReduced] = useState(false);
+ useEffect(() => {
+ const update = (e?: Event) => setReduced(e instanceof CustomEvent ? Boolean(e.detail) : readMotionOff());
+ // another tab changed the switch: follow it here too
+ const onStorage = (e: StorageEvent) => {
+ if (e.key !== MOTION_KEY) return;
+ const off = e.newValue === 'off';
+ document.documentElement.dataset.motion = off ? 'off' : 'on';
+ setReduced(off);
+ };
+ update();
+ window.addEventListener('xr-motion', update);
+ window.addEventListener('storage', onStorage);
+ return () => {
+ window.removeEventListener('xr-motion', update);
+ window.removeEventListener('storage', onStorage);
+ };
+ }, []);
+ return reduced;
+}
diff --git a/src/utils/themeTransition.ts b/src/utils/themeTransition.ts
new file mode 100644
index 0000000..a441dd4
--- /dev/null
+++ b/src/utils/themeTransition.ts
@@ -0,0 +1,29 @@
+/**
+ * Animated light/dark switch: fades every color over ~320ms via a temporary
+ * `is-theme-transitioning` class on (CSS lives in
+ * xrstyle-reading.css, section b).
+ *
+ * We deliberately do NOT use document.startViewTransition here: its snapshot
+ * crossfade freezes the whole page for the duration and stalls rendering for
+ * seconds in some environments, while the in-place color transition keeps the
+ * page live and measurably smooth (rAF sampling: no dropped frames).
+ *
+ * With the page animation switch off, the theme is
+ * applied instantly. Re-entrant clicks during a fade skip straight to apply()
+ * so rapid toggling can never stack animations.
+ */
+export function animateColorModeSwitch(apply: () => void): void {
+ if (typeof document === 'undefined' || typeof window === 'undefined') {
+ apply();
+ return;
+ }
+ const root = document.documentElement;
+ const motionOff = root.dataset.motion === 'off';
+ if (motionOff || root.classList.contains('is-theme-transitioning')) {
+ apply();
+ return;
+ }
+ root.classList.add('is-theme-transitioning');
+ apply();
+ window.setTimeout(() => root.classList.remove('is-theme-transitioning'), 360);
+}
diff --git a/static/img/qq-group-qr.jpg b/static/img/qq-group-qr.jpg
new file mode 100644
index 0000000..d07b775
Binary files /dev/null and b/static/img/qq-group-qr.jpg differ
diff --git a/static/motion-init.js b/static/motion-init.js
new file mode 100644
index 0000000..8c96634
--- /dev/null
+++ b/static/motion-init.js
@@ -0,0 +1,16 @@
+/**
+ * Applies the stored page animation switch to before first paint
+ * (plain ES5, loaded synchronously in by docusaurus.config.js), so CSS keyed on
+ * html[data-motion='off'] never flashes the animated state. Same key and default as
+ * src/utils/motion.ts.
+ */
+(function () {
+ 'use strict';
+ var off = false;
+ try {
+ off = window.localStorage.getItem('xr-motion') === 'off';
+ } catch (e) {
+ /* storage unavailable: animation stays on */
+ }
+ document.documentElement.setAttribute('data-motion', off ? 'off' : 'on');
+})();
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..0496637
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,25 @@
+{
+ "compilerOptions": {
+ "target": "ES2020",
+ "lib": ["DOM", "DOM.Iterable", "ES2020"],
+ "module": "ESNext",
+ "moduleResolution": "Bundler",
+ "jsx": "react-jsx",
+ "strict": true,
+ "noEmit": true,
+ "skipLibCheck": true,
+ "esModuleInterop": true,
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "forceConsistentCasingInFileNames": true,
+ "allowJs": true,
+ "allowImportingTsExtensions": true,
+ "types": ["node", "react"],
+ "baseUrl": ".",
+ "paths": {
+ "@site/*": ["./*"]
+ }
+ },
+ "include": ["src", "scripts"],
+ "exclude": ["node_modules", "build", ".docusaurus"]
+}