merge: retain concurrent official docs visual corrections

This commit is contained in:
maoyingjie
2026-10-24 07:32:45 +08:00
11 changed files with 181 additions and 83 deletions
+1
View File
@@ -476,3 +476,4 @@ DateField/DateInputGroup 已公开,先读[DATE-02 报告](docs/migrations/DATE
- 弹层内目录跳转先处理关闭/焦点恢复,再路由和滚动;验证 URL、activeElement 与标题可见性,不能仅断言 hash 改变。
- 保持正文/演示 not-prose 边界、满宽换行表格和同 SFC 预览/高亮/复制。禁止无层级的全局 button/input 字体、cursor 等重置覆盖库变体;异步高亮/observer/timer 需清理。
- 文档导航索引应覆盖所有实际根指南与组件页;展示真实社区版本及固定设计基线,不伪造尚未提供的版本、框架或组件选项。缺少的公共组件可保留现有语义实现并记录。
- 视觉验收必须用同视口官网页面核对实际背景、字号、留白、卡片列数和预览内容,不把源码参数或功能回归通过当成视觉一致。总览不能擅自改成纯文字摘要卡;目录 Link 须清除默认圆角,防止选中线弯曲。官方 CDN 缩略图仅用于设计预览,保留加载失败降级,不冒充 Vue 运行结果。
+35 -9
View File
@@ -1,14 +1,20 @@
<script setup lang="ts">
import { computed } from "vue";
import { Card, CardTitle, CardDescription } from "@heroui-vue/components";
import { computed, ref } from "vue";
import { Card, Link } from "@heroui-vue/components";
import { withBase } from "vitepress";
import { IconArrowUpRight } from "@tabler/icons-vue";
import { searchIndex } from "virtual:docs-data";
import { componentItems } from "./navigation";
const props = defineProps<{ category: string }>();
const items = computed(() =>
componentItems.filter((item) => item.category === props.category),
);
const failed = ref(new Set<string>());
function imageName(title: string) {
return title.split(" ")[0].toLowerCase();
}
function thumbnail(title: string, theme: "light" | "dark") {
return `https://heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/related-components/${theme}-${imageName(title)}.png`;
}
function description(url: string) {
return (
searchIndex.find((entry) => entry.url === url && entry.section === "概览")
@@ -21,16 +27,36 @@ function description(url: string) {
<Card
v-for="item in items"
:key="item.url"
as="a"
:href="withBase(item.url)"
class="component-index-card"
variant="transparent"
>
<CardTitle>
<div class="component-index-preview" aria-hidden="true">
<template v-for="theme in ['light', 'dark'] as const" :key="theme">
<img
v-if="!failed.has(theme + item.url)"
:class="'component-thumbnail-' + theme"
:src="thumbnail(item.title, theme)"
alt=""
loading="lazy"
decoding="async"
width="874"
height="594"
@error="failed.add(theme + item.url)"
/>
<div
v-else
:class="
'component-thumbnail-' + theme + ' component-thumbnail-fallback'
"
>
<strong>{{ item.title.split(" ")[0] }}</strong>
<span>{{ description(item.url) }}</span>
</div>
</template>
</div>
<Link :href="withBase(item.url)" class="component-index-title">
{{ item.title }}
<IconArrowUpRight aria-hidden="true" :size="16" />
</CardTitle>
<CardDescription>{{ description(item.url) }}</CardDescription>
</Link>
</Card>
</div>
</template>
-16
View File
@@ -19,8 +19,6 @@ import {
Link,
Chip,
Separator,
Breadcrumbs,
BreadcrumbsItem,
Card,
Drawer,
DrawerTrigger,
@@ -379,20 +377,6 @@ async function copyMarkdownCode(event: MouseEvent) {
</Popover>
</div>
<main id="main" class="docs-main" tabindex="-1">
<nav aria-label="面包屑">
<Breadcrumbs class="breadcrumb" aria-label="页面路径">
<BreadcrumbsItem
:href="
withBase(
section === 'components' ? '/components' : '/introduction',
)
"
>
{{ section === "components" ? "组件" : "快速开始" }}
</BreadcrumbsItem>
<BreadcrumbsItem>{{ frontmatter.title }}</BreadcrumbsItem>
</Breadcrumbs>
</nav>
<h1 tabindex="-1">{{ frontmatter.title }}</h1>
<p v-if="frontmatter.description" class="page-description">
{{ frontmatter.description }}
+94 -45
View File
@@ -4,7 +4,7 @@
--docs-width: 1400px;
--docs-header-height: 96px;
--docs-sidebar-width: 220px;
--docs-toc-width: 240px;
--docs-toc-width: 268px;
}
html {
scroll-padding-top: 154px;
@@ -108,7 +108,7 @@ html {
border-radius: 0;
}
.docs-nav-sections nav .hv-link[aria-current="page"] {
border-color: var(--foreground);
border-color: var(--accent);
color: var(--foreground);
}
.docs-nav-sections .framework {
@@ -169,16 +169,17 @@ html {
}
.sidebar-tree h2 {
margin: 0;
padding: 8px 12px;
font-size: 13px;
padding: 4px 8px;
font-size: 14px;
font-weight: 500;
}
.sidebar-tree .hv-link {
display: flex;
width: 100%;
padding: 7px 12px;
padding: 8px;
margin: 2px 0;
font-size: 14px;
line-height: 1.5;
line-height: 20px;
color: var(--muted);
border-radius: var(--radius-field);
word-break: keep-all;
@@ -206,44 +207,34 @@ html {
outline: none;
}
.docs-main > .page-description {
font-size: 18px;
line-height: 1.65;
font-size: 16px;
line-height: 24px;
color: var(--muted);
margin: 0 0 32px;
margin: 16px 0 32px;
}
.docs-main > h1 {
font-size: 28px;
font-weight: 600;
line-height: 1.3;
line-height: 42px;
letter-spacing: -0.6px;
margin: 16px 0;
margin: 0;
outline: none;
}
.docs-main .breadcrumb {
font-size: 13px;
color: var(--muted);
}
.docs-main .breadcrumb .hv-link {
font-size: 13px;
color: var(--muted);
}
.docs-main .breadcrumb [aria-current="page"] {
color: var(--foreground);
}
.source-links {
display: flex;
flex-wrap: wrap;
gap: 8px;
margin: -12px 0 32px;
margin: -8px 0 32px;
}
.source-links .hv-link {
display: inline-flex;
align-items: center;
gap: 4px;
padding: 5px 9px;
border: 1px solid var(--docs-border);
border-radius: 7px;
font-size: 12px;
padding: 5px 12px;
border: 0;
border-radius: 999px;
background: var(--default);
font-size: 14px;
color: var(--muted);
}
.source-links .hv-link:hover {
@@ -277,6 +268,7 @@ html {
}
.toc-links .hv-link {
display: block;
border-radius: 0;
padding: 6px 8px 6px 12px;
line-height: 1.5;
font-size: 13px;
@@ -285,6 +277,9 @@ html {
white-space: nowrap;
text-overflow: ellipsis;
}
.toc-links .hv-link[aria-current="location"] {
box-shadow: inset 1px 0 var(--foreground);
}
.toc-links .hv-link.nested {
padding-left: 24px;
}
@@ -348,28 +343,85 @@ html {
}
.components-grid {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 12px;
grid-template-columns: repeat(3, minmax(0, 1fr));
column-gap: 16px;
row-gap: 40px;
}
.component-index-card {
padding: 18px;
border: 1px solid var(--docs-border);
position: relative;
display: flex;
flex-direction: column;
gap: 9px;
padding: 0;
border: 0;
border-radius: 0;
box-shadow: none;
overflow: visible;
}
.component-index-preview {
position: relative;
height: 198px;
overflow: hidden;
border: 1px solid var(--separator);
border-radius: 12px;
}
.component-index-card:hover {
background: var(--default-soft);
.component-index-preview > img,
.component-thumbnail-fallback {
position: absolute;
inset: 0;
width: 100%;
height: 100%;
object-fit: cover;
}
.component-index-card .hv-card__title {
display: flex;
align-items: center;
justify-content: space-between;
gap: 12px;
font-size: 14px;
.component-thumbnail-dark,
.dark .component-thumbnail-light {
display: none;
}
.component-index-card .hv-card__description {
margin-top: 6px;
.dark .component-thumbnail-dark {
display: block;
}
.component-thumbnail-fallback {
padding: 20px;
text-align: center;
align-content: center;
}
.component-thumbnail-fallback span {
display: block;
color: var(--muted);
font-size: 12px;
line-height: 1.6;
margin-top: 8px;
}
.component-index-title {
font-size: 16px;
font-weight: 500;
line-height: 24px;
color: var(--foreground);
}
.component-index-title::after {
content: "";
position: absolute;
inset: 0;
border-radius: 12px;
}
.component-index-card:hover .component-index-preview {
border-color: var(--muted);
}
.component-index-card:focus-within .component-index-preview {
outline: 2px solid var(--focus);
outline-offset: 3px;
}
@media (max-width: 1023px) {
.components-grid {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
}
@media (max-width: 639px) {
.components-grid {
grid-template-columns: 1fr;
}
.component-index-title {
order: -1;
}
}
.search-trigger {
display: flex;
@@ -667,9 +719,6 @@ html {
.source-links .hv-link {
font-size: 11px;
}
.components-grid {
grid-template-columns: 1fr;
}
.page-navigation .hv-card {
padding: 12px;
}
+15 -10
View File
@@ -46,8 +46,8 @@ body {
}
/* Documentation prose is isolated from every live component example. */
.docs-content {
font-size: 14px;
line-height: 1.85;
font-size: 16px;
line-height: 1.75;
}
.docs-content :is(h2, h3, h4):not(:where(.not-prose, .not-prose *)) {
font-weight: 600;
@@ -55,12 +55,17 @@ body {
scroll-margin-top: 154px;
}
.docs-content h2:not(:where(.not-prose, .not-prose *)) {
font-size: 23px;
font-size: 24px;
line-height: 1.333333;
letter-spacing: -0.5px;
margin: 40px 0 20px;
margin: 48px 0 24px;
}
.docs-content > h2:first-child,
.docs-content > div > h2:first-child {
margin-top: 0;
}
.docs-content h3:not(:where(.not-prose, .not-prose *)) {
font-size: 18px;
font-size: 20px;
margin: 32px 0 16px;
}
.docs-content h4:not(:where(.not-prose, .not-prose *)) {
@@ -104,9 +109,9 @@ body {
}
.docs-content div[class*="language-"] {
position: relative;
border: 1px solid var(--docs-border);
border-radius: 10px;
background: var(--surface);
border: 0;
border-radius: 12px;
background: var(--default);
margin: 16px 0;
}
.docs-content div[class*="language-"] > .lang {
@@ -190,9 +195,9 @@ body {
min-width: 0;
height: 30px;
padding: 0;
border: 1px solid var(--docs-border);
border: 0;
border-radius: 6px;
background: var(--surface);
background: transparent;
color: var(--muted);
line-height: 1;
}
+1 -3
View File
@@ -1,10 +1,8 @@
---
title: 所有组件(Vue)
description: 浏览库中所有可用组件的完整列表,更多组件正在路上。
description: 浏览已迁移的 Vue 组件,更多组件正在路上。
---
仅展示已经实现并提供文档的 Vue 组件。各组件的支持范围与已知差异请查看对应 API 页面。
## 按钮
<DocsComponents category="buttons" />
@@ -27,3 +27,15 @@
- 5174 真实浏览器重点检查安装代码复制、图标居中、展开源码与高亮、搜索 isPending 的方向键/Enter 跳转及 Escape 焦点恢复、深色/跟随系统、桌面目录。Button 两张表在 1280px 视口均宽 724px,scrollWidth=clientWidth,页面无横向溢出。
- 390px iframe 实际响应式视口检查移动菜单、分区切换与目录跳转。修复后“表单”目录关闭并聚焦对应标题,内容在固定头部下可见。临时审查页面验后删除,不作为正式站点内容。
- 这不是全部页面逐像素、完整读屏、物理触屏或全浏览器验收;保留缺失组件及上述差异。最终构建、格式与独立产物回归结果同步在 verification.md。
## 2026-10-24:官网实测后的视觉返修
用户指出上一轮视觉退步后,实际访问 `https://heroui.com/en/docs/react/components` 及 Button 页面,使用相同 1280×720 视口对比。上一轮仅对照结构和部分源码,未正确验收总览卡片与首屏密度,此处更正:
- 组件总览恢复官方三列 / 16px 列距 / 40px 行距 / 198px 预览框 / 9px 标题间距,1024px 以下两列、640px 以下一列,移动端标题在预览上方。移除自行添加的文字摘要卡片和额外首段说明。
- 使用官方同源 CDN 的 light/dark 设计缩略图,按主题显示、懒加载,失败后退回名称与说明,导航仍可用。这些是上游设计缩略图,实际交互预览与复制代码仍来自 Vue SFC;没有把远程媒体下载到仓库。CDN 非提交版本化资源,不声明离线图片或逐像素固定快照。
- 实测官方右栏占 268px,正文内容宽 696px;修正上节误设的 240px,当前同视口正文与官方均为 696px。去掉页面顶部额外面包屑,将主标题/描述/首章节起点分别对齐到无公告条布局的 128/186/242px。
- 正文 16px、描述 16px/24px、二级标题 24px/32px;调整侧栏 36px 链接高度和分组留白。导航选中线恢复 accent 蓝色,目录选中用直线,清除 Link 默认圆角对目录线的干扰。
- 页面底色/前景与官方现有主题接近,未改组件库主题数值。代码背景改用 default 层、复制按钮透明,源码入口改为官方同类胶囊,避免白底代码框与细边框按钮割裂层次。
- 深浅色图片、390px 单列排版与桌面正文实测;Button 两张表均 696px 且无内部横向溢出。未增加官网的广告、Newsletter、未实现的版本/框架选项或跟随更新组件 API。
- 新增图片失败后导航仍可用回归,完整 59 文件 / 796 项通过。截图 `/private/tmp/heroui-docs-visual-review.png`、`/private/tmp/heroui-docs-visual-mobile.png`;最终构建与格式结果见 verification.md。
+2
View File
@@ -32,3 +32,5 @@
最终 pnpm test:69 文件 / 861 项通过;typecheck、build:docs、导航专项 10 项和 diff 检查通过。包含文档壳层的 `*-integrated.tgz` 再安装到同一独立消费者,7 份 ESM/CSS/SSR 脚本及全部 bundler/NodeNext 契约通过。
浏览器旧缓存页不能作为新壳层证据。新服务已恢复 5173,但本次最终浏览器补验落在连接失败的内部 data 页面并被工具 URL 策略阻断,未绕过;不声明已经完成合并后新文档壳层的真实浏览器复验。此前 Toast/Table 几何证据和 DOCS-01 独立报告的验证分别保留,未升级为全站视觉验收。
远程随后补充 DOCS-01 视觉层级修正(d8f7b04);继续正常合并,仅 verification 追加记录冲突按两边保留。该批不改组件库产物。最终完整回归更新为 69 文件 / 862 项,typecheck 与文档构建通过;7 份独立产物和两种类型契约的结果保持有效。
+2
View File
@@ -196,3 +196,5 @@ M18–M20 的标签桥接在 Vue 使用 indicator 注册表与 SSR 直接/原生
## DOCS-01 文档布局来源(2026-10-24)
固定 ce90ea3 的 `apps/docs/src/components/fumadocs/layouts/notebook`、page/toc、`apps/docs/src/app/global.css`、中文组件 meta/overview、component-preview-container、component-source/codeblock-client 与版本/框架/搜索控件。布局尺寸、导航分区、示例结构适配到 VitePress 和本库 Vue 组件,保留 HeroUI Apache-2.0 来源声明;没有运行时依赖相邻仓库。分类缩略图未复制,缺失组件与搜索/Table 原生语义保留项见 [DOCS-01](migrations/DOCS-01-shell-alignment.md)。
2026-10-24 视觉返修实际对照官网 components/Button 页面;总览直接引用官方组件目录同源 `heroui-assets.nyc3.cdn.digitaloceanspaces.com/docs/related-components/{light,dark}-<name>.png` 设计缩略图(来源规则见固定 `component-item.tsx`)。不下载或重绘媒体,图片失败仍保留本地名称/说明/导航;实际 Vue 演示保持原 SFC。官网为视觉补验依据,不替换固定组件 API 基线。
+6
View File
@@ -878,3 +878,9 @@ M35/M36 合并最新 main 后:68 文件/849 项、typecheck、build:docs 通
- 布局来源、已替换控件及原生搜索结果/API table 保留原因见 [DOCS-01](migrations/DOCS-01-shell-alignment.md)。本轮不继续迁移 Calendar/YearPicker。
最终又合入并行推送的 DOCS-01(671a276),Toast/Table 纳入 navigation.ts 的唯一清单和分类。69 文件/861 项、typecheck、build:docs、10 项文档清单专项通过;*-integrated.tgz 的 7 份独立消费脚本与两种类型解析契约通过。合并后新壳层浏览器补验受 URL 策略阻断,未把旧缓存视作验收、未绕过,详情见 M35-M36-acceptance。
### DOCS-01 官网视觉返修(2026-10-24)
实际访问官网 components/Button,以 1280×720 对照修正三列预览卡、标题/描述/首章节留白、696px 正文宽度、正文层级、代码背景和选中线。深浅色缩略图加载、390px 移动单列及 Button 长短表同为 696px/无横溢出已验。官方缩略图为外部设计资源,加载失败保留说明和导航,新增对应回归。完整 **59 文件 / 796 项通过**,typecheck、build:docs、全仓 Prettier 和 diff 检查通过;仍有既存 chunk 提示。临时窄屏页面已移除,截图与差异见 [DOCS-01 返修记录](migrations/DOCS-01-shell-alignment.md)。这次视觉实测补充并更正上节,不扩大为全站逐像素/物理触屏验收。
又增量保留 d8f7b04 的文档视觉层级/分类卡片修正;最终完整 Vitest 为 69 文件/862 项,typecheck、文档生产构建和 diff 检查通过。该批仅文档壳层及测试,没有更改此前验证的组件产物;未重写并行工作。
+13
View File
@@ -44,6 +44,7 @@ vi.mock("vitepress", async () => {
import Layout from "../apps/docs/.vitepress/theme/Layout.vue";
import DocSearch from "../apps/docs/.vitepress/theme/DocSearch.vue";
import Demo from "../apps/docs/.vitepress/theme/Demo.vue";
import DocsComponents from "../apps/docs/.vitepress/theme/DocsComponents.vue";
const wrappers: ReturnType<typeof mount>[] = [];
beforeEach(() => {
vi.clearAllMocks();
@@ -99,6 +100,18 @@ async function search(text: string) {
input().dispatchEvent(new Event("input", { bubbles: true }));
await flushPromises();
}
it("keeps component navigation usable when a themed thumbnail fails", async () => {
const w = fixture(DocsComponents as never, {
props: { category: "buttons" },
});
const image = w.get("img.component-thumbnail-light");
expect(image.attributes("src")).toContain("light-button.png");
await image.trigger("error");
expect(w.get(".component-thumbnail-fallback").text()).toContain("Button");
expect(w.get('a[href="/components/button"]').text()).toBe("Button 按钮");
expect(w.findAll("img.component-thumbnail-dark")).toHaveLength(5);
});
describe("documentation structure", () => {
it("makes every existing component page reachable exactly once in navigation and its category overview", () => {
const pages = readdirSync("apps/docs/components")