fix(docs): use native header control composition and default sizing
This commit is contained in:
@@ -478,3 +478,4 @@ DateField/DateInputGroup 已公开,先读[DATE-02 报告](docs/migrations/DATE
|
||||
- 文档导航索引应覆盖所有实际根指南与组件页;展示真实社区版本及固定设计基线,不伪造尚未提供的版本、框架或组件选项。缺少的公共组件可保留现有语义实现并记录。
|
||||
- 视觉验收必须用同视口官网页面核对实际背景、字号、留白、卡片列数和预览内容,不把源码参数或功能回归通过当成视觉一致。总览不能擅自改成纯文字摘要卡;目录 Link 须清除默认圆角,防止选中线弯曲。官方 CDN 缩略图仅用于设计预览,保留加载失败降级,不冒充 Vue 运行结果。
|
||||
- 公共壳层须单独验收 Header/Search:CSS 用实际 `--field-background`,不能把 Tailwind 的 bg-field 当作存在 `--field` 变量。核对计算颜色与透明度;搜索遮罩按主题局部适配,不能直接拿 Modal 默认遮罩代表官网搜索。两行导航无中间边框、桌面 gap 4px,sticky 总高度和移动端一起检查。
|
||||
- 使用组件发现异常时先核对默认组件、真实 DOM 和覆盖来源;若是组件本身问题,修组件及行为回归,不在文档藏补丁。文档不得清零 Button 内边距后再叠图标负边距;版本使用原生 button 的 PopoverTrigger,链接按钮使用 Button asChild + a 保留导航语义,ToggleButtonGroup 分离模式用 isDetached,不重写其尺寸/间距。定制配色用组件提供的状态变量。
|
||||
|
||||
@@ -28,6 +28,7 @@ function setTheme(value: unknown) {
|
||||
<template>
|
||||
<ToggleButtonGroup
|
||||
class="docs-theme-wide"
|
||||
is-detached
|
||||
:model-value="mode"
|
||||
selection-mode="single"
|
||||
disallow-empty-selection
|
||||
@@ -40,6 +41,7 @@ function setTheme(value: unknown) {
|
||||
:id="choice.id"
|
||||
:key="choice.id"
|
||||
is-icon-only
|
||||
variant="ghost"
|
||||
:aria-label="choice.label"
|
||||
>
|
||||
<component :is="choice.icon" aria-hidden="true" :size="15" />
|
||||
@@ -63,6 +65,7 @@ function setTheme(value: unknown) {
|
||||
<PopoverDialog>
|
||||
<PopoverHeading class="sr-only">外观</PopoverHeading>
|
||||
<ToggleButtonGroup
|
||||
is-detached
|
||||
:model-value="mode"
|
||||
selection-mode="single"
|
||||
disallow-empty-selection
|
||||
@@ -75,6 +78,7 @@ function setTheme(value: unknown) {
|
||||
:id="choice.id"
|
||||
:key="choice.id"
|
||||
is-icon-only
|
||||
variant="ghost"
|
||||
:aria-label="choice.label"
|
||||
>
|
||||
<component :is="choice.icon" aria-hidden="true" :size="16" />
|
||||
|
||||
@@ -218,16 +218,9 @@ async function copyMarkdownCode(event: MouseEvent) {
|
||||
<Chip size="sm" variant="soft">Vue</Chip>
|
||||
</Link>
|
||||
<Popover>
|
||||
<PopoverTrigger as-child>
|
||||
<Button
|
||||
class="version"
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
aria-label="版本信息"
|
||||
>
|
||||
v0.0.1
|
||||
<IconChevronDown :size="12" aria-hidden="true" />
|
||||
</Button>
|
||||
<PopoverTrigger as="button" class="version" aria-label="版本信息">
|
||||
<span>v0.0.1</span>
|
||||
<IconChevronDown :size="14" aria-hidden="true" />
|
||||
</PopoverTrigger>
|
||||
<PopoverContent placement="bottom start">
|
||||
<PopoverDialog class="version-panel">
|
||||
@@ -248,15 +241,17 @@ async function copyMarkdownCode(event: MouseEvent) {
|
||||
</div>
|
||||
<DocSearch />
|
||||
<div class="nav-tools">
|
||||
<Link
|
||||
class="docs-github"
|
||||
href="https://git.myjdemo.cn/maoyingjie/heroui-vue"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
aria-label="项目源码"
|
||||
>
|
||||
<IconBrandGithub :size="19" aria-hidden="true" />
|
||||
</Link>
|
||||
<Button as-child variant="tertiary" size="sm" class="docs-github">
|
||||
<a
|
||||
href="https://git.myjdemo.cn/maoyingjie/heroui-vue"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
aria-label="项目源码"
|
||||
>
|
||||
<IconBrandGithub :size="16" aria-hidden="true" />
|
||||
<span>源码</span>
|
||||
</a>
|
||||
</Button>
|
||||
<DocsThemeSwitch />
|
||||
<Drawer v-model:open="mobile">
|
||||
<DrawerTrigger as-child>
|
||||
|
||||
@@ -65,11 +65,20 @@ html {
|
||||
font-size: 11px;
|
||||
}
|
||||
.docs-nav .version {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 6px;
|
||||
padding: 4px 0;
|
||||
height: auto;
|
||||
min-width: 0;
|
||||
background: transparent;
|
||||
border: 0;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
.docs-nav .version svg {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.version-panel {
|
||||
display: flex;
|
||||
@@ -93,6 +102,7 @@ html {
|
||||
}
|
||||
.docs-github {
|
||||
color: var(--muted);
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.docs-nav-sections {
|
||||
display: flex;
|
||||
@@ -129,24 +139,17 @@ html {
|
||||
}
|
||||
.docs-theme-wide {
|
||||
padding: 2px;
|
||||
border-radius: 14px;
|
||||
border-radius: 999px;
|
||||
background: var(--default);
|
||||
gap: 0;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.docs-theme-wide .hv-toggle-button {
|
||||
min-width: 28px;
|
||||
width: 28px;
|
||||
height: 26px;
|
||||
border: 0;
|
||||
border-radius: 12px;
|
||||
padding: 4px;
|
||||
background: transparent;
|
||||
box-shadow: none;
|
||||
color: var(--muted);
|
||||
--toggle-button-bg-selected: var(--surface);
|
||||
--toggle-button-bg-selected-hover: var(--surface);
|
||||
--toggle-button-bg-selected-pressed: var(--surface);
|
||||
--toggle-button-fg-selected: var(--foreground);
|
||||
}
|
||||
.docs-theme-wide .hv-toggle-button[data-selected="true"] {
|
||||
background: var(--surface);
|
||||
color: var(--foreground);
|
||||
box-shadow: var(--surface-shadow);
|
||||
}
|
||||
.docs-theme-compact,
|
||||
@@ -673,7 +676,7 @@ html {
|
||||
.docs-sidebar {
|
||||
grid-row: 1 / span 2;
|
||||
}
|
||||
.version {
|
||||
.docs-nav .version {
|
||||
display: none;
|
||||
}
|
||||
.docs-nav-main {
|
||||
|
||||
@@ -49,3 +49,12 @@
|
||||
- 搜索触发器恢复官方 400×32px、14px 文本/20px 键帽,在 1280px 视口起点为 x=416;快捷键拆为独立修饰键与 K,按客户端平台显示 ⌘ 或 Ctrl,公共 aria-keyshortcuts 保留两种组合。
|
||||
- 搜索弹层不能直接沿用 Modal 默认黑色遮罩:浅色搜索为白色 40%,深色为黑色 40%,blur(8px) saturate(1.8)。本地仅覆盖文档搜索,库 Modal 本身不变。640px 弹层、12px 圆角和垂直位置同步核对。
|
||||
- 真实浏览器验证上述计算样式、深浅色、Meta+K 聚焦输入与 Escape 关闭,截图 `/private/tmp/heroui-docs-header-search.png`、`/private/tmp/heroui-docs-search-light.png`。自动搜索/壳层 16 项通过,类型与文档构建结果见 verification.md。没有声称文档搜索已复制官网云搜索或所有服务。
|
||||
|
||||
## Header 控件组合复核
|
||||
|
||||
继续按用户反馈检查版本、源码和主题按钮,追溯 Button/PopoverTrigger/Link/ToggleButtonGroup 的源码、上游样式与实际几何。本轮根因为文档组合与覆盖,不为满足“修组件”而无依据修改库默认样式:
|
||||
|
||||
- 版本原先 Button 被清零内边距,仍套用按钮 SVG 负边距和尺寸,箭头越出点击区域。改为与上游一致的原生 button PopoverTrigger + span/图标,6px gap、14px 图标,保留原生键盘与弹层语义。
|
||||
- 源码原为 19×19px 裸 Link;改为 Button asChild + a 的标准 tertiary/sm 链接按钮。真实目标仍为社区仓库,显示“源码”,不伪造官方 GitHub stars。使用库默认 32px 高度、12px 水平 padding、8px gap。
|
||||
- 主题组使用已有 isDetached/ghost/sm/isIconOnly API,删除文档对其宽高、padding、gap、圆角和基础背景的强制改写;库默认 32×32px,组间距 4px。仅保留文档主题配色变量与选中阴影。
|
||||
- 浏览器实测三类控件及文字/图标纵向中心均为 y=28px。版本点击展开/关闭、主题方向键移动焦点 + Space 选择、深浅色已验证。截图 `/private/tmp/heroui-header-controls-review.png`。未宣称修改过组件默认实现或完成全站像素验收。
|
||||
|
||||
@@ -890,3 +890,7 @@ M35/M36 合并最新 main 后:68 文件/849 项、typecheck、build:docs 通
|
||||
- 发现搜索触发器使用未定义 `--field` 导致计算背景透明,已改用实际字段 token;桌面两行导航边框移除、增加 4px gap,总高度 100px,移动端 92px。快捷键按平台分为两个键帽,搜索弹层浅色白遮罩/深色黑遮罩局部适配,库 Modal 不变。
|
||||
- 1280px 浏览器实测搜索框 x=416、400×32px、浅色背景 oklch(1 0 0)、键帽 14px/20px;深色字段 80% 背景和两种遮罩均确认。Meta+K 聚焦 combobox、Escape 关闭恢复焦点,390px 导航与页面未见横溢出;临时夹具已删除。
|
||||
- 增量合入远程 Toast/Table 后,完整 **69 文件 / 862 项通过**,typecheck、build:docs 与全仓格式/diff 检查通过(仍有既存 chunk 提示)。截图及具体差异见 [DOCS-01 公共区域补验](migrations/DOCS-01-shell-alignment.md)。本轮未修改库组件实现,无需重复打包产物行为验收。
|
||||
|
||||
### Header 控件组合修正
|
||||
|
||||
Button/PopoverTrigger/Link/ToggleButtonGroup 源码及几何复核后,移除文档错误组合与尺寸覆盖,使用原生版本触发器、标准链接按钮及 isDetached 主题组。新增原生触发器/源码 anchor/分离组/版本展开回归。相关 **3 文件 / 68 项通过**,typecheck、build:docs、全仓 Prettier/diff 通过;仍有既存 chunk 提示。真实浏览器核对文字/图标中心、点击区、4px 组间距、版本展开/关闭和方向键 + Space 主题切换;范围与截图见 [DOCS-01 控件组合复核](migrations/DOCS-01-shell-alignment.md)。本轮未改库默认实现,没有重新宣称完整测试数量或独立产物验收。
|
||||
|
||||
@@ -112,6 +112,27 @@ it("keeps component navigation usable when a themed thumbnail fails", async () =
|
||||
expect(w.get('a[href="/components/button"]').text()).toBe("Button 按钮");
|
||||
expect(w.findAll("img.component-thumbnail-dark")).toHaveLength(5);
|
||||
});
|
||||
|
||||
it("uses a native version trigger, button-styled source anchor and detached theme controls", async () => {
|
||||
host.route.path = "/components/button";
|
||||
const w = fixture(Layout as never, { global: { stubs: { Content: true } } });
|
||||
const version = w.get('[aria-label="版本信息"]');
|
||||
expect(version.element.tagName).toBe("BUTTON");
|
||||
const source = w.get('[aria-label="项目源码"]');
|
||||
expect(source.element.tagName).toBe("A");
|
||||
expect(source.attributes("href")).toBe(
|
||||
"https://git.myjdemo.cn/maoyingjie/heroui-vue",
|
||||
);
|
||||
expect(source.classes()).toContain("hv-button--tertiary");
|
||||
expect(w.get(".docs-theme-wide").classes()).toContain(
|
||||
"hv-toggle-button-group--detached",
|
||||
);
|
||||
await version.trigger("click");
|
||||
await flushPromises();
|
||||
expect(document.querySelector(".version-panel")?.textContent).toContain(
|
||||
"社区独立实现",
|
||||
);
|
||||
});
|
||||
describe("documentation structure", () => {
|
||||
it("makes every existing component page reachable exactly once in navigation and its category overview", () => {
|
||||
const pages = readdirSync("apps/docs/components")
|
||||
|
||||
Reference in New Issue
Block a user