ms-vite-plugin 1.4.59 → 1.4.61

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 (83) hide show
  1. package/dist/luaBundle.js +1 -1
  2. package/dist/luaObfuscator/addVararg.d.ts +2 -0
  3. package/dist/luaObfuscator/addVararg.js +1 -0
  4. package/dist/luaObfuscator/antiTamper.d.ts +2 -0
  5. package/dist/luaObfuscator/antiTamper.js +26 -0
  6. package/dist/luaObfuscator/ast.d.ts +191 -0
  7. package/dist/luaObfuscator/ast.js +1 -0
  8. package/dist/luaObfuscator/cipher.d.ts +10 -0
  9. package/dist/luaObfuscator/cipher.js +28 -0
  10. package/dist/luaObfuscator/compiler.d.ts +31 -0
  11. package/dist/luaObfuscator/compiler.js +1 -0
  12. package/dist/luaObfuscator/constantArray.d.ts +5 -0
  13. package/dist/luaObfuscator/constantArray.js +1 -0
  14. package/dist/luaObfuscator/flatten.d.ts +2 -0
  15. package/dist/luaObfuscator/flatten.js +1 -0
  16. package/dist/luaObfuscator/index.d.ts +6 -0
  17. package/dist/luaObfuscator/index.js +1 -0
  18. package/dist/luaObfuscator/lexer.d.ts +14 -0
  19. package/dist/luaObfuscator/lexer.js +10 -0
  20. package/dist/luaObfuscator/minify.d.ts +3 -0
  21. package/dist/luaObfuscator/minify.js +1 -0
  22. package/dist/luaObfuscator/numbers.d.ts +2 -0
  23. package/dist/luaObfuscator/numbers.js +1 -0
  24. package/dist/luaObfuscator/opcodes.d.ts +3 -0
  25. package/dist/luaObfuscator/opcodes.js +1 -0
  26. package/dist/luaObfuscator/parser.d.ts +8 -0
  27. package/dist/luaObfuscator/parser.js +1 -0
  28. package/dist/luaObfuscator/rename.d.ts +3 -0
  29. package/dist/luaObfuscator/rename.js +1 -0
  30. package/dist/luaObfuscator/reserved.d.ts +5 -0
  31. package/dist/luaObfuscator/reserved.js +1 -0
  32. package/dist/luaObfuscator/scope.d.ts +11 -0
  33. package/dist/luaObfuscator/scope.js +1 -0
  34. package/dist/luaObfuscator/selftest.d.ts +1 -0
  35. package/dist/luaObfuscator/selftest.js +39 -0
  36. package/dist/luaObfuscator/splitStrings.d.ts +2 -0
  37. package/dist/luaObfuscator/splitStrings.js +1 -0
  38. package/dist/luaObfuscator/strings.d.ts +4 -0
  39. package/dist/luaObfuscator/strings.js +1 -0
  40. package/dist/luaObfuscator/visit.d.ts +5 -0
  41. package/dist/luaObfuscator/visit.js +1 -0
  42. package/dist/luaObfuscator/vmEmit.d.ts +2 -0
  43. package/dist/luaObfuscator/vmEmit.js +281 -0
  44. package/dist/luaObfuscator/wrapInFunction.d.ts +2 -0
  45. package/dist/luaObfuscator/wrapInFunction.js +1 -0
  46. package/docs/AGENTS.md +1 -1
  47. package/docs/SKILL.md +1 -1
  48. package/docs/api/hid.md +21 -0
  49. package/docs/apicn/hid.md +21 -0
  50. package/docs/apilua/action.md +2 -27
  51. package/docs/apilua/appleocr.md +2 -6
  52. package/docs/apilua/cloud.md +2 -6
  53. package/docs/apilua/config.md +2 -6
  54. package/docs/apilua/cryptoUtils.md +2 -7
  55. package/docs/apilua/device.md +2 -19
  56. package/docs/apilua/dotocr.md +2 -5
  57. package/docs/apilua/file.md +2 -17
  58. package/docs/apilua/global.md +1 -1
  59. package/docs/apilua/hid.md +25 -44
  60. package/docs/apilua/hotUpdate.md +2 -3
  61. package/docs/apilua/http.md +2 -7
  62. package/docs/apilua/image.md +2 -20
  63. package/docs/apilua/ime.md +2 -10
  64. package/docs/apilua/logger.md +3 -9
  65. package/docs/apilua/media.md +2 -9
  66. package/docs/apilua/mysql.md +2 -10
  67. package/docs/apilua/netCard.md +2 -6
  68. package/docs/apilua/node.md +2 -3
  69. package/docs/apilua/opencv.md +1 -27
  70. package/docs/apilua/paddleocr.md +2 -7
  71. package/docs/apilua/pip.md +2 -12
  72. package/docs/apilua/system.md +2 -23
  73. package/docs/apilua/tomatoocr.md +2 -16
  74. package/docs/apilua/tts.md +2 -9
  75. package/docs/apilua/ui.md +3 -9
  76. package/docs/apilua/utils.md +2 -9
  77. package/docs/apilua/yolo.md +2 -4
  78. package/docs/apilua/yolocls.md +2 -5
  79. package/docs/apipython/hid.md +22 -0
  80. package/docs/mcp-agent-description.md +1 -1
  81. package/docs/quick/vscode/createProject.md +1 -1
  82. package/docs/quick/vscode/packProject.md +1 -1
  83. package/package.json +1 -1
