@zenuml/core 3.40.1 → 3.41.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,179 @@
1
+ # Unicode 字符支持
2
+
3
+ ZenUML 现在完全支持 Unicode 字符,包括中文、日文、韩文、阿拉伯文、俄文等多种语言的标识符。
4
+
5
+ ## 功能特性
6
+
7
+ ### 1. 直接使用 Unicode 字符作为标识符
8
+
9
+ 您可以直接使用任何 Unicode 字母字符作为:
10
+ - 参与者名称
11
+ - 方法名称
12
+ - 变量名称
13
+ - 参数名称
14
+
15
+ **示例:**
16
+
17
+ ```zenuml
18
+ // 中文标识符
19
+ 用户 订单服务 数据库
20
+
21
+ 用户.登录()
22
+ 订单服务.创建订单()
23
+ 数据库.保存数据()
24
+ return 成功
25
+ ```
26
+
27
+ ### 2. 包含空格的文本使用引号
28
+
29
+ 如果标识符中需要包含空格或特殊字符,请使用双引号:
30
+
31
+ ```zenuml
32
+ // 使用引号处理包含空格的名称
33
+ "用户 服务" "订单 管理系统"
34
+
35
+ "用户 服务"."获取 用户信息"()
36
+ "订单 管理系统"."创建 新订单"()
37
+ return "操作 成功"
38
+ ```
39
+
40
+ ### 3. 中英文混合支持
41
+
42
+ 您可以自由混合使用中文和英文:
43
+
44
+ ```zenuml
45
+ UserService 数据库 CacheManager
46
+
47
+ UserService.获取用户()
48
+ 数据库.query("SELECT * FROM users")
49
+ CacheManager.缓存结果()
50
+ ```
51
+
52
+ ## 支持的 Unicode 范围
53
+
54
+ 当前实现支持所有 Unicode 字母字符,包括但不限于:
55
+
56
+ - **中文**:汉字字符
57
+ - **日文**:平假名、片假名、汉字
58
+ - **韩文**:韩文字母
59
+ - **阿拉伯文**:阿拉伯字母
60
+ - **俄文**:西里尔字母
61
+ - **其他**:所有 Unicode 定义的字母字符
62
+
63
+ ## 使用规则
64
+
65
+ 1. **标识符规则**:
66
+ - 必须以 Unicode 字母或下划线 `_` 开头
67
+ - 可以包含 Unicode 字母、数字和下划线
68
+ - 不能包含空格(需要空格请使用引号)
69
+
70
+ 2. **引号字符串**:
71
+ - 可以包含任何字符(除了换行符)
72
+ - 适用于包含空格或特殊字符的文本
73
+
74
+ 3. **保留关键字**:
75
+ - 英文关键字(如 `if`, `while`, `return` 等)保持不变
76
+ - 不能使用保留关键字作为标识符
77
+
78
+ ## 实际应用示例
79
+
80
+ ### 示例 1:订单处理流程
81
+
82
+ ```zenuml
83
+ title "订单处理流程"
84
+
85
+ @Actor 用户
86
+ @Service 订单服务
87
+ @Database 数据库
88
+
89
+ 用户->订单服务: 创建订单
90
+ 订单服务.验证订单() {
91
+ if (库存充足) {
92
+ 数据库.保存订单()
93
+ return "订单创建成功"
94
+ } else {
95
+ return "库存不足"
96
+ }
97
+ }
98
+ ```
99
+
100
+ ### 示例 2:用户认证流程
101
+
102
+ ```zenuml
103
+ 用户 认证服务 令牌管理器
104
+
105
+ 用户.登录(用户名, 密码)
106
+ 认证服务.验证凭据(用户名, 密码) {
107
+ if (验证成功) {
108
+ 令牌 = 令牌管理器.生成令牌()
109
+ return 令牌
110
+ } else {
111
+ return "认证失败"
112
+ }
113
+ }
114
+ ```
115
+
116
+ ### 示例 3:多语言混合
117
+
118
+ ```zenuml
119
+ // 混合多种语言的示例
120
+ ユーザー // 日文
121
+ 사용자 // 韩文
122
+ 用户 // 中文
123
+ User // 英文
124
+
125
+ ユーザー.ログイン()
126
+ 사용자.로그인()
127
+ 用户.登录()
128
+ User.login()
129
+ ```
130
+
131
+ ## 技术实现
132
+
133
+ ### 词法分析器更改
134
+
135
+ 在 `SequenceLexer.g4` 中,ID token 定义已更新为:
136
+
137
+ ```antlr
138
+ ID
139
+ : [\p{L}_] [\p{L}\p{Nd}_]*
140
+ ;
141
+ ```
142
+
143
+ - `\p{L}` 匹配任何 Unicode 字母
144
+ - `\p{Nd}` 匹配任何 Unicode 十进制数字
145
+ - 保持了对下划线 `_` 的支持
146
+
147
+ ### 向后兼容性
148
+
149
+ 所有现有的 ASCII 标识符仍然完全支持:
150
+ - 英文字母 (a-z, A-Z)
151
+ - 数字 (0-9)
152
+ - 下划线 (_)
153
+
154
+ 现有的 ZenUML 代码无需任何修改即可继续工作。
155
+
156
+ ## 测试
157
+
158
+ 您可以通过以下方式测试 Unicode 支持:
159
+
160
+ 1. **开发服务器测试**:
161
+ ```bash
162
+ pnpm dev
163
+ ```
164
+ 然后访问 http://localhost:8080/test-chinese.html
165
+
166
+ 2. **单元测试**:
167
+ ```bash
168
+ pnpm test src/parser/ChineseSupport.spec.ts
169
+ ```
170
+
171
+ ## 注意事项
172
+
173
+ 1. **编码**:确保您的文件使用 UTF-8 编码保存
174
+ 2. **字体支持**:渲染时需要系统或浏览器支持相应的字体
175
+ 3. **方向性**:某些语言(如阿拉伯文)是从右到左书写,但在 ZenUML 中仍按从左到右的顺序处理
176
+
177
+ ## 贡献
178
+
179
+ 如果您发现任何 Unicode 相关的问题或有改进建议,欢迎提交 issue 或 pull request。
@@ -0,0 +1,97 @@
1
+ # 🌐 ZenUML Now Supports Unicode Characters!
2
+
3
+ *September 2025 Newsletter*
4
+
5
+ ---
6
+
7
+ We're excited to announce a major enhancement to ZenUML: **full Unicode character support** for identifiers! You can now create sequence diagrams using native characters from Chinese, Japanese, Korean, Arabic, Cyrillic, and many other languages.
8
+
9
+ ## ✨ What's New
10
+
11
+ ### Native Language Support
12
+
13
+ No more workarounds or quoted strings for basic identifiers. You can now write ZenUML diagrams in your native language:
14
+
15
+ **Chinese Example:**
16
+ ```zenuml
17
+ 用户 订单服务 数据库
18
+
19
+ 用户.登录()
20
+ 订单服务.创建订单()
21
+ 数据库.保存数据()
22
+ return 成功
23
+ ```
24
+
25
+ **Japanese Example:**
26
+ ```zenuml
27
+ ユーザー システム データベース
28
+
29
+ ユーザー.ログイン()
30
+ システム.認証()
31
+ データベース.検索()
32
+ ```
33
+
34
+ **Mixed Languages:**
35
+ ```zenuml
36
+ UserService 数据库 CacheManager
37
+
38
+ UserService.获取用户()
39
+ 数据库.query("SELECT * FROM users")
40
+ CacheManager.缓存结果()
41
+ ```
42
+
43
+ ### Supported Languages
44
+
45
+ The new Unicode support includes:
46
+ - **Chinese** (Simplified & Traditional)
47
+ - **Japanese** (Hiragana, Katakana, Kanji)
48
+ - **Korean** (Hangul)
49
+ - **Arabic**
50
+ - **Cyrillic** (Russian, Bulgarian, etc.)
51
+ - **And many more Unicode languages!**
52
+
53
+ ## 🔧 Technical Implementation
54
+
55
+ ### Grammar Enhancement
56
+
57
+ We've updated the ANTLR lexer to use Unicode property classes:
58
+
59
+ ```antlr
60
+ ID : [\p{L}_] [\p{L}\p{Nd}_]* ;
61
+ ```
62
+
63
+ - `\p{L}` matches any Unicode letter
64
+ - `\p{Nd}` matches any Unicode decimal digit
65
+ - Maintains backward compatibility with ASCII identifiers
66
+
67
+ ### Backward Compatibility
68
+
69
+ **All existing ZenUML code continues to work unchanged.** This is a purely additive feature that expands what's possible without breaking existing diagrams.
70
+
71
+ ## 📋 Usage Guidelines
72
+
73
+ ### Simple Identifiers
74
+ Use Unicode characters directly for participant names, method names, and variables:
75
+ - ✅ `用户.登录()`
76
+ - ✅ `ユーザー.データ取得()`
77
+ - ✅ `사용자.인증()`
78
+
79
+ ### With Spaces
80
+ For identifiers containing spaces, use quotes:
81
+ - ✅ `"用户 服务".获取信息()`
82
+ - ✅ `"Order Management".processOrder()`
83
+
84
+ ### Rules
85
+ - Must start with a Unicode letter or underscore
86
+ - Can contain Unicode letters, numbers, and underscores
87
+ - Keywords (if, while, return) remain in English
88
+
89
+ ## 🚀 Try It Now
90
+
91
+ Visit https://app.zenuml.com
92
+
93
+ ---
94
+
95
+ **Happy Diagramming in Your Language!** 🎉
96
+
97
+ *Have feedback or found an issue? [Open an issue on GitHub](https://github.com/mermaid-js/zenuml-core/issues) or join our community discussions.*
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zenuml/core",
3
- "version": "3.40.1",
3
+ "version": "3.41.1",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "repository": {