feat(前端): 阶段 9–45 呈现层落地——环节资产同构、图标两级表、kit 分包与四处交互收口

这一提交是 NEX 阶段 9–45 里所有**业务呈现层**的落地(不含探针与文档)。
三把尺子里只碰了 `styles/index.css`/`styles/app.css`,`theme/antd.ts` 一字未动;
不升级、不换库、不引入第二套 UI 组件包,业务页仍然不直接 import antd(R8)。

主线:
- 环节「资产管理」与平台资产库呈现层同构(阶段 44):`pages/project/Library.tsx`
  换成与 `pages/AssetLibrary.tsx` 同一套 kit 骨架——PageHead / StatGrid /
  Tabs+counts / Panel / Ctlbar `cols={5}` / ChipBar / Grid+Tile pick / MediaThumb /
  Drawer;摘要尺上收为 `Tile.TILE_SUMMARY` 一处定义,两页共用,不再各写各的。
  在册偏离见 `docs/NEX-对照与例外.md` E11(本页接口不收 `page`/`page_size`,
  硬造前端切片是假分页;筛选条缺平台那两颗「状态」「排序」下拉,因为环节接口
  根本不收 `status`/`sort`,补它们属于功能改动——待授权)。
- 项目总控台去掉「展开/收拢执行过程」那颗文字胶囊(阶段 44):折叠行本身
  就是可点的语义元素,胶囊是同一动作的第二入口。口径写进 `UI规范.md` §13.14。
- 卡片动作收口(阶段 45):项目总览 / 环节资产 / 模型中心三处卡片上的动作
  按钮按 `§5.1.2.1` 的尺子归位(32 档只属于页头与工具条独立动作,卡片内不再
  混挂实底),`Ctlbar` 与 `Fields` 配套。
- 图标:登记表两级拆分落地(阶段 25)——`components/icons/core.ts`
  (首屏外壳可达 54 只)/ `extra.ts`(只有懒页面要 24 只)/ `_kit.ts`(不含图形)/
  `index.ts` 退化为只转发 core 的桶;边界由 `classaudit` 附三守。
  `@ant-design/icons` 按嵌套包定价回落到 `^5.6.1`(阶段 26、27)。
- 分包:`vite.config.ts` 一条 `codeSplitting.groups` 只圈我们自己的四个目录
  (components/lib/stores/api),`includeDependenciesRecursively: false` 是关键,
  第三方怎么分块一个字不动。同一把 churn 实验:只改 `Input.tsx` 一个字符串,
  改前 21 块里 20 块改名(用户多下 1 276 kB/gzip 390 kB),改后第三方大块
  1 217 164 B 哈希不变,只有 `kit-*`/`index-*` 换名。
  `frontend/chunk-budget.mjs` 的产物级预算基线 `chunk-budget.json` 随仓库走。
- S-2/S-3/T-1 的收口:图标默认为装饰 + 控件补自然中文名称、antd 语言包根因、
  表单 id 关联新增 `ui/fieldId.ts`、离线告警宿主、交付面与窄屏表等(阶段 9–43 报告逐条)。
- `public/help/*.png` 是 `helpshots.py` 重新拍的 12 张手册插图(此前与实现漂移)。

提交前当场复跑静态四闸:`npm run typecheck` 0、`npm run build` 0(产物哈希与阶段 44
收工读数一字不差:`Library-0Ke7LMGG.js`/`AssetLibrary-DiALYoDN.js`)、
`node scripts/ui/classaudit.mjs` FAMILY 12 族全 0、`node scripts/ui/chunkbudget.mjs` 全 `ok`。
main
mula.liu 2026-11-12 10:21:29 +08:00
parent cbc645c4e1
commit ee17358182
55 changed files with 1884 additions and 1025 deletions

View File

@ -0,0 +1,10 @@
{
"_what": "构建产物体积预算(scripts/ui/chunkbudget.mjs 的来源 C · 阶段 24 登记)",
"budget": 1500000,
"_unit": "字节,十进制 kB(kB = 1000 B),与 vite 控制台 / chunkSizeWarningLimit / 阶段 15 基线同一把尺",
"_why": "1 500 kB = 阶段 15 基线单块峰值 1 275.93 kB(当时块名 ui-*.js)之上留 17.5 % 余量:够一次正常功能增量,不够一次无声的重依赖引入。这个数字与 chunkbudget.mjs 的兜底值 FALLBACK_KB 相同 ⇒ 登记它不放宽也不收紧判定,只是把「上限是谁说的」从脚本里的常数换成可评审、可 diff 的项目文件。",
"_scope": "全局上限,逐文件判定;未启用 name/type 作用域(要用时按 rollup 的形状写数组即可,脚本已支持)",
"_observed": "2026-11-09 09:18 产物实测最大块 assets/WarningOutlined-BEwHRRI6.js = 1 217 164 B = 1 217.16 kB,余量 282.84 kB(23.2 %);vite 的 chunkSizeWarningLimit 仍是 1 200 kB,那条 (!) Some chunks are larger 照旧常驻,本文件不是用来捂警告的",
"_rules": "越界先查成分(node scripts/ui/chunkinfo.mjs),不许调大这个数字把警告捂住;确需调整必须在 docs/UI规范.md §13.11 说明依据与改前改后同尺读数",
"_reviewed": "阶段 24(2026-11-09)"
}

View File

