反馈四级表面全部自绘:吐司、确认框、提示条、Tooltip 不再用出厂件
症状(用户原话「整体修改系统中的所以提示窗、完成后的反馈 tips 等。不要使用默认组件」):
① 55 处 `notify()` 落的是 antd 出厂 `<message>`——页面顶部正中一颗纯黑药丸,只有
「一个图形 + 一行白字」:说完了「保存成功」却说不完后果(哪个版本、几个镜头、
能不能撤销);3 秒准时消失且**悬停不停**,错误里那句长文案根本读不完;同一次
批量操作连点五次就在原地叠五颗一模一样的胶囊;站内每一张卡、每一个信息块都有
描边、圆角、色块图标,只有它是另一家的长相。
② 12 处 `window.confirm()` 弹的是**操作系统**的窗口:主题、字号、按钮、层级、语言
全由 Chrome/macOS 决定,「会删掉什么、影响哪些产物」整段挤成一行灰字,不可恢复
的删除和有代价但可逆的切换长得一模一样,用户只能条件反射点确定;它还是同步阻塞
的,页面脚本停在原地,动画和轮询全冻住。
③ 页面里的提示条是 antd `Alert` 直封装,跟 R16.3 那把唯一的语义底纹尺(`BLOCK_TONE`)
是两套皮肤,同页并存;而且它没有 action 位——App.tsx 那条「后端连接异常」要挂
「重试」,只能绕过 kit 直接 import antd 的 Alert,R8 那道墙就是这么被自己的兜底
页凿穿的。
④ 纯图标按钮的说明(R11 的唯一出口)仍是 antd 出厂 Tooltip:`colorBgSpotlight` 走
反色文字基准,浅色下是一块死黑、深色下比正文还亮,跟站内浮层没有共同语言。
做法(四级从同一张语义表出发,`components/ui/tone.tsx` 是唯一的色调与图形来源):
· 语气表 `tone.tsx`:`ok/bad/warn/info/loading` 五档 → 底纹 `TONE_TINT`、图形
`TONE_ICON`、朗读名 `TONE_LABEL`、antd 词汇映射 `NOTICE_TONE`,色值全部取 antd
语义 token,页面里不出现新色。
· 吐司:状态留在 `stores/notice.ts`(**55 处调用点一个都没改**),皮肤换到
`components/ui/Toast.tsx`——右下角堆叠卡片、语义色块、标题 + 明细两层、底部倒计
时条、悬停/聚焦时动画与计时器同时暂停、同文案同语气去重成「×N」、同屏最多 5 颗
(超出挤掉最旧);`notifyLoading()` 改成 `startLoading()` 返回 `done()` 句柄,
进行中的那颗原地换语气换文案,不再「消失一下再弹一颗」。
· 确认框:新增 `stores/confirm.ts` 的 `confirmAction(): Promise<boolean>` +
`components/ui/Confirm.tsx`(浮层唯一实现 kit `Modal` + 语义色块 + 两层文案 +
图标按钮)。12 处原生调用清零,问话只留一句、后果写进 `desc`、主按钮把动作写成
动词(「删除 / 继续切换 / 仍然关闭 / 归档」),`danger` 给红描边。外层函数本来就
全是 `async`,一行 `await` 读起来和原来的 `if` 一样顺。已有一张开着时后来的请求
直接判取消——连按 Esc 不会排出一串窗口。
· 提示条:`Notice` 不再借 `Alert` 的皮肤,改读 `BLOCK_TONE`(与 `<Block>` 同一把
尺),左 20px 档色块、两行文案,新增 `action` 位与标准图标按钮关闭键;props 与
原来完全一致(含 antd 词汇的 `type`),32 处调用点零改动。App.tsx 的系统异常条与
ErrorBoundary 的兜底条从裸 antd `Alert` 收回 kit,并补上「重试」按钮。
· Tooltip:`theme/antd.ts` 只换两个 token(`colorBgElevated` 底 + `colorTextBase`
字),明暗自动跟主题、不引入新色值,描边与阴影那一圈在 `app.css` 的
`.ant-tooltip-inner` 补。不换自绘件:定位、延迟、触屏、aria-describedby 是它的
本职,「不要用默认组件」指的是那几张**反馈表面**。
· 两个宿主 `<ToastHost/>` / `<ConfirmHost/>` 挂在 `app/providers.tsx` 而不是
App.tsx:反馈队列是跨页面的全局状态(换页要清空、灯箱与抽屉之上也要显示),而
App.tsx 只画工作台,登录页走另一棵子树——挂在 Provider 层两边才是同一个长相。
· `app.css` 新增 38 条规则(`.nex-toast*` 17 / `.nex-confirm*` 12 / `.nex-notice*`
9),尺寸全部读 `--ant-*`;确认框的描边用 `:has([data-tone=…])` 落在 `.ant-modal`
上,为此给 kit `Modal` 加了 `className` 形参。抽屉/弹窗的吸底动作条交给
`ActionGroup`(同一套自动竖排量法),窄屏不再折成 2 + 1。
验证:`npm run typecheck` / `build` 绿;`scripts/ui/feedbackcheck.py`(本轮起的反馈表面
探针)明暗两档 0 违规——出厂 `message`/`Alert`/`window.confirm` 在 DOM 里已全部查不到,
吐司只有右下角一个 region、每颗都有色块与倒计时。反向验证:临时把一颗吐司换回
`message.success`,探针当场点名。
⚠ 本笔同时携带并行会话在途的改动,如实记账:`styles/app.css` 是整文件提交的,其中
`nex-head-stack`(4 行,配套 `Panel.tsx` 的 `<576` 卡头换行,本轮一起才自洽)、
`nex-steps` / `nex-opt-cell` / `nex-tag-text`(5 行,选择器暂时悬空,调用方在
`components/ui/{Steps,Status}.tsx`,那些文件留在他们那笔)共 9 行不是本轮主题。
main
parent
e5ccbe0651
commit
b6a1df6dfd
|
|
@ -8,7 +8,7 @@
|
|||
* 顶栏高度与底色来自 Layout 的组件 token;
|
||||
* · 折叠与断点来自 Sider 的 breakpoint + collapsedWidth(值 = antd Grid 的 md);
|
||||
* · 主区不再算减法:antd 的 Layout 本身是 flex,Sider 让位后 Content 自然撑开;
|
||||
* · Content 内自上而下是「系统异常 Alert → 页面」。**内容页不再有多页签条**——
|
||||
* · Content 内自上而下是「系统异常提示条(kit Notice)→ 页面」。**内容页不再有多页签条**——
|
||||
* 页签属于页面内部的分区切换(见 §6 与 `components/ui/Tabs.tsx`),不属于外壳。
|
||||
*
|
||||
* · 登录页这类 chromeless 页面不套顶栏/侧栏,也不去拉需要鉴权的系统状态。
|
||||
|
|
@ -18,7 +18,9 @@
|
|||
*/
|
||||
import { Suspense, useEffect, useRef, useState, type ReactNode } from 'react'
|
||||
import { Navigate, Outlet, useLocation, useMatches } from 'react-router-dom'
|
||||
import { Alert, Button, Flex, Layout, Spin } from 'antd'
|
||||
import { Button, Flex, Layout, Spin } from 'antd'
|
||||
import { Notice } from '../components/ui'
|
||||
import { IconReload } from '../components/icons'
|
||||
import { authState, refreshState, useAuthStore, useIsAuthenticated } from '../stores/auth'
|
||||
import { loadSystem, useSystemStore } from '../stores/system'
|
||||
import { toggleTheme } from '../stores/theme'
|
||||
|
|
@ -144,11 +146,13 @@ export default function App() {
|
|||
<AppSider projectId={projectId} collapsed={collapsed} onCollapse={setCollapsed} />
|
||||
<Layout.Content className="min-w-0 p-6 max-lg:p-4 max-md:p-3"
|
||||
style={{ maxWidth: 1680, width: '100%', marginInline: 'auto' }}>
|
||||
{/* 系统级异常:kit Notice(R19 反馈表面唯一实现)。
|
||||
后端连不上是「可以继续用但要知道」的状态,条上给一颗重试按钮就地善后。 */}
|
||||
{systemError && !auth.offline && isAuthenticated && (
|
||||
<Alert type="error" showIcon className="mb-4"
|
||||
message="后端连接异常"
|
||||
description={systemError}
|
||||
action={<Button size="small" onClick={() => void loadSystem(true)}>重试</Button>} />
|
||||
<Notice danger description={systemError}
|
||||
action={<Button size="small" icon={<IconReload />} onClick={() => void loadSystem(true)}>重试</Button>}>
|
||||
后端连接异常
|
||||
</Notice>
|
||||
)}
|
||||
<AuthGate admin={handle.admin}>
|
||||
{/* 换顶级路由时整块重挂:避免上一个页面的本地状态(筛选条件、抽屉)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,9 @@
|
|||
* 不需要额外的「清除错误」状态。
|
||||
*/
|
||||
import { Component, type ErrorInfo, type ReactNode } from 'react'
|
||||
import { Alert, Button, Result, Typography } from 'antd'
|
||||
import { Result, Typography } from 'antd'
|
||||
import { Button, Notice } from '../components/ui'
|
||||
import { IconProjects, IconReload } from '../components/icons'
|
||||
|
||||
/** 自动重刷只允许发生一次:记时间戳而不是布尔值,隔一阵子的问题还能再自愈一回 */
|
||||
const RELOAD_KEY = 'nex.chunk.reload.at'
|
||||
|
|
@ -68,22 +70,21 @@ export default class ErrorBoundary extends Component<Props, State> {
|
|||
? '多半是服务端刚重新部署过,浏览器还在用旧版页面清单。重新加载通常就好了;一直不好就把本页地址发我。'
|
||||
: '页面在渲染时抛了异常。先重新加载一次;如果每次进来都这样,请附上下面这行提示。'}
|
||||
extra={[
|
||||
<Button type="primary" key="reload" onClick={() => window.location.reload()}>
|
||||
<Button type="primary" key="reload" icon={<IconReload />} onClick={() => window.location.reload()}>
|
||||
重新加载本页
|
||||
</Button>,
|
||||
<Button key="home" href="/">回到项目列表</Button>
|
||||
<Button key="home" href="/" icon={<IconProjects />}>回到项目列表</Button>
|
||||
]}
|
||||
>
|
||||
<Alert
|
||||
type="error"
|
||||
showIcon
|
||||
message={(chunk ? '分包加载失败' : '渲染异常') + ':' + (error.message || String(error))}
|
||||
description={
|
||||
<Typography.Text type="secondary">
|
||||
兜底页由 ErrorBoundary 渲染;具体堆栈在浏览器控制台的 [nex] 页面渲染失败。
|
||||
</Typography.Text>
|
||||
}
|
||||
/>
|
||||
{/* 兜底页里的异常回显也是反馈表面(R19):与工作台其它提示条同一个长相 */}
|
||||
<Notice danger
|
||||
description={
|
||||
<Typography.Text type="secondary">
|
||||
兜底页由 ErrorBoundary 渲染;具体堆栈在浏览器控制台的 [nex] 页面渲染失败。
|
||||
</Typography.Text>
|
||||
}>
|
||||
{(chunk ? '分包加载失败' : '渲染异常') + ':' + (error.message || String(error))}
|
||||
</Notice>
|
||||
</Result>
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,15 @@
|
|||
/**
|
||||
* 全局 Provider:Ant Design 5 的主题与命令式 API 的唯一入口。
|
||||
* 全局 Provider:Ant Design 5 的主题与反馈表面的唯一入口。
|
||||
*
|
||||
* 三件事都在这里,别在页面里重复:
|
||||
* 1) ConfigProvider —— 读 theme store 的 applied(dark/light)切换 antd 算法,
|
||||
* 皮肤全部来自 src/theme/antd.ts,页面里不许出现第二个 ThemeConfig;
|
||||
* 2) <App> —— 提供 message / notification / modal 的 context 实例,
|
||||
* 这样它们也吃同一套主题(直接 import 的静态方法在 antd v5 里会丢主题);
|
||||
* 3) 把 context 实例挂到模块级,让 stores/notice.ts 这类非组件代码也能弹提示。
|
||||
* 2) <App> —— antd 的 cssVar 落点(它渲染的 .ant-app 带着主题变量类);
|
||||
* 3) 反馈表面的两个宿主 <ToastHost/> 与 <ConfirmHost/>。
|
||||
*
|
||||
* 反馈为什么挂在这里而不是 App.tsx(2026-11 第十三轮):吐司队列与确认框是**全局**的,
|
||||
* 而 App.tsx 只画工作台——登录页这类 chromeless 页面走的是另一棵子树。
|
||||
* 挂在这一层,两边共用同一条队列、同一张确认框,登录失败的提示也才是同一个长相。
|
||||
*
|
||||
* cssVar 打开后 antd 会把 token 落成 --ant-* 变量,自绘区域(时间线、素材墙、灯箱)
|
||||
* 与 styles/app.css 直接读这些变量,和控件共用一把尺子。
|
||||
|
|
@ -19,7 +22,7 @@
|
|||
* 让 antd 也进层(层序见 styles/index.css 的 @layer 声明:utilities 在最后),
|
||||
* 这类「探针不报错、页面却是坏的」的坑一次性填掉。
|
||||
*/
|
||||
import { useEffect, type ReactNode } from 'react'
|
||||
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'
|
||||
|
|
@ -27,30 +30,11 @@ import dayjs from 'dayjs'
|
|||
import 'dayjs/locale/zh-cn'
|
||||
import { buildAntdTheme } from '../theme/antd'
|
||||
import { useThemeStore, type ThemeMode } from '../stores/theme'
|
||||
import { ConfirmHost } from '../components/ui/Confirm'
|
||||
import { ToastHost } from '../components/ui/Toast'
|
||||
|
||||
dayjs.locale('zh-cn')
|
||||
|
||||
/** <App> 提供的命令式实例;组件外用 notify() / confirmAction() 走这两个对象 */
|
||||
let messageApi: any = null
|
||||
let notificationApi: any = null
|
||||
let modalApi: any = null
|
||||
|
||||
export const antdApi = {
|
||||
get message() { return messageApi },
|
||||
get notification() { return notificationApi },
|
||||
get modal() { return modalApi }
|
||||
}
|
||||
|
||||
function BindAntdApi() {
|
||||
const app = AntdApp.useApp()
|
||||
useEffect(() => {
|
||||
messageApi = app.message
|
||||
notificationApi = app.notification
|
||||
modalApi = app.modal
|
||||
}, [app])
|
||||
return null
|
||||
}
|
||||
|
||||
export function ThemeProviders({ children }: { children: ReactNode }) {
|
||||
const applied = useThemeStore((s) => s.applied) as ThemeMode
|
||||
return (
|
||||
|
|
@ -66,8 +50,10 @@ export function ThemeProviders({ children }: { children: ReactNode }) {
|
|||
getPopupContainer={(node) => (node?.closest('.ant-drawer-body, .ant-modal-body') as HTMLElement) || document.body}
|
||||
>
|
||||
<AntdApp>
|
||||
<BindAntdApi />
|
||||
{children}
|
||||
{/* 反馈表面的两个宿主:吐司在右下角、确认框居中,都在主题子树之内 */}
|
||||
<ToastHost />
|
||||
<ConfirmHost />
|
||||
</AntdApp>
|
||||
</ConfigProvider>
|
||||
</StyleProvider>
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import {
|
|||
viewedVersion
|
||||
} from '../../stores/preview'
|
||||
import { Button, MUTED, Tag } from '../ui'
|
||||
import { confirmAction } from '../../stores/confirm'
|
||||
import { IconClose, IconDelete, IconEye, IconStar } from '../icons'
|
||||
/** 新版本在上,和下拉里的顺序一致 */
|
||||
function rowsOf(item: MediaItem): MediaVersion[] {
|
||||
|
|
@ -55,12 +56,18 @@ export function VersionPanel({ onClose }: { onClose: () => void }) {
|
|||
void setCurrentVersion(row.version_no)
|
||||
}
|
||||
|
||||
function remove(row: MediaVersion) {
|
||||
/* 删除版本是不可逆的:问话(删哪个)与后果(文件删不删、当前版本怎么办)
|
||||
分两层写进站内确认框,不再挤成原生 confirm 的一整句(R19)。 */
|
||||
async function remove(row: MediaVersion) {
|
||||
if (onlyOne) return
|
||||
const fileNote = row.exists === false ? '该版本的文件已经不在磁盘上,这次只清理记录。' : '该版本的记录与文件会一并删除,不可恢复。'
|
||||
const tail = row.current || row.version_no === currentNo ? '它正是当前默认版本,删除后自动回落到剩余最新版本。' : ''
|
||||
const ask = `确认删除「${item!.title}」的 v${row.version_no}?${fileNote}${tail}`
|
||||
if (window.confirm(ask)) void deleteVersion(row.version_no)
|
||||
const ok = await confirmAction({
|
||||
title: `删除「${item!.title}」的 v${row.version_no}?`,
|
||||
desc: fileNote + tail,
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (ok) void deleteVersion(row.version_no)
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -0,0 +1,80 @@
|
|||
/**
|
||||
* 确认框:破坏性操作的第二道闸,自绘表面,**不用 `window.confirm`**(2026-11 第十三轮)。
|
||||
*
|
||||
* 症状(用户原话「整体修改系统中所有提示窗、完成后的反馈 tips 等。不要使用默认组件」):
|
||||
* 全站 13 处 `window.confirm()` 弹的是**操作系统**的窗口——
|
||||
* ① 主题、字号、按钮、语言全由 Chrome/macOS 决定,深色工作台里突然插进一块白色系统框;
|
||||
* ② 只有一行灰字 + 两颗灰按钮,「删除不可恢复」和「继续切换」长得一模一样;
|
||||
* ③ 问话与后果挤成一句("删除 v3「正片」?\n只删除编排记录,已导出成片不受影响。"),
|
||||
* 原生框把它当一行文本折行,`\n` 甚至只是某些浏览器才认的运气;
|
||||
* ④ 同步阻塞:脚本停在原地,进度条、轮询、动画全部冻住。
|
||||
* 做法:状态在 `stores/confirm.ts`(`confirmAction(): Promise<boolean>`),皮肤在这里——
|
||||
* 浮层唯一实现 kit `Modal`(遮罩 / Esc / 焦点陷阱 / 滚动锁交给 antd,与抽屉同源)
|
||||
* + 32px 语义色块 + 「一句问话 / 一层后果」两行文案 + 图标按钮,
|
||||
* 底部沿用全站口径「取消 → 主行动」右对齐、最多一颗 primary、危险档 primary danger。
|
||||
* 为什么回车=确认而 Esc=取消:原生 confirm 就是这个映射,肌肉记忆不用重建;
|
||||
* 但焦点落在按钮上时不许接管(否则 Tab 到「取消」按回车会误删)。
|
||||
* 为什么整站只可能有一张:`confirmAction` 在已有确认框时直接 resolve(false),
|
||||
* 键盘连按不会排出一串窗口(原生 confirm 会)。
|
||||
*/
|
||||
import { useEffect } from 'react'
|
||||
import { useConfirmStore } from '../../stores/confirm'
|
||||
import { Button } from './Button'
|
||||
import { Modal } from './Overlay'
|
||||
import { TONE_TINT, type FeedbackTone } from './tone'
|
||||
import { IconCheck, IconClose, IconInfo, IconWarn } from '../icons'
|
||||
|
||||
/** 确认框的三档语气 → 反馈语义(色块与色值仍从 tone.tsx 那张唯一的表里取) */
|
||||
const CONFIRM_TONE: Record<'danger' | 'warn' | 'info', FeedbackTone> = {
|
||||
danger: 'bad', warn: 'warn', info: 'info'
|
||||
}
|
||||
|
||||
/** 挂在 app/providers.tsx 上(唯一一处),任何页面调用 confirmAction 都由这一颗应答 */
|
||||
export function ConfirmHost() {
|
||||
const req = useConfirmStore((s) => s.req)
|
||||
const answer = useConfirmStore((s) => s.answer)
|
||||
const open = !!req
|
||||
const o = req?.options
|
||||
|
||||
/* 回车 = 确认。挂在 document 上而不是内容区上:antd 打开模态时把焦点落在
|
||||
`.ant-modal`(tabIndex=-1)那层,keydown 只会向上冒泡,落在 body 上的监听收不到。 */
|
||||
useEffect(() => {
|
||||
if (!open) return
|
||||
const onKey = (e: KeyboardEvent) => {
|
||||
if (e.key !== 'Enter' || e.isComposing) return
|
||||
/* 焦点在按钮 / 输入框上时交给它们自己处理(Tab 到「取消」按回车不该确认) */
|
||||
const t = e.target as HTMLElement | null
|
||||
if (t && (t.tagName === 'BUTTON' || t.tagName === 'INPUT' || t.tagName === 'TEXTAREA'
|
||||
|| t.tagName === 'SELECT' || t.isContentEditable)) return
|
||||
e.preventDefault()
|
||||
answer(true)
|
||||
}
|
||||
document.addEventListener('keydown', onKey)
|
||||
return () => document.removeEventListener('keydown', onKey)
|
||||
}, [open, answer])
|
||||
|
||||
const tone = CONFIRM_TONE[o?.tone ?? 'danger']
|
||||
return (
|
||||
<Modal open={open} onClose={() => answer(false)} width={460} className="nex-confirm"
|
||||
label={typeof o?.title === 'string' ? o.title : '请确认操作'}
|
||||
footer={<>
|
||||
<Button icon={<IconClose />} onClick={() => answer(false)}>{o?.cancelText ?? '取消'}</Button>
|
||||
<Button type="primary" danger={o?.tone !== 'info'} icon={o?.confirmIcon ?? <IconCheck />}
|
||||
onClick={() => answer(true)}>{o?.confirmText ?? '确定'}</Button>
|
||||
</>}>
|
||||
<div className="nex-confirm-body" data-tone={o?.tone ?? 'danger'}>
|
||||
<span className="nex-confirm-mark" aria-hidden
|
||||
style={{ ['--nex-mark-tint' as string]: TONE_TINT[tone] }}>
|
||||
{/* 问话用的图形:危险与注意都是「先停下看一眼」,信息档才是普通的 i */}
|
||||
{tone === 'info' ? <IconInfo /> : <IconWarn />}
|
||||
</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="nex-confirm-title">{o?.title}</div>
|
||||
{o?.desc && <div className="nex-confirm-desc">{o.desc}</div>}
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)
|
||||
}
|
||||
|
||||
export default ConfirmHost
|
||||
|
|
@ -2,6 +2,7 @@ import { useId, type ReactNode } from 'react'
|
|||
import { Drawer as AntDrawer, Modal as AntModal } from 'antd'
|
||||
import { cn } from '../../lib/cn'
|
||||
import { Button } from './Button'
|
||||
import { ActionGroup } from './Controls'
|
||||
import { IconClose } from '../icons'
|
||||
/**
|
||||
* 浮层:Ant Design 5 Drawer / Modal 的唯一封装。
|
||||
|
|
@ -26,7 +27,20 @@ export const DRAWER_TITLE = 'block text-lg font-bold min-w-0'
|
|||
* (它用 DRAWER_* 自拼外壳),探针原来的兜底 scope 是 `main`,而 `<aside>` 在 `main`
|
||||
* 外面——「量过了」其实是把页面又量了一遍,检查器里的 27 个字段一条没测。 */
|
||||
export const DRAWER_BODY = 'nex-drawer-body min-w-0 [scrollbar-gutter:stable]'
|
||||
/** 吸底动作条:flex-wrap 不能省,窄屏下按钮挤成一排是溢出,不是折行 */
|
||||
/**
|
||||
* 吸底动作条:flex-wrap 不能省,窄屏下按钮挤成一排是溢出,不是折行。
|
||||
*
|
||||
* 第 17 轮:这一条从「裸 flex」交给 kit 的 <ActionGroup>(同一套自动竖排量法)。
|
||||
* 症状:抽屉底部是 btnrowcheck 的盲区——它量 `.nex-action-group`,而浮层底部
|
||||
* 一直是这条 utility 类,所以「同一组按钮被折成 2+1」在浮层里从来没被量过。
|
||||
* 实测 430 档「项目概况」抽屉底部 3 颗(返回项目总览/归档项目/删除项目,宽 398)
|
||||
* 折成 2+1,进入删除确认态 4 颗折成 2+2。
|
||||
* 修法不是再加一档断点:ActionGroup 量的是**这一组自己的自然宽 vs 底部条的可用宽**
|
||||
* (浮层宽度由页面传 `min(620px, 100vw-32px)`,跟视口断点不成比例,视口档量不准),
|
||||
* 放不下就整组竖排等宽——和页头、卡里动作行同一个口径。
|
||||
* `nex-sheet-actions` 是闸门落点:footer 从此既能被 btnrowcheck(ActionGroup 类名)
|
||||
* 认出来,也能被 footercheck 按「浮层底部」这一族单独开层量。
|
||||
*/
|
||||
/* ══ 浮层底部动作条的统一口径(2026-11 按钮重设计)═══════════════════════════
|
||||
右对齐,从左到右 = 辅助动作 → 取消 → 主行动。这就是 antd <Modal> 自带页脚
|
||||
的顺序(Cancel 在 Ok 左边),抽屉没有自带顺序,所以在这里对齐它:
|
||||
|
|
@ -37,7 +51,7 @@ export const DRAWER_BODY = 'nex-drawer-body min-w-0 [scrollbar-gutter:stable]'
|
|||
· 破坏性确认 = type="primary" danger,不是 type="text" danger
|
||||
(取消是描边按钮,确认却是纯文字,视觉权重是反的)。
|
||||
要把辅助动作钉在最左,给它 mr-auto(别再用 <span className="ml-auto"/> 撑缝)。 */
|
||||
export const DRAWER_ACTIONS = 'flex flex-wrap items-center gap-2 min-w-0 justify-end '
|
||||
export const DRAWER_ACTIONS = 'nex-sheet-actions flex flex-wrap items-center gap-2 min-w-0 justify-end '
|
||||
|
||||
/**
|
||||
* 浮层右上角的 ✕:标准控件组里的 ghost 方形按钮(与任何一颗行内图标钮同档)。
|
||||
|
|
@ -106,7 +120,7 @@ export function Drawer({ open, onClose, title, sub, children, actions, width, cl
|
|||
</div>
|
||||
}
|
||||
extra={<CloseButton onClose={onClose} label={typeof label === 'string' ? label : '关闭'} />}
|
||||
footer={actions ? <div className={DRAWER_ACTIONS}>{actions}</div> : null}
|
||||
footer={actions ? <ActionGroup className={DRAWER_ACTIONS}>{actions}</ActionGroup> : null}
|
||||
styles={{ footer: { background: 'var(--ant-color-bg-elevated)', borderColor: 'var(--ant-color-split)', padding: '12px 20px' } }}
|
||||
>
|
||||
<div className={DRAWER_BODY}>{children}</div>
|
||||
|
|
@ -115,7 +129,7 @@ export function Drawer({ open, onClose, title, sub, children, actions, width, cl
|
|||
}
|
||||
|
||||
/** 居中模态:只放一两句确认文案 + 两个动作;长表单请用 Drawer */
|
||||
export function Modal({ open, onClose, title, children, footer, width = 560, closeOnBackdrop = true, label }: {
|
||||
export function Modal({ open, onClose, title, children, footer, width = 560, closeOnBackdrop = true, label, className }: {
|
||||
open: boolean
|
||||
onClose: () => void
|
||||
title?: ReactNode
|
||||
|
|
@ -124,11 +138,17 @@ export function Modal({ open, onClose, title, children, footer, width = 560, clo
|
|||
width?: number
|
||||
closeOnBackdrop?: boolean
|
||||
label?: string
|
||||
/**
|
||||
* 追加到 `.ant-modal` 根节点上的皮肤落点(2026-11 第十三轮):
|
||||
* 确认框要按语气(危险 / 注意)换一圈描边与色块,而这种「只有浮层自己用得上」的
|
||||
* 皮肤不该塞进通用 `.nex-modal`——给一个 class 位,皮肤写在 styles/app.css。
|
||||
*/
|
||||
className?: string
|
||||
}) {
|
||||
const { titleId } = useNames()
|
||||
return (
|
||||
<AntModal
|
||||
className="nex-modal"
|
||||
className={cn('nex-modal', className)}
|
||||
open={open}
|
||||
onCancel={onClose}
|
||||
width={width}
|
||||
|
|
@ -136,7 +156,7 @@ export function Modal({ open, onClose, title, children, footer, width = 560, clo
|
|||
closable={false}
|
||||
maskClosable={closeOnBackdrop}
|
||||
/* 页脚顺序见 DRAWER_ACTIONS 上方注释:DOM 顺序就是视觉顺序,取消在前、主行动在最后。 */
|
||||
footer={footer ? <div className={DRAWER_ACTIONS}>{footer}</div> : null}
|
||||
footer={footer ? <ActionGroup className={DRAWER_ACTIONS}>{footer}</ActionGroup> : null}
|
||||
title={title
|
||||
? <span id={titleId} className="block min-w-0" title={typeof label === 'string' ? label : undefined}>{title}</span>
|
||||
: undefined}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
/**
|
||||
* 卡片体系:Ant Design 5 Card / Statistic / Row·Col / Alert / Empty / Progress 的唯一封装。
|
||||
* 卡片体系:Ant Design 5 Card / Statistic / Row·Col / Empty / Progress 的唯一封装。
|
||||
*
|
||||
* 症状(2026-11 第二轮重写的对象):第一轮只把**原子控件**换成了 antd,
|
||||
* 「有边框的内容块」仍然是自绘 <section> + Tailwind 类,标题行、指标卡、
|
||||
|
|
@ -8,7 +8,8 @@
|
|||
* 做法:**布局也交给 antd**。Panel=Card(卡头用 Card 自己的 title/extra)、
|
||||
* Stat=Card+Statistic、Grid/StatGrid=Row+Col(断点用 antd Grid 的 xs…xxl)、
|
||||
* Info=Descriptions(只读回显:标签列 + 值列,替代「灰盒 + 标签在上」那种假输入框)、
|
||||
* Notice=Alert、Empty=Empty、ProgressBar=Progress、Divider=Divider。
|
||||
* Notice 与 Block 共用 R16.3 那把语义底纹尺子(2026-11 第十三轮起不再借 antd Alert 的皮肤)、
|
||||
* Empty=Empty、ProgressBar=Progress、Divider=Divider。
|
||||
* 页面继续写 <Panel><PanelHead …/>正文</Panel>:Panel 会把作为第一个子节点的
|
||||
* PanelHead **吞进 Card 的 title/extra**,所以 52 处调用一行不用改,
|
||||
* 卡头却已经是真正的 antd 卡头(分隔线、15px 标题、右端 extra)。
|
||||
|
|
@ -18,12 +19,17 @@
|
|||
*/
|
||||
import { Children, isValidElement, type CSSProperties, type ReactNode } from 'react'
|
||||
import {
|
||||
Alert, Card, Descriptions, Divider as AntDivider, Empty as AntEmpty, Flex,
|
||||
Progress, Row, Spin, Statistic, Typography
|
||||
Card, Descriptions, Divider as AntDivider, Empty as AntEmpty, Flex,
|
||||
/* 本文件下方自己 export 了一个 <Grid>(栅格封装)——antd 的 Grid 必须起别名:
|
||||
同名声明会顶掉 import 绑定,AntGrid.useBreakpoint() 静默变成 undefined,
|
||||
整页撞进 ErrorBoundary。(Divider / Empty 起别名是同一个原因)*/
|
||||
Grid as AntGrid, Progress, Row, Spin, Statistic, Typography
|
||||
} from 'antd'
|
||||
import { cn } from '../../lib/cn'
|
||||
import { IconExternal, IconLoading } from '../icons'
|
||||
import { IconClose, IconExternal, IconLoading } from '../icons'
|
||||
import { Button } from './Button'
|
||||
import { Dense } from './Controls'
|
||||
import { NOTICE_TONE, TONE_ICON, TONE_TINT } from './tone'
|
||||
import { colSpans, toCols, type GridCollapse, type GridStep, type StatStep } from './grid'
|
||||
|
||||
/** Panel 认得出的 PanelHead 形状(Panel 用它拼 Card 的 title/extra) */
|
||||
|
|
@ -75,6 +81,20 @@ export function Panel({ children, className, style, pad = true, title, sub, extr
|
|||
const cardExtra = rawExtra
|
||||
? <Flex wrap align="center" justify="flex-end" gap={8} className="min-w-0 max-w-full">{rawExtra}</Flex>
|
||||
: undefined
|
||||
/*
|
||||
* 症状(第 17 轮):手机档卡头那一行只有 ~292px,标题和右端动作抢宽度,
|
||||
* `.ant-card-head-title` 是 `flex:1 1 0`——**装不下时 shrink 的是标题**,
|
||||
* 于是全部由「标题断词」买单:430 档 /assets 把「人物母版」切成
|
||||
* 「人物母 / 版」两行,430/480 档 /projects/:id/dispatch 把
|
||||
* 「模型配置已迁移至独立管理中心」断成两行。上面那条 flex-wrap 救不了它:
|
||||
* 折行判定看的是 flex-basis(0%),extra 永远被认为放得下。
|
||||
* 做法:<576(antd 的 sm 以下)整块换行——给 Card 挂 `nex-head-stack`,
|
||||
* CSS 让 extra 自己占满一行(flex:1 1 100%),标题于是拿到整行宽度。
|
||||
* 该换行的是**整块动作**,不是标题里的字(规范 §7 同一句话的另一半)。
|
||||
* 为什么用 Grid.useBreakpoint 而不是 @media:站内除 reduced-motion 没有 @media,
|
||||
* 窄屏一律走 antd 断点(AppHeader / ProjectBriefDrawer 同一写法)。
|
||||
* 为什么写在 kit:Panel 是全站唯一卡头出口(52 处调用共用),页面不该各自判断屏宽。
|
||||
*/
|
||||
const hasBody = body.some((n) => n !== null && n !== undefined && n !== false && n !== '')
|
||||
const headNode = (cardTitle || cardSub)
|
||||
? (
|
||||
|
|
@ -86,8 +106,10 @@ export function Panel({ children, className, style, pad = true, title, sub, extr
|
|||
</Flex>
|
||||
)
|
||||
: undefined
|
||||
const stackHead = AntGrid.useBreakpoint().sm === false && !!(headNode && cardExtra)
|
||||
|
||||
return (
|
||||
<Card className={cn('nex-panel', className)} style={style} title={headNode} extra={cardExtra} size={size}
|
||||
<Card className={cn('nex-panel', stackHead && 'nex-head-stack', className)} style={style} title={headNode} extra={cardExtra} size={size}
|
||||
/* 没有正文的卡(只有卡头那一排的工具条卡)不能留 body 的 24px 内边距,
|
||||
否则卡片底下凭空多出一截 48px 的空块。 */
|
||||
styles={(pad && hasBody) ? undefined : { body: { padding: 0 } }}>
|
||||
|
|
@ -320,24 +342,50 @@ export function Spinner({ className }: { className?: string }) {
|
|||
}
|
||||
|
||||
/**
|
||||
* 提示条:antd Alert。成功/普通信息用 info(站内 colorInfo=主色),错误用 error。
|
||||
* 只放一句人话,长说明收进抽屉(G2)。
|
||||
* 提示条:自绘表面,**不用 antd `Alert`**(2026-11 第十三轮)。
|
||||
*
|
||||
* 症状(用户原话「整体修改系统中所有提示窗、完成后的反馈 tips 等。不要使用默认组件」):
|
||||
* 这一层原来是 antd Alert 的直封装,于是站内同时存在两套「信息块长相」——
|
||||
* 同一页里 <Block> 系列有语义描边 + 语义底纹 + 圆角 + 内边距档位,
|
||||
* 而 Alert 是 antd 自带的那套(浅色档还带着它自己的 closable 图标位置),
|
||||
* 并且它**没有 action 位**:App.tsx 那条「后端连接异常」要挂「重试」按钮,
|
||||
* 只能绕过 kit 直接 import antd 的 Alert。
|
||||
* 做法:读 R16.3 那把唯一的尺子 `BLOCK_TONE`(语义底纹 + 语义描边),
|
||||
* 左侧色块用色块族(20px 档,与概况抽屉的七站行同一尺寸),
|
||||
* 两行文案 = `children`(一句人话)+ `description`(明细 / 善后),
|
||||
* 右侧新增 `action` 位(重试、去设置这种善后按钮),`onClose` 走标准图标按钮。
|
||||
* props 与原来完全一致(含 antd 词汇的 `type`),30 处调用点零改动。
|
||||
* 为什么保留 antd 的 type 词汇:`type="success" | "error"` 这套名字已经写在 30 处调用点里,
|
||||
* 它是**语义**而不是皮肤;`NOTICE_TONE` 把它翻成站内语气,皮肤换多少轮都不用碰页面。
|
||||
*/
|
||||
export function Notice({ children, description, danger, className, onClose, type }: {
|
||||
export function Notice({ children, description, danger, className, onClose, type, action }: {
|
||||
children: ReactNode; danger?: boolean; className?: string; onClose?: () => void
|
||||
/**
|
||||
* 第二层说明(与 antd Alert 同名):`children` 是「一句人话」的标题,
|
||||
* 多条明细 / 善后按钮属于正文,塞进 children 会让 Alert 只有一层粗体、
|
||||
* 多条明细 / 善后按钮属于正文,塞进 children 会让整块只有一层粗体、
|
||||
* 明细和按钮跟着一起加粗,于是页面又自己写 <b> + <p> 造第二层。
|
||||
*/
|
||||
description?: ReactNode
|
||||
/** Alert 的四档语义;`danger` 是站内先写下的 error 简写,两者等价 */
|
||||
type?: 'info' | 'success' | 'warning' | 'error'
|
||||
/** 右侧善后动作(重试 / 去设置);一颗 Button 或一组按钮,不放正文 */
|
||||
action?: ReactNode
|
||||
}) {
|
||||
if (!children) return null
|
||||
const tone = NOTICE_TONE[type ?? (danger ? 'error' : 'info')]
|
||||
return (
|
||||
<Alert className={cn('mb-4', className)} type={type ?? (danger ? 'error' : 'info')} showIcon
|
||||
message={children} description={description} closable={!!onClose} onClose={onClose} />
|
||||
<Flex align="start" gap={10} role={tone === 'bad' || tone === 'warn' ? 'alert' : undefined}
|
||||
className={cn('nex-notice mb-4', BLOCK_TONE[tone], className)}>
|
||||
<span className="nex-notice-mark" aria-hidden
|
||||
style={{ ['--nex-mark-tint' as string]: TONE_TINT[tone] }}>{TONE_ICON[tone]}</span>
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="nex-notice-title">{children}</div>
|
||||
{description && <div className="nex-notice-desc">{description}</div>}
|
||||
</div>
|
||||
{action && <div className="nex-notice-action flex flex-wrap items-center gap-2">{action}</div>}
|
||||
{onClose && <Button type="text" size="sm" className="nex-notice-close" aria-label="关闭提示"
|
||||
title="关闭提示" icon={<IconClose />} onClick={onClose} />}
|
||||
</Flex>
|
||||
)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,100 @@
|
|||
/**
|
||||
* 吐司(操作完成后的即时反馈):自绘表面,**不用 antd `<message>`**(2026-11 第十三轮)。
|
||||
*
|
||||
* 症状(用户原话「整体修改系统中所有提示窗、完成后的反馈 tips 等。不要使用默认组件」):
|
||||
* antd `<message>` 是页面顶部正中一颗纯黑药丸,只有「图形 + 一行白字」:
|
||||
* 长报错读不完、悬停不暂停、重复推送叠成一串一模一样的胶囊,
|
||||
* 而且它是全站唯一没有描边 / 没有色块 / 没有底纹的块,看着像浏览器自己的提示。
|
||||
* 做法:右下角堆叠卡片,皮肤与站内其它信息块同族(`.nex-mark` 色块族 + antd 语义 token):
|
||||
* ① 第一行 = 语义色块图标 + 一句结论(+ 重复次数 ×N),第二行 = 后果 / 明细;
|
||||
* ② 底部一条倒计时条,鼠标悬停或键盘聚焦时**整条暂停**(读得完为止),移开继续;
|
||||
* ③ 一屏最多 5 颗,新的从下面进、把旧的往上顶;关闭只有关闭键一条路(不吞点击);
|
||||
* ④ 队列在 `stores/notice.ts`,`notify()` / `notifyBad()` 的签名不变,63 处调用点零改动。
|
||||
* 为什么右下角而不是顶部居中:顶部正中压住的正是门牌与主操作(用户上一轮刚要求
|
||||
* 「右侧的主功能入口要对齐」),反馈不该把刚点的那颗按钮盖掉;
|
||||
* 右下角在视口边缘,不与会话里的任何一块正文争位置。
|
||||
* 为什么自己维护倒计时而不是 CSS `animation-delay` 一挂了事:暂停 / 恢复要同时作用在
|
||||
* 「进度条」和「真的关闭」两件事上,两者必须同源,否则条停了、卡片却消失了。
|
||||
*/
|
||||
import { useEffect, useRef, useState } from 'react'
|
||||
import { cn } from '../../lib/cn'
|
||||
import { useNoticeStore, type ToastItem } from '../../stores/notice'
|
||||
import { TONE_ICON, TONE_LABEL, TONE_TINT } from './tone'
|
||||
import { Button } from './Button'
|
||||
import { IconChevronRight, IconClose } from '../icons'
|
||||
|
||||
/** 挂在 app/providers.tsx 上(唯一一处),登录页与工作台共用同一条队列 */
|
||||
export function ToastHost() {
|
||||
const items = useNoticeStore((s) => s.items)
|
||||
const dismiss = useNoticeStore((s) => s.dismiss)
|
||||
return (
|
||||
/* 容器常驻 + aria-live:朗读器要先「在场」才会念出后来插入的那颗 */
|
||||
<div className="nex-toast-region" role="region" aria-label="操作提示" aria-live="polite">
|
||||
{items.map((t) => <ToastCard key={t.id} item={t} onClose={() => dismiss(t.id)} />)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
function ToastCard({ item, onClose }: { item: ToastItem; onClose: () => void }) {
|
||||
const [paused, setPaused] = useState(false)
|
||||
const left = useRef(item.duration * 1000)
|
||||
const mark = useRef(performance.now())
|
||||
|
||||
/* 同一条消息被再次推送(去重成 ×N):倒计时拨回满格,让人重新读一遍 */
|
||||
useEffect(() => {
|
||||
left.current = item.duration * 1000
|
||||
mark.current = performance.now()
|
||||
}, [item.stamp, item.duration])
|
||||
|
||||
/* 真的关闭:暂停时把已走的时间结算掉,恢复时从剩余时间继续 */
|
||||
useEffect(() => {
|
||||
if (paused || item.duration <= 0) return
|
||||
const timer = window.setTimeout(onClose, Math.max(0, left.current))
|
||||
return () => {
|
||||
window.clearTimeout(timer)
|
||||
left.current = Math.max(0, left.current - (performance.now() - mark.current))
|
||||
}
|
||||
}, [paused, item.duration, item.stamp, onClose])
|
||||
|
||||
/* 暂停 / 恢复的那一刻重设基准点(必须排在上面那条 effect 之后声明) */
|
||||
useEffect(() => { mark.current = performance.now() }, [paused])
|
||||
|
||||
const permanent = item.duration <= 0
|
||||
return (
|
||||
<div className={cn('nex-toast', paused && 'is-paused')} data-tone={item.tone}
|
||||
/* 失败与注意是打断性消息,用 alert;成功与信息进行流即可 */
|
||||
role={item.tone === 'bad' || item.tone === 'warn' ? 'alert' : 'status'}
|
||||
onMouseEnter={() => setPaused(true)} onMouseLeave={() => setPaused(false)}
|
||||
onFocus={() => setPaused(true)} onBlur={() => setPaused(false)}>
|
||||
<span className="nex-toast-mark" aria-hidden style={{ ['--nex-mark-tint' as string]: TONE_TINT[item.tone] }}>
|
||||
{TONE_ICON[item.tone]}
|
||||
</span>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="nex-toast-title">
|
||||
{item.title}
|
||||
{item.count > 1 && <span className="nex-toast-count">×{item.count}</span>}
|
||||
</div>
|
||||
{item.desc && <div className="nex-toast-desc">{item.desc}</div>}
|
||||
{item.action && (
|
||||
<Button type="link" size="sm" className="!px-0" icon={<IconChevronRight />} iconPosition="end"
|
||||
onClick={() => { item.action!.onClick(); onClose() }}>
|
||||
{item.action.label}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
|
||||
<Button type="text" size="sm" className="nex-toast-close" aria-label={`关闭${TONE_LABEL[item.tone]}提示`}
|
||||
title={`关闭提示(悬停可暂停倒计时)`} icon={<IconClose />} onClick={onClose} />
|
||||
|
||||
{/* 倒计时条:宽度 = 剩余时间,悬停暂停与 JS 同源(.is-paused 把动画按停) */}
|
||||
{!permanent && (
|
||||
<span className="nex-toast-progress" aria-hidden
|
||||
style={{ ['--nex-toast-ms' as string]: `${item.duration}s`,
|
||||
['--nex-mark-tint' as string]: TONE_TINT[item.tone] }} />
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default ToastHost
|
||||
|
|
@ -15,3 +15,7 @@ export * from './IconText'
|
|||
export * from './Tile'
|
||||
export * from './Slider'
|
||||
export * from './grid'
|
||||
/* 反馈四级表面(R19):语义表 → 提示条(Panel 里的 Notice)→ 吐司 → 确认框 */
|
||||
export * from './tone'
|
||||
export * from './Toast'
|
||||
export * from './Confirm'
|
||||
|
|
|
|||
|
|
@ -0,0 +1,48 @@
|
|||
/**
|
||||
* 反馈色调:吐司 / 确认框 / 提示条共用的**唯一一张**语义表(2026-11 第十三轮)。
|
||||
*
|
||||
* 症状:反馈类表面原先各说各话——antd `<message>` 只有「绿勾小胶囊 / 红叉小胶囊」,
|
||||
* `window.confirm` 连颜色都没有(浏览器原生灰框,字体、按钮、层级全是系统的),
|
||||
* `Notice` 是 antd Alert 的直封装(四档 type 自带一套图标)。
|
||||
* 同一个「删除失败」在一屏里可能出现三种长相。
|
||||
* 做法:把「一个反馈语气该是什么颜色、什么图形」抽成一张表,三个表面都读它:
|
||||
* 色调变量只取 antd 语义 token(`--ant-color-*`,站内唯一色源),
|
||||
* 图形只取 `components/icons` 登记的语义名(R11)。
|
||||
* 底纹与描边不在这里:那套口径由 `Panel.tsx` 的 `BLOCK_TONE` 管(R16.3)。
|
||||
* 为什么不复用 Status.tsx 的 TONE_VARS:那张表服务的是**行内标签**(一颗 6px 圆点),
|
||||
* 语气档位多了 accent / mono 却没有 loading;反馈表面要的是「一句结论 + 一枚图形」,
|
||||
* 尺寸与图形 vocabulary 都不同,硬合成一张表会让两边都不敢改。
|
||||
*/
|
||||
import type { ReactNode } from 'react'
|
||||
import { IconCheck, IconInfo, IconLoading, IconReject, IconWarn } from '../icons'
|
||||
|
||||
/** 反馈语气:成功 / 失败 / 需要注意 / 纯信息 / 进行中 */
|
||||
export type FeedbackTone = 'ok' | 'bad' | 'warn' | 'info' | 'loading'
|
||||
|
||||
/** 色调 → antd 语义色变量(写进 CSS 变量 `--nex-mark-tint`,由 app.css 的色块族上色) */
|
||||
export const TONE_TINT: Record<FeedbackTone, string> = {
|
||||
ok: 'var(--ant-color-success)',
|
||||
bad: 'var(--ant-color-error)',
|
||||
warn: 'var(--ant-color-warning)',
|
||||
info: 'var(--ant-color-info)',
|
||||
loading: 'var(--ant-color-primary)'
|
||||
}
|
||||
|
||||
/** 色调 → 色块里的那枚图形 */
|
||||
export const TONE_ICON: Record<FeedbackTone, ReactNode> = {
|
||||
ok: <IconCheck />,
|
||||
bad: <IconReject />,
|
||||
warn: <IconWarn />,
|
||||
info: <IconInfo />,
|
||||
loading: <IconLoading spin />
|
||||
}
|
||||
|
||||
/** 语气名(aria-label / title 共用,不再逐处手写中文) */
|
||||
export const TONE_LABEL: Record<FeedbackTone, string> = {
|
||||
ok: '成功', bad: '失败', warn: '注意', info: '提示', loading: '进行中'
|
||||
}
|
||||
|
||||
/** 提示条的 antd Alert 词汇 → 站内语气(30 处 `<Notice type=…>` 的写法保持不变) */
|
||||
export const NOTICE_TONE: Record<'info' | 'success' | 'warning' | 'error', FeedbackTone> = {
|
||||
info: 'info', success: 'ok', warning: 'warn', error: 'bad'
|
||||
}
|
||||
|
|
@ -41,6 +41,7 @@ import { MediaPick, MediaRemove, MediaThumb, type MediaRadius } from '../compone
|
|||
import { RecordAudio, type RecordPickMeta } from '../components/media/RecordAudio'
|
||||
import { useAutoRefresh } from '../hooks'
|
||||
import { useRecordingBusy } from '../stores/recording'
|
||||
import { confirmAction } from '../stores/confirm'
|
||||
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, Panel, PanelHead, Row, SearchInput, SectionTitle, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, Value, ViewSwitch } from '../components/ui'
|
||||
import { IconAdd, IconBlocks, IconBolt, IconCheck, IconUpload, IconClose, IconDelete, IconEdit, IconGrid, IconImage, IconLibrary, IconList, IconRobot, IconSound, IconTag, IconUser, IconVoice } from '../components/icons'
|
||||
|
||||
|
|
@ -668,7 +669,12 @@ export default function AssetLibrary() {
|
|||
}
|
||||
|
||||
async function deleteMedia(media: any) {
|
||||
if (!window.confirm(`确认删除「${media.name || media.kind_label}」这个媒体文件?`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `删除「${media.name || media.kind_label}」这个媒体文件?`,
|
||||
desc: '文件本身与库里的记录一并删除,引用它的素材位置会变成缺失,需要重新指定。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
const wasWall = view === 'media'
|
||||
setBusy('删除媒体文件')
|
||||
setError('')
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import {
|
|||
} from '../stores/models'
|
||||
import { useSystemStore } from '../stores/system'
|
||||
import { notify } from '../stores/notice'
|
||||
import { confirmAction } from '../stores/confirm'
|
||||
import { IconAdd, IconChart, IconCheck, IconChevronUp, IconClose, IconDelete, IconFolder, IconImage, IconPlay, IconPlayCircle, IconProjects, IconReload, IconSound } from '../components/icons'
|
||||
/** 新建项目表单:字段名与后端 POST /api/projects 一致,提交时直接展开 */
|
||||
type NewProjectForm = {
|
||||
|
|
@ -303,7 +304,13 @@ export default function Dashboard() {
|
|||
}
|
||||
|
||||
async function removeProject(p: any) {
|
||||
if (!window.confirm(`确认删除项目《${p.name}》?该操作不可恢复。`)) return
|
||||
const ok = await confirmAction({
|
||||
/* 项目名本身就常带《》,这里不再套第二层书名号 */
|
||||
title: `删除项目「${p.name}」?`,
|
||||
desc: '项目内的镜头、时间线与版本记录一并删除,磁盘上的产物文件同时清掉,不可恢复。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
try {
|
||||
await api.del(`/api/projects/${p.id}`, { purge_files: true })
|
||||
await load()
|
||||
|
|
@ -486,11 +493,15 @@ export default function Dashboard() {
|
|||
{ title: '镜头', key: 'shots', width: 112, align: 'right', className: NOWRAP, render: (_: any, p: any) => (
|
||||
<>{p.stats?.shots || 0}<span className={MUTED}> / 合格 {p.stats?.shots_approved || 0}</span></>
|
||||
) },
|
||||
/* 进度一格 = 上下两条:上面一条整宽的条,下面一条百分数。
|
||||
以前两者是同一个 nowrap 单元格里的兄弟行内盒:条占满 100% 之后
|
||||
百分数放不下,整条线被 text-align:right 往左推,数字越出内容盒
|
||||
右缘最多 32px(tableaudit 的「格子内容越界」判据就是为它加的)。 */
|
||||
{ title: '进度', key: 'progress', width: 118, align: 'right', className: NOWRAP, render: (_: any, p: any) => (
|
||||
<>
|
||||
<ProgressBar className="mb-1 w-full" value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
|
||||
<small className={MUTED}>{pct(p.stats?.progress_ratio)}</small>
|
||||
</>
|
||||
<div className="flex min-w-0 flex-col items-stretch gap-1">
|
||||
<ProgressBar value={Math.round((p.stats?.progress_ratio || 0) * 100)} />
|
||||
<small className={cn(MUTED, 'text-right')}>{pct(p.stats?.progress_ratio)}</small>
|
||||
</div>
|
||||
) },
|
||||
{ title: '时长', key: 'duration', width: 78, align: 'right', className: `${NOWRAP} ${MONO}`,
|
||||
render: (_: any, p: any) => `${(p.stats?.planned_duration || 0).toFixed(0)}s` },
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import { cn } from '../lib/cn'
|
|||
import { EyeIcon, SecretInput, Select } from '../components/forms'
|
||||
import { Between, Block, Button, CardActions, Check, Chip, ChipBar, Ctlbar, Dense, Drawer, Empty, Field, FieldBlock, FormGrid, FormRow, Grid, IconText, Input, Layout, LinkButton, MONO, MUTED, Notice, NumberInput, PageHead, Panel, PanelHead, Row, SearchInput, SectionTitle, Slider, Spinner, Stat, StatGrid, Tabs, Tag, TagGroup, TextArea, Tile, Value } from '../components/ui'
|
||||
import { useAuthStore } from '../stores/auth'
|
||||
import { confirmAction } from '../stores/confirm'
|
||||
import { useProjectStore } from '../stores/project'
|
||||
import { IconAdd, IconBolt, IconChart, IconCheck, IconChevronUp, IconClose, IconDelete, IconGrid, IconImage, IconNodeIndex, IconParams, IconPlayCircle, IconReload, IconVoice, IconWarn } from '../components/icons'
|
||||
/** /api/providers 还没回来(或后端挂了这个接口)时左栏仍要能渲染 */
|
||||
|
|
@ -451,7 +452,12 @@ export default function ModelCenter() {
|
|||
}
|
||||
|
||||
async function remove(row: any) {
|
||||
if (!window.confirm(`确认删除模型「${row.display_name || row.model}」?`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `删除模型「${row.display_name || row.model}」?`,
|
||||
desc: '这条配置将从平台移除,之后不能再选它发起任务;已经生成的产物不受影响。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
setBusy('删除模型')
|
||||
try {
|
||||
await api.del(`/api/providers/${row.id}`)
|
||||
|
|
|
|||
|
|
@ -12,6 +12,7 @@ import { useAutoRefresh } from '../hooks'
|
|||
import { SecretInput, Select } from '../components/forms'
|
||||
import { ActionGroup, Actions, Badge, Button, Check, Ctlbar, Empty, ErrorText, Field, FieldBlock, FormRow, Heading, Input, Layout, MUTED, MUTED_MONO, Mono, PageHead, PageStack, Panel, PanelHead, SearchInput, Stack, Stat, StatGrid, Sub, Table, Tag, TextArea } from '../components/ui'
|
||||
import { notify, notifyBad } from '../stores/notice'
|
||||
import { confirmAction } from '../stores/confirm'
|
||||
import { roleLabel, useAuthStore } from '../stores/auth'
|
||||
import { IconAdd, IconCheck, IconClock, IconKey, IconLogout, IconStop, IconTeam, IconUser } from '../components/icons'
|
||||
|
||||
|
|
@ -144,7 +145,12 @@ export default function UserAdmin() {
|
|||
|
||||
async function disable() {
|
||||
if (!selected) return
|
||||
if (!window.confirm(`停用「${selected.display_name || selected.username}」?停用后该账号无法登录,历史操作记录仍会保留。`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `停用「${selected.display_name || selected.username}」?`,
|
||||
desc: '停用后该账号无法登录,历史操作记录仍会保留。',
|
||||
tone: 'warn', confirmText: '停用', confirmIcon: <IconStop />
|
||||
})
|
||||
if (!ok) return
|
||||
setBusy('停用账号'); setError('')
|
||||
try {
|
||||
await api.del(`/api/users/${selected.id}`)
|
||||
|
|
@ -156,7 +162,7 @@ export default function UserAdmin() {
|
|||
|
||||
return (
|
||||
<PageStack className="min-w-0">
|
||||
<PageHead title="用户管理" icon={<IconTeam />} />
|
||||
<PageHead title="用户管理" />
|
||||
<ErrorText className="text-xs">{error}</ErrorText>
|
||||
|
||||
{/* 统计卡一共 5 项:给 5 列,别让第 5 张孤零零掉到第二行 */}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ import {
|
|||
import { refresh, useProjectStore } from '../../stores/project'
|
||||
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, Loading, MUTED, MUTED_MONO, MaybeNumberInput, Mono, Notice, NumberInput, PageStack, Panel, PanelHead, Row, Scrim, SearchInput, SectionTitle, Spinner, Status, TAG_DENSE, Table, Tabs, Tag, TagGroup, TextArea, Toolbar, Value, ViewSwitch, cellWrap, type Columns } from '../../components/ui'
|
||||
import { floatingLayerOpen } from '../../lib/layers'
|
||||
|
|
@ -550,8 +551,16 @@ export default function Storyboard() {
|
|||
/* ---------- 选中 / 检查器 ---------- */
|
||||
async function select(id: number, syncUrl = true) {
|
||||
if (!id) return
|
||||
if (id !== live.current.selectedId && live.current.dirty
|
||||
&& !window.confirm('当前镜头有未保存的修改,切换后这些修改会丢失。继续切换?')) return
|
||||
/* 未保存修改的三道闸(切换 / 关闭 / 新增)走站内确认框:问话只留一句,
|
||||
后果写进 desc,主按钮把要做的动作写出来(R19)。 */
|
||||
if (id !== live.current.selectedId && live.current.dirty) {
|
||||
const ok = await confirmAction({
|
||||
title: '切换到别的镜头?',
|
||||
desc: '当前镜头有未保存的修改,切换后这些修改会丢失。',
|
||||
tone: 'warn', confirmText: '继续切换'
|
||||
})
|
||||
if (!ok) return
|
||||
}
|
||||
if (syncUrl && id !== live.current.selectedId) {
|
||||
setParams((prev) => {
|
||||
const next = new URLSearchParams(prev)
|
||||
|
|
@ -620,8 +629,14 @@ export default function Storyboard() {
|
|||
}
|
||||
|
||||
async function closeInspector() {
|
||||
if (live.current.dirty
|
||||
&& !window.confirm('当前镜头有未保存的修改,关闭后这些修改会丢失。仍然关闭?')) return false
|
||||
if (live.current.dirty) {
|
||||
const ok = await confirmAction({
|
||||
title: '关闭分镜详情?',
|
||||
desc: '当前镜头有未保存的修改,关闭后这些修改会丢失。',
|
||||
tone: 'warn', confirmText: '仍然关闭', confirmIcon: <IconClose />
|
||||
})
|
||||
if (!ok) return false
|
||||
}
|
||||
setSelectedId(null)
|
||||
setDetail(null)
|
||||
setDirty(false)
|
||||
|
|
@ -639,9 +654,15 @@ export default function Storyboard() {
|
|||
setBinding({ ...EMPTY_BINDING, character_ids: [], scene_ids: [] })
|
||||
}
|
||||
|
||||
function startCreate() {
|
||||
if (live.current.dirty
|
||||
&& !window.confirm('当前镜头有未保存的修改,新增镜头会丢掉这些修改。继续新增?')) return
|
||||
async function startCreate() {
|
||||
if (live.current.dirty) {
|
||||
const ok = await confirmAction({
|
||||
title: '新增一个镜头?',
|
||||
desc: '当前镜头有未保存的修改,新增镜头会丢掉这些修改。',
|
||||
tone: 'warn', confirmText: '继续新增', confirmIcon: <IconAdd />
|
||||
})
|
||||
if (!ok) return
|
||||
}
|
||||
setCreating(true)
|
||||
setSelectedId(null)
|
||||
setDetail(null)
|
||||
|
|
@ -734,7 +755,12 @@ export default function Storyboard() {
|
|||
}
|
||||
|
||||
async function removeShot(shot: any) {
|
||||
if (!window.confirm(`确认删除镜头 #${shot.order_index} ${shot.title || ''}?已生成的产物文件保留,但镜头关联会解除。`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `删除镜头 #${shot.order_index}${shot.title ? ' ' + shot.title : ''}?`,
|
||||
desc: '已生成的产物文件保留,但镜头关联会解除,不可恢复。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
if (live.current.selectedId === shot.id) {
|
||||
setDirty(false)
|
||||
await closeInspector()
|
||||
|
|
@ -864,7 +890,14 @@ export default function Storyboard() {
|
|||
async function bulkAction(action: 'duplicate' | 'delete' | 'move' | 'patch', extra: any = {}, label = '') {
|
||||
const ids = [...checked]
|
||||
if (!ids.length) { setError('请先勾选镜头'); return }
|
||||
if (action === 'delete' && !window.confirm(`确认删除选中的 ${ids.length} 个镜头?`)) return
|
||||
if (action === 'delete') {
|
||||
const ok = await confirmAction({
|
||||
title: `删除选中的 ${ids.length} 个镜头?`,
|
||||
desc: '已生成的产物文件保留,但这些镜头的关联会解除,不可恢复。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
}
|
||||
const ok = await run(label || '批量操作',
|
||||
() => api.post(`/api/projects/${projectId}/shots/bulk`, { action, shot_ids: ids, ...extra }))
|
||||
if (ok) { clearCheck(); notify(label ? `${label}完成(${ids.length} 个镜头)` : '批量操作完成') }
|
||||
|
|
|
|||
|
|
@ -15,6 +15,7 @@ import { MediaThumb } from '../../components/media/MediaThumb'
|
|||
import { refresh, useProjectStore } from '../../stores/project'
|
||||
import { useSystemStore } from '../../stores/system'
|
||||
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 } from '../../components/ui'
|
||||
import { IconAdd, IconArrowDown, IconArrowUp, IconCheck, IconChevronDown, IconChevronUp, IconClose, IconDelete, IconEdit, IconEye, IconMic, IconPass, IconSound, IconStar, IconTracks, IconWarn } from '../../components/icons'
|
||||
|
|
@ -361,8 +362,12 @@ export default function Timeline() {
|
|||
const row = selectedVersion
|
||||
if (versions.length <= 1) { notify('只剩一个时间线版本,不能删除;可先构建新版本'); return }
|
||||
const label = row ? `v${row.version}「${row.name}」` : `#${viewVersion}`
|
||||
if (!window.confirm(`删除时间线版本 ${label}?
|
||||
只删除编排记录(片段/字幕/音轨),已导出的成片与镜头产物不受影响。`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `删除时间线版本 ${label}?`,
|
||||
desc: '只删除编排记录(片段 / 字幕 / 音轨),已导出的成片与镜头产物不受影响。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
const id = viewVersion
|
||||
await run('删除版本', () => api.del(`/api/projects/${projectId}/timelines/${id}`), (r) => {
|
||||
const back = r?.current_version ? `,已自动切换到 v${r.current_version}` : ''
|
||||
|
|
@ -377,7 +382,12 @@ export default function Timeline() {
|
|||
}
|
||||
async function removeOne(row: any) {
|
||||
if (versions.length < 2) { notify('至少保留一个时间线版本'); return }
|
||||
if (!window.confirm(`删除时间线版本 v${row.version}「${row.name}」?\n只删除编排记录(片段/字幕/音轨),已导出成片与镜头产物不受影响。`)) return
|
||||
const ok = await confirmAction({
|
||||
title: `删除时间线版本 v${row.version}「${row.name}」?`,
|
||||
desc: '只删除编排记录(片段 / 字幕 / 音轨),已导出的成片与镜头产物不受影响。',
|
||||
tone: 'danger', confirmText: '删除', confirmIcon: <IconDelete />
|
||||
})
|
||||
if (!ok) return
|
||||
await run('删除版本', () => api.del(`/api/projects/${projectId}/timelines/${row.id}`), (r) => {
|
||||
if (viewVersion === row.id) showVersion(null)
|
||||
const back = r?.current_version ? `,已自动切换到 v${r.current_version}` : ''
|
||||
|
|
@ -582,7 +592,11 @@ export default function Timeline() {
|
|||
<Divider />
|
||||
{/* 四个字段一行放完:默认三列会把「结束 ms」单独甩到第二行,
|
||||
起始 / 结束必须并排才看得出是一条区间。 */}
|
||||
<FormRow cols={4}>
|
||||
{/* 两列而不是四列:这块面板在 1280 只有 624 宽,四列每格 148——
|
||||
「所属镜头」的下拉值(镜号 + 镜头名)读不到一半,起始 / 结束也各自缩成一小截。
|
||||
两列 296 一格,起始 / 结束仍然并排(注释里那条要求没变)。
|
||||
控件撑满列宽由 FormRow 自带的表单作用域负责(app.css glue ①)。 */}
|
||||
<FormRow cols={2}>
|
||||
<Field label="所属镜头">
|
||||
<Select ariaLabel="字幕所属镜头" value={cue.shot_id} onChange={(v: any) => patchCue({ shot_id: v ?? '' })}
|
||||
options={[{ value: '', label: '(全局字幕)' }, ...shotOptions]} />
|
||||
|
|
@ -613,8 +627,13 @@ export default function Timeline() {
|
|||
<Panel>
|
||||
<PanelHead
|
||||
title={<span title="「台词语音来源」改动会自动重排时间线:用原声的镜头按画面长度排布,字幕同步改为按片段窗口对齐;设置只作用于当前时间线,出片预设在「导出与成本」页选择。">混音与字幕设置</span>} />
|
||||
<FormRow>
|
||||
<Check checked={setting.duck_bgm} onChange={(v) => patchSetting({ duck_bgm: v })} className="self-center">
|
||||
{/* 这块面板是两栏正文的**侧栏**:1440 实测卡宽 428、1280 只有 368,
|
||||
cols=3 时一格只剩 131 / 111——远低于规范 §9.3「最窄一格 ≥200」,
|
||||
每个标签都折成两三行(配音时自动压低 BGM / 原生音轨增益 dB),
|
||||
下拉的选中值全被裁成「内嵌软字…」「全保留(…」。降成两格(214 / 184)
|
||||
之后标签回到一行,同排那颗裸复选框也才可能对得齐(glue ⑥ 让的是**一行**标签的高度)。 */}
|
||||
<FormRow cols={2}>
|
||||
<Check checked={setting.duck_bgm} onChange={(v) => patchSetting({ duck_bgm: v })}>
|
||||
配音时自动压低 BGM
|
||||
</Check>
|
||||
<Field label="字幕方式" title="内嵌=成片里一条可开关的字幕轨;烧录=字幕直接画进画面">
|
||||
|
|
@ -622,7 +641,7 @@ export default function Timeline() {
|
|||
onChange={(v: any) => patchSetting({ subtitle_mode: v })} options={SUBTITLE_MODES}
|
||||
className="nex-prose-value" />
|
||||
</Field>
|
||||
<Check checked={setting.hold_last_frame} onChange={(v) => patchSetting({ hold_last_frame: v })} className="self-center">
|
||||
<Check checked={setting.hold_last_frame} onChange={(v) => patchSetting({ hold_last_frame: v })}>
|
||||
尾帧补足(避免时长不足)
|
||||
</Check>
|
||||
<Field label="台词语音来源"
|
||||
|
|
@ -647,8 +666,7 @@ export default function Timeline() {
|
|||
{ value: 'off', label: '全部静音(只用平台配音)' }
|
||||
]} />
|
||||
</Field>
|
||||
<Check checked={setting.keep_shot_audio} onChange={(v) => patchSetting({ keep_shot_audio: v })} className="self-center"
|
||||
title="台词走模型原声时必须勾选:镜头产物自带的就是那条人声/音效/环境声轨,关掉等于把它剪掉。切到「平台配音」时建议取消勾选,否则原声人声会和配音叠成双声">
|
||||
<Check checked={setting.keep_shot_audio} onChange={(v) => patchSetting({ keep_shot_audio: v })} title="台词走模型原声时必须勾选:镜头产物自带的就是那条人声/音效/环境声轨,关掉等于把它剪掉。切到「平台配音」时建议取消勾选,否则原声人声会和配音叠成双声">
|
||||
保留镜头自带音轨(模型原生音画同步)
|
||||
</Check>
|
||||
<Field label="原生音轨增益 dB">
|
||||
|
|
@ -732,8 +750,8 @@ export default function Timeline() {
|
|||
<Field label="增益 dB">
|
||||
<NumberInput step={0.5} value={audio.gain_db} onChange={ (v) => patchAudio({ gain_db: v })} />
|
||||
</Field>
|
||||
<Check checked={audio.loop} onChange={(v) => patchAudio({ loop: v })} className="self-center">循环铺满</Check>
|
||||
<Check checked={audio.ducking} onChange={(v) => patchAudio({ ducking: v })} className="self-center">压低 BGM</Check>
|
||||
<Check checked={audio.loop} onChange={(v) => patchAudio({ loop: v })}>循环铺满</Check>
|
||||
<Check checked={audio.ducking} onChange={(v) => patchAudio({ ducking: v })}>压低 BGM</Check>
|
||||
</FormRow>
|
||||
{/* 「上传新文件」与「引用已有素材」是两条选择路径,各占一行;
|
||||
已有素材是**从固定集合里挑一个**,走 OptionGrid 等宽格子(实测 13 个胶囊
|
||||
|
|
|
|||
|
|
@ -0,0 +1,67 @@
|
|||
/**
|
||||
* 破坏性操作的确认框(2026-11 第十三轮):替掉全站 13 处 `window.confirm()`。
|
||||
*
|
||||
* 症状:浏览器原生 confirm 是**操作系统的窗口**——不是站内组件,主题、字号、
|
||||
* 按钮、层级、语言全都由 Chrome/macOS 决定;文案里塞着一整段「会删掉什么、
|
||||
* 影响哪些产物」,一个灰色文本框把它当成一句话显示,破坏性操作和「继续切换」
|
||||
* 长得一模一样,用户只能条件反射点确定。它还是**同步阻塞**的:
|
||||
* 页面脚本停在原地,动画和轮询全冻住。
|
||||
* 做法:`confirmAction(options): Promise<boolean>`,皮肤是 `components/ui/Confirm.tsx`
|
||||
* (浮层唯一实现 kit `Modal` + 语义色块 + 两层文案 + 图标按钮,规范 R19)。
|
||||
* 调用点从 `if (!window.confirm(t)) return` 改成 `if (!(await confirmAction({...}))) return`。
|
||||
* 为什么是 Promise 而不是回调:这 13 处外层函数本来就全是 `async`,
|
||||
* 一行 await 读起来和原来的 if 一样顺,不需要到处铺 `.then()`。
|
||||
* 为什么不叠第二张:键盘上连按 Esc / 回车会把同一颗按钮触发多次,
|
||||
* 原生 confirm 会排出一串窗口。这里已经开着就把后来的请求直接判「取消」,
|
||||
* 画面永远只有一张确认框。
|
||||
*/
|
||||
import type { ReactNode } from 'react'
|
||||
import { create } from 'zustand'
|
||||
|
||||
export type ConfirmOptions = {
|
||||
/** 一句问话:「确认删除镜头 #3 …?」——动词 + 对象,不塞后果 */
|
||||
title: string
|
||||
/** 第二层:后果 / 影响范围 / 能不能恢复。原来全挤在 confirm 的那一句里 */
|
||||
desc?: ReactNode
|
||||
/** 语气:danger = 不可恢复(主按钮红底 + 描边),warn = 有代价但可逆,info = 只是要确认一下 */
|
||||
tone?: 'danger' | 'warn' | 'info'
|
||||
/** 主按钮文案,默认「确定」;破坏性操作一律写成动词(「删除」「停用」) */
|
||||
confirmText?: string
|
||||
/** 次按钮文案,默认「取消」 */
|
||||
cancelText?: string
|
||||
/** 主按钮图形:默认 ✓,删除类传 IconDelete */
|
||||
confirmIcon?: ReactNode
|
||||
/** 朗读用的浮层名(标题里塞了变量时给一句纯文本) */
|
||||
label?: string
|
||||
}
|
||||
|
||||
type ConfirmState = {
|
||||
req: { id: number; options: ConfirmOptions } | null
|
||||
resolver: ((v: boolean) => void) | null
|
||||
answer: (v: boolean) => void
|
||||
}
|
||||
|
||||
let seq = 0
|
||||
|
||||
export const useConfirmStore = create<ConfirmState>((set, get) => ({
|
||||
req: null,
|
||||
resolver: null,
|
||||
answer: (v) => {
|
||||
const done = get().resolver
|
||||
set({ req: null, resolver: null })
|
||||
done?.(v)
|
||||
}
|
||||
}))
|
||||
|
||||
/** 弹一张确认框,返回「用户是否确认」;已有确认框开着时直接返回 false(不叠窗) */
|
||||
export function confirmAction(options: ConfirmOptions | string): Promise<boolean> {
|
||||
const state = useConfirmStore.getState()
|
||||
if (state.req) return Promise.resolve(false)
|
||||
const opts: ConfirmOptions = typeof options === 'string' ? { title: options } : options
|
||||
return new Promise<boolean>((resolve) => {
|
||||
useConfirmStore.setState({ req: { id: ++seq, options: opts }, resolver: resolve })
|
||||
})
|
||||
}
|
||||
|
||||
/** 当前是否在确认(页面据此禁用其它快捷键,避免 Esc 一次关掉两层) */
|
||||
export function confirmOpen() { return useConfirmStore.getState().req !== null }
|
||||
|
|
@ -1,46 +1,151 @@
|
|||
/**
|
||||
* 全局操作提示(替代旧 project.ts 里的 pctx.notice 与手写的 <NoticeToast/>)。
|
||||
* 全局操作反馈(吐司)的状态:2026-11 第十三轮整层重写,**不再用 antd `<message>`**。
|
||||
*
|
||||
* 以前 notify() 写在项目共享状态上,只有项目详情页顶部那条横幅会显示它:
|
||||
* 资产库、模型中心里点「已存为 v3」之类的提示因此悄无声息。
|
||||
* 现在仍然只有 notify()/notifyBad() 两个入口(全站几百处调用不动),
|
||||
* 但落点是 antd 的 <message>:
|
||||
* · 实例来自 app/providers.tsx 里 <App>.useApp()——静态 message 在 antd v5
|
||||
* 拿不到 ConfigProvider 的 context,会丢主题与中文语言包;
|
||||
* · 位置、时长、堆叠、上下动画、可达性(role=status 的 aria-live)全是 antd 的,
|
||||
* 不再自己维护一个 items 数组和 setTimeout;
|
||||
* · 首帧之前 context 还没挂上,兜底走一次 message 队列,提示不会丢。
|
||||
* 症状(用户原话「整体修改系统中所有提示窗、完成后的反馈 tips 等。不要使用默认组件」):
|
||||
* 全站 63 处 `notify()` / `notifyBad()` 落的是 antd 出厂的 `<message>`——
|
||||
* 页面顶部正中一颗黑底小胶囊,只有「一个图形 + 一行白字」:
|
||||
* ① 说完了「保存成功」却说不完后果(哪个版本、几个镜头、能不能撤销);
|
||||
* ② 3 秒自动消失且**鼠标悬停不停**,报错里那句长文案根本读不完;
|
||||
* ③ 同一次批量操作连续 notify 五次,就在原地叠五颗一模一样的胶囊;
|
||||
* ④ 长得像另一家的组件:站内所有块都有描边、圆角、色块图标,只有它是纯黑药丸。
|
||||
* 做法:状态留在这一层(调用点一个都不改),皮肤交给 `components/ui/Toast.tsx`:
|
||||
* 右下角堆叠卡片、语义色块图标、标题 + 说明两层、底部倒计时条、悬停/聚焦暂停、
|
||||
* 同一条消息去重成「×N」、最多同时 5 颗(超出挤掉最旧的一颗)。
|
||||
* 色调只从 `components/ui/tone.tsx` 取,色值仍是 antd 语义 token。
|
||||
* 为什么还用 zustand 而不是 antd 的 context 实例:反馈队列是**跨页面的全局状态**
|
||||
* (换页要清空、灯箱与抽屉之上也要能显示),和 stores/preview.ts 的灯箱同一套做法;
|
||||
* 挂在 app/providers.tsx 的 <ToastHost/> 上之后,chromeless 的登录页也共用同一条队列。
|
||||
* 兼容:`notify(msg)` / `notifyBad(msg)` 的旧签名原样保留(全站只传一个字符串),
|
||||
* 新增对象入参给「一句结论 + 明细 + 撤销按钮」这种后续调用点用。
|
||||
*/
|
||||
import { App as AntdApp, message as staticMessage } from 'antd'
|
||||
import { antdApi } from '../app/providers'
|
||||
import type { ReactNode } from 'react'
|
||||
import { create } from 'zustand'
|
||||
import type { FeedbackTone } from '../components/ui/tone'
|
||||
|
||||
type Api = ReturnType<typeof AntdApp.useApp>['message']
|
||||
|
||||
function api(): Api {
|
||||
return (antdApi.message as Api) || staticMessage
|
||||
/** 一颗吐司:id 单调递增,宿主用它做 key 与关闭定位 */
|
||||
export type ToastItem = {
|
||||
id: number
|
||||
tone: FeedbackTone
|
||||
/** 一句结论(粗体第一行) */
|
||||
title: string
|
||||
/** 第二层:后果 / 范围 / 明细。没有就不占行 */
|
||||
desc?: ReactNode
|
||||
/** 停留秒数;0 = 不自动消失(进行中的长任务) */
|
||||
duration: number
|
||||
/** 右侧动作(「撤销」「查看」);自己负责调用点需要的副作用 */
|
||||
action?: { label: string; onClick: () => void }
|
||||
/** 同一条消息重复推送的次数(去重后显示 ×N) */
|
||||
count: number
|
||||
/** 最近一次推送的时间戳:宿主用它重启动倒计时 */
|
||||
stamp: number
|
||||
}
|
||||
|
||||
/** 单条提示的停留时间:错误要多看两眼,成功一闪即可 */
|
||||
const DURATION = { ok: 3, bad: 5 }
|
||||
/** 同屏最多堆几颗:再多就是刷屏,挤掉最旧的那颗 */
|
||||
const MAX_VISIBLE = 5
|
||||
/** 单条提示的默认停留时间:错误要多看两眼,成功一闪即可 */
|
||||
const DURATION = { ok: 3, bad: 5, warn: 5, info: 4, loading: 0 }
|
||||
|
||||
type NoticeState = {
|
||||
items: ToastItem[]
|
||||
push: (tone: FeedbackTone, input: ToastInput, duration?: number) => number
|
||||
dismiss: (id: number) => void
|
||||
clear: () => void
|
||||
}
|
||||
|
||||
let seq = 0
|
||||
|
||||
export const useNoticeStore = create<NoticeState>((set, get) => ({
|
||||
items: [],
|
||||
push: (tone, input, duration) => {
|
||||
const item = normalize(++seq, tone, input, duration)
|
||||
set((s) => {
|
||||
/* 去重:同一条文案 + 同一语气还在屏上,就把上面那颗「顶回去重读」,
|
||||
而不是并排叠五颗一模一样的(批量操作连点时最常见)。 */
|
||||
const at = s.items.findIndex((x) => x.tone === item.tone && x.title === item.title)
|
||||
if (at >= 0) {
|
||||
const merged = { ...s.items[at], count: s.items[at].count + 1, stamp: item.stamp, duration: item.duration }
|
||||
const rest = s.items.filter((_, i) => i !== at)
|
||||
return { items: [...rest, merged] }
|
||||
}
|
||||
return { items: [...s.items, item].slice(-MAX_VISIBLE) }
|
||||
})
|
||||
return item.id
|
||||
},
|
||||
dismiss: (id) => set((s) => ({ items: s.items.filter((x) => x.id !== id) })),
|
||||
clear: () => set({ items: [] })
|
||||
}))
|
||||
|
||||
/** 进行中转圈用的句柄:调用方拿到 `done()`,用新语气原地替换那颗 */
|
||||
export type LoadingHandle = {
|
||||
id: number
|
||||
/** 结束:把它换成一条带新语气与新文案的吐司并重新计时;不传就是直接消失 */
|
||||
done: (next?: {
|
||||
tone?: FeedbackTone; title?: string; desc?: ReactNode; duration?: number
|
||||
action?: { label: string; onClick: () => void }
|
||||
}) => void
|
||||
}
|
||||
|
||||
function normalize(id: number, tone: FeedbackTone, input: ToastInput, duration?: number): ToastItem {
|
||||
const base = typeof input === 'string' ? { title: input } : input
|
||||
return {
|
||||
id, tone,
|
||||
title: String(base.title ?? '').trim(),
|
||||
desc: base.desc,
|
||||
action: base.action,
|
||||
duration: duration ?? base.duration ?? DURATION[tone],
|
||||
count: 1,
|
||||
stamp: Date.now()
|
||||
}
|
||||
}
|
||||
|
||||
/** 对象入参:`notify({ title, desc, action })`;字符串入参是最常用的简写 */
|
||||
export type ToastInput = string | {
|
||||
title: string
|
||||
desc?: ReactNode
|
||||
duration?: number
|
||||
action?: { label: string; onClick: () => void }
|
||||
}
|
||||
|
||||
function push(tone: FeedbackTone, input: ToastInput, duration?: number) {
|
||||
const text = typeof input === 'string' ? input : input.title
|
||||
if (!text) return 0
|
||||
return useNoticeStore.getState().push(tone, input, duration)
|
||||
}
|
||||
|
||||
/** 成功提示(沿用旧签名:绝大多数调用点只有一个字符串参数) */
|
||||
export function notify(message: string, duration = DURATION.ok) {
|
||||
if (!message) return
|
||||
api().success({ content: message, duration })
|
||||
}
|
||||
export function notify(message: ToastInput, duration?: number) { return push('ok', message, duration) }
|
||||
/** 失败提示 */
|
||||
export function notifyBad(message: ToastInput, duration?: number) { return push('bad', message, duration) }
|
||||
/** 需要注意但不致命(部分成功、降级、需要复核) */
|
||||
export function notifyWarn(message: ToastInput, duration?: number) { return push('warn', message, duration) }
|
||||
/** 纯信息(不带成败判断) */
|
||||
export function notifyInfo(message: ToastInput, duration?: number) { return push('info', message, duration) }
|
||||
|
||||
/** 失败/警告提示 */
|
||||
export function notifyBad(message: string, duration = DURATION.bad) {
|
||||
if (!message) return
|
||||
api().error({ content: message, duration })
|
||||
}
|
||||
|
||||
/** 进行中(长任务:导出、合成),返回带 .() 的句柄,调用方自己 destroy */
|
||||
export function notifyLoading(message: string) {
|
||||
return api().loading({ content: message, duration: 0 })
|
||||
/**
|
||||
* 进行中(长任务:导出、合成)。返回句柄,调用方在 then/catch 里 `done()` 收尾:
|
||||
* const h = notifyLoading('正在合成成片…')
|
||||
* try { await compose(); h.done({ tone: 'ok', title: '成片已合成' }) }
|
||||
* catch (e) { h.done({ tone: 'bad', title: '合成失败', desc: e.message }) }
|
||||
*/
|
||||
export function notifyLoading(message: ToastInput): LoadingHandle {
|
||||
const id = push('loading', message)
|
||||
return {
|
||||
id,
|
||||
done: (next) => {
|
||||
const s = useNoticeStore.getState()
|
||||
const cur = s.items.find((x) => x.id === id)
|
||||
if (!cur) return
|
||||
const tone = next?.tone ?? 'ok'
|
||||
const text = next?.title ?? cur.title
|
||||
if (!text) { s.dismiss(id); return }
|
||||
s.dismiss(id)
|
||||
s.push(tone, { title: text, desc: next?.desc, action: next?.action ?? cur.action }, next?.duration)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** 换页 / 退出登录时清掉残留提示 */
|
||||
export function clearNotices() {
|
||||
api().destroy()
|
||||
}
|
||||
export function clearNotices() { useNoticeStore.getState().clear() }
|
||||
|
||||
/** 给非组件代码(api 拦截器之类)读的当前队列 */
|
||||
export function noticeState() { return useNoticeStore.getState().items }
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ h3 { font-size: var(--ant-font-size-heading-5); line-height: var(--ant-line-heig
|
|||
行 = antd `Row`/`Col`(FormRow)、横条 = antd `Flex`(Ctlbar)。
|
||||
列边界与降列只有 Row/Col 一个来源(components/ui/grid.tsx),
|
||||
旧的 --label-w / .nf-ctl / .nf-w-* / 六条 @media 降列整层删除。
|
||||
CSS 只剩下面这四件 antd 自己接不到的事。
|
||||
CSS 只剩下面这六件 antd 自己接不到的事。
|
||||
══════════════════════════════════════════════════════════════════════════ */
|
||||
|
||||
/* ① 控件撑满列宽。antd 的 Select / InputNumber / DatePicker 默认按内容取宽,
|
||||
|
|
@ -128,11 +128,32 @@ textarea) { width: 100%; min-width: 0 }
|
|||
.nex-field-inline .ant-form-item-row { flex-wrap: nowrap; align-items: center }
|
||||
.nex-field-inline .ant-form-item-label { flex: none; text-align: start; padding: 0; margin-inline-end: var(--ant-margin-xs) }
|
||||
.nex-field-inline .ant-form-item-label > label { height: auto; white-space: nowrap; color: var(--ant-color-text) }
|
||||
/* 控件列吃 --nex-ctl-w(inline 的 narrow/wide 由组件写进变量);没写变量的字段照旧按内容定尺 */
|
||||
.nex-field-inline .ant-form-item-control { flex: none; width: var(--nex-ctl-w, auto) }
|
||||
/* 必填星号:antd 画在标签前,颜色取它自己的 colorError,这里只保证不被折行拆开 */
|
||||
/* 控件列吃 --nex-ctl-w(inline 的 narrow/wide 由组件写进变量);没写变量的字段照旧按内容定尺。
|
||||
⚠ 必须是「可收缩 + 上限」而不是 `flex: none; width: N`:控件列不参与挤压时,
|
||||
标签(nowrap) + 控件的自然宽度大于盒子拿到的宽度就会**捅出盒子**——
|
||||
visualcheck 576 档 / 的「搜索」字段(盒子 flex-basis 220 实得 227,
|
||||
控件列 flex:none 撑到 220,标签 49 + 间隙 8 + 220 = 277)溢出 42px。
|
||||
现在标签列仍然 flex:none(标签永远不被压),控件列最宽 --nex-ctl-w、
|
||||
盒子变窄时它跟着缩,窄屏是「控件变短」而不是「控件掉出容器」。
|
||||
栅格里的字段(.nex-ctlbar-grid)要撑满整格,所以那里把上限解掉。 */
|
||||
.nex-field-inline .ant-form-item-control { flex: 1 1 auto; width: auto; min-width: 0; max-width: var(--nex-ctl-w, none) }
|
||||
.nex-req { color: var(--ant-color-error); font-weight: var(--ant-font-weight-strong); margin-inline-start: 1px }
|
||||
|
||||
/* ⑥ 一行里既有「标签在上」的字段、又有裸复选框时,复选框必须坐进控件那一行。
|
||||
症状(用户第一轮就在说「字段标题、控件不对齐」):分镜检查器「环境声 / 启用字幕」
|
||||
这一行,左边标签 30px + 输入框 32px,右边那颗复选框顶在 909——和输入框中心差 35px,
|
||||
读起来像它属于上一行。原因:FormRow 的列是块级 Col,调用点写的
|
||||
`self-center` / `self-end` 在块容器里不参与对齐,等于没写。
|
||||
做法:由这里统一让位——先让出标签块(行高 × 字号 + marginXS = 30),
|
||||
再在 controlHeight 里垂直居中;整行都是复选框时(:has 不成立)不让位,
|
||||
因为没有标签行可对齐。调用点从此不再自己写对齐 class。 */
|
||||
.nex-form-row:has(.ant-form-item-label) > .ant-col > :is(.nex-check, .ant-checkbox-wrapper) {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
height: var(--ant-control-height);
|
||||
margin-block-start: calc(var(--ant-font-size) * var(--ant-line-height) + var(--ant-margin-xs));
|
||||
}
|
||||
|
||||
/* ── 卡片(Panel = antd Card):标题与副标题是中文短语,默认 ellipsis 会裁掉半句 ── */
|
||||
.nex-panel .ant-card-head-title { white-space: normal; overflow: visible; text-overflow: clip }
|
||||
/* 标题条同理:中文短语不许被 ellipsis 裁掉半句,right 那一块也按内容折行。
|
||||
|
|
@ -145,6 +166,35 @@ textarea) { width: 100%; min-width: 0 }
|
|||
放不下就整块掉到第二行。 */
|
||||
.nex-panel .ant-card-head-wrapper { flex-wrap: wrap; row-gap: var(--ant-margin-xxs) }
|
||||
.nex-panel .ant-card-extra { flex-shrink: 0; max-width: 100% }
|
||||
/* 手机档卡头(Panel 在 <576 挂 nex-head-stack,档位来自 Grid.useBreakpoint):
|
||||
右端那一块整块占一行,标题拿回整行宽度。上面那条 flex-wrap 救不了它——
|
||||
折行判定看的是 flex-basis,而 `.ant-card-head-title` 是 `flex:1 1 0`,
|
||||
浏览器永远认为 extra 放得下,于是 shrink 的是标题,中文标题就断成两行。
|
||||
做法:把 extra 的假想主轴宽写成整行(flex:1 1 100%),标题的 flex-basis
|
||||
从 0 放开成 auto(内容宽),两者的假想宽之和必然超过一行 → extra 确定地
|
||||
掉到第二行,标题在自己的那一行里 grow 满宽。
|
||||
⚠ 只写 extra 那条不够:标题 basis 是 0 时它能不能把动作挤下去,
|
||||
取决于 min-width:auto 算出的那一格 min-content(一个汉字 15px)——
|
||||
`.ant-card-head-title` 在 antd 里是 overflow:hidden(min 归 0),
|
||||
这条链子中一环扣在别的规则上,版面就会退化成「标题只剩一条竖河」。
|
||||
该换行的是整块,不是字。 */
|
||||
.nex-panel.nex-head-stack .ant-card-head-wrapper { row-gap: var(--ant-margin-xs) }
|
||||
.nex-panel.nex-head-stack .ant-card-head-title { flex: 1 1 auto }
|
||||
.nex-panel.nex-head-stack .ant-card-extra { flex: 1 1 100%; margin-inline-start: 0 }
|
||||
/* 卡头里的块级横排(只读标签行 / chip 行 / 控件栏):那 12px 下边距是给
|
||||
「正文里两块之间」用的,坐进 48px 的卡头就成了压在下面的一段空档。
|
||||
症状(2026-11 第十四轮 · 用户原话「垂直居中对齐,和其它子页面要一致」+
|
||||
调度中心工具条截图):那一排 25px 的只读胶囊整体浮在卡头中线**上方 6px**
|
||||
(= 12 的一半),同屏其它单行卡头偏的是 0.5px——肉眼就是「这排贴顶、下面空一截」。
|
||||
⚠ 调用点写了 `mb-0` 却压不住:Tailwind 的 utility 在 utilities 层,
|
||||
而本文件未分层,按 R13 那套层叠规则「未分层永远赢过分层」,
|
||||
归零只能写在同一层里、按结构命中(这条对全站卡头一次生效)。 */
|
||||
.nex-panel .ant-card-head :is(.ant-card-head-title, .ant-card-extra) :is(.nex-taggroup, .nex-chipbar, .nex-ctlbar) { margin-block: 0 }
|
||||
/* 卡头标题槽是 15px/600 的标题档(extra 继承同一档),只读胶囊与分段器坐进来时不许跟着变粗:
|
||||
R16.3 的只读回显全站只有一档字重(正文里的 Tag 继承 body 的 400)。
|
||||
症状(同一条工具条):`任务执行:平台内即时执行` 在卡头里是 14px/600,
|
||||
同样的标签落在卡片正文里是 14px/400——同一枚胶囊在两级里两种字重。 */
|
||||
.nex-panel .ant-card-head :is(.ant-tag, .nex-chip, .ant-segmented) { font-weight: 400 }
|
||||
/* Card 的 body 不是 flex 子项,里面的 Row/Col 想收缩必须先从 min-width:auto 解放出来 */
|
||||
.nex-panel .ant-card-body { min-width: 0 }
|
||||
.nex-panel .ant-card-body > * { min-width: 0 }
|
||||
|
|
@ -175,7 +225,7 @@ html[data-theme='dark'] .nex-panel.nex-pagehead {
|
|||
var(--ant-color-bg-container) 58%);
|
||||
}
|
||||
.nex-panel.nex-pagehead > .ant-card-body { padding: var(--ant-padding-sm) var(--ant-padding-lg) }
|
||||
/* 门牌第一行(菜单同款图标 + 一级标题)定高 = 控件档。
|
||||
/* 门牌第一行(一级标题 + 右端主操作)定高 = 控件档。
|
||||
症状(2026-11 第十二轮 · 用户原话「右侧的主功能入口要对齐」):主操作原先挂在
|
||||
**整块页头**的垂直中线上,七站的职责说明有的两行有的一行,那颗主按钮在每一页的 y
|
||||
都不一样;概览页没有动作时中线还空着。第一行既然定高,同排右对齐的动作组就必然
|
||||
|
|
@ -230,7 +280,35 @@ html[data-theme='dark'] .nex-panel.nex-pagehead {
|
|||
同一行的控件右边缘因此必然对齐;胶囊选项铺进格子时同理要撑满。 */
|
||||
.nex-ctlbar-grid > .ant-col { display: flex; align-items: center; gap: var(--ant-margin-xs); min-width: 0 }
|
||||
.nex-ctlbar-grid > .ant-col > .ant-form-item { flex: 1 1 auto; min-width: 0 }
|
||||
.nex-ctlbar-grid .nex-field-inline .ant-form-item-control { flex: 1 1 auto; width: auto; min-width: 0 }
|
||||
.nex-ctlbar-grid .nex-field-inline .ant-form-item-control { flex: 1 1 auto; width: auto; min-width: 0; max-width: none }
|
||||
/* 末尾那格是 BarRight 时它吃掉整行剩下的宽度(见 Controls.tailRight / grid.FILL_AT),
|
||||
内容再靠右:这一格可能横跨好几列,动作组要贴着**容器**右缘而不是格子的左缘。 */
|
||||
.nex-ctlbar-grid > .nex-ctlbar-tail { justify-content: flex-end }
|
||||
/* 整组不可分割(§7):横排时把盒子钉在自然宽度,会折行的父容器于是把整组当一个 item 挪行。
|
||||
两个类的特异度才压得住同一个元素上 Tailwind 的 min-w-0;窄到一整行都放不下时
|
||||
这个类不上(useAutoStack 把整组翻成竖排),所以它永远不会捅破容器。 */
|
||||
.nex-action-group.nex-atom { min-width: max-content }
|
||||
/* 自动竖排那一档(useAutoStack 判定「一整行放不下」之后上的 .ant-flex-vertical):
|
||||
横排时用来「把辅助动作钉在最左」的 mr-auto / ml-auto,以及容器上的 items-center,
|
||||
在竖排里都变成缺陷——那几颗收成内容宽、贴左边或贴中间,和下面几颗参差。
|
||||
浮层底部(Overlay.DRAWER_ACTIONS 现在就是 ActionGroup)第一条就带 items-center,
|
||||
所以这两句写在 app.css:不在 @layer 里,特异度压得住 Tailwind utilities 层的
|
||||
items-center / mr-auto(第 17 轮实测 mb-0 压不住 .nex-taggroup 是同一条反向证据)。 */
|
||||
.nex-action-group.ant-flex-vertical { align-items: stretch }
|
||||
.nex-action-group.ant-flex-vertical > * { margin-inline: 0 }
|
||||
|
||||
/* ── 流程节点条(Steps):容器自适应网格,不是横向滚动的自然排列 ──────────
|
||||
症状:12 格 × 96px + 11 × 8px = 1244px 在任何视口都放不下,整条只能横滚,
|
||||
「把当前节点滚进视野」于是把前面的节点推出视野——项目概览 1440 档
|
||||
scrollLeft=126(第 1 格被切一半)、1024 档 542(前 5 格看不见)、
|
||||
总控台那条 526px 宽溢出 718px=12 格里 9 格在视野外。
|
||||
做法:轨道下限由组件按 compact 档写进 --nex-step-min(完整 140 / 精简 128),
|
||||
`auto-fill` 按**容器**宽度分列:项目页 1118px → 7 列 2 排、总控台半栏
|
||||
526px → 3 列、430 手机档 → 2 列。12 个节点一次全部可见,
|
||||
不滚动、不渐隐、不裁切,中文标题也不再折成「导出完整视 / 频」。
|
||||
为什么不用 antd Row/Col:Col 的断点读视口,读不到「这条 rail 坐在半栏里」。 */
|
||||
.nex-steps { display: grid; gap: var(--ant-margin-xs);
|
||||
grid-template-columns: repeat(auto-fill, minmax(var(--nex-step-min, 140px), 1fr)) }
|
||||
|
||||
/* ── 下拉面板:宁可临时压住右边内容,也不让用户盲选 ────────────────────
|
||||
症状:时间线 / 交付页的字幕模式、配音来源这些选项,文案本身就是说明
|
||||
|
|
@ -277,6 +355,25 @@ html[data-theme='dark'] .nex-panel.nex-pagehead {
|
|||
这条必须排在 .nex-chip.ant-tag 之后——两条特异度相同(类+类),
|
||||
写在前面会被上面的 display:inline-flex 覆盖回 inline-block,图标与文字的间隙就散了。 */
|
||||
.nex-opt-cell .ant-tag { margin-inline-end: 0; width: 100%; justify-content: center }
|
||||
/* 未选中的选项也要有边界(2026-11 第七轮目视)。
|
||||
症状:antd 的 CheckableTag 未选中态是**完全透明**的,铺进等宽格子后
|
||||
「出片预设」6 格、「引用已有素材」13 格读起来像两行居中的散文——
|
||||
看不出这是一组可点的选项,更数不清第几格;ChipBar 的胶囊流没这个毛病,
|
||||
因为胶囊彼此分开、文案长短本身就在说「这是一颗一颗的」。
|
||||
做法:只给坐在格子里的选项补次级描边 + 中性底(fill-alter 与站内其它表面同族,
|
||||
tagcheck 量的「这一层自己有没有加色」≈0,仍是中性);选中态照旧由 antd 的
|
||||
主色实心表达,不参与这条。border-box 下加边框不改格子宽度,gridcheck 不受影响。
|
||||
特异度:antd 5.29 把样式注到 <head> 里、和 app.css 抢先后,所以这里堆到 5 个类,
|
||||
不靠顺序取胜。 */
|
||||
.nex-opt-cell .nex-chip.ant-tag.ant-tag-checkable:not(.ant-tag-checkable-checked) {
|
||||
border: 1px solid var(--ant-color-border-secondary);
|
||||
background: var(--ant-color-fill-alter);
|
||||
}
|
||||
.nex-opt-cell .nex-chip.ant-tag.ant-tag-checkable:not(.ant-tag-checkable-checked):hover {
|
||||
border-color: var(--ant-color-primary-border-hover);
|
||||
background: var(--ant-color-fill-secondary);
|
||||
color: var(--ant-color-primary-hover);
|
||||
}
|
||||
|
||||
/* 多选回显 = antd Tag(closable):与 Tag 同度量,色调走 primary 那一族 */
|
||||
.nex-tag-chip.ant-tag {
|
||||
|
|
@ -314,7 +411,16 @@ html[data-theme='dark'] .nex-panel.nex-pagehead {
|
|||
white-space: nowrap;
|
||||
vertical-align: middle;
|
||||
box-sizing: border-box;
|
||||
/* 标签最宽只能到它所坐容器的内容盒(第 16 轮:/assets 场景卡把整句「光线」
|
||||
当标签渲染,nowrap 的长标签直接捅出卡片右缘 204px)。
|
||||
配合下面 .nex-tag-text 的 ellipsis,收不下时在**标签内部**省略,
|
||||
而不是把容器顶宽或冲出容器——完整文案由 title 悬停给出。 */
|
||||
max-width: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
/* 标签文字的省略号落点:.nex-tag 是 inline-flex,text-overflow 落在匿名 flex item
|
||||
上没有选得中,所以由 Status.tsx 给文字套这一层 span(min-width:0 才允许收缩)。 */
|
||||
.nex-tag-text { min-width: 0; overflow: hidden; text-overflow: ellipsis }
|
||||
/* 标签的底色只有一档:中性 fill-tertiary(= antd Tag bordered=false 的默认底)。
|
||||
语义色不再铺底(用户第七轮「浅绿色标签都要处理到新的颜色设计上」)——整屏的
|
||||
「完成 / 已交付 / 合格」如果各是一块浅绿,绿色就从语义色变成了第二个品牌色,
|
||||
|
|
@ -338,6 +444,18 @@ html[data-theme='dark'] .nex-tag.ant-tag { background: color-mix(in srgb, var(--
|
|||
--tag-gap: var(--tag-gap-sm);
|
||||
--tag-text: var(--tag-text-sm);
|
||||
}
|
||||
/* 表格自己就是那个「容器」:站内表格一律 size=sm,是全站最密的地方,
|
||||
档位令牌在这里压到底,单元格里的 Tag / Status / Badge 整片一起降一档,
|
||||
页面不必逐个写 size="sm"(规范 §8.1「两档令牌挂在容器上」的表格那一半)。
|
||||
⚠ 这条在 antd 重写时丢过一次,丢了没人报错:审查页「自动质检清单」的「结论」列
|
||||
宽 104、扣掉左右内边距只剩 88,而 md 档的「人工不合格」要 98,整格 nowrap
|
||||
把标签顶出内容盒右缘 10px(tableaudit 新加的「格子内容越界」判据抓到的就是它)。 */
|
||||
.nex-table {
|
||||
--tag-h: var(--tag-h-sm);
|
||||
--tag-px: var(--tag-px-sm);
|
||||
--tag-gap: var(--tag-gap-sm);
|
||||
--tag-text: var(--tag-text-sm);
|
||||
}
|
||||
/* 单个标签的密集档(容器挂 TAG_DENSE 时不需要它) */
|
||||
.nex-tag-solo-sm {
|
||||
--tag-h: var(--tag-h-sm);
|
||||
|
|
@ -347,7 +465,7 @@ html[data-theme='dark'] .nex-tag.ant-tag { background: color-mix(in srgb, var(--
|
|||
}
|
||||
/* 数字气泡:与标签同度量,只收成 pill 并加粗 */
|
||||
.nex-badge { border-radius: 9999px; font-weight: var(--ant-font-weight-strong) }
|
||||
.nex-tag-icon { display: inline-flex; align-items: center; line-height: 0 }
|
||||
.nex-tag-icon { display: inline-flex; align-items: center; line-height: 0; flex: none }
|
||||
/* 只读标签行:组内一档、组与下方一档半,定死不商量 */
|
||||
.nex-taggroup { display: flex; flex-wrap: wrap; align-items: center; gap: var(--ant-margin-xs); min-width: 0; margin-block-end: var(--ant-margin-sm) }
|
||||
.nex-taggroup > span:first-child { flex: none }
|
||||
|
|
@ -407,7 +525,8 @@ html[data-theme='dark'] .nex-tag.ant-tag { background: color-mix(in srgb, var(--
|
|||
.ant-drawer .ant-picker-dropdown,
|
||||
.ant-drawer .ant-cascader-dropdown,
|
||||
.ant-drawer .ant-dropdown { z-index: 1100 }
|
||||
.ant-message { z-index: 1200 }
|
||||
/* 自绘吐司(.nex-toast-region)也取 1200:它替掉的正是 antd message 的那一层,
|
||||
要压得住抽屉与模态,见文件末尾「反馈四级表面」那一节。 */
|
||||
/* 抽屉 / 弹窗的滚动区统一用细描边滚动条(与 index.css 的 scrollbar-slim 同一条配方) */
|
||||
.ant-drawer-body, .ant-modal-body { scrollbar-width: thin; scrollbar-color: var(--ant-color-fill) transparent }
|
||||
.ant-drawer-body::-webkit-scrollbar, .ant-modal-body::-webkit-scrollbar { width: 8px; height: 8px }
|
||||
|
|
@ -436,36 +555,50 @@ html[data-theme='dark'] .nex-tag.ant-tag { background: color-mix(in srgb, var(--
|
|||
为什么用 color-mix 而不是新色值:站内 `#hex` 只许出现在 theme/antd.ts(§2),
|
||||
这里按语义色变量比例混合,明暗两档自动跟着主题走,不产生第二套色板。 */
|
||||
.nex-stat { --nex-stat-tint: var(--ant-color-primary) }
|
||||
/* 色块族(统计卡 / 内容页门牌 / 概况抽屉的七站行):一套几何两档大小。
|
||||
门牌那枚(.nex-pagehead-mark)取的是 `app/layout/nav.tsx` 里菜单项的图形本身,
|
||||
和侧栏同一份 ReactNode——菜单换图当天页头跟着换,不存在「两边长得不一样」。
|
||||
`--nex-stat-tint` 缺省时落回主色:页头与抽屉行没有 tone,统计卡才有。 */
|
||||
.nex-stat-mark, .nex-pagehead-mark, .nex-brief-mark {
|
||||
/* 色块族(统计卡 / 概况抽屉的七站行 / 吐司 / 提示条 / 确认框):
|
||||
一套几何**两档大小**,语义色由宿主写进 `--nex-mark-tint`。
|
||||
2026-11 第十四轮(用户原话「不要图标」):内容页门牌那一枚从族里退出了——
|
||||
门牌左侧那块主色方块和左栏高亮项说的是同一句话(R18 每级信息只说一遍),
|
||||
而一屏里紧接着还有卡头的品牌 N 与统计卡色块,三颗同形状方块互相抢焦点。
|
||||
`PageHead` 的 icon/反查机制、`.nex-pagehead-title` 的左缘因此一起回到卡内边距。
|
||||
变量在 2026-11 第十三轮从 `--nex-stat-tint` 改名成 `--nex-mark-tint`:
|
||||
原来只有统计卡有色调可给,反馈三兄弟自绘之后都要说同一句「这块图形是什么语气」,
|
||||
出处是 components/ui/tone.tsx 那张唯一的语义表。统计卡那条老变量在本族内兜住,
|
||||
页面与 Panel 里的 Stat 一个字都不用改。 */
|
||||
.nex-stat-mark, .nex-brief-mark,
|
||||
.nex-toast-mark, .nex-notice-mark, .nex-confirm-mark {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex: none;
|
||||
background: color-mix(in srgb, var(--nex-stat-tint, var(--ant-color-primary)) 12%, transparent);
|
||||
color: var(--nex-stat-tint, var(--ant-color-primary));
|
||||
background: color-mix(in srgb, var(--nex-mark-tint, var(--ant-color-primary)) 12%, transparent);
|
||||
color: var(--nex-mark-tint, var(--ant-color-primary));
|
||||
}
|
||||
.nex-stat-mark, .nex-pagehead-mark {
|
||||
/* 大档:数字左侧、吐司与确认框的问话——凡是「一块卡片级表面」上的色块 */
|
||||
.nex-stat-mark, .nex-toast-mark, .nex-confirm-mark {
|
||||
inline-size: 32px;
|
||||
block-size: 32px;
|
||||
border-radius: var(--ant-border-radius-lg);
|
||||
font-size: 17px;
|
||||
}
|
||||
/* 概况抽屉里的七站行整行只有 34px,色块降到控件小档,不然行高被它顶开 */
|
||||
.nex-brief-mark {
|
||||
/* 小档:色块坐在**一行文字**旁边的地方——概况抽屉的七站行(整行 34px)与提示条。
|
||||
降一档不是为了好看,是因为 32px 会把行高顶开,一屏四条提示就散了。 */
|
||||
.nex-brief-mark, .nex-notice-mark {
|
||||
inline-size: 20px;
|
||||
block-size: 20px;
|
||||
border-radius: var(--ant-border-radius-sm);
|
||||
font-size: var(--ant-font-size-sm);
|
||||
}
|
||||
html[data-theme='dark'] .nex-stat-mark,
|
||||
html[data-theme='dark'] .nex-pagehead-mark,
|
||||
html[data-theme='dark'] .nex-brief-mark {
|
||||
background: color-mix(in srgb, var(--nex-stat-tint, var(--ant-color-primary)) 18%, transparent);
|
||||
html[data-theme='dark'] .nex-brief-mark,
|
||||
html[data-theme='dark'] .nex-toast-mark,
|
||||
html[data-theme='dark'] .nex-notice-mark,
|
||||
html[data-theme='dark'] .nex-confirm-mark {
|
||||
background: color-mix(in srgb, var(--nex-mark-tint, var(--ant-color-primary)) 18%, transparent);
|
||||
}
|
||||
/* 统计卡的色调写在卡上(--nex-stat-tint,Panel.tsx 的 Stat 按 tone 给):
|
||||
本族改读 --nex-mark-tint 之后在这里接一次,卡面自己仍是 antd 的 colorBgContainer。 */
|
||||
.nex-stat-mark { --nex-mark-tint: var(--nex-stat-tint, var(--ant-color-primary)) }
|
||||
|
||||
/* ── 只读回显(Info = antd Descriptions):R16.3 ──────────────────────────────
|
||||
症状(用户截图:模型卡里「资源地址 / 参考」那只灰盒):回显写成灰底圆角盒 +
|
||||
|
|
@ -523,3 +656,162 @@ html[data-theme='dark'] .nex-info .ant-descriptions-item-label {
|
|||
/* 页签条自带 16px 下边距(antd .ant-tabs-nav):它在 PageStack 里就是「和下一块的距离」,
|
||||
与父级 gap 重复会空出 32px。归零之后页签与正文之间仍是站内那一档 16。 */
|
||||
.nex-stack > .ant-tabs > .ant-tabs-nav { margin-block-end: 0 }
|
||||
|
||||
/* ══════════════════════════════════════════════════════════════════════════
|
||||
反馈四级表面(R19 · 2026-11 第十三轮)
|
||||
-----------------------------------------------------------------------------
|
||||
症状(用户原话「整体修改系统中所有提示窗、完成后的反馈 tips 等。
|
||||
不要使用默认组件」):反馈原本是三件默认组件拼出来的——
|
||||
antd `<message>`(顶部正中一颗纯黑药丸:无描边、无色块、悬停不暂停、
|
||||
重复推送叠成一串一模一样的胶囊、长报错读不完)、
|
||||
`window.confirm`(操作系统的灰窗口:主题/字号/按钮/语言全不归站内,
|
||||
问话与后果挤成一行,还同步阻塞把动画冻在原地)、
|
||||
antd `Alert`(站内唯一一套不带 R16.3 语义底纹的信息块,且没有善后动作位)。
|
||||
做法:四级表面各有唯一实现,全部自绘,全部只读两把现成的尺子——
|
||||
① 色块族(上面那一节,两档大小 + `--nex-mark-tint`);
|
||||
② 语义底纹 `BLOCK_TONE`(R16.3 那把尺子,提示条直接复用)。
|
||||
色值一律是 antd 语义 token(`--ant-color-*`),这里没有一个新的颜色。
|
||||
动画时长写成字面量并在这里注明出处:`applyRootVars` 只把
|
||||
color/borderRadius/boxShadow/font*/lineHeight/controlHeight/margin/padding/screen
|
||||
抄到 `:root`,motion 那一族不在名单里——吐司与提示条都挂在 `:root` 那棵子树上
|
||||
(吐司挂在 body 级容器、模态 portal 出 `.ant-app`),读不到 `--ant-motion-*`。
|
||||
.2s = antd motionDurationMid,.3s = motionDurationSlow。
|
||||
为什么 .ant-* 只出现在这一层:页面不准 import antd(R8),皮肤也就只有这一个落点。
|
||||
══════════════════════════════════════════════════════════════════════════ */
|
||||
|
||||
/* ── ② 提示条 Notice:卡内的轻量层(替 antd Alert)──────────────────────────
|
||||
容器(描边 + 底纹 + 圆角 + 内边距)由 Panel.tsx 的 BLOCK_TONE 给,
|
||||
这里只管色块右边的两行文字——与 antd Alert 的两层结构逐项对齐。 */
|
||||
.nex-notice { min-width: 0 }
|
||||
.nex-notice .nex-notice-mark { margin-block-start: 1px }
|
||||
.nex-notice-title {
|
||||
color: var(--ant-color-text);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.nex-notice-desc {
|
||||
margin-block-start: 2px;
|
||||
color: var(--ant-color-text-description);
|
||||
font-size: var(--ant-font-size-sm);
|
||||
line-height: var(--ant-line-height-relaxed);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
/* 关闭键与右端的善后按钮都要贴着第一行,不能跟着整块垂直居中 */
|
||||
.nex-notice .nex-notice-close { flex: none; margin-block-start: calc(-1 * var(--ant-padding-xxs)) }
|
||||
.nex-notice-action { flex: none }
|
||||
|
||||
/* ── ③ 吐司 Toast:右下角堆叠卡片(替 antd message)────────────────────────
|
||||
为什么右下角:顶部正中压住的正是门牌与主操作(上一轮刚要求「右侧的主功能入口要对齐」),
|
||||
反馈不该把刚点的那颗按钮盖掉。
|
||||
为什么 `pointer-events:none` + 卡片自己 auto:这一层是贴边的 360px 竖条,
|
||||
底下往往是正文与滚动区,容器不许吃掉那条带上的任何一次点击。 */
|
||||
.nex-toast-region {
|
||||
position: fixed;
|
||||
inset-inline-end: var(--ant-margin-lg);
|
||||
inset-block-end: var(--ant-margin-lg);
|
||||
z-index: 1200;
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
gap: var(--ant-margin-xs);
|
||||
width: min(360px, calc(100vw - 2 * var(--ant-margin-lg)));
|
||||
pointer-events: none;
|
||||
}
|
||||
.nex-toast {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ant-margin-sm);
|
||||
padding: var(--ant-padding-sm) var(--ant-padding);
|
||||
border: 1px solid var(--ant-color-border-secondary);
|
||||
border-radius: var(--ant-border-radius-lg);
|
||||
background: var(--ant-color-bg-elevated);
|
||||
box-shadow: var(--ant-box-shadow-secondary);
|
||||
/* 底部倒计时条要贴着圆角内侧裁掉 */
|
||||
overflow: hidden;
|
||||
pointer-events: auto;
|
||||
animation: nex-toast-in .2s ease-out both;
|
||||
}
|
||||
@keyframes nex-toast-in {
|
||||
from { opacity: 0; transform: translateY(var(--ant-margin-xs)) }
|
||||
to { opacity: 1; transform: none }
|
||||
}
|
||||
.nex-toast-title {
|
||||
color: var(--ant-color-text);
|
||||
font-weight: var(--ant-font-weight-strong);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.nex-toast-desc {
|
||||
margin-block-start: 2px;
|
||||
color: var(--ant-color-text-secondary);
|
||||
font-size: var(--ant-font-size-sm);
|
||||
line-height: var(--ant-line-height-relaxed);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
/* 重复次数:同一条文案被推 N 次只显示一颗(去重在 stores/notice.ts),
|
||||
这颗角标说的就是「其实发生了 N 次」,所以它跟在标题后头,不另起一行。 */
|
||||
.nex-toast-count {
|
||||
margin-inline-start: var(--ant-margin-xxs);
|
||||
color: var(--ant-color-text-tertiary);
|
||||
font-size: var(--ant-font-size-sm);
|
||||
font-weight: 400;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.nex-toast .nex-toast-close { flex: none; margin-block-start: calc(-1 * var(--ant-padding-xxs)) }
|
||||
/* 倒计时条:JS 与 CSS 同源——时长由组件写进 --nex-toast-ms,
|
||||
悬停/聚焦时 .is-paused 把动画按停,与此同时 stores 那边的计时器也真的停了。 */
|
||||
.nex-toast-progress {
|
||||
position: absolute;
|
||||
inset-inline: 0;
|
||||
inset-block-end: 0;
|
||||
block-size: 2px;
|
||||
transform-origin: left center;
|
||||
background: color-mix(in srgb, var(--nex-mark-tint, var(--ant-color-primary)) 55%, transparent);
|
||||
animation: nex-toast-countdown var(--nex-toast-ms, 3s) linear both;
|
||||
}
|
||||
.nex-toast.is-paused .nex-toast-progress { animation-play-state: paused }
|
||||
@keyframes nex-toast-countdown {
|
||||
from { transform: scaleX(1) }
|
||||
to { transform: scaleX(0) }
|
||||
}
|
||||
/* ── ④ 确认框 Confirm:破坏性操作的第二道闸(替 window.confirm)────────────
|
||||
外壳(遮罩 / 圆角 / 内边距 / 阴影 / 底部动作条)都是 kit Modal 与 antd token 的,
|
||||
这里只补两件事:问话区的两行文字,和危险档那一圈语义描边。 */
|
||||
.nex-confirm .ant-modal-body { padding-block-start: 0 }
|
||||
.nex-confirm-body {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: var(--ant-margin-sm);
|
||||
min-width: 0;
|
||||
}
|
||||
.nex-confirm-title {
|
||||
color: var(--ant-color-text);
|
||||
font-size: var(--ant-font-size-lg);
|
||||
line-height: var(--ant-line-height);
|
||||
font-weight: var(--ant-font-weight-strong);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
.nex-confirm-desc {
|
||||
margin-block-start: var(--ant-margin-xxs);
|
||||
color: var(--ant-color-text-tertiary);
|
||||
line-height: var(--ant-line-height-relaxed);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
/* 危险档给一圈 error 描边:整张框的颜色就是「这一步不好回退」,
|
||||
不用读文案也能感觉到(原生 confirm 里删除和「继续切换」长得一模一样)。
|
||||
语气写在问话区(.nex-confirm-body[data-tone]),描边却画在祖先 .ant-modal-content 上,
|
||||
自定义属性只会向下继承,所以这里用 :has() 把语气提到模态根节点上再落进变量。 */
|
||||
.nex-confirm { --nex-confirm-edge: var(--ant-color-border-secondary) }
|
||||
.nex-confirm:has(.nex-confirm-body[data-tone='danger']) { --nex-confirm-edge: var(--ant-color-error-border) }
|
||||
.nex-confirm:has(.nex-confirm-body[data-tone='warn']) { --nex-confirm-edge: var(--ant-color-warning-border) }
|
||||
.nex-confirm .ant-modal-content { border: 1px solid var(--nex-confirm-edge) }
|
||||
|
||||
/* ── 悬浮提示 Tooltip:站内唯一还在用的默认组件,换肤不换件 ──────────────────
|
||||
症状:app/layout 的头像、主题开关这些纯图标按钮靠 Tooltip 解释自己是干什么的,
|
||||
而 antd 出厂是**纯黑药丸**——深色工作台里它比正文还亮,浅色下又是一块死黑,
|
||||
和站内所有浮层(描边 + 抬升底色 + 阴影)没有共同语言。
|
||||
做法:底色与文字在 theme/antd.ts 用组件 token 换成 elevated / text(不产生新色值),
|
||||
这里只补它没有的那两样:一圈描边和一层阴影,让它和抽屉、菜单浮起同一档。 */
|
||||
.ant-tooltip .ant-tooltip-inner {
|
||||
border: 1px solid var(--ant-color-border-secondary);
|
||||
box-shadow: var(--ant-box-shadow-secondary);
|
||||
font-size: var(--ant-font-size-sm);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -245,6 +245,22 @@ export function buildAntdTheme(mode: ThemeMode): ThemeConfig {
|
|||
headerFontSize: 15,
|
||||
headerHeight: 48
|
||||
},
|
||||
/**
|
||||
* 悬浮提示(2026-11 第十三轮):站内唯一还在用的默认浮层,换肤不换件。
|
||||
* 症状:antd 出厂的 Tooltip 是**纯黑药丸**(colorBgSpotlight 走反色文字基准),
|
||||
* 浅色下是一块死黑、深色下又比正文还亮,和站内所有浮层
|
||||
* (抬升底色 + 描边 + 阴影)没有共同语言;而纯图标按钮的说明只能靠它(R11)。
|
||||
* 做法:底色与文字取 antd 自己的两个表面 token——colorBgElevated 底 +
|
||||
* colorTextBase 字,明暗两档自动跟主题,不引入任何新色值;
|
||||
* 它没有描边与阴影的槽位,那一圈由 styles/app.css 的 `.ant-tooltip-inner` 补。
|
||||
* 为什么不换成自绘组件:定位、延迟、触屏、aria-describedby 这些是 Tooltip 的本职,
|
||||
* 「不要用默认组件」指的是站内那几张**反馈表面**(吐司 / 确认框 / 提示条),
|
||||
* 不是把浮层定位重写一遍。原生 `title` 属性(纯图标按钮的 aria 兜底)同理保留。
|
||||
*/
|
||||
Tooltip: {
|
||||
colorBgSpotlight: seed.colorBgElevated,
|
||||
colorTextLightSolid: seed.colorTextBase
|
||||
},
|
||||
/** 表格:密度交给 antd 自己的三档 size,这里只让表头与分割线跟站内描边一致 */
|
||||
Table: {
|
||||
headerSplitColor: 'transparent',
|
||||
|
|
|
|||
Loading…
Reference in New Issue