Skip to content

Commit 45c32d0

Browse files
committed
chore(web): update i18n resources and alias imports
1 parent 3800e83 commit 45c32d0

File tree

182 files changed

+3582
-947
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

182 files changed

+3582
-947
lines changed

AGENTS.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,10 @@ flowchart TD
123123
1. 读写文档都要用 UTF-8 编码。
124124
2. 所有代码必须考虑可扩展性和健壮性。
125125
3. `@mdr/ui` 包下组件库使用 SCSS 进行样式编写,其他样式则用 Tailwind。要用最新的 Tailwind 4 写法,摒弃旧写法。
126-
4. 为方便开发者看懂代码,当且仅当在重要模块的核心方法或核心组件前编写规范的文档注释,写明白模块的调用链路的逻辑。不要写无用注释。
127-
5. 如果文件过长,拆分。
128-
6. 当且仅当需要测试时,补全测试。考虑边界条件。
129-
7. 当完整的功能写好后,先运行 `pnpm run format` 来格式化代码。
130-
8. 仅在有明确提示的时候提交并推送。commit msg 使用纯英文,按照业界规范写法:使用 `type(scope): description` 格式。
131-
9. 在保持 monochrome-ui 设计风格的前提下,样式和 UX 设计可以模仿 Figma 和 Dify。
126+
4. 优先使用 `@/...` 导入同一个包下的代码,而不是使用相对路径。
127+
5. 为方便开发者看懂代码,当且仅当在重要模块的核心方法或核心组件前编写规范的文档注释,写明白模块的调用链路的逻辑。不要写无用注释。
128+
6. 如果文件过长,拆分。
129+
7. 当且仅当需要测试时,补全测试。考虑边界条件。
130+
8. 当完整的功能写好后,先运行 `pnpm run format` 来格式化代码。
131+
9. 仅在有明确提示的时候提交并推送。commit msg 使用纯英文,按照业界规范写法:使用 `type(scope): description` 格式。
132+
10. 在保持 monochrome-ui 设计风格的前提下,样式和 UX 设计可以模仿 Figma 和 Dify。

README.md

Lines changed: 31 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,7 @@ MFE 采用独创的 **三编辑器统一架构**,所有操作最终都收敛
2525
时间线、关键帧、过渡曲线、交互动画序列、CSS Filter、SVG Filter
2626

2727
**MIR 是整个系统的“唯一真相源”**
28-
任意编辑器修改都会实时同步到其他视图 → 最终通过“炼化”编译器生成多框架代码。彻底解决传统低代码工具“改一处、乱三处”的顽疾。
29-
30-
(当前进度:蓝图编辑器 + MIR 基础框架正在开发中,节点图与动画编辑器即将启动)
28+
任意编辑器修改都会实时同步到其他视图 → 最终通过“炼化”编译器生成多框架代码,解决传统低代码工具“改一处、乱三处”的顽疾。
3129

3230
---
3331

@@ -52,21 +50,42 @@ MFE 采用独创的 **三编辑器统一架构**,所有操作最终都收敛
5250

5351
## 📂 项目结构 (Monorepo)
5452

55-
采用 **Turbo + pnpm workspaces** 构建,实现前后端、工具链、文档的完全解耦
53+
采用 **Turbo + pnpm workspaces** 构建:
5654

5755
```text
5856
.
57+
├── .github/ # CI/CD 与仓库工作流
5958
├── apps/
60-
│ ├── web/ # MFE 核心可视化编辑器(React + TS 重度)
61-
│ ├── backend/ # Go 驱动的高性能后端服务
62-
│ ├── cli/ # Mdr 命令行工具
63-
│ ├── vscode/ # VSCode 插件
64-
│ └── docs/ # 基于 MFE 自身构建的官方文档
59+
│ ├── web/ # MFE 核心可视化编辑器(React + TS)
60+
│ ├── backend/ # Go 驱动的后端服务
61+
│ ├── cli/ # Mdr 命令行工具
62+
│ ├── vscode/ # VSCode 插件
63+
│ └── docs/ # VitePress 文档站点
64+
├── deploy/ # 部署与本地依赖编排(如 postgres)
6565
├── packages/
66-
│ └── ui/ # 共享组件库 + Storybook
66+
│ ├── ui/ # 共享组件库(SCSS)+ Storybook
67+
│ ├── themes/ # 主题与设计变量
68+
│ ├── shared/ # MIR Schema / Types / 公共工具
69+
│ ├── i18n/ # 国际化资源与工具
70+
│ ├── mir-compiler/ # MIR 编译器核心包
71+
│ ├── eslint-plugin-mdr/ # 自定义 ESLint 插件
72+
│ └── vscode-debugger/ # VSCode 调试适配器
73+
├── scripts/ # 仓库级脚本
74+
├── specs/ # 规范与设计文档
75+
├── tests/ # 仓库级测试
76+
├── package.json
77+
├── pnpm-workspace.yaml
6778
└── turbo.json
6879
```
6980

