2 Commits
Author SHA1 Message Date
dongsk 9c45aedbe8 update css 2026-10-18 23:02:15 +08:00
dongsk 90ee2b30f5 搜索 2026-10-18 21:50:40 +08:00
20 changed files with 558 additions and 102 deletions
@@ -14,19 +14,20 @@ description: 将独立 React(Vite) 前端项目融合进 ai-platform 平台成
3. **静态资源迁移**(SOP §3):资源统一放 `public/mod-assets/<name>/`,代码引用全部改为绝对路径 `/mod-assets/<name>/xxx`(含 `locateFile`)。 3. **静态资源迁移**(SOP §3):资源统一放 `public/mod-assets/<name>/`,代码引用全部改为绝对路径 `/mod-assets/<name>/xxx`(含 `locateFile`)。
4. **样式隔离**(SOP §4):模块根容器类(如 `.xxx-root`)作为所有选择器前缀;`body`/`:root`/`html`/`#root` 规则必须改写或删除;class、ID、裸元素三类冲突源都要检测。 4. **样式隔离**(SOP §4):模块根容器类(如 `.xxx-root`)作为所有选择器前缀;`body`/`:root`/`html`/`#root` 规则必须改写或删除;class、ID、裸元素三类冲突源都要检测。
5. **代码适配**(SOP §5):源 `main.tsx` 的 Provider 包裹与 CSS import 全部迁入模块 `App.tsx`;`tsc -b` 报错按清单修(TS6133、TS2554)。 5. **代码适配**(SOP §5):源 `main.tsx` 的 Provider 包裹与 CSS import 全部迁入模块 `App.tsx`;`tsc -b` 报错按清单修(TS6133、TS2554)。
6. **平台注册**(SOP §6):`moduleConfig` + `registry.ts` + `App.tsx` 路由 + `HomePage.tsx` ICON_MAP 四件套。 6. **平台注册**(SOP §6):`moduleConfig` + `registry.ts` + `App.tsx` 路由(模块用 `React.lazy` 动态导入 + `<Suspense fallback={<ModuleLoading />}>` 包 `<Routes>`,禁止静态 import,否则模块 CSS 进主包)+ `HomePage.tsx` ICON_MAP 四件套。
7. **验证**(SOP §7):构建层、浏览器层(mock 登录注入)、回归层逐项打勾。 7. **验证**(SOP §7):构建层、浏览器层(mock 登录注入)、回归层逐项打勾。
8. **部署检查**(SOP §8):nginx 加固与生产地址冒烟。 8. **部署检查**(SOP §8):nginx 加固与生产地址冒烟。
## 红线(违反必出事故) ## 红线(违反必出事故)
- **路由与资源目录永不同名**:资源只放 `public/mod-assets/<name>/`,绝不能放 `public/<name>/`。否则 dist 下出现与路由同名目录,nginx 目录 301 补斜杠并把容器端口 `:8901` 泄漏进浏览器地址栏,新页签 403/空白(2026-10 生产事故,SOP §3、§8)。 - **路由与资源目录永不同名**:资源只放 `public/mod-assets/<name>/`,绝不能放 `public/<name>/`。否则 dist 下出现与路由同名目录,nginx 目录 301 补斜杠并把容器端口 `:8901` 泄漏进浏览器地址栏,新页签 403/空白(2026-10 生产事故,SOP §3、§8)。
- **样式绝对隔离**:所有 CSS 选择器挂模块根容器类下,平台各模块 CSS 全局共载,裸选择器必然跨模块污染;ID 选择器特异性最高,`#nav` 类冲突需给旧模块规则也加前缀(SOP §4.2)。 - **样式绝对隔离**:所有 CSS 选择器挂模块根容器类下。模块 CSS 虽随 React.lazy 路由 chunk 按需加载,但加载后仍全局生效,裸选择器必然跨模块污染;同名 `@keyframes`/工具类若值不同必须重命名或作用域化。全局选择器由 `npm run check:styles` 零容忍门禁拦截(已接入 build,SOP §4.5);ID 选择器特异性最高,`#nav` 类冲突需给旧模块规则也加前缀(SOP §4.2)。
- **零平台侵入**:不改 `document.body`/`document.documentElement`,存储 key 带模块前缀,不与平台路由冲突。 - **零平台侵入**:不改 `document.body`/`document.documentElement`,存储 key 带模块前缀,不与平台路由冲突。
- **Provider 必须迁移**:漏迁 `AppProvider` 会导致路由渲染时 context 为 null 白屏。 - **Provider 必须迁移**:漏迁 `AppProvider` 会导致路由渲染时 context 为 null 白屏。
## 验证捷径 ## 验证捷径
- 提交/构建前跑 `npm run check:styles`(已接入 build 门禁),退出码 0 = 模块 CSS 无全局选择器违规。
- 构建后 `ls dist/` 确认根目录无与路由同名目录。 - 构建后 `ls dist/` 确认根目录无与路由同名目录。
- 部署后 `curl -sI https://生产域名/<name>` 期望 200(或 302 跳登录);出现 301 且 Location 带 `:8901` 即端口泄漏信号。 - 部署后 `curl -sI https://生产域名/<name>` 期望 200(或 302 跳登录);出现 301 且 Location 带 `:8901` 即端口泄漏信号。
- 浏览器验证前先注入 mock 会话:`sessionStorage.setItem('userToken', 'mock-token-for-ui-check')`。 - 浏览器验证前先注入 mock 会话:`sessionStorage.setItem('userToken', 'mock-token-for-ui-check')`。
@@ -7,7 +7,7 @@
## 0. 核心原则(先记住这四条) ## 0. 核心原则(先记住这四条)
1. **样式绝对隔离**:平台所有模块的 CSS 会同时全局加载(静态 import,无懒加载隔离),任何裸元素选择器、`:root`/`body` 全局规则、裸 class/ID 选择器都会跨模块污染。**模块所有 CSS 选择器必须挂在模块根容器类下**。 1. **样式绝对隔离**:模块 CSS 随 React.lazy 路由 chunk 按需加载(进入模块才下载该模块 JS+CSS),但加载后仍全局生效,任何裸元素选择器、`:root`/`body` 全局规则、裸 class/ID 选择器都会跨模块污染。**模块所有 CSS 选择器必须挂在模块根容器类下**;同名 `@keyframes` 与同名工具类若值不同,必须重命名或作用域化。
2. **路由与资源目录永不同名**:模块路由名(如 `/wuc-quotation`)绝不能与 `dist` 下静态资源目录同名,否则 nginx `try_files $uri` 命中目录触发自动 301 补斜杠重定向,Location 会带上容器内端口(8901)泄漏进浏览器地址栏,随后 403(详见 §3、§8)。资源统一放 `public/mod-assets/<模块名>/`。 2. **路由与资源目录永不同名**:模块路由名(如 `/wuc-quotation`)绝不能与 `dist` 下静态资源目录同名,否则 nginx `try_files $uri` 命中目录触发自动 301 补斜杠重定向,Location 会带上容器内端口(8901)泄漏进浏览器地址栏,随后 403(详见 §3、§8)。资源统一放 `public/mod-assets/<模块名>/`。
3. **零平台侵入**:模块不得修改 `document.body`/`document.documentElement` 的 class/style,不得占用全局 localStorage key,不得与平台路由冲突。 3. **零平台侵入**:模块不得修改 `document.body`/`document.documentElement` 的 class/style,不得占用全局 localStorage key,不得与平台路由冲突。
4. **入口职责迁移**:源项目 `main.tsx` 中的 Provider 包裹、全局 CSS 引入等职责,全部迁移到模块 `App.tsx`,平台路由直接渲染模块默认导出。 4. **入口职责迁移**:源项目 `main.tsx` 中的 Provider 包裹、全局 CSS 引入等职责,全部迁移到模块 `App.tsx`,平台路由直接渲染模块默认导出。
@@ -123,6 +123,14 @@ return <div className="xxx-root" ref={rootRef}>...</div>
- `@keyframes` 命名全平台唯一(冲突时给新模块 keyframes 加前缀) - `@keyframes` 命名全平台唯一(冲突时给新模块 keyframes 加前缀)
- 各模块 CSS 文件内不放 `@import` 全局重置(normalize/reset 一律禁止) - 各模块 CSS 文件内不放 `@import` 全局重置(normalize/reset 一律禁止)
### 4.5 全局选择器门禁(check:styles)
`scripts/check-module-styles.mjs`(`npm run check:styles`)是样式隔离的零容忍门禁:以状态机逐字符解析扫描 `src/modules/**/*.css`(兼容数 MB 的 minified CSS 与 data URI 字符串),命中裸标签选择器(`button`/`table` 等)、裸 `:root`/伪类伪元素(`::-webkit-scrollbar` 等)、通配符 `*`、裸属性选择器、`@import` 引入 reset/normalize 即判违规,非零码退出。已接入 build 门禁(`npm run build` = `tsc -b && npm run check:styles && vite build`),日常可单独运行:
```bash
npm run check:styles # 退出码 0 = 模块 CSS 无全局选择器违规
```
--- ---
## 5. 代码适配 ## 5. 代码适配
@@ -180,11 +188,19 @@ export const moduleConfig: ModuleConfig = {
```ts ```ts
// 2. src/modules/registry.ts:import + modules 数组追加 // 2. src/modules/registry.ts:import + modules 数组追加
// 3. src/App.tsx:路由(ModuleTitle 负责页签标题,卸载恢复 'EIOSpace') // 3. src/App.tsx:模块级 React.lazy 动态导入 + 路由(ModuleTitle 负责页签标题,卸载恢复 'EIOSpace')
<Route path="/<name>" element={<RequireAuth><ModuleTitle title="模块中文名"><XxxApp /></ModuleTitle></RequireAuth>} /> const XxxApp = lazy(() => import('@/modules/<name>/App'));
...
<Routes>
<Suspense fallback={<ModuleLoading />}>
<Route path="/<name>" element={<RequireAuth><ModuleTitle title="模块中文名"><XxxApp /></ModuleTitle></RequireAuth>} />
...
</Suspense>
</Routes>
// 4. src/pages/HomePage.tsx:ICON_MAP 增加图标(先在 lucide-react import 中补图标名) // 4. src/pages/HomePage.tsx:ICON_MAP 增加图标(先在 lucide-react import 中补图标名)
``` ```
> 模块入口必须用 `React.lazy` 动态导入(模块 CSS 随路由 chunk 按需加载),**静态 import 会把模块 CSS 打进主包,禁止**。
> 首页卡片点击已是 `window.open(mod.path, '_blank')` 新页签打开,无需额外处理。 > 首页卡片点击已是 `window.open(mod.path, '_blank')` 新页签打开,无需额外处理。
--- ---
@@ -193,7 +209,8 @@ export const moduleConfig: ModuleConfig = {
**构建层** **构建层**
- [ ] `npx tsc --noEmit` 通过 - [ ] `npx tsc --noEmit` 通过
- [ ] `npm run build` 通过(注意 `tsc -b` 比 `tsc --noEmit` 更严,以 build 为准) - [ ] `npm run build` 通过(注意 `tsc -b` 比 `tsc --noEmit` 更严,以 build 为准;已含 `check:styles` 门禁)
- [ ] `npm run check:styles` 退出码 0(模块 CSS 全局选择器零容忍门禁,见 §4.5,已接入 build)
- [ ] `dist/mod-assets/<name>/` 资源齐全 - [ ] `dist/mod-assets/<name>/` 资源齐全
- [ ] **`ls dist/` 确认根目录下没有与模块路由同名的目录**(防端口泄漏,见 §3) - [ ] **`ls dist/` 确认根目录下没有与模块路由同名的目录**(防端口泄漏,见 §3)
@@ -207,6 +224,8 @@ sessionStorage.setItem('userInfo', JSON.stringify({ name: '演示用户', userId
- [ ] 页内交互可用(菜单切换、弹窗、主题切换) - [ ] 页内交互可用(菜单切换、弹窗、主题切换)
- [ ] 新页签打开后浏览器标题为模块中文名 - [ ] 新页签打开后浏览器标题为模块中文名
- [ ] 首页出现新模块卡片(图标、配色正确) - [ ] 首页出现新模块卡片(图标、配色正确)
- [ ] 首页(未进入任何模块)Network 面板无任何模块级 CSS chunk
- [ ] 首次进入模块路由时按需加载对应 JS+CSS chunk(React.lazy 生效)
**回归层(改了旧模块 CSS 时必做)** **回归层(改了旧模块 CSS 时必做)**
- [ ] 新模块关键布局 computed style 复核(如 nav 的 display) - [ ] 新模块关键布局 computed style 复核(如 nav 的 display)
@@ -254,3 +273,4 @@ curl -sI https://ai-workshop.digiwincloud.com.cn/<name> | head -5
| wuc-quotation | `@media` 内规则未递归前缀化(首版转换脚本 bug) | 递归处理 + 转换后自动校验 | | wuc-quotation | `@media` 内规则未递归前缀化(首版转换脚本 bug) | 递归处理 + 转换后自动校验 |
| wuc-quotation ↔ supplier-platform | `#nav` ID 特异性碾压类前缀,菜单被改 flex 水平 | 旧模块规则改 `.hansong-app #nav`;SOP 增加 ID 冲突检测 | | wuc-quotation ↔ supplier-platform | `#nav` ID 特异性碾压类前缀,菜单被改 flex 水平 | 旧模块规则改 `.hansong-app #nav`;SOP 增加 ID 冲突检测 |
| jieya-ibp / welltrust-qap | sql.js wasm 路径、logo 相对路径失效 | 统一 `locateFile: () => '/mod-assets/<name>/...'` | | jieya-ibp / welltrust-qap | sql.js wasm 路径、logo 相对路径失效 | 统一 `locateFile: () => '/mod-assets/<name>/...'` |
| 全部模块 | 模块 CSS 全局选择器(`:root`/`button`/`table`/`::-webkit-scrollbar`/`*`)跨模块污染 | 加模块根容器前缀 + `check:styles` 门禁(§4.5,已接入 build) |
@@ -0,0 +1,12 @@
# Checklist
- [x] `src/App.tsx` 全部模块组件改为 `React.lazy()` 动态导入,`<Suspense>` 兜底生效
- [x] `npx tsc -b` 类型检查通过
- [x] `npm run build` 成功,`dist/assets` 中每个模块的 CSS 为独立 chunk 文件(8 个 css chunk:主 css 12KB 仅平台样式,wuc 7.8MB、supplier/baode/jieya/welltrust/bomx 各自独立,共享 styles chunk 1 个)
- [x] `scripts/check-module-styles.mjs` 存在且能正确检测 `:root`/`html`/`body`/`*`/裸元素选择器/`@import` 重置,违规时非 0 退出并列出文件+行号(对 git HEAD 存量验证:46 条违规全部检出且行号正确,wuc 7.8MB data URI 零误报)
- [x] `package.json` 含 `check:styles` 脚本,且 `build` 脚本已接入该门禁(`tsc -b && npm run check:styles && vite build`)
- [x] `bomx-reuse-analyzer/styles.css` 无 `:root` 残留,模块页面 CSS 变量取值正常、视觉无回归(浏览器实测浅色 BOM 界面正常渲染)
- [x] `npm run check:styles` 退出码 0(✓ 模块样式检查通过,扫描 12 个文件)
- [x] 首页加载时 Network 面板无任何模块级 CSS chunk(实测仅 /src/index.css)
- [x] 跳转 `supplier-platform`/`wuc-quotation`/`bomx-reuse-analyzer` 时按需加载对应样式且渲染正常、无控制台报错(wuc 6 个样式文件按需加载;另验 jieya-ibp 深色主题正常)
- [x] 平台首页与登录页视觉未受模块样式污染(星空动画、卡片、按钮样式实测正常)
- [x] `docs/react-module-integration-sop.md` 与 `.trae/skills/react-module-integration/SKILL.md` 已包含 lazy 路由约定与 check:styles 校验说明(references 副本同步)
@@ -0,0 +1,70 @@
# 模块样式隔离与按需加载 Spec
## Why
当前 `src/App.tsx` 静态 import 全部 12 个模块的 App 组件,导致所有模块的 JS 与 CSS 全部打进主包,用户打开首页即下载全部模块样式(wuc-quotation 单个模块 CSS 约 7.8MB)。同时样式隔离仅依赖 SOP 中的手工命名空间约定,无自动化守护,仍存在残留全局选择器(如 `bomx-reuse-analyzer/styles.css` 的 `:root` 规则)可跨模块污染。
## What Changes
- **路由级懒加载**:`src/App.tsx` 中模块组件改为 `React.lazy()` 动态导入,外层包 `<Suspense>` 加载兜底;Vite 自动将每个模块拆为独立 JS+CSS chunk,仅在跳转到对应路由时才加载该模块样式。
- **样式隔离自动化守护**:新增 `scripts/check-module-styles.mjs` 检查脚本,扫描 `src/modules/**/*.css` 中的全局选择器(`:root`/`html`/`body`/`*`/裸元素选择器/`@import` 全局重置),发现违规即报错退出;注册为 `npm run check:styles`。
- **修复存量违规**:`bomx-reuse-analyzer/styles.css` 的 `:root` CSS 变量迁移到模块根容器类下。
- **构建管线接入**:存量违规清零后,将 `check:styles` 纳入 `build` 脚本,防止后续模块引入全局选择器。
- **文档同步**:更新 SOP 文档与 react-module-integration 技能,明确新模块接入必须使用 lazy 路由模式 + 命名空间根容器。
## Impact
- Affected specs: 无既有 spec(首次建立)
- Affected code:
- `src/App.tsx`(懒加载改造)
- `src/modules/bomx-reuse-analyzer/styles.css`(存量违规修复)
- `scripts/check-module-styles.mjs`(新增)
- `package.json`(新增 check:styles 脚本、build 接入)
- `docs/react-module-integration-sop.md`、`.trae/skills/react-module-integration/SKILL.md`(文档同步)
## ADDED Requirements
### Requirement: 模块按需加载
系统 SHALL 以 `React.lazy()` 动态导入方式注册全部模块路由,保证模块代码与样式拆分为独立 chunk,仅在用户导航至该模块路由时才发起加载。
#### Scenario: 首页不加载模块样式
- **WHEN** 用户登录后停留在平台首页(`/`)
- **THEN** Network 面板中不出现任何模块级 CSS chunk(如 `wuc-quotation`、`supplier-platform` 的 CSS 文件)
#### Scenario: 跳转模块时加载对应样式
- **WHEN** 用户首次导航到某模块路由(如 `/supplier-platform`)
- **THEN** 浏览器按需加载该模块对应的 JS 与 CSS chunk,模块界面正常渲染
#### Scenario: 加载期间兜底 UI
- **WHEN** 模块 chunk 尚在加载中
- **THEN** Suspense 兜底占位展示(平台风格的加载提示),加载完成后无报错切换至模块界面
#### Scenario: 构建产物按模块拆分
- **WHEN** 执行 `npm run build`
- **THEN** `dist/assets` 中每个模块生成独立的 JS 与 CSS 产物(含路由引用关系),`tsc -b` 类型检查通过
### Requirement: 模块样式全局选择器零容忍
系统 SHALL 提供自动化检查脚本,确保 `src/modules/**/*.css` 中不出现全局作用选择器;检查结果 SHALL 作为构建门禁。
#### Scenario: 扫描通过
- **WHEN** 执行 `npm run check:styles` 且所有模块 CSS 均挂在模块命名空间根容器类下
- **THEN** 脚本以退出码 0 结束,无违规输出
#### Scenario: 扫描发现违规
- **WHEN** 某模块 CSS 中存在 `:root`、`html`、`body`、`*`、裸元素选择器或 `@import` 全局重置
- **THEN** 脚本以非 0 退出码失败,并逐条输出违规文件、行号与选择器内容
#### Scenario: 构建门禁生效
- **WHEN** 模块 CSS 存在全局选择器违规时执行 `npm run build`
- **THEN** 构建失败并提示先修复样式违规
### Requirement: 存量违规清零
系统 SHALL 保证现有 12 个模块 CSS 无全局选择器残留,不污染平台首页、登录页及其它模块。
#### Scenario: bomx-reuse-analyzer 变量迁移
- **WHEN** `src/modules/bomx-reuse-analyzer/styles.css` 中存在 `:root { --xxx }` 规则
- **THEN** 变量定义迁移至该模块根容器类下,模块页面变量取值正常,视觉无回归
### Requirement: 新模块接入约定同步
SOP 文档与 react-module-integration 技能 SHALL 同步更新:新模块路由必须使用 lazy 动态导入模式,CSS 必须挂载在模块命名空间根容器下,并通过 check:styles 校验。
#### Scenario: 文档含懒加载约定
- **WHEN** 查阅 SOP 文档或技能文件
- **THEN** 可找到 lazy 路由模式代码约定与 check:styles 校验说明
@@ -0,0 +1,30 @@
# Tasks
- [x] Task 1: 路由级懒加载改造
- [x] SubTask 1.1: `src/App.tsx` 将 12 个模块组件的静态 import 全部改为 `React.lazy(() => import('...'))`
- [x] SubTask 1.2: `<Routes>` 外层包 `<Suspense>`,提供平台风格 loading 兜底(居中 spinner + "模块加载中"文案)
- [x] SubTask 1.3: 验证 `npx tsc -b` 类型检查通过;`npm run build` 后确认 `dist/assets` 中各模块 CSS 拆分为独立文件
- [x] Task 2: 样式隔离自动检查脚本
- [x] SubTask 2.1: 新增 `scripts/check-module-styles.mjs`:递归扫描 `src/modules/**/*.css`,检测 `:root`/`html`/`body`/`*` 选择器、裸元素选择器(无类/ID/命名空间前缀的元素标签规则)、`@import` 全局重置;违规输出文件+行号+选择器,非 0 退出
- [x] SubTask 2.2: `package.json` 注册 `"check:styles": "node scripts/check-module-styles.mjs"`
- [ ] Task 3: 修复存量违规(勘察确认共 5 个模组存在裸选择器,修复后须全部通过 check:styles)
- [x] SubTask 3.1: `bomx-reuse-analyzer/styles.css`(根容器 `.bomx-app`):`:root`→`.bomx-app`、`::-webkit-scrollbar*`/`input[type=...]`/`select`/`input:focus`/`:focus-visible` 全部加前缀
- [x] SubTask 3.2: `order-cost-analysis`:为 `pages-orig/CostCockpit.tsx`、`pages-orig/AIMCockpit.tsx` 根 div 添加 `ordercost-root` 类,`styles.css` 顶部级 `::-webkit-scrollbar` 三条规则加前缀
- [x] SubTask 3.3: `jieya-ibp`:App.tsx 根 div(加载态 + 主态)添加 `jieya-root` 类;`index.css` 的 `button`/`input, textarea`/`::-webkit-scrollbar` 四条规则加前缀
- [x] SubTask 3.4: `welltrust-qap`:同 3.3,根类 `welltrust-root`
- [x] SubTask 3.5: `supplier-platform/index.css`:`main`、`table/th/td/tr.rec-row/tbody tr` 等裸元素规则加 `.hansong-app` 前缀
- [x] SubTask 3.6: 检查受影响模组的 `createPortal` 挂载点均位于模块根容器内(bomx Drawer 挂 document.body 需包 `.bomx-app` 类包裹层);baode/bomx/jieya/welltrust 的 `@media (prefers-reduced-motion)` 内 `*` 通配规则加根前缀;jieya/welltrust 的 `.space-*` 同名不同值工具类作用域化、`slide-in-right` 等同名不同体 keyframes 重命名
- [x] SubTask 3.7: `npm run check:styles` 退出码 0(存量违规清零)
- [x] Task 4: 构建门禁与文档同步
- [x] SubTask 4.1: `package.json` 的 `build` 脚本接入 `check:styles`(`tsc -b && npm run check:styles && vite build`)
- [x] SubTask 4.2: 更新 `docs/react-module-integration-sop.md`:新增「路由必须 lazy 动态导入」约定与 check:styles 校验说明
- [x] SubTask 4.3: 同步 `.trae/skills/react-module-integration/SKILL.md`(红线与验证清单补充懒加载要求)
- [x] Task 5: 端到端验证
- [x] SubTask 5.1: `npm run dev` 启动,浏览器验证:首页 Network 无任何模块 CSS chunk(实测仅 /src/index.css)
- [x] SubTask 5.2: 依次跳转 `supplier-platform`、`wuc-quotation`、`bomx-reuse-analyzer`:按需加载对应 chunk、界面渲染正常、无控制台报错(另验 jieya-ibp 深色主题正常)
- [x] SubTask 5.3: 抽查首页与登录页视觉无污染、`bomx-reuse-analyzer` 页面样式无回归
# Task Dependencies
- Task 3 依赖 Task 2(需要脚本先检测出违规)
- Task 4 依赖 Task 2、Task 3(违规清零后才接入构建门禁)
- Task 5 依赖 Task 1(懒加载完成后方可验证按需加载);SubTask 5.3 依赖 Task 3
- Task 2 与 Task 1 无依赖,可并行
+24 -4
View File
@@ -7,7 +7,7 @@
## 0. 核心原则(先记住这四条) ## 0. 核心原则(先记住这四条)
1. **样式绝对隔离**:平台所有模块的 CSS 会同时全局加载(静态 import,无懒加载隔离),任何裸元素选择器、`:root`/`body` 全局规则、裸 class/ID 选择器都会跨模块污染。**模块所有 CSS 选择器必须挂在模块根容器类下**。 1. **样式绝对隔离**:模块 CSS 随 React.lazy 路由 chunk 按需加载(进入模块才下载该模块 JS+CSS),但加载后仍全局生效,任何裸元素选择器、`:root`/`body` 全局规则、裸 class/ID 选择器都会跨模块污染。**模块所有 CSS 选择器必须挂在模块根容器类下**;同名 `@keyframes` 与同名工具类若值不同,必须重命名或作用域化。
2. **路由与资源目录永不同名**:模块路由名(如 `/wuc-quotation`)绝不能与 `dist` 下静态资源目录同名,否则 nginx `try_files $uri` 命中目录触发自动 301 补斜杠重定向,Location 会带上容器内端口(8901)泄漏进浏览器地址栏,随后 403(详见 §3、§8)。资源统一放 `public/mod-assets/<模块名>/`。 2. **路由与资源目录永不同名**:模块路由名(如 `/wuc-quotation`)绝不能与 `dist` 下静态资源目录同名,否则 nginx `try_files $uri` 命中目录触发自动 301 补斜杠重定向,Location 会带上容器内端口(8901)泄漏进浏览器地址栏,随后 403(详见 §3、§8)。资源统一放 `public/mod-assets/<模块名>/`。
3. **零平台侵入**:模块不得修改 `document.body`/`document.documentElement` 的 class/style,不得占用全局 localStorage key,不得与平台路由冲突。 3. **零平台侵入**:模块不得修改 `document.body`/`document.documentElement` 的 class/style,不得占用全局 localStorage key,不得与平台路由冲突。
4. **入口职责迁移**:源项目 `main.tsx` 中的 Provider 包裹、全局 CSS 引入等职责,全部迁移到模块 `App.tsx`,平台路由直接渲染模块默认导出。 4. **入口职责迁移**:源项目 `main.tsx` 中的 Provider 包裹、全局 CSS 引入等职责,全部迁移到模块 `App.tsx`,平台路由直接渲染模块默认导出。
@@ -123,6 +123,14 @@ return <div className="xxx-root" ref={rootRef}>...</div>
- `@keyframes` 命名全平台唯一(冲突时给新模块 keyframes 加前缀) - `@keyframes` 命名全平台唯一(冲突时给新模块 keyframes 加前缀)
- 各模块 CSS 文件内不放 `@import` 全局重置(normalize/reset 一律禁止) - 各模块 CSS 文件内不放 `@import` 全局重置(normalize/reset 一律禁止)
### 4.5 全局选择器门禁(check:styles)
`scripts/check-module-styles.mjs`(`npm run check:styles`)是样式隔离的零容忍门禁:以状态机逐字符解析扫描 `src/modules/**/*.css`(兼容数 MB 的 minified CSS 与 data URI 字符串),命中裸标签选择器(`button`/`table` 等)、裸 `:root`/伪类伪元素(`::-webkit-scrollbar` 等)、通配符 `*`、裸属性选择器、`@import` 引入 reset/normalize 即判违规,非零码退出。已接入 build 门禁(`npm run build` = `tsc -b && npm run check:styles && vite build`),日常可单独运行:
```bash
npm run check:styles # 退出码 0 = 模块 CSS 无全局选择器违规
```
--- ---
## 5. 代码适配 ## 5. 代码适配
@@ -180,11 +188,19 @@ export const moduleConfig: ModuleConfig = {
```ts ```ts
// 2. src/modules/registry.ts:import + modules 数组追加 // 2. src/modules/registry.ts:import + modules 数组追加
// 3. src/App.tsx:路由(ModuleTitle 负责页签标题,卸载恢复 'EIOSpace') // 3. src/App.tsx:模块级 React.lazy 动态导入 + 路由(ModuleTitle 负责页签标题,卸载恢复 'EIOSpace')
<Route path="/<name>" element={<RequireAuth><ModuleTitle title="模块中文名"><XxxApp /></ModuleTitle></RequireAuth>} /> const XxxApp = lazy(() => import('@/modules/<name>/App'));
...
<Routes>
<Suspense fallback={<ModuleLoading />}>
<Route path="/<name>" element={<RequireAuth><ModuleTitle title="模块中文名"><XxxApp /></ModuleTitle></RequireAuth>} />
...
</Suspense>
</Routes>
// 4. src/pages/HomePage.tsx:ICON_MAP 增加图标(先在 lucide-react import 中补图标名) // 4. src/pages/HomePage.tsx:ICON_MAP 增加图标(先在 lucide-react import 中补图标名)
``` ```
> 模块入口必须用 `React.lazy` 动态导入(模块 CSS 随路由 chunk 按需加载),**静态 import 会把模块 CSS 打进主包,禁止**。
> 首页卡片点击已是 `window.open(mod.path, '_blank')` 新页签打开,无需额外处理。 > 首页卡片点击已是 `window.open(mod.path, '_blank')` 新页签打开,无需额外处理。
--- ---
@@ -193,7 +209,8 @@ export const moduleConfig: ModuleConfig = {
**构建层** **构建层**
- [ ] `npx tsc --noEmit` 通过 - [ ] `npx tsc --noEmit` 通过
- [ ] `npm run build` 通过(注意 `tsc -b` 比 `tsc --noEmit` 更严,以 build 为准) - [ ] `npm run build` 通过(注意 `tsc -b` 比 `tsc --noEmit` 更严,以 build 为准;已含 `check:styles` 门禁)
- [ ] `npm run check:styles` 退出码 0(模块 CSS 全局选择器零容忍门禁,见 §4.5,已接入 build)
- [ ] `dist/mod-assets/<name>/` 资源齐全 - [ ] `dist/mod-assets/<name>/` 资源齐全
- [ ] **`ls dist/` 确认根目录下没有与模块路由同名的目录**(防端口泄漏,见 §3) - [ ] **`ls dist/` 确认根目录下没有与模块路由同名的目录**(防端口泄漏,见 §3)
@@ -207,6 +224,8 @@ sessionStorage.setItem('userInfo', JSON.stringify({ name: '演示用户', userId
- [ ] 页内交互可用(菜单切换、弹窗、主题切换) - [ ] 页内交互可用(菜单切换、弹窗、主题切换)
- [ ] 新页签打开后浏览器标题为模块中文名 - [ ] 新页签打开后浏览器标题为模块中文名
- [ ] 首页出现新模块卡片(图标、配色正确) - [ ] 首页出现新模块卡片(图标、配色正确)
- [ ] 首页(未进入任何模块)Network 面板无任何模块级 CSS chunk
- [ ] 首次进入模块路由时按需加载对应 JS+CSS chunk(React.lazy 生效)
**回归层(改了旧模块 CSS 时必做)** **回归层(改了旧模块 CSS 时必做)**
- [ ] 新模块关键布局 computed style 复核(如 nav 的 display) - [ ] 新模块关键布局 computed style 复核(如 nav 的 display)
@@ -254,3 +273,4 @@ curl -sI https://ai-workshop.digiwincloud.com.cn/<name> | head -5
| wuc-quotation | `@media` 内规则未递归前缀化(首版转换脚本 bug) | 递归处理 + 转换后自动校验 | | wuc-quotation | `@media` 内规则未递归前缀化(首版转换脚本 bug) | 递归处理 + 转换后自动校验 |
| wuc-quotation ↔ supplier-platform | `#nav` ID 特异性碾压类前缀,菜单被改 flex 水平 | 旧模块规则改 `.hansong-app #nav`;SOP 增加 ID 冲突检测 | | wuc-quotation ↔ supplier-platform | `#nav` ID 特异性碾压类前缀,菜单被改 flex 水平 | 旧模块规则改 `.hansong-app #nav`;SOP 增加 ID 冲突检测 |
| jieya-ibp / welltrust-qap | sql.js wasm 路径、logo 相对路径失效 | 统一 `locateFile: () => '/mod-assets/<name>/...'` | | jieya-ibp / welltrust-qap | sql.js wasm 路径、logo 相对路径失效 | 统一 `locateFile: () => '/mod-assets/<name>/...'` |
| 全部模块 | 模块 CSS 全局选择器(`:root`/`button`/`table`/`::-webkit-scrollbar`/`*`)跨模块污染 | 加模块根容器前缀 + `check:styles` 门禁(§4.5,已接入 build) |
+3 -2
View File
@@ -5,8 +5,9 @@
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc -b && vite build", "build": "tsc -b && npm run check:styles && vite build",
"preview": "vite preview" "preview": "vite preview",
"check:styles": "node scripts/check-module-styles.mjs"
}, },
"dependencies": { "dependencies": {
"@ant-design/icons": "^5.4.0", "@ant-design/icons": "^5.4.0",
+267
View File
@@ -0,0 +1,267 @@
#!/usr/bin/env node
/**
* 模块样式命名空间检查(门禁脚本)
*
* 平台规则:src/modules 下所有 .css 中选择器必须挂在模块根容器类(命名空间)下,
* 禁止全局作用选择器(裸标签 / :root / 通配符 / 裸伪类 / 裸属性选择器等)跨模块污染。
*
* 实现:状态机逐字符解析(模块内存在数 MB 的 minified CSS,含大量 data URI
* 字符串与花括号,不能依赖简单正则)。零依赖,Node >= 18。
*/
import { readdirSync, readFileSync } from 'node:fs';
import path from 'node:path';
import { fileURLToPath } from 'node:url';
const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
const MODULES_DIR = path.join(ROOT, 'src', 'modules');
const MAX_LEN = 80;
/* ---------------------------------- 文件收集 ---------------------------------- */
function collectCssFiles(dir) {
const out = [];
let entries;
try {
entries = readdirSync(dir, { withFileTypes: true });
} catch {
return out;
}
for (const entry of entries) {
const full = path.join(dir, entry.name);
if (entry.isDirectory()) {
out.push(...collectCssFiles(full));
} else if (entry.isFile() && entry.name.toLowerCase().endsWith('.css')) {
out.push(full);
}
}
return out;
}
/* --------------------------------- 选择器判定 --------------------------------- */
/**
* 判定单个选择器(已 trim)是否为全局作用选择器。
* 返回 null 表示合法(挂在类/ID 命名空间下),否则返回原因字符串。
*/
function classifySelector(sel) {
if (!sel || sel.startsWith('@')) return null;
// 裸伪类/伪元素::root、:focus-visible、::-webkit-scrollbar 等,等价于通配符
if (sel.startsWith(':')) {
if (/^:root(?![a-zA-Z0-9_-])/.test(sel)) return '裸 :root 选择器(全局作用)';
return '裸伪类/伪元素(等价于通配符,全局作用)';
}
if (sel.startsWith('*')) return '通配符 *(全局作用)';
if (sel.startsWith('[')) return '裸属性选择器(全局作用)';
// 裸标签:首 token 匹配 /^[a-zA-Z][a-zA-Z0-9-]*$/ 且不是 CSS 函数(后面紧跟 "(")
const m = sel.match(/^[a-zA-Z][a-zA-Z0-9-]*/);
if (m) {
const next = sel.charAt(m[0].length);
if (next !== '(') {
return `裸标签选择器「${m[0]}」(未挂在模块根容器下)`;
}
}
return null;
}
/**
* 按顶层逗号拆分选择器列表:括号 ( ) 与属性选择器 [ ] 内的逗号不拆分,
* 引号字符串内的逗号不拆分。
*/
function splitTopLevelCommas(s) {
const parts = [];
let cur = '';
let paren = 0;
let bracket = 0;
let quote = null;
let escaped = false;
for (const ch of s) {
if (quote) {
cur += ch;
if (escaped) escaped = false;
else if (ch === '\\') escaped = true;
else if (ch === quote) quote = null;
continue;
}
if (ch === '"' || ch === "'") {
quote = ch;
cur += ch;
continue;
}
if (ch === '(') paren++;
else if (ch === ')') paren = Math.max(0, paren - 1);
else if (ch === '[') bracket++;
else if (ch === ']') bracket = Math.max(0, bracket - 1);
if (ch === ',' && paren === 0 && bracket === 0) {
parts.push(cur);
cur = '';
continue;
}
cur += ch;
}
parts.push(cur);
return parts;
}
function truncate(s) {
return s.length > MAX_LEN ? `${s.slice(0, MAX_LEN - 3)}...` : s;
}
/* --------------------------------- 状态机解析 --------------------------------- */
/**
* 逐字符解析 CSS 文本。
* - 跳过块注释与字符串内容(data URI 中的 { } ; ( ) 不影响结构);
* - 跟踪大括号深度与栈帧:'media'(@media/@supports 内继续扫描)、
* 'rule'(普通规则块,声明不扫描)、'skip'(@keyframes/@font-face 等块内不扫描);
* - prelude("{" 之前的文本)在扫描态下累积,用于选择器判定与 @import 检查。
*
* onRule(prelude, line) —— 每条普通规则回调;
* onImport(prelude, line) —— 每条顶层(或 @media 内)@import 回调。
*/
function parseCss(source, onRule, onImport) {
const stack = [];
let prelude = '';
let preludeLine = -1;
let line = 1;
let inComment = false;
let quote = null;
let escaped = false;
const scanMode = () => stack.length === 0 || stack[stack.length - 1] === 'media';
const resetPrelude = () => {
prelude = '';
preludeLine = -1;
};
for (let i = 0; i < source.length; i++) {
const ch = source[i];
if (ch === '\n') line++;
if (inComment) {
if (ch === '*' && source[i + 1] === '/') {
inComment = false;
i++;
}
continue;
}
if (quote) {
// 字符串内容原样跳过(不解析其中的 { } ; 等);
// 为支持 @import 目标检查,扫描态下仍原样记录进 prelude。
if (escaped) {
escaped = false;
} else if (ch === '\\') {
escaped = true;
} else if (ch === quote) {
quote = null;
}
if (scanMode()) prelude += ch;
continue;
}
if (ch === '"' || ch === "'") {
quote = ch;
if (scanMode()) {
if (preludeLine === -1 && /\S/.test(ch)) preludeLine = line;
prelude += ch;
}
continue;
}
if (ch === '/' && source[i + 1] === '*') {
inComment = true;
i++;
continue;
}
if (ch === '{') {
const trimmed = prelude.trim();
let frame;
if (scanMode() && trimmed.startsWith('@')) {
const m = trimmed.match(/^@([a-zA-Z0-9-]+)/);
const name = m ? m[1].toLowerCase() : '';
// @media / @supports 递归继续扫描内部规则;其余 at-rule 跳过块内选择器
frame = name === 'media' || name === 'supports' ? 'media' : 'skip';
} else if (scanMode()) {
if (trimmed) onRule(trimmed, preludeLine === -1 ? line : preludeLine);
frame = 'rule';
} else {
frame = 'skip';
}
stack.push(frame);
resetPrelude();
continue;
}
if (ch === '}') {
if (stack.length) stack.pop();
resetPrelude();
continue;
}
if (ch === ';') {
if (scanMode()) {
const trimmed = prelude.trim();
if (/^@import\b/.test(trimmed)) {
onImport(trimmed, preludeLine === -1 ? line : preludeLine);
}
}
resetPrelude();
continue;
}
if (scanMode()) {
if (preludeLine === -1 && /\S/.test(ch)) preludeLine = line;
prelude += ch;
}
}
}
/* ------------------------------------ 主流程 ----------------------------------- */
function main() {
const files = collectCssFiles(MODULES_DIR).sort();
const violations = [];
const addViolation = (rel, line, selector, reason) => {
violations.push(`[违规] ${rel}:${line} ${truncate(selector)} ${reason}`);
};
for (const file of files) {
const rel = path.relative(ROOT, file).split(path.sep).join('/');
const source = readFileSync(file, 'utf8');
parseCss(
source,
(prelude, line) => {
for (const part of splitTopLevelCommas(prelude)) {
const sel = part.trim();
const reason = classifySelector(sel);
if (reason) addViolation(rel, line, sel, reason);
}
},
(prelude, line) => {
if (/(^|[^a-z0-9])(reset|normalize)/i.test(prelude)) {
addViolation(rel, line, prelude, '@import 引入 reset/normalize 样式(全局污染)');
}
},
);
}
if (violations.length > 0) {
for (const v of violations) console.log(v);
const badFiles = new Set(violations.map((v) => v.split(' ')[0])).size;
console.log(
`[汇总] 模块样式命名空间检查失败:共 ${violations.length} 条违规,涉及 ${badFiles} 个文件(共扫描 ${files.length} 个文件)`,
);
process.exit(1);
}
console.log(`✓ 模块样式检查通过(扫描 ${files.length} 个文件)`);
process.exit(0);
}
main();
+47 -14
View File
@@ -1,26 +1,58 @@
import { lazy, Suspense } from 'react';
import { Routes, Route } from 'react-router-dom'; import { Routes, Route } from 'react-router-dom';
import HomePage from '@/pages/HomePage'; import HomePage from '@/pages/HomePage';
import SSOLogin from '@/pages/SSOLogin'; import SSOLogin from '@/pages/SSOLogin';
import LoginPage from '@/pages/LoginPage'; import LoginPage from '@/pages/LoginPage';
import RequireAuth from '@/shared/components/RequireAuth'; import RequireAuth from '@/shared/components/RequireAuth';
import ModuleTitle from '@/shared/components/ModuleTitle'; import ModuleTitle from '@/shared/components/ModuleTitle';
import AIMCockpit from '@/modules/ai-matching/pages/AIMCockpit';
import CostCockpit from '@/modules/cost-analysis/pages/CostCockpit'; const AIMCockpit = lazy(() => import('@/modules/ai-matching/pages/AIMCockpit'));
import KnowledgeGraphHome from '@/modules/knowledge-graph/pages/KnowledgeGraphHome'; const CostCockpit = lazy(() => import('@/modules/cost-analysis/pages/CostCockpit'));
import SpaceCockpit from '@/modules/knowledge-graph/pages/SpaceCockpit'; const KnowledgeGraphHome = lazy(() => import('@/modules/knowledge-graph/pages/KnowledgeGraphHome'));
import BomxReuseHome from '@/modules/bomx-reuse-analyzer/pages/BomxReuseHome'; const SpaceCockpit = lazy(() => import('@/modules/knowledge-graph/pages/SpaceCockpit'));
import CostCockpitFull from '@/modules/order-cost-analysis/pages/CostCockpitFull'; const BomxReuseHome = lazy(() => import('@/modules/bomx-reuse-analyzer/pages/BomxReuseHome'));
import AIMCockpitFull from '@/modules/order-cost-analysis/pages/AIMCockpitFull'; const CostCockpitFull = lazy(() => import('@/modules/order-cost-analysis/pages/CostCockpitFull'));
import BexellSchedulingApp from '@/modules/bexell-scheduling-ai/App'; const AIMCockpitFull = lazy(() => import('@/modules/order-cost-analysis/pages/AIMCockpitFull'));
import SanruiAIDesignHome from '@/modules/sanrui-ai-design/pages/SanruiAIDesignHome'; const BexellSchedulingApp = lazy(() => import('@/modules/bexell-scheduling-ai/App'));
import JieyaIbpApp from '@/modules/jieya-ibp/App'; const SanruiAIDesignHome = lazy(() => import('@/modules/sanrui-ai-design/pages/SanruiAIDesignHome'));
import WelltrustQapApp from '@/modules/welltrust-qap/App'; const JieyaIbpApp = lazy(() => import('@/modules/jieya-ibp/App'));
import BaodeWebApp from '@/modules/baode-web/App'; const WelltrustQapApp = lazy(() => import('@/modules/welltrust-qap/App'));
import SupplierPlatformApp from '@/modules/supplier-platform/App'; const BaodeWebApp = lazy(() => import('@/modules/baode-web/App'));
import WucQuotationApp from '@/modules/wuc-quotation/App'; const SupplierPlatformApp = lazy(() => import('@/modules/supplier-platform/App'));
const WucQuotationApp = lazy(() => import('@/modules/wuc-quotation/App'));
function ModuleLoading() {
const spinnerStyle: React.CSSProperties = {
width: 44,
height: 44,
border: '3px solid rgba(0, 212, 255, 0.2)',
borderTopColor: '#00d4ff',
borderRadius: '50%',
animation: 'spin 1s linear infinite',
};
return (
<div
style={{
position: 'fixed',
inset: 0,
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: 18,
background: '#000a1e',
zIndex: 9999,
}}
>
<div style={spinnerStyle} />
<div style={{ color: '#00d4ff', fontSize: 14, letterSpacing: 2 }}>模块加载中…</div>
</div>
);
}
export default function App() { export default function App() {
return ( return (
<Suspense fallback={<ModuleLoading />}>
<Routes> <Routes>
<Route path="/login" element={<LoginPage />} /> <Route path="/login" element={<LoginPage />} />
<Route path="/sso-login" element={<SSOLogin />} /> <Route path="/sso-login" element={<SSOLogin />} />
@@ -40,5 +72,6 @@ export default function App() {
<Route path="/supplier-platform" element={<RequireAuth><ModuleTitle title="供应商智能管控平台"><SupplierPlatformApp /></ModuleTitle></RequireAuth>} /> <Route path="/supplier-platform" element={<RequireAuth><ModuleTitle title="供应商智能管控平台"><SupplierPlatformApp /></ModuleTitle></RequireAuth>} />
<Route path="/wuc-quotation" element={<RequireAuth><ModuleTitle title="武船AI智能报价平台"><WucQuotationApp /></ModuleTitle></RequireAuth>} /> <Route path="/wuc-quotation" element={<RequireAuth><ModuleTitle title="武船AI智能报价平台"><WucQuotationApp /></ModuleTitle></RequireAuth>} />
</Routes> </Routes>
</Suspense>
); );
} }
+3 -3
View File
@@ -177,7 +177,7 @@
flex: none; width: 18px; height: 18px; border-radius: 50%; flex: none; width: 18px; height: 18px; border-radius: 50%;
display: grid; place-items: center; font-size: 11px; color: #fff; background: #cbd5e1; display: grid; place-items: center; font-size: 11px; color: #fff; background: #cbd5e1;
} }
.s-执行中 .fnode-dot { background: var(--brand); animation: pulse 1.6s ease-in-out infinite; } .s-执行中 .fnode-dot { background: var(--brand); animation: baode-pulse 1.6s ease-in-out infinite; }
.s-等待填报 .fnode-dot { background: var(--wait); } .s-等待填报 .fnode-dot { background: var(--wait); }
.s-待补全 .fnode-dot { background: var(--cta); } .s-待补全 .fnode-dot { background: var(--cta); }
.s-已完成 .fnode-dot { background: var(--pass); } .s-已完成 .fnode-dot { background: var(--pass); }
@@ -386,10 +386,10 @@
.checkpage .fail { color: var(--fail); font-weight: 600; } .checkpage .fail { color: var(--fail); font-weight: 600; }
@keyframes floatIn { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } } @keyframes floatIn { from { opacity: 0; translate: 0 6px; } to { opacity: 1; translate: 0 0; } }
@keyframes pulse { @keyframes baode-pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); } 0%, 100% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); } 50% { box-shadow: 0 0 0 6px rgba(37, 99, 235, 0); }
} }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
* { animation: none !important; transition: none !important; } .baode-root * { animation: none !important; transition: none !important; }
} }
@@ -12,7 +12,9 @@ export default function Drawer({ open, title, onClose, children, width = 540 }:
}, [open, onClose]); }, [open, onClose]);
return createPortal( return createPortal(
<> // 模块根容器包裹层:为 portal 内容提供 .bomx-app 作用域下的 CSS 变量;
// overlay/panel 均 position:fixed,且平台 body 为 overflow:hidden,包裹层不影响布局
<div className="bomx-app">
{/* 遮罩:覆盖全屏(含导航条),点击任意非抽屉区域关闭 */} {/* 遮罩:覆盖全屏(含导航条),点击任意非抽屉区域关闭 */}
{open && <div className="drawer-overlay" onClick={onClose} />} {open && <div className="drawer-overlay" onClick={onClose} />}
@@ -29,7 +31,7 @@ export default function Drawer({ open, title, onClose, children, width = 540 }:
</div> </div>
<div className="drawer-content">{children}</div> <div className="drawer-content">{children}</div>
</div> </div>
</>, </div>,
document.body document.body
); );
} }
+13 -13
View File
@@ -3,7 +3,7 @@
风格:Premium Light · 深度层次 · 流畅交互 风格:Premium Light · 深度层次 · 流畅交互
============================================================ */ ============================================================ */
:root { .bomx-app {
--header-h: 64px; --header-h: 64px;
/* 品牌渐变 */ /* 品牌渐变 */
--grad-brand: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%); --grad-brand: linear-gradient(135deg, #6366F1 0%, #8B5CF6 50%, #A855F7 100%);
@@ -85,9 +85,9 @@
z-index: 0; z-index: 0;
} }
::-webkit-scrollbar { width: 8px; height: 8px; } .bomx-app ::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; } .bomx-app ::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); } .bomx-app ::-webkit-scrollbar-thumb:hover { background: var(--text-3); }
/* ===== Header ===== */ /* ===== Header ===== */
.app-header { .app-header {
@@ -260,7 +260,7 @@
.btn-sm { height: 32px; padding: 0 13px; font-size: 12px; border-radius: var(--r-sm); } .btn-sm { height: 32px; padding: 0 13px; font-size: 12px; border-radius: var(--r-sm); }
/* ===== Form ===== */ /* ===== Form ===== */
input[type="text"], input[type="number"], select { .bomx-app input[type="text"], .bomx-app input[type="number"], .bomx-app select {
height: 38px; height: 38px;
padding: 0 13px; padding: 0 13px;
border: 1px solid var(--line-2); border: 1px solid var(--line-2);
@@ -273,7 +273,7 @@ input[type="text"], input[type="number"], select {
transition: all var(--t-fast) var(--ease); transition: all var(--t-fast) var(--ease);
} }
input:focus, select:focus { .bomx-app input:focus, .bomx-app select:focus {
border-color: var(--indigo); border-color: var(--indigo);
box-shadow: 0 0 0 3px rgba(99,102,241,0.14); box-shadow: 0 0 0 3px rgba(99,102,241,0.14);
} }
@@ -589,7 +589,7 @@ input:focus, select:focus {
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes bomx-fade-in { from { opacity: 0; } to { opacity: 1; } }
.drawer { .drawer {
position: fixed; position: fixed;
@@ -645,7 +645,7 @@ input:focus, select:focus {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; justify-content: center;
animation: fade-in 0.2s ease; animation: bomx-fade-in 0.2s ease;
} }
.confirm-modal { .confirm-modal {
@@ -743,10 +743,10 @@ input:focus, select:focus {
.checkbox-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; } .checkbox-label { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; }
.checkbox-label input { width: 16px; height: 16px; accent-color: var(--indigo); cursor: pointer; } .checkbox-label input { width: 16px; height: 16px; accent-color: var(--indigo); cursor: pointer; }
:focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; } .bomx-app :focus-visible { outline: 2px solid var(--indigo); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
*, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } .bomx-app *, .bomx-app *::before, .bomx-app *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
} }
/* ===== 修复:BOM 树表头列样式统一 ===== */ /* ===== 修复:BOM 树表头列样式统一 ===== */
@@ -896,11 +896,11 @@ input:focus, select:focus {
border: 2.5px solid var(--line-1); border: 2.5px solid var(--line-1);
border-top-color: var(--accent-primary); border-top-color: var(--accent-primary);
border-radius: 50%; border-radius: 50%;
animation: spin 0.8s linear infinite; animation: bomx-spin 0.8s linear infinite;
flex-shrink: 0; flex-shrink: 0;
} }
@keyframes spin { @keyframes bomx-spin {
to { transform: rotate(360deg); } to { transform: rotate(360deg); }
} }
@@ -1168,7 +1168,7 @@ input:focus, select:focus {
border: 2px solid var(--indigo-soft); border: 2px solid var(--indigo-soft);
border-top-color: var(--indigo); border-top-color: var(--indigo);
border-radius: 50%; border-radius: 50%;
animation: spin 0.7s linear infinite; animation: bomx-spin 0.7s linear infinite;
} }
/* 阶段信息 */ /* 阶段信息 */
+2 -2
View File
@@ -82,7 +82,7 @@ function AppInner() {
if (!dbReady) { if (!dbReady) {
const errMsg = dbError ?? (dbTimedOut ? t.common.initTimeout : null); const errMsg = dbError ?? (dbTimedOut ? t.common.initTimeout : null);
return ( return (
<div style={{ <div className="jieya-root" style={{
width: '100vw', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100vw', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center',
background: tokens.bodyBgImage, color: tokens.textSub, fontSize: 14, background: tokens.bodyBgImage, color: tokens.textSub, fontSize: 14,
}}> }}>
@@ -116,7 +116,7 @@ function AppInner() {
} }
return ( return (
<div style={{ <div className="jieya-root" style={{
width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column', width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column',
background: tokens.bodyBgImage, color: tokens.text, overflow: 'hidden', background: tokens.bodyBgImage, color: tokens.text, overflow: 'hidden',
position: 'relative', position: 'relative',
+18 -18
View File
@@ -1,7 +1,7 @@
/* 本模块样式仅保留动效/工具类;base 重置与 tailwind 由平台全局 index.css 提供 */ /* 本模块样式仅保留动效/工具类;base 重置与 tailwind 由平台全局 index.css 提供 */
button { cursor: pointer; } .jieya-root button { cursor: pointer; }
input, textarea { font-family: inherit; } .jieya-root input, .jieya-root textarea { font-family: inherit; }
/* ═══════════════════════════════════════════ /* ═══════════════════════════════════════════
太空舱 / 三栏工作区 动效层 太空舱 / 三栏工作区 动效层
@@ -23,7 +23,7 @@ input, textarea { font-family: inherit; }
from { opacity: 0; transform: translateX(-20px); } from { opacity: 0; transform: translateX(-20px); }
to { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(0); }
} }
@keyframes slide-in-right { @keyframes jieya-slide-in-right {
from { opacity: 0; transform: translateX(20px); } from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(0); }
} }
@@ -43,11 +43,11 @@ input, textarea { font-family: inherit; }
from { opacity: 0; transform: translateY(18px) scale(0.97); } from { opacity: 0; transform: translateY(18px) scale(0.97); }
to { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 1; transform: translateY(0) scale(1); }
} }
@keyframes space-pulse { @keyframes jieya-space-pulse {
0%, 100% { opacity: 0.55; } 0%, 100% { opacity: 0.55; }
50% { opacity: 1; } 50% { opacity: 1; }
} }
@keyframes glow-pulse { @keyframes jieya-glow-pulse {
0%, 100% { box-shadow: 0 0 0 rgba(79,70,229,0); } 0%, 100% { box-shadow: 0 0 0 rgba(79,70,229,0); }
50% { box-shadow: 0 0 18px var(--glow-color, rgba(79,70,229,0.35)); } 50% { box-shadow: 0 0 18px var(--glow-color, rgba(79,70,229,0.35)); }
} }
@@ -55,7 +55,7 @@ input, textarea { font-family: inherit; }
0%, 100% { opacity: 1; transform: scale(1); } 0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.35; transform: scale(0.78); } 50% { opacity: 0.35; transform: scale(0.78); }
} }
@keyframes scan-sweep { @keyframes jieya-scan-sweep {
0% { left: -30%; } 0% { left: -30%; }
100% { left: 110%; } 100% { left: 110%; }
} }
@@ -128,27 +128,27 @@ input, textarea { font-family: inherit; }
.animate-slide-in { animation: slide-in-left 0.3s ease-out; } .animate-slide-in { animation: slide-in-left 0.3s ease-out; }
.animate-number { animation: number-roll 0.5s ease-out; } .animate-number { animation: number-roll 0.5s ease-out; }
.space-animate-left { animation: slide-in-left 0.4s cubic-bezier(0.4,0,0.2,1); } .space-animate-left { animation: slide-in-left 0.4s cubic-bezier(0.4,0,0.2,1); }
.space-animate-right{ animation: slide-in-right 0.4s cubic-bezier(0.4,0,0.2,1); } .jieya-root .space-animate-right{ animation: jieya-slide-in-right 0.4s cubic-bezier(0.4,0,0.2,1); }
.space-animate-up { animation: slide-in-up 0.4s cubic-bezier(0.4,0,0.2,1); } .space-animate-up { animation: slide-in-up 0.4s cubic-bezier(0.4,0,0.2,1); }
.card-in { animation: card-in 0.35s cubic-bezier(0.4,0,0.2,1) both; } .card-in { animation: card-in 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.notice-in { animation: notice-in 0.35s cubic-bezier(0.4,0,0.2,1) both; } .notice-in { animation: notice-in 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.content-reveal { animation: content-reveal 0.5s cubic-bezier(0.34,1.56,0.64,1) both; } .jieya-root .content-reveal { animation: content-reveal 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }
.stream-cursor { animation: stream-cursor-blink 0.9s step-end infinite; } .stream-cursor { animation: stream-cursor-blink 0.9s step-end infinite; }
.space-pulse { animation: space-pulse 2.4s ease-in-out infinite; } .jieya-root .space-pulse { animation: jieya-space-pulse 2.4s ease-in-out infinite; }
.dot-blink { animation: dot-blink 1.6s ease-in-out infinite; } .dot-blink { animation: dot-blink 1.6s ease-in-out infinite; }
.glow-pulse { animation: glow-pulse 3s ease-in-out infinite; } .jieya-root .glow-pulse { animation: jieya-glow-pulse 3s ease-in-out infinite; }
.bar-grow { animation: bar-grow 0.6s cubic-bezier(0.4,0,0.2,1) both; transform-origin: bottom; } .bar-grow { animation: bar-grow 0.6s cubic-bezier(0.4,0,0.2,1) both; transform-origin: bottom; }
.dash-flow { animation: dash-flow 1.2s linear infinite; } .dash-flow { animation: dash-flow 1.2s linear infinite; }
/* 滚动条:颜色由 --scroll-thumb 注入(跟随主题 token) */ /* 滚动条:颜色由 --scroll-thumb 注入(跟随主题 token) */
::-webkit-scrollbar { width: 5px; height: 5px; } .jieya-root ::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; } .jieya-root ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 10px; } .jieya-root ::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 10px; }
::-webkit-scrollbar-corner { background: transparent; } .jieya-root ::-webkit-scrollbar-corner { background: transparent; }
.space-scroll::-webkit-scrollbar { width: 4px; height: 8px; } .jieya-root .space-scroll::-webkit-scrollbar { width: 4px; height: 8px; }
.space-scroll::-webkit-scrollbar-track { background: transparent; } .jieya-root .space-scroll::-webkit-scrollbar-track { background: transparent; }
.space-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 4px; } .jieya-root .space-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 4px; }
/* 面板通用过渡 */ /* 面板通用过渡 */
.panel-shell { transition: width 0.3s cubic-bezier(0.4,0,0.2,1); } .panel-shell { transition: width 0.3s cubic-bezier(0.4,0,0.2,1); }
@@ -156,7 +156,7 @@ input, textarea { font-family: inherit; }
.ghost-btn:hover { background: var(--hover-bg, rgba(79,70,229,0.07)); } .ghost-btn:hover { background: var(--hover-bg, rgba(79,70,229,0.07)); }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
*, *::before, *::after { .jieya-root *, .jieya-root *::before, .jieya-root *::after {
animation-duration: 0.01ms !important; animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important; animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important; transition-duration: 0.01ms !important;
@@ -30,7 +30,7 @@ export default function AIMCockpit() {
}; };
return ( return (
<div style={{ <div className="ordercost-root" style={{
width: '100vw', height: '100vh', width: '100vw', height: '100vh',
overflow: 'hidden', overflow: 'hidden',
display: 'flex', flexDirection: 'column', display: 'flex', flexDirection: 'column',
@@ -83,7 +83,7 @@ export default function CostCockpit() {
}, [centerFullscreen]); }, [centerFullscreen]);
return ( return (
<div style={{ <div className="ordercost-root" style={{
width: '100vw', height: '100vh', width: '100vw', height: '100vh',
overflow: 'hidden', overflow: 'hidden',
display: 'flex', flexDirection: 'column', display: 'flex', flexDirection: 'column',
+3 -3
View File
@@ -91,9 +91,9 @@
.space-scroll::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.25); border-radius: 4px; } .space-scroll::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.25); border-radius: 4px; }
.space-scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,212,255,0.45); } .space-scroll::-webkit-scrollbar-thumb:hover { background: rgba(0,212,255,0.45); }
::-webkit-scrollbar { width: 5px; height: 5px; } .ordercost-root ::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; } .ordercost-root ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 10px; } .ordercost-root ::-webkit-scrollbar-thumb { background: rgba(0,212,255,0.2); border-radius: 10px; }
/* 拖入模块处理动画 */ /* 拖入模块处理动画 */
@keyframes module-spin { @keyframes module-spin {
+13 -13
View File
@@ -39,8 +39,8 @@
.logo-sub{font-size:10px;color:var(--faint);letter-spacing:1.5px} .logo-sub{font-size:10px;color:var(--faint);letter-spacing:1.5px}
.live{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:700;color:var(--blue); .live{display:inline-flex;align-items:center;gap:4px;font-size:10px;font-weight:700;color:var(--blue);
border:1px solid var(--blue);border-radius:20px;padding:2px 8px;margin-left:8px} border:1px solid var(--blue);border-radius:20px;padding:2px 8px;margin-left:8px}
.live i{width:6px;height:6px;border-radius:50%;background:var(--blue);animation:pulse 1.4s infinite} .live i{width:6px;height:6px;border-radius:50%;background:var(--blue);animation:hansong-pulse 1.4s infinite}
@keyframes pulse{0%,100%{opacity:1}50%{opacity:.25}} @keyframes hansong-pulse{0%,100%{opacity:1}50%{opacity:.25}}
/* 加 .hansong-app 前缀:#nav 会误命中 wuc-quotation 模块的 <nav id="nav">(ID 特异性高于类选择器) */ /* 加 .hansong-app 前缀:#nav 会误命中 wuc-quotation 模块的 <nav id="nav">(ID 特异性高于类选择器) */
.hansong-app #nav{display:flex;gap:6px;margin-left:14px;flex:1;justify-content:flex-end} .hansong-app #nav{display:flex;gap:6px;margin-left:14px;flex:1;justify-content:flex-end}
.nav-btn{border:1px solid transparent;background:transparent;color:var(--sub);font-size:13px;font-weight:600; .nav-btn{border:1px solid transparent;background:transparent;color:var(--sub);font-size:13px;font-weight:600;
@@ -64,7 +64,7 @@
.user-role{font-size:10px;color:var(--faint)} .user-role{font-size:10px;color:var(--faint)}
/* ===== 页面容器 ===== */ /* ===== 页面容器 ===== */
main{flex:1;overflow:hidden;position:relative} .hansong-app main{flex:1;overflow:hidden;position:relative}
.page{position:absolute;inset:0;padding:14px 18px;display:none;flex-direction:column;gap:12px;overflow:hidden} .page{position:absolute;inset:0;padding:14px 18px;display:none;flex-direction:column;gap:12px;overflow:hidden}
.page.on{display:flex;animation:fadeIn .35s} .page.on{display:flex;animation:fadeIn .35s}
@keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1}} @keyframes fadeIn{from{opacity:0;transform:translateY(6px)}to{opacity:1}}
@@ -182,13 +182,13 @@ main{flex:1;overflow:hidden;position:relative}
/* ===== 比价表 ===== */ /* ===== 比价表 ===== */
.tbl-wrap{margin:0 14px 12px;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--card-solid)} .tbl-wrap{margin:0 14px 12px;border:1px solid var(--line);border-radius:12px;overflow:hidden;background:var(--card-solid)}
.tbl-title{padding:9px 14px;font-size:12px;font-weight:800;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:8px} .tbl-title{padding:9px 14px;font-size:12px;font-weight:800;border-bottom:1px solid var(--line);display:flex;align-items:center;gap:8px}
table{width:100%;border-collapse:collapse;font-size:12px} .hansong-app table{width:100%;border-collapse:collapse;font-size:12px}
th{background:var(--blue-bg);color:var(--sub);font-weight:700;text-align:left;padding:8px 10px;white-space:nowrap;font-size:11px} .hansong-app th{background:var(--blue-bg);color:var(--sub);font-weight:700;text-align:left;padding:8px 10px;white-space:nowrap;font-size:11px}
td{padding:8px 10px;border-top:1px solid var(--line);vertical-align:middle} .hansong-app td{padding:8px 10px;border-top:1px solid var(--line);vertical-align:middle}
tr.rec-row{background:linear-gradient(90deg,var(--blue-bg),transparent)} .hansong-app tr.rec-row{background:linear-gradient(90deg,var(--blue-bg),transparent)}
tr.rec-row td:first-child{box-shadow:inset 3px 0 0 var(--blue)} .hansong-app tr.rec-row td:first-child{box-shadow:inset 3px 0 0 var(--blue)}
tbody tr{transition:.15s} .hansong-app tbody tr{transition:.15s}
tbody tr:hover{background:var(--blue-bg)} .hansong-app tbody tr:hover{background:var(--blue-bg)}
.score-cell{display:flex;align-items:center;gap:6px} .score-cell{display:flex;align-items:center;gap:6px}
.score-bar{width:52px;height:6px;border-radius:3px;background:rgba(120,135,170,.18);overflow:hidden} .score-bar{width:52px;height:6px;border-radius:3px;background:rgba(120,135,170,.18);overflow:hidden}
.score-bar i{display:block;height:100%;border-radius:3px;background:linear-gradient(90deg,var(--blue),var(--purple))} .score-bar i{display:block;height:100%;border-radius:3px;background:linear-gradient(90deg,var(--blue),var(--purple))}
@@ -309,10 +309,10 @@ tbody tr:hover{background:var(--blue-bg)}
/* ===== AI 思考动画 ===== */ /* ===== AI 思考动画 ===== */
.ai-think{padding:34px 20px;text-align:center} .ai-think{padding:34px 20px;text-align:center}
.ai-think .orb{width:52px;height:52px;margin:0 auto 14px;border-radius:50%; .ai-think .orb{width:52px;height:52px;margin:0 auto 14px;border-radius:50%;
background:conic-gradient(var(--blue),var(--purple),var(--cyan),var(--blue));animation:spin 1.2s linear infinite; background:conic-gradient(var(--blue),var(--purple),var(--cyan),var(--blue));animation:hansong-spin 1.2s linear infinite;
display:flex;align-items:center;justify-content:center} display:flex;align-items:center;justify-content:center}
.ai-think .orb::after{content:"";width:42px;height:42px;border-radius:50%;background:var(--card-solid)} .ai-think .orb::after{content:"";width:42px;height:42px;border-radius:50%;background:var(--card-solid)}
@keyframes spin{to{transform:rotate(360deg)}} @keyframes hansong-spin{to{transform:rotate(360deg)}}
.think-step{font-size:12px;color:var(--sub);padding:3px 0;opacity:0;animation:fadeUp .3s forwards} .think-step{font-size:12px;color:var(--sub);padding:3px 0;opacity:0;animation:fadeUp .3s forwards}
.think-step b{color:var(--blue)} .think-step b{color:var(--blue)}
.empty-hint{padding:40px 20px;text-align:center;color:var(--faint);font-size:12px} .empty-hint{padding:40px 20px;text-align:center;color:var(--faint);font-size:12px}
@@ -320,5 +320,5 @@ tbody tr:hover{background:var(--blue-bg)}
.sec-label{font-size:11px;font-weight:800;color:var(--faint);letter-spacing:1px;margin:14px 14px 6px} .sec-label{font-size:11px;font-weight:800;color:var(--faint);letter-spacing:1px;margin:14px 14px 6px}
.mini-list{font-size:11px} .mini-list{font-size:11px}
.mini-list .row{display:flex;gap:8px;padding:5px 0;border-top:1px dashed var(--line);align-items:center} .mini-list .row{display:flex;gap:8px;padding:5px 0;border-top:1px dashed var(--line);align-items:center}
select.sel{border:1px solid var(--line2);background:var(--card-solid);color:var(--ink);border-radius:9px; .hansong-app select.sel{border:1px solid var(--line2);background:var(--card-solid);color:var(--ink);border-radius:9px;
padding:6px 10px;font-size:12px;outline:none;cursor:pointer;font-weight:600} padding:6px 10px;font-size:12px;outline:none;cursor:pointer;font-weight:600}
+2 -2
View File
@@ -82,7 +82,7 @@ function AppInner() {
if (!dbReady) { if (!dbReady) {
const errMsg = dbError ?? (dbTimedOut ? t.common.initTimeout : null); const errMsg = dbError ?? (dbTimedOut ? t.common.initTimeout : null);
return ( return (
<div style={{ <div className="welltrust-root" style={{
width: '100vw', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center', width: '100vw', height: '100vh', display: 'flex', alignItems: 'center', justifyContent: 'center',
background: tokens.bodyBgImage, color: tokens.textSub, fontSize: 14, background: tokens.bodyBgImage, color: tokens.textSub, fontSize: 14,
}}> }}>
@@ -116,7 +116,7 @@ function AppInner() {
} }
return ( return (
<div style={{ <div className="welltrust-root" style={{
width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column', width: '100vw', height: '100vh', display: 'flex', flexDirection: 'column',
background: tokens.bodyBgImage, color: tokens.text, overflow: 'hidden', background: tokens.bodyBgImage, color: tokens.text, overflow: 'hidden',
position: 'relative', position: 'relative',
+18 -18
View File
@@ -1,7 +1,7 @@
/* 本模块样式仅保留动效/工具类;base 重置与 tailwind 由平台全局 index.css 提供 */ /* 本模块样式仅保留动效/工具类;base 重置与 tailwind 由平台全局 index.css 提供 */
button { cursor: pointer; } .welltrust-root button { cursor: pointer; }
input, textarea { font-family: inherit; } .welltrust-root input, .welltrust-root textarea { font-family: inherit; }
/* ═══════════════════════════════════════════ /* ═══════════════════════════════════════════
太空舱 / 三栏工作区 动效层 太空舱 / 三栏工作区 动效层
@@ -23,7 +23,7 @@ input, textarea { font-family: inherit; }
from { opacity: 0; transform: translateX(-20px); } from { opacity: 0; transform: translateX(-20px); }
to { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(0); }
} }
@keyframes slide-in-right { @keyframes welltrust-slide-in-right {
from { opacity: 0; transform: translateX(20px); } from { opacity: 0; transform: translateX(20px); }
to { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(0); }
} }
@@ -43,11 +43,11 @@ input, textarea { font-family: inherit; }
from { opacity: 0; transform: translateY(18px) scale(0.97); } from { opacity: 0; transform: translateY(18px) scale(0.97); }
to { opacity: 1; transform: translateY(0) scale(1); } to { opacity: 1; transform: translateY(0) scale(1); }
} }
@keyframes space-pulse { @keyframes welltrust-space-pulse {
0%, 100% { opacity: 0.55; } 0%, 100% { opacity: 0.55; }
50% { opacity: 1; } 50% { opacity: 1; }
} }
@keyframes glow-pulse { @keyframes welltrust-glow-pulse {
0%, 100% { box-shadow: 0 0 0 rgba(79,70,229,0); } 0%, 100% { box-shadow: 0 0 0 rgba(79,70,229,0); }
50% { box-shadow: 0 0 18px var(--glow-color, rgba(79,70,229,0.35)); } 50% { box-shadow: 0 0 18px var(--glow-color, rgba(79,70,229,0.35)); }
} }
@@ -55,7 +55,7 @@ input, textarea { font-family: inherit; }
0%, 100% { opacity: 1; transform: scale(1); } 0%, 100% { opacity: 1; transform: scale(1); }
50% { opacity: 0.35; transform: scale(0.78); } 50% { opacity: 0.35; transform: scale(0.78); }
} }
@keyframes scan-sweep { @keyframes welltrust-scan-sweep {
0% { left: -30%; } 0% { left: -30%; }
100% { left: 110%; } 100% { left: 110%; }
} }
@@ -125,27 +125,27 @@ input, textarea { font-family: inherit; }
.animate-slide-in { animation: slide-in-left 0.3s ease-out; } .animate-slide-in { animation: slide-in-left 0.3s ease-out; }
.animate-number { animation: number-roll 0.5s ease-out; } .animate-number { animation: number-roll 0.5s ease-out; }
.space-animate-left { animation: slide-in-left 0.4s cubic-bezier(0.4,0,0.2,1); } .space-animate-left { animation: slide-in-left 0.4s cubic-bezier(0.4,0,0.2,1); }
.space-animate-right{ animation: slide-in-right 0.4s cubic-bezier(0.4,0,0.2,1); } .welltrust-root .space-animate-right{ animation: welltrust-slide-in-right 0.4s cubic-bezier(0.4,0,0.2,1); }
.space-animate-up { animation: slide-in-up 0.4s cubic-bezier(0.4,0,0.2,1); } .space-animate-up { animation: slide-in-up 0.4s cubic-bezier(0.4,0,0.2,1); }
.card-in { animation: card-in 0.35s cubic-bezier(0.4,0,0.2,1) both; } .card-in { animation: card-in 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.notice-in { animation: notice-in 0.35s cubic-bezier(0.4,0,0.2,1) both; } .notice-in { animation: notice-in 0.35s cubic-bezier(0.4,0,0.2,1) both; }
.content-reveal { animation: content-reveal 0.5s cubic-bezier(0.34,1.56,0.64,1) both; } .welltrust-root .content-reveal { animation: content-reveal 0.5s cubic-bezier(0.34,1.56,0.64,1) both; }
.stream-caret { display: inline-block; width: 2px; height: 0.95em; margin-left: 2px; vertical-align: -0.12em; background: currentColor; animation: stream-caret-blink 1s steps(1) infinite; } .stream-caret { display: inline-block; width: 2px; height: 0.95em; margin-left: 2px; vertical-align: -0.12em; background: currentColor; animation: stream-caret-blink 1s steps(1) infinite; }
.space-pulse { animation: space-pulse 2.4s ease-in-out infinite; } .welltrust-root .space-pulse { animation: welltrust-space-pulse 2.4s ease-in-out infinite; }
.dot-blink { animation: dot-blink 1.6s ease-in-out infinite; } .dot-blink { animation: dot-blink 1.6s ease-in-out infinite; }
.glow-pulse { animation: glow-pulse 3s ease-in-out infinite; } .welltrust-root .glow-pulse { animation: welltrust-glow-pulse 3s ease-in-out infinite; }
.bar-grow { animation: bar-grow 0.6s cubic-bezier(0.4,0,0.2,1) both; transform-origin: bottom; } .bar-grow { animation: bar-grow 0.6s cubic-bezier(0.4,0,0.2,1) both; transform-origin: bottom; }
.dash-flow { animation: dash-flow 1.2s linear infinite; } .dash-flow { animation: dash-flow 1.2s linear infinite; }
/* 滚动条:颜色由 --scroll-thumb 注入(跟随主题 token) */ /* 滚动条:颜色由 --scroll-thumb 注入(跟随主题 token) */
::-webkit-scrollbar { width: 5px; height: 5px; } .welltrust-root ::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; } .welltrust-root ::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 10px; } .welltrust-root ::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 10px; }
::-webkit-scrollbar-corner { background: transparent; } .welltrust-root ::-webkit-scrollbar-corner { background: transparent; }
.space-scroll::-webkit-scrollbar { width: 4px; height: 8px; } .welltrust-root .space-scroll::-webkit-scrollbar { width: 4px; height: 8px; }
.space-scroll::-webkit-scrollbar-track { background: transparent; } .welltrust-root .space-scroll::-webkit-scrollbar-track { background: transparent; }
.space-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 4px; } .welltrust-root .space-scroll::-webkit-scrollbar-thumb { background: var(--scroll-thumb, rgba(79,70,229,0.22)); border-radius: 4px; }
/* 面板通用过渡 */ /* 面板通用过渡 */
.panel-shell { transition: width 0.3s cubic-bezier(0.4,0,0.2,1); } .panel-shell { transition: width 0.3s cubic-bezier(0.4,0,0.2,1); }
@@ -153,7 +153,7 @@ input, textarea { font-family: inherit; }
.ghost-btn:hover { background: var(--hover-bg, rgba(79,70,229,0.07)); } .ghost-btn:hover { background: var(--hover-bg, rgba(79,70,229,0.07)); }
@media (prefers-reduced-motion: reduce) { @media (prefers-reduced-motion: reduce) {
*, *::before, *::after { .welltrust-root *, .welltrust-root *::before, .welltrust-root *::after {
animation-duration: 0.01ms !important; animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important; animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important; transition-duration: 0.01ms !important;