Skip to content

Commit 435d65e

Browse files
committed
config finish
1 parent f7a6b6d commit 435d65e

File tree

5 files changed

+124
-44
lines changed

5 files changed

+124
-44
lines changed

docs/v0.1.0/en/doc/guide/tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { Badge } from '@theme';
1818
With **minimal arguments** and an **intuitive dialog-based interface**, Ract supports frameworks like **GenUI** and **Makepad**, making your development workflow smooth and efficient. 🚀
1919

2020
:::tip
21-
`Ract` is the first step to start GenUI. Please choose the latest version to download. For Ract usage, please refer to the tutorial: [Ract](/doc/tutorial/ract/introduction)
21+
`Ract` is the first step to start GenUI. Please choose the latest version to download. For Ract usage, please refer to the tutorial: [Ract](en/doc/tutorial/ract/introduction)
2222
:::
2323

2424
## VSCode plugin <Badge text="Comming Soon" type="warning" />

docs/v0.1.0/zh/doc/config/gen_ui_toml.mdx

Lines changed: 61 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { Tab, Tabs } from 'rspress/theme';
2+
13
# Compiler Conf (gen_ui.toml)
24

35
`gen_ui.toml``GenUI`项目的配置文件,它为编译器配置具体的项目信息和编译底层以及开发时插件。
@@ -26,6 +28,14 @@ makepad-widgets = { path = "/Users/shengyifei/projects/makepad/makepad/widgets"
2628

2729
## 配置说明
2830

31+
|key|value type|description|
32+
|--|--|--|
33+
|`compiler`|`CompilerConf`|编译基本配置|
34+
|`underlayer`|`CompileUnderlayer`|编译底层配置(动态类型)|
35+
|`plugins`|`Option<HashMap<String, PathBuf>>`|GenUI插件|
36+
37+
---
38+
2939
### `[compiler]`
3040

3141
|key|value type|description|
@@ -35,21 +45,61 @@ makepad-widgets = { path = "/Users/shengyifei/projects/makepad/makepad/widgets"
3545
|`log_level`|`LogLevel`|日志级别|
3646
|`excludes`|`Excludes`|需要被编译器排除的文件和目录|
3747

38-
> - [Underlayer](/zh/doc/config/types#underlayer)
39-
> - [LogLevel](/zh/doc/config/types#log_level)
40-
> - [Excludes](/zh/doc/config/types#excludes)
48+
> - [`Underlayer`](/zh/doc/config/types#underlayer)
49+
> - [`LogLevel`](/zh/doc/config/types#log_level)
50+
> - [`Excludes`](/zh/doc/config/types#excludes)
4151
42-
### `[makepad]`
52+
---
4353

44-
#### `[makepad.root]`
54+
### underlayer
4555

46-
|key|value type|description|
47-
|--|--|--|
48-
|`path`|`PathBuf`|UI根入口的地址|
49-
|`window`|`Prop<WindowProps>`|窗口配置属性|
56+
<Tabs>
57+
<Tab label="makepad">
58+
### `[makepad]`
59+
60+
|key|value type|description|
61+
|--|--|--|
62+
|`entry`|`Option<String>`|入口文件名|
63+
|`root`|`RootConf`|入口配置,包含UI入口地址和窗口属性|
64+
|`dependencies`|`Option<Vec<RustDependence>>`|Rust依赖项|
65+
|`wasm`|`Option<WasmConf>`|wasm相关配置(编译同步模式, 暂不支持)|
66+
67+
#### `entry`
68+
69+
- `Option<String>`
70+
71+
#### `[makepad.root]`
72+
73+
|key|value type|description|
74+
|--|--|--|
75+
|`path`|`PathBuf`|UI根入口的地址|
76+
|`window`|`Prop<WindowProps>`|窗口配置属性|
77+
78+
> - [`WindowProps`](/zh/doc/config/types#window_props)
79+
80+
#### `[makepad.dependencies]`
81+
82+
这里使用`Option<Vec<RustDependence>>`类型
83+
84+
> - [`RustDependence`](https://doc.rust-lang.org/cargo/commands/cargo-add.html)
85+
86+
#### `[makepad.wasm]`
87+
88+
|key|value type|description|
89+
|--|--|--|
90+
|`fresh`|`bool`|是否需要在每次更新后重新编译|
91+
|`port`|`Option<u16>`|端口 (默认8010)|
92+
93+
</Tab>
94+
<Tab label="其他暂无"></Tab>
95+
</Tabs>
96+
97+
---
5098

51-
#### `[makepad.dependencies]`
99+
### `[plugins]`
52100

101+
- `Option<HashMap<String, PathBuf>>`: 开发插件条目
53102

103+
这个配置一般由`ract add`命令自动添加,除非您需要使用自己开发的本地插件,它的写法很统一,指向插件的`token.toml`所在的目录即可
54104

55-
### `[plugins]`
105+
`plugin_name = ".plugins/plugin_name"`

docs/v0.1.0/zh/doc/config/ract_toml.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ import { Tab, Tabs } from 'rspress/theme';
3434
|`compiles`|`Option<Vec<usize>>`|需要编译的项目,如果未设置,则编译成员中的第一个项目|
3535

3636
> - [`FrameworkType`](/zh/doc/config/types#frameworktype)
37-
> - [`Member`](/zh/doc/config/types/#member)
37+
> - [`Member`](/zh/doc/config/types#member)
3838
3939
### .ract源码
4040

docs/v0.1.0/zh/doc/config/types.mdx

Lines changed: 60 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -39,40 +39,44 @@ pub struct Member {
3939

4040
## `gen_ui.toml`
4141

42-
### 源码
42+
### CompilerConf
4343

4444
```rust
45-
46-
/// Compiler Config for gen_ui.toml
47-
/// ```toml
48-
/// [compiler]
49-
/// // see [Underlayer]
50-
/// [makepad]
51-
/// // see [MakepadConfig]
52-
/// ```
53-
#[derive(Debug)]
54-
pub struct Conf {
55-
pub compiler: CompilerConf,
56-
/// underlayer for makepad (current support)
57-
pub underlayer: CompileUnderlayer,
58-
/// genui plugins, each plugin has a token.toml file
59-
pub plugins: Option<HashMap<String, PathBuf>>,
60-
}
61-
6245
#[derive(Debug)]
6346
pub struct CompilerConf {
6447
pub target: Underlayer,
6548
pub logo: bool,
6649
pub log_level: LogLevel,
6750
pub excludes: Excludes,
6851
}
52+
```
53+
54+
### Underlayer
55+
56+
- `"makepad"`
57+
58+
#### 源码
6959

60+
```rust
7061
#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
7162
pub enum Underlayer {
7263
#[default]
7364
Makepad,
7465
}
66+
```
67+
68+
### LogLevel
69+
70+
- `"info"`
71+
- `"debug"`
72+
- `"error"`
73+
- `"warn"`
74+
- `"trace"`
75+
- `"off"`
7576

77+
#### 源码
78+
79+
```rust
7680
#[derive(Debug, Clone, Copy, Default)]
7781
pub enum LogLevel {
7882
#[default]
@@ -83,7 +87,11 @@ pub enum LogLevel {
8387
Trace,
8488
Off,
8589
}
90+
```
91+
92+
### Excludes
8693

94+
```rust
8795
/// # Gen Excludes
8896
/// These files and directories are excludesd by the compiler(watcher)
8997
/// Which need to write in `gen_ui.toml` file
@@ -96,7 +104,11 @@ pub enum LogLevel {
96104
/// ["Cargo.toml", "Cargo.lock", "target", ".gen_ui_cache", "gen_ui.toml", ".plugins"]
97105
#[derive(Debug, Clone)]
98106
pub struct Excludes(pub Vec<PathBuf>);
107+
```
108+
109+
### MakepadConfig
99110

111+
```rust
100112
#[derive(Debug, Clone)]
101113
pub struct Config {
102114
/// entry file name, default is app
@@ -112,27 +124,54 @@ pub struct Config {
112124
/// makepad wasm
113125
pub wasm: Option<WasmConf>,
114126
}
127+
```
128+
129+
### RootConf
115130

131+
```rust
116132
#[derive(Debug, Clone)]
117133
pub struct RootConf {
118134
// pub name: String,
119135
pub path: PathBuf,
120136
pub window: Prop<WindowProps>,
121137
}
138+
```
139+
### WindowProps
140+
141+
也许对于您来说源码过于复杂,您可以直接看如下配置示例,这是最常用的配置:
142+
143+
```
144+
{
145+
os_type = "mac",
146+
show_title = true,
147+
window_size = {
148+
inner_size = {x = 1080.0, y = 720.0}
149+
}
150+
}
151+
```
152+
153+
#### 源码
154+
155+
> [!TIP]
156+
>
157+
> 我们隐藏了一些您不该配置的属性
122158
159+
```rust
123160
#[derive(Debug, Clone)]
124161
pub enum Props {
125162
OsType(GOsType),
126163
DerefWidget(ViewProps),
127164
ShowTitle(bool),
128165
ShowIcon(bool),
129-
LastMousePos(DVec2),
130-
MouseCursorSize(DVec2),
131166
HideCaptionOnFullscreen(bool),
132-
EventKey(bool),
133167
WindowSize(WindowSize),
134168
}
135169

170+
#[derive(Debug, Clone)]
171+
pub struct WindowSize {
172+
pub inner_size: DVec2,
173+
}
174+
136175
#[derive(Clone, Copy, PartialEq, Debug, Default)]
137176
pub enum GOsType {
138177
Windows,
@@ -167,10 +206,6 @@ pub enum Props {
167206
AnimationKey(bool),
168207
GrabKeyFocus(bool),
169208
BlockSignalEvent(bool),
170-
// MinWidth(f32),
171-
// MinHeight(f32),
172-
// MaxWidth(f32),
173-
// MaxHeight(f32),
174209
Walk(Walk),
175210
Layout(Layout),
176211
EventOrder(EventOrder),
@@ -180,9 +215,4 @@ pub enum Props {
180215
EventKey(bool),
181216
BlockChildEvents(bool),
182217
}
183-
184-
#[derive(Debug, Clone)]
185-
pub struct WindowSize {
186-
pub inner_size: DVec2,
187-
}
188218
```

docs/v0.1.0/zh/doc/guide/tools.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Ract 是一款用 Rust 编写的会话式 CLI 工具,旨在通过提供一体
1818
Ract 具有最少的参数和直观的基于对话框的界面,支持 GenUI 和 Makepad 等框架,使您的开发工作流程顺畅高效。 🚀
1919

2020
:::tip
21-
`Ract`是您开启GenUI之路的第一步,请选择最新的版本进行下载,Ract相关使用请参照教程:[Ract](/doc/tutorial/ract/introduction)
21+
`Ract`是您开启GenUI之路的第一步,请选择最新的版本进行下载,Ract相关使用请参照教程:[Ract](zh/doc/tutorial/ract/introduction)
2222
:::
2323

2424
## VSCode 插件 <Badge text="Comming Soon" type="warning" />

0 commit comments

Comments
 (0)