@@ -1,5 +1,7 @@
1
1
  # HID 模块
2
2
 
3
+ 模块表是内置全局 `hid`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  HID 模块提供基于 HID 设备的触控与按键能力,包括点击、滑动、系统导航、文本输入、组合键以及剪贴板与应用控制。
4
6
 
5
7
  ## 常量
@@ -51,7 +53,6 @@ HidKey = {}
51
53
  **示例:**
52
54
 
53
55
  ```lua
54
- local hid = require("hid")
55
56
  hid.sendKey({ HidKey.COMMAND, "c" })
56
57
  hid.sendKey({ HidKey.HOME })
57
58
  ```
@@ -68,7 +69,6 @@ function isBLEConnected() end
68
69
  **示例:**
69
70
 
70
71
  ```lua
71
- local hid = require("hid")
72
72
  print(hid.isBLEConnected())
73
73
  ```
74
74
 
@@ -82,7 +82,6 @@ function isUSBConnected() end
82
82
  **示例:**
83
83
 
84
84
  ```lua
85
- local hid = require("hid")
86
85
  print(hid.isUSBConnected())
87
86
  ```
88
87
 
@@ -96,7 +95,6 @@ function getBLEHIDDeviceName() end
96
95
  **示例:**
97
96
 
98
97
  ```lua
99
- local hid = require("hid")
100
98
  print(hid.getBLEHIDDeviceName())
101
99
  ```
102
100
 
@@ -116,7 +114,6 @@ function setBLEHIDDeviceName(name) end
116
114
  **示例:**
117
115
 
118
116
  ```lua
119
- local hid = require("hid")
120
117
  print(hid.setBLEHIDDeviceName("KuaiJS-HID"))
121
118
  ```
122
119
 
@@ -130,7 +127,6 @@ function getDeviceMac() end
130
127
  **示例:**
131
128
 
132
129
  ```lua
133
- local hid = require("hid")
134
130
  print(hid.getDeviceMac())
135
131
  ```
136
132
 
@@ -144,7 +140,6 @@ function getDeviceModel() end
144
140
  **示例:**
145
141
 
146
142
  ```lua
147
- local hid = require("hid")
148
143
  print(hid.getDeviceModel())
149
144
  ```
150
145
 
@@ -158,7 +153,6 @@ function getDeviceVersion() end
158
153
  **示例:**
159
154
 
160
155
  ```lua
161
- local hid = require("hid")
162
156
  print(hid.getDeviceVersion())
163
157
  ```
164
158
 
@@ -181,7 +175,6 @@ function resetPosition() end
181
175
  **示例:**
182
176
 