81+
子项目说明文档:
82+
83+
- [apps/web/README.md](apps/web/README.md)
84+
- [apps/backend/README.md](apps/backend/README.md)
85+
- [apps/cli/README.md](apps/cli/README.md)
86+
- [apps/docs/README.md](apps/docs/README.md)
87+
- [apps/vscode/README.md](apps/vscode/README.md)
88+
7089
---
7190

7291
## 🚀 快速开始
@@ -107,7 +126,7 @@ pnpm dev
107126

108127
命令有细化版本:比如 `pnpm test:web` 只跑前端测试,`pnpm test:web:coverage` 只跑前端覆盖率测试,等等。
109128

110-
### 子模块开发(专注模式)
129+
### 子模块开发
111130

112131
| 模块 | 命令 |
113132
| ----------- | ------------------ |
@@ -157,4 +176,4 @@ pnpm cli sync # 同步 MIR 与本地代码
157176
> **MdrFrontEngine** —— 打破边界,让灵感在可视化与代码间自由跳动。
158177
> **Minsecrus** 2026.2.18
159178
160-
**Star 支持我们!** 你的每一个 Star 都是对 MIR 架构的最大肯定!
179+
**Star 支持我们!**

apps/backend/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# @mdr/backend
2+
3+
MdrFrontEngine 的后端服务,基于 Go。
4+
5+
## 目录结构
6+
7+
```text
8+
apps/backend
9+
├── cmd/
10+
│ └── server/ # 服务入口
11+
├── internal/
12+
│ ├── app/ # 应用装配
13+
│ ├── config/ # 配置加载
14+
│ ├── modules/ # 业务模块
15+
│ └── platform/ # 基础设施与平台能力
16+
├── server.go # 启动入口
17+
├── go.mod
18+
├── Dockerfile
19+
└── docker-compose.yml
20+
```
21+
22+
## 常用命令
23+
24+
```bash
25+
pnpm dev:backend
26+
pnpm dev:backend:hot
27+
pnpm build:backend
28+
cd apps/backend && go test ./...
29+
```

apps/cli/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# @mdr/cli
2+
3+
MdrFrontEngine 的命令行工具,提供项目初始化、同步、构建相关能力。
4+
5+
## 目录结构
6+
7+
```text
8+
apps/cli
9+
├── src/
10+
│ ├── commands/ # CLI 子命令实现
11+
│ ├── utils/ # 命令工具函数
12+
│ └── cli.ts # 命令入口
13+
├── bin/
14+
│ └── mdr.js # 可执行入口
15+
├── test/ # CLI 测试
16+
├── package.json
17+
└── tsconfig.json
18+
```
19+
20+
## 常用命令
21+
22+
```bash
23+
pnpm dev:cli
24+
pnpm build:cli
25+
pnpm cli --help
26+
```

apps/docs/README.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# @mdr/docs
2+
3+
MdrFrontEngine 官方文档站点,基于 VitePress。
4+
5+
## 目录结构
6+
7+
```text
8+
apps/docs
9+
├── .vitepress/
10+
│ └── config.mts # 站点配置
11+
├── guide/ # 使用与开发指南
12+
├── api/ # API 文档
13+
├── reference/ # 规范与参考
14+
├── community/ # 社区与协作文档
15+
├── index.md # 首页
16+
└── package.json
17+
```
18+
19+
## 常用命令
20+
21+
```bash
22+
pnpm dev:docs
23+
pnpm build:docs
24+
cd apps/docs && pnpm preview
25+
```

apps/vscode/README.md

