feat: add Surface, Link and Spinner components

This commit is contained in:
maoyingjie
2026-10-21 13:04:06 +08:00
parent 9d40dc0ecb
commit 630963c652
52 changed files with 2683 additions and 162 deletions
+11
View File
@@ -70,3 +70,14 @@
- 修复独立 utilities.css 缺少库 @theme inline 映射的问题。此前 accent/surface 等自定义颜色工具类没有生成,计算样式中渐变为 none、光晕与标签背景为透明。现在显式导入本库主题映射。
- 把通用预览 max-width:100% 约束放入 components 层,恢复 utilities 层 max-w-md 的优先级;桌面计算宽度由 654px 恢复为 448px。
- 实际浏览器分别验证浅色与深色:渐变、边框透明度、光晕、推荐标签背景及按钮 accent 阴影均存在,页面无水平溢出。未宣称自动逐像素对比通过。
## Surface / Link / Spinner 迁移验证(M01–M03)
验证日期:2026-10-21。开发地址 `http://127.0.0.1:5173`,桌面视口,IAB 浏览器。
- `pnpm test`:7 个测试文件、51 项全部通过(新增 14 项 Surface/Link/Spinner/TextArea 行为测试;清单测试覆盖 Surface 4、Link 6、Spinner 5)。
- `pnpm typecheck` 通过;`pnpm build:docs`(含 styles + components + VitePress)通过;`pnpm format` 通过。
- Surface:浅色计算背景分别为 default `oklch(1 0 0)`、secondary `oklch(0.9524…)`、tertiary `oklch(0.9373…)`、transparent `rgba(0,0,0,0)`;深色切换后为 `oklch(0.2103…)` / `0.257` / `0.2721` / transparent。自定义样式示例渐变 `linear-gradient(to right bottom, accent/8, surface, surface-secondary)` 与 `border-accent/15` 生效。表单示例内 Input/TextArea 均为 secondary 变体。
- Link:`underline` / `no-underline` / `underline-offset-1..4` 计算值正确;默认图标 `data-default-icon` 与内置 SVG;自定义图标为 Tabler 且无 default 标记;asChild 渲染 `span[data-custom=foo]` 并合并 href 与 link 类。修复文档全局 `a { text-decoration: none }` 未入层导致 utility 下划线被覆盖的问题(改入 `@layer base`)。
- Spinner:尺寸 sm/md/lg/xl = 16/24/32/40px;颜色 current/accent/success/warning/danger 映射主题变量;`role="status"`、`aria-label="Loading"`、内部 SVG `aria-hidden` 与 viewBox;动画 `spin 0.75s`。Button 加载示例内 Spinner 为 16px,按钮 `data-pending` / `aria-busy`。
- Card 页面三处链接已改为 Link/LinkIcon。IAB 截图接口超时,未能保存本轮位图证据;以上为 DOM/计算样式记录,不等同于逐像素视觉验收。