@ -8,7 +8,8 @@
"name": "nex-animation-studio",
"version": "1.0.0",
"dependencies": {
"@ant-design/icons": "^6.3.4",
"@ant-design/cssinjs": "1.24.0",
"@ant-design/icons": "^5.6.1",
"@tailwindcss/vite": "^4.3.3",
"@vitejs/plugin-react": "^5.2.0",
"antd": "^5.29.3",
@ -28,12 +29,12 @@
}
},
"node_modules/@ant-design/colors": {
"version": "8.0.1",
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-8.0.1.tgz",
"integrity": "sha512-foPVl0+SWIslGUtD/xBr1p9U4AKzPhNYEseXYRRo5QSzGACYZrQbe11AYJbYfAWnWSpGBx6JjBmSeugUsD9vqQ==",
"version": "7.2.1",
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.2.1.tgz",
"integrity": "sha512-lCHDcEzieu4GA3n8ELeZ5VQ8pKQAWcGGLRTQ50aQM2iqPpq2evTxER84jfdPvsPAtEcZ7m44NI45edFMo8oOYQ==",
"license": "MIT",
"dependencies": {
"@ant-design/fast-color": "^3.0.0"
"@ant-design/fast-color": "^2.0.6"
}
},
"node_modules/@ant-design/cssinjs": {
@ -71,24 +72,28 @@
}
},
"node_modules/@ant-design/fast-color": {
"version": "3.0.1",
"resolved": "https://registry.npmmirror.com/@ant-design/fast-color/-/fast-color-3.0.1.tgz",
"integrity": "sha512-esKJegpW4nckh0o6kV3Tkb7NPIZYbPnnFxmQDUmL08ukXZAvV85TZBr70eGuke/CIArLaP6aw8lt9KILjnWuOw==",
"version": "2.0.6",
"resolved": "https://registry.npmmirror.com/@ant-design/fast-color/-/fast-color-2.0.6.tgz",
"integrity": "sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.24.7"
},
"engines": {
"node": ">=8.x"
}
},
"node_modules/@ant-design/icons": {
"version": "6.3.4",
"resolved": "https://registry.npmmirror.com/@ant-design/icons/-/icons-6.3.4.tgz",
"integrity": "sha512-kDoUlppczVyCUTFthF6cHmPzMBYqNZQhu9j6EyIX/YIdM9j9CZNZoJUjzVw7/1v1VO8WwVMmPp15r/uwIAS0AQ==",
"version": "5.6.1",
"resolved": "https://registry.npmmirror.com/@ant-design/icons/-/icons-5.6.1.tgz",
"integrity": "sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg==",
"license": "MIT",
"dependencies": {
"@ant-design/colors": "^8.0.1",
"@ant-design/icons-svg": "^4.6.0",
"@rc-component/util": "^1.11.0",
"clsx": "^2.1.1"
"@ant-design/colors": "^7.0.0",
"@ant-design/icons-svg": "^4.4.0",
"@babel/runtime": "^7.24.8",
"classnames": "^2.2.6",
"rc-util": "^5.31.1"
},
"engines": {
"node": ">=8"
@ -504,18 +509,6 @@
"react-dom": ">=16.9.0"
}
},
"node_modules/@rc-component/color-picker/node_modules/@ant-design/fast-color": {
"version": "2.0.6",
"resolved": "https://registry.npmmirror.com/@ant-design/fast-color/-/fast-color-2.0.6.tgz",
"integrity": "sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.24.7"
},
"engines": {
"node": ">=8.x"
}
},
"node_modules/@rc-component/context": {
"version": "1.4.0",
"resolved": "https://registry.npmmirror.com/@rc-component/context/-/context-1.4.0.tgz",
@ -635,20 +628,6 @@
"react-dom": ">=16.9.0"
}
},
"node_modules/@rc-component/util": {
"version": "1.14.0",
"resolved": "https://registry.npmmirror.com/@rc-component/util/-/util-1.14.0.tgz",
"integrity": "sha512-qFpkGBCiyN3NNAU+FOnZdcdz7A/rXCg3JdQk+bujUKAExZgRqzf2yy1f4YN63Lwctic5FcK9rgjQ6aWbykqwEw==",
"license": "MIT",
"dependencies": {
"is-mobile": "^5.0.0",
"react-is": "^19.2.7"
},
"peerDependencies": {
"react": ">=18.0.0",
"react-dom": ">=18.0.0"
}
},
"node_modules/@remix-run/router": {
"version": "1.23.4",
"resolved": "https://registry.npmmirror.com/@remix-run/router/-/router-1.23.4.tgz",
@ -1570,47 +1549,6 @@
"react-dom": ">=16.9.0"
}
},
"node_modules/antd/node_modules/@ant-design/colors": {
"version": "7.2.1",
"resolved": "https://registry.npmmirror.com/@ant-design/colors/-/colors-7.2.1.tgz",
"integrity": "sha512-lCHDcEzieu4GA3n8ELeZ5VQ8pKQAWcGGLRTQ50aQM2iqPpq2evTxER84jfdPvsPAtEcZ7m44NI45edFMo8oOYQ==",
"license": "MIT",
"dependencies": {
"@ant-design/fast-color": "^2.0.6"
}
},
"node_modules/antd/node_modules/@ant-design/fast-color": {
"version": "2.0.6",
"resolved": "https://registry.npmmirror.com/@ant-design/fast-color/-/fast-color-2.0.6.tgz",
"integrity": "sha512-y2217gk4NqL35giHl72o6Zzqji9O7vHh9YmhUVkPtAOpoTCH4uWxo/pr4VE8t0+ChEPs0qo4eJRC5Q1eXWo3vA==",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.24.7"
},
"engines": {
"node": ">=8.x"
}
},
"node_modules/antd/node_modules/@ant-design/icons": {
"version": "5.6.1",
"resolved": "https://registry.npmmirror.com/@ant-design/icons/-/icons-5.6.1.tgz",
"integrity": "sha512-0/xS39c91WjPAZOWsvi1//zjx6kAp4kxWwctR6kuU6p133w8RU0D2dSCvZC19uQyharg/sAvYxGYWl01BbZZfg==",
"license": "MIT",
"dependencies": {
"@ant-design/colors": "^7.0.0",
"@ant-design/icons-svg": "^4.4.0",
"@babel/runtime": "^7.24.8",
"classnames": "^2.2.6",
"rc-util": "^5.31.1"
},
"engines": {
"node": ">=8"
},
"peerDependencies": {
"react": ">=16.0.0",
"react-dom": ">=16.0.0"
}
},
"node_modules/baseline-browser-mapping": {
"version": "2.11.34",
"resolved": "https://registry.npmmirror.com/baseline-browser-mapping/-/baseline-browser-mapping-2.11.34.tgz",
@ -1824,12 +1762,6 @@
"integrity": "sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==",
"license": "ISC"
},
"node_modules/is-mobile": {
"version": "5.0.0",
"resolved": "https://registry.npmmirror.com/is-mobile/-/is-mobile-5.0.0.tgz",
"integrity": "sha512-Tz/yndySvLAEXh+Uk8liFCxOwVH6YutuR74utvOcu7I9Di+DwM0mtdPVZNaVvvBUM2OXxne/NhOs1zAO7riusQ==",
"license": "MIT"
},
"node_modules/jiti": {
"version": "2.7.0",
"resolved": "https://registry.npmmirror.com/jiti/-/jiti-2.7.0.tgz",
@ -2873,12 +2805,6 @@
"react": "^18.3.1"
}
},
"node_modules/react-is": {
"version": "19.3.1",
"resolved": "https://registry.npmmirror.com/react-is/-/react-is-19.3.1.tgz",
"integrity": "sha512-RRieF6IyxQBkcK6pP8xOHprLTPW6QjRkbGdImtqNme+/hYVwCZkLQLdlZGOhUqXwkS9IEynaGvPJtv6XB/cz0Q==",
"license": "MIT"
},
"node_modules/react-refresh": {
"version": "0.18.0",
"resolved": "https://registry.npmmirror.com/react-refresh/-/react-refresh-0.18.0.tgz",

View File

@ -11,7 +11,7 @@
},
"dependencies": {
"@ant-design/cssinjs": "1.24.0",
"@ant-design/icons": "^6.3.4",
"@ant-design/icons": "^5.6.1",
"@tailwindcss/vite": "^4.3.3",
"@vitejs/plugin-react": "^5.2.0",
"antd": "^5.29.3",

Binary file not shown.

Before

Width:  |  Height:  |  Size: 319 KiB

After

Width:  |  Height:  |  Size: 336 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 290 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 334 KiB

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 321 KiB

After

Width:  |  Height:  |  Size: 328 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 204 KiB

After

Width:  |  Height:  |  Size: 208 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 288 KiB

After

Width:  |  Height:  |  Size: 318 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 421 KiB

After

Width:  |  Height:  |  Size: 426 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 290 KiB

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 268 KiB

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 517 KiB

After

Width:  |  Height:  |  Size: 535 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 340 KiB

After

Width:  |  Height:  |  Size: 341 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 223 KiB

After

Width:  |  Height:  |  Size: 233 KiB

View File

@ -178,7 +178,7 @@ export default function App() {
return (
<Layout style={{ minHeight: '100vh' }}>
<AppHeader projectId={projectId} collapsed={collapsed} onCollapse={setCollapsed}
onOpenBrief={() => setBriefOpen((v) => !v)} briefOpen={briefOpen}
onOpenBrief={() => setBriefOpen((v) => !v)} onBriefOpenChange={setBriefOpen} briefOpen={briefOpen}
narrow={narrow} navOpen={navOpen} onToggleNav={() => setNavOpen((v) => !v)} />
<Layout>
{/* <768 不渲染常驻侧栏:窄屏的导航入口只有顶栏那颗汉堡(点开左边的抽屉)。

View File

@ -13,7 +13,8 @@
* 全站自动刷新开关也落在这块面板上——它是「刷新策略」的唯一入口。
*
* 为什么不放进侧栏或者做成一张页:这不是一个功能模块,是常驻的运行状态,
* 和顶栏已有的「在线/离线」是同一族信息(AppHeader 右侧那段)。
* 和顶栏那条「后端离线」告警是同一族信息(AppHeader 右侧只剩故障才出现的那一颗;
* 健康态的「在线」2026-11-08 已撤——运行状态由这一颗唯一代言,§13.7)。
* 数据由 stores/activity 单例轮询供给(有活 3 秒、空闲 15 秒),
* 这里只读 store,不再发第二份请求。
*/

View File

@ -24,13 +24,15 @@ import ActivityCenter from './ActivityCenter'
import PipelineConsole from './PipelineConsole'
import UserMenu from './UserMenu'
export function AppHeader({ projectId, collapsed, onCollapse, onOpenBrief, briefOpen,
export function AppHeader({ projectId, collapsed, onCollapse, onOpenBrief, onBriefOpenChange, briefOpen,
narrow, navOpen, onToggleNav }: {
projectId: string
collapsed: boolean
onCollapse: (next: boolean) => void
/** 展开/收起右侧「项目概况」抽屉(项目层唯一入口,实现在 app/App.tsx) */
onOpenBrief: () => void
/** 只展开、不取反:悬停展开走这条(点按仍走上面那颗 toggle),见 PipelineConsole 的悬停注释 */
onBriefOpenChange: (open: boolean) => void
briefOpen: boolean
/**
* <768:这一档外壳里没有常驻侧栏,这颗汉堡是导航的**唯一**入口,
@ -45,7 +47,6 @@ export function AppHeader({ projectId, collapsed, onCollapse, onOpenBrief, brief
}) {
const screens = Grid.useBreakpoint()
const isLight = useAppliedTheme() === 'light'
const health = useSystemStore((s) => s.health)
const error = useSystemStore((s) => s.error)
const offline = !!error
/* 侧栏收起时折叠按钮是唯一的展开入口,此时不许再隐任何东西。
@ -118,18 +119,33 @@ export function AppHeader({ projectId, collapsed, onCollapse, onOpenBrief, brief
以前跟着 wide(=折叠或 ≥lg)走,900~991 这段整块没有,手机上就再也够不到归档/删除。
窄档由它自己的断点隐件换:轨道与状态 <xl 隐、当前节点 <lg 隐,md 只剩名字+百分比。 */}
{projectId && (
<PipelineConsole projectId={projectId} onOpenBrief={onOpenBrief} briefOpen={briefOpen} />
<PipelineConsole projectId={projectId} onOpenBrief={onOpenBrief}
onBriefOpenChange={onBriefOpenChange} briefOpen={briefOpen} />
)}
<Flex align="center" gap="small" justify="flex-end" className={cn('min-w-max flex-[1_1_0]', !wide && 'flex-none')}>
{!offline && health && (
<Tooltip title={'后端服务运行中' + (health?.version ? ' · v' + health.version : '')}>
<Badge status="processing" text={<span className="whitespace-nowrap max-xl:hidden">在线</span>} className="max-lg:hidden" />
</Tooltip>
)}
{/* 顶栏只报「出事」,不报「一切正常」(2026-11-08 · 用户第 1 条「header 上不显示在线状态」):
健康态那颗绿点在屏幕上的每一秒都在,读者第二秒就学会跳过它——它唯一携带的信息
是「今天没亮过」,而那正好是下面这条离线告警会说的话。撤掉它,顶栏少一处
永远不变的装饰,故障可见性一点没减:连不上后端仍然出现红色 Badge + 原因(title)。
「平台此刻在干什么」不由这里说,归旁边的 ActivityCenter(§13.7:顶栏唯一进度源)。
断点口径沿用原样:文字 <1280 隐、整颗 <1024 隐——窄档本来就没有这块像素。 */}
{offline && (
<Tooltip title={'后端连接异常:' + error}>
<Badge status="error" text={<span className="whitespace-nowrap max-xl:hidden">后端离线</span>} className="max-lg:hidden" />
{/* 多包这一层 span 不是装饰:antd 的 Badge 不转发 ref,Tooltip 里的
rc-resize-observer 拿不到宿主节点就退回 findDOMNode,React 每挂载一次
就往 console 打一条 deprecation 警告。实测(reports/ui_evidence/nex-p22/
headerofflinegeo.py + headerstatus.py):断掉 /health 重新载入,
四档视口各一条,一共 5 条——响的正好是「后端已经出事」那条分支,
等于在最该看日志的时候先脏一次控制台。
换法只换宿主元素,不换盒子:max-lg:hidden 从 Badge 挪到这一层,
隐藏的还是同一块(1440 / 1200 文字 56px、1000 只剩 6px 状态点、
430 整颗不渲染,改前后逐字段一致)。
React 19 会把 findDOMNode 直接删掉,这颗告警是全站唯一一处
`Tooltip` 直接吃非 DOM 子件的地方(grep -A2 '<Tooltip' | grep '<Badge' = 1 处)。 */}
<span className="inline-flex max-lg:hidden">
<Badge status="error" text={<span className="whitespace-nowrap max-xl:hidden">后端离线</span>} />
</span>
</Tooltip>
)}
{/* 平台动态(跑模型的任务在做什么)不跟着 md 让位:

View File

@ -31,7 +31,7 @@
* 不要改成 margin-inline:auto:那居中的是「品牌右缘↔工具左缘」空档的中点,
* 工具区比品牌区宽约 140px,整块会偏左 70px。
*/
import { useEffect, useRef, useState } from 'react'
import { useEffect, useId, useRef, useState } from 'react'
import { Tooltip, Typography } from 'antd'
import { Button, Tag, type TagTone } from '../../components/ui'
import { IconChevronDown } from '../../components/icons'
@ -80,16 +80,20 @@ const SEG_BG: Record<string, string> = {
pending: 'var(--ant-color-fill)'
}
export function PipelineConsole({ projectId, onOpenBrief, briefOpen }: {
export function PipelineConsole({ projectId, onOpenBrief, onBriefOpenChange, briefOpen }: {
projectId: string
/** 展开/收起「项目概况」抽屉(入口只有这一颗) */
/** 点按:展开/收起「项目概况」抽屉(入口只有这一颗) */
onOpenBrief: () => void
/** 悬停:只负责展开,不取反。两个动词分开是因为 toggle 读到的是渲染时快照,
* 悬停计时器响的那一刻 prop 很可能还是旧值——先点后悬会把刚点开的抽屉再顶回去。 */
onBriefOpenChange?: (open: boolean) => void
briefOpen?: boolean
}) {
const project = useProjectStore((s) => s.project)
const workflow = useProjectStore((s) => s.workflow)
/* 认「加载成功的那份数据自己的 id」,不认路由号 */
const proj = projectId && project?.id === Number(projectId) ? project : null
const loadedId = useProjectStore((s) => s.loadedId)
/* 认「加载成功的那份数据自己的 id」,不认路由号:口径见 stores/project.ts 的 loadedId */
const proj = projectId && loadedId === Number(projectId) ? project : null
if (!projectId) return null
const list = proj ? workflow || [] : []
@ -135,6 +139,27 @@ export function PipelineConsole({ projectId, onOpenBrief, briefOpen }: {
+ ' · 已完成 ' + pipeDone + '/' + pipeTotal + ' 个节点'
+ (pipeCurrent ? (allDone ? ' · ' : ' · 当前节点:') + pipeCurrent.label : '')
/* ── 可访问名称(2026-11-10 · 阶段 35 · T-1 / T1-N2)──────────────────────────
改前:这颗胶囊没有 `aria-label`,可读名称由「可见内容 + `title`」拼出来,
而 `title` 整条是 `summary`(《项目名》流程进度 83% · 已完成 10/12 个节点
· 当前节点:X)再缀一句「(悬停或点击展开项目概况)」。
VoiceOver 每次 ⌥→ 到这一站都要 6–8 s 才念完,且「悬停 / 点击」是**鼠标
隐喻**——键盘用户听到的动词是他手上没有的设备。
(登记:`docs/NEX-对照与例外.md` §6 行 T1-N2;阶段 11 只除掉了名称里的
鼠标隐喻依赖,长度这条当时明确「下一轮再动」。)
改后:名称 = **它是什么 + 做到哪了**(`aria-label`,≈20 字,含项目身份),
长明细 `summary` 移到 `aria-describedby`(sr-only 节点承载)。
为什么这样切:读屏的 name 每次进站必念,description 是「想知道再问」的
第二通道(`aria-describedby` 在 NVDA/VoiceOver 都可单独重念,且能按
语音档位跳过),明细因此**一条都没丢**,只是不再霸占每一站的头一句。
`title` 收成「展开项目概况」——它现在是给鼠标看的一句提示,
不再参与名称(有 `aria-label` 时 title 只可能落进 description,
而我们把 description 显式给了 summary,所以这里写什么都不会污染名称)。
不动的东西:视觉一个字没改(aria/sr-only 不产生版面)、悬停展开与点按取反、
名字的三条抵达通道(hover Tooltip / focus-visible / 触屏靠抽屉标题)。 */
const nameId = 'nex-console-' + useId().replace(/[^a-zA-Z0-9_-]/g, '')
const name = '项目概况:' + projectTitle + ',流程进度 ' + pipePct + '%'
/* 完整项目名的三条抵达通道(阶段 8.5 · 第 2 项):
· Hover:指针悬停在名字上 ⇒ antd Tooltip;
· Focus:键盘 Tab 到这颗胶囊 ⇒ 同一个 Tooltip(`:focus-visible` 才给,
@ -167,14 +192,109 @@ export function PipelineConsole({ projectId, onOpenBrief, briefOpen }: {
try { return window.matchMedia('(hover: hover)').matches } catch { return true }
}
const showNameTip = () => { if (canHover() && nameTruncated()) setNameTip(true) }
/*
* ── 悬停展开(2026-11-08 · 用户第 3 条原话「项目首页的节点展开改成按钮的 hover」)─────
* 症状:这颗胶囊是「项目概况」的唯一入口,可它只认点按。要读一眼节点明细、
* 或者从七站里跳一站,都得先点一下、看完再点回来收起;而它右端那颗下箭头
* 画的本来就是「这儿能展开」,鼠标停在上面却什么都不发生。
* 做法:**悬停 = 展开**(单向),**点按 = 展开/收起**(原有语义一个字没改)。
* · intent delay 300 ms:这颗胶囊最宽 520px、坐在顶栏正中,是从品牌块走到
* 右侧工具区的必经之路。0 延迟会让「路过」变成「打开一扇挡住整页的抽屉」。
* 取 300 ms 的依据是实测边界,不是手感猜测(playwright 真浏览器 + 页内计时,
* `reports/ui_evidence/nex-p11/hoverbrief.py`):真实停留 126 ms、243 ms 不开,
* 412 ms 以上必开;「进入胶囊 → 抽屉类名生效」端到端实测 409–429 ms
* (= 300 ms 计时器 + 抽屉自己挂载约 110–130 ms,读者感知的上限就是半秒)。
* 一次横扫顶栏落在 250 ms 以下,一次「停下来看」落在 400 ms 以上,300 在两者之间。
* · `@media (hover: hover)`(复用上面那颗 `canHover()`):触屏没有真正的悬停,
* 手指按下去先 pointerover 再 click——不收口的话每次点项目名都会先被悬停通道
* 抢先展开,然后再被 click 的 toggle 收回去,抽屉看起来「闪一下就没了」。
* 与 Tooltip 用同一个判据、同一个理由,不新造第二把尺子。
* · **移出不自动关**:抽屉里是项目身份、指标、七站跳转和归档/删除,不是只读提示。
* 胶囊在页面正中、抽屉贴在右缘,中间隔着一条遮罩——鼠标还没走到抽屉,
* 「离开即收起」就会先把门关上;要做就得给收起也加宽限并监听抽屉自己的
* pointerenter,那是在一条已验证的模态通道上叠两套计时器。
* 收起的出口一条没动(都是抽屉原有的)。实测过它们各自真实接住点击的是谁:
* 抽屉展开时遮罩盖住整页,`(胶囊中心)` 的 `elementFromPoint` 命中
* `div.ant-drawer-mask`——鼠标在那颗坐标按下去落的是遮罩(`maskClosable`),
* 视觉结果与「再点一次胶囊」相同,机制不同;「再点胶囊」这条出口真正走得通的是
* 键盘(Shift+Tab 回到胶囊按 Enter/Space 取反)。Esc 的口径是**焦点在抽屉内才有效**
* (阶段 11 复测:焦点退回胶囊后连按两次 Esc,open 仍是 true——antd 把抽屉的 keydown
* 绑在抽屉自己身上,焦点在门外收不到);点按与悬停两条进入路径实测都会把焦点送进
* .ant-drawer,所以「按 Esc 能收」对用户实际走得通的每条路径都成立。
* · **键盘不被悬停通道打扰**:焦点移动不自动展开(实测:只 focus 不 mouseenter ⇒
* open 仍为 false;开合由 Enter/Space 说,`aria-expanded` 已经如实报状态)。
* 展开后焦点会进抽屉根节点 `.ant-drawer`——这是抽屉固有的开合行为,不是悬停引入的
* (对照实测:键盘 Enter 打开、全程没有 mouseenter,焦点同样落在 `.ant-drawer`)。
* 这一条与阶段 9 在总览页给的「hover 永远不是唯一入口」同一口径。
* 不影响的东西:Header 56 高、胶囊内部排版与断点隐件、Tooltip 的三条名称通道、
* footercheck 的 `button.nex-console`(playwright 的 click 是「移动即点」,
* 落在计时器响之前,展开由 click 负责;即使悬停通道后到,`onBriefOpenChange(true)`
* 是绝对值,不会把刚点开的抽屉关掉)。
*/
const HOVER_OPEN_MS = 300
const hoverTimer = useRef<number>()
/* 悬停通道的保险(阶段 11 实测)。
症状:遮罩盖住整页,包括胶囊自己。收起抽屉(Esc / 遮罩 / ✕)的一瞬间,遮罩从
**静止的指针**下面消失,浏览器会向胶囊补发一次 mouseover + mouseenter
—— 于是「Esc 收起 → 半秒后它自己又开了」。
实测时间线(1440 · 指针停在胶囊上,`reports/ui_evidence/nex-p11/hoverfix.json`):
1255ms drawer-open=false → 1646ms btn:mouseover + btn:mouseenter
→ 2123ms drawer-open=true (= 补发的进入事件 + 300ms 计时器 + 挂载约 120ms)
阶段 10 之前没有这条通道,收起就是收起;这条是悬停展开带出来的新缺陷。
判据:**指针真的动过**才算意图。补发的那一束里只有 mouseover/mouseenter,
没有 mousemove(同一条实测日志里 1646ms 只有两枚事件);而人把指针移到
胶囊上、或在胶囊里挪一下,必然带 mousemove。所以:
· 收起(open→close)⇒ 悬停卸膛;
· 胶囊上的 mousemove ⇒ 重新上膛并起 300ms 计时(这一次才算一次悬停);
· 正常路径不变:mouseenter 起表、mousemove 不打断已经在一起的计时
(阶段 11 定 300ms 用的就是「进入后停留」这条口径,hoverbrief.py 按它验收,
改成「静止 300ms」会让 126/243/412ms 那组实测边界失效)。
点按开关、遮罩、✕、Esc 四条出口的语义一个字没改;改的只有「收起之后
悬停不立刻反悔」。 */
const hoverArmed = useRef(true)
const prevBriefOpen = useRef(briefOpen)
useEffect(() => {
if (prevBriefOpen.current && !briefOpen) hoverArmed.current = false
prevBriefOpen.current = briefOpen
}, [briefOpen])
const cancelHoverOpen = () => {
if (hoverTimer.current !== undefined) {
window.clearTimeout(hoverTimer.current)
hoverTimer.current = undefined
}
}
useEffect(() => cancelHoverOpen, [])
/* 键盘档收口:Enter/Space 点开概况抽屉时,身后的提示同步收回(桌面档悬停由
mouseleave 负责,不依赖这条)。触屏档在 canHover() 那一步就已经不会弹了。 */
useEffect(() => { if (briefOpen) setNameTip(false) }, [briefOpen])
/* 悬停计时的两个挂点:进入胶囊起表,离开或点按立刻撤表。
撤表是必需的——移开后不撤,300 ms 后人已经走到抽屉里了,背后又会被顶开一次。 */
const hoverOpenStart = () => {
cancelHoverOpen()
if (!hoverArmed.current || briefOpen || !onBriefOpenChange || !canHover()) return
hoverTimer.current = window.setTimeout(() => {
hoverTimer.current = undefined
onBriefOpenChange(true)
}, HOVER_OPEN_MS)
}
/* 胶囊内的真实移动:收起之后靠它重新上膛(见上面那段判据)。
已上膛时它一个字都不做 —— 停留计时由 mouseenter 负责,mousemove 不许把它重置。 */
const hoverMove = () => {
if (hoverArmed.current) return
hoverArmed.current = true
hoverOpenStart()
}
return (
<Button type="text" className="nex-console" onClick={onOpenBrief}
<Button type="text" className="nex-console"
onClick={() => { cancelHoverOpen(); onOpenBrief() }}
onMouseEnter={hoverOpenStart} onMouseLeave={cancelHoverOpen} onMouseMove={hoverMove}
aria-haspopup="dialog" aria-expanded={!!briefOpen}
title={summary + '(点击展开项目概况)'}
aria-label={name} aria-describedby={nameId}
title="展开项目概况"
onFocus={(e) => {
/* 只有键盘焦点才补这层提示:鼠标悬停由 Tooltip 自己的 hover 负责 */
let byKeyboard = true
@ -255,6 +375,9 @@ export function PipelineConsole({ projectId, onOpenBrief, briefOpen }: {
{/* 尾部那颗下箭头只说「这儿能展开」,不承载信息:对读屏隐藏,
抽屉的开合状态由上面的 aria-expanded 说 */}
<IconChevronDown aria-hidden className={cn('flex-none transition-transform', briefOpen && 'rotate-180')} />
{/* `aria-describedby` 的落点:完整明细(完成节点数 + 当前节点)仍读得到,
只是不再挤进每一站的可读名称里。sr-only ⇒ 零版面。 */}
<span id={nameId} className="sr-only">{summary}</span>
</Button>
)
}

View File

@ -66,8 +66,9 @@ export function ProjectBriefDrawer({ open, onClose, projectId }: {
const project = useProjectStore((s) => s.project)
const workflow = useProjectStore((s) => s.workflow)
const stats = useProjectStore((s) => s.stats)
/* 认「加载成功的那份数据自己的 id」,不认路由号:项目 404 时 store 里还留着上一个 */
const proj = projectId && project?.id === Number(projectId) ? project : null
const loadedId = useProjectStore((s) => s.loadedId)
/* 认「加载成功的那份数据自己的 id」,不认路由号:口径见 stores/project.ts 的 loadedId */
const proj = projectId && loadedId === Number(projectId) ? project : null
const st = stats || {}
const isArchived = proj?.status === 'archived'
const curSlug = slugOf(projectModules.find((m) => pathOf(m, projectId) === location.pathname) || projectModules[0])
@ -98,7 +99,7 @@ export function ProjectBriefDrawer({ open, onClose, projectId }: {
const nextStep = workflow.find((s: any) => s.state === 'active' || s.state === 'failed')
return (
<Drawer open={open} onClose={onClose} label="项目概况"
<Drawer open={open} onClose={onClose} label="项目概况" destroyOnHidden
loading={!proj}
width="min(620px, calc(100vw - 32px))"
title={proj?.name || `项目 #${projectId}`}

View File

@ -25,7 +25,7 @@
import type { ReactNode } from 'react'
import { App as AntdApp, ConfigProvider } from 'antd'
import { StyleProvider } from '@ant-design/cssinjs'
import zhCN from 'antd/locale/zh_CN'
import zhCNModule from 'antd/locale/zh_CN'
import dayjs from 'dayjs'
import 'dayjs/locale/zh-cn'
import { buildAntdTheme } from '../theme/antd'
@ -35,6 +35,24 @@ import { ToastHost } from '../components/ui/Toast'
dayjs.locale('zh-cn')
/* ---------------------------------------------------------------------------
* antd 中文文案:必须剥一层 default(2026-11-08 实测,dev 与 dist 一致)
*
* `antd/locale/zh_CN` 是个 CJS 壳(node_modules/antd/locale/zh_CN.js 里只有一行
* `module.exports = require('../lib/locale/zh_CN')`)。本项目的构建器把整个
* module.exports 当成默认导出交出来,于是这里拿到的是 `{ default: 真 locale }`,
* 而 antd 的 useLocale 只认 `context.Pagination` 这一层 ⇒ 找不到就静默回落到 enUS。
* 后果不是「少一个语言包」这么客气:全站 antd 内置文案在**生产产物里也是英文**,
* 且因为回落是静默的,第 9 闸与读屏只看得见症状(分页跳转框的可访问名称是 `Go to`、
* `Previous Page`/`Next Page`)。fiber 上回读 ConfigProvider 的 props.locale:
* keys 只有 ["default"],真 locale 在下一层。
*
* 写成 `.default ?? 本体` 而不是改 import 路径:两种 interop(把 module.exports
* 当 default / 把 exports.default 当 default)都成立,且不会为了一颗语言包把
* antd/es/** 拉进未预打包的源码图里(dev 冷启动会多出上百个请求)。
* ------------------------------------------------------------------------ */
const zhCN = ((zhCNModule as unknown as { default?: typeof zhCNModule }).default ?? zhCNModule) as typeof zhCNModule
export function ThemeProviders({ children }: { children: ReactNode }) {
const applied = useThemeStore((s) => s.applied) as ThemeMode
return (

View File

@ -1,6 +1,7 @@
import { useMemo } from 'react'
import { Select as AntSelect } from 'antd'
import { sameValue, toOptions, type OptionLike } from './options'
import { markFieldControl, useFieldControlId } from '../ui/fieldId'
/**
* 全站统一「多选下拉」:antd Select 的 multiple 模式。
@ -20,13 +21,15 @@ export type MultiSelectProps = {
size?: 'sm' | 'md'
ariaLabel?: string
className?: string
/** 写下来就用它,没写时由宿主 `Field` 生成(T1-N6) */
id?: string
/** 一个都不选等于「不限制」的下拉(筛选场景),保留「全部」语义提示 */
title?: string
}
export function MultiSelect({
value, onChange, options, disabled, placeholder = '未选择', searchThreshold = 3,
size, ariaLabel, className, title
size, ariaLabel, className, title, id
}: MultiSelectProps) {
const picked = useMemo(() => (Array.isArray(value) ? value : []), [value])
const opts = useMemo(() => toOptions(options), [options])
@ -37,6 +40,7 @@ export function MultiSelect({
return (
<AntSelect
mode="multiple"
id={useFieldControlId(id)}
title={title}
aria-label={ariaLabel}
className={className}
@ -53,3 +57,5 @@ export function MultiSelect({
/>
)
}
markFieldControl(MultiSelect)

View File

@ -3,6 +3,7 @@ import { Input } from 'antd'
import * as api from '../../api/client'
import { domInput, passRef } from '../../lib/ref'
import { IconEye, IconEyeOff } from '../icons'
import { markFieldControl, useFieldControlId } from '../ui/fieldId'
/**
* 全站统一的「密码 / 密钥」输入框:Ant Design 5 Input.Password。
@ -94,22 +95,40 @@ export const SecretInput = forwardRef<HTMLInputElement, Omit<SecretInputProps, '
<Input.Password
className={className}
ref={(h) => passRef(outerRef, domInput(h))}
id={id}
id={useFieldControlId(id)}
value={value}
placeholder={placeholder}
autoComplete={autocomplete}
maxLength={maxLength}
disabled={disabled}
visibilityToggle={{ visible: shown, onVisibleChange: (next: boolean) => void toggle(next) }}
/* 眼睛这颗是**点得着的控件本体**(antd 把 className 与 onMouseDown clone 到
iconRender 返回的那只图标上),默认图标自带的英文字形码 `eye` / `eye-invisible`
就是它对辅助技术的全部名字(2026-11-08 · S-2)。名字直接复用旁边那句
已经写好的中文 hint,三态口径与 title 完全一致;图标换成登记表里的同一只
EyeOutlined / EyeInvisibleOutlined,svg、尺寸、类名、手感一字不变。 */
iconRender={(visible) => visible
? <IconEye aria-label={hint} />
: <IconEyeOff aria-label={hint} />}
title={hint}
/* 眼睛这颗是**点得着的控件本体**,所以它必须是一个真按钮
(2026-11-08 · S-2 换中文名 → 2026-11-10 · 阶段 35 · T-1 / T1-N4 + T1-N5)。
改前两处缺陷:
· T1-N4:antd 的 `iconRender` 只被 clone 上一份 `className` 与三个事件,
返回的是 `<span role="img" tabindex="-1">`——读屏里它是一张**图片**,
Tab 到不了、也没有「当前是明文还是密文」这个状态位;
· T1-N5:`title={hint}` 挂在 `Input.Password` 上,antd 把它原样转给 `<input>`
本体(`antd/es/input/Password.js` 的 `restProps`),于是密码框自己的可访问
名称被眼睛的提示词占用,VoiceOver 念「显示密码 编辑框」,真正的字段标签
「新密码」反而到不了耳朵里(取证 `reports/ui_evidence/nex-p11/vo/logs/axsrc.json`)。
改后:`<button type="button">` + `aria-pressed`(明文/密文是一枚货真价实的开关态)
+ `aria-label`=同一句中文 hint + `title` 只留给眼睛;里面的图形显式 `aria-hidden`
(R15:宿主具名 ⇒ 图形消音)。`title` 从输入框上摘掉,字段名交还给 `Field` 的标签。
antd 仍然把 `ant-input-password-icon` 类名与 click / mouseDown / mouseUp clone 到
这个 button 上(`Password.js:64-83`)——**不要自己再挂 onClick**,否则一次点击两遍逻辑;
它那条 `onMouseDown` 的 `preventDefault()` 正是「按下不抢输入框焦点」的来处,照旧生效。
视觉:图形仍是登记表里同一只 EyeOutlined / EyeInvisibleOutlined,14×14,
外层 button 由下面三条布局属性与 Tailwind preflight 做到与旧 span 逐像素相同
(读数对照 `reports/ui_evidence/nex-p35/vo/eye-geom-{before,after}.json`)。 */
iconRender={(visible) => (
<button type="button" aria-pressed={visible} aria-label={hint} title={hint}
style={{ display: 'flex', alignItems: 'center', lineHeight: 0 }}>
{visible ? <IconEye aria-hidden /> : <IconEyeOff aria-hidden />}
</button>
)}
aria-describedby={failed ? `${id || 'secret'}-hint` : undefined}
onChange={(e) => onChange?.(e.target.value)}
{...(rest as any)}
@ -118,3 +137,5 @@ export const SecretInput = forwardRef<HTMLInputElement, Omit<SecretInputProps, '
</>
)
})
markFieldControl(SecretInput)

View File

@ -1,6 +1,7 @@
import { useMemo } from 'react'
import { Select as AntSelect } from 'antd'
import { sameValue, toOptions, type OptionLike } from './options'
import { markFieldControl, useFieldControlId } from '../ui/fieldId'
/**
* 全站统一下拉控件:Ant Design 5 Select 的唯一封装。
@ -58,9 +59,12 @@ export function Select({
// 类型宽容:把外部值折成选项里真实存在的那個 value(number/string 都认)
const hit = aimed === null || aimed === undefined ? undefined : opts.find((o) => sameValue(o.value, aimed))
const shown = aimed === null || aimed === undefined ? undefined : (hit ? hit.value : aimed)
/* id 落在真正可聚焦的那颗 `<input role=combobox>` 上(rc-select 把它交给 Selector/Input),
宿主 `Field` 的 `<label for>` 指的就是它——T1-N6,见 ui/fieldId.ts */
const ctlId = useFieldControlId(id)
return (
<AntSelect
id={id}
id={ctlId}
title={title}
aria-label={ariaLabel}
disabled={disabled}
@ -83,3 +87,5 @@ export function Select({
/>
)
}
markFieldControl(Select)

View File

@ -0,0 +1,56 @@
/**
* 图标登记表的**公共件**(2026-11-09 · NEX 阶段 25):`decorative()` 与两个图标类型,
* 由 `core.ts` / `extra.ts` 两张表共用。
*
* 这里**不导出任何图形**,所以它落在 `src/components/**` 里被 `kit` 分组收拢,
* 也不会把 `@ant-design/icons` 的字形模块拽上首屏:唯一那条 import 是
* `import type { ProjectOutlined }`,只取它的属性类型,编译期整条抹掉。
* 真正的字形 import 只有两张表里那两条,也都还在 `src/components/icons/` 目录内
* (词汇表闸 `classaudit.mjs` 第 2 条放行的就是这个目录)。
*/
import { createElement, forwardRef } from 'react'
import type { ComponentProps, ComponentType } from 'react'
import type { ProjectOutlined } from '@ant-design/icons'
/** 一只字形组件(@ant-design/icons 原样产物的属性:className / style / onClick / spin / rotate / 全部 aria-*) */
export type IconProps = ComponentProps<typeof ProjectOutlined>
/** 需要把图标当值存进映射表时(lib/media.ts 的素材类型表)用这个类型 */
export type IconComponent = ComponentType<IconProps>
/**
* 装饰性包装:登记表出口的**唯一**渲染路径(2026-11-08 · 阶段 8.5 在册 AT-1 → 本轮 S-2)。
*
* 症状:`@ant-design/icons` 把每只字形渲染成
* `<span role="img" aria-label=字形名>`(AntdIcon.js: `{'aria-label': icon.name}`),
* 于是 VoiceOver 念出来的是「upload 导入脚本」「down 导出」「appstore 看板」
* 「ordered-list 分镜表」「book 手册」——按钮文字已经在外面,同一个控件被报两遍,
* 前半截还是用户从没见过的英文码。取证:
* `reports/ui_evidence/nex-p8f/07-screen-reader/voiceover-announcements-2026-11-08.txt` V7/V8/V11。
*
* 口径(一句话):**图标默认是装饰,语义由它所在的控件说。**
* · 默认 → `aria-hidden="true"` 且不写 aria-label:字形名对辅助技术彻底消失,
* 控件的可读名称回到「导入脚本 / 导出 / 看板」这几个真人会说的字上;
* · 调用方显式给了非空 `aria-label` → 这只图标**自己承担语义**(它后面没有文字),
* 保留 `role=img` 用给定的名字,不再隐藏;
* · 调用方显式写 `aria-hidden={false}` → 尊重调用方(用于整块表面自带 aria-labelledby 的场景)。
* 需要「图标是唯一语义」的位置一律走第二条,禁止把包装拆回去让英文字形名重新外泄。
*
* 只改辅助技术属性,**不产生任何 DOM 结构变化**(渲染的仍是同一只 `span.anticon`),
* 尺寸、颜色、间距、`.anticon` 选择器(app.css:564)与全部视觉探针读数不受影响。
*/
export function decorative(Glyph: ComponentType<IconProps>, alias: string) {
const Icon = forwardRef<HTMLSpanElement, IconProps>(function IconDecorative(props, ref) {
const { 'aria-hidden': ariaHidden, 'aria-label': ariaLabel, ...rest } = props
const named = typeof ariaLabel === 'string' && ariaLabel.trim() !== ''
// 本文件是 .ts(登记表不写 JSX),所以用 createElement 而不是 <Glyph />
return createElement(Glyph, {
...rest,
ref,
'aria-label': named ? ariaLabel : undefined,
'aria-hidden': named ? (ariaHidden ?? false) : (ariaHidden ?? true),
})
})
Icon.displayName = alias
return Icon
}

View File

@ -0,0 +1,213 @@
/**
* 全站图标登记表(**核心表**):整个项目**只有 `src/components/icons/` 这一个目录**允许 import '@ant-design/icons'。
*
* 本目录分两级(2026-11-09 · NEX 阶段 24 · `UI规范.md` §13.11 逃生组一条的来由):
* · `core.ts`(本文件)= 外壳(首屏静态闭包)用得上的 54 只,经 `index.ts` 桶对外;
* · `extra.ts`= 只有懒加载页面用得上的 24 只,**调用方深 import `../components/icons/extra`**;
* · `_kit.ts`= `decorative()` 与图标类型,两级表共用,不对外导出图形。
* 拆级的唯一理由是**首屏字节**:桶里多一条 `export * from './extra'` 就会把 24 只字形
* 焊回首屏(实测 Δgzip −0.08,第三方大块与基线同名同尺寸)。加图标先问「外壳要不要」,
* 拿不准就放 `extra.ts`——放错只会让首屏变大,不会让页面报错。
*
* ── 为什么要收口(2026-11 图标重设计)────────────────────────────────────
* 收口之前有 32 个文件各自 `import { XOutlined } from '@ant-design/icons'`,
* 73 个图标名散在页面里,于是「换个图标」= 全站搜索替换,而「同一个意思该长
* 什么样」没有任何一处能查。更糟的是页面写的是**字形名**(AppstoreOutlined),
* 不是**语义**:读代码的人看不出这里是「网格视图」还是「资产库」,
* 下一个改的人就顺手挑了另一个「看着差不多」的方块。
*
* 收口之后:
* · 页面只说语义(IconGrid / IconWarn / IconTimeline),字形只在这里出现一次;
* · 换一只图标 = 改这一行,全站跟着变,明暗两色、菜单/按钮/标签三处一起生效;
* · 想加新图标必须先在这里登记一个语义名,「随手 import 一个没见过的图形」
* 在词汇表闸(scripts/ui/classaudit.mjs 第 2 条)上直接红。
*
* ── 选图形的四条规则 ────────────────────────────────────────────────────
* 1. **一族到底**:只用 Outlined。只有两枚例外,且例外是「实心才读得对」的
* 状态资产——播放三角(IconPlay)与收藏/当前版本(IconStar)。
* TwoTone / 双色一律不用:它们带第二个颜色,深色主题里那一档永远是错的。
* 2. **剪影互不雷同**:同一屏里出现的图标必须靠轮廓分辨,不能靠细节。
* 本次为此改了四处侧栏图形(见下面的「导航」组),并消掉了
* 「当前项目」和「资产管理」共用一只文件夹的撞脸。
* 3. **14px 可读**:线条数超过三组、或含 1px 内细节的图形不进导航与按钮
* (AuditOutlined 的夹板勾在 14px 糊成一团 → 换 SafetyCertificate 的盾牌)。
* 4. **图标不写尺寸与颜色**:.anticon 继承容器的 font-size / color,
* 菜单跟 Menu 的 iconSize、按钮跟 Button 的 onlyIconSize、标签跟 Tag 的
* fontSizeSM——antd 已经各定过一档,页面再写 `text-[11px]` 就是第二把尺子。
* 行内(小标题 / 提示行)用 kit 的 <IconText>,按钮用 icon 槽,
* 不要手搓 margin。
*
* 5. **图标默认不进辅助技术树**:字形自己带 `aria-label=字形名`,混进按钮名称就是
* 「upload 导入脚本」这种半英不中的播报。出口一律走下面的 `decorative()`:
* 默认 `aria-hidden`,只有「图标就是这条操作的全部语义」时才显式写 `aria-label`。
*
* 用法:`import { IconClose, IconWarn } from '../../components/icons'`
*/
import {
ApiOutlined,
AppstoreOutlined,
BarChartOutlined,
BarsOutlined,
BookOutlined,
CaretRightFilled,
CheckOutlined,
ClockCircleOutlined,
CloseCircleFilled,
CloseCircleOutlined,
CloseOutlined,
CopyOutlined,
DashboardOutlined,
DatabaseOutlined,
DeleteOutlined,
DownOutlined,
DownloadOutlined,
EllipsisOutlined,
ExclamationOutlined,
ExportOutlined,
EyeInvisibleOutlined,
EyeOutlined,
FolderOpenOutlined,
FullscreenOutlined,
FundProjectionScreenOutlined,
InfoCircleOutlined,
LeftOutlined,
LoadingOutlined,
LogoutOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
MoonOutlined,
PauseOutlined,
PictureOutlined,
PlayCircleOutlined,
PlusOutlined,
ProfileOutlined,
ProjectOutlined,
RedoOutlined,
ReloadOutlined,
RightOutlined,
SafetyCertificateOutlined,
ScissorOutlined,
SearchOutlined,
SoundOutlined,
StarFilled,
SunOutlined,
SyncOutlined,
TeamOutlined,
ThunderboltOutlined,
UpOutlined,
UserOutlined,
VideoCameraOutlined,
WarningOutlined,
} from '@ant-design/icons'
import { decorative } from './_kit'
/* ══ 导航:侧栏菜单 + 页签 + 手册目录 ═════════════════════════════════════
十只图形按「轮廓不同族」挑:看板格 / 圆柱库 / 插头 / 仪表盘 / 文件夹 /
投影幕 / 闪电 / 盾牌 / 剪刀 / 下箭头托盘。四处改动都写在旁边的注释里,
改回来的人能看见当初为什么换掉。 */
/** 项目总览:所有项目的看板。原来用 Appstore(四个方块),和「平台资产库」的素材墙撞脸 */
export const IconProjects = decorative(ProjectOutlined, 'IconProjects')
/** 平台资产库:跨项目的母版库(圆柱 = 存量) */
export const IconLibrary = decorative(DatabaseOutlined, 'IconLibrary')
/** 模型管理中心:站内所有模型都是外部 API 接入 */
export const IconApi = decorative(ApiOutlined, 'IconApi')
/** 当前项目(侧栏子菜单):一个项目 = 一个打开的目录 */
export const IconFolder = decorative(FolderOpenOutlined, 'IconFolder')
/** 流程概览:总控台 / 全节点进度(仪表盘是「概览」的唯一画法) */
export const IconDashboard = decorative(DashboardOutlined, 'IconDashboard')
/** 资产管理:项目内的素材墙是网格砖,所以给方块组(原来与父级共用文件夹 = 上下同图) */
export const IconGrid = decorative(AppstoreOutlined, 'IconGrid')
/** 分镜与脚本:投影幕 + 分格 = 分镜板 */
export const IconStoryboard = decorative(FundProjectionScreenOutlined, 'IconStoryboard')
/** 任务调度中心:队列 / 执行 / 重试 / 并发 */
export const IconBolt = decorative(ThunderboltOutlined, 'IconBolt')
/** 质检与审核:盾牌带勾。AuditOutlined 的夹板在 iconSize 14 下糊成一块板 */
export const IconShield = decorative(SafetyCertificateOutlined, 'IconShield')
/** 时间线合成:剪刀 = 剪辑(NodeIndex 的节点连线与「调度」的图形读不出先后) */
export const IconTimeline = decorative(ScissorOutlined, 'IconTimeline')
/** 导出与成本:成片交付 */
export const IconDownload = decorative(DownloadOutlined, 'IconDownload')
/* ══ 方向与折叠:成对出现,绝不混用 ══════════════════════════════════════
Chevron(尖角)= 展开/收起、上下移一档;Arrow(带箭杆)= 跨页面/跨数量级的
位移(返回、升到顶、排序方向)。两套混在一排里,用户就分不清「收起这一段」
和「翻到上一条」。 */
export const IconChevronUp = decorative(UpOutlined, 'IconChevronUp')
export const IconChevronDown = decorative(DownOutlined, 'IconChevronDown')
export const IconChevronLeft = decorative(LeftOutlined, 'IconChevronLeft')
export const IconChevronRight = decorative(RightOutlined, 'IconChevronRight')
/** 侧栏折叠:折叠与展开是两只不同的图形,不能靠 transform 复用一只 */
export const IconSiderCollapse = decorative(MenuFoldOutlined, 'IconSiderCollapse')
export const IconSiderExpand = decorative(MenuUnfoldOutlined, 'IconSiderExpand')
/** 灯箱左右翻页 */
export const IconFullscreen = decorative(FullscreenOutlined, 'IconFullscreen')
/* ══ 动作:会改数据或打开东西 ══════════════════════════════════════════ */
export const IconAdd = decorative(PlusOutlined, 'IconAdd')
export const IconClose = decorative(CloseOutlined, 'IconClose')
/**
* 清空输入框(antd 输入类控件 `allowClear` 的默认图形,同一只 CloseCircleFilled)。
*
* 登记它不是为了画新东西,而是为了让 kit 能把这只图形**换成带名字的**:
* antd 自己在内部渲染 CloseCircleFilled,读屏于是念英文字形名「close-circle」。
* kit/SearchInput 传 `allowClear={{ clearIcon: <IconClear aria-label="清空搜索" /> }}`
* 之后,svg 路径与类名(anticon-close-circle)一字不差,只有可读名称变了。
*/
export const IconClear = decorative(CloseCircleFilled, 'IconClear')
export const IconDelete = decorative(DeleteOutlined, 'IconDelete')
export const IconCopy = decorative(CopyOutlined, 'IconCopy')
/** 在新窗口打开(不是「导出文件」,导出用 IconDownload) */
export const IconExternal = decorative(ExportOutlined, 'IconExternal')
export const IconReload = decorative(ReloadOutlined, 'IconReload')
/** 与后台对表(同步状态),区别于 IconReload(重跑同一件事) */
export const IconSync = decorative(SyncOutlined, 'IconSync')
/** 重试失败的节点 */
export const IconRetry = decorative(RedoOutlined, 'IconRetry')
export const IconSearch = decorative(SearchOutlined, 'IconSearch')
/** 更多(三个点,用于折叠起来的操作) */
export const IconMore = decorative(EllipsisOutlined, 'IconMore')
/** 显隐切换:明文/密文、显示/隐藏轨道 */
export const IconEye = decorative(EyeOutlined, 'IconEye')
export const IconEyeOff = decorative(EyeInvisibleOutlined, 'IconEyeOff')
/* ══ 播放与媒体 ═════════════════════════════════════════════════════════
两档播放:IconPlay(实心三角,贴在缩略角上的「点这里播」)、
IconPlayCircle(圆圈,动作按钮里的「播放/预览成片」)。 */
export const IconPlay = decorative(CaretRightFilled, 'IconPlay')
export const IconPlayCircle = decorative(PlayCircleOutlined, 'IconPlayCircle')
export const IconPause = decorative(PauseOutlined, 'IconPause')
/** 音频素材 / 正在出声 */
export const IconSound = decorative(SoundOutlined, 'IconSound')
export const IconImage = decorative(PictureOutlined, 'IconImage')
export const IconVideo = decorative(VideoCameraOutlined, 'IconVideo')
/** 文档类素材:素材类型表(lib/media.ts)与灯箱角标共用这一枚,不再另挑一只「清单」 */
export const IconDoc = decorative(ProfileOutlined, 'IconDoc')
/** 时间线轨道列表 */
export const IconTracks = decorative(BarsOutlined, 'IconTracks')
/* ══ 状态:只读,不触发任何动作 ═════════════════════════════════════════ */
export const IconCheck = decorative(CheckOutlined, 'IconCheck')
export const IconReject = decorative(CloseCircleOutlined, 'IconReject')
/** 需要注意但不致命(三角);IconCaution(感叹号)用在流程步骤的失败标记上 */
export const IconWarn = decorative(WarningOutlined, 'IconWarn')
export const IconCaution = decorative(ExclamationOutlined, 'IconCaution')
export const IconInfo = decorative(InfoCircleOutlined, 'IconInfo')
export const IconLoading = decorative(LoadingOutlined, 'IconLoading')
/** 排队 / 已耗时 */
export const IconClock = decorative(ClockCircleOutlined, 'IconClock')
/** 收藏 / 当前选定版本(实心才有「已选中」的重量) */
export const IconStar = decorative(StarFilled, 'IconStar')
/* ══ 流程与 AI ═════════════════════════════════════════════════════════ */
/** 成本 / 统计 */
export const IconChart = decorative(BarChartOutlined, 'IconChart')
/* ══ 账号与外壳 ═════════════════════════════════════════════════════════ */
export const IconUser = decorative(UserOutlined, 'IconUser')
export const IconTeam = decorative(TeamOutlined, 'IconTeam')
export const IconLogout = decorative(LogoutOutlined, 'IconLogout')
export const IconBook = decorative(BookOutlined, 'IconBook')
/** 主题切换:太阳/月亮成对,不用 Sun/Moon 之外的图标凑 */
export const IconSun = decorative(SunOutlined, 'IconSun')
export const IconMoon = decorative(MoonOutlined, 'IconMoon')

View File

@ -0,0 +1,96 @@
/**
* 全站图标登记表(**扩展表**):只有**懒加载页面**用得到的语义出口(24 只)。
*
* 为什么单独一张表:`manualChunks` 的 `kit` 组按目录 `src/components/**` 强制收拢,
* 只要这张表的出口被首屏外壳按名字引用,那 24 只字形模块就整块上首屏。把外壳用不到的出口
* 分进来、并给 `extra.ts` 一条 priority 高于 `kit` 的逃生分组(`vite.config.ts` 的 `kit-icons-extra`)
* 之后,首屏实测 −20.94 raw / −4.74 gzip / −3.56 brotli kB(`chunkinfo.mjs`,同 no-map 设置配对)。
* 选图形的四条规则、`decorative()` 口径、命名规范**全部沿用 `core.ts` 文件头**,本表不是第二套规矩。
*
* 用法:`import { IconAudit } from '../components/icons/extra'`(**不能**从 `'../components/icons'` 取,
* 桶只 re-export core;这正是防回归的设计——写错时 `typecheck` 报「没有这个导出」,而不是悄悄拖慢首屏)。
* 取证:`reports/ui_evidence/nex-p24/bundle-icons-split.log`。
*/
import {
AimOutlined,
ArrowDownOutlined,
ArrowUpOutlined,
AudioOutlined,
AuditOutlined,
BlockOutlined,
BulbOutlined,
CheckCircleOutlined,
CustomerServiceOutlined,
EditOutlined,
FormOutlined,
HolderOutlined,
HourglassOutlined,
KeyOutlined,
NodeIndexOutlined,
OrderedListOutlined,
RobotOutlined,
SendOutlined,
SlidersOutlined,
StopOutlined,
TagOutlined,
ToTopOutlined,
UnorderedListOutlined,
UploadOutlined,
} from '@ant-design/icons'
import { decorative } from './_kit'
/* ══ 方向与折叠:成对出现,绝不混用 ══════════════════════════════════════
Chevron(尖角)= 展开/收起、上下移一档;Arrow(带箭杆)= 跨页面/跨数量级的
位移(返回、升到顶、排序方向)。两套混在一排里,用户就分不清「收起这一段」
和「翻到上一条」。 */
export const IconArrowUp = decorative(ArrowUpOutlined, 'IconArrowUp')
export const IconArrowDown = decorative(ArrowDownOutlined, 'IconArrowDown')
/** 回到顶部 / 置顶 */
export const IconToTop = decorative(ToTopOutlined, 'IconToTop')
/* ══ 动作:会改数据或打开东西 ══════════════════════════════════════════ */
/** 编辑内容(铅笔)。与 IconCompose(填表/写提示词)分档:一个是改已有,一个是补全 */
export const IconEdit = decorative(EditOutlined, 'IconEdit')
export const IconCompose = decorative(FormOutlined, 'IconCompose')
export const IconUpload = decorative(UploadOutlined, 'IconUpload')
export const IconSend = decorative(SendOutlined, 'IconSend')
/** 参数 / 提示词配置(滑杆) */
export const IconParams = decorative(SlidersOutlined, 'IconParams')
/** 定位到素材 / 看技术指标(靶心) */
export const IconAim = decorative(AimOutlined, 'IconAim')
/* ══ 播放与媒体 ═════════════════════════════════════════════════════════
两档播放:IconPlay(实心三角,贴在缩略角上的「点这里播」)、
IconPlayCircle(圆圈,动作按钮里的「播放/预览成片」)。 */
export const IconStop = decorative(StopOutlined, 'IconStop')
/** 录音 / 配音(话筒) */
export const IconMic = decorative(AudioOutlined, 'IconMic')
/** 声音模型与音色样本(耳麦 = 声音这条线,和「音频文件」分开) */
export const IconVoice = decorative(CustomerServiceOutlined, 'IconVoice')
/** 拖拽把手:表格里「按住整行改顺序」的把手(antd 拖拽排序示例的标准图形) */
export const IconDragHandle = decorative(HolderOutlined, 'IconDragHandle')
/* ══ 状态:只读,不触发任何动作 ═════════════════════════════════════════ */
export const IconPass = decorative(CheckCircleOutlined, 'IconPass')
/** 在等外部条件(授权、限流) */
export const IconHourglass = decorative(HourglassOutlined, 'IconHourglass')
/* ══ 流程与 AI ═════════════════════════════════════════════════════════ */
/** AI 生成 / 一键跑(与侧栏「任务调度」同一只闪电:都是「跑起来」) */
export const IconRobot = decorative(RobotOutlined, 'IconRobot')
/** AI 建议 / 补全提示词(灯泡 = 想法,不给「生成」用,避免和闪电同义) */
export const IconBulb = decorative(BulbOutlined, 'IconBulb')
/** 分组、节点图之类结构性内容 */
export const IconNodeIndex = decorative(NodeIndexOutlined, 'IconNodeIndex')
/** 审核 / 合规检查(手册章节里还在用;侧栏已换盾牌) */
export const IconAudit = decorative(AuditOutlined, 'IconAudit')
/** 素材集合(看板分组切换里的「全部素材」) */
export const IconBlocks = decorative(BlockOutlined, 'IconBlocks')
export const IconList = decorative(UnorderedListOutlined, 'IconList')
/** 打标签 / 批量标签(标签形状与列表不同,能分辨) */
export const IconTag = decorative(TagOutlined, 'IconTag')
export const IconListOrdered = decorative(OrderedListOutlined, 'IconListOrdered')
/* ══ 账号与外壳 ═════════════════════════════════════════════════════════ */
export const IconKey = decorative(KeyOutlined, 'IconKey')

View File

@ -1,311 +1,15 @@
/**
* 全站图标登记表:整个项目**只有这一个文件**允许 import '@ant-design/icons'。
* 全站图标登记表的**桶**:页面默认 import 这里,拿到的只有 `core.ts` 的 54 只外壳图形。
*
* ── 为什么要收口(2026-11 图标重设计)────────────────────────────────────
* 收口之前有 32 个文件各自 `import { XOutlined } from '@ant-design/icons'`,
* 73 个图标名散在页面里,于是「换个图标」= 全站搜索替换,而「同一个意思该长
* 什么样」没有任何一处能查。更糟的是页面写的是**字形名**(AppstoreOutlined),
* 不是**语义**:读代码的人看不出这里是「网格视图」还是「资产库」,
* 下一个改的人就顺手挑了另一个「看着差不多」的方块。
* 这里刻意**不写** `export * from './extra'`(2026-11-09 · NEX 阶段 25):
* 一旦写上,首屏外壳就按名字引用得到那 24 只懒页面专属图形,`kit` 分组会把整张
* `extra.ts` 连字形一起拽上首屏 —— 实测那条 `export *` 值 Δgzip −0.08 kB,
* 拆表白做(`reports/ui_evidence/nex-p24/bundle-icons-split.log` D1)。
* 所以懒页面专属的出口要写全路径 `from '../components/icons/extra'`;
* 写错时 `typecheck` 直接报「没有这个导出」,而不是悄悄拖慢首屏。
*
* 收口之后:
* · 页面只说语义(IconGrid / IconWarn / IconTimeline),字形只在这里出现一次;
* · 换一只图标 = 改这一行,全站跟着变,明暗两色、菜单/按钮/标签三处一起生效;
* · 想加新图标必须先在这里登记一个语义名,「随手 import 一个没见过的图形」
* 在词汇表闸(scripts/ui/classaudit.mjs 第 2 条)上直接红。
*
* ── 选图形的四条规则 ────────────────────────────────────────────────────
* 1. **一族到底**:只用 Outlined。只有两枚例外,且例外是「实心才读得对」的
* 状态资产——播放三角(IconPlay)与收藏/当前版本(IconStar)。
* TwoTone / 双色一律不用:它们带第二个颜色,深色主题里那一档永远是错的。
* 2. **剪影互不雷同**:同一屏里出现的图标必须靠轮廓分辨,不能靠细节。
* 本次为此改了四处侧栏图形(见下面的「导航」组),并消掉了
* 「当前项目」和「资产管理」共用一只文件夹的撞脸。
* 3. **14px 可读**:线条数超过三组、或含 1px 内细节的图形不进导航与按钮
* (AuditOutlined 的夹板勾在 14px 糊成一团 → 换 SafetyCertificate 的盾牌)。
* 4. **图标不写尺寸与颜色**:.anticon 继承容器的 font-size / color,
* 菜单跟 Menu 的 iconSize、按钮跟 Button 的 onlyIconSize、标签跟 Tag 的
* fontSizeSM——antd 已经各定过一档,页面再写 `text-[11px]` 就是第二把尺子。
* 行内(小标题 / 提示行)用 kit 的 <IconText>,按钮用 icon 槽,
* 不要手搓 margin。
*
* 5. **图标默认不进辅助技术树**:字形自己带 `aria-label=字形名`,混进按钮名称就是
* 「upload 导入脚本」这种半英不中的播报。出口一律走下面的 `decorative()`:
* 默认 `aria-hidden`,只有「图标就是这条操作的全部语义」时才显式写 `aria-label`。
*
* 用法:`import { IconClose, IconWarn } from '../../components/icons'`
* 命名规范、选图形四条规则、`decorative()` 口径都在 `core.ts` 文件头,本文件不重复。
*/
import { createElement, forwardRef, type ComponentProps, type ComponentType } from 'react'
import {
AimOutlined,
ApiOutlined,
AppstoreOutlined,
ArrowDownOutlined,
ArrowLeftOutlined,
ArrowUpOutlined,
AudioOutlined,
AuditOutlined,
BarChartOutlined,
BarsOutlined,
BlockOutlined,
BookOutlined,
BulbOutlined,
CaretRightFilled,
CheckCircleOutlined,
CheckOutlined,
ClockCircleOutlined,
CloseCircleFilled,
CloseCircleOutlined,
CloseOutlined,
CopyOutlined,
CustomerServiceOutlined,
DashboardOutlined,
DatabaseOutlined,
DeleteOutlined,
DownOutlined,
DownloadOutlined,
EditOutlined,
EllipsisOutlined,
ExclamationOutlined,
ExportOutlined,
EyeInvisibleOutlined,
EyeOutlined,
FolderOpenOutlined,
FormOutlined,
FullscreenOutlined,
FundProjectionScreenOutlined,
HolderOutlined,
HourglassOutlined,
InfoCircleOutlined,
KeyOutlined,
LeftOutlined,
LoadingOutlined,
LogoutOutlined,
MenuFoldOutlined,
MenuUnfoldOutlined,
MoonOutlined,
NodeIndexOutlined,
OrderedListOutlined,
PauseOutlined,
PictureOutlined,
PlayCircleOutlined,
PlusOutlined,
ProfileOutlined,
ProjectOutlined,
RedoOutlined,
ReloadOutlined,
RightOutlined,
RobotOutlined,
SafetyCertificateOutlined,
ScissorOutlined,
SearchOutlined,
SendOutlined,
SlidersOutlined,
SoundOutlined,
StarFilled,
StopOutlined,
SunOutlined,
SyncOutlined,
TagOutlined,
TeamOutlined,
ThunderboltOutlined,
ToTopOutlined,
UnorderedListOutlined,
UpOutlined,
UploadOutlined,
UserOutlined,
VideoCameraOutlined,
WarningOutlined,
} from '@ant-design/icons'
/** 一只字形组件(@ant-design/icons 原样产物的属性:className / style / onClick / spin / rotate / 全部 aria-*) */
export type IconProps = ComponentProps<typeof ProjectOutlined>
/** 需要把图标当值存进映射表时(lib/media.ts 的素材类型表)用这个类型 */
export type IconComponent = ComponentType<IconProps>
/**
* 装饰性包装:登记表出口的**唯一**渲染路径(2026-11-08 · 阶段 8.5 在册 AT-1 → 本轮 S-2)。
*
* 症状:`@ant-design/icons` 把每只字形渲染成
* `<span role="img" aria-label=字形名>`(AntdIcon.js: `{'aria-label': icon.name}`),
* 于是 VoiceOver 念出来的是「upload 导入脚本」「down 导出」「appstore 看板」
* 「ordered-list 分镜表」「book 手册」——按钮文字已经在外面,同一个控件被报两遍,
* 前半截还是用户从没见过的英文码。取证:
* `reports/ui_evidence/nex-p8f/07-screen-reader/voiceover-announcements-2026-11-08.txt` V7/V8/V11。
*
* 口径(一句话):**图标默认是装饰,语义由它所在的控件说。**
* · 默认 → `aria-hidden="true"` 且不写 aria-label:字形名对辅助技术彻底消失,
* 控件的可读名称回到「导入脚本 / 导出 / 看板」这几个真人会说的字上;
* · 调用方显式给了非空 `aria-label` → 这只图标**自己承担语义**(它后面没有文字),
* 保留 `role=img` 用给定的名字,不再隐藏;
* · 调用方显式写 `aria-hidden={false}` → 尊重调用方(用于整块表面自带 aria-labelledby 的场景)。
* 需要「图标是唯一语义」的位置一律走第二条,禁止把包装拆回去让英文字形名重新外泄。
*
* 只改辅助技术属性,**不产生任何 DOM 结构变化**(渲染的仍是同一只 `span.anticon`),
* 尺寸、颜色、间距、`.anticon` 选择器(app.css:564)与全部视觉探针读数不受影响。
*/
function decorative(Glyph: ComponentType<IconProps>, alias: string) {
const Icon = forwardRef<HTMLSpanElement, IconProps>(function IconDecorative(props, ref) {
const { 'aria-hidden': ariaHidden, 'aria-label': ariaLabel, ...rest } = props
const named = typeof ariaLabel === 'string' && ariaLabel.trim() !== ''
// 本文件是 .ts(登记表不写 JSX),所以用 createElement 而不是 <Glyph />
return createElement(Glyph, {
...rest,
ref,
'aria-label': named ? ariaLabel : undefined,
'aria-hidden': named ? (ariaHidden ?? false) : (ariaHidden ?? true),
})
})
Icon.displayName = alias
return Icon
}
/* ══ 导航:侧栏菜单 + 页签 + 手册目录 ═════════════════════════════════════
十只图形按「轮廓不同族」挑:看板格 / 圆柱库 / 插头 / 仪表盘 / 文件夹 /
投影幕 / 闪电 / 盾牌 / 剪刀 / 下箭头托盘。四处改动都写在旁边的注释里,
改回来的人能看见当初为什么换掉。 */
/** 项目总览:所有项目的看板。原来用 Appstore(四个方块),和「平台资产库」的素材墙撞脸 */
export const IconProjects = decorative(ProjectOutlined, 'IconProjects')
/** 平台资产库:跨项目的母版库(圆柱 = 存量) */
export const IconLibrary = decorative(DatabaseOutlined, 'IconLibrary')
/** 模型管理中心:站内所有模型都是外部 API 接入 */
export const IconApi = decorative(ApiOutlined, 'IconApi')
/** 当前项目(侧栏子菜单):一个项目 = 一个打开的目录 */
export const IconFolder = decorative(FolderOpenOutlined, 'IconFolder')
/** 流程概览:总控台 / 全节点进度(仪表盘是「概览」的唯一画法) */
export const IconDashboard = decorative(DashboardOutlined, 'IconDashboard')
/** 资产管理:项目内的素材墙是网格砖,所以给方块组(原来与父级共用文件夹 = 上下同图) */
export const IconGrid = decorative(AppstoreOutlined, 'IconGrid')
/** 分镜与脚本:投影幕 + 分格 = 分镜板 */
export const IconStoryboard = decorative(FundProjectionScreenOutlined, 'IconStoryboard')
/** 任务调度中心:队列 / 执行 / 重试 / 并发 */
export const IconBolt = decorative(ThunderboltOutlined, 'IconBolt')
/** 质检与审核:盾牌带勾。AuditOutlined 的夹板在 iconSize 14 下糊成一块板 */
export const IconShield = decorative(SafetyCertificateOutlined, 'IconShield')
/** 时间线合成:剪刀 = 剪辑(NodeIndex 的节点连线与「调度」的图形读不出先后) */
export const IconTimeline = decorative(ScissorOutlined, 'IconTimeline')
/** 导出与成本:成片交付 */
export const IconDownload = decorative(DownloadOutlined, 'IconDownload')
/* ══ 方向与折叠:成对出现,绝不混用 ══════════════════════════════════════
Chevron(尖角)= 展开/收起、上下移一档;Arrow(带箭杆)= 跨页面/跨数量级的
位移(返回、升到顶、排序方向)。两套混在一排里,用户就分不清「收起这一段」
和「翻到上一条」。 */
export const IconChevronUp = decorative(UpOutlined, 'IconChevronUp')
export const IconChevronDown = decorative(DownOutlined, 'IconChevronDown')
export const IconChevronLeft = decorative(LeftOutlined, 'IconChevronLeft')
export const IconChevronRight = decorative(RightOutlined, 'IconChevronRight')
export const IconArrowUp = decorative(ArrowUpOutlined, 'IconArrowUp')
export const IconArrowDown = decorative(ArrowDownOutlined, 'IconArrowDown')
/** 返回上一个页面(不是「向上移一档」) */
export const IconArrowBack = decorative(ArrowLeftOutlined, 'IconArrowBack')
/** 回到顶部 / 置顶 */
export const IconToTop = decorative(ToTopOutlined, 'IconToTop')
/** 侧栏折叠:折叠与展开是两只不同的图形,不能靠 transform 复用一只 */
export const IconSiderCollapse = decorative(MenuFoldOutlined, 'IconSiderCollapse')
export const IconSiderExpand = decorative(MenuUnfoldOutlined, 'IconSiderExpand')
/** 灯箱左右翻页 */
export const IconFullscreen = decorative(FullscreenOutlined, 'IconFullscreen')
/* ══ 动作:会改数据或打开东西 ══════════════════════════════════════════ */
export const IconAdd = decorative(PlusOutlined, 'IconAdd')
export const IconClose = decorative(CloseOutlined, 'IconClose')
/**
* 清空输入框(antd 输入类控件 `allowClear` 的默认图形,同一只 CloseCircleFilled)。
*
* 登记它不是为了画新东西,而是为了让 kit 能把这只图形**换成带名字的**:
* antd 自己在内部渲染 CloseCircleFilled,读屏于是念英文字形名「close-circle」。
* kit/SearchInput 传 `allowClear={{ clearIcon: <IconClear aria-label="清空搜索" /> }}`
* 之后,svg 路径与类名(anticon-close-circle)一字不差,只有可读名称变了。
*/
export const IconClear = decorative(CloseCircleFilled, 'IconClear')
export const IconDelete = decorative(DeleteOutlined, 'IconDelete')
/** 编辑内容(铅笔)。与 IconCompose(填表/写提示词)分档:一个是改已有,一个是补全 */
export const IconEdit = decorative(EditOutlined, 'IconEdit')
export const IconCompose = decorative(FormOutlined, 'IconCompose')
export const IconCopy = decorative(CopyOutlined, 'IconCopy')
export const IconUpload = decorative(UploadOutlined, 'IconUpload')
/** 在新窗口打开(不是「导出文件」,导出用 IconDownload) */
export const IconExternal = decorative(ExportOutlined, 'IconExternal')
export const IconReload = decorative(ReloadOutlined, 'IconReload')
/** 与后台对表(同步状态),区别于 IconReload(重跑同一件事) */
export const IconSync = decorative(SyncOutlined, 'IconSync')
/** 重试失败的节点 */
export const IconRetry = decorative(RedoOutlined, 'IconRetry')
export const IconSend = decorative(SendOutlined, 'IconSend')
export const IconSearch = decorative(SearchOutlined, 'IconSearch')
/** 参数 / 提示词配置(滑杆) */
export const IconParams = decorative(SlidersOutlined, 'IconParams')
/** 定位到素材 / 看技术指标(靶心) */
export const IconAim = decorative(AimOutlined, 'IconAim')
/** 更多(三个点,用于折叠起来的操作) */
export const IconMore = decorative(EllipsisOutlined, 'IconMore')
/** 显隐切换:明文/密文、显示/隐藏轨道 */
export const IconEye = decorative(EyeOutlined, 'IconEye')
export const IconEyeOff = decorative(EyeInvisibleOutlined, 'IconEyeOff')
/* ══ 播放与媒体 ═════════════════════════════════════════════════════════
两档播放:IconPlay(实心三角,贴在缩略角上的「点这里播」)、
IconPlayCircle(圆圈,动作按钮里的「播放/预览成片」)。 */
export const IconPlay = decorative(CaretRightFilled, 'IconPlay')
export const IconPlayCircle = decorative(PlayCircleOutlined, 'IconPlayCircle')
export const IconPause = decorative(PauseOutlined, 'IconPause')
export const IconStop = decorative(StopOutlined, 'IconStop')
/** 录音 / 配音(话筒) */
export const IconMic = decorative(AudioOutlined, 'IconMic')
/** 音频素材 / 正在出声 */
export const IconSound = decorative(SoundOutlined, 'IconSound')
/** 声音模型与音色样本(耳麦 = 声音这条线,和「音频文件」分开) */
export const IconVoice = decorative(CustomerServiceOutlined, 'IconVoice')
export const IconImage = decorative(PictureOutlined, 'IconImage')
export const IconVideo = decorative(VideoCameraOutlined, 'IconVideo')
/** 文档类素材:素材类型表(lib/media.ts)与灯箱角标共用这一枚,不再另挑一只「清单」 */
export const IconDoc = decorative(ProfileOutlined, 'IconDoc')
/** 时间线轨道列表 */
export const IconTracks = decorative(BarsOutlined, 'IconTracks')
/** 拖拽把手:表格里「按住整行改顺序」的把手(antd 拖拽排序示例的标准图形) */
export const IconDragHandle = decorative(HolderOutlined, 'IconDragHandle')
/* ══ 状态:只读,不触发任何动作 ═════════════════════════════════════════ */
export const IconCheck = decorative(CheckOutlined, 'IconCheck')
export const IconPass = decorative(CheckCircleOutlined, 'IconPass')
export const IconReject = decorative(CloseCircleOutlined, 'IconReject')
/** 需要注意但不致命(三角);IconCaution(感叹号)用在流程步骤的失败标记上 */
export const IconWarn = decorative(WarningOutlined, 'IconWarn')
export const IconCaution = decorative(ExclamationOutlined, 'IconCaution')
export const IconInfo = decorative(InfoCircleOutlined, 'IconInfo')
export const IconLoading = decorative(LoadingOutlined, 'IconLoading')
/** 排队 / 已耗时 */
export const IconClock = decorative(ClockCircleOutlined, 'IconClock')
/** 在等外部条件(授权、限流) */
export const IconHourglass = decorative(HourglassOutlined, 'IconHourglass')
/** 收藏 / 当前选定版本(实心才有「已选中」的重量) */
export const IconStar = decorative(StarFilled, 'IconStar')
/* ══ 流程与 AI ═════════════════════════════════════════════════════════ */
/** AI 生成 / 一键跑(与侧栏「任务调度」同一只闪电:都是「跑起来」) */
export const IconRobot = decorative(RobotOutlined, 'IconRobot')
/** AI 建议 / 补全提示词(灯泡 = 想法,不给「生成」用,避免和闪电同义) */
export const IconBulb = decorative(BulbOutlined, 'IconBulb')
/** 分组、节点图之类结构性内容 */
export const IconNodeIndex = decorative(NodeIndexOutlined, 'IconNodeIndex')
/** 审核 / 合规检查(手册章节里还在用;侧栏已换盾牌) */
export const IconAudit = decorative(AuditOutlined, 'IconAudit')
/** 成本 / 统计 */
export const IconChart = decorative(BarChartOutlined, 'IconChart')
/** 素材集合(看板分组切换里的「全部素材」) */
export const IconBlocks = decorative(BlockOutlined, 'IconBlocks')
export const IconList = decorative(UnorderedListOutlined, 'IconList')
/** 打标签 / 批量标签(标签形状与列表不同,能分辨) */
export const IconTag = decorative(TagOutlined, 'IconTag')
export const IconListOrdered = decorative(OrderedListOutlined, 'IconListOrdered')
/* ══ 账号与外壳 ═════════════════════════════════════════════════════════ */
export const IconUser = decorative(UserOutlined, 'IconUser')
export const IconTeam = decorative(TeamOutlined, 'IconTeam')
export const IconKey = decorative(KeyOutlined, 'IconKey')
export const IconLogout = decorative(LogoutOutlined, 'IconLogout')
export const IconBook = decorative(BookOutlined, 'IconBook')
/** 主题切换:太阳/月亮成对,不用 Sun/Moon 之外的图标凑 */
export const IconSun = decorative(SunOutlined, 'IconSun')
export const IconMoon = decorative(MoonOutlined, 'IconMoon')
export * from './core'
export type { IconProps, IconComponent } from './_kit'

View File

@ -154,6 +154,10 @@ export function MediaThumb({
* 而它和 MediaThumb 自带的版本角标是同一族东西——都压在媒体上、都不参与控件档位。
* 做法:收进媒体组件,谁要删除入口就给 MediaThumb 传 onRemove,
* 自己拼的占位方块(无缩略图的文件)也可以直接用这只。
* 重做(2026-11-11 · 用户第 3 条「图片资产上的删除按钮重新设计」):原来那颗
* 粉底红叉压在缩略图角上像一枚报错徽标,颜色和图片打架。现在与左下版本
* 角标同族(.nex-media-badge):深色磨砂小方角 + 白色图标,常态安静、
* 悬停 / 聚焦才转成 error 红表明破坏性;保持常驻可见(触屏没有 hover)。
* 为什么 stopPropagation:外层整块媒体本身可点开预览,删除不能顺手把灯箱也打开。
*/
export function MediaRemove({ onClick, title, label = '删除这个素材' }: {
@ -162,7 +166,7 @@ export function MediaRemove({ onClick, title, label = '删除这个素材' }: {
return (
<button type="button" title={title} aria-label={label}
onClick={(e) => { e.stopPropagation(); onClick() }}
className="nex-media-remove absolute right-1 top-1 z-[3] grid place-items-center w-5 h-5 p-0 rounded-full cursor-pointer border border-error-border text-error-hover text-base leading-none hover:bg-error-border bg-[color-mix(in_srgb,var(--ant-color-error-bg-hover)_91%,transparent)]">
className="nex-media-remove nex-media-badge absolute right-1 top-1 z-[3] grid place-items-center w-5 h-5 p-0 rounded-sm cursor-pointer text-white text-xs leading-none transition-colors bg-[color-mix(in_srgb,var(--ant-color-bg-mask)_62%,transparent)] hover:bg-error">
<IconClose />
</button>
)

View File

@ -24,7 +24,8 @@ import {
import { AudioPlay } from './AudioPlay'
import { Checkbox } from '../ui/Checkbox'
import { Button, Input, TextLink } from '../ui'
import { IconCheck, IconClose, IconHourglass, IconMic, IconReload, IconStop, IconWarn } from '../icons'
import { IconCheck, IconClose, IconReload, IconWarn } from '../icons'
import { IconHourglass, IconMic, IconStop } from '../icons/extra'
export type RecordPickMeta = {
durationMs: number

View File

@ -135,6 +135,11 @@ export function OptionGrid({ children, cols = 3, label, labelTitle, className, h
* `CardActions` 包了 Dense(全 sm 24),页面又在 Actions 里补 size="sm",
* 于是素材墙一张卡底下「AI 生成」24、「上传」32、「删除」32。
* 现在只有一个实现:页面既不用、也不准再给行里的单个控件写 size。
*
* 【这一句的边界(2026-11-11 · §5.1.2.1)】它管的是**套在 CardActions 里**的控件。
* 卡片右上角那一对(模型卡「配置 / 删除」、资产卡与项目素材卡的「编辑 / 删除」)是绝对定位在
* 封面上的,套不进这一行,于是按同一份口径在 JSX 上显式写死 `size="sm"` —— 档位来源只有这两种,
* 不许靠「这张卡恰好没套 Dense」维持 24。看到那些显式 size 别当冗余删掉。
*/
export function CardActions({ children, className }: { children: ReactNode; className?: string }) {
return (
@ -329,13 +334,27 @@ export function Chip({ active, children, onClick, className, title, disabled, as
)
}
/** 选中态胶囊 + 移除叉(多选回显);removeTitle 解释叉掉之后会发生什么 */
/**
* 选中态胶囊 + 移除叉(多选回显);removeTitle 解释叉掉之后会发生什么。
*
* 那颗叉**必须自己报名**(2026-11-09 · 阶段 23 · S-2 收口):antd 5.29 的
* `_util/hooks/useClosable.js` 会把 closeIcon `cloneElement` 一次并补
* `'aria-label': props['aria-label'] ?? locale.close` ⇒ 我们不写名时它兜的是
* 通用词「关闭」,而这里的动作是**取消这一项选择**(点完胶囊消失、人物回到未引入
* 状态),不是关掉什么东西;更关键的是这个名字来自 antd 的实现细节,
* 5.20 之前那段兜底根本不存在(叉当时直接从 AT 树上消失),升级即静默漂移。
* 显式写 `aria-label="移除"` 之后 `?? ` 短路 ⇒ 名字由我们说了算,`decorative()`
* 也从第 ① 档(默认 aria-hidden)切到第 ② 档(图标自己承担语义)。
* 已知缺口(本轮不修,登记在未解决项):`Tag` 的 closeIconRender 用
* `replaceElement` 把 onClick 直接挂到图形上,`AntdIcon` 见到 onClick 就写
* `tabIndex=-1` ⇒ 这颗叉**鼠标点得着、键盘够不到**,且它本体是 role=img 不是 button。
*/
export function TagChip({ children, onRemove, className, removeTitle }: {
children: ReactNode; onRemove?: () => void; className?: string; removeTitle?: string
}) {
return (
<Tag className={cn('nex-tag-chip', className)} bordered closable={!!onRemove}
closeIcon={onRemove ? <IconClose /> : undefined}
closeIcon={onRemove ? <IconClose aria-label="移除" /> : undefined}
onClose={(e) => { e.preventDefault(); onRemove?.() }}>
<span className="min-w-0 wrap-anywhere">{children}</span>
{removeTitle && <span className="sr-only">{removeTitle}</span>}
@ -356,11 +375,27 @@ export function TagChip({ children, onRemove, className, removeTitle }: {
* DOM 结构、类名、皮肤、禁用逻辑一律不动(rc-pagination 拿到返回值之后照样
* cloneElement({disabled}),翻页到头的禁用还是它自己算)。
* simple 档没有 jump-prev / jump-next(那是完整分页的「•••」),所以只登记这两类。
*
* **补一句消音**(2026-11-09 · 阶段 23 · S-2 收口):只给宿主报名是不够的。
* antd 的原元素是 `<button class="ant-pagination-item-link" tabindex="-1"><LeftOutlined/></button>`,
* 图形那颗 `<span role="img" aria-label="left">` 在 AX 树里是**独立对象**——
* 读屏念完「上一页」再补一句英文「left」(`semanticcheck` 5c 实测 1440/430 各 4 颗,
* 加上浮层里的分页 8 颗共 12 颗,取证 `reports/ui_evidence/nex-p23/predis/`)。
* 口径与登记表一致:**宿主具名 ⇒ 图形消音**。`AntdIcon` 把 `restProps` spread 在
* `{role:'img','aria-label':icon.name}` **之后** ⇒ clone 进去的 `aria-hidden` 覆盖得住。
* 图形本体、类名、`tabindex`、禁用逻辑一律不动(rc-pagination 拿到返回值之后照样
* `cloneElement({disabled})`),所以这一步只改辅助技术可见性,零视觉与零行为变化。
*/
const pagerLabel = (el: React.ReactNode, type: 'page' | 'prev' | 'next' | 'jump-prev' | 'jump-next') => {
if (!((type === 'prev' || type === 'next') && isValidElement(el))) return el
return cloneElement(el as ReactElement<{ 'aria-label'?: string }>,
{ 'aria-label': type === 'prev' ? '上一页' : '下一页' })
const btn = el as ReactElement<{ 'aria-label'?: string; children?: ReactNode }>
const glyph = btn.props.children
return cloneElement(btn, {
'aria-label': type === 'prev' ? '上一页' : '下一页',
children: isValidElement(glyph)
? cloneElement(glyph as ReactElement, { 'aria-hidden': true })
: glyph
})
}
const DEFAULT_SIZES = [12, 20, 24, 30, 48, 60, 120]

View File

@ -8,6 +8,7 @@ import { type ReactNode, type CSSProperties } from 'react'
import { Checkbox as AntCheckbox, Form, Radio as AntRadio, Row } from 'antd'
import { cn } from '../../lib/cn'
import { Button } from './Button'
import { FieldIdContext, fieldControlChild, useNexFieldId } from './fieldId'
import { ROW_STEPS, colSpans, toCols } from './grid'
type FieldWidth = 'default' | 'grow' | 'narrow' | 'wide' | 'full'
@ -46,10 +47,18 @@ export function Field({ label, required, children, width = 'default', className,
/** 标签与控件同一行(筛选条 / 工具条);不写就是标签在上(表单 / 抽屉) */
inline?: boolean
}) {
/* 名字通道(T1-N6):只有「children 就是单独一颗 kit 控件」时才写 htmlFor。
控件那边由 useFieldControlId 认领同一个 id;自带 id 时两边都跟着它走。
Provider 不产生 DOM 节点,`.ant-form-item-control-input-content > .ant-input-affix-wrapper`
那条直接子元素选择器(见文件下方注释与 SecretInput 的 ref 契约)不受影响。 */
const genId = useNexFieldId()
const ctl = fieldControlChild(children)
const forId = ctl ? (typeof (ctl.props as { id?: unknown }).id === 'string' ? (ctl.props as { id: string }).id : genId) : undefined
return (
<Form.Item
layout={inline ? 'horizontal' : 'vertical'}
required={required}
htmlFor={forId}
label={label === undefined ? undefined : <span title={title}>{label}</span>}
extra={hint}
className={cn('nex-field min-w-0', inline && 'nex-field-inline', width !== 'default' && 'nex-field-fill', className)}
@ -57,7 +66,7 @@ export function Field({ label, required, children, width = 'default', className,
? { ['--nex-ctl-w' as string]: `${INLINE_CTL_W[width]}px` }
: WIDTHS[width]), ...style }}
>
{children}
{ctl ? <FieldIdContext.Provider value={{ id: genId, claim: { taken: false } }}>{children}</FieldIdContext.Provider> : children}
</Form.Item>
)
}
@ -151,17 +160,36 @@ export function RadioGroup({ value, onChange, options, className, disabled }: {
* 选完把 input 清空:否则连着两次选同一个文件 value 没变,onChange 不再触发
* (分镜导入要反复试同一份脚本)。
*/
export function FilePick({ label, icon, accept, multiple, onFiles, className, title, disabled }: {
export function FilePick({ label, icon, accept, multiple, onFiles, className, title, disabled, size }: {
label: ReactNode; accept?: string; multiple?: boolean; onFiles: (files: File[]) => void; className?: string
/** 悬浮说明「选出来的文件会落到哪里」:一页里上传点越多越需要这句话 */
title?: string; disabled?: boolean
/** 图标走 antd Button 的 icon 槽,不写进 label —— 否则间距由 label 里的空格决定 */
icon?: ReactNode
/** 与 Select 同义:不给就跟随容器档位。卡片动作条不套 Dense 时页面要显式写 sm。 */
size?: 'sm' | 'md'
}) {
/* ── 可访问名称(2026-11-10 · 阶段 35 · S-3 / T1-N7)─────────────────────────
改前实测(`reports/ui_evidence/nex-p35/filepick-ax-before.json`,Chromium AX 树):
· 外层按钮名 = `定妆图 Choose File: No file chosen`
——浏览器给 `<input type=file>` 的原生影子文字(`Choose File` / `No file chosen`)
按 name-from-contents 渗进了**按钮**的名字里,与 S-2 那族「字形名混入名称」
同一个形状,只是来源从图标换成了浏览器原生控件文案;
· 隐藏那颗 input 自己也是一个 AT 停靠点:`button "Choose File"`(英文)。
改后两条各管各的:按钮名称用 `aria-label` 钉成 label 本身(影子文字不再参与
计算);那颗 input 给出中文全名「<动作>,选择文件」——它**是**真正的激活目标
(整块热区靠 `inset:0` 压在按钮上,Enter 开文件框的是它),所以必须留在 AT 树里、
带着自己的名字,不能 `aria-hidden` 掉(`aria-hidden` + 可聚焦 = 焦点落进哑节点)。
`labelText` 为空(label 是 JSX)时按钮退回按 contents 取名、input 用通用中文名词,
两种退路都不会再出现英文。
不动的东西:`title`(→ AT description)、`inset:0` 热区、选完清空 value 的口径、
焦点环 `.ant-btn:has(> .nex-file-input:focus-visible)`(`app.css:528`)、停靠点数量。 */
const labelText = typeof label === 'string' ? label.trim() : ''
return (
<Button className={className} title={title} disabled={disabled} icon={icon}>
<Button size={size} className={className} title={title} disabled={disabled} icon={icon} aria-label={labelText || undefined}>
<span className="contents">{label}</span>
<input type="file" className="nex-file-input" accept={accept} multiple={multiple} title={undefined}
aria-label={labelText ? labelText + ',选择文件' : '选择文件'}
onChange={(e) => {
const files = Array.from(e.currentTarget.files || [])
e.currentTarget.value = ''

View File

@ -14,17 +14,19 @@
* React 18 必须 forwardRef,而且页面拿到节点才能 focus / setSelectionRange /
* scrollIntoView——契约与理由见 lib/ref.ts。
*/
import { forwardRef } from 'react'
import { forwardRef, useEffect, useRef } from 'react'
import { Button, Input as AntInput, InputNumber } from 'antd'
import { IconClear, IconSearch } from '../icons'
import { domInput, domTextarea, passRef } from '../../lib/ref'
import { markFieldControl, useFieldControlId } from './fieldId'
const { TextArea: AntTextArea, Search: AntSearch } = AntInput
/** 单行文本(原生 event 兼容:onChange={(e) => setX(e.target.value)}) */
export const Input = forwardRef<HTMLInputElement, React.ComponentProps<typeof AntInput>>(
function Input(props, ref) {
return <AntInput {...props} ref={(h) => passRef(ref, domInput(h))} />
/* id 由宿主 Field 提供(T1-N6):`<label for>` 指向的本体就是这颗 input */
return <AntInput {...props} id={useFieldControlId(props.id)} ref={(h) => passRef(ref, domInput(h))} />
})
/**
@ -40,11 +42,91 @@ export const Input = forwardRef<HTMLInputElement, React.ComponentProps<typeof An
* 「这个字段默认几行」,把「会不会长」这件事收在一处,页面不用记第二条规矩。
*/
export const TextArea = forwardRef<HTMLTextAreaElement, React.ComponentProps<typeof AntTextArea>>(
function TextArea({ rows, autoSize, ...rest }, ref) {
function TextArea({ rows, autoSize, id, ...rest }, ref) {
const grow = autoSize ?? (rows ? { minRows: rows, maxRows: Math.max(4, rows * 4) } : undefined)
return <AntTextArea {...rest} autoSize={grow} ref={(h) => passRef(ref, domTextarea(h))} />
return <AntTextArea {...rest} id={useFieldControlId(id)} autoSize={grow} ref={(h) => passRef(ref, domTextarea(h))} />
})
/* ── 步进器的可读名称(2026-11-09 · 阶段 18 · S-3-2)────────────────────────────
症状:全站 antd 内置件里最后剩下的英文可读名称,就是数字框上下两颗——
读屏念「Increase Value」/「Decrease Value」(第 9 闸 LOCALE 的在册豁免 12 处)。
根因:`rc-input-number@9.5.0` 把这两条 `aria-label` **写死**在 handler `<span>` 上
(`es/StepHandler.js:87` 与 `:97`),而且写在 `...sharedHandlerProps` **之后**
⇒ antd 的 `upHandler` / `downHandler` 只换得到里面的图形,换不掉外层那颗按钮的名字;
antd 的 `zh_CN` 语言包**没有 InputNumber 这一段**(阶段 12 打印过它的 keys)
⇒ 组件属性通道与语言包通道**两条都不存在**,剩下的只有「自己把名字改对」。
做法:只改名字,**结构、类名、像素、鼠标与键盘行为一个字都不动**——挂载后把这两条
换成中文,再用 MutationObserver 兜住重挂载。写之前先比一次当前值,
已经是中文就不写 ⇒ 观察者不会自己咬自己(不会形成 attribute 回环)。
为什么需要观察者而不是只在挂载时改一次:handler 是 `controls` 为真时才渲染的
(`rc-input-number/es/InputNumber.js:492` 就是 `controls && <StepHandler>`),
条件变化换上来的是两颗全新的 `<span>`;这一版本 antd 的 InputNumber
**没有 mobile 分支**(实测 560 与 1440 两态 handler 一直在,`grep mobile
antd/es/input-number/index.js` 为空),所以观察者今天兜的是重挂载而不是断点。
为什么落在 kit 这一层:全站数字框只有下面两个组件(R8 把 antd 的 import 关在
`theme/` · `app/` · `components/{ui,forms}`),在这里收口 = 页面 0 改动、
`controls={false}` 与自绘步进器那两条「要动已验证视觉」的路一条都没走。
验收:`semanticcheck` 第 10 条判据 LOCALE 的豁免表**已清空**——这两条英文名再出现就是违规;
反向验证见 `gateprobe` 判据 ⑳(`pb-locnum` 坏形状必须点名 / `pg-locnumzh` 必须放行);
活体读数(DOM 名 + AX 整名 + 步进链路 + 明暗截图)见
`reports/ui_evidence/nex-p18/s3step.py`。*/
const STEP_LABEL_ZH: Record<string, string> = {
'Increase Value': '增加数值',
'Decrease Value': '减少数值'
}
/**
* 就地把 wrapper 里那两颗步进按钮的英文名字换成中文(只认精确等值,别的 aria-label 一律不碰),
* 并把**已具名宿主**内部的图形消音(2026-11-09 · 阶段 23 · S-2 收口)。
*
* 为什么要第二步:改名之后 AT 念的是「增加数值」,可 antd 给那颗按钮装的图形
* `<span role="img" aria-label="up" class="anticon anticon-up ant-input-number-handler-up-inner">`
* 在 AX 树里仍是**独立对象**(`rc-input-number/es/StepHandler.js:87`/`:97` 的 upNode),
* 读屏念完宿主再补一句英文「up」——`semanticcheck` 5c 实测 1440/430 各 34 颗
* (`reports/ui_evidence/nex-p23/predis/`,另有浮层里的 12 颗)。口径与图标登记表一致:
* **宿主具名 ⇒ 图形消音**(规范 §5.1.1 第 ⑤ 道闸)。
*
* 三条边界,防止这一刀把别的东西削掉:
* · 只在宿主 `aria-label` **非空**时消音——宿主自己没名字时,里面那颗图形可能是唯一
* 的名称来源,隐藏它就把控件念成「未命名」了(这一族在 wrapper 里今天不存在,
* 但判据不能依赖「今天不存在」);
* · `querySelectorAll` 只向下找后代 ⇒ 宿主自己就是 `role=img` 时不会被自己消音;
* · 只 `setAttribute`,不增删节点、不改类名 ⇒ 像素、鼠标按住连击、键盘步进全不动;
* 观察者盯的是 `attributeFilter:['aria-label']`,写 `aria-hidden` 不会自咬成回环。
* React 侧同样安全:这些 `aria-hidden` 不在 vDOM 属性里,React 更新时不会把它擦掉;
* handler 重挂载换上来的是全新节点,由 `childList` 那一路观察者重新补写。
*/
function renameStepHandlers(root: HTMLElement | null) {
if (!root || typeof root.querySelectorAll !== 'function') return
root.querySelectorAll<HTMLElement>('[aria-label]').forEach((el) => {
const label = el.getAttribute('aria-label') || ''
const next = STEP_LABEL_ZH[label]
if (next) el.setAttribute('aria-label', next)
if ((next ?? label).trim() === '') return
el.querySelectorAll<HTMLElement>('[role=img]').forEach((g) => g.setAttribute('aria-hidden', 'true'))
})
}
/** 产出一个可以直接放进 `<InputNumber ref>` 的回调:拿到 wrapper 节点就负责它的步进器名字 */
function useStepLabelRef() {
const box = useRef<{ el: HTMLElement | null; ob: MutationObserver | null }>({ el: null, ob: null })
useEffect(() => () => {
box.current.ob?.disconnect()
box.current = { el: null, ob: null }
}, [])
return (h: unknown) => {
const el = (h as { nativeElement?: HTMLElement } | null)?.nativeElement ?? null
if (!el || el === box.current.el) return
box.current.ob?.disconnect()
box.current.el = el
renameStepHandlers(el)
if (typeof MutationObserver !== 'undefined') {
box.current.ob = new MutationObserver(() => renameStepHandlers(el))
box.current.ob.observe(el, { subtree: true, childList: true, attributeFilter: ['aria-label'] })
}
}
}
/**
* 数值输入:antd 的数字框(步进按钮在框内,不再露出系统控件)。
*
@ -54,11 +136,14 @@ export const TextArea = forwardRef<HTMLTextAreaElement, React.ComponentProps<typ
* 两个都把外来的字符串数字折成 number(接口经常回 "5"),页面拿到的一定是自己要的形态。
*/
export const NumberInput = forwardRef<HTMLInputElement, NumProps<number>>(function NumberInput(
{ value, onChange, min, max, step, ...rest }, ref) {
{ value, onChange, min, max, step, id, ...rest }, ref) {
const stepRef = useStepLabelRef()
return (
<InputNumber
{...rest}
ref={(h) => passRef(ref, domInput(h))}
id={useFieldControlId(id)}
aria-valuetext={stepValueText(rest, value, min, max)}
ref={(h) => { stepRef(h); passRef(ref, domInput(h)) }}
value={toNum(value)}
min={numOrUndef(min)}
max={numOrUndef(max)}
@ -73,11 +158,14 @@ export const NumberInput = forwardRef<HTMLInputElement, NumProps<number>>(functi
/** 清空即 null:这一格留空=不改这个字段 */
export const MaybeNumberInput = forwardRef<HTMLInputElement, NumProps<number | null>>(
function MaybeNumberInput({ value, onChange, min, max, step, ...rest }, ref) {
function MaybeNumberInput({ value, onChange, min, max, step, id, ...rest }, ref) {
const stepRef = useStepLabelRef()
return (
<InputNumber
{...rest}
ref={(h) => passRef(ref, domInput(h))}
id={useFieldControlId(id)}
aria-valuetext={stepValueText(rest, value, min, max)}
ref={(h) => { stepRef(h); passRef(ref, domInput(h)) }}
value={toNum(value)}
min={numOrUndef(min)}
max={numOrUndef(max)}
@ -126,5 +214,35 @@ export const SearchInput = forwardRef<HTMLInputElement, React.ComponentProps<typ
enterButton={<Button icon={<IconSearch />} aria-label="搜索"
disabled={disabled} loading={loading} />}
{...props}
id={useFieldControlId(props.id)}
ref={(h) => passRef(ref, domInput(h))} />
})
/**
* 区间数值框的朗读文本(2026-11-10 · 阶段 35 · T-1 / T1-N1)。
*
* 症状(阶段 9 · Safari + VoiceOver 实测,登记在 `docs/NEX-对照与例外.md` §6 T1-N1):
* 同时带 `min` 与 `max` 的 `spinbutton`,Safari 把「当前值」折算成**区间百分比**播报——
* 优先级 5/9 念成「55.6 %」、音量 (32−1)/255 念成「12.2 %」。
* 页面上写的是 5,读屏耳朵里是一个页面上根本不存在、也没人算过的数。
* 做法:只有 `min` 与 `max` **同时存在**时才补 `aria-valuetext`,内容=输入框里显示的那个数
* (所见即所念);调用点自己写了 `aria-valuetext` 时听它的。
* 没有上下限的数值框浏览器不做折算(读到的本来就是数字),一条 `aria-valuetext` 都不加,
* 免得给本来正确的读数再套一层可能过期的文本。
* 影响面:`role`、`aria-valuemin/max/now`、类名、像素、步进手感、键盘行为一字不动,
* 只多一个属性;带上下限的数值框在 kit 一处收口,页面 0 改动。
*/
function stepValueText(
rest: Record<string, any>, value: unknown, min?: number | string, max?: number | string,
): string | undefined {
const given = rest['aria-valuetext']
if (given !== undefined) return given
// min / max 在组件签名里就被解构走了,rest 里根本没有这两项
// —— 活体尺子 valuetext.py 抓到过只查 rest 的那一版一条都没补上(空转)。
if (numOrUndef(min) === undefined || numOrUndef(max) === undefined) return undefined
const n = toNum(value)
return n === null ? undefined : String(n)
}
/* 打上「可被宿主 Field 命名」的标记:只有这些 kit 件,`Field` 才敢写 `htmlFor`(见 fieldId.ts) */
;[Input, TextArea, NumberInput, MaybeNumberInput, SearchInput].forEach((c) => markFieldControl(c))

View File

@ -73,7 +73,7 @@ function useNames() {
const DRAWER_WIDE = 'min(1360px, calc(100vw - 20px))'
export function Drawer({ open, onClose, title, sub, children, actions, width, closeOnBackdrop = true, label, loading,
placement = 'right', flushBody }: {
placement = 'right', flushBody, destroyOnHidden }: {
open: boolean
onClose: () => void
title: ReactNode
@ -107,6 +107,18 @@ export function Drawer({ open, onClose, title, sub, children, actions, width, cl
* 层外的永远压层内(同 §1.1.1 那条 `.nex-tag` 实测),页面写了是空转。
*/
flushBody?: boolean
/**
* 收起即卸载(阶段 11 · 第 9 闸 FOCUS 实测):默认 false = antd 收起后把整棵抽屉
* 留在 DOM 里,其中 rc-drawer 的两颗焦点哨兵
* `<div tabindex="0" aria-hidden="true" data-sentinel="start|end">`(0×0、无描边)
* 挂在 `.ant-drawer` 根节点下、**不受收起影响**(rc-drawer/lib/DrawerPopup.js:258-270
* 无条件渲染),于是抽屉开过一次之后正文末尾多出两个隐形 Tab 站:
* 1440/dark /projects/10/overview 实测走到哨兵后 Shift+Tab 与 Tab 都停在哨兵上出不去。
* 只在「正文没有需要跨开合保留的表单实例」的抽屉上打开——概况抽屉的正文是只读回显
* + 底部动作条,卸载代价为零;表单抽屉(人物/场景/声线/模型编辑)不打开,
* 它们的 `useForm()` 实例在「先 setFieldsValue 后 open」的写法下会丢值。
*/
destroyOnHidden?: boolean
}) {
const { titleId, subId } = useNames()
return (
@ -122,6 +134,7 @@ export function Drawer({ open, onClose, title, sub, children, actions, width, cl
closable={false}
maskClosable={closeOnBackdrop}
push={false}
destroyOnHidden={destroyOnHidden}
/*
* 症状(资产库编辑抽屉截图左侧那条「菜单压在抽屉上面」):这里原本写
* `getContainer={false}` + `rootStyle={{position:'fixed'}}`,抽屉被**就地**

View File

@ -88,6 +88,14 @@ export const TILE_HINT = 'flex-none px-3 py-1 rounded-full border border-border
+ 'transition-[border-color,background,color] duration-150 group-hover:border-primary-border group-hover:text-primary '
+ 'group-[[aria-expanded=true]]:border-primary group-[[aria-expanded=true]]:bg-primary group-[[aria-expanded=true]]:text-on-primary'
/**
* 卡片摘要行:三行封顶 + 固定最小高,让同排两卡的标签行与素材条落在同一高度。
*
* 登记在 Tile 而不是留在页面里(2026-11-11 · 用户第 1 条):平台资产库先写了这一串,
* 项目资产管理要与之对齐时若各抄一遍,就成了两把同名不同长的尺子。
*/
export const TILE_SUMMARY = 'line-clamp-3 min-h-[46px] text-xs leading-normal text-text-tertiary'
/**
* 折叠行:外框(状态色)+ 整行热区 + 展开体。
*

View File

@ -0,0 +1,66 @@
/**
* 字段 ↔ 控件的**名字通道**(2026-11-10 · 阶段 35 · T-1 / T1-N6)。
*
* 症状:`Field` / `FieldBlock` 的 `<label>` 到不了辅助技术——它坐在 antd `Form.Item` 里,
* 而 `Form.Item` 只有拿到 `name`(走 antd 的字段 id)或显式 `htmlFor` 才会给 `<label>`
* 写 `for`。本项目的 `Field` 一律不吃 `name`(值是页面自己管的受控 props),
* 于是 `for` 永远缺失:读屏念到的是「编辑框 / 组合框 / 数值调节器」,
* 字段名只剩 placeholder 在兜底;没写 placeholder 的字段直接没有名字。
* 全站普查(`reports/ui_evidence/nex-p35/vo/fieldnames.py`,判据=Chromium 无障碍树):
* **有名字 107 / 无名字 20**(时间线 14 颗数字框、交付 3、总览 2、审核 1)。
*
* 做法:`Field` 用 `useId()` 生成一个 id,只有当**直接子元素就是 kit 里那批控件**时
* 才把它交给 `Form.Item` 的 `htmlFor`,并用 Provider 把同一个 id 递给那颗控件;
* 控件侧 `useFieldControlId(props.id)` 自己决定落到哪个 DOM 节点
* (自带 `id` 优先,`Field` 那边的 `for` 也同步指向它)。
* 为什么必须「认件」而不是无条件写 `for`:`for` 指向一个不存在的 id 时,
* label 就成了悬空引用,读屏听到的名字没多,反而多了一条假线索;
* 一个 Field 里塞两颗控件(同行两个输入、控件 + 旁边一颗按钮)时也无法判断
* 该命名谁,所以 `claim` 保证同一轮渲染只有第一颗认领得到,认领不到就不写 id。
* 为什么不做「深传递」:往下穿到任意一层会把不该有名字的图形件(比如字段里的
* 单位后缀输入、行内两颗步进器)也染上 id,同一轮撞出两个相同 id。
*
* 单独成文件的原因:`Fields.tsx` 与 `Input.tsx` / `forms/*.tsx` 互相都要用这套机制,
* 放在任何一边都会形成 import 环(`Fields → Button → …`、`forms/Select → ui/fieldId`)。
*/
import { createContext, isValidElement, useContext, useId, type ReactElement, type ReactNode } from 'react'
/** Field 交给这一轮渲染的一次性作用域:`claim` 由第一个认领的控件置位 */
export type FieldIdScope = { id: string; claim: { taken: boolean } }
const FieldIdContext = createContext<FieldIdScope | null>(null)
/** React 的 `:r5:` 直接当 id 用会在 CSS / `querySelector('#…')` 里翻车,折成安全字符 */
export function useNexFieldId(): string {
return `nf${useId().replace(/[^a-zA-Z0-9_-]/g, '')}`
}
/**
* 控件侧:把 `Field` 生成的 id 落到真正可聚焦的那个元素上。
* 自带 `id` 时原样返回(调用点的显式 id 永远优先),没有宿主 `Field` 时返回 undefined,
* DOM 上不写 id——与改造前逐字相同。
*/
export function useFieldControlId(explicit?: string): string | undefined {
const scope = useContext(FieldIdContext)
if (explicit) return explicit
if (!scope || scope.claim.taken) return undefined
scope.claim.taken = true
return scope.id
}
const MARK = '__nexFieldControl'
/** 给 kit 控件打标记:只有打了标记的件,`Field` 才敢给它写 `htmlFor` */
export function markFieldControl<C>(Cmp: C): C {
(Cmp as { [k: string]: unknown })[MARK] = true
return Cmp
}
/** `Field` 用:children 是不是「单独一颗 kit 控件」,是则返回它 */
export function fieldControlChild(children: ReactNode): ReactElement | null {
if (!isValidElement(children)) return null
const type = children.type as unknown as { [k: string]: unknown } | null
return type?.[MARK] ? children : null
}
export { FieldIdContext }

View File

@ -13,7 +13,8 @@ import { useAutoRefresh } from '../hooks/use-auto-refresh'
import { SecretInput } from '../components/forms'
import { Actions, Button, CardRow, Empty, ErrorText, Field, FormGrid, FormRow, Info, Input, Mono, Layout, Notice, PageHead, PageStack, Panel, PanelHead, Stack, Tag } from '../components/ui'
import { login, roleLabel, setUser, useAuthStore } from '../stores/auth'
import { IconCheck, IconKey, IconLogout, IconUser } from '../components/icons'
import { IconCheck, IconLogout, IconUser } from '../components/icons'
import { IconKey } from '../components/icons/extra'
const RULES_HINT = '至少 8 位,字母 / 数字 / 符号至少两种'

View File

@ -44,8 +44,9 @@ import { useRecordingBusy } from '../stores/recording'
import { confirmAction } from '../stores/confirm'
import { notify } from '../stores/notice'
import { ownerKey, track, useActivityStore } from '../stores/activity'
import { ActionGroup, BarRight, Between, Block, Button, CardActions, Check, Checkbox, Chip, ChipBar, Ctlbar, Drawer, Empty, ErrorText, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Input, LINK_CLS, MONO, MUTED, MUTED_MONO, Modal, Notice, NumberInput, PageHead, Pager, PageStack, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, Value, ViewSwitch } from '../components/ui'
import { IconAdd, IconBlocks, IconBolt, IconCaution, IconCheck, IconClose, IconCopy, IconDelete, IconEdit, IconGrid, IconImage, IconLibrary, IconList, IconRobot, IconSound, IconTag, IconUpload, IconUser, IconVoice } from '../components/icons'
import { ActionGroup, BarRight, Between, Block, Button, CardActions, Check, Checkbox, Chip, ChipBar, Ctlbar, Drawer, Empty, ErrorText, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Input, LINK_CLS, MONO, MUTED, MUTED_MONO, Modal, Notice, NumberInput, PageHead, Pager, PageStack, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, TILE_SUMMARY, Value, ViewSwitch } from '../components/ui'
import { IconAdd, IconBolt, IconCaution, IconCheck, IconClose, IconCopy, IconDelete, IconGrid, IconImage, IconLibrary, IconSound, IconUser } from '../components/icons'
import { IconBlocks, IconEdit, IconList, IconRobot, IconTag, IconUpload, IconVoice } from '../components/icons/extra'
type AssetType = 'human' | 'scene' | 'voice'
type ViewMode = 'grid' | 'list' | 'media'
@ -1140,11 +1141,6 @@ export default function AssetLibrary() {
: patchFilters({ sort: String(next) }))}
options={view === 'media' ? WALL_SORTS : sortOptions} />
</Field>
{view !== 'media' && (
<Check checked={filters.duplicate_only} onChange={(next) => patchFilters({ duplicate_only: next })}>
仅疑似重复
</Check>
)}
{/* 自动刷新的倒计时/手动按钮由 useAutoRefresh 与它自己的展示组件负责,
这里只补一句「正在忙什么」,避免同一行出现两个刷新入口。 */}
<BarRight>{busy && <span className={cn(MUTED, 'text-xs')}><Spinner /> {busy}…</span>}</BarRight>
@ -1275,7 +1271,6 @@ export default function AssetLibrary() {
/* 同上:名称自给,见素材墙那颗的说明 */
aria-label={`选择母版 ${row.name}`}
onClick={(e) => { e.stopPropagation(); toggleSelect(row, idx, e.shiftKey) }} />
<Portrait name={row.name} sm />
<div className="min-w-0">
<div className="flex items-center gap-1 flex-wrap">
<b className="text-xs">{row.name}</b>
@ -1320,23 +1315,35 @@ export default function AssetLibrary() {
))}
{!row.assets?.length && <span className={cn(MUTED, 'text-xs')}>暂无素材</span>}
</div>
{/* 和网格卡底同构的三段:AI 生成自己一段(下面那条横线是分界线),
「我动手」的上传 + 引入一段,母版本身的编辑 + 删除一段。
编辑和删除两颗同形状同尺寸,不再一颗实心一颗 text danger。 */}
<div className="flex w-[168px] flex-none flex-col items-stretch gap-1.5">
<Button type="primary" block loading={!!generatingOf(row)}
{/* 这一列的三段一个都没增减,只把「母版本身的编辑 / 删除」从**行尾**提到**行首**,
并升成主操作档(2026-11-11 · 用户「平台资产卡片的主功能按钮样式没有和模型管理
卡片的主功能按钮一致」)。此前它在这里是两颗 24 无描边焦点的裸图标按钮,
而在网格卡与模型卡上同两个动作是「右上角 primary 实底 + 图标 + 文字」——
同一个母版换个视图就换一套档位与皮肤,读者的「哪颗是主按钮」要重新猜。
现在三处逐像素同构(sm 24 / 圆角 6 / 图标 + 文字 / 主操作在左、破坏性在右):
列表这一行 · 网格卡卡角 · 模型卡「配置 / 删除」——口径见 docs/UI规范.md §5.1.2.1。
行高不变:三段还是三行,只是把卡角那一对排到第一行(= 这一行的右上角)。
列宽 176 不变(图标 + 两个汉字要 82px,168 里 flex-1 分完只剩 81,
文字会被挤没;按 4px 栅格抬到 176 = 44×4)。
2026-11-11 追加(用户「所有卡片的主功能按钮统一成小尺寸,只是主按钮有底色」):
这一整列的动作全部收 sm(24 高),实底只留「编辑」一颗 ——
「删除」退 danger 描边红字,「AI 生成 / 上传 / 引入」退无底色。 */}
<div className="flex w-[176px] flex-none flex-col items-stretch gap-1.5">
<div className="flex gap-1.5 [&>*]:flex-1">
<Button size="sm" type="primary" icon={<IconEdit />} title="编辑这个母版"
onClick={() => openEdit(row)}>编辑</Button>
<Button size="sm" danger icon={<IconDelete />} title="删除这个资源"
onClick={() => setConfirmDelete(row)}>删除</Button>
</div>
<Button size="sm" block loading={!!generatingOf(row)}
onClick={() => openGenerate(row)} icon={<IconBolt />}
title={generatingOf(row) ? '这条母版有一次生成正在排队,进度见顶栏「平台动态」' : undefined}>
{isVoice ? '生成试听' : 'AI 生成'}
</Button>
<div className="flex gap-1.5 border-t border-fill-secondary pt-1.5 [&>*]:flex-1">
<FilePick icon=<IconUpload /> label="上传" title="选完即作为新版本登记到这个母版下"
<FilePick size="sm" icon=<IconUpload /> label="上传" title="选完即作为新版本登记到这个母版下"
onFiles={(files) => files.forEach((file) => void uploadFile(row, file, uploadKindFor(row)))} />
<Button icon={<IconLibrary />} onClick={() => openImportSelection(row)} title="把这个母版引入项目">引入</Button>
</div>
<div className="flex gap-1.5 [&>*]:flex-1">
<Button icon={<IconEdit />} title="编辑这个母版" onClick={() => openEdit(row)} aria-label="编辑这个母版" />
<Button icon={<IconDelete />} title="删除这个资源" onClick={() => setConfirmDelete(row)} aria-label="删除这个资源" />
<Button size="sm" icon={<IconLibrary />} onClick={() => openImportSelection(row)} title="把这个母版引入项目">引入</Button>
</div>
</div>
</Tile>
@ -1362,7 +1369,6 @@ export default function AssetLibrary() {
onClick={(e) => { e.stopPropagation(); toggleSelect(row, idx, e.shiftKey) }} />
</MediaPick>
<div className="flex items-start gap-2.5 pl-[22px] min-w-0">
<Portrait name={row.name} />
<div className="grow min-w-0">
<div className="flex items-center gap-1 flex-wrap">
<b className="truncate text-sm">{row.name}</b>
@ -1379,6 +1385,20 @@ export default function AssetLibrary() {
</div>
<div className={MUTED_MONO}>{row.code || `${type}-${row.id}`}</div>
</div>
{/* 编辑 / 删除挪到卡片右上角(2026-11-11 · 用户第 2 条),并统一成
带重点色的主按钮档(用户续条「参照模型管理的配置按钮,带重点色」):
「编辑」primary 实底,「删除」同一档位只换 danger 语义色;
图标 + 文字成对,卡底不再挂这两颗。
档位显式写 sm:与模型卡右上角那对(配置 / 删除)逐像素同构
(24 高 / 圆角 6),不靠「这张卡恰好没套 Dense」维持
(2026-11-11 用户「所有卡片的主功能按钮统一成小尺寸」,
连同「删除」的实底一起退档 —— 一张卡只留一颗带底色的主按钮)。 */}
<div className="flex flex-none items-center gap-1.5">
<Button size="sm" type="primary" icon={<IconEdit />} title="编辑这个母版"
onClick={() => openEdit(row)}>编辑</Button>
<Button size="sm" danger icon={<IconDelete />} title="删除这个资源"
onClick={() => setConfirmDelete(row)}>删除</Button>
</div>
</div>
<p className={SUMMARY}>
@ -1454,18 +1474,17 @@ export default function AssetLibrary() {
</div>
)}
{/* 一条横轨,三段:AI 生成 │ 类型 + 上传 + 引入 …………… 编辑 删除。
{/* 一条横轨,两段:AI 生成 │ 类型 + 上传 + 引入。
为什么这么分(用户原话「类型和上传、引入是配对的,但 AI 生成是单独的
逻辑」):中间那段都是「我自己动手」—— 选类型 → 上传是同一个动作的两半,
引入是把这张卡搬进项目;AI 生成则是「让模型跑一张」,走排队任务,
结果什么时候回来不由这张卡决定,所以隔在分界线左边,不跟它们缝在一起。
分界线画在中轨左缘:它贴着被分开的那组动作,长度等于这组动作的高度。
右端铅笔 + 垃圾桶是这张卡本身的编辑 / 删除,两颗同形状同尺寸
(用户原话「删除要和编辑在一起,并且同样的设计」),用 BarRight 靠右,
不再挂在卡头。卡底右侧的「v1 · 更新于…」删了:标签行里本来就有一枚。
编辑 / 删除已上移到卡片右上角(2026-11-11 · 用户第 2 条),
卡底右侧的「v1 · 更新于…」删了:标签行里本来就有一枚。
窄到装不下时整组一起挪行(ActionGroup 的自动档),不是谁先掉谁掉。 */}
<div className="mt-auto flex flex-wrap items-center gap-x-3 gap-y-2 border-t border-fill-secondary pt-3">
<Button type="primary" className="flex-none" loading={!!generating}
<Button size="sm" className="flex-none" loading={!!generating}
onClick={() => openGenerate(row)} icon={<IconBolt />}
title={generating ? '这条母版有一次生成正在排队,进度见顶栏「平台动态」' : undefined}>
{isVoice ? '生成试听' : 'AI 生成'}
@ -1488,10 +1507,6 @@ export default function AssetLibrary() {
)}
<Button icon={<IconLibrary />} onClick={() => openImportSelection(row)} title="把这个母版引入项目">引入</Button>
</ActionGroup>
<BarRight>
<Button icon={<IconEdit />} title="编辑这个母版" onClick={() => openEdit(row)} aria-label="编辑这个母版" />
<Button icon={<IconDelete />} title="删除这个资源" onClick={() => setConfirmDelete(row)} aria-label="删除这个资源" />
</BarRight>
</CardActions>
</div>
</Tile>
@ -1981,17 +1996,6 @@ export default function AssetLibrary() {
「只有资产库会跟着改」的公共 API。皮肤写成模块级常量,JSX 里只剩结构。
跨页复用的(Panel / Field / Grid / Tag …)一律走 components/ui。 */
/** 头像占位:没有定妆图时至少留一个「这里站着谁」的形体(圆角下宽上窄=肩线) */
function Portrait({ name, sm }: { name?: string; sm?: boolean }) {
return (
<span className={cn('grid place-items-center flex-none border border-primary-border bg-primary-bg text-primary',
sm ? 'w-[30px] h-8 text-base rounded-t-lg rounded-b-lg'
: 'w-[38px] h-[42px] text-xl rounded-t-lg rounded-b-lg')}>
{name?.slice(0, 1)}
</span>
)
}
/** 引用状态:删除母版前最需要知道的一件事就是「有没有项目在用」 */
function ScopeTag({ row }: { row: any }) {
return row.usage_count
@ -2027,7 +2031,8 @@ function MediaTile({ media, size = 'sm', radius, width, queue, index, onRemove }
const FILE_TILE = 'flex flex-col justify-between p-2 rounded-md bg-fill-tertiary '
+ '[&>b]:text-text-secondary [&>b]:text-xs [&>span]:text-text-quaternary [&>span]:text-xs'
const SUMMARY = 'line-clamp-3 min-h-[46px] text-xs leading-normal text-text-tertiary'
/* 卡片摘要行的尺子已上收到 Tile(TILE_SUMMARY):两页共用一把,不再各写一遍 */
const SUMMARY = TILE_SUMMARY
/** 场景卡的「光线 / 时段 / 色板」:散文级的光线单独成枚,短字段各成一枚 */
const sceneMeta = (row: any) => [['光线', row.lighting], ['时段', row.time_of_day], ['色板', row.palette]]

View File

@ -1,25 +1,23 @@
/**
* 项目总览(流程第 ① 步的家)
*
* 这一页承担三件事:新建项目(含直接从资源库带母版)、看所有项目的进度、
* 看全局动态。进度和动态都是 20 秒自刷的只读视图——平台在后台跑,
* 这一页承担两件事:新建项目(含直接从资源库带母版)、看所有项目的进度。
* 进度是 20 秒自刷的只读视图——平台在后台跑,
* 页面不该要求用户点「刷新」才知道镜头跑完了没有。
* 要看某个项目的节点明细,点它的名字直接进「流程概览」;页内不再挂
* 「流程节点 / 全局动态」两块预览面板(2026-11-11 · 用户:主页面只要项目列表)。
*/
import { useEffect, useMemo, useRef, useState, type FormEvent } from 'react'
import { Link, useNavigate } from 'react-router-dom'
import { cn } from '../lib/cn'
import * as api from '../api/client'
import {
EVENT_LEVELS, eventLabel, eventLevelKey, fmtAgo, fmtMoney, fmtTime, opt, pct, statusLabel
} from '../lib/format'
import { fmtMoney, opt, pct, statusLabel } from '../lib/format'
import { fromAsset, isAudio, isImage } from '../lib/media'
import { stageNote } from '../lib/pipeline'
import { useAutoRefresh } from '../hooks'
import { Select } from '../components/forms'
import { MediaThumb } from '../components/media/MediaThumb'
import { WorkflowBar } from '../components/media/WorkflowBar'
import { Actions, Block, Button, Chip, ChipBar, Ctlbar, Empty, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, Input, LINK_CLS, SearchInput, LinkButton, LogBox, LogRow, MONO, MUTED, NumberInput, PageHead, Panel, PanelHead, ProgressBar, Row, SectionTitle, Stat, StatGrid, Status, PageStack, SkeletonBlock, Tile, Table, Tag, TagChip, TagGroup, TextArea, Value, Clamp } from '../components/ui'
import { Actions, Block, Button, Chip, Ctlbar, Empty, ErrorText, Field, FieldBlock, FormGrid, FormRow, Input, LINK_CLS, SearchInput, LinkButton, MONO, MUTED, NumberInput, PageHead, Panel, PanelHead, ProgressBar, Row, Stat, StatGrid, Status, PageStack, SkeletonBlock, Tile, Table, Tag, TagChip, TagGroup, TextArea, Value, Clamp } from '../components/ui'
import {
capabilityHint, capsOf, defaultFor, deliveryResolutions, fpsChoices, isMock, loadModels,
@ -79,15 +77,11 @@ export default function Dashboard() {
useRegistry((s) => s.rows)
const [projects, setProjects] = useState<any[]>([])
const [events, setEvents] = useState<any[]>([])
const [loading, setLoading] = useState(true)
const [error, setError] = useState('')
const [keyword, setKeyword] = useState('')
const [statusFilter, setStatusFilter] = useState('')
const [creating, setCreating] = useState(false)
/** 全局动态过滤(DB-4):级别 + 关键字,只看异常时不必在 40 条流水里翻 */
const [eventLevel, setEventLevel] = useState('')
const [eventKeyword, setEventKeyword] = useState('')
const [form, setFormState] = useState<NewProjectForm>(EMPTY_FORM)
const setForm = (patch: Partial<NewProjectForm>) => setFormState((cur) => ({ ...cur, ...patch }))
@ -164,23 +158,6 @@ export default function Dashboard() {
})
}, [projects, keyword, statusFilter])
const shownEvents = useMemo(() => {
const needle = eventKeyword.trim().toLowerCase()
return events.filter((e: any) => {
if (eventLevel && eventLevelKey(e.level) !== eventLevel) return false
if (!needle) return true
return `${e.message || ''} ${e.action || ''} ${eventLabel(e.action)}`.toLowerCase().includes(needle)
})
}, [events, eventLevel, eventKeyword])
const levelCounts = useMemo(() => {
const counts: Record<string, number> = {}
for (const e of events) {
const key = eventLevelKey(e.level)
counts[key] = (counts[key] || 0) + 1
}
return counts
}, [events])
const totals = {
all: projects.length,
active: projects.filter((p) => ACTIVE_STATUSES.includes(p.status)).length,
@ -259,12 +236,8 @@ export default function Dashboard() {
setError('')
loadModels()
try {
const [list, evs] = await Promise.all([
api.get('/api/projects', { status: statusFilter, q: keyword }),
api.get('/api/events', { limit: 40 })
])
const list = await api.get('/api/projects', { status: statusFilter, q: keyword })
setProjects(list.projects || [])
setEvents(evs.events || [])
} catch (exc: any) {
setError(exc.message)
} finally {
@ -334,7 +307,7 @@ export default function Dashboard() {
<PageHead title="项目总览" className="mb-0"
actions={<Button type="primary" onClick={() => setCreating((v) => !v)}
icon={creating ? <IconChevronUp /> : <IconAdd />}>
{creating ? '收起' : '新建长视频项目'}
{creating ? '收起' : '新建项目'}
</Button>} />
<ErrorText>{error}</ErrorText>
@ -342,7 +315,7 @@ export default function Dashboard() {
{creating && (
<form onSubmit={submit} className="min-w-0">
{/* 标题写进卡头:表单正文里再顶一个大标题=同一个标题出现两次 */}
<Panel title="新建长视频项目" sub="流程第 ① 步:创建视频项目">
<Panel title="新建项目" sub="流程第 ① 步:创建视频项目">
<FormGrid>
<FormRow>
<Field label="项目名称" required>
@ -462,7 +435,7 @@ export default function Dashboard() {
{/* 首屏(列表还没到过)给表格形状的骨架;筛选出来的「没有匹配」是空态,不是骨架 */}
{loading ? <SkeletonBlock rows={8} title={false} label="正在读取项目" />
: !filtered.length ? <Empty>还没有项目。点击右上角「新建长视频项目」开始。</Empty>
: !filtered.length ? <Empty>还没有项目。点击右上角「新建项目」开始。</Empty>
: (
<>
{/* 卡片 / 表格的分界从 sm(576) 抬到 lg(992)(NEX 阶段 8.5 · 六表收口之①):
@ -530,60 +503,14 @@ export default function Dashboard() {
{/* 窄屏换成卡片:940px 的表在手机上只能横向拖,进度和成本永远看不见 */}
<div className="hidden min-w-0 gap-2 max-lg:grid">
{filtered.map((p) => <ProjectCard key={`card-${p.id}`} p={p} onRemove={removeProject} />)}
{filtered.map((p) => (
<ProjectCard key={p.id} p={p} onRemove={removeProject} />
))}
</div>
</>
)}
</Panel>
<Grid cols={2} gap={16} oneAt="xl">
<Panel>
<PanelHead title={
<span title="平台按 12 个节点推进:创建项目 → 导入分镜 → 绑定资产 → 生成任务清单 → 检查素材 → 队列调度 → 调用模型 → 保存产物 → 质量检查 → 人工审核 → 时间线合成 → 导出成片。被驳回的镜头会回到「修改提示词 → 重新生成」。">
流程节点
</span>
} />
<SectionTitle className="mt-0">示例项目流程
<Value>{filtered[0]?.name || '暂无项目'}</Value>
</SectionTitle>
{filtered[0]?.workflow
? <WorkflowBar workflow={filtered[0].workflow} compact />
: <Empty className="py-4 text-xs">创建项目后可在这里看到实时节点进度。</Empty>}
</Panel>
<Panel>
<PanelHead title="全局动态" />
<ChipBar>
{EVENT_LEVELS.map((lv) => (
<Chip key={lv.value || 'all'} active={eventLevel === lv.value} onClick={() => setEventLevel(lv.value)}>
{lv.label}
{lv.value && levelCounts[lv.value]
? <em className="text-primary not-italic"> {levelCounts[lv.value]}</em> : null}
</Chip>
))}
<Field inline label="搜索" width="grow" className="max-w-[280px]">
<SearchInput value={eventKeyword} aria-label="搜索事件" placeholder="事件内容 / 动作" onChange={(e) => setEventKeyword(e.target.value)} />
</Field>
</ChipBar>
<LogBox>
{shownEvents.map((e: any) => (
<LogRow key={e.id} level={eventLevelKey(e.level)}
time={<span title={fmtTime(e.created_at)}>{fmtAgo(e.created_at)}</span>}
who={<span className={MONO} title={e.action}>{eventLabel(e.action)}</span>}>
{e.message}
{e.project_id ? <span className={MUTED}> · 项目#{e.project_id}</span> : null}
</LogRow>
))}
{!events.length && <div className={cn(MUTED, 'py-2 px-0.5')}>暂无事件</div>}
{!!events.length && !shownEvents.length && (
<div className={cn(MUTED, 'flex flex-wrap items-center gap-2 py-2 px-0.5')}>
当前筛选条件下没有事件。
<Button icon={<IconClose />} onClick={() => { setEventLevel(''); setEventKeyword('') }}>清除筛选</Button>
</div>
)}
</LogBox>
</Panel>
</Grid>
</PageStack>
)
}
@ -722,9 +649,12 @@ function ProjectCard({ p, onRemove }: { p: any; onRemove: (p: any) => void }) {
</div>
<ProgressBar className="w-full" value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
<div className="mt-3 flex min-w-0 flex-wrap items-center gap-3 ">
<LinkButton type="primary" to={`/projects/${p.id}/overview`} icon={<IconFolder />}>进入项目</LinkButton>
<Button type="text" danger title="删除这个项目" onClick={() => onRemove(p)} icon={<IconDelete />} aria-label="删除这个项目" />
{/* 卡底动作一律 sm(24):这张卡的重点色只给「进入项目」那颗主按钮,
删除是图标 + danger 文字档,不抢底色(§5.1.2.1 v2 · 2026-11-11 用户
「所有卡片的主功能按钮统一成小尺寸,只是主按钮有底色」)。 */}
<div className="mt-3 flex min-w-0 flex-wrap items-center gap-1.5">
<LinkButton size="sm" type="primary" to={`/projects/${p.id}/overview`} icon={<IconFolder />}>进入项目</LinkButton>
<Button size="sm" type="text" danger title="删除这个项目" onClick={() => onRemove(p)} icon={<IconDelete />} aria-label="删除这个项目" />
</div>
</Tile>
)

View File

@ -20,7 +20,8 @@ import {
Block, Chip, ChipBar, Code, CodeBlock, Divider, ExtLink, Grid, Heading, LinkButton,
Notice, PageHead, Panel, Paragraph, Table, Tag, TagGroup, Value, type Columns, cellWrap
} from '../components/ui'
import { IconApi, IconBolt, IconDashboard, IconImage, IconPlayCircle, IconVoice } from '../components/icons'
import { IconApi, IconBolt, IconDashboard, IconImage, IconPlayCircle } from '../components/icons'
import { IconVoice } from '../components/icons/extra'
/** 正文皮肤:只在手册根上贴一次(行内加粗、链接里的代码色),段落不再各带一套 */
const SHELL = 'min-w-0 [&_b]:font-semibold [&_b]:text-text [&_a_code]:text-primary'
/** 章节:锚点要躲开常驻顶栏(kit 的 HEADER_HEIGHT=56),滚动定位留两档余量 */
@ -228,7 +229,7 @@ export default function Help() {
从项目总览创建或打开项目,按左侧业务模块依次推进。
</DocCard>
</Grid>
<Notice type="info"><b>界面导航:</b>顶部应用栏左侧是平台标识;正中间是<b>流程进度控制台</b>——项目名、项目状态、 12 个业务节点轨道(按完成 / 进行中 / 需处理 / 待处理着色;进行中的那一段更高、带光晕并与需处理一起呼吸闪烁, 扫一眼就知道卡在哪一段)、 流程进度(已完成节点 ÷ 全部节点)与当前节点,点一下控制台就回到流程概览;12 个节点全部走完时这里改说 <b>「全部 12 个节点已完成」</b>,不会在「已交付」旁边再挂一个假的当前节点。这条口径由 <Code>frontend/src/lib/pipeline.ts</Code> 统一定义,侧栏项目副标题、项目页头标签、流程进度条 (含总览右侧的示例流程)、项目设置面板的状态标签(流程推进中 / <b>流程已完成</b> / 已归档)、 「下一步建议」抬头、项目总览表格与卡片的<b>「流程节点」列</b>、资产库「引入项目」下拉的副标题 全部复用它,任何一处都不会各说各话。右侧固定放使用手册、显示模式(深色 / 浅色, <Code>⌘/Ctrl+Shift+L</Code> 随时切换)和账号胶囊;点开账号胶囊即是二级菜单——我的账号、用户管理、退出登录都在这里。 接口文档不再占用顶栏入口,需要时直接访问 <a href="/docs" target="_blank" rel="noreferrer" className={LINK}><Code>/docs</Code></a>。 左侧栏只保留模块导航:全局三个模块 + 当前项目的七个业务节点。页面底部不再常驻系统信息。</Notice>
<Notice type="info"><b>界面导航:</b>顶部应用栏左侧是平台标识;正中间是<b>流程进度控制台</b>——项目名、项目状态、 12 个业务节点轨道(按完成 / 进行中 / 需处理 / 待处理着色;进行中的那一段更高、带光晕并与需处理一起呼吸闪烁, 扫一眼就知道卡在哪一段)、 流程进度(已完成节点 ÷ 全部节点)与当前节点,点一下控制台就回到流程概览;12 个节点全部走完时这里改说 <b>「全部 12 个节点已完成」</b>,不会在「已交付」旁边再挂一个假的当前节点。这条口径由 <Code>frontend/src/lib/pipeline.ts</Code> 统一定义,侧栏项目副标题、项目页头标签、流程进度条 (含总览右侧那块可悬停列表切换的流程)、项目设置面板的状态标签(流程推进中 / <b>流程已完成</b> / 已归档)、 「下一步建议」抬头、项目总览表格与卡片的<b>「流程节点」列</b>、资产库「引入项目」下拉的副标题 全部复用它,任何一处都不会各说各话。右侧固定放使用手册、显示模式(深色 / 浅色, <Code>⌘/Ctrl+Shift+L</Code> 随时切换)和账号胶囊;点开账号胶囊即是二级菜单——我的账号、用户管理、退出登录都在这里。 接口文档不再占用顶栏入口,需要时直接访问 <a href="/docs" target="_blank" rel="noreferrer" className={LINK}><Code>/docs</Code></a>。 左侧栏只保留模块导航:全局三个模块 + 当前项目的七个业务节点。页面底部不再常驻系统信息。</Notice>
<Panel className="mt-4 overflow-hidden" pad={false}>
<figure className="m-0 min-w-0">
<a href="/help/overview.png" target="_blank" rel="noreferrer" aria-label="查看项目总览页截图" className="block">

View File

@ -20,7 +20,8 @@ import {
import { login, useAuthStore } from '../stores/auth'
import { setTheme, useAppliedTheme } from '../stores/theme'
import { readLocal, writeLocal } from '../hooks/use-local-storage'
import { IconMoon, IconShield, IconStoryboard, IconSun, IconUser, IconVideo, IconVoice } from '../components/icons'
import { IconMoon, IconShield, IconStoryboard, IconSun, IconUser, IconVideo } from '../components/icons'
import { IconVoice } from '../components/icons/extra'
/** 记住我:账号 + 口令一起记,也一起清;存的是本机明文口令,共用电脑不该勾,所以默认不勾 */
const REMEMBER_KEY = 'nex-login'

View File

@ -23,7 +23,8 @@ import { useAuthStore } from '../stores/auth'
import { useProjectStore } from '../stores/project'
import { confirmAction } from '../stores/confirm'
import { notify } from '../stores/notice'
import { IconAdd, IconApi, IconBolt, IconChart, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconGrid, IconImage, IconNodeIndex, IconParams, IconPlayCircle, IconReload, IconShield, IconStar, IconVoice, IconWarn } from '../components/icons'
import { IconAdd, IconApi, IconBolt, IconChart, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconGrid, IconImage, IconPlayCircle, IconReload, IconShield, IconStar, IconWarn } from '../components/icons'
import { IconNodeIndex, IconParams, IconVoice } from '../components/icons/extra'
/** /api/providers 还没回来(或后端挂了这个接口)时左栏仍要能渲染 */
const FALLBACK_TYPES = ['llm', 'video', 'image', 'tts']
@ -982,7 +983,23 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
</div>
<div className={cn(ID_MONO, 'mt-0.5 text-text-quaternary')}>{row.model}</div>
</div>
<Button icon={<IconParams />} onClick={onEdit}>配置</Button>
{/* 删除按钮放卡片右上角(2026-11-11 · 用户),并按同一轮续条收口成
带重点色的主按钮档:「配置」primary 实底,「删除」同尺寸 danger 描边 + 文字,
与平台资产库卡角的「编辑 / 删除」完全同构(含左右顺序:主操作在左、
破坏性在右,沿用 G4「删除永远排最后」);卡底只剩「启用 / 设为默认 / 检测连接」。
这一档的完整口径(含列表行首那一处)登记在 docs/UI规范.md §5.1.2.1。
档位写死 sm(2026-11-11 用户续条「项目中所有卡片的主功能按钮在大小上
都统一成小尺寸,只是主按钮有底色」):卡片是密集容器,动作一律 24 高;
32 档只留给页头 / 工具栏 / 浮层底部(G4 不变)。
sm 必须**显式写死**而不是靠 <Dense> 继承 —— 上一轮就是因为「 inherit 页面基准」
和「写死 md」两种来源并存,同一种卡角在两页差出一整档。
底色同理:一张卡只有一颗实底(这里是「配置」),「删除」退成 danger 描边红字,
卡底那条 CardActions 也全为无底色。 */}
<div className="flex flex-none items-center gap-1.5">
<Button size="sm" icon={<IconParams />} type="primary" onClick={onEdit}>配置</Button>
<Button size="sm" icon={<IconDelete />} danger disabled={busy}
title="删除这个模型" onClick={onRemove}>删除</Button>
</div>
</div>
{/*
@ -1049,10 +1066,10 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
onChange={() => onPatch({ enabled: !row.enabled }, row.enabled ? '停用模型' : '启用模型')}>
启用
</Check>
{/* 第 17 轮续(闸门 §15.11 btnclustercheck):这四块原先全平铺在 CardActions 上,
430 档实测「启用 + 设为默认 + 检测连接」占满一行、删除孤零零掉到第二行,
卡再窄一点就会把「设为默认 / 检测连接」这一对劈成 1+1。
按 §7 的分组判据:对象级操作一组,破坏性操作单独一组(整块换行,不组内换行)。 */}
{/* 第 17 轮续(闸门 §15.11 btnclustercheck):这几块原先全平铺在 CardActions 上,
430 档实测「启用 + 设为默认 + 检测连接」占满一行、删除孤零零掉到第二行。
按 §7 的分组判据:对象级操作一组(整块换行,不组内换行);
破坏性的删除则在 2026-11-11 移到卡片右上角,与「配置」同排,卡底不再挂它。 */}
<ActionGroup>
<Button icon={<IconCheck />} disabled={busy || !!row.is_default}
onClick={() => onPatch({ is_default: true }, '设为默认')}>
@ -1062,7 +1079,6 @@ function ModelCard({ row, rail, busy, canReveal, revealed, revealing, probing,
{probing ? '探测中…' : '检测连接'}
</Button>
</ActionGroup>
<Button icon={<IconDelete />} type="text" danger disabled={busy} title="删除这个模型" onClick={onRemove} aria-label="删除这个模型" />
</CardActions>
</Tile>
</Dense>

View File

@ -16,7 +16,8 @@ import { Button, Check, Ctlbar, Drawer, Empty, Field, FormGrid, FormRow, Input,
import { notify, notifyBad } from '../stores/notice'
import { confirmAction } from '../stores/confirm'
import { roleLabel, useAuthStore } from '../stores/auth'
import { IconAdd, IconCheck, IconClose, IconEdit, IconKey, IconLogout, IconShield, IconStop, IconUser } from '../components/icons'
import { IconAdd, IconCheck, IconClose, IconLogout, IconShield, IconUser } from '../components/icons'
import { IconEdit, IconKey, IconStop } from '../components/icons/extra'
const NOWRAP = 'whitespace-nowrap'
const FALLBACK_ROLES = ['admin', 'editor', 'viewer'].map((v) => ({ value: v, label: roleLabel(v) }))

View File

@ -21,8 +21,9 @@ import { notify } from '../../stores/notice'
import { useProjectStore } from '../../stores/project'
import { loadModels } from '../../stores/models'
import { Select } from '../../components/forms'
import { Between, Block, Button, Check, Chip, ChipBar, DisclosureRow, Empty, Field, FieldBlock, FormGrid, FormRow, Heading, Layout, LinkButton, LiveDot, MUTED, Mono, Notice, Panel, Paragraph, Row, Tag, TextArea, TILE_HINT, Value } from '../../components/ui'
import { IconAudit, IconCheck, IconChevronRight, IconClose, IconNodeIndex, IconPlay, IconRetry, IconRobot, IconStoryboard } from '../../components/icons'
import { Between, Block, Button, Check, Chip, ChipBar, DisclosureRow, Empty, Field, FieldBlock, FormGrid, FormRow, Heading, Layout, LinkButton, LiveDot, MUTED, Mono, Notice, Panel, Paragraph, Row, Tag, TextArea, Value } from '../../components/ui'
import { IconCheck, IconChevronRight, IconClose, IconPlay, IconRetry, IconStoryboard } from '../../components/icons'
import { IconAudit, IconNodeIndex, IconRobot } from '../../components/icons/extra'
/** 计划里的一步(白名单动作),status: pending/running/succeeded/skipped/failed */
type AgentStep = {
action: string
@ -688,8 +689,7 @@ export default function AgentConsole() {
className={cn('flex-none', row.status === 'cancelled' && 'text-error-hover')}>
{STATUS_LABELS[row.status] || row.status}
</Tag>
<span className={TILE_HINT}>{open ? '收起执行过程' : '展开执行过程'}</span>
</>}
</>}
>
<div className="mt-0 mr-[9px] mb-2 ml-[19px] pt-0.5 pr-2 pb-1 pl-4 border-l border-dashed border-border min-w-0 max-agent:ml-[7px] max-agent:pl-[10px]">
{row.status === 'planning'

View File

@ -15,7 +15,8 @@ import { refresh, useProjectStore } from '../../stores/project'
import { presetLabel, presets as FALLBACK_PRESETS, useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { openTogether } from '../../stores/preview'
import { IconChart, IconChevronUp, IconHourglass, IconPlayCircle, IconRetry, IconWarn } from '../../components/icons'
import { IconChart, IconChevronUp, IconPlayCircle, IconRetry, IconWarn } from '../../components/icons'
import { IconHourglass } from '../../components/icons/extra'
const PRESET_HINTS: Record<string, string> = {
draft_720p: '1280×720 · CRF28 · veryfast(试片最快)',

View File

@ -13,7 +13,8 @@ import { refresh, useProjectStore } from '../../stores/project'
import { useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { Checkbox } from '../../components/ui'
import { IconApi, IconClock, IconClose, IconPlayCircle, IconRetry, IconSend, IconSound } from '../../components/icons'
import { IconApi, IconClock, IconClose, IconPlayCircle, IconRetry, IconSound } from '../../components/icons'
import { IconSend } from '../../components/icons/extra'
const QUEUE_STATUSES = ['planned', 'queued', 'running', 'retrying', 'succeeded', 'failed', 'cancelled', 'skipped']
const QUEUE_KINDS = ['generate_shot', 'voiceover', 'qc_shot', 'compose', 'import', 'asset']

File diff suppressed because it is too large Load Diff

View File

@ -27,7 +27,8 @@ import { useAutoRefresh } from '../../hooks'
import { Select } from '../../components/forms'
import { PageHead, Actions, Button, CardRow, Chip, Info, Ctlbar, Divider, ErrorText, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, LINK_CLS, Layout, LinkButton, LogBox, LogRow, MONO, Notice, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, Row, SearchInput, Stack, Stat, Table, Tag, TagGroup, TextArea, Value, Clamp } from '../../components/ui'
import AgentConsole from './AgentConsole'
import { IconBolt, IconCheck, IconChevronRight, IconChevronUp, IconClose, IconFolder, IconGrid, IconImage, IconPass, IconTracks, IconUser, IconVoice } from '../../components/icons'
import { IconBolt, IconCheck, IconChevronRight, IconChevronUp, IconClose, IconFolder, IconGrid, IconImage, IconTracks, IconUser } from '../../components/icons'
import { IconPass, IconVoice } from '../../components/icons/extra'
/**
* 只放后端 ProjectUpdate 真实接受的字段。
* status 不在这里:项目状态由后端 status.refresh() 按镜头与任务真实进度回写,

View File

@ -16,7 +16,8 @@ import { MediaThumb } from '../../components/media/MediaThumb'
import { PageHead, ActionGroup, Actions, Button, Check, ChipBar, Ctlbar, Divider, Empty, ErrorText, Field, FormRow, Row, BarRight, SegmentedTabs, Count, IconText, Info, Input, Layout, LineHint, MONO, MUTED, MUTED_MONO, NumberInput, PageStack, Panel, PanelHead, SectionTitle, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value, Clamp, useNarrowTable } from '../../components/ui'
import { refresh, useProjectStore } from '../../stores/project'
import { notify } from '../../stores/notice'
import { IconAim, IconDownload, IconEye, IconPass, IconReject, IconReload, IconRetry } from '../../components/icons'
import { IconDownload, IconEye, IconReject, IconReload, IconRetry } from '../../components/icons'
import { IconAim, IconPass } from '../../components/icons/extra'
const KIND_OPTIONS = [
{ value: '', label: '全部记录' },

View File

@ -11,7 +11,7 @@
* 几十上百个镜头也不会把首屏压垮。
*/
import { useEffect, useMemo, useRef, useState } from 'react'
import { Link, useSearchParams } from 'react-router-dom'
import { useSearchParams } from 'react-router-dom'
import * as api from '../../api/client'
import { canvasFor, fmtAgo, fmtTime, opt, reviewBadge, statusLabel } from '../../lib/format'
import { fromAsset, fromShot, fromShotGroup, thumbUrl, type MediaItem } from '../../lib/media'
@ -29,9 +29,10 @@ import { options, useSystemStore } from '../../stores/system'
import { notify } from '../../stores/notice'
import { confirmAction } from '../../stores/confirm'
import { openPreview, usePreviewOpen } from '../../stores/preview'
import { PageHead, ActionGroup, Actions, BarRight, Between, BLOCK_TONE, Button, CARD_ROW, Check, Checkbox, Chip, ChipBar, CloseButton, Ctlbar, DRAWER_ACTIONS, DRAWER_BODY, DRAWER_HEAD, DRAWER_TITLE, Divider, Empty, ErrorText, ExportMenu, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LINK_CLS, LinkButton, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, PageStack, Panel, PanelHead, Row, Scrim, SearchInput, SectionTitle, SkeletonBlock, Spinner, Status, TAG_DENSE, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, ViewSwitch, cellWrap, type Columns } from '../../components/ui'
import { PageHead, ActionGroup, Actions, BarRight, Between, BLOCK_TONE, Button, CARD_ROW, Check, Checkbox, Chip, ChipBar, CloseButton, Ctlbar, DRAWER_ACTIONS, DRAWER_BODY, DRAWER_HEAD, DRAWER_TITLE, Divider, Empty, ErrorText, ExportMenu, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, IconText, Input, LinkButton, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, PageStack, Panel, PanelHead, Row, Scrim, SearchInput, SectionTitle, SkeletonBlock, Spinner, Status, TAG_DENSE, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, ViewSwitch, cellWrap, type Columns } from '../../components/ui'
import { floatingLayerOpen, LAYER } from '../../lib/layers'
import { IconAdd, IconArrowDown, IconArrowUp, IconAudit, IconCheck, IconChevronUp, IconClose, IconCompose, IconCopy, IconDelete, IconDownload, IconDragHandle, IconEdit, IconEye, IconGrid, IconImage, IconListOrdered, IconMic, IconParams, IconPlayCircle, IconReload, IconRetry, IconSearch, IconSound, IconToTop, IconUpload, IconVideo, IconWarn } from '../../components/icons'
import { IconAdd, IconCheck, IconChevronUp, IconClose, IconCopy, IconDelete, IconDownload, IconEye, IconGrid, IconImage, IconPlayCircle, IconReload, IconRetry, IconSearch, IconSound, IconVideo, IconWarn } from '../../components/icons'
import { IconArrowDown, IconArrowUp, IconAudit, IconCompose, IconDragHandle, IconEdit, IconListOrdered, IconMic, IconParams, IconToTop, IconUpload } from '../../components/icons/extra'
type ViewMode = 'grid' | 'table'
type InspectorTab = 'shot' | 'assets' | 'prompt' | 'output'
@ -861,6 +862,7 @@ export default function Storyboard() {
* 键盘用户看不见「它刚从第 4 位来到第 3 位」这件事,得由文字说出来。
* 反馈走 notify() 而不是新的 live region——components/ui/Toast.tsx 的容器
* 本身就是常驻 aria-live="polite",再造一个就是全站第二条播报通道(R19)。
* 但播报排在焦点归还之后(见 refocusShotCard 的 after),否则第一下念不出来。
* 到头了也要说话:静默不动会被当成「快捷键没生效」。
*/
async function moveByKey(shot: any, delta: number) {
@ -875,8 +877,9 @@ export default function Storyboard() {
return
}
if (await move(shot, delta)) {
notify(`${name} 已${dir}到第 ${to + 1} 位`)
refocusShotCard(shot.id)
// 播报让位给焦点(阶段 43 / N14):先回到这张卡,再念「已后移到第 N 位」
const msg = `${name} 已${dir}到第 ${to + 1} 位`
refocusShotCard(shot.id, () => notify(msg))
}
}
/** 卡片上的「⧉」只复制当前镜头,不跟着勾选集走 */
@ -1363,12 +1366,26 @@ export default function Storyboard() {
聚焦卡片后按住 Alt(macOS 键盘上标的是 Option)加上下方向键,可以把这一镜前移或后移;
分镜表视图里也有「前移 / 后移」按钮。
</p>
{/* 258px 是「缩略图 + 两行说明 + 脚注三个按钮」不塌的地板;
降档用登记断点 board=1240(UI规范.md §4):主阶梯的 xl=1200 太晚,
实测 1204–1239(1200px 笔记本的可视宽度)靠 224 的地板排得下 4 列,
按 258 排只剩 3 列;邻居 2xl=1600 又太早:1280 会从实测 3 列 328px
变 4 列 243px、1440 从 4 列 283px 变 5 列 224px,每张卡缩掉 59–85px。 */}
<div className="grid min-w-0 grid-cols-[repeat(auto-fill,minmax(258px,1fr))] gap-3 max-board:grid-cols-[repeat(auto-fill,minmax(224px,1fr))]">
{/* 卡宽三件事(2026-11-11 · 用户「分镜与脚本的卡片按钮部署有问题,卡片宽度也有问题」):
① 地板 258 → 320(降档 224 → 288):状态行现在要放「审核」那颗主按钮
(用户「审核按钮作为主功能按钮应该放到审核状态后」),
283 宽的卡给标题只剩 ~107px,三行才能放下 18 个汉字;抬到 320 之后标题回到两行。
② 上限不再写在轨道上:上一轮把轨道写成 minmax(320px, 420px),本意是
「地板 320、封顶 420」,实测(同一份 CSS 在 1168px 的看板上)Chromium 排的是
**2 条 420 的轨道 + 右边一条 316px 的死白**——`repeat(auto-fit|auto-fill, minmax(A, B))`
里 B 是定长时,浏览器按 **B** 而不是 A 数轨道数(1168 → ⌊1180/432⌋=2、1328 → 3、1800 → 4),
地板等于白写。这正是用户说「卡片宽度也有问题」时看到的那道空档:
1440 只有 2 列,1024 看板 752px 只排 1 张 380 的卡(右边空 372)。
现在上限交给地板本身:`minmax(320px, 1fr)` 让浏览器按地板数轨道、把整行摊满
(1168 → 3 列 381、1008 → 3 列 328、1328 → 4 列 323、752 → 2 列 370),
卡宽带宽 320–485,与全站另外四处卡片栅格(素材墙 148/1fr、封面墙 212/1fr、
项目素材墙 148/1fr、检查器 270/1fr)同一种写法。
为什么不用 `auto-fit`:镜头数少于轨道数时(一镜、两镜的新项目)auto-fit 会把空轨道
塌掉并摊给剩下的卡,1168 的看板上一张卡就是整行 1168(16:9 缩略图 658 高);
`auto-fill` 保留空轨道,卡宽只由看板宽度决定,一镜也是 381 的卡 + 右边留白。
③ 降档仍用登记断点 board=1240(UI规范.md §4):xl=1200 太晚、2xl=1600 太早,
窄一档地板 288 让 1024 排 2 列 370、768/430 单列摊满,口径与下面那条老注释一致。 */}
<div className="grid min-w-0 grid-cols-[repeat(auto-fill,minmax(320px,1fr))] gap-3 max-board:grid-cols-[repeat(auto-fill,minmax(288px,1fr))]">
{filtered.map((s) => (
<ShotCard
key={s.id}
@ -1941,13 +1958,25 @@ const SHOT_MOVE_KEYSHORTCUTS = 'Alt+ArrowUp Alt+ArrowDown'
* 本函数返回时新列表通常还没画完,同步 focus 会作用在旧节点上。
* 最多 8 帧(约 130ms):拿不到就算了(比如这镜正被筛选条件挡住),
* 不去抢 body 之外的焦点,免得把用户本来就放好的焦点弄丢。
*
* after(focused):焦点归还**之后**再执行的那句话(NEX 阶段 43 / N14)。
* 8 帧耗尽也要执行(focused=false)——挪没成都得有一句话,静默会被当成快捷键坏了。
* 为什么播报要排在这里:Toast 容器是常驻 aria-live="polite",阶段 41 实测
* 「notify 在 focus 之前」时两个方向各丢第一下(焦点播报抢在文案播报前面)。
* 让出一帧再写文案,顺序就固定成「先说落在哪张卡,再说它移动到了第几位」。
* 播报通道仍然只有 Toast 这一条(R19,不另造 live region)。
*/
function refocusShotCard(id: number) {
function refocusShotCard(id: number, after?: (focused: boolean) => void) {
let tries = 0
const step = () => {
const el = document.querySelector<HTMLElement>(`[data-shot-card="${id}"]`)
if (el) { el.focus(); return }
if (++tries < 8) requestAnimationFrame(step)
if (el) {
el.focus()
requestAnimationFrame(() => after?.(true))
return
}
if (++tries < 8) { requestAnimationFrame(step); return }
after?.(false)
}
requestAnimationFrame(step)
}
@ -2075,9 +2104,22 @@ function ShotCard({
阶段 8 修好 D16 之后 wrapper 已撤,flex-none 直接写在 <Status> 上。
卡片宽度、栅格、标题行数都不动;标签兜底的 title 仍然保留(窄到连 42px
都给不出时,读 title)。 */}
<div className="flex min-w-0 items-start justify-between gap-2">
<b data-shot-select className="min-w-0 text-xs leading-snug">{s.title || '未命名镜头'}</b>
<Status value={s.status} className="flex-none" />
{/* 右侧这一组 = 这张卡的「状态 + 主功能」(2026-11-11 · 用户
「审核按钮作为主功能按钮应该放到审核状态后」):
审核状态是读者的落点(这镜过没过),「审核」是紧接着要做的动作,
两者贴在同一条中心线上,不再让读者到卡片脚注最右端去捞那颗文字链。
它是这张卡唯一一颗实底主按钮(口径 §5.1.2.1),小尺寸 sm。
<b> 由 justify-between 改成 flex-1:中间的空档归标题,
右端这一组用 flex-none 整块贴边,不许被长标题压扁。
wrapper 上的 stopPropagation:整张卡是「打开这一镜」的热区,
点审核不该顺手把检查器也拉开。 */}
<div className="flex min-w-0 items-start gap-2">
<b data-shot-select className="min-w-0 flex-1 text-xs leading-snug">{s.title || '未命名镜头'}</b>
<span className="flex flex-none items-center gap-1.5" onClick={(ev) => ev.stopPropagation()}>
<Status value={s.status} className="flex-none" />
<LinkButton to={`/projects/${projectId}/review?shot=${s.id}`} size="sm" type="primary"
icon={<IconAudit />} title="到「质检与审核」处理这一镜">审核</LinkButton>
</span>
</div>
<p className="m-0 line-clamp-2 text-xs leading-normal text-text-tertiary">{s.description || '未填写画面描述'}</p>
{s.dialogue
@ -2115,20 +2157,20 @@ function ShotCard({
</div>
) : null}
<div className={SHOT_FOOT} onClick={(ev) => ev.stopPropagation()}>
<Button type="primary" size="sm" onClick={onText} title="直接改这一镜的画面描述与台词" icon={<IconEdit />}>改文案</Button>
{/* 卡底三颗都是 sm(24)且一律不涂底色:这张卡的重点色只给状态行那颗「审核」。 */}
<Button size="sm" onClick={onText} title="直接改这一镜的画面描述与台词" icon={<IconEdit />}>改文案</Button>
<LinkButton to={dispatchLink(projectId, s)} size="sm"
title={s.output_url ? '已有产物:到调度中心只重做这一镜' : '到调度中心生成这一镜'}
icon={s.output_url ? <IconReload /> : <IconPlayCircle />}>
{s.output_url ? '重生成' : '生成'}
</LinkButton>
<BarRight>
<Link to={`/projects/${projectId}/review?shot=${s.id}`} className={LINK_CLS}>审核</Link>
{/* 这一条原先在 1440 就被劈开过(闸门 §15.11):左端「生成/重生成」把宽度吃掉之后
BarRight 只剩 89px,「审核 + 复制」占一行、删除单独掉到第二行。
复制 / 删除是这一镜的对象级操作,粘成一组整块换行。 */}
{/* 「审核」2026-11-11 升到状态行做主按钮,脚注这里不再留那颗文字链。
剩两颗对象级操作整块换行(闸门 §15.11 的老账),并一起收进 sm 档:
原先复制是 24、删除是 32,同一组里差一档,中心线也差 4px。 */}
<ActionGroup>
<Button size="sm" disabled={busy} onClick={onDuplicate} title="复制这一镜" aria-label="复制这一镜" icon={<IconCopy />} />
<Button type="text" danger title="删除这一镜" aria-label="删除这一镜" onClick={onRemove} icon={<IconDelete />} />
<Button size="sm" type="text" danger title="删除这一镜" aria-label="删除这一镜" onClick={onRemove} icon={<IconDelete />} />
</ActionGroup>
</BarRight>
</div>

View File

@ -18,7 +18,8 @@ import { notify } from '../../stores/notice'
import { confirmAction } from '../../stores/confirm'
import { openPreview } from '../../stores/preview'
import { PageHead, ActionGroup, Actions, Button, Check, Chip, ChipBar, Ctlbar, Divider, Empty, ErrorText, ExtLink, Field, FieldBlock, FilePick, FormGrid, FormRow, Grid, Count, IconText, Input, IssueRow, Layout, LineHint, MONO, MUTED, MUTED_MONO, MaybeNumberInput, Mono, NumberInput, OptionGrid, PageStack, Panel, PanelHead, Row, Spinner, Status, Table, Tag, TagGroup, TextArea, Toolbar, Value, Clamp, useNarrowTable } from '../../components/ui'
import { IconAdd, IconArrowDown, IconArrowUp, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEdit, IconEye, IconMic, IconPass, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
import { IconAdd, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEye, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
import { IconArrowDown, IconArrowUp, IconEdit, IconMic, IconPass } from '../../components/icons/extra'
/**
* 这三条下拉(字幕方式 / 台词语音来源 / 模型原声策略)的选项名是一整句解释,

View File

@ -9,7 +9,24 @@ import * as api from '../api/client'
import { isRecordingBusy } from './recording'
export type ProjectState = {
/** 路由当前是哪个项目(`ProjectDetail` 的 `:id`),进页面就写,早于数据到达 */
id: number | null
/**
* `project` / `workflow` / `stats` 这一份数据**属于哪个项目**。只有拉成功才写,
* 与它们同生同灭,所以拿它当「这份数据能不能用」的唯一判据。
*
* 为什么要有这一格(2026-11-10 · 用户第 2 条):路由号和数据不是一回事。
* 同一次会话里从项目 A 切到 B(点列表链接、点平台动态里的那条),
* `id` 立刻是 B,而 `project` 还是 A —— 概览页于是把 A 的 12 个节点顶在 B 的地址下面;
* B 的项目已经被删掉(详情 404)时更糟:`project` 永远停在 A,
* 「未找到项目」也永远出不来。实测两组读数见
* `reports/ui_evidence/nex-p33/projspa_before.log`(残留 40–80 ms / 404 永久残留)。
*
* 需要「当前项目的数据」的地方读本格的 `project` 即可;只想确认是不是自己那份,
* 比 `loadedId`,别比 `id`。总控台与概况抽屉原来各自写了一遍
* `project?.id === Number(projectId)`,是同一件事在消费端各补一遍。
*/
loadedId: number | null
project: any
workflow: any[]
stats: any
@ -24,6 +41,7 @@ export type ProjectState = {
export const useProjectStore = create<ProjectState>((set) => ({
id: null,
loadedId: null,
project: null,
workflow: [],
stats: null,
@ -37,13 +55,28 @@ export const useProjectStore = create<ProjectState>((set) => ({
export const projectState = () => useProjectStore.getState()
/** 已经发出的第几次请求:只有最后一次的结果许写进 store(见下面 loadProject) */
let seq = 0
export async function loadProject(id: number, silent = true) {
const set = useProjectStore.getState().set
const { set, loadedId } = useProjectStore.getState()
const mine = ++seq
set({ id })
/* 换项目(不是原地刷新)才清旧数据,清完由 `ProjectDetail` 出它本来就设计好的骨架。
· 为什么清在这里而不是让各页自己加守卫:`project` 只有这一处写,
消费方有 7 个(概览 / 素材库 / 分镜 / 时间线 / Agent / 总控台 / 概况抽屉),
逐个加守卫迟早漏一个——概览就是漏掉的那一个。
· 为什么只在 `!silent` 时清:轮询与 `refresh()` 都是 silent,刷的还是同一个项目,
清了就是每 6 秒整屏闪一次骨架(实测静置 8 秒 0 次闪,别把它加回去)。
· 404 时不清就等于没改:拉失败 ⇒ `project` 留在 null ⇒ 外壳的「未找到项目」成立。 */
if (!silent && loadedId !== id) set({ loadedId: null, project: null, workflow: [], stats: null, error: '' })
if (!silent) set({ loading: true })
try {
const data = await api.get(`/api/projects/${id}`)
// 快速连切 A→B→A 时,先发的请求可能后到;旧响应不许盖掉新项目的数据
if (mine !== seq) return
set({
loadedId: id,
project: data,
workflow: data.workflow || [],
stats: data.stats || null,
@ -52,9 +85,10 @@ export async function loadProject(id: number, silent = true) {
activeProject: data
})
} catch (exc: any) {
if (mine !== seq) return
set({ error: exc?.message || String(exc) })
} finally {
set({ loading: false })
if (mine === seq) set({ loading: false })
}
}

View File

@ -527,6 +527,38 @@ html[data-theme='dark'] .nex-tag.ant-tag { background: color-mix(in srgb, var(--
`:has()` 上一行就在用,不是新引入的能力。 */
.ant-btn:has(> .nex-file-input:focus-visible) { outline: 2px solid var(--ant-color-primary); outline-offset: 2px }
/* ── 密码框的眼睛开关:换成真 <button> 后,antd 的着色规则要按原样接回来 ─────
症状(2026-11-10 · 阶段 35 · T1-N4/N5 改动的视觉回归,明暗两档都看得见):
`forms/SecretInput.tsx` 的 `iconRender` 从 antd 给的
`<span role="img" tabindex="-1">` 换成 `<button type="button">` 之后,
眼睛的颜色从 colorIcon(明 rgba(17,26,34,.45) / 暗 rgba(233,237,242,.45))
跳成 colorText(.88 / .85),悬停不再变深,鼠标指针也退回 default。
读数:`reports/ui_evidence/nex-p35/t1/logs/eye-reveal.json`。
根因:antd 这条规则的选择器是**两个类的合取**(antd/es/input/style/index.js:433
写成 `${iconCls}${componentCls}-password-icon`),运行时展开成
`.ant-input-affix-wrapper .anticon.ant-input-password-icon`。
`anticon` 是 antd 自己包给默认那只 span 的类;`iconRender` 的返回值
只被 clone 上 `ant-input-password-icon` 和三个事件(Password.js:64-83),
换了标签就只剩一个类 ⇒ 整条规则落空。
顺带堵死一条捷径:不能靠给按钮写 `className="anticon"` 蒙过去,
同一个 cloneElement 是**覆盖** className 而不是合并,组件里写的类名留不下来。
做法:把 antd 原规则**逐条照抄**,只摘掉失效的那半个类,数值一个都不新造——
色值与时长用的还是 antd 自己的三个 CSS 变量(`--ant-motion-duration-slow`
在眼睛这个位置实测可解析:加上 anticon 后 computed transition-duration = .3s),
所以明暗切换、禁用态跟着 antd 的 token 走,不产生第二把尺子。
落点选这里而不是组件内联:R8 规定 app.css 是全站唯一的 `.ant-*` 出口。 */
.ant-input-affix-wrapper .ant-input-password-icon {
color: var(--ant-color-icon);
cursor: pointer;
transition: all var(--ant-motion-duration-slow);
}
.ant-input-affix-wrapper .ant-input-password-icon:hover { color: var(--ant-color-icon-hover) }
.ant-input-affix-wrapper-disabled .ant-input-password-icon {
color: var(--ant-color-icon);
cursor: not-allowed;
}
.ant-input-affix-wrapper-disabled .ant-input-password-icon:hover { color: var(--ant-color-icon) }
/* ── 分段控件:轨道高度必须正好落在档位上 ────────────────────────────────
症状:窄屏体检量到 37px(档位只有 32/24/40),真值是 36.53;宽屏 31.03
侥幸四舍五入成 31,所以只在窄档犯病,看起来像「窄屏专属 bug」。
@ -702,7 +734,7 @@ html[data-theme='dark'] .nex-info .ant-descriptions-item-label {
② 语义底纹 `BLOCK_TONE`(R16.3 那把尺子,提示条直接复用)。
色值一律是 antd 语义 token(`--ant-color-*`),这里没有一个新的颜色。
动画时长写成字面量并在这里注明出处:`applyRootVars` 只把
color/borderRadius/boxShadow/font*/lineHeight/controlHeight/margin/padding/screen
color/borderRadius/boxShadow/font* / lineHeight/controlHeight/margin/padding/screen
抄到 `:root`,motion 那一族不在名单里——吐司与提示条都挂在 `:root` 那棵子树上
(吐司挂在 body 级容器、模态 portal 出 `.ant-app`),读不到 `--ant-motion-*`。
.2s = antd motionDurationMid,.3s = motionDurationSlow。

View File

@ -48,6 +48,19 @@
· 用 !important 逐条补回 antd 的 padding/margin:补不完,antd 一升级又漏。 */
@layer theme, base, components, antd, utilities;
/* ── Tailwind 内容扫描的边界(阶段 19 加的,别删)────────────────────────────
上面三行是 granular 导入,等价于「自动源探测开着」:Tailwind 会把整个项目目录
(减去 .gitignore 命中的)当候选类名来源。于是**同目录下的构建产物会被当成源码**。
frontend/dist-b1 只是 Bundle 取证留下的一份对照产物,Tailwind 把它 index CSS 里的
类名原样读成候选,正式产物因此被烤进 84 条本项目根本没用到的工具类
(container / table-cell / list-item / rounded-t / scale-3d / 以及 fixed 与 visible
的 important 变体等),88 997 B vs 77 786 B:多 11 211 B,是 CSS 的 12.6 %,
gzip 1.55 kB,连产物哈希一起漂移。复现三遍,且逐条判过生死:14 路由 × Light/Dark
活体 querySelectorAll 命中 0、运行时 class 全集交集 0、.tsx 类位置词元交集 0、
源码无「片段拼类」。所以这 84 条确实是死 CSS,排除掉不改变任何一屏。
.gitignore 里的 frontend/dist 前缀规则也能修,但它护的是「恰好没被提交」;
下面这行才是把产物目录从扫描集里永久摘出去。两处都留。 */
@source not "../../dist*";
@import "tailwindcss/theme.css" layer(theme);
/* ⚠️ preflight 必须与 antd 同层,理由见上。写成 layer(base) 就会退回全部错位。 */
@import "tailwindcss/preflight.css" layer(antd);

View File

@ -8,6 +8,14 @@ declare const process: { env: Record<string, string | undefined> }
// 开发态把 /api 与 /media 代理到本地 FastAPI(默认 127.0.0.1:8000)
const backend = process.env.NEX_BACKEND || 'http://127.0.0.1:8000'
/* 共享代码分组用:本项目自己的「不是页面」的代码住在这四个目录里(页面在 src/pages、
外壳在 src/app)。`import.meta.url` 的 pathname 是 percent-encoded 的(工作 → %E5%B7%A5…),
而模块 id 是真实文件路径 ⇒ 必须先 decodeURIComponent,否则 test 永远不命中、
分组静默失效(阶段 18 第一次实验就这么白跑了一轮)。 */
const SRC_ROOT = decodeURIComponent(new URL('./src', import.meta.url).pathname)
const KIT_DIRS = ['components', 'lib', 'stores', 'api']
export default defineConfig({
plugins: [react(), tailwindcss()],
// '@' → src:标准控件组(shadcn)的组件源码一律 import '@/lib/utils'、'@/components/kit',
@ -27,5 +35,93 @@ export default defineConfig({
'/openapi.json': { target: backend, changeOrigin: true }
}
},
build: { outDir: 'dist', emptyOutDir: true, chunkSizeWarningLimit: 1200 }
build: {
outDir: 'dist', emptyOutDir: true, chunkSizeWarningLimit: 1200,
/* 把我们自己的共享代码(kit / lib / stores / api)从共享的第三方块里分出来。
症状:构建器把 `src/components/ui/**` 与 1 000 多个 node_modules 模块**混进同一块**
(`ui-*.js`,实测 sourcemap 里 39 个 src 模块 + 1 054 个依赖模块),
于是改一行 kit 代码 ⇒ 这块换哈希 ⇒ 引用它的首屏与 15 个路由块**全部**换哈希。
实测(2026-11-09 阶段 18):只把 `Input.tsx` 里一个字符串换个字,
21 块里 20 块改名,用户要多下 1 276 kB(gzip 390 kB)的第三方代码。
做法:一条 `codeSplitting.groups`,只圈我们自己的四个目录,
`includeDependenciesRecursively: false` 是关键——默认 true 会把它们的依赖
整个拖进这一组(实测那块涨到 1 362 kB、路由块被吃掉),等于换成另一种混块。
第三方怎么分块**一个字都不动**:不预置 vendor 名单,不做全局分包。
效果(同一把 churn 实验,改一个字符串后逐块比哈希):第三方大块 1 217 164 B
**哈希不变**,只有 `kit-*`(135 kB) 与 `index-*`(143 kB) 等 17 块换名 ⇒
每次改 kit 少重下 1.19 MB(gzip 369 kB)。
代价:首屏静态闭包 +25 559 B(raw +1.6% / gzip +8 643 B +1.8%)——多一个块边界
就多一层 interop 包装并打断跨块压缩。冷启动略贵,换部署后的缓存留存。
阈值 `chunkSizeWarningLimit` 保持 1200 没抬过;分块后最大块从 1 276 kB 降到 1 217 kB。
验收:`npm run build` 与 `node scripts/ui/chunkbudget.mjs` 必须绿;
90 态 `visualcheck` 与 `semanticcheck` 必须零新增 console 报错
——跨块边界唯一真会坏的是循环依赖的初始化顺序,靠真页面读数证明它没坏。 */
rolldownOptions: {
output: {
codeSplitting: {
groups: [
{
/* 图标登记表的**扩展表**单独成块(阶段 25 · Bundle 收口,不是全局分包重构)。
症状:`kit` 分组按**目录** `src/components/**` 收拢,所以图标登记表整张在首屏;
登记表拆成 core(首屏外壳按名字用得上的 54 只)+ extra(只有懒页面用得上的
24 只)之后,`extra.ts` 仍然被 `kit` 那条目录规则捞进首屏块 —— 实测 Δgzip
−0.66 kB(**负收益**,`bundle-icons-split.log` 的 D2):切了目录没切分组规则,
等于白切。
做法:给 `extra.ts` 一条 priority 高于 `kit` 的逃生分组,
`includeDependenciesRecursively: false`(同 `kit` / `kit-recorder` 的口径:
只圈这一个模块,不让它的依赖被整块拖走)。
实测(同一条 `chunkinfo.mjs` 尺子,与基线各构一次 no-map 产物配对):
首屏 raw 1 513.38 → 1 492.44 kB / gzip 460.51 → 455.77 kB(−4.74,−1.03 %)/
brotli 377.02 → 373.46 kB;第三方大块 `WarningOutlined-*` 1 217.16 → 1 195.84 kB,
sourcemap 归因=111 只字形 → 87 只,请出去的正是 extra 那 24 只,
react / @babel/runtime / rc-util 逐模块字节一字不差;
全部产物 gzip 593.70 → 594.69 kB(**+0.99 kB**,新块边界的 interop 成本,
阶段 18 / 22 量过同一现象)。
前置条件(缺一条这条分组就是空转):桶 `icons/index.ts` **不许**
`export * from './extra'`,首屏静态闭包里的任何文件都不许深 import
`icons/extra` —— 两条都由 `scripts/ui/classaudit.mjs` 第 2 条·附三钉住,
反例见 `scripts/ui/gateprobe.py`。
验收:`chunkbudget` 对新块必须仍 OK(不抬 `chunkSizeWarningLimit`);
`lazyloadcheck.py` 在 `vite preview` 产物上证明「首屏不请求 kit-icons-extra、
进懒页面才请求、图标照样画得出来」。 */
name: 'kit-icons-extra', priority: 120, includeDependenciesRecursively: false,
test: (id: string) => /\/src\/components\/icons\/extra\.ts$/.test(id)
},
{
/* 录音面板单独成块(阶段 22 · 有实测依据的低风险拆分,不是全局分包重构)。
依据:`reports/ui_evidence/nex-p22/lazykit.mjs` 拿「首屏闭包 × 构建产物 sourcemap」
逐模块判定 kit 块里哪些字节首屏根本用不到 —— 只有 3 个:
RecordAudio.tsx 11.78 kB + lib/recorder.ts 9.10 kB + lib/versions.ts 0.86 kB
(产物字节,合计 21.7 kB = kit 自有归属 121.1 kB 的 18 %)。
使用方只有 `AssetLibrary` 与 `project/Library` 两条 lazy 路由,首屏闭包不含它们。
实测(同一条 `chunkinfo.mjs` 尺子,前后各跑一次):
首屏 raw 1 537.52 → 1 513.85 kB / gzip 468.96 → 460.65 kB(−8.31,−1.77 %)/
brotli 384.04 → 377.26 kB;全部产物 gzip 592.76 → 593.85 kB(**+1.09 kB**,
即新块边界的 interop 成本,阶段 18 量过同一现象);
`kit-*.js` 131.58/45.43 → 107.85/37.10 kB;新块 `kit-recorder-*.js`
23.89/9.37 kB,只在进那两页时才拉。
阶段 18 的不变量仍成立:第三方大块 `WarningOutlined-*.js` 1 188.64 kB
**同名同哈希**,CSS `index-*.css` 同名 —— 第三方怎么分块一个字没动。
⚠ 复核口径:模块可达性必须同时认 `import … from` 与桶文件的
`export * from './X'` 再导出。首版只认 import,把 `components/ui/index.ts`
再导出的 17 个模块误判成 lazy-only,虚报 40.6 kB / 20 模块 —— 按那个数字
拆下去会多切两刀还说不清收益。同一盲区也在 `eagergraph.mjs` 上(阶段 22
的 `eagergraph.log` 由此偏乐观,已在台账注明)。
验收:`chunkbudget` 对新块必须仍 OK(不许靠抬 `chunkSizeWarningLimit` 捂警告);
90 态 `visualcheck` 与 `semanticcheck` console 报错 0 条;
跨块边界唯一真会坏的是初始化顺序,靠 `lazyloadcheck.py` 在**构建产物**
(`vite preview :4173`)上证明「非录音页不请求 kit-recorder、进那两页才请求、
录音面板照样点得开」。 */
name: 'kit-recorder', priority: 110, includeDependenciesRecursively: false,
test: (id: string) => /\/src\/(components\/media\/RecordAudio\.tsx|lib\/(recorder|versions)\.ts)$/.test(id)
},
{
name: 'kit', priority: 100, includeDependenciesRecursively: false,
test: (id: string) => KIT_DIRS.some((d) => id.startsWith(SRC_ROOT + '/' + d + '/'))
}
]
}
}
}
}
})