ms-vite-plugin 1.4.59 → 1.4.60

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 (80) 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/apilua/action.md +2 -27
  49. package/docs/apilua/appleocr.md +2 -6
  50. package/docs/apilua/cloud.md +2 -6
  51. package/docs/apilua/config.md +2 -6
  52. package/docs/apilua/cryptoUtils.md +2 -7
  53. package/docs/apilua/device.md +2 -19
  54. package/docs/apilua/dotocr.md +2 -5
  55. package/docs/apilua/file.md +2 -17
  56. package/docs/apilua/global.md +1 -1
  57. package/docs/apilua/hid.md +2 -44
  58. package/docs/apilua/hotUpdate.md +2 -3
  59. package/docs/apilua/http.md +2 -7
  60. package/docs/apilua/image.md +2 -20
  61. package/docs/apilua/ime.md +2 -10
  62. package/docs/apilua/logger.md +3 -9
  63. package/docs/apilua/media.md +2 -9
  64. package/docs/apilua/mysql.md +2 -10
  65. package/docs/apilua/netCard.md +2 -6
  66. package/docs/apilua/node.md +2 -3
  67. package/docs/apilua/opencv.md +1 -27
  68. package/docs/apilua/paddleocr.md +2 -7
  69. package/docs/apilua/pip.md +2 -12
  70. package/docs/apilua/system.md +2 -23
  71. package/docs/apilua/tomatoocr.md +2 -16
  72. package/docs/apilua/tts.md +2 -9
  73. package/docs/apilua/ui.md +3 -9
  74. package/docs/apilua/utils.md +2 -9
  75. package/docs/apilua/yolo.md +2 -4
  76. package/docs/apilua/yolocls.md +2 -5
  77. package/docs/mcp-agent-description.md +1 -1
  78. package/docs/quick/vscode/createProject.md +1 -1
  79. package/docs/quick/vscode/packProject.md +1 -1
  80. 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,7 +254,6 @@ 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
  ```
@@ -300,7 +289,6 @@ function click(x, y, duration, jitter) end
300
289
  **示例:**
301
290
 
302
291
  ```lua
303
- local hid = require("hid")
304
292
  -- 简单点击
305
293
  hid.click(100, 200)
306
294
  -- 带持续时间和抖动的点击
@@ -338,7 +326,6 @@ function clickRandom(x1, y1, x2, y2, duration) end
338
326
  **示例:**
339
327
 
340
328
  ```lua
341
- local hid = require("hid")
342
329
  -- 在区域内随机点击
343
330
  hid.clickRandom(100, 100, 200, 200, 20)
344
331
  ```
@@ -368,7 +355,6 @@ function move(x, y) end
368
355
  **示例:**
369
356
 
370
357
  ```lua
371
- local hid = require("hid")
372
358
  -- 移动到 (100, 200)
373
359
  hid.move(100, 200)
374
360
  ```
@@ -385,7 +371,6 @@ function mouseDown() end
385
371
  **示例:**
386
372
 
387
373
  ```lua
388
- local hid = require("hid")
389
374
  hid.mouseDown()
390
375
  ```
391
376
 
@@ -401,7 +386,6 @@ function mouseUp() end
401
386
  **示例:**
402
387
 
403
388
  ```lua
404
- local hid = require("hid")
405
389
  hid.mouseUp()
406
390
  ```
407
391
 
@@ -436,7 +420,6 @@ function doubleClick(x, y, duration, interval, jitter) end
436
420
  **示例:**
437
421
 
438
422
  ```lua
439
- local hid = require("hid")
440
423
  -- 带抖动的双击
441
424
  hid.doubleClick(100, 100, 20, 20, true)
442
425
  ```
@@ -474,7 +457,6 @@ function doubleClickRandom(x1, y1, x2, y2, duration, interval) end
474
457
  **示例:**
475
458
 
476
459
  ```lua
477
- local hid = require("hid")
478
460
  -- 在区域内随机双击
479
461
  hid.doubleClickRandom(100, 100, 200, 200, 20, 20)
480
462
  ```
@@ -514,7 +496,6 @@ function swipe(x, y, ex, ey, jitter, steps) end
514
496
  **示例:**
515
497
 
516
498
  ```lua
517
- local hid = require("hid")
518
499
  -- 简单滑动
519
500
  hid.swipe(100, 100, 200, 200)
520
501
  -- 带抖动和自定义步数的滑动
@@ -556,7 +537,6 @@ function swipe(x, y, ex, ey, duration, jitter, steps) end
556
537
  **示例:**
557
538
 
558
539
  ```lua
559
- local hid = require("hid")
560
540
  -- 长按 1 秒后滑动
561
541
  hid.pressAndSwipe(100, 100, 200, 200, 1000)
562
542
  -- 长按 1 秒后带抖动和自定义步数的滑动
@@ -596,7 +576,6 @@ function swipeCurve(startX, startY, midX, midY, endX, endY) end
596
576
  **示例:**
597
577
 
598
578
  ```lua
599
- local hid = require("hid")
600
579
  -- 通过三个点的曲线滑动
601
580
  hid.swipeCurve(100, 100, 150, 50, 200, 100)
602
581
  ```
@@ -620,7 +599,6 @@ function homeScreen() end
620
599
  **示例:**
621
600
 
622
601
  ```lua
623
- local hid = require("hid")
624
602
  -- 回到主屏幕
625
603
  hid.homeScreen()
626
604
  ```
