Files
maoyingjie dc859fb8ae feat(styles): export shared field variant maps and restore the border fallback
HD-05 scope, against heroui ce90ea3 styles sources:

- add labelVariants/descriptionVariants/fieldErrorVariants/
  textFieldVariants/switchGroupVariants (+ VariantProps types) to
  @heroui-vue/styles and re-export them from @heroui-vue/components;
  variant keys, defaultVariants and slot sets match the pinned
  *.styles.ts files key for key (hv- namespace only)
- Label/Description/FieldError/useTextField/SwitchGroup now consume
  those mappings instead of inline class strings, so the state classes
  have a single source; rendered class output is unchanged and pinned
  by tests/shared-field-styles.test.ts (mapping output <-> component
  output)
- restore the global border-color fallback
  (*, ::after, ::before, ::backdrop, ::file-selector-button ->
  border-color: var(--border, currentColor)) in a new base/base.css,
  imported layer(base) right after preflight like the pinned entry:
  a low-priority default that components, utilities and consumer CSS
  override without !important
- view-transition globals from the pinned base.css stay unported: no
  View Transitions API usage exists in the library or docs site
- shared-styles package contract: packed runtime exports from both
  entries, variant-output assertions, CSS tokens incl. the fallback,
  strict nodenext+bundler type contract, and a real-browser consumer
  fixture (light/dark --border, explicit colors, consumer overrides,
  currentColor fallback) wired into check-package.mjs
- docs: styling layers/border fallback/exports notes, five component
  API pages, compatibility matrix and upstream source records

Full suite 111 files / 1634 tests, typecheck and build:docs pass;
shared-styles + api-root-aliases + handbook-styles verified against
the final tarballs.
2026-10-28 23:36:59 +08:00

1.4 KiB
Raw Permalink Blame History

Shared styles 独立产物验收(styles 导出与全局边框回退)

先运行 node scripts/check-package.mjs shared-styles(可与受影响契约合跑)统一构建、打包、安装和类型验收;它会把本夹具放入独立消费者并打印路径和 Vite 命令。按输出显式选空闲端口启动,不另外复制安装流程;入口不会自动启动服务。main.js 只从包根/发布 CSS 导入,不用源码 alias、私有路径或 Vue 模板编译器。

在真实浏览器核对:

  1. #default-border(无显式 border 颜色)的计算 border-color 等于当前主题的 --border(浅/深两值不同)。
  2. #explicit-border 的显式红边框不被全局回退覆盖。
  3. #override-border 的调用方普通 CSS(无 !important)覆盖生效;另在页面注入与库规则同等选择器的普通样式,验证库规则不是高优先级、不破坏消费者定制。
  4. #fallback-border(--border: initial)边框色回退为 currentColor(元素文字色)。
  5. #component-border 内 .hv-input-otp__slot 的显式 var(--field-border)(默认 transparent)不被全局回退覆盖;点 #theme-toggle 切深色后上述 --border 期望值同步变化。

记录计算样式实值与截图;不能因 CSS 文本包含 var(--border 就通过。类型正反例使用上级 shared-styles-contract.ts 的两种解析模式。