# 上游 HeroUI ↔ heroui-vue 硬差异审计(进行中) > 状态:**对比完成,待人工复核与浏览器验证**(2026-10-28)。本文档记录审计进度与已确认结论;硬差异总清单见第 5 节。 > 任务:逐组件对比上游 HeroUI(固定基线 ce90ea3 / 3.2.6)与 heroui-vue 的文档示例、API、实现、样式、动画、配色, > 列出硬差异(**只记录、不修改**)。SSR 相关差异与框架机制差异不计入。 ## 1. 范围与判定口径 - 对比对象:`heroui/apps/docs/content/docs/{en,cn}/react/components/**`、`heroui/apps/docs/src/demos/cn/**`、 `heroui/packages/styles/**`、`heroui/packages/react/src/components/**` ↔ `heroui-vue/apps/docs/components/*.md`、`heroui-vue/apps/docs/demos/*.vue`、 `heroui-vue/packages/styles/**`、`heroui-vue/packages/vue/src/components/**`。 - 忽略:SSR/水合/Nuxt;框架机制差异(onPress→@click、render→as/asChild/作用域插槽、children→插槽、 className→class、camelCase↔kebab-case、受控 idiom、"use client"、ref→defineExpose 等); 底座适配命名(data-placement↔data-side、--trigger-anchor-point↔--reka-popper-transform-origin、 slot 属性↔data-endpoint、UNSTABLE_portalContainer→to 等,但由此产生的可见视觉/行为差异要记); `hv-` 前缀、许可头、纯格式化差异;`release-*` 前缀的 release-notes 专用 demo。 - 记录:示例内容差异、API(props/事件/插槽/默认值/变体集合)、实现行为、CSS 数值、动画、配色、文档结构缺失。 ## 2. 全量机械对比已完成的结论(脚本级,已核) ### 2.1 示例清单(ComponentPreview 名) - 上游 72 个组件文档页 vs Vue 74 页。逐页示例名与顺序**完全一致**,仅: - `fieldset`:Vue 多一个示例 `fieldset-disabled`(上游无)。 - `textarea`(上游 `text-area`):`text-area-custom-styles` ↔ `textarea-custom-styles` 仅命名差异,内容待核。 - Vue 独有页面:`empty-state`、`header`(上游 style/组件源码有 empty-state、header,但**文档站无此页面**,属上游文档缺失,不是硬差异方向;页面质量另核)。 - demo 文件级:上游 EN registry 688 key vs Vue 699 个 .vue。除 `release-*`(跳过)与 textarea 命名外, Vue 独有 `empty-state-*`、`header-*`、`fieldset-disabled`、`form-foundation`、`handbook-*`、`slider-regression` (后者为文档站自用/回归用,不属组件文档示例)。 ### 2.2 组件 CSS 语义差异(归一化 hv- 前缀、注释、空白后仍不同:29 个文件) 已分类(详细逐条见 `/tmp/audit/css_semantic2.txt`,需并入最终报告): **属底座适配(可忽略或简注)**:popover 系(color-picker/date-picker/date-range-picker/dropdown/popover/select/tooltip) 的 `data-placement`→`data-side`、`--trigger-anchor-point`→`--reka-popper-transform-origin`、 `max-height: var(--reka-popover-content-available-height)`、`z-index: var(--z-index-overlay)`、 `[data-reka-popper-content-wrapper]` 修正、`motion-reduce` 动画抑制补充;`date-input-group` 的 `slot=`→`data-endpoint=`; `menu-item`/`tabs` 的 `[data-disabled="true"]`→`[data-disabled]`。 **初步判定为硬差异(待逐条并入报告)**: - `alert-dialog.css`:Vue 缺 `__header > .modal__icon { @apply mb-0 }`(header 含图标时的布局规则)。 - `color-input-group.css`:Vue 的 `__input` 多 `min-w-0`(任务记录中的有意修复,仍属与上游不同)。 - `color-slider.css`:轨道端帽渐变写法不同(上游 `linear-gradient(var(--track-start-color))`+`background-color` 端帽 vs Vue 双写 `linear-gradient(x,x)`+棋盘格组合)——透明度棋盘格渲染可能不同,需视觉核对。 - `color-swatch-picker.css`:`[data-light-color="true"] > *` 选择器(上游多一层 `& > *`);Vue 的 `__swatch` 新增棋盘格背景(上游无)——半透明色块渲染差异。 - `disclosure.css`:上游 `__heading` 用 `.accordion__heading`(上游自身笔误类)vs Vue 用 `.disclosure__heading`; `__trigger` 上游 `inline-block` vs Vue `inline-flex items-center`;Vue 新增 `.button svg.disclosure__indicator` 尺寸规则。 - `drawer.css`:上游用 transition(translate + `--drawer-enter/exit-duration/ease`)驱动进/退场, Vue 改用 `@keyframes drawer-in/out-*` + `drawer-backdrop-in/out`——时长缓动映射一致但机制不同, 打断/拖拽返回行为可能不同(需行为核对)。 - `input-otp.css`:Vue 新增 `__input` 绝对定位透明覆盖层(隐藏原生输入的适配)。 - `list-box-item.css`:Vue 新增 `[data-filtered="true"] { display: none }`。 - `modal.css`:Vue 新增 `__dialog[data-exiting]` 的 `modal-retain` 保活动画与 `pointer-events:none`; `.modal__trigger.button` display 修正。 - `range-calendar.css`:`__cell` Vue 多 `w-full`。 - `slider.css`:Vue 新增 `.slider__thumb:has(.slider__input:focus-visible)` 聚焦环; motion-reduce 由 utility 改写为 media query(`scale-100` 恢复规则写法不同,需核对语义)。 - `spinner.css`:Vue 新增 `.spinner > svg { @apply size-full }`。 - `table.css`:角圆角选择器 `td`→`:is(td,th.table__cell)`;`.table__cell` 新增 `text-start font-normal`; `.table__column-resizer` 新增 `z-index: 1`。 - `autocomplete.css`/`combo-box.css` 等:motion-reduce 补充(属适配,简注)。 ### 2.3 主题与全局 - `themes/default/variables.css`:数值完全一致;Vue 侧多 `--z-index-overlay/--z-index-toast` (上游在 `base/base.css` 定义,等值搬移,非差异)。 - `themes/shared/theme.css`、`base/scrollbar.css`:仅注释/前缀差异。 - **上游 `base/base.css` 有而 Vue 无对应**:`*::before...{ border-color: var(--border, currentColor) }` 边框色继承、 `:root { view-transition-name: none }` 与 `::view-transition { pointer-events: none }`。 前者是全库边框色回退语义,**疑为硬差异**(Vue 库内是否在别处实现待核);后两者与 view-transition 相关,影响面待核。 - 上游 `themes/default/components/index.css`(空模板)Vue 无——无视觉影响。 - `animations.css`:Vue 以 `@import "tw-animate-css"` 等价引入,无差异。 ### 2.4 tv 变体映射(上游 84 个导出 vs Vue 79 个) - 缺失导出(Vue 未提供同名 tv 映射):`descriptionVariants`、`fieldErrorVariants`、`labelVariants`、 `switchGroupVariants`、`textFieldVariants`——Vue 侧相应组件(Label/Description/FieldError/SwitchGroup/TextField) 似直接写类名而无变体映射导出,属 **API 导出差异**(对外 `@heroui-vue/styles` 契约)。 - `chipVariants`:Vue 的 `defaultVariants` 多 `size: "md"`(上游默认尺寸隐含在 CSS base)——**默认值差异**。 - `kbdVariants`:Vue 的 `defaultVariants` 多 `variant: "default"`——**默认值差异**。 - 其余 70+ 映射逐键一致(归一化前缀后)。 ### 2.5 文档 API 表(脚本抽取1424 行上游 prop 行) 逐页 prop 名差异绝大多数为框架映射(className→class、onPress、render、children→插槽、camelCase→kebab 等),已排除。 **待人工收口的候选硬差异**(需复核后写入报告): - `button`:Vue variant 列表含 `'danger-soft'`,上游 mdx 只列 6 变体(上游 `button.styles.ts`/`button.css` 实际有 danger-soft)——上游文档与自身代码不一致,Vue 文档更全;需注明。 - `switch`:上游文档含 render props(isHovered/isPressed/isFocused/isFocusVisible/state)与 SwitchGroup 段,Vue 对应段落结构不同,需核对是否遗漏。 - `input`/`textarea`/`search-field` 等表单直通属性(minLength/pattern/wrap/cols 等)在 Vue 文档的对应归属需核对是否完整。 - `select`:上游 `onClear`、`defaultChildren`、`state`、`selectedItems` 等触发器 render props 在 Vue 文档的对应表达需核对。 - `close-button`:上游 `onPress`/React Aria Button Props 段 ↔ Vue「原生按钮属性」段的 prop 覆盖需核对。 ### 2.6 示例内容(脚本级,待逐条人工判定) - 中文文案差异:683 对示例中 83 对有文案集合差异(`/tmp/audit/demo_cjk.txt`),其中已抽样确认: - `accordion-custom-styles`:**内容完全不同**(上游:数字藏品收藏场景+精细自定义类;Vue:简单描边容器/字号示例)——硬差异。 - `alert-dialog-*`:`controlled`(useState→ref/v-model,属框架差异)、`close-methods`/`custom-portal`/`custom-animations` 有描述文字删减(如「适合底部抽屉或 Toast」被删)——文档/示例文案差异,偏轻。 - `avatar-group-*` 等:Vue 补了模板字符串 aria-label(`${user.name}的头像`),上游无——无障碍增强,方向为 Vue 更全。 - class 字符串差异:96 对(`/tmp/audit/demo_classes.txt`),已抽样确认: - `button-*` 多个示例:上游示例外层容器类(`flex flex-wrap gap-3` 等)在 Vue 示例中被省略——**布局类缺失**,示例观感不同,硬差异(轻)。 - `button-custom-styles`:Vue 多 `motion-reduce:transition-none`(增强)。 - `button-group-basic` 等:Vue 示例内容比上游**大幅简化**(上游含 Dropdown/Chip/图标组合的真实场景)——硬差异,需确认是否其他示例补回。 - `alert-dialog-custom-animations`:Vue 用 tw-animate 工具类表达动画参数,上游用自定义 ease 类——动画参数本身是否一致待核。 - `alert-dialog-custom-styles`:上游示例有顶部渐变光线装饰条(`bg-linear-to-r ...`),Vue 无——视觉差异。 ## 3. 并行逐组件深查(进行中) | 批次 | 范围 | 输出 | 状态 | |---|---|---|---| | 01 | button、button-group、close-button、toggle-button、toggle-button-group | `docs/audit-groups/01-buttons.md`(原始 `/tmp/audit/groups/01-buttons.md`) | **已完成** | | 02 | card、surface、separator、toolbar、badge、chip、table | `docs/audit-groups/02-layout-display.md` | **已完成** | ### 批次 01 摘要(buttons 组,详见 `docs/audit-groups/01-buttons.md`) CSS/tv/配色五组件逐行一致,硬差异集中在示例与文档/API: 1. **示例被大幅简化/替换**:`button-group-basic` 上游是 GitHub 合并下拉 + 9 组按钮(复刻/扫码/点赞/星标/文本对齐等,含 Chip/Label/Description/13 图标),Vue 只剩 First/Second/Third;`button-group-custom-styles` 上游绿色配色合并下拉(`bg-[#08872B]`)被换成 `rounded-lg` 三按钮;`toggle-button-custom-styles` / `toggle-button-group-custom-styles` 上游主题变量样式(accent-soft 选中态、组 `aria-label="文本格式"`)被换成 `bg-purple-500`/`opacity-25` 且丢无障碍标签。 2. **示例文案英文化**:`button-group-*`、`toggle-button-*`、`toggle-button-group-*` 系列沿用 en 文案(First/Small/Like/Bold…),违背 cn 中文基线;`button-group-variants` 直接渲染小写变体名 "primary"。 3. **结构/props 丢失**:`button-group-sizes` 丢 `variant="secondary"`(视觉变体错);`button-group-full-width` 缺仅图标对齐组;`button-group-disabled` 缺 `isDisabled={false}` 覆盖演示;`toggle-button-group-full-width` 缺对齐组;`toggle-button-group-orientation` 按钮数 3→4;`toggle-button-basic/variants` 结构 1→2、2→4 按钮。 4. **API/文档**:上游 Button/ButtonGroup API 表漏 `danger-soft`/`outline`(与其自身 styles.ts/css/示例矛盾,Vue 文档补全,属上游文档缺陷);ToggleButtonGroup 组禁用覆盖语义相反(上游称 `isDisabled={false}` 可覆盖,Vue 实现 `Boolean(isDisabled||groupDisabled)` 不可覆盖且文档明说);Button 缺上游"相关案例"节与完整 CSS 类清单、Global CSS 示例被换成 `--button-bg` 手法;"相关组件"三处均与上游 registry 不同;`toggle-button.md` 禁用状态写 `[data-disabled="true"]` 与实际 CSS 不符。 5. **示例行为/动画**:`button-basic` 点击改文案(上游 console.log);`button-loading-state` Vue 加状态文本与防重复点击;`button-ripple-effect` 自实现波纹(0.6s、opacity 0.18)替代 m3-ripple;`button-with-icons` "搜索"图标 Globe→IconSearch 语义变化。 ### 批次 02 摘要(layout/display 组,详见 `docs/audit-groups/02-layout-display.md`) badge、surface 基本无硬差异;差异集中在 table 与 card: 1. **table 虚拟化/列宽能力缺口(最严重)**:`TableLayout` 不导出(rowHeight/estimatedRowHeight/headingHeight/loaderHeight/gap/padding 等 API 缺失),虚拟化退化为固定 42px 行高窗口;`defaultWidth="1fr"` 由 fr 权重退化为 `width:auto`,列宽分布可见不同;`table-virtualization` 示例改用 `table-fixed` + 截断类 + 手写 aria-rowcount/rowindex。 2. **card 示例颜色/行为差异**:`card-default`、`card-with-images` 图标丢 `text-primary`(渲染为默认前景色);`card-with-form` 新增 `required`/`autocomplete`(空表单被原生校验拦截无法提交),提交 alert → 内联状态文案、"忘记密码"链接 → 点击写提示文案。 3. **table 交互/语义**:排序表头 Vue 在 th 内放原生 button(无配套 CSS),焦点环不再是基线 `.table__column` inset 焦点环;空状态 `colspan` 默认 1(上游自动跨全列);行头渲染 `