@spcsn/taro 0.1.0

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 (140) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +147 -0
  3. package/dist/index.js.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +86 -0
  6. package/types/api/ad/index.d.ts +197 -0
  7. package/types/api/ai/face.d.ts +133 -0
  8. package/types/api/ai/inference.d.ts +129 -0
  9. package/types/api/ai/visionkit.d.ts +874 -0
  10. package/types/api/alipay/index.d.ts +69 -0
  11. package/types/api/base/crypto.d.ts +104 -0
  12. package/types/api/base/debug.d.ts +329 -0
  13. package/types/api/base/env.d.ts +19 -0
  14. package/types/api/base/index.d.ts +102 -0
  15. package/types/api/base/performance.d.ts +258 -0
  16. package/types/api/base/system.d.ts +742 -0
  17. package/types/api/base/update.d.ts +130 -0
  18. package/types/api/base/weapp/app-event.d.ts +265 -0
  19. package/types/api/base/weapp/life-cycle.d.ts +155 -0
  20. package/types/api/canvas/index.d.ts +2162 -0
  21. package/types/api/cloud/index.d.ts +2622 -0
  22. package/types/api/data-analysis/index.d.ts +122 -0
  23. package/types/api/device/accelerometer.d.ts +102 -0
  24. package/types/api/device/accessibility.d.ts +26 -0
  25. package/types/api/device/battery.d.ts +46 -0
  26. package/types/api/device/bluetooth-ble.d.ts +601 -0
  27. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  28. package/types/api/device/bluetooth.d.ts +463 -0
  29. package/types/api/device/calendar.d.ts +98 -0
  30. package/types/api/device/clipboard.d.ts +81 -0
  31. package/types/api/device/compass.d.ts +105 -0
  32. package/types/api/device/contact.d.ts +110 -0
  33. package/types/api/device/gyroscope.d.ts +85 -0
  34. package/types/api/device/iBeacon.d.ts +168 -0
  35. package/types/api/device/keyboard.d.ts +97 -0
  36. package/types/api/device/memory.d.ts +52 -0
  37. package/types/api/device/motion.d.ts +88 -0
  38. package/types/api/device/network.d.ts +172 -0
  39. package/types/api/device/nfc.d.ts +1238 -0
  40. package/types/api/device/phone.d.ts +30 -0
  41. package/types/api/device/scan.d.ts +111 -0
  42. package/types/api/device/screen.d.ts +217 -0
  43. package/types/api/device/sms.d.ts +26 -0
  44. package/types/api/device/vibrate.d.ts +51 -0
  45. package/types/api/device/wifi.d.ts +301 -0
  46. package/types/api/ext/index.d.ts +64 -0
  47. package/types/api/files/index.d.ts +1472 -0
  48. package/types/api/framework/index.d.ts +51 -0
  49. package/types/api/location/index.d.ts +517 -0
  50. package/types/api/media/audio.d.ts +1013 -0
  51. package/types/api/media/background-audio.d.ts +291 -0
  52. package/types/api/media/camera.d.ts +207 -0
  53. package/types/api/media/editor.d.ts +239 -0
  54. package/types/api/media/image.d.ts +469 -0
  55. package/types/api/media/live.d.ts +461 -0
  56. package/types/api/media/map.d.ts +638 -0
  57. package/types/api/media/media-recorder.d.ts +117 -0
  58. package/types/api/media/recorder.d.ts +317 -0
  59. package/types/api/media/video-decoder.d.ts +117 -0
  60. package/types/api/media/video-processing.d.ts +84 -0
  61. package/types/api/media/video.d.ts +527 -0
  62. package/types/api/media/voip.d.ts +393 -0
  63. package/types/api/navigate/index.d.ts +327 -0
  64. package/types/api/network/download.d.ts +173 -0
  65. package/types/api/network/mdns.d.ts +191 -0
  66. package/types/api/network/request.d.ts +480 -0
  67. package/types/api/network/tcp.d.ts +181 -0
  68. package/types/api/network/udp.d.ts +218 -0
  69. package/types/api/network/upload.d.ts +201 -0
  70. package/types/api/network/websocket.d.ts +383 -0
  71. package/types/api/open-api/account.d.ts +51 -0
  72. package/types/api/open-api/address.d.ts +68 -0
  73. package/types/api/open-api/authorize.d.ts +80 -0
  74. package/types/api/open-api/card.d.ts +110 -0
  75. package/types/api/open-api/channels.d.ts +225 -0
  76. package/types/api/open-api/customer-service.d.ts +45 -0
  77. package/types/api/open-api/device-voip.d.ts +103 -0
  78. package/types/api/open-api/facial.d.ts +98 -0
  79. package/types/api/open-api/favorites.d.ts +101 -0
  80. package/types/api/open-api/group.d.ts +59 -0
  81. package/types/api/open-api/invoice.d.ts +87 -0
  82. package/types/api/open-api/license-plate.d.ts +27 -0
  83. package/types/api/open-api/login.d.ts +115 -0
  84. package/types/api/open-api/my-miniprogram.d.ts +28 -0
  85. package/types/api/open-api/privacy.d.ts +107 -0
  86. package/types/api/open-api/redpackage.d.ts +24 -0
  87. package/types/api/open-api/settings.d.ts +174 -0
  88. package/types/api/open-api/soter.d.ts +184 -0
  89. package/types/api/open-api/sticker.d.ts +83 -0
  90. package/types/api/open-api/subscribe-message.d.ts +305 -0
  91. package/types/api/open-api/user-info.d.ts +182 -0
  92. package/types/api/open-api/werun.d.ts +101 -0
  93. package/types/api/payment/index.d.ts +119 -0
  94. package/types/api/qq/index.d.ts +354 -0
  95. package/types/api/route/index.d.ts +324 -0
  96. package/types/api/share/index.d.ts +354 -0
  97. package/types/api/skyline/index.d.ts +345 -0
  98. package/types/api/storage/background-fetch.d.ts +131 -0
  99. package/types/api/storage/cache-manager.d.ts +249 -0
  100. package/types/api/storage/index.d.ts +405 -0
  101. package/types/api/swan/bookshelf.d.ts +307 -0
  102. package/types/api/swan/download-package.d.ts +80 -0
  103. package/types/api/swan/index.d.ts +251 -0
  104. package/types/api/swan/pay.d.ts +139 -0
  105. package/types/api/taro.extend.d.ts +233 -0
  106. package/types/api/taro.hooks.d.ts +148 -0
  107. package/types/api/ui/animation.d.ts +427 -0
  108. package/types/api/ui/background.d.ts +69 -0
  109. package/types/api/ui/custom-component.d.ts +23 -0
  110. package/types/api/ui/fonts.d.ts +77 -0
  111. package/types/api/ui/interaction.d.ts +281 -0
  112. package/types/api/ui/menu.d.ts +29 -0
  113. package/types/api/ui/navigation-bar.d.ts +130 -0
  114. package/types/api/ui/pull-down-refresh.d.ts +50 -0
  115. package/types/api/ui/scroll.d.ts +114 -0
  116. package/types/api/ui/sticky.d.ts +32 -0
  117. package/types/api/ui/tab-bar.d.ts +196 -0
  118. package/types/api/ui/window.d.ts +71 -0
  119. package/types/api/worker/index.d.ts +83 -0
  120. package/types/api/wxml/index.d.ts +540 -0
  121. package/types/compile/compiler.d.ts +32 -0
  122. package/types/compile/config/h5.d.ts +134 -0
  123. package/types/compile/config/harmony.d.ts +118 -0
  124. package/types/compile/config/index.d.ts +8 -0
  125. package/types/compile/config/manifest.d.ts +155 -0
  126. package/types/compile/config/mini.d.ts +118 -0
  127. package/types/compile/config/plugin.d.ts +34 -0
  128. package/types/compile/config/project.d.ts +338 -0
  129. package/types/compile/config/rn.d.ts +85 -0
  130. package/types/compile/config/util.d.ts +179 -0
  131. package/types/compile/hooks.d.ts +13 -0
  132. package/types/compile/index.d.ts +11 -0
  133. package/types/compile/viteCompilerContext.d.ts +167 -0
  134. package/types/global.d.ts +428 -0
  135. package/types/index.d.ts +190 -0
  136. package/types/taro.api.d.ts +130 -0
  137. package/types/taro.component.d.ts +168 -0
  138. package/types/taro.config.d.ts +712 -0
  139. package/types/taro.lifecycle.d.ts +220 -0
  140. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,874 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace isVKSupport {
5
+ /** vision kit 版本 */
6
+ interface IVersion {
7
+ /** 旧版本 */
8
+ v1
9
+ /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
10
+ v2
11
+ }
12
+ }
13
+ namespace createVKSession {
14
+ /** vision kit 版本 */
15
+ interface IVersion {
16
+ /** 旧版本 */
17
+ v1
18
+ /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
19
+ v2
20
+ }
21
+ /** 跟踪配置 */
22
+ interface ITrack {
23
+ /** 平面跟踪配置 */
24
+ plane: IPlane
25
+ }
26
+ /** 平面跟踪配置 */
27
+ interface IPlane {
28
+ /** 平面跟踪配置模式 */
29
+ mode: keyof IPlaneMode
30
+ }
31
+ /** 平面跟踪配置模式合法值 */
32
+ interface IPlaneMode {
33
+ /** 检测横向平面 */
34
+ 1
35
+ /** 检测纵向平面,只有 v2 版本支持 */
36
+ 2
37
+ /** 检测横向和纵向平面,只有 v2 版本支持 */
38
+ 3
39
+ }
40
+ }
41
+
42
+ /** anchor 对象,只有 v2 版本支持
43
+ * @supported weapp
44
+ * @ignore
45
+ */
46
+ type VKAnchor = VKBodyAnchor | VKDepthAnchor | VKFaceAnchor | VKHandAnchor | VKMarkerAnchor | VKOCRAnchor | VKPlaneAnchor
47
+
48
+ /** 人体 anchor
49
+ * @supported weapp
50
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKBodyAnchor.html
51
+ */
52
+ interface VKBodyAnchor {
53
+ /** 唯一标识 */
54
+ id: number
55
+ /** 类型 */
56
+ type: keyof VKBodyAnchor.IType
57
+ /** 识别序号 */
58
+ detectId: number
59
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
60
+ size: VKBodyAnchor.ISize
61
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
62
+ origin: VKBodyAnchor.IOrigin
63
+ /** 关键点的置信度 */
64
+ confidence: number[]
65
+ /** 关键点 */
66
+ points: VKBodyAnchor.IPoint[]
67
+ /** 总体置信值 */
68
+ score: number
69
+ }
70
+ namespace VKBodyAnchor {
71
+ /** 类型 */
72
+ interface IType {
73
+ /** 人体 */
74
+ 5
75
+ }
76
+ /** 相对视窗的尺寸*/
77
+ interface ISize {
78
+ /** 宽度 */
79
+ width: number
80
+ /** 高度 */
81
+ height: number
82
+ }
83
+ /** 相对视窗的位置信息 */
84
+ interface IOrigin {
85
+ /** 横坐标 */
86
+ x: number
87
+ /** 纵坐标 */
88
+ y: number
89
+ }
90
+ /** 关键点 */
91
+ interface IPoint {
92
+ /** 横坐标 */
93
+ x: number
94
+ /** 纵坐标 */
95
+ y: number
96
+ }
97
+ }
98
+
99
+ /** 相机对象
100
+ * @supported weapp
101
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.html
102
+ */
103
+ interface VKCamera {
104
+ /** 视图矩阵 */
105
+ viewMatrix: Float32Array
106
+ /** 相机内参,只有 v2 版本支持 */
107
+ intrinsics: Float32Array
108
+ /** 获取投影矩阵
109
+ * @supported weapp
110
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKCamera.getProjectionMatrix.html
111
+ */
112
+ getProjectionMatrix (
113
+ /** 近视点 */
114
+ near: number,
115
+ /** 远视点 */
116
+ far: number
117
+ ): Float32Array
118
+ }
119
+
120
+ /** depth anchor
121
+ * @supported weapp
122
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKDepthAnchor.html
123
+ */
124
+ interface VKDepthAnchor {
125
+ /** 唯一标识 */
126
+ id: number
127
+ /** 类型 */
128
+ type: keyof VKDepthAnchor.IType
129
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
130
+ size: VKDepthAnchor.ISize
131
+ /** 包含深度信息的数组 */
132
+ depthArray: number[]
133
+ }
134
+ namespace VKDepthAnchor {
135
+ /** 类型 */
136
+ interface IType {
137
+ /** DEPTH */
138
+ 8
139
+ }
140
+ /** 相对视窗的尺寸 */
141
+ interface ISize {
142
+ /** 宽度 */
143
+ width: number
144
+ /** 高度 */
145
+ height: number
146
+ }
147
+ }
148
+
149
+ /** 人脸 anchor
150
+ * @supported weapp
151
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFaceAnchor.html
152
+ */
153
+ interface VKFaceAnchor {
154
+ /** 唯一标识 */
155
+ id: number
156
+ /** 类型 */
157
+ type: keyof VKFaceAnchor.IType
158
+ /** 识别序号 */
159
+ detectId: number
160
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
161
+ origin: VKFaceAnchor.IOrigin
162
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
163
+ size: VKFaceAnchor.ISize
164
+ /** 人脸 106 个关键点的坐标 */
165
+ points: VKFaceAnchor.IPoint[]
166
+ /** 人脸角度信息 */
167
+ angle: number[]
168
+ /** 关键点的置信度 */
169
+ confidence: number
170
+ }
171
+ namespace VKFaceAnchor {
172
+ /** 类型 */
173
+ interface IType {
174
+ /** 人脸 */
175
+ 3
176
+ }
177
+ /** 相对视窗的尺寸*/
178
+ interface ISize {
179
+ /** 宽度 */
180
+ width: number
181
+ /** 高度 */
182
+ height: number
183
+ }
184
+ /** 相对视窗的位置信息 */
185
+ interface IOrigin {
186
+ /** 横坐标 */
187
+ x: number
188
+ /** 纵坐标 */
189
+ y: number
190
+ }
191
+ /** 关键点 */
192
+ interface IPoint {
193
+ /** 横坐标 */
194
+ x: number
195
+ /** 纵坐标 */
196
+ y: number
197
+ }
198
+ }
199
+
200
+ /** 手势 anchor
201
+ * @supported weapp
202
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKHandAnchor.html
203
+ */
204
+ interface VKHandAnchor {
205
+ /** 唯一标识 */
206
+ id: number
207
+ /** 类型 */
208
+ type: keyof VKHandAnchor.IType
209
+ /** 识别序号 */
210
+ detectId: number
211
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
212
+ size: VKHandAnchor.ISize
213
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
214
+ origin: VKHandAnchor.IOrigin
215
+ /** 关键点的置信度 */
216
+ confidence: number[]
217
+ /** 关键点 */
218
+ points: VKHandAnchor.IPoint[]
219
+ /** 总体置信值 */
220
+ score: number
221
+ /** 手势分类, 返回整数 -1 到 18, -1 表示无效手势 */
222
+ gesture: keyof VKHandAnchor.IGesture | -1
223
+ }
224
+ namespace VKHandAnchor {
225
+ /** 类型 */
226
+ interface IType {
227
+ /** 手势 */
228
+ 7
229
+ }
230
+ /** 相对视窗的尺寸*/
231
+ interface ISize {
232
+ /** 宽度 */
233
+ width: number
234
+ /** 高度 */
235
+ height: number
236
+ }
237
+ /** 相对视窗的位置信息 */
238
+ interface IOrigin {
239
+ /** 横坐标 */
240
+ x: number
241
+ /** 纵坐标 */
242
+ y: number
243
+ }
244
+ /** 关键点 */
245
+ interface IPoint {
246
+ /** 横坐标 */
247
+ x: number
248
+ /** 纵坐标 */
249
+ y: number
250
+ }
251
+ /** 手势分类 */
252
+ interface IGesture {
253
+ /**单手比心 */
254
+ 0
255
+ /** 布(数字5)*/
256
+ 1
257
+ /** 剪刀(数字2) */
258
+ 2
259
+ /** 握拳 */
260
+ 3
261
+ /** 数字1 */
262
+ 4
263
+ /** 热爱 */
264
+ 5
265
+ /** 点赞 */
266
+ 6
267
+ /** 数字3 */
268
+ 7
269
+ /** 摇滚 */
270
+ 8
271
+ /** 数字6 */
272
+ 9
273
+ /** 数字8 */
274
+ 10
275
+ /** 双手抱拳(恭喜发财) */
276
+ 11
277
+ /** 数字4 */
278
+ 12
279
+ /** 比ok */
280
+ 13
281
+ /** 不喜欢(踩) */
282
+ 14
283
+ /** 双手比心 */
284
+ 15
285
+ /** 祈祷(双手合十) */
286
+ 16
287
+ /** 双手抱拳 */
288
+ 17
289
+ /** 无手势动作 */
290
+ 18
291
+ }
292
+ }
293
+
294
+ /** marker anchor
295
+ * @supported weapp
296
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKMarkerAnchor.html
297
+ */
298
+ interface VKMarkerAnchor {
299
+ /** 唯一标识 */
300
+ id: number
301
+ /** 类型 */
302
+ type: keyof VKMarkerAnchor.IType
303
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
304
+ transform: Float32Array
305
+ /** marker id */
306
+ markerId: number
307
+ /** 图片路径 */
308
+ path: string
309
+ }
310
+ namespace VKMarkerAnchor {
311
+ /** 类型 */
312
+ interface IType {
313
+ /** marker */
314
+ 1
315
+ }
316
+ }
317
+
318
+ /** OCR anchor
319
+ * @supported weapp
320
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOCRAnchor.html
321
+ */
322
+ interface VKOCRAnchor {
323
+ /** 唯一标识 */
324
+ id: number
325
+ /** 类型 */
326
+ type: keyof VKOCRAnchor.IType
327
+ /** 识别的文字结果 */
328
+ text: string
329
+ }
330
+ namespace VKOCRAnchor {
331
+ /** 类型 */
332
+ interface IType {
333
+ /** OCR */
334
+ 6
335
+ }
336
+ }
337
+
338
+ /** OSD anchor
339
+ * @supported weapp
340
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKOSDAnchor.html
341
+ */
342
+ interface VKOSDAnchor {
343
+ /** 唯一标识 */
344
+ id: number
345
+ /** 类型 */
346
+ type: keyof VKOSDAnchor.IType
347
+ /** marker id */
348
+ markerId: number
349
+ /** 相对视窗的尺寸,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘*/
350
+ size: VKOSDAnchor.ISize
351
+ /** 图片路径 */
352
+ path: string
353
+ /** 相对视窗的位置信息,取值范围为 [0, 1],0 为左/上边缘,1 为右/下边缘 */
354
+ origin: VKOSDAnchor.IOrigin
355
+ }
356
+ namespace VKOSDAnchor {
357
+ /** 类型 */
358
+ interface IType {
359
+ /** OSD */
360
+ 2
361
+ }
362
+ /** 相对视窗的尺寸*/
363
+ interface ISize {
364
+ /** 宽度 */
365
+ width: number
366
+ /** 高度 */
367
+ height: number
368
+ }
369
+ /** 相对视窗的位置信息 */
370
+ interface IOrigin {
371
+ /** 横坐标 */
372
+ x: number
373
+ /** 纵坐标 */
374
+ y: number
375
+ }
376
+ }
377
+
378
+ /** 平面 anchor,只有 v2 版本支持
379
+ * @supported weapp
380
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKPlaneAnchor.html
381
+ */
382
+ interface VKPlaneAnchor {
383
+ /** 唯一标识 */
384
+ id: number
385
+ /** 类型 */
386
+ type: keyof VKPlaneAnchor.IType
387
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
388
+ transform: Float32Array
389
+ /** 尺寸 */
390
+ size: VKPlaneAnchor.ISize
391
+ /** 方向 */
392
+ alignment: number
393
+ }
394
+
395
+ namespace VKPlaneAnchor {
396
+ /** 类型 */
397
+ interface IType {
398
+ /** 平面 */
399
+ 0
400
+ }
401
+ /** 相对视窗的尺寸*/
402
+ interface ISize {
403
+ /** 宽度 */
404
+ width: number
405
+ /** 高度 */
406
+ height: number
407
+ }
408
+ }
409
+
410
+ /** vision kit 会话对象
411
+ * @supported weapp
412
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html
413
+ */
414
+ interface VKFrame {
415
+ /** 生成时间 */
416
+ timestamp: number
417
+ /** 相机对象 */
418
+ camera: VKCamera
419
+ /** 获取当前帧纹理,目前只支持 YUV 纹理
420
+ * @supported weapp
421
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html
422
+ */
423
+ getCameraTexture(ctx: WebGLRenderingContext): VKFrame.IGetCameraTextureResult
424
+ /** 获取当前帧 rgba buffer。iOS 端微信在 v8.0.20 开始支持,安卓端微信在 v8.0.30 开始支持。
425
+ * 按 aspect-fill 规则裁剪,此接口要求在创建 VKSession 对象时必须传入 gl 参数。
426
+ * 此接口仅建议拿来做帧分析使用,上屏请使用 getCameraTexture 来代替。
427
+ * @supported weapp
428
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraBuffer.html
429
+ */
430
+ getCameraBuffer(widht: number, height: number): ArrayBuffer
431
+ /** 获取纹理调整矩阵。默认获取到的纹理是未经裁剪调整的纹理,此矩阵可用于在着色器中根据帧对象尺寸对纹理进行裁剪
432
+ * @supported weapp
433
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html
434
+ */
435
+ getDisplayTransform(): Float32Array
436
+ }
437
+
438
+ namespace VKFrame {
439
+ /** 帧纹理对象 */
440
+ interface IGetCameraTextureResult {
441
+ /** Y 分量纹理 */
442
+ yTexture: WebGLTexture
443
+ /** UV 分量纹理 */
444
+ uvTexture: WebGLTexture
445
+ }
446
+ }
447
+
448
+ /** vision kit 会话对象
449
+ * @supported weapp
450
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.html
451
+ */
452
+ interface VKSession {
453
+ /** 会话状态 */
454
+ state: keyof VKSession.IState
455
+ /** 会话配置 */
456
+ config: VKSession.IConfig
457
+ /** 相机尺寸 */
458
+ cameraSize: VKSession.ISize
459
+ /** 添加一个 marker,要求调 Taro.createVKSession 时传入的 track.marker 为 true
460
+ * @supported weapp
461
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addMarker.html
462
+ */
463
+ addMarker(
464
+ /** 图片路径,目前只支持本地用户图片 */
465
+ path: string
466
+ ): number
467
+ /** 添加一个 OSD marker(one-shot detection marker),要求调 Taro.createVKSession 时传入的 track.OSD 为 true
468
+ * @supported weapp
469
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.addOSDMarker.html
470
+ */
471
+ addOSDMarker(
472
+ /** 图片路径,目前只支持本地用户图片 */
473
+ path: string
474
+ ): number
475
+ /** 取消由 requestAnimationFrame 添加到计划中的动画帧请求
476
+ * @supported weapp
477
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html
478
+ */
479
+ cancelAnimationFrame(requestID: number): void
480
+ /** 销毁会话
481
+ * @supported weapp
482
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html
483
+ */
484
+ destroy(): void
485
+ /** 静态图像人体关键点检测。当 Taro.createVKSession 参数传入 {track: {body: {mode: 2} } } 时可用。
486
+ * @supported weapp
487
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectBody.html
488
+ */
489
+ detectBody(option: VKSession.IDetectBodyOption): void
490
+ /** 深度识别。当 Taro.createVKSession 参数传入 {track: {depth: {mode: 2} } } 时可用。
491
+ * @supported weapp
492
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectDepth.html
493
+ */
494
+ detectDepth(option: VKSession.IDetectDepthOption): void
495
+ /** 静态图像人脸关键点检测。当 Taro.createVKSession 参数传入 {track: {face: {mode: 2} } } 时可用。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。
496
+ * @supported weapp
497
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectFace.html
498
+ */
499
+ detectFace(option: VKSession.IDetectFaceOption): void
500
+ /** 静态图像手势关键点检测。当 Taro.createVKSession 参数传入 {track: {hand: {mode: 2} } } 时可用。
501
+ * @supported weapp
502
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.detectHand.html
503
+ */
504
+ detectHand(option: VKSession.IDetectHandOption): void
505
+ /** 获取所有 marker,要求调 Taro.createVKSession 时传入的 track.marker 为 true
506
+ * @supported weapp
507
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllMarker.html
508
+ */
509
+ getAllMarker(): VKSession.IMarker[]
510
+ /** 获取所有 OSD marker,要求调 Taro.createVKSession 时传入的 track.OSD 为 true
511
+ * @supported weapp
512
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getAllOSDMarker.html
513
+ */
514
+ getAllOSDMarker(): VKSession.IOSDMarker[]
515
+ /** 获取帧对象,每调用一次都会触发一次帧分析过程
516
+ * @supported weapp
517
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html
518
+ */
519
+ getVKFrame(
520
+ /** 宽度 */
521
+ width: number,
522
+ /** 高度 */
523
+ height: number
524
+ ): VKFrame
525
+ /** 触摸检测,v1 版本只支持单平面(即 hitTest 生成一次平面后,后续 hitTest 均不会再生成平面,而是以之前生成的平面为基础进行检测)。
526
+ *
527
+ * 如果需要重新识别其他平面,可以在调用此方法时将 reset 参数置为 true。
528
+ * @supported weapp
529
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.hitTest.html
530
+ */
531
+ hitTest(
532
+ /** 相对视窗的横坐标,取值范围为 [0, 1],0 为左边缘,1 为右边缘 */
533
+ x: number,
534
+ /** 相对视窗的纵坐标,取值范围为 [0, 1],0 为上边缘,1 为下边缘 */
535
+ y: number,
536
+ /** 是否需要重新识别其他平面,v2 版本不再需要此参数 */
537
+ reset?: boolean
538
+ ): VKSession.IHitTestResult[]
539
+ /** 取消监听会话事件。
540
+ * @supported weapp
541
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html
542
+ */
543
+ off(
544
+ /** 事件名称 */
545
+ eventName: string,
546
+ /** 事件监听函数 */
547
+ fn: TaroGeneral.EventCallback
548
+ ): void
549
+ /** 监听会话事件。
550
+ * @supported weapp
551
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.on.html
552
+ */
553
+ on(
554
+ /** 事件名称 */
555
+ eventName: 'resize' | 'addAnchors' | 'updateAnchors' | 'removeAnchors' | string,
556
+ /** 事件监听函数 */
557
+ fn: TaroGeneral.EventCallback
558
+ ): void
559
+ /** 删除一个 marker,要求调 Taro.createVKSession 时传入的 track.marker 为 true
560
+ * @supported weapp
561
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeMarker.html
562
+ */
563
+ removeMarker(
564
+ /** marker id */
565
+ markerId: number
566
+ ): number
567
+ /** 删除一个 OSD marker,要求调 Taro.createVKSession 时传入的 track.OSD 为 true
568
+ * @supported weapp
569
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.removeOSDMarker.html
570
+ */
571
+ removeOSDMarker(
572
+ /** marker id */
573
+ markerId: number
574
+ ): number
575
+ /** 在下次进行重绘时执行。
576
+ * @supported weapp
577
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html
578
+ */
579
+ requestAnimationFrame(
580
+ /** 执行函数 */
581
+ callback: TaroGeneral.TFunc
582
+ ): number
583
+ /** 静态图像 OCR 检测。当 Taro.createVKSession 参数传入 {track: {OCR: {mode: 2} } } 时可用。
584
+ * @supported weapp
585
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.runOCR.html
586
+ */
587
+ runOCR(option: VKSession.IRunOCROption): void
588
+ /** 开启会话。
589
+ * @supported weapp
590
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html
591
+ */
592
+ start(
593
+ /** 开启会话回调 */
594
+ callback: (status: keyof VKSession.IStartStatus) => void
595
+ ): void
596
+ /** 停止会话。
597
+ * @supported weapp
598
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html
599
+ */
600
+ stop(): void
601
+ /** 开启 3D 模式
602
+ * @supported weapp
603
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.update3DMode.html
604
+ */
605
+ update3DMode(
606
+ /** 是否开启 */
607
+ open3d: boolean
608
+ ): void
609
+ /** 更新 OSD 识别精确度,要求调 Taro.createVKSession 时传入的 track.OSD 为 true
610
+ * @supported weapp
611
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.updateOSDThreshold.html
612
+ */
613
+ updateOSDThreshold(
614
+ /** 阈值 */
615
+ threshold: number
616
+ ): void
617
+ }
618
+ namespace VKSession {
619
+ /** state 的合法值 */
620
+ interface IState {
621
+ /** 不可用 */
622
+ 0
623
+ /** 运行中 */
624
+ 1
625
+ /** 暂停中 */
626
+ 2
627
+ /** 初始化中 */
628
+ 3
629
+ }
630
+ /** 会话配置 */
631
+ interface IConfig {
632
+ /** 不可用 */
633
+ version: keyof IVersion
634
+ /** 运行中 */
635
+ track: ITrack
636
+ /** marker 跟踪配置,基础库(3.0.0)开始允许同时支持v2的水平面检测能力 */
637
+ marker: boolean
638
+ /** OSD 跟踪配置 */
639
+ OSD: boolean
640
+ /** 深度识别配置 */
641
+ depth: IDepth
642
+ /** 人脸检测配置。安卓微信8.0.25开始支持,iOS微信8.0.24开始支持。 */
643
+ face: IFace
644
+ /** OCR 检测配置。 */
645
+ OCR: IOCR
646
+ /** 人体检测配置。 */
647
+ body: IBody
648
+ /** 手势检测配置。 */
649
+ hand: IHand
650
+ /** 提供基础AR功能,输出相机旋转的3个自由度的位姿,利用手机陀螺仪传感器,实现快速稳定的AR定位能力,适用于简单AR场景。 */
651
+ threeDof: boolean
652
+ /** 绑定的 WebGLRenderingContext 对象 */
653
+ gl: WebGLRenderingContext
654
+ }
655
+ /** vision kit 版本 */
656
+ interface IVersion {
657
+ /** 旧版本 */
658
+ v1
659
+ /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
660
+ v2
661
+ }
662
+ /** 跟踪配置 */
663
+ interface ITrack {
664
+ /** 平面跟踪配置 */
665
+ plane: IPlane
666
+ }
667
+ /** 平面跟踪配置 */
668
+ interface IPlane {
669
+ /** 平面跟踪配置模式 */
670
+ mode: keyof IPlaneMode
671
+ }
672
+ /** 平面跟踪配置模式合法值 */
673
+ interface IPlaneMode {
674
+ /** 检测横向平面 */
675
+ 1
676
+ /** 检测纵向平面,只有 v2 版本支持 */
677
+ 2
678
+ /** 检测横向和纵向平面,只有 v2 版本支持 */
679
+ 3
680
+ }
681
+ /** 深度识别配置 */
682
+ interface IDepth {
683
+ mode: keyof IDepthMode
684
+ }
685
+ /** 深度识别模式 */
686
+ interface IDepthMode {
687
+ /** 通过摄像头实时检测 */
688
+ 1
689
+ /** 静态图片检测 */
690
+ 2
691
+ }
692
+ /** 人脸检测模式 */
693
+ interface IFace {
694
+ mode: keyof IFaceMode
695
+ }
696
+ /** 人脸检测模式 */
697
+ interface IFaceMode {
698
+ /** 通过摄像头实时检测 */
699
+ 1
700
+ /** 静态图片检测 */
701
+ 2
702
+ }
703
+ /** OCR 检测配置 */
704
+ interface IOCR {
705
+ mode: keyof IOCRMode
706
+ }
707
+ /** OCR 检测模式 */
708
+ interface IOCRMode {
709
+ /** 通过摄像头实时检测 */
710
+ 1
711
+ /** 静态图片检测 */
712
+ 2
713
+ }
714
+ /** 人体检测模式 */
715
+ interface IBody {
716
+ mode: keyof IBodyMode
717
+ }
718
+ /** 人体检测模式 */
719
+ interface IBodyMode {
720
+ /** 通过摄像头实时检测 */
721
+ 1
722
+ /** 静态图片检测 */
723
+ 2
724
+ }
725
+ /** 手势检测配置 */
726
+ interface IHand {
727
+ mode: keyof IHandMode
728
+ }
729
+ /** 手势检测模式 */
730
+ interface IHandMode {
731
+ /** 通过摄像头实时检测 */
732
+ 1
733
+ /** 静态图片检测 */
734
+ 2
735
+ }
736
+ /** 相机尺寸 */
737
+ interface ISize {
738
+ /** 宽度 */
739
+ width: number
740
+ /** 高度 */
741
+ height: number
742
+ }
743
+ interface IDetectBodyOption {
744
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
745
+ frameBuffer: ArrayBuffer
746
+ /** 图像宽度 */
747
+ width: number
748
+ /** 图像高度 */
749
+ height: number
750
+ /** 评分阈值。正常情况传入 0.8 即可。默认值 0.8 */
751
+ scoreThreshold?: number
752
+ /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果。默认值1 */
753
+ sourceType?: keyof ISourceType
754
+ }
755
+ /** 图像源类型。 */
756
+ interface ISourceType {
757
+ /** 表示输入的图片是随机的图片 */
758
+ 1
759
+ /** 表示输入的图片是来自一个连续视频的每一帧图像 */
760
+ 0
761
+ }
762
+ interface IDetectDepthOption {
763
+ /** 人需要识别深度的图像像素点数据,每四项表示一个像素点的 RGBA */
764
+ frameBuffer: ArrayBuffer
765
+ /** 图像宽度 */
766
+ width: number
767
+ /** 图像高度 */
768
+ height: number
769
+ }
770
+ interface IDetectFaceOption {
771
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
772
+ frameBuffer: ArrayBuffer
773
+ /** 图像宽度 */
774
+ width: number
775
+ /** 图像高度 */
776
+ height: number
777
+ /** 评分阈值。正常情况传入 0.8 即可。默认值 0.8 */
778
+ scoreThreshold?: number
779
+ /** 图像源类型。正常情况传入 1 即可。当输入的图片是来自一个连续视频的每一帧图像时,sourceType 传入 0 会得到更优的效果。默认值1 */
780
+ sourceType?: keyof ISourceType
781
+ /** 算法模型类型。正常情况传入 1 即可。0、1、2 分别表示小、中、大模型,模型越大识别准确率越高,但资源占用也越高。建议根据用户设备性能进行选择。 */
782
+ modelModel?: keyof IModelModel
783
+ }
784
+ /** 算法模型类型 */
785
+ interface IModelModel {
786
+ /** 小模型 */
787
+ 0
788
+ /** 中模型 */
789
+ 1
790
+ /** 大模型 */
791
+ 2
792
+ }
793
+ interface IDetectHandOption {
794
+ /** 人脸图像像素点数据,每四项表示一个像素点的 RGBA */
795
+ frameBuffer: ArrayBuffer
796
+ /** 图像宽度 */
797
+ width: number
798
+ /** 图像高度 */
799
+ height: number
800
+ /** 评分阈值。正常情况传入 0.8 即可。默认值0.8 */
801
+ scoreThreshold?: number
802
+ /** 算法检测模式 */
803
+ algoMode?: keyof IAlgoMode
804
+ }
805
+ /** 算法检测模式 */
806
+ interface IAlgoMode {
807
+ /** 检测模式,输出框和点 */
808
+ 0
809
+ /** 手势模式,输出框和手势分类 */
810
+ 1
811
+ /** 结合0和1模式,输出框、点、手势分类 */
812
+ 2
813
+ }
814
+ interface IMarker {
815
+ /** marker id */
816
+ markerId: number
817
+ /** 图片路径 */
818
+ path: string
819
+ }
820
+ /** OSD marker */
821
+ interface IOSDMarker {
822
+ /** marker id */
823
+ markerId: number
824
+ /** 图片路径 */
825
+ path: string
826
+ }
827
+ interface IRunOCROption {
828
+ /** 待识别图像的像素点数据,每四项表示一个像素点的 RGBA */
829
+ frameBuffer: ArrayBuffer
830
+ /** 图像宽度 */
831
+ width: number
832
+ /** 图像高度 */
833
+ height: number
834
+ }
835
+ /** hitTest 检测结果 */
836
+ interface IHitTestResult {
837
+ /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
838
+ transform: Float32Array
839
+ }
840
+ /** start status 的合法值 */
841
+ interface IStartStatus {
842
+ /** 成功 */
843
+ 0
844
+ /** 系统错误 */
845
+ 2000000
846
+ /** 参数错误 */
847
+ 2000001
848
+ /** 设备不支持 */
849
+ 2000002
850
+ /** 系统不支持 */
851
+ 2000003
852
+ /** 会话不可用 */
853
+ 2003000
854
+ /** 未开启系统相机权限 */
855
+ 2003001
856
+ /** 未开启小程序相机权限 */
857
+ 2003002
858
+ }
859
+ }
860
+
861
+ interface TaroStatic {
862
+ /** 判断支持版本
863
+ * @supported weapp
864
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html
865
+ */
866
+ isVKSupport (version: keyof isVKSupport.IVersion): boolean /** 是否支持对应版本的 vision kit */
867
+
868
+ /** 创建 vision kit 会话对象
869
+ * @supported weapp
870
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html
871
+ */
872
+ createVKSession (version: keyof createVKSession.IVersion): VKSession /** vision kit 会话对象 */
873
+ }
874
+ }