新增: Rust 数据模型 + 颜色纯函数 + ts-rs 类型同步(B1)

- model.rs: 全部数据结构(Deck/Slide/Element/Style/Theme/AiCfg/LibItem/PageTemplate/ChatMessage/Op/RichSegment)
  所有结构体 derive Serialize/Deserialize/TS,自动生成 TS 类型到 bindings/types.ts
- color.rs: 颜色解析纯函数(resolve_color/resolve_bg/is_dark_bg/shade/hex_to_rgb)
  对应 store.ts 的颜色逻辑,23 个单元测试全部通过
- lib.rs: 新增 app_info IPC 命令
- ts-rs 自动生成的 bindings/types.ts 与手写 types.ts 类型一致
This commit is contained in:
2026-07-12 18:20:49 +08:00
parent b9a388b570
commit 1430e9e061
6 changed files with 626 additions and 5 deletions

39
src-tauri/Cargo.lock generated
View File

@@ -1589,6 +1589,12 @@ dependencies = [
"unicode-segmentation",
]
[[package]]
name = "lazy_static"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe"
[[package]]
name = "libappindicator"
version = "0.9.0"
@@ -3149,6 +3155,15 @@ dependencies = [
"new_debug_unreachable",
]
[[package]]
name = "termcolor"
version = "1.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755"
dependencies = [
"winapi-util",
]
[[package]]
name = "thiserror"
version = "1.0.69"
@@ -3483,6 +3498,29 @@ version = "0.2.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
[[package]]
name = "ts-rs"
version = "10.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e640d9b0964e9d39df633548591090ab92f7a4567bc31d3891af23471a3365c6"
dependencies = [
"lazy_static",
"thiserror 2.0.18",
"ts-rs-macros",
]
[[package]]
name = "ts-rs-macros"
version = "10.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0e9d8656589772eeec2cf7a8264d9cda40fb28b9bc53118ceb9e8c07f8f38730"
dependencies = [
"proc-macro2",
"quote",
"syn 2.0.118",
"termcolor",
]
[[package]]
name = "typeid"
version = "1.0.3"
@@ -3503,6 +3541,7 @@ dependencies = [
"serde_json",
"tauri",
"tauri-build",
"ts-rs",
]
[[package]]