Lines changed: 29 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,29 @@
1-
# mdr-front-engine README
2-
3-
This is the README for your extension "mdr-front-engine". After writing up a brief description, we recommend including the following sections.
4-
5-
## Features
6-
7-
Describe specific features of your extension including screenshots of your extension in action. Image paths are relative to this README file.
8-
9-
For example if there is an image subfolder under your extension project workspace:
10-
11-
\!\[feature X\]\(images/feature-x.png\)
12-
13-
> Tip: Many popular extensions utilize animations. This is an excellent way to show off your extension! We recommend short, focused animations that are easy to follow.
14-
15-
## Requirements
16-
17-
If you have any requirements or dependencies, add a section describing those and how to install and configure them.
18-
19-
## Extension Settings
20-
21-
Include if your extension adds any VS Code settings through the `contributes.configuration` extension point.
22-
23-
For example:
24-
25-
This extension contributes the following settings:
26-
27-
- `myExtension.enable`: Enable/disable this extension.
28-
- `myExtension.thing`: Set to `blah` to do something.
29-
30-
## Known Issues
31-
32-
Calling out known issues can help limit users opening duplicate issues against your extension.
33-
34-
## Release Notes
35-
36-
Users appreciate release notes as you update your extension.
37-
38-
### 1.0.0
39-
40-
Initial release of ...
41-
42-
### 1.0.1
43-
44-
Fixed issue #.
45-
46-
### 1.1.0
47-
48-
Added features X, Y, and Z.
49-
50-
---
51-
52-
## Following extension guidelines
53-
54-
Ensure that you've read through the extensions guidelines and follow the best practices for creating your extension.
55-
56-
- [Extension Guidelines](https://code.visualstudio.com/api/references/extension-guidelines)
57-
58-
## Working with Markdown
59-
60-
You can author your README using Visual Studio Code. Here are some useful editor keyboard shortcuts:
61-
62-
- Split the editor (`Cmd+\` on macOS or `Ctrl+\` on Windows and Linux).
63-
- Toggle preview (`Shift+Cmd+V` on macOS or `Shift+Ctrl+V` on Windows and Linux).
64-
- Press `Ctrl+Space` (Windows, Linux, macOS) to see a list of Markdown snippets.
65-
66-
## For more information
67-
68-
- [Visual Studio Code's Markdown Support](http://code.visualstudio.com/docs/languages/markdown)
69-
- [Markdown Syntax Reference](https://help.github.com/articles/markdown-basics/)
70-
71-
**Enjoy!**
1+
# @mdr/vscode
2+
3+
MdrFrontEngine 的 VSCode 插件,提供 MIR 语言支持、MIR 预览命令与调试适配能力。
4+
5+
## 目录结构
6+
7+
```text
8+
apps/vscode
9+
├── src/
10+
│ ├── commands/ # 命令实现(含 MIR 预览)
11+
│ ├── language/ # MIR 语言特性
12+
│ ├── debugger/ # 调试器接入
13+
│ ├── test/ # 插件测试
14+
│ ├── extension.ts # 扩展入口
15+
│ └── index.ts # 调试适配入口
16+
├── out/ # 编译输出
17+
├── dist/ # 打包输出
18+
├── esbuild.js # 构建脚本
19+
├── package.json
20+
└── tsconfig.json
21+
```
22+
23+
## 常用命令
24+
25+
```bash
26+
pnpm dev:vscode
27+
pnpm build:vscode
28+
cd apps/vscode && pnpm lint
29+
```

apps/web/README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# @mdr/web
2+
3+
MdrFrontEngine 的核心可视化编辑器前端应用,基于 React + TypeScript + Vite。
4+
5+
## 目录结构
6+
7+
```text
8+
apps/web
9+
├── src/
10+
│ ├── editor/ # 编辑器主模块(蓝图/节点图/动画)
11+
│ ├── mir/ # MIR 相关模型与协议
12+
│ ├── core/ # 执行器、节点运行时等核心能力
13+
│ ├── components/ # 通用 UI 组件封装
14+
│ ├── stores/ # 状态管理
15+
│ ├── hooks/ # 复用 hooks
16+
│ └── utils/ # 通用工具函数
17+
├── public/ # 静态资源
18+
├── docker/ # Nginx 等部署配置
19+
├── .storybook/ # Storybook 配置
20+
├── vite.config.ts
21+
├── tailwind.config.ts
22+
└── vitest.config.ts
23+
```
24+
25+
## 常用命令
26+
27+
```bash
28+
pnpm dev:web
29+
pnpm build:web
30+
pnpm test:web
31+
pnpm test:web:coverage
32+
```

apps/web/src/auth/ProfilePage.tsx

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
import { Calendar, Copy, Mail, Pencil, UserRound } from 'lucide-react';
1515
import { authApi, ApiError } from './authApi';
1616
import { useAuthStore } from './useAuthStore';
17+
import { isAbortError } from '@/infra/api';
1718

1819
type Flash = { type: 'Info' | 'Success' | 'Warning' | 'Danger'; text: string };
1920

@@ -80,24 +81,34 @@ export const ProfilePage = () => {
8081
};
8182
}, []);
8283

83-
const fetchProfile = useCallback(async () => {
84-
if (!token) return;
85-
setError(null);
86-
setLoading(true);
87-
try {
88-
const response = await authApi.me(token);
89-
setUser(response.user);
90-
} catch (err) {
91-
setError(formatError(err));
92-
} finally {
93-
setLoading(false);
94-
}
95-
}, [token, setUser]);
96-
9784
useEffect(() => {
9885
if (!token || user) return;
99-
fetchProfile();
100-
}, [token, user, fetchProfile]);
86+
let cancelled = false;
87+
const controller =
88+
typeof AbortController === 'function' ? new AbortController() : null;
89+
const requestOptions: RequestInit = controller
90+
? { signal: controller.signal }
91+
: {};
92+
setError(null);
93+
setLoading(true);
94+
authApi
95+
.me(token, requestOptions)
96+
.then((response) => {
97+
if (cancelled) return;
98+
setUser(response.user);
99+
})
100+
.catch((err) => {
101+
if (cancelled || isAbortError(err)) return;
102+
setError(formatError(err));
103+
})
104+
.finally(() => {
105+
if (!cancelled) setLoading(false);
106+
});
107+
return () => {
108+
cancelled = true;
109+
controller?.abort();
110+
};
111+
}, [token, user, setUser]);
101112

102113
const copyText = useCallback(
103114
async (value: string | undefined, message: string) => {

0 commit comments

Comments
 (0)