Skip to content

Commit 52bc58a

Browse files
committed
feat: update doc
1 parent 2ff21df commit 52bc58a

5 files changed

Lines changed: 93 additions & 7 deletions

File tree

astro.config.mjs

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ export default defineConfig({
3333
{
3434
label: "创建第一个工程",
3535
slug: "guides/create-project",
36+
},
37+
{
38+
label: "架构",
39+
slug: "guides/architecture",
3640
}
3741
],
3842
},
@@ -75,7 +79,10 @@ export default defineConfig({
7579
label: '滚动容器 Scroll',
7680
slug: 'components/scroll',
7781
},
78-
82+
{
83+
label: '视频 Video',
84+
slug: 'components/video',
85+
},
7986
]
8087
},
8188
{
@@ -89,6 +96,14 @@ export default defineConfig({
8996
label: '窗体 Window',
9097
slug: 'api/window',
9198
},
99+
{
100+
label: '网络请求 Fetch',
101+
slug: 'api/fetch',
102+
},
103+
{
104+
label: 'WebSocket',
105+
slug: 'api/websocket',
106+
},
92107
{
93108
label: '音频 Audio',
94109
slug: 'api/audio',
@@ -125,10 +140,6 @@ export default defineConfig({
125140
label: '后台线程 Worker',
126141
slug: 'api/worker',
127142
},
128-
{
129-
label: 'WebSocket',
130-
slug: 'api/websocket',
131-
},
132143
{
133144
label: 'Sqlite',
134145
slug: 'api/sqlite',

src/content/docs/api/fetch.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
title: Fetch 网络请求
3+
---
4+
5+
Fetch用于发起Http请求
6+
7+
**使用**
8+
```
9+
const rsp = await fetch("https://deft-ui.github.io");
10+
const result = await rsp.json();
11+
console.log(result);
12+
```
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
title: 视频 Video
3+
---
4+
5+
在Deft中播放视频,需要引入额外的组件`deft-video`,详情请参考:https://github.com/deft-ui/deft-video
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
---
2+
title: 架构
3+
---
4+
5+
# 简介
6+
7+
Deft是一个通用的UI引擎,允许使用Rust和JavaScript构建跨平台应用。它使用统一的渲染引擎(skia)和JavaScript引擎(quickjs),确保在所有平台都拥有一致的表现。
8+
9+
Deft提供常用的基础组件,同时允许创建自绘组件,这提供了极大的灵活性。基础组件和自绘组件使用Rust编写,以提供更好的性能。
10+
11+
Deft提供便捷高效的跨语言调用(Rust和JavaScript),可以高效地调用系统接口。
12+
13+
# Deft不是什么
14+
15+
* 不是WebView。Deft不提供完整Web环境,即使它提供很多跟Web一致的API。
16+
* 不是一个大而全的UI框架。Deft更多的是提供基础能力,同时提供易用的扩展机制,以保持轻量和灵活。
17+
* 不是高性能JavaScript引擎。Deft使用QuickJS解析执行JavaScript,性能并不是QuickJS的优势,性能问题应该使用Rust解决。
18+
19+
# 主要组件
20+
21+
## deft [Rust]
22+
23+
Rust层使用的主要依赖库,提供应用初始化、启动、运行时、基础组件等能力。
24+
25+
## deft-build [Rust]
26+
27+
Rust层使用的构建脚本依赖,提供开发和构建相关能力。
28+
29+
## deft-macros [Rust]
30+
31+
Rust使用的宏工具包,提供方便的跨语言调用能力。
32+
33+
## deft-sys [JS]
34+
35+
JS层类型定义库,它不是必须的,当你希望IDE提供类型提示的时候,才需要使用它。
36+
37+
## deft-react [JS]
38+
39+
JS层React支持库,它不是必须的,当你希望使用React开发应用时,才需要使用它。
40+
41+
# 外部组件
42+
43+
## deft-skia-safe
44+
45+
提供2D图形渲染相关能力,从[rust-skia](https://github.com/rust-skia/rust-skia)项目fork出来的,以更好适配Deft
46+
47+
## deft-quick-js
48+
49+
提供JS解析、执行相关能力,从[quick-js](https://github.com/theduke/quickjs-rs)项目fork出来的,以更好适配Deft
50+
51+
## deft-winit
52+
53+
提供窗口创建、管理相关能力,从[winit](https://github.com/rust-windowing/winit)项目fork出来的,以更好适配Deft
54+
55+
## deft-yoga
56+
57+
提供布局计算相关能力,从[yoga-rs](https://github.com/bschwind/yoga-rs)项目fork出来的,以更好适配Deft
58+

src/content/docs/guides/create-project.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: 创建第一个工程
33
---
44

5-
## 创建
5+
## 创建工程
66

77
安装Rust和NodeJS环境后,使用下面任意一条命令,即可创建一个Deft工程。
88

@@ -19,7 +19,7 @@ pnpm create deft@latest
1919
yarn create deft
2020
```
2121

22-
## 启动
22+
## 启动工程
2323

2424
```bash
2525
npm run dev

0 commit comments

Comments
 (0)