ms-vite-plugin 1.5.12 → 1.5.14

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 (61) hide show
  1. package/dist/build/luaBundle.js +2 -2
  2. package/dist/build/scriptProtect.js +2 -2
  3. package/docs/api/ai.md +16 -16
  4. package/docs/api/config.md +3 -3
  5. package/docs/api/dotocr.md +2 -2
  6. package/docs/api/file.md +18 -18
  7. package/docs/api/hid.md +2 -2
  8. package/docs/api/hotUpdate.md +2 -2
  9. package/docs/api/http.md +4 -4
  10. package/docs/api/image.md +15 -15
  11. package/docs/api/jbclear.md +12 -12
  12. package/docs/api/jbdevice.md +25 -25
  13. package/docs/api/jbdraw.md +139 -0
  14. package/docs/api/jbdylib.md +6 -6
  15. package/docs/api/jbpower.md +134 -0
  16. package/docs/api/jbshell.md +2 -2
  17. package/docs/api/jbsystem.md +6 -6
  18. package/docs/api/jbvpn.md +7 -7
  19. package/docs/api/mysql.md +4 -4
  20. package/docs/api/netCard.md +4 -73
  21. package/docs/api/node.md +5 -3
  22. package/docs/api/opencv.md +116 -116
  23. package/docs/api/plist.md +2 -2
  24. package/docs/api/sqlite.md +231 -0
  25. package/docs/api/system.md +1 -1
  26. package/docs/api/thread.md +2 -2
  27. package/docs/api/tomatoocr.md +2 -2
  28. package/docs/api/yolo.md +2 -2
  29. package/docs/api/yolocls.md +6 -6
  30. package/docs/api/zipFile.md +113 -0
  31. package/docs/apicn/ai.md +16 -16
  32. package/docs/apicn/config.md +2 -2
  33. package/docs/apicn/dotocr.md +2 -2
  34. package/docs/apicn/file.md +16 -16
  35. package/docs/apicn/hid.md +4 -4
  36. package/docs/apicn/hotUpdate.md +2 -2
  37. package/docs/apicn/http.md +4 -4
  38. package/docs/apicn/image.md +13 -13
  39. package/docs/apicn/mysql.md +4 -4
  40. package/docs/apicn/netCard.md +4 -73
  41. package/docs/apicn/node.md +5 -3
  42. package/docs/apicn/sqlite.md +197 -0
  43. package/docs/apicn/system.md +3 -3
  44. package/docs/apicn/thread.md +2 -2
  45. package/docs/apicn/yolo.md +2 -2
  46. package/docs/apicn/yolocls.md +6 -6
  47. package/docs/apicn/zipFile.md +113 -0
  48. package/docs/apilua/jbdraw.md +141 -0
  49. package/docs/apilua/jbpower.md +136 -0
  50. package/docs/apilua/netCard.md +3 -77
  51. package/docs/apilua/node.md +3 -1
  52. package/docs/apilua/sqlite.md +204 -0
  53. package/docs/apilua/zipFile.md +123 -0
  54. package/docs/apipython/jbdraw.md +147 -0
  55. package/docs/apipython/jbpower.md +133 -0
  56. package/docs/apipython/netCard.md +3 -74
  57. package/docs/apipython/node.md +3 -1
  58. package/docs/apipython/overview.md +1 -1
  59. package/docs/apipython/sqlite.md +181 -0
  60. package/docs/apipython/zipFile.md +117 -0
  61. package/package.json +1 -1
@@ -118,7 +118,7 @@ function 获取当前运行的应用(): {
118
118
  bundleId: 字符串;
119
119
  name: 字符串;
120
120
  pid: 数字;
121
- } | null;
121
+ } | undefined;
122
122
  ```
123
123
 
124
124
  **返回值:**
@@ -334,14 +334,14 @@ if (set) {
334
334
  #### 获取剪切板内容 - 获取系统剪贴板内容。
335
335
 
336
336
  ```typescript