183
177
  ```lua
184
- local hid = require("hid")
185
178
  -- 复位坐标到左上角
186
179
  local ok = hid.resetPosition()
187
180
  print(ok) -- 输出: true 或 false
@@ -204,7 +197,6 @@ function restartDevice() end
204
197
  **示例:**
205
198
 
206
199
  ```lua
207
- local hid = require("hid")
208
200
  print(hid.restartDevice())
209
201
  ```
210
202
 
@@ -222,7 +214,6 @@ function openRecordScreen() end
222
214
  **示例:**
223
215
 
224
216
  ```lua
225
- local hid = require("hid")
226
217
  hid.openRecordScreen()
227
218
  ```
228
219
 
@@ -241,7 +232,6 @@ function isRecording() end
241
232
  **示例:**
242
233
 
243
234
  ```lua
244
- local hid = require("hid")
245
235
  print(hid.isRecording())
246
236
  ```
247
237
 
@@ -264,11 +254,33 @@ function setJitterValue(value) end
264
254
  **示例:**
265
255
 
266
256
  ```lua
267
- local hid = require("hid")
268
257
  -- 设置抖动值为5像素
269
258
  hid.setJitterValue(5)
270
259
  ```
271
260
 
261
+ ### setActionDelay - 设置动作延迟
262
+
263
+ 设置连续点击/滑动之间的等待毫秒。不调用时用固件默认(相对 200ms / 绝对 100ms)。
264
+
265
+ ```lua
266
+ ---@param milliseconds number
267
+ ---@return boolean
268
+ function setActionDelay(milliseconds) end
269
+ ```
270
+
271
+ **参数:**
272
+ | 参数 | 类型 | 必需 | 默认值 | 描述 |
273
+ | ---- | ---- | ---- | ------ | ---- |
274
+ | `milliseconds` | number | 是 | `-1` | `0` 关闭,`>0` 覆盖毫秒,`-1` 恢复默认 |
275
+
276
+ **示例:**
277
+
278
+ ```lua
279
+ hid.setActionDelay(0)
280
+ hid.click(100, 200)
281
+ hid.click(300, 400)
282
+ ```
283
+
272
284
  ## 基础触摸操作
273
285
 
274
286
  ### click - 点击操作
@@ -300,7 +312,6 @@ function click(x, y, duration, jitter) end
300
312
  **示例:**
301
313
 
302
314
  ```lua
303
- local hid = require("hid")
304
315
  -- 简单点击
305
316
  hid.click(100, 200)
306
317
  -- 带持续时间和抖动的点击
@@ -338,7 +349,6 @@ function clickRandom(x1, y1, x2, y2, duration) end
338
349
  **示例:**
339
350
 
340
351
  ```lua
341
- local hid = require("hid")
342
352
  -- 在区域内随机点击
343
353
  hid.clickRandom(100, 100, 200, 200, 20)
344
354
  ```
@@ -368,7 +378,6 @@ function move(x, y) end
368
378
  **示例:**
369
379
 
370
380
  ```lua
371
- local hid = require("hid")
372
381
  -- 移动到 (100, 200)
373
382
  hid.move(100, 200)
374
383
  ```
@@ -385,7 +394,6 @@ function mouseDown() end
385
394
  **示例:**
386
395
 
387
396
  ```lua
388
- local hid = require("hid")
389
397
  hid.mouseDown()
390
398
  ```
391
399
 
@@ -401,7 +409,6 @@ function mouseUp() end
401
409
  **示例:**
402
410
 
403
411
  ```lua
404
- local hid = require("hid")
405
412
  hid.mouseUp()
406
413
  ```
407
414
 
@@ -436,7 +443,6 @@ function doubleClick(x, y, duration, interval, jitter) end
436
443
  **示例:**
437
444
 
438
445
  ```lua
439
- local hid = require("hid")
440
446
  -- 带抖动的双击
441
447
  hid.doubleClick(100, 100, 20, 20, true)
442
448
  ```
@@ -474,7 +480,6 @@ function doubleClickRandom(x1, y1, x2, y2, duration, interval) end
474
480
  **示例:**
475
481
 
476
482
  ```lua
477
- local hid = require("hid")
478
483
  -- 在区域内随机双击
479
484
  hid.doubleClickRandom(100, 100, 200, 200, 20, 20)
480
485
  ```
