ms-vite-plugin 1.4.21 → 1.4.22

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.
@@ -28,12 +28,12 @@ AppleOCR 模块基于 Apple Vision 框架,提供原生的光学字符识别(
28
28
 
29
29
  ### OCRResult
30
30
 
31
- 识别结果字典,包含以下键:
31
+ 识别结果对象,包含以下字段:
32
32
 
33
33
  ```python
34
- from typing import TypedDict
34
+ from kuaijs._types import KuaiJSNamespace
35
35
 
36
- class OCRResult(TypedDict):
36
+ class OCRResult(KuaiJSNamespace):
37
37
  text: str # 识别的文本内容
38
38
  confidence: float # 识别置信度 (0-1)
39
39
  x: int # 文本区域左上角 x 坐标
@@ -7,9 +7,10 @@
7
7
  ### getBatteryInfo - 获取设备的电池信息。
8
8
 
9
9
  ```python
10
- from typing import TypedDict, Literal
10
+ from typing import Literal
11
+ from kuaijs._types import KuaiJSNamespace
11
12
 
12
- class BatteryInfo(TypedDict):
13
+ class BatteryInfo(KuaiJSNamespace):
13
14
  level: int # 电池电量(0-100)
14
15
  isCharging: bool # 是否正在充电
15
16
 
@@ -38,9 +39,10 @@ if info.level < 20:
38
39
  ### getStorageSpace - 获取设备存储空间信息。
39
40
 
40
41
  ```python
41
- from typing import TypedDict, Literal
42
+ from typing import Literal
43
+ from kuaijs._types import KuaiJSNamespace
42
44
 
43
- class StorageSpaceInfo(TypedDict):
45
+ class StorageSpaceInfo(KuaiJSNamespace):
44
46
  total: float # 总存储空间(GB,十进制)
45
47
  free: float # 剩余存储空间(GB,十进制)
46
48
  unit: Literal["GB"] # 单位,固定 GB
@@ -198,7 +200,9 @@ print(device.getDeviceModel())
198
200
  - 返回尺寸为设备分辨率除以缩放比例计算结果;仅返回竖屏分辨率
199
201
 
200
202
  ```python
201
- class ScreenSize(TypedDict):
203
+ from kuaijs._types import KuaiJSNamespace
204
+
205
+ class ScreenSize(KuaiJSNamespace):
202
206
  width: float # 屏幕宽度(像素)
203
207
  height: float # 屏幕高度(像素)
204
208
 
@@ -158,7 +158,7 @@ if g.getCpuAutoThrottle():
158
158
  设置 CPU 限流单次 sleep 延迟范围(毫秒)。默认 `min_ms=3`、`max_ms=30`。仅在 CPU 自动限流开启且触发限流时生效。
159
159
 
160
160
  ```python
161
- def setCpuThrottleDelay(min_ms: int, max_ms: int) -> dict
161
+ def setCpuThrottleDelay(min_ms: int, max_ms: int) -> CpuThrottleDelay
162
162
  ```
163
163
 
164
164
  **参数:**
@@ -170,9 +170,10 @@ def setCpuThrottleDelay(min_ms: int, max_ms: int) -> dict
170
170
 
171
171
  **返回值:**
172
172
 
173
- | 类型 | 描述 |
174
- | ------ | ------------------ |
175
- | `dict` | `{"minMs": int, "maxMs": int}`,实际生效的延迟范围 |
173
+ | 字段名 | 类型 | 描述 |
174
+ | ------- | ----- | -------------- |
175
+ | `minMs` | `int` | 实际最低延迟 |
176
+ | `maxMs` | `int` | 实际最高延迟 |
176
177
 
177
178
  **示例:**
178
179
 
@@ -188,14 +189,15 @@ print(f"CPU 限流延迟: {delay['minMs']}~{delay['maxMs']}ms")
188
189
  获取 CPU 限流延迟范围(毫秒)。
189
190
 
190
191
  ```python
191
- def getCpuThrottleDelay() -> dict
192
+ def getCpuThrottleDelay() -> CpuThrottleDelay
192
193
  ```
193
194
 
194
195
  **返回值:**
195
196
 
196
- | 类型 | 描述 |
197
- | ------ | ------------------ |
198
- | `dict` | `{"minMs": int, "maxMs": int}`,当前最低与最高延迟 |
197
+ | 字段名 | 类型 | 描述 |
198
+ | ------- | ----- | ------------ |
199
+ | `minMs` | `int` | 当前最低延迟 |
200
+ | `maxMs` | `int` | 当前最高延迟 |
199
201
 
200
202
  **示例:**
201
203
 
@@ -1109,15 +1109,22 @@ hid.takeMeToFront()
1109
1109
  获取当前打开应用的信息(仅 iOS 18.2+)。
1110
1110
 
1111
1111
  ```python
1112
- def currentAppInfo() -> Optional[dict]
1112
+ from typing import Optional
1113
+ from kuaijs._types import KuaiJSNamespace
1114
+
1115
+ class AppInfo(KuaiJSNamespace):
1116
+ name: str
1117
+ bundleId: str
1118
+
1119
+ def currentAppInfo() -> Optional[AppInfo]
1113
1120
  ```
1114
1121
 
1115
1122
  **返回值:**
1116
1123
  | 类型 | 描述 |
1117
1124
  | ---- | ---- |
1118
- | dict \| None | 当前应用信息或 None(如果不可用) |
1125
+ | AppInfo \| None | 当前应用信息或 None(如果不可用) |
1119
1126
 
1120
- **返回字典属性:**
1127
+ **返回属性:**
1121
1128
  | 属性 | 类型 | 描述 |
1122
1129
  | ---- | ---- | ---- |
1123
1130
  | `name` | str | 应用程序名称 |
@@ -13,9 +13,10 @@
13
13
  服务器响应数据结构。
14
14
 
15
15
  ```python
16
- from typing import TypedDict, Optional
16
+ from typing import Optional
17
+ from kuaijs._types import KuaiJSNamespace
17
18
 
18
- class HotUpdateResponse(TypedDict):
19
+ class HotUpdateResponse(KuaiJSNamespace):
19
20
  download_url: str # 新包的下载地址
20
21
  version: int # 新包的版本号
21
22
  download_timeout: int # 下载超时时间(秒)
@@ -30,9 +31,10 @@ class HotUpdateResponse(TypedDict):
30
31
  热更新检查结果。
31
32
 
32
33
  ```python
33
- from typing import TypedDict, Optional
34
+ from typing import Optional
35
+ from kuaijs._types import KuaiJSNamespace
34
36
 
35
- class HotUpdateResult(TypedDict):
37
+ class HotUpdateResult(KuaiJSNamespace):
36
38
  needUpdate: bool # 是否需要更新
37
39
  error: Optional[str] # 错误信息(当检查失败时)
38
40
  data: Optional[HotUpdateResponse] # 服务器返回的更新数据(当 needUpdate 为 True 时)
@@ -43,9 +45,10 @@ class HotUpdateResult(TypedDict):
43
45
  安装结果。
44
46
 
45
47
  ```python
46
- from typing import TypedDict, Optional
48
+ from typing import Optional
49
+ from kuaijs._types import KuaiJSNamespace
47
50
 
48
- class InstallResult(TypedDict):
51
+ class InstallResult(KuaiJSNamespace):
49
52
  updated: bool # 是否安装成功
50
53
  error: Optional[str] # 安装失败时的错误信息
51
54
  ```
@@ -182,9 +182,10 @@ if imageId:
182
182
  ### getSize - 获取图片尺寸。
183
183
 
184
184
  ```python
185
- from typing import TypedDict, Optional
185
+ from typing import Optional
186
+ from kuaijs._types import KuaiJSNamespace
186
187
 
187
- class Size(TypedDict):
188
+ class Size(KuaiJSNamespace):
188
189
  width: int
189
190
  height: int
190
191
 
@@ -45,12 +45,13 @@ class MySQLConfig(TypedDict):
45
45
 
46
46
  ### MySQLResult
47
47
 
48
- 查询结果字典。
48
+ 查询结果。
49
49
 
50
50
  ```python
51
- from typing import TypedDict, List, Dict, Any, Optional
51
+ from typing import Any, Dict, List, Optional
52
+ from kuaijs._types import KuaiJSNamespace
52
53
 
53
- class MySQLResult(TypedDict):
54
+ class MySQLResult(KuaiJSNamespace):
54
55
  rows: List[Dict[str, Any]] # 查询结果数据行
55
56
  affectedRows: int # 受影响的行数
56
57
  insertId: Optional[int] # 插入ID(仅适用于INSERT操作)
@@ -60,8 +61,8 @@ class MySQLResult(TypedDict):
60
61
 
61
62
  **参数说明:**
62
63
 
63
- | 参数名 | 类型 | 描述 |
64
- | -------------- | -------------------- | ------------------------------- |
64
+ | 参数名 | 类型 | 描述 |
65
+ | -------------- | ---------------- | ------------------------------- |
65
66
  | `rows` | List[Dict[str, Any]] | 查询结果数据行 |
66
67
  | `affectedRows` | int | 受影响的行数 |
67
68
  | `insertId` | int | 插入 ID(仅适用于 INSERT 操作) |
@@ -76,9 +76,10 @@ else:
76
76
  #### getCardInfo - 获取卡密信息
77
77
 
78
78
  ```python
79
- from typing import TypedDict, Optional
79
+ from typing import Optional
80
+ from kuaijs._types import KuaiJSNamespace
80
81
 
81
- class CardInfo(TypedDict):
82
+ class CardInfo(KuaiJSNamespace):
82
83
  cardNo: str
83
84
  batchCard: str
84
85
  remark: str
@@ -19,9 +19,9 @@ PaddleOCR 模块基于百度飞桨 PaddleOCR 技术,提供强大的光学字
19
19
  识别结果的数据结构,包含完整的文本信息和位置数据。
20
20
 
21
21
  ```python
22
- from typing import TypedDict, List
22
+ from kuaijs._types import KuaiJSNamespace
23
23
 
24
- class OCRResult(TypedDict):
24
+ class OCRResult(KuaiJSNamespace):
25
25
  text: str # 识别的文本内容
26
26
  confidence: float # 识别置信度 (0-1)
27
27
  x: int # 文本区域左上角 x 坐标
@@ -20,7 +20,9 @@
20
20
  前台应用信息结构。
21
21
 
22
22
  ```python
23
- class ActivateAppInfo(TypedDict):
23
+ from kuaijs._types import KuaiJSNamespace
24
+
25
+ class ActivateAppInfo(KuaiJSNamespace):
24
26
  bundleId: str
25
27
  name: str
26
28
  pid: int
@@ -31,7 +33,9 @@ class ActivateAppInfo(TypedDict):
31
33
  已安装应用信息结构。
32
34
 
33
35
  ```python
34
- class InstalledAppInfo(TypedDict):
36
+ from kuaijs._types import KuaiJSNamespace
37
+
38
+ class InstalledAppInfo(KuaiJSNamespace):
35
39
  bundleVersion: str
36
40
  appName: str
37
41
  bundleIdentifier: str
@@ -42,7 +46,9 @@ class InstalledAppInfo(TypedDict):
42
46
  内存信息结构。
43
47
 
44
48
  ```python
45
- class MemoryInfo(TypedDict):
49
+ from kuaijs._types import KuaiJSNamespace
50
+
51
+ class MemoryInfo(KuaiJSNamespace):
46
52
  used: int # 当前应用占用(MB)
47
53
  available: int # 系统可用内存(MB)
48
54
  total: int # 系统总内存(MB)
@@ -20,9 +20,9 @@ TomatoOCR 模块提供基于 TomatoOCR 框架的文字识别和 YOLO 目标检
20
20
  初始化结果结构。
21
21
 
22
22
  ```python
23
- from typing import TypedDict, Optional
23
+ from kuaijs._types import KuaiJSNamespace
24
24
 
25
- class TomatoInitResult(TypedDict):
25
+ class TomatoInitResult(KuaiJSNamespace):
26
26
  deviceId: str # 设备 ID
27
27
  expiryTime: str # 过期时间
28
28
  message: str # 消息
@@ -6,12 +6,12 @@ TTS(文本转语音)模块提供了语音合成、播放控制等功能,
6
6
 
7
7
  ### VoiceInfo - 语音信息结构
8
8
 
9
- 语音信息字典。
9
+ 语音信息对象。
10
10
 
11
11
  ```python
12
- from typing import TypedDict
12
+ from kuaijs._types import KuaiJSNamespace
13
13
 
14
- class VoiceInfo(TypedDict):
14
+ class VoiceInfo(KuaiJSNamespace):
15
15
  identifier: str # 语音的唯一标识符,用于设置特定语音
16
16
  name: str # 语音显示名称
17
17
  language: str # 语言代码(如 "zh-CN", "en-US")
@@ -27,12 +27,12 @@ YOLO 模块基于 YOLOV8/YOLO11/YOLO26 算法和 NCNN 框架,提供高性能
27
27
 
28
28
  ### YoloResult
29
29
 
30
- YOLO 检测结果字典,包含检测到的物体的完整信息。
30
+ YOLO 检测结果对象,包含检测到的物体的完整信息。
31
31
 
32
32
  ```python
33
- from typing import TypedDict
33
+ from kuaijs._types import KuaiJSNamespace
34
34
 
35
- class YoloResult(TypedDict):
35
+ class YoloResult(KuaiJSNamespace):
36
36
  x: int # 检测框的左上角x坐标
37
37
  y: int # 检测框的左上角y坐标
38
38
  ex: int # 检测框的右下角x坐标
@@ -20,12 +20,13 @@ YOLO 图像分类模块基于 YOLOv8-cls / YOLO11-cls / YOLO26-cls 分类模型
20
20
 
21
21
  ### YoloClsProbs
22
22
 
23
- YOLO 分类概率结果字典,字段命名与 Ultralytics `Probs` 保持一致。
23
+ YOLO 分类概率结果对象,字段命名与 Ultralytics `Probs` 保持一致。
24
24
 
25
25
  ```python
26
- from typing import List, Optional, TypedDict
26
+ from typing import List, Optional
27
+ from kuaijs._types import KuaiJSNamespace
27
28
 
28
- class YoloClsProbs(TypedDict):
29
+ class YoloClsProbs(KuaiJSNamespace):
29
30
  data: List[float] # 所有类别概率,下标即类别 ID
30
31
  top1: Optional[int] # 概率最高的类别 ID
31
32
  top5: List[int] # 概率最高的 5 个类别 ID
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ms-vite-plugin",
3
- "version": "1.4.21",
3
+ "version": "1.4.22",
4
4
  "type": "commonjs",
5
5
  "license": "MIT",
6
6
  "publishConfig": {