nexfep 0.0.1 → 0.0.2

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.
Files changed (3) hide show
  1. package/README-CN.md +238 -0
  2. package/README.md +98 -98
  3. package/package.json +2 -1
package/README-CN.md ADDED
@@ -0,0 +1,238 @@
1
+ # Nexfep
2
+
3
+ 基于 WebView 的桌面应用框架
4
+
5
+ ## 项目状态
6
+
7
+ **🚧 早期阶段**
8
+
9
+ 本项目目前处于早期开发阶段,仍缺失大量桌面应用开发所需的核心能力。框架正在持续迭代中。
10
+
11
+ ## 简介
12
+
13
+ Nexfep 是一个基于 [@webviewjs/webview](https://github.com/webview/webview) 构建的桌面应用框架,使用 TypeScript 编写。它旨在为开发者提供一套简洁、高效的工具链,用于构建跨平台桌面应用。
14
+
15
+ 框架采用窗口池管理机制,支持多窗口应用场景,如代码编辑器、聊天工具、仪表盘等。
16
+
17
+ ## 特性
18
+
19
+ - **窗口池管理** — 内置窗口池机制,自动复用和回收窗口资源,避免频繁创建销毁的开销
20
+ - **IPC 通信** — 支持主进程与 WebView 之间的双向消息通信,通过注入的函数进行调用
21
+ - **窗口控制** — 提供最大化、最小化、关闭、标题设置、开发者工具等完整窗口操作 API
22
+ - **拖拽区域** — 内置 HTML 属性支持,方便定义窗口拖拽区域(`nexfep-area-drag` 等)
23
+ - **TypeScript 支持** — 完整的类型定义,开发体验优秀
24
+
25
+ ## 安装
26
+
27
+ ```bash
28
+ pnpm add nexfep
29
+ ```
30
+
31
+ ## 快速开始
32
+
33
+ ```typescript
34
+ import { WindowPool } from 'nexfep';
35
+
36
+ const pool = new WindowPool();
37
+
38
+ const window = await pool.createWindow(true, false);
39
+
40
+ await window.loadHTML('<h1 nexfep-area-drag>Hello Nexfep!</h1>');
41
+
42
+ pool.mainloop();
43
+ ```
44
+
45
+ ## 使用指南
46
+
47
+ ### 窗口池
48
+
49
+ `WindowPool` 是框架的核心管理类,负责窗口的创建和回收。
50
+
51
+ ```typescript
52
+ const pool = new WindowPool();
53
+ ```
54
+
55
+ **构造函数参数**
56
+
57
+ - `WindowsWebview2UserDataFolder`(可选)— WebView2 用户数据目录,默认为 `%LOCALAPPDATA%\NexfepDevelopment.webview2-data`
58
+
59
+ ### 窗口创建
60
+
61
+ ```typescript
62
+ const win = await pool.createWindow(true, false);
63
+ ```
64
+
65
+ **参数说明**
66
+
67
+ - `isShow`(布尔值,默认 `true`)— 是否立即显示窗口
68
+ - `isDecorated`(布尔值,默认 `true`)— 是否使用系统窗口装饰。设为 `false` 时,窗口无边框,需要自定义标题栏
69
+
70
+ ### 窗口操作
71
+
72
+ ```typescript
73
+ window.show();
74
+ window.hide();
75
+ window.maximize();
76
+ window.minimize();
77
+ window.close();
78
+ window.setTitle('新标题');
79
+ window.openDevTools();
80
+ ```
81
+
82
+ ### IPC 通信
83
+
84
+ 框架在 WebView 页面加载完成后会自动注入一系列控制函数,建议使用这些注入的函数进行 IPC 通信,而非直接使用 `@webviewjs/webview` 原生包装的 IPC。
85
+
86
+ #### 发送自定义消息
87
+
88
+ 在页面中通过 `window.postMessage` 发送消息:
89
+
90
+ ```javascript
91
+ window.postMessage({ hello: 'world' });
92
+ ```
93
+
94
+ **参数说明**
95
+
96
+ - `data` — 任意类型的可序列化数据,会被序列化为 JSON 字符串后发送
97
+
98
+ #### 监听消息
99
+
100
+ 在主进程中通过 `onCustomMessage` 回调接收消息:
101
+
102
+ ```typescript
103
+ pool.onCustomMessage = (window, data) => {
104
+ console.log(`来自窗口 ${window.id} 的消息:`, data);
105
+ };
106
+ ```
107
+
108
+ **回调参数**
109
+
110
+ - `window` — 发送消息的窗口对象
111
+ - `data` — 消息内容,为对象类型(JSON 序列化后会自动通过 `JSON.parse` 转换为对象)
112
+
113
+ #### 窗口控制函数
114
+
115
+ 页面中可直接调用以下注入函数进行窗口控制:
116
+
117
+ ```javascript
118
+ window.close(); // 关闭窗口
119
+ window.minimize(); // 最小化窗口
120
+ window.unminimize(); // 还原最小化的窗口
121
+ window.maximize(); // 最大化窗口
122
+ window.unmaximize(); // 还原最大化的窗口
123
+ window.setTitle('标题'); // 设置窗口标题
124
+ window.openDevTools(); // 打开开发者工具
125
+ window.closeDevTools(); // 关闭开发者工具
126
+ ```
127
+
128
+ ### 拖拽区域
129
+
130
+ 通过 HTML 属性即可定义窗口拖拽区域,无需编写额外 JavaScript 代码。这些属性会自动应用 `-webkit-app-region` 和 `app-region` CSS 属性。
131
+
132
+ #### `nexfep-area-drag`
133
+
134
+ 使整个区域及其所有子元素均可拖拽。适用于自定义标题栏等需要整块区域可拖拽的场景。
135
+
136
+ ```html
137
+ <div nexfep-area-drag>
138
+ <h1>标题栏</h1>
139
+ <span>副标题</span>
140
+ </div>
141
+ ```
142
+
143
+ #### `nexfep-element-drag`
144
+
145
+ 仅使指定元素本身可拖拽,子元素不受影响。适用于需要精确控制拖拽区域的场景。
146
+
147
+ ```html
148
+ <div>
149
+ <div nexfep-element-drag>拖拽手柄</div>
150
+ <p>这部分不可拖拽</p>
151
+ </div>
152
+ ```
153
+
154
+ #### `nexfep-no-drag`
155
+
156
+ 使指定区域及其所有子元素不可拖拽,优先级最高,可覆盖父元素的拖拽属性。适用于按钮、输入框等交互元素。
157
+
158
+ ```html
159
+ <div nexfep-area-drag>
160
+ <h1>标题栏</h1>
161
+ <button nexfep-no-drag>点击按钮</button>
162
+ </div>
163
+ ```
164
+
165
+ #### `nexfep-auto-drag`
166
+
167
+ 自动判断拖拽区域:整个区域可拖拽,但常见交互元素(`button`、`input`、`select`、`textarea`、`a`)自动设为不可拖拽。适用于包含多种交互元素的复杂区域。
168
+
169
+ ```html
170
+ <div nexfep-auto-drag>
171
+ <h1>标题栏</h1>
172
+ <button>自动不可拖拽</button>
173
+ <input placeholder="自动不可拖拽" />
174
+ <a href="#">自动不可拖拽</a>
175
+ </div>
176
+ ```
177
+
178
+ ### 加载完成事件
179
+
180
+ WebView 窗口加载完成后会触发 `nexfep-load-done` 事件:
181
+
182
+ ```javascript
183
+ window.addEventListener('nexfep-load-done', () => {
184
+ console.log('Nexfep 窗口加载完成');
185
+ });
186
+ ```
187
+
188
+ 也可通过 `window.isNexfepLoadDone` 属性判断:
189
+
190
+ ```javascript
191
+ if (window.isNexfepLoadDone) {
192
+ // 窗口已就绪
193
+ }
194
+ ```
195
+
196
+ ## API
197
+
198
+ ### WindowPool
199
+
200
+ | 方法/属性 | 参数 | 返回值 | 说明 |
201
+ | ------------------------------------- | ----------------------------------------------------------- | ---------------- | -------------------------- |
202
+ | `constructor(userDataFolder?)` | `userDataFolder`: string(可选) | WindowPool | 创建窗口池,可选指定 WebView2 用户数据目录 |
203
+ | `createWindow(isShow?, isDecorated?)` | `isShow`: boolean(默认 true), `isDecorated`: boolean(默认 true) | Promise\<Window> | 创建并获取一个窗口 |
204
+ | `closeWindow(window)` | `window`: Window | Promise\<void> | 关闭指定窗口并回收至池中 |
205
+ | `closePool()` | 无 | Promise\<void> | 关闭窗口池,退出应用 |
206
+ | `mainloop()` | 无 | void | 启动应用主循环,阻塞直到应用退出 |
207
+ | `onCustomMessage` | `(window: Window, data: string) => void` | 无 | 自定义消息回调函数,当收到页面发来的自定义消息时触发 |
208
+
209
+ ### Window
210
+
211
+ | 方法/属性 | 参数 | 返回值 | 说明 |
212
+ | --------------------------- | --------------------------------- | -------------- | ------------- |
213
+ | `loadURL(url)` | `url`: string — 要加载的网页地址 | Promise\<void> | 加载指定 URL |
214
+ | `loadHTML(html)` | `html`: string — HTML 字符串 | Promise\<void> | 加载指定 HTML 内容 |
215
+ | `show()` | 无 | void | 显示窗口 |
216
+ | `hide()` | 无 | void | 隐藏窗口 |
217
+ | `maximize()` | 无 | void | 最大化窗口 |
218
+ | `unMaximize()` | 无 | void | 还原窗口(取消最大化) |
219
+ | `minimize()` | 无 | void | 最小化窗口 |
220
+ | `unMinimize()` | 无 | void | 还原窗口(取消最小化) |
221
+ | `close()` | 无 | void | 关闭窗口并回收至池中 |
222
+ | `setTitle(title)` | `title`: string — 窗口标题 | void | 设置窗口标题 |
223
+ | `setDecorated(isDecorated)` | `isDecorated`: boolean — 是否使用系统装饰 | void | 设置窗口是否带边框和标题栏 |
224
+ | `resizable(resizable)` | `resizable`: boolean — 是否可调整大小 | void | 设置窗口是否可调整大小 |
225
+ | `openDevTools()` | 无 | void | 打开开发者工具 |
226
+ | `closeDevTools()` | 无 | void | 关闭开发者工具 |
227
+ | `id` | 无 | number | 窗口唯一标识,自增编号 |
228
+
229
+ ## 开发
230
+
231
+ ```bash
232
+ pnpm install
233
+ pnpm run compile
234
+ ```
235
+
236
+ ## 许可证
237
+
238
+ MIT License
package/README.md CHANGED
@@ -1,34 +1,34 @@
1
1
  # Nexfep
2
2
 
3
- 基于 WebView 的桌面应用框架
3
+ A desktop application framework based on WebView
4
4
 
5
- ## 项目状态
5
+ ## Project Status
6
6
 
7
- **🚧 早期阶段**
7
+ **🚧 Early Stage**
8
8
 
9
- 本项目目前处于早期开发阶段,仍缺失大量桌面应用开发所需的核心能力。框架正在持续迭代中。
9
+ This project is currently in early development, with many core capabilities for desktop application development still missing. The framework is being continuously iterated.
10
10
 
11
- ## 简介
11
+ ## Introduction
12
12
 
13
- Nexfep 是一个基于 [@webviewjs/webview](https://github.com/webview/webview) 构建的桌面应用框架,使用 TypeScript 编写。它旨在为开发者提供一套简洁、高效的工具链,用于构建跨平台桌面应用。
13
+ Nexfep is a desktop application framework built on [@webviewjs/webview](https://github.com/webview/webview), written in TypeScript. It aims to provide developers with a concise and efficient toolchain for building cross-platform desktop applications.
14
14
 
15
- 框架采用窗口池管理机制,支持多窗口应用场景,如代码编辑器、聊天工具、仪表盘等。
15
+ The framework uses a window pool management mechanism, supporting multi-window application scenarios such as code editors, chat tools, dashboards, etc.
16
16
 
17
- ## 特性
17
+ ## Features
18
18
 
19
- - **窗口池管理**内置窗口池机制,自动复用和回收窗口资源,避免频繁创建销毁的开销
20
- - **IPC 通信**支持主进程与 WebView 之间的双向消息通信,通过注入的函数进行调用
21
- - **窗口控制**提供最大化、最小化、关闭、标题设置、开发者工具等完整窗口操作 API
22
- - **拖拽区域**内置 HTML 属性支持,方便定义窗口拖拽区域(`nexfep-area-drag` 等)
23
- - **TypeScript 支持**完整的类型定义,开发体验优秀
19
+ - **Window Pool Management** Built-in window pool mechanism for automatic reuse and recycling of window resources, avoiding the overhead of frequent creation and destruction
20
+ - **IPC Communication**Supports bidirectional message communication between the main process and WebView, via injected functions
21
+ - **Window Control** Provides complete window operation APIs including maximize, minimize, close, title setting, and developer tools
22
+ - **Drag Regions** Built-in HTML attribute support for defining window drag regions (`nexfep-area-drag`, etc.)
23
+ - **TypeScript Support**Complete type definitions for excellent development experience
24
24
 
25
- ## 安装
25
+ ## Installation
26
26
 
27
27
  ```bash
28
28
  pnpm add nexfep
29
29
  ```
30
30
 
31
- ## 快速开始
31
+ ## Quick Start
32
32
 
33
33
  ```typescript
34
34
  import { WindowPool } from 'nexfep';
@@ -42,32 +42,32 @@ await window.loadHTML('<h1 nexfep-area-drag>Hello Nexfep!</h1>');
42
42
  pool.mainloop();
43
43
  ```
44
44
 
45
- ## 使用指南
45
+ ## Usage Guide
46
46
 
47
- ### 窗口池
47
+ ### Window Pool
48
48
 
49
- `WindowPool` 是框架的核心管理类,负责窗口的创建和回收。
49
+ `WindowPool` is the core management class of the framework, responsible for window creation and recycling.
50
50
 
51
51
  ```typescript
52
52
  const pool = new WindowPool();
53
53
  ```
54
54
 
55
- **构造函数参数**
55
+ **Constructor Parameters**
56
56
 
57
- - `WindowsWebview2UserDataFolder`(可选)— WebView2 用户数据目录,默认为 `%LOCALAPPDATA%\NexfepDevelopment.webview2-data`
57
+ - `WindowsWebview2UserDataFolder` (optional) — WebView2 user data directory, defaults to `%LOCALAPPDATA%\NexfepDevelopment.webview2-data`
58
58
 
59
- ### 窗口创建
59
+ ### Window Creation
60
60
 
61
61
  ```typescript
62
62
  const win = await pool.createWindow(true, false);
63
63
  ```
64
64
 
65
- **参数说明**
65
+ **Parameters**
66
66
 
67
- - `isShow`(布尔值,默认 `true`)— 是否立即显示窗口
68
- - `isDecorated`(布尔值,默认 `true`)— 是否使用系统窗口装饰。设为 `false` 时,窗口无边框,需要自定义标题栏
67
+ - `isShow` (boolean, default `true`) — Whether to immediately show the window
68
+ - `isDecorated` (boolean, default `true`) Whether to use system window decorations. When set to `false`, the window has no border and requires a custom title bar
69
69
 
70
- ### 窗口操作
70
+ ### Window Operations
71
71
 
72
72
  ```typescript
73
73
  window.show();
@@ -75,121 +75,121 @@ window.hide();
75
75
  window.maximize();
76
76
  window.minimize();
77
77
  window.close();
78
- window.setTitle('新标题');
78
+ window.setTitle('New Title');
79
79
  window.openDevTools();
80
80
  ```
81
81
 
82
- ### IPC 通信
82
+ ### IPC Communication
83
83
 
84
- 框架在 WebView 页面加载完成后会自动注入一系列控制函数,建议使用这些注入的函数进行 IPC 通信,而非直接使用 `@webviewjs/webview` 原生包装的 IPC。
84
+ The framework automatically injects a series of control functions after WebView page loading is complete. It is recommended to use these injected functions for IPC communication, rather than the native IPC wrapped by `@webviewjs/webview`.
85
85
 
86
- #### 发送自定义消息
86
+ #### Send Custom Messages
87
87
 
88
- 在页面中通过 `window.postMessage` 发送消息:
88
+ Send messages via `window.postMessage` in the page:
89
89
 
90
90
  ```javascript
91
91
  window.postMessage({ hello: 'world' });
92
92
  ```
93
93
 
94
- **参数说明**
94
+ **Parameters**
95
95
 
96
- - `data` — 任意类型的可序列化数据,会被序列化为 JSON 字符串后发送
96
+ - `data` — Any serializable data, will be serialized to JSON string before sending
97
97
 
98
- #### 监听消息
98
+ #### Listen for Messages
99
99
 
100
- 在主进程中通过 `onCustomMessage` 回调接收消息:
100
+ Receive messages via `onCustomMessage` callback in the main process:
101
101
 
102
102
  ```typescript
103
103
  pool.onCustomMessage = (window, data) => {
104
- console.log(`来自窗口 ${window.id} 的消息:`, data);
104
+ console.log(`Message from window ${window.id}:`, data);
105
105
  };
106
106
  ```
107
107
 
108
- **回调参数**
108
+ **Callback Parameters**
109
109
 
110
- - `window` — 发送消息的窗口对象
111
- - `data` — 消息内容,为对象类型(JSON 序列化后会自动通过 `JSON.parse` 转换为对象)
110
+ - `window` — The window object that sent the message
111
+ - `data` — Message content, an object type (automatically converted from JSON string via `JSON.parse`)
112
112
 
113
- #### 窗口控制函数
113
+ #### Window Control Functions
114
114
 
115
- 页面中可直接调用以下注入函数进行窗口控制:
115
+ The following injected functions can be directly called in the page for window control:
116
116
 
117
117
  ```javascript
118
- window.close(); // 关闭窗口
119
- window.minimize(); // 最小化窗口
120
- window.unminimize(); // 还原最小化的窗口
121
- window.maximize(); // 最大化窗口
122
- window.unmaximize(); // 还原最大化的窗口
123
- window.setTitle('标题'); // 设置窗口标题
124
- window.openDevTools(); // 打开开发者工具
125
- window.closeDevTools(); // 关闭开发者工具
118
+ window.close(); // Close window
119
+ window.minimize(); // Minimize window
120
+ window.unminimize(); // Restore minimized window
121
+ window.maximize(); // Maximize window
122
+ window.unmaximize(); // Restore maximized window
123
+ window.setTitle('Title'); // Set window title
124
+ window.openDevTools(); // Open developer tools
125
+ window.closeDevTools(); // Close developer tools
126
126
  ```
127
127
 
128
- ### 拖拽区域
128
+ ### Drag Regions
129
129
 
130
- 通过 HTML 属性即可定义窗口拖拽区域,无需编写额外 JavaScript 代码。这些属性会自动应用 `-webkit-app-region` `app-region` CSS 属性。
130
+ Define window drag regions via HTML attributes without writing additional JavaScript code. These attributes automatically apply `-webkit-app-region` and `app-region` CSS properties.
131
131
 
132
132
  #### `nexfep-area-drag`
133
133
 
134
- 使整个区域及其所有子元素均可拖拽。适用于自定义标题栏等需要整块区域可拖拽的场景。
134
+ Makes the entire region and all its child elements draggable. Suitable for scenarios like custom title bars where the entire region needs to be draggable.
135
135
 
136
136
  ```html
137
137
  <div nexfep-area-drag>
138
- <h1>标题栏</h1>
139
- <span>副标题</span>
138
+ <h1>Title Bar</h1>
139
+ <span>Subtitle</span>
140
140
  </div>
141
141
  ```
142
142
 
143
143
  #### `nexfep-element-drag`
144
144
 
145
- 仅使指定元素本身可拖拽,子元素不受影响。适用于需要精确控制拖拽区域的场景。
145
+ Makes only the specified element itself draggable; child elements are not affected. Suitable for scenarios requiring precise control over the drag region.
146
146
 
147
147
  ```html
148
148
  <div>
149
- <div nexfep-element-drag>拖拽手柄</div>
150
- <p>这部分不可拖拽</p>
149
+ <div nexfep-element-drag>Drag Handle</div>
150
+ <p>This part is not draggable</p>
151
151
  </div>
152
152
  ```
153
153
 
154
154
  #### `nexfep-no-drag`
155
155
 
156
- 使指定区域及其所有子元素不可拖拽,优先级最高,可覆盖父元素的拖拽属性。适用于按钮、输入框等交互元素。
156
+ Makes the specified region and all its child elements non-draggable. Highest priority, can override parent element's drag attributes. Suitable for interactive elements like buttons and input fields.
157
157
 
158
158
  ```html
159
159
  <div nexfep-area-drag>
160
- <h1>标题栏</h1>
161
- <button nexfep-no-drag>点击按钮</button>
160
+ <h1>Title Bar</h1>
161
+ <button nexfep-no-drag>Click Button</button>
162
162
  </div>
163
163
  ```
164
164
 
165
165
  #### `nexfep-auto-drag`
166
166
 
167
- 自动判断拖拽区域:整个区域可拖拽,但常见交互元素(`button`、`input`、`select`、`textarea`、`a`)自动设为不可拖拽。适用于包含多种交互元素的复杂区域。
167
+ Automatically determines drag regions: the entire region is draggable, but common interactive elements (`button`, `input`, `select`, `textarea`, `a`) are automatically set to non-draggable. Suitable for complex regions containing multiple interactive elements.
168
168
 
169
169
  ```html
170
170
  <div nexfep-auto-drag>
171
- <h1>标题栏</h1>
172
- <button>自动不可拖拽</button>
173
- <input placeholder="自动不可拖拽" />
174
- <a href="#">自动不可拖拽</a>
171
+ <h1>Title Bar</h1>
172
+ <button>Automatically non-draggable</button>
173
+ <input placeholder="Automatically non-draggable" />
174
+ <a href="#">Automatically non-draggable</a>
175
175
  </div>
176
176
  ```
177
177
 
178
- ### 加载完成事件
178
+ ### Load Complete Event
179
179
 
180
- WebView 窗口加载完成后会触发 `nexfep-load-done` 事件:
180
+ The `nexfep-load-done` event is triggered after the WebView window finishes loading:
181
181
 
182
182
  ```javascript
183
183
  window.addEventListener('nexfep-load-done', () => {
184
- console.log('Nexfep 窗口加载完成');
184
+ console.log('Nexfep window loaded');
185
185
  });
186
186
  ```
187
187
 
188
- 也可通过 `window.isNexfepLoadDone` 属性判断:
188
+ It can also be checked via the `window.isNexfepLoadDone` property:
189
189
 
190
190
  ```javascript
191
191
  if (window.isNexfepLoadDone) {
192
- // 窗口已就绪
192
+ // Window is ready
193
193
  }
194
194
  ```
195
195
 
@@ -197,42 +197,42 @@ if (window.isNexfepLoadDone) {
197
197
 
198
198
  ### WindowPool
199
199
 
200
- | 方法/属性 | 参数 | 返回值 | 说明 |
201
- | ------------------------------------- | ----------------------------------------------------------- | ---------------- | -------------------------- |
202
- | `constructor(userDataFolder?)` | `userDataFolder`: string(可选) | WindowPool | 创建窗口池,可选指定 WebView2 用户数据目录 |
203
- | `createWindow(isShow?, isDecorated?)` | `isShow`: boolean(默认 true), `isDecorated`: boolean(默认 true| Promise\<Window> | 创建并获取一个窗口 |
204
- | `closeWindow(window)` | `window`: Window | Promise\<void> | 关闭指定窗口并回收至池中 |
205
- | `closePool()` | | Promise\<void> | 关闭窗口池,退出应用 |
206
- | `mainloop()` | | void | 启动应用主循环,阻塞直到应用退出 |
207
- | `onCustomMessage` | `(window: Window, data: string) => void` | | 自定义消息回调函数,当收到页面发来的自定义消息时触发 |
200
+ | Method/Property | Parameters | Return Value | Description |
201
+ | ------------------------------------- | -------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------ |
202
+ | `constructor(userDataFolder?)` | `userDataFolder`: string (optional) | WindowPool | Creates a window pool, optionally specifying the WebView2 user data directory |
203
+ | `createWindow(isShow?, isDecorated?)` | `isShow`: boolean (default true), `isDecorated`: boolean (default true) | Promise\<Window> | Creates and returns a window |
204
+ | `closeWindow(window)` | `window`: Window | Promise\<void> | Closes the specified window and returns it to the pool |
205
+ | `closePool()` | None | Promise\<void> | Closes the window pool and exits the application |
206
+ | `mainloop()` | None | void | Starts the application main loop, blocking until the application exits |
207
+ | `onCustomMessage` | `(window: Window, data: string) => void` | None | Custom message callback, triggered when receiving custom messages from pages |
208
208
 
209
209
  ### Window
210
210
 
211
- | 方法/属性 | 参数 | 返回值 | 说明 |
212
- | --------------------------- | --------------------------------- | -------------- | ------------- |
213
- | `loadURL(url)` | `url`: string — 要加载的网页地址 | Promise\<void> | 加载指定 URL |
214
- | `loadHTML(html)` | `html`: string — HTML 字符串 | Promise\<void> | 加载指定 HTML 内容 |
215
- | `show()` | | void | 显示窗口 |
216
- | `hide()` | | void | 隐藏窗口 |
217
- | `maximize()` | | void | 最大化窗口 |
218
- | `unMaximize()` | | void | 还原窗口(取消最大化) |
219
- | `minimize()` | | void | 最小化窗口 |
220
- | `unMinimize()` | | void | 还原窗口(取消最小化) |
221
- | `close()` | | void | 关闭窗口并回收至池中 |
222
- | `setTitle(title)` | `title`: string — 窗口标题 | void | 设置窗口标题 |
223
- | `setDecorated(isDecorated)` | `isDecorated`: boolean — 是否使用系统装饰 | void | 设置窗口是否带边框和标题栏 |
224
- | `resizable(resizable)` | `resizable`: boolean — 是否可调整大小 | void | 设置窗口是否可调整大小 |
225
- | `openDevTools()` | | void | 打开开发者工具 |
226
- | `closeDevTools()` | | void | 关闭开发者工具 |
227
- | `id` | | number | 窗口唯一标识,自增编号 |
228
-
229
- ## 开发
211
+ | Method/Property | Parameters | Return Value | Description |
212
+ | ------------------------------------- | ------------------------------------------- | ---------------- | ---------------------------------------- |
213
+ | `loadURL(url)` | `url`: string — URL to load | Promise\<void> | Loads the specified URL |
214
+ | `loadHTML(html)` | `html`: string — HTML string | Promise\<void> | Loads the specified HTML content |
215
+ | `show()` | None | void | Shows the window |
216
+ | `hide()` | None | void | Hides the window |
217
+ | `maximize()` | None | void | Maximizes the window |
218
+ | `unMaximize()` | None | void | Restores the window (cancels maximize) |
219
+ | `minimize()` | None | void | Minimizes the window |
220
+ | `unMinimize()` | None | void | Restores the window (cancels minimize) |
221
+ | `close()` | None | void | Closes the window and returns to pool |
222
+ | `setTitle(title)` | `title`: string — Window title | void | Sets the window title |
223
+ | `setDecorated(isDecorated)` | `isDecorated`: boolean — Use system decorations | void | Sets whether the window has borders and title bar |
224
+ | `resizable(resizable)` | `resizable`: boolean — Resizable | void | Sets whether the window is resizable |
225
+ | `openDevTools()` | None | void | Opens developer tools |
226
+ | `closeDevTools()` | None | void | Closes developer tools |
227
+ | `id` | None | number | Unique window identifier, auto-incrementing |
228
+
229
+ ## Development
230
230
 
231
231
  ```bash
232
232
  pnpm install
233
233
  pnpm run compile
234
234
  ```
235
235
 
236
- ## 许可证
236
+ ## License
237
237
 
238
- MIT License
238
+ MIT License
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "nexfep",
3
- "version": "0.0.1",
3
+ "description": "A desktop application framework based on WebView.js",
4
+ "version": "0.0.2",
4
5
  "type": "module",
5
6
  "packageManager": "pnpm@9.15.9",
6
7
  "main": "./index.js",