@@ -514,7 +519,6 @@ function swipe(x, y, ex, ey, jitter, steps) end
514
519
  **示例:**
515
520
 
516
521
  ```lua
517
- local hid = require("hid")
518
522
  -- 简单滑动
519
523
  hid.swipe(100, 100, 200, 200)
520
524
  -- 带抖动和自定义步数的滑动
@@ -556,7 +560,6 @@ function swipe(x, y, ex, ey, duration, jitter, steps) end
556
560
  **示例:**
557
561
 
558
562
  ```lua
559
- local hid = require("hid")
560
563
  -- 长按 1 秒后滑动
561
564
  hid.pressAndSwipe(100, 100, 200, 200, 1000)
562
565
  -- 长按 1 秒后带抖动和自定义步数的滑动
@@ -596,7 +599,6 @@ function swipeCurve(startX, startY, midX, midY, endX, endY) end
596
599
  **示例:**
597
600
 
598
601
  ```lua
599
- local hid = require("hid")
600
602
  -- 通过三个点的曲线滑动
601
603
  hid.swipeCurve(100, 100, 150, 50, 200, 100)
602
604
  ```
@@ -620,7 +622,6 @@ function homeScreen() end
620
622
  **示例:**
621
623
 
622
624
  ```lua
623
- local hid = require("hid")
624
625
  -- 回到主屏幕
625
626
  hid.homeScreen()
626
627
  ```
@@ -645,7 +646,6 @@ function input(text) end
645
646
  **示例:**
646
647
 
647
648
  ```lua
648
- local hid = require("hid")
649
649
  hid.input("Hello World")
650
650
  hid.input("测试")
651
651
  ```
@@ -673,7 +673,6 @@ function inputSimple(text) end
673
673
  **示例:**
674
674
 
675
675
  ```lua
676
- local hid = require("hid")
677
676
  -- 输入英文与数字
678
677
  hid.inputSimple("hello_123")
679
678
  ```
@@ -697,7 +696,6 @@ function space() end
697
696
  **示例:**
698
697
 
699
698
  ```lua
700
- local hid = require("hid")
701
699
  hid.space()
702
700
  ```
703
701
 
@@ -725,7 +723,6 @@ function backspace(count) end
725
723
  **示例:**
726
724
 
727
725
  ```lua
728
- local hid = require("hid")
729
726
  hid.backspace()
730
727
  hid.backspace(3)
731
728
  ```
@@ -747,7 +744,6 @@ function enter() end
747
744
  **示例:**
748
745
 
749
746
  ```lua
750
- local hid = require("hid")
751
747
  hid.enter()
752
748
  ```
753
749
 
@@ -768,7 +764,6 @@ function pressButton(button) end
768
764
  **示例:**
769
765
 
770
766
  ```lua
771
- local hid = require("hid")
772
767
  hid.pressButton("home")
773
768
  hid.pressButton("volumeup")
774
769
  hid.pressButton("snapshot")
@@ -799,7 +794,6 @@ function sendKey(key) end
799
794
  **示例:**
800
795
 
801
796
  ```lua
802
- local hid = require("hid")
803
797
  -- 发送Cmd+C
804
798
  hid.sendKey({ HidKey.COMMAND, "c" })
805
799
  -- 发送Ctrl+Alt+Delete
@@ -823,7 +817,6 @@ function copyText() end
823
817
  **示例:**
824
818
 
825
819
  ```lua
826
- local hid = require("hid")
827
820
  hid.copyText()
828
821
  ```
829
822
 
@@ -844,7 +837,6 @@ function pasteText() end
844
837
  **示例:**
845
838
 
846
839
  ```lua
847
- local hid = require("hid")
848
840
  hid.pasteText()
849
841
  ```
850
842
 
@@ -867,7 +859,6 @@ function back() end
867
859
  **示例:**
868
860
 
869
861
  ```lua
870
- local hid = require("hid")
871
862
  hid.back()
872
863
  ```
873
864
 
@@ -888,7 +879,6 @@ function recent() end
888
879
  **示例:**
889
880
 