@@ -645,7 +623,6 @@ function input(text) end
645
623
  **示例:**
646
624
 
647
625
  ```lua
648
- local hid = require("hid")
649
626
  hid.input("Hello World")
650
627
  hid.input("测试")
651
628
  ```
@@ -673,7 +650,6 @@ function inputSimple(text) end
673
650
  **示例:**
674
651
 
675
652
  ```lua
676
- local hid = require("hid")
677
653
  -- 输入英文与数字
678
654
  hid.inputSimple("hello_123")
679
655
  ```
@@ -697,7 +673,6 @@ function space() end
697
673
  **示例:**
698
674
 
699
675
  ```lua
700
- local hid = require("hid")
701
676
  hid.space()
702
677
  ```
703
678
 
@@ -725,7 +700,6 @@ function backspace(count) end
725
700
  **示例:**
726
701
 
727
702
  ```lua
728
- local hid = require("hid")
729
703
  hid.backspace()
730
704
  hid.backspace(3)
731
705
  ```
@@ -747,7 +721,6 @@ function enter() end
747
721
  **示例:**
748
722
 
749
723
  ```lua
750
- local hid = require("hid")
751
724
  hid.enter()
752
725
  ```
753
726
 
@@ -768,7 +741,6 @@ function pressButton(button) end
768
741
  **示例:**
769
742
 
770
743
  ```lua
771
- local hid = require("hid")
772
744
  hid.pressButton("home")
773
745
  hid.pressButton("volumeup")
774
746
  hid.pressButton("snapshot")
@@ -799,7 +771,6 @@ function sendKey(key) end
799
771
  **示例:**
800
772
 
801
773
  ```lua
802
- local hid = require("hid")
803
774
  -- 发送Cmd+C
804
775
  hid.sendKey({ HidKey.COMMAND, "c" })
805
776
  -- 发送Ctrl+Alt+Delete
@@ -823,7 +794,6 @@ function copyText() end
823
794
  **示例:**
824
795
 
825
796
  ```lua
826
- local hid = require("hid")
827
797
  hid.copyText()
828
798
  ```
829
799
 
@@ -844,7 +814,6 @@ function pasteText() end
844
814
  **示例:**
845
815
 
846
816
  ```lua
847
- local hid = require("hid")
848
817
  hid.pasteText()
849
818
  ```
850
819
 
@@ -867,7 +836,6 @@ function back() end
867
836
  **示例:**
868
837
 
869
838
  ```lua
870
- local hid = require("hid")
871
839
  hid.back()
872
840
  ```
873
841
 
@@ -888,7 +856,6 @@ function recent() end
888
856
  **示例:**
889
857
 
890
858
  ```lua
891
- local hid = require("hid")
892
859
  hid.recent()
893
860
  ```
894
861
 
@@ -909,7 +876,6 @@ function lock() end
909
876
  **示例:**
910
877
 
911
878
  ```lua
912
- local hid = require("hid")
913
879
  hid.lock()
914
880
  ```
915
881
 
@@ -930,7 +896,6 @@ function unlock() end
930
896
  **示例:**
931
897
 
932
898
  ```lua
933
- local hid = require("hid")
934
899
  hid.unlock()
935
900
  ```
936
901
 
@@ -959,7 +924,6 @@ function openURL(url) end
959
924
  **示例:**
960
925
 
961
926
  ```lua
962
- local hid = require("hid")
963
927
  -- 打开网站
964
928
  hid.openURL("https://www.example.com")
965
929
  -- 使用自定义scheme打开应用
@@ -989,7 +953,6 @@ function openApp(name) end
989
953
  **示例:**
990
954
 
991
955
  ```lua
992
- local hid = require("hid")
993
956
  -- 打开Safari
994
957
  hid.openApp("Safari")
995
958
  -- 打开设置
@@ -1016,7 +979,6 @@ function closeApp(name) end
1016
979
  **示例:**
1017
980
 
1018
981
  ```lua
1019
- local hid = require("hid")
1020
982
  hid.closeApp("Safari")
1021
983
  hid.closeApp("com.example.myapp")
1022
984
  ```
@@ -1038,7 +1000,6 @@ function takeMeToFront() end
1038
1000
  **示例:**
1039
1001
 
1040
1002
  ```lua
1041
- local hid = require("hid")
1042
1003
  hid.takeMeToFront()
1043
1004
  ```
1044
1005
 
@@ -1065,7 +1026,6 @@ function currentAppInfo() end
1065
1026
  **示例:**
1066
1027
 
1067
1028
  ```lua
1068
- local hid = require("hid")
1069
1029
  local appInfo = hid.currentAppInfo()
1070
1030
  if appInfo then
1071
1031
  print("当前应用: " .. tostring(appInfo.name) .. " (" .. tostring(appInfo.bundleId) .. ")")
@@ -1097,7 +1057,6 @@ function setClipboard(text) end
1097
1057
  **示例:**
1098
1058
 
1099
1059
  ```lua
1100
- local hid = require("hid")
1101
1060
  hid.setClipboard("你好,世界!")
1102
1061
  ```
1103
1062
 
@@ -1118,7 +1077,6 @@ function getClipboard() end
1118
1077
  **示例:**
1119
1078
 
1120
1079
  ```lua
1121
- local hid = require("hid")
1122
1080
  local clipboardText = hid.getClipboard()
1123
1081
  if clipboardText then
1124
1082
  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("剪贴板设置成功")