去掉 GSAP。对话入场改为按需加载的 Motion,仍是 160 毫秒,仍尊重减少动态效果。 用 shadcn@4.21.4 补上任务书列出的组件,不覆盖已有的 8 个。设计令牌映射到 shadcn 变量。 手写控件检查和只减不增的白名单。Motion 预设与四个 store 只是骨架,没有接到页面上。 自测:tsc --noEmit 退出码 0;npm run lint 0 error(122 条原有 warning); 定向测试 37 项、fail 0、cancelled 0;next build 后 / 仍是 Static; 首屏 JS gzip 578349 → 578435(+86 字节,+0.01%)。 Co-Authored-By: Grok (agent loop)
32 lines
1.3 KiB
TypeScript
32 lines
1.3 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import { readFileSync } from "node:fs";
|
|
import test from "node:test";
|
|
|
|
const css = readFileSync(new URL("../src/app/globals.css", import.meta.url), "utf8");
|
|
|
|
test("shadcn tailwind utilities are imported on the second line", () => {
|
|
const [first, second] = css.split(/\r?\n/);
|
|
assert.equal(first, '@import "tailwindcss";');
|
|
assert.equal(second, '@import "shadcn/tailwind.css";');
|
|
});
|
|
|
|
test("shadcn semantic variables alias the existing palette", () => {
|
|
const light = css.slice(css.indexOf(":root {\n color-scheme: light;"), css.indexOf("\n}", css.indexOf(":root {\n color-scheme: light;")));
|
|
const aliases: Record<string, string> = {
|
|
"--background": "var(--color-canvas)",
|
|
"--foreground": "var(--color-ink)",
|
|
"--card": "var(--color-canvas-muted)",
|
|
"--primary": "var(--color-action-fill)",
|
|
"--primary-foreground": "var(--color-on-action-fill)",
|
|
"--destructive": "var(--color-danger)",
|
|
"--border": "var(--color-border)",
|
|
"--input": "var(--color-border-strong)",
|
|
"--ring": "var(--color-focus)",
|
|
"--sidebar": "var(--color-sidebar)",
|
|
"--radius": "12px",
|
|
};
|
|
for (const [name, value] of Object.entries(aliases)) {
|
|
assert.match(light, new RegExp(`${name.replace("-", "\\-")}: ${value.replace(/[()]/g, "\\$&")};`));
|
|
}
|
|
});
|