890
881
  ```lua
891
- local hid = require("hid")
892
882
  hid.recent()
893
883
  ```
894
884
 
@@ -909,7 +899,6 @@ function lock() end
909
899
  **示例:**
910
900
 
911
901
  ```lua
912
- local hid = require("hid")
913
902
  hid.lock()
914
903
  ```
915
904
 
@@ -930,7 +919,6 @@ function unlock() end
930
919
  **示例:**
931
920
 
932
921
  ```lua
933
- local hid = require("hid")
934
922
  hid.unlock()
935
923
  ```
936
924
 
@@ -959,7 +947,6 @@ function openURL(url) end
959
947
  **示例:**
960
948
 
961
949
  ```lua
962
- local hid = require("hid")
963
950
  -- 打开网站
964
951
  hid.openURL("https://www.example.com")
965
952
  -- 使用自定义scheme打开应用
@@ -989,7 +976,6 @@ function openApp(name) end
989
976
  **示例:**
990
977
 
991
978
  ```lua
992
- local hid = require("hid")
993
979
  -- 打开Safari
994
980
  hid.openApp("Safari")
995
981
  -- 打开设置
@@ -1016,7 +1002,6 @@ function closeApp(name) end
1016
1002
  **示例:**
1017
1003
 
1018
1004
  ```lua
1019
- local hid = require("hid")
1020
1005
  hid.closeApp("Safari")
1021
1006
  hid.closeApp("com.example.myapp")
1022
1007
  ```
@@ -1038,7 +1023,6 @@ function takeMeToFront() end
1038
1023
  **示例:**
1039
1024
 
1040
1025
  ```lua
1041
- local hid = require("hid")
1042
1026
  hid.takeMeToFront()
1043
1027
  ```
1044
1028
 
@@ -1065,7 +1049,6 @@ function currentAppInfo() end
1065
1049
  **示例:**
1066
1050
 
1067
1051
  ```lua
1068
- local hid = require("hid")
1069
1052
  local appInfo = hid.currentAppInfo()
1070
1053
  if appInfo then
1071
1054
  print("当前应用: " .. tostring(appInfo.name) .. " (" .. tostring(appInfo.bundleId) .. ")")
@@ -1097,7 +1080,6 @@ function setClipboard(text) end
1097
1080
  **示例:**
1098
1081
 
1099
1082
  ```lua
1100
- local hid = require("hid")
1101
1083
  hid.setClipboard("你好,世界!")
1102
1084
  ```
1103
1085
 
@@ -1118,7 +1100,6 @@ function getClipboard() end
1118
1100
  **示例:**
1119
1101
 
1120
1102
  ```lua
1121
- local hid = require("hid")
1122
1103
  local clipboardText = hid.getClipboard()
1123
1104
  if clipboardText then
1124
1105
  print("剪贴板内容:", clipboardText)
@@ -1,5 +1,7 @@
1
1
  # 热更新模块 (HotUpdate)
2
2
 
3
+ 模块表是内置全局 `hotupdate`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  热更新模块提供了完整的应用热更新功能,支持检查更新、下载更新包、MD5 校验、对话框展示等核心功能。
4
6
 
5
7
  ## 自动检查更新
@@ -78,7 +80,6 @@ function checkUpdate() end
78
80
  **示例:**
79
81
 
80
82
  ```lua
81
- local hotupdate = require("hotupdate")
82
83
  -- 检查更新
83
84
  local result = hotupdate.checkUpdate()
84
85
 
@@ -121,7 +122,6 @@ function downloadAndInstall() end
121
122
  **示例:**
122
123
 
123
124
  ```lua
124
- local hotupdate = require("hotupdate")
125
125
  -- 先检查更新,再手动下载安装
126
126
  local result = hotupdate.checkUpdate()
127
127
 
@@ -161,7 +161,6 @@ function getCurrentVersion() end
161
161
  **示例:**
162
162
 
163
163
  ```lua
164
- local hotupdate = require("hotupdate")
165
164
  local version = hotupdate.getCurrentVersion()
166
165
  print("当前版本:", version)
167
166
  ```