337
- function 获取剪切板内容(): 字符串 | null;
337
+ function 获取剪切板内容(): 字符串;
338
338
  ```
339
339
 
340
340
  **返回值:**
341
341
 
342
342
  | 类型 | 描述 |
343
343
  | -------------- | ----------------------------------------- |
344
- | `字符串\|null` | 剪贴板文本内容 `null`剪贴板为空或获取失败 |
344
+ | `字符串 \| undefined` | 剪贴板文本内容 `null`剪贴板为空或获取失败 |
345
345
 
346
346
  **示例:**
347
347
 
@@ -25,7 +25,7 @@
25
25
  启动一个新的线程来执行指定的 JS 文件。
26
26
 
27
27
  ```typescript
28
- function 运行(线程js文件名: 字符串, 启动参数?: 字典<任意类型>): 线程;
28
+ function 运行(线程js文件名: 字符串, 启动参数?: 字典<任意类型>): 线程 | undefined;
29
29
  ```
30
30
 
31
31
  **参数:**
@@ -39,7 +39,7 @@ function 运行(线程js文件名: 字符串, 启动参数?: 字典<任意类型
39
39
 
40
40
  | 类型 | 描述 |
41
41
  | ------ | ------------ |
42
- | `线程` | 线程控制对象 |
42
+ | `线程 \| undefined` | 线程控制对象;启动参数不是 Object 或启动失败时返回 undefined |
43
43
 
44
44
  **示例:**
45
45
 
@@ -70,7 +70,7 @@ function 加载模型(
70
70
  标签数量?: 数字,
71
71
  模型版本?: 数字,
72
72
  useGpu?: 布尔值
73
- ): 字符串 | null;
73
+ ): 字符串 | undefined;
74
74
  ```
75
75
 
76
76
  **参数:**
