ms-vite-plugin 1.4.11 → 1.4.12
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.
- package/docs/api/pip.md +191 -11
- package/docs/apicn/pip.md +191 -11
- package/docs/apipython/pip.md +203 -11
- package/docs/httpapi/api.md +1 -1
- package/package.json +1 -1
- package/webview/assets/index-C8WE_Bef.js +2 -0
- package/webview/assets/rolldown-runtime-_TIqcEvS.js +1 -0
- package/webview/assets/vendor-modules-lYh5b13U.js +93553 -0
- package/webview/index.html +3 -2
- package/webview/assets/index-CFwoQXO_.js +0 -13
- package/webview/assets/vendor-modules-Oqi8dZEn.js +0 -42198
package/docs/apipython/pip.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
# 悬浮窗模块 (PIP)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
悬浮窗模块提供 iOS 画中画(Picture in Picture)悬浮窗能力,可用于显示脚本日志、保活提示或脚本自定义文本。
|
|
4
4
|
|
|
5
5
|
## 功能特性
|
|
6
6
|
|
|
7
|
-
-
|
|
7
|
+
- **显示模式**:支持日志、保活和自定义三种显示模式
|
|
8
|
+
- **关闭控制**:支持主动关闭悬浮窗
|
|
8
9
|
- **状态查询**:判断悬浮窗是否正在显示
|
|
9
|
-
-
|
|
10
|
+
- **尺寸设置**:日志模式和自定义模式支持设置内容宽高,并按模式分别持久化
|
|
11
|
+
- **自定义文本**:自定义模式支持文本、换行、文字颜色、背景色和文字大小
|
|
10
12
|
|
|
11
13
|
## API 参考
|
|
12
14
|
|
|
@@ -35,7 +37,7 @@ if pip.isPipActive():
|
|
|
35
37
|
|
|
36
38
|
### switchToLogMode - 切换到日志模式
|
|
37
39
|
|
|
38
|
-
切换到日志模式并尝试显示悬浮窗日志窗口。首次显示悬浮窗时 App
|
|
40
|
+
切换到日志模式并尝试显示悬浮窗日志窗口。首次显示悬浮窗时 App 必须在前台。日志模式会恢复最近一次保存的日志窗口尺寸。
|
|
39
41
|
|
|
40
42
|
```python
|
|
41
43
|
def switchToLogMode() -> bool
|
|
@@ -58,7 +60,7 @@ success = pip.switchToLogMode()
|
|
|
58
60
|
|
|
59
61
|
### switchToKeepAliveMode - 切换到保活模式
|
|
60
62
|
|
|
61
|
-
切换到保活模式并尝试显示极小高度悬浮窗。首次显示悬浮窗时 App
|
|
63
|
+
切换到保活模式并尝试显示极小高度悬浮窗。首次显示悬浮窗时 App 必须在前台。保活模式不接受脚本尺寸设置。
|
|
62
64
|
|
|
63
65
|
```python
|
|
64
66
|
def switchToKeepAliveMode() -> bool
|
|
@@ -79,12 +81,12 @@ utils.takeMeToFront()
|
|
|
79
81
|
success = pip.switchToKeepAliveMode()
|
|
80
82
|
```
|
|
81
83
|
|
|
82
|
-
###
|
|
84
|
+
### switchToCustomMode - 切换到自定义模式
|
|
83
85
|
|
|
84
|
-
|
|
86
|
+
切换到自定义模式并显示脚本设置的自定义文本。首次显示悬浮窗时 App 必须在前台。自定义模式会恢复最近一次保存的自定义窗口尺寸。
|
|
85
87
|
|
|
86
88
|
```python
|
|
87
|
-
def
|
|
89
|
+
def switchToCustomMode() -> bool
|
|
88
90
|
```
|
|
89
91
|
|
|
90
92
|
**返回值:**
|
|
@@ -95,10 +97,185 @@ def switchToOffMode() -> bool
|
|
|
95
97
|
|
|
96
98
|
**示例:**
|
|
97
99
|
|
|
100
|
+
```python
|
|
101
|
+
from kuaijs import pip, utils
|
|
102
|
+
|
|
103
|
+
utils.takeMeToFront()
|
|
104
|
+
pip.switchToCustomMode()
|
|
105
|
+
pip.setCustomText("运行中\n进度 1/3")
|
|
106
|
+
pip.setCustomTextColor("#34c759")
|
|
107
|
+
pip.setCustomTextSize(18)
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### closeWindow - 关闭悬浮窗
|
|
111
|
+
|
|
112
|
+
关闭悬浮窗。
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
def closeWindow() -> bool
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**返回值:**
|
|
119
|
+
|
|
120
|
+
| 类型 | 描述 |
|
|
121
|
+
| ------ | --------------------- |
|
|
122
|
+
| `bool` | `True` 代表已提交请求 |
|
|
123
|
+
|
|
124
|
+
**示例:**
|
|
125
|
+
|
|
126
|
+
```python
|
|
127
|
+
from kuaijs import pip
|
|
128
|
+
|
|
129
|
+
success = pip.closeWindow()
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### setContentSize - 设置内容尺寸
|
|
133
|
+
|
|
134
|
+
设置日志模式或自定义模式的悬浮窗内容尺寸。宽度和高度都必须传入有效数字。日志模式和自定义模式会分别保存尺寸;悬浮窗关闭状态和保活模式不会生效。
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
def setContentSize(width: float, height: float) -> bool
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**参数:**
|
|
141
|
+
|
|
142
|
+
| 参数 | 类型 | 必填 | 描述 |
|
|
143
|
+
| -------- | ---------------- | ---- | ----------------------------- |
|
|
144
|
+
| `width` | `float` | 是 | 目标内容宽度 |
|
|
145
|
+
| `height` | `float` | 是 | 目标内容高度 |
|
|
146
|
+
|
|
147
|
+
**返回值:**
|
|
148
|
+
|
|
149
|
+
| 类型 | 描述 |
|
|
150
|
+
| ------ | ------------------------------------------------------------------- |
|
|
151
|
+
| `bool` | `True` 代表尺寸已提交;`False` 代表当前模式不允许设置或宽高无效 |
|
|
152
|
+
|
|
153
|
+
**示例:**
|
|
154
|
+
|
|
98
155
|
```python
|
|
99
156
|
from kuaijs import pip
|
|
100
157
|
|
|
101
|
-
|
|
158
|
+
pip.switchToLogMode()
|
|
159
|
+
pip.setContentSize(280, 120)
|
|
160
|
+
|
|
161
|
+
pip.switchToCustomMode()
|
|
162
|
+
pip.setContentSize(120, 180)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### setCustomText - 设置自定义文本
|
|
166
|
+
|
|
167
|
+
设置自定义模式显示的纯文本内容。该方法只更新自定义文本数据,不会自动切换到自定义模式。
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
def setCustomText(text: str) -> bool
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**参数:**
|
|
174
|
+
|
|
175
|
+
| 参数 | 类型 | 必填 | 描述 |
|
|
176
|
+
| ------ | ----- | ---- | ------------------------------------------- |
|
|
177
|
+
| `text` | `str` | 是 | 要显示的文本,支持真实换行和字符串中的 `\n` |
|
|
178
|
+
|
|
179
|
+
**返回值:**
|
|
180
|
+
|
|
181
|
+
| 类型 | 描述 |
|
|
182
|
+
| ------ | --------------------- |
|
|
183
|
+
| `bool` | `True` 代表文本已提交 |
|
|
184
|
+
|
|
185
|
+
**示例:**
|
|
186
|
+
|
|
187
|
+
```python
|
|
188
|
+
from kuaijs import pip
|
|
189
|
+
|
|
190
|
+
pip.setCustomText("运行中\n进度 1/3")
|
|
191
|
+
pip.switchToCustomMode()
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### setCustomTextColor - 设置自定义文字颜色
|
|
195
|
+
|
|
196
|
+
设置自定义模式显示文本的文字颜色。该方法只更新文字颜色数据,不会自动切换到自定义模式。
|
|
197
|
+
|
|
198
|
+
```python
|
|
199
|
+
def setCustomTextColor(color: str) -> bool
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
**参数:**
|
|
203
|
+
|
|
204
|
+
| 参数 | 类型 | 必填 | 描述 |
|
|
205
|
+
| ------- | ----- | ---- | ---------------------------------------------------------- |
|
|
206
|
+
| `color` | `str` | 是 | 文字颜色,支持 `RRGGBB`、`RRGGBBAA`,可带 `#` 前缀;末尾 AA 为透明度;无效值使用白色 |
|
|
207
|
+
|
|
208
|
+
**返回值:**
|
|
209
|
+
|
|
210
|
+
| 类型 | 描述 |
|
|
211
|
+
| ------ | ------------------------- |
|
|
212
|
+
| `bool` | `True` 代表文字颜色已提交 |
|
|
213
|
+
|
|
214
|
+
**示例:**
|
|
215
|
+
|
|
216
|
+
```python
|
|
217
|
+
from kuaijs import pip
|
|
218
|
+
|
|
219
|
+
pip.setCustomTextColor("#34c759")
|
|
220
|
+
pip.switchToCustomMode()
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### setCustomTextSize - 设置自定义文字大小
|
|
224
|
+
|
|
225
|
+
设置自定义模式显示文本的文字大小。该方法只更新文字大小数据,不会自动切换到自定义模式。
|
|
226
|
+
|
|
227
|
+
```python
|
|
228
|
+
def setCustomTextSize(fontSize: float) -> bool
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
**参数:**
|
|
232
|
+
|
|
233
|
+
| 参数 | 类型 | 必填 | 描述 |
|
|
234
|
+
| ---------- | ------- | ---- | -------------------------- |
|
|
235
|
+
| `fontSize` | `float` | 是 | 文字字号,必须是有效数字 |
|
|
236
|
+
|
|
237
|
+
**返回值:**
|
|
238
|
+
|
|
239
|
+
| 类型 | 描述 |
|
|
240
|
+
| ------ | ----------------------------------------------------- |
|
|
241
|
+
| `bool` | `True` 代表文字大小已提交;`False` 代表字号无效 |
|
|
242
|
+
|
|
243
|
+
**示例:**
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
from kuaijs import pip
|
|
247
|
+
|
|
248
|
+
pip.setCustomTextSize(18)
|
|
249
|
+
pip.switchToCustomMode()
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
### setCustomBackgroundColor - 设置自定义背景色
|
|
253
|
+
|
|
254
|
+
设置自定义模式显示区域的背景色。该方法只更新背景色数据,不会自动切换到自定义模式。
|
|
255
|
+
|
|
256
|
+
```python
|
|
257
|
+
def setCustomBackgroundColor(color: str) -> bool
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
**参数:**
|
|
261
|
+
|
|
262
|
+
| 参数 | 类型 | 必填 | 描述 |
|
|
263
|
+
| ------- | ----- | ---- | ---------------------------------------------------------- |
|
|
264
|
+
| `color` | `str` | 是 | 背景颜色,支持 `RRGGBB`、`RRGGBBAA`,可带 `#` 前缀;末尾 AA 为透明度;无效值使用黑色 |
|
|
265
|
+
|
|
266
|
+
**返回值:**
|
|
267
|
+
|
|
268
|
+
| 类型 | 描述 |
|
|
269
|
+
| ------ | ----------------------- |
|
|
270
|
+
| `bool` | `True` 代表背景色已提交 |
|
|
271
|
+
|
|
272
|
+
**示例:**
|
|
273
|
+
|
|
274
|
+
```python
|
|
275
|
+
from kuaijs import pip
|
|
276
|
+
|
|
277
|
+
pip.setCustomBackgroundColor("#111111")
|
|
278
|
+
pip.switchToCustomMode()
|
|
102
279
|
```
|
|
103
280
|
|
|
104
281
|
## 完整使用示例
|
|
@@ -107,15 +284,25 @@ success = pip.switchToOffMode()
|
|
|
107
284
|
from kuaijs import pip, utils
|
|
108
285
|
|
|
109
286
|
utils.takeMeToFront()
|
|
287
|
+
|
|
110
288
|
pip.switchToLogMode()
|
|
289
|
+
pip.setContentSize(280, 120)
|
|
290
|
+
|
|
291
|
+
pip.setCustomText("任务运行中\n1/3")
|
|
292
|
+
pip.setCustomTextColor("#34c759")
|
|
293
|
+
pip.setCustomTextSize(18)
|
|
294
|
+
pip.setCustomBackgroundColor("#111111")
|
|
295
|
+
pip.switchToCustomMode()
|
|
296
|
+
pip.setContentSize(120, 180)
|
|
111
297
|
```
|
|
112
298
|
|
|
113
299
|
## 注意事项
|
|
114
300
|
|
|
115
|
-
1.
|
|
301
|
+
1. **前台限制**:首次切换到日志、保活或自定义显示模式并启动悬浮窗时,App 必须在前台;悬浮窗已启动后可以继续切换显示模式或关闭悬浮窗
|
|
116
302
|
2. **设备兼容性**:仅支持 iOS 15+ 且具备画中画功能的设备
|
|
117
303
|
3. **系统限制**:悬浮窗位置和实际显示尺寸由 iOS 管理
|
|
118
|
-
4.
|
|
304
|
+
4. **尺寸持久化**:日志模式和自定义模式分别保存尺寸,互不共用;保活模式不接受脚本尺寸
|
|
305
|
+
5. **竖向文本**:自定义窗口高度大于宽度时,文本会按逐字符换行方式竖向显示
|
|
119
306
|
|
|
120
307
|
## 故障排除
|
|
121
308
|
|
|
@@ -124,3 +311,8 @@ pip.switchToLogMode()
|
|
|
124
311
|
- 确认设备支持悬浮窗功能
|
|
125
312
|
- 检查悬浮窗权限是否已开启
|
|
126
313
|
- 确认应用当前在前台
|
|
314
|
+
|
|
315
|
+
### setContentSize 返回 False
|
|
316
|
+
|
|
317
|
+
- 确认当前模式是日志模式或自定义模式
|
|
318
|
+
- 确认宽度和高度都传入了有效数字
|
package/docs/httpapi/api.md
CHANGED
|
@@ -936,7 +936,7 @@ GET /logger/download
|
|
|
936
936
|
|
|
937
937
|
GET /logger/current/lines
|
|
938
938
|
|
|
939
|
-
读取 LoggerModule
|
|
939
|
+
读取 LoggerModule 当前已创建日志文件中已经写入的最新输出行。单次最多返回 5000 行,超出时按 5000 行处理。接口不会刷新当前日志缓冲区,也不会强制日志落盘,返回的 `lines` 按日志原始输出顺序排列。
|
|
940
940
|
|
|
941
941
|
### 请求参数
|
|
942
942
|
|