@@ -1,5 +1,7 @@
1
1
  # HTTP 模块 (HTTP)
2
2
 
3
+ 模块表是内置全局 `http`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  HTTP 模块提供了完整的网络请求功能,包括 HTTP 请求、文件下载、WebSocket 连接等。
4
6
 
5
7
  ## 通用 HTTP 请求
@@ -48,7 +50,6 @@ function request(params) end
48
50
  **示例:**
49
51
 
50
52
  ```lua
51
- local http = require("http")
52
53
  -- GET 请求
53
54
  local response = http.request({
54
55
  url = "https://api.example.com/users",
@@ -117,7 +118,6 @@ function httpGet(url, params, timeout, headers) end
117
118
  **示例:**
118
119
 
119
120
  ```lua
120
- local http = require("http")
121
121
  -- 简单 GET 请求
122
122
  local html = http.httpGet("https://www.example.com")
123
123
  print(html)
@@ -162,7 +162,6 @@ function httpPost(url, params, files, timeout, headers) end
162
162
  **示例:**
163
163
 
164
164
  ```lua
165
- local http = require("http")
166
165
  -- 发送表单数据
167
166
  local response = http.httpPost("https://api.example.com/submit", {
168
167
  username = "admin",
@@ -209,7 +208,6 @@ function postJSON(url, json, timeout, headers) end
209
208
  **示例:**
210
209
 
211
210
  ```lua
212
- local http = require("http")
213
211
  -- 发送 JSON 数据