@@ -87,7 +87,7 @@ function 加载模型(
87
87
 
88
88
  | 类型 | 描述 |
89
89
  | ---------------- | ----------------------------------------- |
90
- | `字符串 \| null` | 加载成功返回模型 ID 字符串,失败返回 null |
90
+ | `字符串 \| undefined` | 加载成功返回模型 ID 字符串,失败返回 undefined |
91
91
 
92
92
  **示例:**
93
93
 
@@ -25,9 +25,9 @@ YOLO 分类概率结果,字段命名与 Ultralytics `Probs` 保持一致。
25
25
  ```typescript
26
26
  interface Yolo分类概率结果 {
27
27
  data: 数组<数字>; // 所有类别概率,下标即类别 ID
28
- top1: 数字 | null; // 概率最高的类别 ID
28
+ top1: 数字 | null; // 概率最高的类别 ID;分类失败时为 null
29
29
  top5: 数组<数字>; // 概率最高的 5 个类别 ID
30
- top1conf: 数字 | null; // top1 对应的概率
30
+ top1conf: 数字 | null; // top1 对应的概率;分类失败时为 null
31
31
  top5conf: 数组<数字>; // top5 对应的概率
32
32
  }
33
33
  ```
@@ -37,9 +37,9 @@ interface Yolo分类概率结果 {
37
37
  | 字段名 | 类型 | 描述 |
38
38
  | ---------- | ---------------- | ---------------------------------------------------------- |
39
39
  | `data` | `数组<数字>` | 所有类别概率数组,下标即类别 ID |
40
- | `top1` | `数字 \| null` | 概率最高的类别 ID;分类失败时为 `null` |
40
+ | `top1` | `数字 \| null` | 概率最高的类别 ID;分类失败时为 `null` |
41
41
  | `top5` | `数组<数字>` | 概率最高的 5 个类别 ID,按概率从高到低排序 |
42
- | `top1conf` | `数字 \| null` | `top1` 对应的概率;分类失败时为 `null` |
42
+ | `top1conf` | `数字 \| null` | `top1` 对应的概率;分类失败时为 `null` |
43
43
  | `top5conf` | `数组<数字>` | `top5` 对应的概率,顺序与 `top5` 一致 |
44
44
 
45
45
  **结果说明:**
@@ -62,7 +62,7 @@ function 加载模型(
62
62
  ncnn模型的bin文件路径: 字符串,
63
63
  类别数量?: 数字,
64
64
  useGpu?: 布尔值
65
- ): 字符串 | null;
65
+ ): 字符串 | undefined;
66
66
  ```
67
67
 
68
68
  **参数:**
@@ -78,7 +78,7 @@ function 加载模型(
78
78
 
79
79
  | 类型 | 描述 |
80
80
  | ---------------- | ----------------------------------------- |
81
- | `字符串 \| null` | 加载成功返回模型 ID 字符串,失败返回 null |
81
+ | `字符串 \| undefined` | 加载成功返回模型 ID 字符串,失败返回 undefined |
82
82
 
83
83
  **示例:**
84
84
 
@@ -0,0 +1,113 @@
1
+ # ZIP 模块 ($ZIP)
2
+
3
+ 路径必须是绝对路径。只压缩、解压 ZIP;`压缩` 只接受目录,不接受文件。
4
+
5
+ ## API 参考
6
+
7
+ ### 获取文件列表 - 获取 ZIP 内部文件列表。
8
+
9
+ ```typescript
10
+ function 获取文件列表(路径: 字符串): 数组<字符串>;
11
+ ```
12
+
13
+ **参数:**
14
+
15
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
16
+ | ------ | -------- | -------- | ------ | ---------------- |
17
+ | `路径` | `字符串` | 是 | - | ZIP 文件绝对路径 |
18
+
19
+ **返回值:**
20
+
21
+ | 类型 | 描述 |
22
+ | -------------- | ------------------------------------------------------------ |
23
+ | `数组<字符串>` | 包内文件路径;不含目录项。不是合法 ZIP 时返回空数组 |
24
+
25
+ **示例:**
26
+
27
+ ```javascript
28
+ const 路径 = $文件.获取内部目录("documents") + "/a.zip";
29
+ const 列表 = $ZIP.获取文件列表(路径);
30
+ ```
31
+
32
+ ### 是否为ZIP - 检查是否为合法 ZIP。
33
+
34
+ ```typescript
35
+ function 是否为ZIP(路径: 字符串): 布尔值;
36
+ ```
37
+
38
+ **参数:**
39
+
40
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
41
+ | ------ | -------- | -------- | ------ | ------------ |
42
+ | `路径` | `字符串` | 是 | - | 文件绝对路径 |
43
+
44
+ **返回值:**
45
+
46
+ | 类型 | 描述 |
47
+ | -------- | ------------------------- |
48
+ | `布尔值` | 能作为 ZIP 打开为 `true` |
49
+
50
+ **示例:**
51
+
52
+ ```javascript
53
+ const 路径 = $文件.获取内部目录("documents") + "/a.zip";
54
+ if ($ZIP.是否为ZIP(路径)) {
55
+ $打印信息日志("是 ZIP");
56
+ }
57
+ ```
58
+
59
+ ### 解压 - 解压到指定目录。
60
+
61
+ 目标目录不存在会创建。包内路径必须落在目标目录内,否则失败。
62
+
63
+ ```typescript
64
+ function 解压(压缩包路径: 字符串, 目标目录: 字符串): 布尔值;
65
+ ```
66
+
67
+ **参数:**
68
+
69
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
70
+ | ------------ | -------- | -------- | ------ | -------------------- |
71
+ | `压缩包路径` | `字符串` | 是 | - | ZIP 文件绝对路径 |
72
+ | `目标目录` | `字符串` | 是 | - | 解压目标目录绝对路径 |
73
+
74
+ **返回值:**
75
+
76
+ | 类型 | 描述 |
77
+ | -------- | ----------------- |
78
+ | `布尔值` | 解压成功为 `true` |
79
+
80
+ **示例:**
81
+
82
+ ```javascript
83
+ const 目录 = $文件.获取内部目录("documents");
84
+ $ZIP.解压(目录 + "/a.zip", 目录 + "/out");
85
+ ```
86
+
87
+ ### 压缩 - 压缩目录为 ZIP。
88
+
89
+ 包内根条目是该目录名。已有同名 ZIP 文件会先删再写。源路径必须是目录,不能是文件。输出 ZIP 不能落在源目录内。
90
+
91
+ ```typescript
92
+ function 压缩(目录路径: 字符串, 压缩包路径: 字符串): 布尔值;
93
+ ```
94
+
95
+ **参数:**
96
+
97
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
98
+ | ------------ | -------- | -------- | ------ | ----------------------------------- |
99
+ | `目录路径` | `字符串` | 是 | - | 要压缩的目录绝对路径 |
100
+ | `压缩包路径` | `字符串` | 是 | - | 输出 ZIP 绝对路径,不能落在源目录内 |
101
+
102
+ **返回值:**
103
+
104
+ | 类型 | 描述 |
105
+ | -------- | ----------------- |
106
+ | `布尔值` | 压缩成功为 `true` |
107
+
108
+ **示例:**
109
+
110
+ ```javascript
111
+ const 目录 = $文件.获取内部目录("documents");
112
+ $ZIP.压缩(目录 + "/out", 目录 + "/out.zip");
113
+ ```
@@ -0,0 +1,141 @@
1
+ # 绘制模块 (JBDraw)
2
+
3
+ 模块表是内置全局 `jbdraw`,直接调用即可。不要 `require` 宿主模块。
4
+
5
+ 仅越狱包可用。免越狱包没有 `jbdraw`。
6
+
7
+ 在屏幕上画矩形和文字。每画一次返回一个 id,可用 `clear` 去掉这一条,或 `clearAll` 全部去掉。坐标为像素坐标。
8
+
9
+ 颜色只接受 `#RRGGBB` 和 `#RRGGBBAA`。需要字加底时先画填充矩形,再画文字。
10
+
11
+ ## 类型
12
+
13
+ ```lua
14
+ ---@class JbDrawRectOptions
15
+ ---@field color string|nil
16
+ ---@field lineWidth number|nil
17
+ ---@field fill string|nil
18
+
19
+ ---@class JbDrawTextOptions
20
+ ---@field color string|nil
21
+ ---@field fontSize number|nil
22
+ ```
23
+
24
+ | 字段 | 类型 | 描述 |
25
+ | ----------- | ------------- | ------------------------------------------------------------ |
26
+ | `color` | string\|nil | `#RRGGBB` 或 `#RRGGBBAA`。矩形默认 `#FF0000`,文字默认 `#FFFFFF` |
27
+ | `lineWidth` | number\|nil | 边框宽度。省略为 `2`。`<= 0` 不画边框 |
28
+ | `fill` | string\|nil | 填充颜色,同 `color` 格式。省略不填充 |
29
+ | `fontSize` | number\|nil | 系统字号。省略为 `16`。`<= 0` 时画字失败 |
30
+
31
+ ## API 参考
32
+
33
+ ### rect - 在屏幕上画矩形。
34
+
35
+ 需要字加底时先画填充矩形,再 `text`。
36
+
37
+ ```lua
38
+ ---@param x number
39
+ ---@param y number
40
+ ---@param width number
41
+ ---@param height number
42
+ ---@param options JbDrawRectOptions|nil
43
+ ---@return integer
44
+ function rect(x, y, width, height, options) end
45
+ ```
46
+
47
+ **参数:**
48
+
49
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
50
+ | --------- | ----------------------- | -------- | ------ | ---------------------------------- |
51
+ | `x` | number | 是 | - | 左上角 x,像素坐标 |
52
+ | `y` | number | 是 | - | 左上角 y,像素坐标 |
53
+ | `width` | number | 是 | - | 宽度,必须大于 0 |
54
+ | `height` | number | 是 | - | 高度,必须大于 0 |
55
+ | `options` | JbDrawRectOptions\|nil | 否 | - | 颜色、边框、填充 |
56
+
57
+ **返回值:**
58
+
59
+ | 类型 | 描述 |
60
+ | ------- | ------------------------------ |
61
+ | integer | 成功为 id(从 1 起);失败为 `0` |
62
+
63
+ **示例:**
64
+
65
+ ```lua
66
+ local box = jbdraw.rect(20, 80, 200, 40, { fill = "#000000AA", lineWidth = 0 })
67
+ local frame = jbdraw.rect(20, 140, 120, 80, { color = "#FF0000", lineWidth = 2 })
68
+ ```
69
+
70
+ ### text - 在屏幕上画文字。
71
+
72
+ 左上角对齐,没有背景。
73
+
74
+ ```lua
75
+ ---@param x number
76
+ ---@param y number
77
+ ---@param text string
78
+ ---@param options JbDrawTextOptions|nil
79
+ ---@return integer
80
+ function text(x, y, text, options) end
81
+ ```
82
+
83
+ **参数:**
84
+
85
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
86
+ | --------- | ----------------------- | -------- | ------ | ---------------------------------- |
87
+ | `x` | number | 是 | - | 文字左上角 x,像素坐标 |
88
+ | `y` | number | 是 | - | 文字左上角 y,像素坐标 |
89
+ | `text` | string | 是 | - | 要画的字符串 |
90
+ | `options` | JbDrawTextOptions\|nil | 否 | - | 颜色和字号 |
91
+
92
+ **返回值:**
93
+
94
+ | 类型 | 描述 |
95
+ | ------- | ------------------------------ |
96
+ | integer | 成功为 id(从 1 起);失败为 `0` |
97
+
98
+ **示例:**
99
+
100
+ ```lua
101
+ local box = jbdraw.rect(20, 80, 200, 40, { fill = "#000000AA", lineWidth = 0 })
102
+ local label = jbdraw.text(28, 88, "hello", { color = "#FFFFFF", fontSize = 18 })
103
+ ```
104
+
105
+ ### clear - 去掉一个图形。
106
+
107
+ ```lua
108
+ ---@param id integer
109
+ ---@return boolean
110
+ function clear(id) end
111
+ ```
112
+
113
+ **参数:**
114
+
115
+ | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
116
+ | ------ | ------- | -------- | ------ | ------------------------ |
117
+ | `id` | integer | 是 | - | `rect` / `text` 返回的 id |
118
+
119
+ **返回值:**
120
+
121
+ | 类型 | 描述 |
122
+ | ------- | ------------------- |
123
+ | boolean | 找到并移除为 `true` |
124
+
125
+ **示例:**
126
+
127
+ ```lua
128
+ jbdraw.clear(label)
129
+ ```
130
+
131
+ ### clearAll - 去掉当前全部图形。
132
+
133
+ ```lua
134
+ function clearAll() end
135
+ ```
136
+
137
+ **示例:**
138
+
139
+ ```lua
140
+ jbdraw.clearAll()
141
+ ```
@@ -0,0 +1,136 @@
1
+ # 电源模块 (JBPower)
2
+
3
+ 模块表是内置全局 `jbpower`,直接调用即可。不要 `require` 宿主模块。
4
+
5
+ 仅越狱包可用。免越狱包没有 `jbpower`。
6
+
7
+ `info` 读取电量百分比、电流、电压和充电状态。`stopCharging` 停止充电并保持,直到调用 `startCharging`。`setSmartCharging` 到上限停止充电,降到下限再充,中间保持。
8
+
9
+ 电流单位是毫安,正数表示正在进电。电压单位是毫伏。
10
+
11
+ ## API 参考
12
+
13
+ ### info - 读取当前电源信息。
14
+
15
+ ```lua
16
+ function info()
17
+ ```
18
+
19
+ **返回值:**
20
+
21
+ | 类型 | 描述 |
22
+ | ------------- | -------------------- |
23
+ | `JbPowerInfo` | 读到电池时的电源信息 |
24
+ | `nil` | 读不到电池 |
25
+
26
+ `JbPowerInfo` 字段:
27
+
28
+ | 字段 | 类型 | 描述 |
29
+ | -------------------- | --------- | ------------------------------------------------- |
30
+ | `percentage` | `integer` | 电量百分比 |
31
+ | `amperage` | `integer` | 电流,单位毫安,正数表示正在进电 |
32
+ | `voltage` | `integer` | 电压,单位毫伏 |
33
+ | `charging` | `boolean` | 系统是否认为正在充电 |
34
+ | `plugged` | `boolean` | 电源状态是否为交流电 |
35
+ | `powerState` | `string` | `AC Power` 或 `Battery Power` |
36
+ | `rawExternal` | `boolean` | 发布出去的外接位 |
37
+ | `showChargingUI` | `boolean` | 主屏是否显示充电 |
38
+ | `appleRawExternal` | `boolean` | 硬件是否还认这根线 |
39
+ | `chargeOverride` | `boolean` | 系统自己的停充覆盖 |
40
+ | `adapterWatts` | `integer` | 适配器功率,单位瓦,读不到时为 0 |
41
+
42
+ **示例:**
43
+
44
+ ```lua
45
+ local power = jbpower.info()
46
+ if power then
47
+ logd(power.percentage, power.amperage)
48
+ end
49
+ ```
50
+
51
+ ### stopCharging - 停止充电。
52
+
53
+ 停止后会保持,直到 `startCharging`。
54
+
55
+ ```lua
56
+ function stopCharging()
57
+ ```
58
+
59
+ **返回值:**
60
+
61
+ | 类型 | 描述 |
62
+ | --------- | --------------- |
63
+ | `boolean` | 写入成功为 `true` |
64
+
65
+ **示例:**
66
+
67
+ ```lua
68
+ jbpower.stopCharging()
69
+ ```
70
+
71
+ ### startCharging - 恢复充电。
72
+
73
+ ```lua
74
+ function startCharging()
75
+ ```
76
+
77
+ **返回值:**
78
+
79
+ | 类型 | 描述 |
80
+ | --------- | --------------- |
81
+ | `boolean` | 写入成功为 `true` |
82
+
83
+ **示例:**
84
+
85
+ ```lua
86
+ jbpower.startCharging()
87
+ ```
88
+
89
+ ### setSmartCharging - 打开智能充电。
90
+
91
+ 电量到 `max` 停止充电,降到 `min` 再充。窗口中间保持上次的决定,不会在停充和充电之间来回切。
92
+
93
+ 上限会收到 2 到 100,下限至少为 1,并且必须小于上限。
94
+
95
+ ```lua
96
+ function setSmartCharging(min, max)
97
+ ```
98
+
99
+ **参数:**
100
+
101
+ | 参数 | 类型 | 描述 |
102
+ | ----- | --------- | ---------------- |
103
+ | `min` | `integer` | 再充下限,百分比 |
104
+ | `max` | `integer` | 停充上限,百分比 |
105
+
106
+ **返回值:**
107
+
108
+ | 类型 | 描述 |
109
+ | --------- | --------------- |
110
+ | `boolean` | 保存成功为 `true` |
111
+
112
+ **示例:**
113
+
114
+ ```lua
115
+ jbpower.setSmartCharging(20, 80)
116
+ ```
117
+
118
+ ### clearSmartCharging - 关掉智能充电。
119
+
120
+ 如果当前正按窗口停充,会恢复充电。
121
+
122
+ ```lua
123
+ function clearSmartCharging()
124
+ ```
125
+
126
+ **返回值:**
127
+
128
+ | 类型 | 描述 |
129
+ | --------- | --------------- |
130
+ | `boolean` | 保存成功为 `true` |
131
+
132
+ **示例:**
133
+
134
+ ```lua
135
+ jbpower.clearSmartCharging()
136
+ ```
@@ -2,18 +2,17 @@
2
2
 
3
3
  模块表是内置全局 `netcard`,直接调用即可。不要 `require` 宿主模块。
4
4
 
5
- 卡密模块提供了卡密验证、备注设置以及键值对存储功能,用于管理网络卡密相关的操作。
5
+ 卡密模块提供了卡密验证和备注设置功能,用于管理网络卡密相关的操作。
6
6
 
7
7
  ## 功能概览
8
8
 
9
9
  - **卡密验证**: 验证卡密的有效性
10
10
  - **备注管理**: 设置和管理卡密备注信息
11
- - **云变量存储**: 提供键值对形式的数据存储和读取功能
12
11
 
13
12
  ## 注意事项
14
13
 
15
14
  1. **卡密安全**: 卡密信息应当妥善保管,避免在日志中明文输出
16
- 2. **普通卡密模式**: 需要先调用 `netCard.verify(cardNo)` 验证卡密,验证通过后才能调用获取卡密信息、备注和云变量等接口
15
+ 2. **普通卡密模式**: 需要先调用 `netCard.verify(cardNo)` 验证卡密,验证通过后才能调用获取卡密信息和备注等接口
17
16
  3. **授权卡密模式**: App 打开加密 UI 或运行脚本前会完成授权和卡密验证,脚本中不需要重复让用户输入卡密,也不需要重复调用 `netCard.verify`
18
17
  4. **兼容旧脚本**: 授权卡密模式下调用 `netCard.verify` 会直接返回 `true`,用于兼容原来已经写了 `verify` 的脚本
19
18
 
@@ -58,7 +57,7 @@ function verify(cardNo) end
58
57
 
59
58
  **说明:**
60
59
 
61
- 普通卡密模式下,该方法会请求普通卡密验证接口,验证成功后才能继续使用卡密信息、备注和云变量相关能力。
60
+ 普通卡密模式下,该方法会请求普通卡密验证接口,验证成功后才能继续使用卡密信息和备注相关能力。
62
61
 
63
62
  授权卡密模式下,App 层已经完成授权和卡密验证,脚本侧不需要重复调用该方法;如果旧脚本仍然调用,方法会直接返回 `true`。
64
63
 
@@ -145,76 +144,3 @@ else
145
144
  logger.error("备注设置失败")
146
145
  end
147
146
  ```
148
-
149
- ### 云变量
150
-
151
- #### setValue - 设置键值对
152
-
153
- ```lua
154
- ---@param key string
155
- ---@param value string
156
- ---@return string
157
- function setValue(key, value) end
158
- ```
159
-
160
- **参数说明:**
161
-
162
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
163
- | ------- | ------ | -------- | ------ | ---------- |
164
- | `key` | string | 是 | | 存储的键名 |
165
- | `value` | string | 是 | | 存储的值 |
166
-
167
- **返回值:**
168
-
169
- | 类型 | 描述 |
170
- | -------- | --------------------------------------------- |
171
- | `string` | 成功时返回设置的 value 值,失败时返回空字符串 |
172
-
173
- **示例:**
174
-
175
- ```lua
176
- -- 设置键值对
177
- local key = "userConfig"
178
- local value = "enableNotification"
179
- local result = netcard.setValue(key, value)
180
-
181
- if result == value then
182
- print("成功设置 [" .. tostring(key) .. "] = " .. tostring(value))
183
- else
184
- logger.error("设置失败")
185
- end
186
- ```
187
-
188
- #### getValue - 获取键值对
189
-
190
- ```lua
191
- ---@param key string
192
- ---@return string
193
- function getValue(key) end
194
- ```
195
-
196
- **参数说明:**
197
-
198
- | 参数名 | 类型 | 是否必填 | 默认值 | 描述 |
199
- | ------ | ------ | -------- | ------ | ------------ |
200
- | `key` | string | 是 | | 要获取的键名 |
201
-
202
- **返回值:**
203
-
204
- | 类型 | 描述 |
205
- | -------- | ------------------------------------------------ |
206
- | `string` | 成功时返回对应的值,失败或键不存在时返回空字符串 |
207
-
208
- **示例:**
209
-
210
- ```lua
211
- -- 获取键值对
212
- local key = "userConfig"
213
- local value = netcard.getValue(key)
214
-
215
- if value then
216
- print("获取到配置: " .. tostring(key) .. " = " .. tostring(value))
217
- else
218
- print("配置 " .. tostring(key) .. " 不存在或获取失败")
219
- end
220
- ```
@@ -155,9 +155,11 @@ selector:releaseNode() -- 手动释放
155
155
  | `depth` | 层级 |
156
156
  | `childCount` | 子节点数,支持数字或如 `">0"` |
157
157
  | `bounds(x, y, width, height)` | 区域 |
158
- | `xpath` | XPath |
158
+ | `xpath` | XPath 1.0 路径 |
159
159
  | `id` | 按节点 ID |
160
160
 
161
+ `xpath` 只支持 [XPath 1.0](https://www.w3.org/TR/1999/REC-xpath-19991116/)。`matches()` 等 XPath 2.0 函数不可用;属性上的正则用 `identifierMatch` 等带 `Match` 的方法。
162
+
161
163
  ```lua
162
164
  -- 精确
163
165
  selector:label("确定"):type("XCUIElementTypeButton"):getOneNodeInfo(3000)