214
212
  local response = http.postJSON(
215
213
  "https://api.example.com/api/users",
@@ -255,8 +253,6 @@ function downloadFile(url, file, timeout, headers) end
255
253
  **示例:**
256
254
 
257
255
  ```lua
258
- local http = require("http")
259
- local file = require("file")
260
256
  local documentsDir = file.getInternalDir("documents")
261
257
  -- 下载文件
262
258
  local success = http.downloadFile(
@@ -379,7 +375,6 @@ function stopHeartbeatInterval() end
379
375
  **WebSocket 完整示例:**
380
376
 
381
377
  ```lua
382
- local http = require("http")
383
378
 
384
379
  local function createWebSocketConnection()
385
380
  local ws = http.newWebsocket("wss://echo.websocket.org", {
@@ -1,5 +1,7 @@
1
1
  # 图片模块 (Image)
2
2
 
3
+ 模块表是内置全局 `image`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  图片模块提供了强大的图像处理功能,包括截图、图像识别、模板匹配、颜色查找、图像变换等。
4
6
 
5
7
  注意所有的 `imageId` 都需要在使用后释放,否则会导致内存泄漏。
@@ -45,8 +47,6 @@ function captureScreen(x, y, ex, ey) end
45
47
  **示例:**
46
48
 
47
49
  ```lua
48
- local image = require("image")
49
- local file = require("file")
50
50
  local dir = file.getInternalDir("documents")
51
51
 
52
52
  -- 全屏截图
@@ -87,7 +87,6 @@ function readImage(path) end
87
87
  **示例:**
88
88
 
89
89
  ```lua
90
- local image = require("image")
91
90
  local imageId = image.readImage("template.jpg")
92
91
  if imageId then
93
92
  print("图片读取成功")
@@ -123,7 +122,6 @@ function saveTo(imageId, filePath) end
123
122
  **示例:**
124
123
 
125
124
  ```lua
126
- local image = require("image")
127
125
  local imageId = image.captureScreen()
128
126
  -- 获取手机文档目录
129
127
  local dir = file.getInternalDir("documents")
@@ -177,7 +175,6 @@ function isRelease(imageId) end
177
175
  **示例:**
178
176
 
179
177
  ```lua
180
- local image = require("image")
181
178
  local imageId = image.captureScreen()
182
179
  if imageId then
183
180
  print("释放前: " .. tostring(image.isRelease(imageId))); -- false
@@ -211,7 +208,6 @@ function getSize(imageId) end
211
208
  **示例:**
212
209
 
213
210
  ```lua
214
- local image = require("image")
215
211
  local imageId = image.captureScreen()
216
212
  if imageId then
217
213
  local size = image.getSize(imageId)
@@ -249,7 +245,6 @@ function pixel(imageId, x, y) end
249
245
  **示例:**
250
246
 
251
247
  ```lua
252
- local image = require("image")
253
248
  local imageId = image.captureScreen()
254
249
  if imageId then
255
250
  local color = image.pixel(imageId, 100, 100)
@@ -318,7 +313,6 @@ function findColor(imageId, color, threshold, x, y, ex, ey, limit, orz) end
318
313
  **示例:**
319
314
 
320
315
  ```lua
321
- local image = require("image")
322
316
  local imageId = image.captureScreen()
323
317
  if imageId then
324
318
  -- 查找蓝色按钮
@@ -383,7 +377,6 @@ function findMultiColor(imageId, firstColor, threshold, points, x, y, ex, ey, li
383
377
  **示例:**
384
378
 
385
379
  ```lua
386
- local image = require("image")
387
380
  local imageId = image.captureScreen()
388
381
  if imageId then
389
382
  -- 查找特定的颜色组合(如按钮的特征颜色)
@@ -444,7 +437,6 @@ function countColor(imageId, colors, threshold, x, y, ex, ey) end
444
437
  **示例:**
445
438
 
446
439
  ```lua
447
- local image = require("image")
448
440
  local imageId = image.captureScreen()
449
441
  if imageId then
450
442
  local count = image.countColor(
@@ -489,7 +481,6 @@ function cmpColor(imageId, points, threshold) end
489
481
  **示例:**
490
482
 
491
483
  ```lua
492
- local image = require("image")
493
484
  local imageId = image.captureScreen()
494
485
  if imageId then
495
486
  -- 检查特定区域是否为预期颜色
@@ -732,7 +723,6 @@ local scaleFactors = buildScaleFactors(baseScale)
732
723
  **示例:**
733
724
 
734
725
  ```lua
735
- local image = require("image")
736
726
  -- 1) 同分辨率标准找图(最常用,模板就是本机截的)
737
727
  local matches = image.findImage(
738
728
  "screen",
@@ -845,7 +835,6 @@ function clip(imageId, x, y, ex, ey) end
845
835
  **示例:**
846
836
 
847
837
  ```lua
848
- local image = require("image")
849
838
  local imageId = image.captureScreen()
850
839
  -- 获取手机文档目录
851
840
  local dir = file.getInternalDir("documents")
@@ -888,7 +877,6 @@ function rotateImage(imageId, degree) end
888
877
  **示例:**
889
878
 
890
879
  ```lua
891
- local image = require("image")
892
880
  local imageId = image.readImage("photo.jpg")
893
881
  -- 获取手机文档目录
894
882
  local dir = file.getInternalDir("documents")
@@ -925,7 +913,6 @@ function gray(imageId) end
925
913
  **示例:**
926
914
 
927
915
  ```lua
928
- local image = require("image")
929
916
  local imageId = image.captureScreen()
930
917
  -- 获取手机文档目录
931
918
  local dir = file.getInternalDir("documents")
@@ -962,7 +949,6 @@ function binaryzation(imageId, threshold) end
962
949
  **示例:**
963
950
 
964
951
  ```lua
965
- local image = require("image")
966
952
  local imageId = image.captureScreen()
967
953
  -- 获取手机文档目录
968
954
  local dir = file.getInternalDir("documents")
@@ -1000,7 +986,6 @@ function drawRect(imageId, x, y, ex, ey, color, thickness) end
1000
986
  **示例:**
1001
987
 
1002
988
  ```lua
1003
- local image = require("image")
1004
989
  -- 获取手机文档目录
1005
990
  local dir = file.getInternalDir("documents")
1006
991
 
@@ -1035,7 +1020,6 @@ function scanCode(imageId) end
1035
1020
  **示例:**
1036
1021
 
1037
1022
  ```lua
1038
- local image = require("image")
1039
1023
  local imageId = image.captureScreen()
1040
1024
  if imageId then
1041
1025
  local result = image.scanCode(imageId)
@@ -1073,7 +1057,6 @@ function base64ToImage(base64) end
1073
1057
  **示例:**
1074
1058
 
1075
1059
  ```lua
1076
- local image = require("image")
1077
1060
  local base64Data =
1078
1061
  "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="
1079
1062
  local imageId = image.base64ToImage(base64Data)
@@ -1112,7 +1095,6 @@ function toBase64Format(imageId, format, q) end
1112
1095
  **示例:**
1113
1096
 
1114
1097
  ```lua
1115
- local image = require("image")
1116
1098
  local imageId = image.captureScreen()
1117
1099
  if imageId then
1118
1100
  local base64 = image.toBase64Format(imageId, "jpg", 90)
@@ -1,5 +1,7 @@
1
1
  # 输入法模块 (IME)
2
2
 
3
+ 模块表是内置全局 `ime`,直接调用即可。不要 `require` 宿主模块。
4
+
3
5
  输入法模块提供了文本输入、剪贴板操作、键盘控制等功能,支持模拟用户的文本输入行为。
4
6
 
5
7
  ## 前提条件
@@ -27,7 +29,6 @@ function isOk() end
27
29
  **示例:**
28
30
 
29
31
  ```lua
30
- local ime = require("ime")
31
32
  -- 检查输入法状态,只有键盘弹出后面的方法才能调用
32
33
  if ime.isOk() then
33
34
  print("输入法键盘已弹出")
@@ -55,7 +56,6 @@ function getText() end
55
56
  **示例:**
56
57
 
57
58
  ```lua
58
- local ime = require("ime")
59
59
  -- 获取当前输入框文本
60
60
  local currentText = ime.getText()
61
61
  print("当前文本: " .. tostring(currentText))
@@ -77,7 +77,6 @@ function clearText() end
77
77
  **示例:**
78
78
 
79
79
  ```lua
80
- local ime = require("ime")
81
80
  -- 清空输入框
82
81
  if ime.clearText() then
83
82
  print("文本清除成功")
@@ -111,7 +110,6 @@ function input(text) end
111
110
  **示例:**
112
111
 
113
112
  ```lua
114
- local ime = require("ime")
115
113
  -- 基础文本输入
116
114
  local textAfter = ime.input("Hello World")
117
115
  print("输入后文本: " .. tostring(textAfter))
@@ -143,7 +141,6 @@ function paste(content) end
143
141
  **示例:**
144
142
 
145
143
  ```lua
146
- local ime = require("ime")
147
144
  -- 基础粘贴操作(使用剪贴板内容)
148
145
  local pasted = ime.paste()
149
146
  print("粘贴后文本: " .. tostring(pasted))
@@ -170,7 +167,6 @@ function pressDel() end
170
167
  **示例:**
171
168
 
172
169
  ```lua
173
- local ime = require("ime")
174
170
  -- 删除一个字符
175
171
  local remaining = ime.pressDel()
176
172
  print("删除后剩余文本: " .. tostring(remaining))
@@ -192,7 +188,6 @@ function pressEnter() end
192
188
  **示例:**
193
189
 
194
190
  ```lua
195
- local ime = require("ime")
196
191
  -- 按下回车键
197
192
  if ime.pressEnter() then
198
193
  print("回车键按下成功")
@@ -217,7 +212,6 @@ function dismiss() end
217
212
  **示例:**
218
213
 
219
214
  ```lua
220
- local ime = require("ime")
221
215
  -- 隐藏键盘
222
216
  if ime.dismiss() then
223
217
  print("键盘隐藏成功")
@@ -244,7 +238,6 @@ function getClipboard() end
244
238
  **示例:**
245
239
 
246
240
  ```lua
247
- local ime = require("ime")
248
241
  -- 获取剪贴板内容
249
242
  local clipboardText = ime.getClipboard()
250
243
  print("剪贴板内容: " .. tostring(clipboardText))
@@ -273,7 +266,6 @@ function setClipboard(text) end
273
266
  **示例:**
274
267
 
275
268
  ```lua
276
- local ime = require("ime")
277
269
  -- 设置剪贴板内容
278
270
  if ime.setClipboard("要复制的文本") then
279
271
  print("剪贴板设置成功")