@tarojs/taro 3.7.0-alpha.19 → 3.7.0-alpha.20

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.7.0-alpha.19",
3
+ "version": "3.7.0-alpha.20",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,12 +21,12 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.7.0-alpha.19",
25
- "@tarojs/runtime": "3.7.0-alpha.19"
24
+ "@tarojs/api": "3.7.0-alpha.20",
25
+ "@tarojs/runtime": "3.7.0-alpha.20"
26
26
  },
27
27
  "devDependencies": {
28
- "@tarojs/helper": "3.7.0-alpha.19",
29
- "@tarojs/shared": "3.7.0-alpha.19"
28
+ "@tarojs/helper": "3.7.0-alpha.20",
29
+ "@tarojs/shared": "3.7.0-alpha.20"
30
30
  },
31
31
  "peerDependenciesMeta": {
32
32
  "@types/react": {
@@ -3,7 +3,7 @@ import Taro from '../../index'
3
3
  declare module '../../index' {
4
4
  namespace isVKSupport {
5
5
  /** vision kit 版本 */
6
- interface Version {
6
+ interface IVersion {
7
7
  /** 旧版本 */
8
8
  v1
9
9
  /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
@@ -12,24 +12,24 @@ declare module '../../index' {
12
12
  }
13
13
  namespace createVKSession {
14
14
  /** vision kit 版本 */
15
- interface Version {
15
+ interface IVersion {
16
16
  /** 旧版本 */
17
17
  v1
18
18
  /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
19
19
  v2
20
20
  }
21
21
  /** 跟踪配置 */
22
- interface Track {
22
+ interface ITrack {
23
23
  /** 平面跟踪配置 */
24
- plane: Plane
24
+ plane: IPlane
25
25
  }
26
26
  /** 平面跟踪配置 */
27
- interface Plane {
27
+ interface IPlane {
28
28
  /** 平面跟踪配置模式 */
29
- mode: keyof PlaneMode
29
+ mode: keyof IPlaneMode
30
30
  }
31
31
  /** 平面跟踪配置模式合法值 */
32
- interface PlaneMode {
32
+ interface IPlaneMode {
33
33
  /** 检测横向平面 */
34
34
  1
35
35
  /** 检测纵向平面,只有 v2 版本支持 */
@@ -41,33 +41,59 @@ declare module '../../index' {
41
41
 
42
42
  /** anchor 对象,只有 v2 版本支持
43
43
  * @supported weapp
44
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKAnchor.html
44
+ * @ignore
45
45
  */
46
- interface VKAnchor {
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 {
47
53
  /** 唯一标识 */
48
54
  id: number
49
55
  /** 类型 */
50
- type: keyof VKAnchor.Type
51
- /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
52
- transform: Float32Array
53
- /** 尺寸,只有平面 anchor 支持 */
54
- size: VKAnchor.Size
55
- /** 方向,只有平面 anchor 支持 */
56
- alignment: number
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
57
69
  }
58
- namespace VKAnchor {
59
- /** anchor 对象类型合法值 */
60
- interface Type {
61
- /** 平面 */
62
- 0
70
+ namespace VKBodyAnchor {
71
+ /** 类型 */
72
+ interface IType {
73
+ /** 人体 */
74
+ 5
63
75
  }
64
- /** anchor 对象类型合法值 */
65
- interface Size {
76
+ /** 相对视窗的尺寸*/
77
+ interface ISize {
66
78
  /** 宽度 */
67
79
  width: number
68
80
  /** 高度 */
69
81
  height: number
70
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
+ }
71
97
  }
72
98
 
73
99
  /** 相机对象
@@ -91,6 +117,296 @@ declare module '../../index' {
91
117
  ): Float32Array
92
118
  }
93
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
+
94
410
  /** vision kit 会话对象
95
411
  * @supported weapp
96
412
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.html
@@ -104,7 +420,14 @@ declare module '../../index' {
104
420
  * @supported weapp
105
421
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getCameraTexture.html
106
422
  */
107
- getCameraTexture(ctx: WebGLRenderingContext): VKFrame.getCameraTextureResult
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
108
431
  /** 获取纹理调整矩阵。默认获取到的纹理是未经裁剪调整的纹理,此矩阵可用于在着色器中根据帧对象尺寸对纹理进行裁剪
109
432
  * @supported weapp
110
433
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKFrame.getDisplayTransform.html
@@ -114,7 +437,7 @@ declare module '../../index' {
114
437
 
115
438
  namespace VKFrame {
116
439
  /** 帧纹理对象 */
117
- interface getCameraTextureResult {
440
+ interface IGetCameraTextureResult {
118
441
  /** Y 分量纹理 */
119
442
  yTexture: WebGLTexture
120
443
  /** UV 分量纹理 */
@@ -128,11 +451,27 @@ declare module '../../index' {
128
451
  */
129
452
  interface VKSession {
130
453
  /** 会话状态 */
131
- state: keyof VKSession.State
454
+ state: keyof VKSession.IState
132
455
  /** 会话配置 */
133
- config: VKSession.Config
456
+ config: VKSession.IConfig
134
457
  /** 相机尺寸 */
135
- cameraSize: VKSession.Size
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
136
475
  /** 取消由 requestAnimationFrame 添加到计划中的动画帧请求
137
476
  * @supported weapp
138
477
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.cancelAnimationFrame.html
@@ -143,6 +482,36 @@ declare module '../../index' {
143
482
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.destroy.html
144
483
  */
145
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[]
146
515
  /** 获取帧对象,每调用一次都会触发一次帧分析过程
147
516
  * @supported weapp
148
517
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.getVKFrame.html
@@ -166,7 +535,7 @@ declare module '../../index' {
166
535
  y: number,
167
536
  /** 是否需要重新识别其他平面,v2 版本不再需要此参数 */
168
537
  reset?: boolean
169
- ): VKSession.hitTestResult[]
538
+ ): VKSession.IHitTestResult[]
170
539
  /** 取消监听会话事件。
171
540
  * @supported weapp
172
541
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.off.html
@@ -175,7 +544,7 @@ declare module '../../index' {
175
544
  /** 事件名称 */
176
545
  eventName: string,
177
546
  /** 事件监听函数 */
178
- fn: Function
547
+ fn: TaroGeneral.EventCallback
179
548
  ): void
180
549
  /** 监听会话事件。
181
550
  * @supported weapp
@@ -183,68 +552,125 @@ declare module '../../index' {
183
552
  */
184
553
  on(
185
554
  /** 事件名称 */
186
- eventName: string,
555
+ eventName: 'resize' | 'addAnchors' | 'updateAnchors' | 'removeAnchors' | string,
187
556
  /** 事件监听函数 */
188
- fn: Function
557
+ fn: TaroGeneral.EventCallback
189
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
190
575
  /** 在下次进行重绘时执行。
191
576
  * @supported weapp
192
577
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.requestAnimationFrame.html
193
578
  */
194
579
  requestAnimationFrame(
195
- /** 执行函数 */
196
- callback: Function
580
+ /** 执行函数 */
581
+ callback: TaroGeneral.TFunc
197
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
198
588
  /** 开启会话。
199
589
  * @supported weapp
200
590
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.start.html
201
591
  */
202
592
  start(
203
- /** 开启会话回调 */
204
- callback: (status: keyof VKSession.StartStatus) => void
593
+ /** 开启会话回调 */
594
+ callback: (status: keyof VKSession.IStartStatus) => void
205
595
  ): void
206
596
  /** 停止会话。
207
597
  * @supported weapp
208
598
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/VKSession.stop.html
209
599
  */
210
- stop(): void
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
211
617
  }
212
618
  namespace VKSession {
213
619
  /** state 的合法值 */
214
- interface State {
620
+ interface IState {
215
621
  /** 不可用 */
216
622
  0
217
623
  /** 运行中 */
218
624
  1
219
625
  /** 暂停中 */
220
626
  2
627
+ /** 初始化中 */
628
+ 3
221
629
  }
222
630
  /** 会话配置 */
223
- interface Config {
631
+ interface IConfig {
224
632
  /** 不可用 */
225
- version: keyof version
633
+ version: keyof IVersion
226
634
  /** 运行中 */
227
- track: track
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
228
654
  }
229
655
  /** vision kit 版本 */
230
- interface version {
656
+ interface IVersion {
231
657
  /** 旧版本 */
232
658
  v1
233
659
  /** v2 版本,目前只有 iOS 基础库 2.22.0 以上支持 */
234
660
  v2
235
661
  }
236
662
  /** 跟踪配置 */
237
- interface track {
663
+ interface ITrack {
238
664
  /** 平面跟踪配置 */
239
- plane: plane
665
+ plane: IPlane
240
666
  }
241
667
  /** 平面跟踪配置 */
242
- interface plane {
668
+ interface IPlane {
243
669
  /** 平面跟踪配置模式 */
244
- mode: keyof PlaneMode
670
+ mode: keyof IPlaneMode
245
671
  }
246
672
  /** 平面跟踪配置模式合法值 */
247
- interface PlaneMode {
673
+ interface IPlaneMode {
248
674
  /** 检测横向平面 */
249
675
  1
250
676
  /** 检测纵向平面,只有 v2 版本支持 */
@@ -252,22 +678,167 @@ declare module '../../index' {
252
678
  /** 检测横向和纵向平面,只有 v2 版本支持 */
253
679
  3
254
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
+ }
255
736
  /** 相机尺寸 */
256
- interface Size {
737
+ interface ISize {
257
738
  /** 宽度 */
258
739
  width: number
259
740
  /** 高度 */
260
741
  height: number
261
742
  }
262
-
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
+ }
263
835
  /** hitTest 检测结果 */
264
- interface hitTestResult {
836
+ interface IHitTestResult {
265
837
  /** 包含位置、旋转、放缩信息的矩阵,以列为主序 */
266
838
  transform: Float32Array
267
839
  }
268
-
269
840
  /** start status 的合法值 */
270
- interface StartStatus {
841
+ interface IStartStatus {
271
842
  /** 成功 */
272
843
  0
273
844
  /** 系统错误 */
@@ -292,12 +863,12 @@ declare module '../../index' {
292
863
  * @supported weapp
293
864
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.isVKSupport.html
294
865
  */
295
- isVKSupport (version: keyof isVKSupport.Version): boolean /** 是否支持对应版本的 vision kit */
866
+ isVKSupport (version: keyof isVKSupport.IVersion): boolean /** 是否支持对应版本的 vision kit */
296
867
 
297
868
  /** 创建 vision kit 会话对象
298
869
  * @supported weapp
299
870
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/visionkit/wx.createVKSession.html
300
871
  */
301
- createVKSession (version: keyof createVKSession.Version): VKSession /** vision kit 会话对象 */
872
+ createVKSession (version: keyof createVKSession.IVersion): VKSession /** vision kit 会话对象 */
302
873
  }
303
874
  }
@@ -32,7 +32,7 @@ declare module '../../index' {
32
32
  * @supported weapp
33
33
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.createObserver.html
34
34
  */
35
- createObserver(callback: Function): PerformanceObserver
35
+ createObserver(callback: TaroGeneral.TFunc): PerformanceObserver
36
36
  /** 该方法返回当前缓冲区中的所有性能数据
37
37
  * @supported weapp, tt
38
38
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/Performance.getEntries.html
@@ -222,23 +222,23 @@ declare module '../../index' {
222
222
 
223
223
  /** 预加载下个页面的 WebView
224
224
  * @supported weapp
225
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
225
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadWebview.html
226
226
  */
227
227
  preloadWebview(option: preloadWebview.Option): Promise<TaroGeneral.CallbackResult>
228
228
 
229
229
  /**预加载下个页面所需要的 Skyline 运行环境
230
230
  * @supported weapp
231
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
231
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadSkylineView.html
232
232
  */
233
233
  preloadSkylineView(option: preloadSkylineView.Option): Promise<TaroGeneral.CallbackResult>
234
234
 
235
235
  /** 为视图层预加载媒体资源文件, 目前支持:font,image
236
236
  * @supported weapp
237
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
237
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/performance/wx.preloadAssets.html
238
238
  */
239
239
  preloadAssets(option: preloadAssets.Option): Promise<TaroGeneral.CallbackResult>
240
240
  /** 小程序测速上报。使用前,需要在小程序管理后台配置。 详情参见[小程序测速](https://developers.weixin.qq.com/miniprogram/dev/framework/performanceReport/index.html)指南。
241
- *
241
+ *
242
242
  * **注意**
243
243
  * - 目前,当开启代码 [按需注入](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/lazyload.html) `时,evaluateScript` 将仅包含公有部分代码,页面和组件的代码注入的时间会包含在 `firstRender` 中(因为页面和组件的代码注入过程成为了首次渲染过程的一部分)。因此开启按需注入后,脚本耗时降低,渲染时间提高属于正常现象,优化效果可以关注整体启动耗时(`appLaunch`)来评估。
244
244
  * - `firstPaint` 和 `firstContentfulPaint` 指标在开启 `vconsole` 的情况下,由于绘制 `vconsoel` 的面板,会导致数据提前。
@@ -882,6 +882,11 @@ declare module '../../index' {
882
882
  /** 矩形路径的高度 */
883
883
  height: number,
884
884
  ): void
885
+ /** 重置绘图上下文状态
886
+ * @supported h5
887
+ * @see https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/reset
888
+ */
889
+ reset(): void
885
890
  /** 恢复之前保存的绘图上下文
886
891
  * @supported weapp, h5
887
892
  * @example
@@ -1230,11 +1235,13 @@ declare module '../../index' {
1230
1235
  * ctx.setFontSize(15)
1231
1236
  * ctx.setTextAlign('left')
1232
1237
  * ctx.fillText('textAlign=left', 150, 60)
1238
+ * await ctx.draw(true)
1233
1239
  * ctx.setTextAlign('center')
1234
1240
  * ctx.fillText('textAlign=center', 150, 80)
1241
+ * await ctx.draw(true)
1235
1242
  * ctx.setTextAlign('right')
1236
1243
  * ctx.fillText('textAlign=right', 150, 100)
1237
- * ctx.draw()
1244
+ * await ctx.draw(true)
1238
1245
  * ```
1239
1246
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextAlign.html
1240
1247
  */
@@ -1254,13 +1261,16 @@ declare module '../../index' {
1254
1261
  * ctx.setFontSize(20)
1255
1262
  * ctx.setTextBaseline('top')
1256
1263
  * ctx.fillText('top', 5, 75)
1264
+ * await ctx.draw(true)
1257
1265
  * ctx.setTextBaseline('middle')
1258
1266
  * ctx.fillText('middle', 50, 75)
1267
+ * await ctx.draw(true)
1259
1268
  * ctx.setTextBaseline('bottom')
1260
1269
  * ctx.fillText('bottom', 120, 75)
1270
+ * await ctx.draw(true)
1261
1271
  * ctx.setTextBaseline('normal')
1262
1272
  * ctx.fillText('normal', 200, 75)
1263
- * ctx.draw()
1273
+ * await ctx.draw(true)
1264
1274
  * ```
1265
1275
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.setTextBaseline.html
1266
1276
  */
@@ -81,7 +81,7 @@ declare module '../../index' {
81
81
  *
82
82
  * 通过 Taro.login 接口获得的用户登录态拥有一定的时效性。用户越久未使用小程序,用户登录态越有可能失效。反之如果用户一直在使用小程序,则用户登录态一直保持有效。具体时效逻辑由微信维护,对开发者透明。开发者只需要调用 Taro.checkSession 接口检测当前用户登录态是否有效。
83
83
  *
84
- * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
84
+ * 登录态过期后开发者可以再调用 Taro.login 获取新的用户登录态。调用 Taro.checkSession 成功说明当前 session_key 未过期,调用失败说明 session_key 已过期。更多使用方法详见 [小程序登录](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/login.html)。
85
85
  * @supported weapp
86
86
  * @example
87
87
  * ```tsx
@@ -0,0 +1,59 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ /**
5
+ * Snapshot 实例,可通过 SelectorQuery 获取。
6
+ *
7
+ * Snapshot 通过 id 跟一个 snapshot 组件绑定,操作对应的 snapshot 组件。
8
+ * @supported weapp
9
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html
10
+ */
11
+ interface Snapshot {
12
+ /**
13
+ * 画布宽度
14
+ */
15
+ width: number
16
+ /**
17
+ * 画布高度
18
+ */
19
+ height: number
20
+ /**
21
+ * 对 snapshot 组件子树进行截图
22
+ * @param option
23
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html
24
+ */
25
+ takeSnapshot(option: Snapshot.TakeSnapshot.Option): Promise<TaroGeneral.CallbackResult>
26
+ }
27
+
28
+ namespace Snapshot {
29
+ namespace TakeSnapshot {
30
+ interface Option {
31
+ /**
32
+ * 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file'
33
+ */
34
+ type: string
35
+ /**
36
+ * 截图文件格式,'rgba' 或 'png',默认值为 'png'
37
+ */
38
+ format: string
39
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
40
+ complete?: (res: TaroGeneral.CallbackResult) => void
41
+ /** 接口调用失败的回调函数 */
42
+ fail?: (res: TaroGeneral.CallbackResult) => void
43
+ /** 接口调用成功的回调函数 */
44
+ success?: (res: SuccessCallbackResult) => void
45
+ }
46
+
47
+ interface SuccessCallbackResult {
48
+ /**
49
+ * 截图保存的临时文件路径,当 type 为 file 该字段生效
50
+ */
51
+ tempFilePath: string
52
+ /**
53
+ * 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效
54
+ */
55
+ data: string
56
+ }
57
+ }
58
+ }
59
+ }
@@ -26,7 +26,7 @@ declare module '../../index' {
26
26
  * @supported weapp
27
27
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html
28
28
  */
29
- deleteCache(
29
+ deleteCache(
30
30
  /** 缓存 id */
31
31
  id: string
32
32
  ): void
@@ -40,7 +40,7 @@ declare module '../../index' {
40
40
  ): void
41
41
  /** 删除规则,同时会删除对应规则下所有缓存
42
42
  * @supported weapp
43
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
43
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
44
44
  */
45
45
  deleteRule(
46
46
  /** 规则 id */
@@ -67,17 +67,17 @@ declare module '../../index' {
67
67
  /** 事件名称 */
68
68
  eventName: string,
69
69
  /** 事件监听函数 */
70
- handler: Function
70
+ handler: TaroGeneral.EventCallback
71
71
  ): void
72
72
  /** 监听事件
73
73
  * @supported weapp
74
74
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html
75
75
  */
76
- on(
76
+ on(
77
77
  /** 事件名称 */
78
78
  eventName: keyof CacheManager.OnEventName,
79
79
  /** 事件监听函数 */
80
- handler: Function
80
+ handler: TaroGeneral.EventCallback
81
81
  ): void
82
82
  /** 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1
83
83
  * @supported weapp
@@ -117,7 +117,7 @@ declare module '../../index' {
117
117
  method: string
118
118
  /** uri 匹配规则,可参考规则字符串写法和正则写法 */
119
119
  url: any
120
- /**
120
+ /**
121
121
  * 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间
122
122
  * @default 7 * 24 * 60 * 60 * 1000
123
123
  */
@@ -189,10 +189,10 @@ declare module '../../index' {
189
189
  }
190
190
 
191
191
  interface TaroStatic {
192
- /** 拉起手机发送短信界面
193
- * @supported weap
194
- * @see declare module '../../index'
192
+ /** 创建缓存管理器
193
+ * @supported weapp
194
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html
195
195
  */
196
196
  createCacheManager(option: createCacheManager.Option): CacheManager
197
197
  }
198
- }
198
+ }
@@ -38,10 +38,10 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
38
38
  webpackChain?: (chain: Chain, webpack: typeof Webpack) => void
39
39
 
40
40
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
41
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
41
+ * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
42
42
  */
43
43
  output?: T extends 'vite' ? Pick<RollupOutputOptions, 'chunkFileNames' | 'assetFileNames' > : Webpack.Configuration['output']
44
-
44
+
45
45
  /** 路由相关的配置 */
46
46
  router?: IH5RouterConfig
47
47
 
@@ -114,4 +114,6 @@ export interface IH5Config <T extends CompilerTypes = CompilerWebpackTypes> {
114
114
  exclude?: any[]
115
115
  include?: any[]
116
116
  }
117
+ /** 是否把代码转化为 es5,只在 vite 编译模式下有效 */
118
+ es5?: T extends 'vite' ? boolean : undefined
117
119
  }
@@ -55,9 +55,9 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
55
55
  webpackChain?: (chain: Chain, webpack: typeof Webpack, PARSE_AST_TYPE: any) => void
56
56
 
57
57
  /** webpack 编译模式下,可用于修改、拓展 Webpack 的 output 选项,配置项参考[官方文档](https://webpack.js.org/configuration/output/)
58
- * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
58
+ * vite 编译模式下,用于修改、扩展 rollup 的 output,目前仅适配 chunkFileNames 和 assetFileNames 两个配置,修改其他配置请使用 vite 插件进行修改。配置想参考[官方文档](https://rollupjs.org/configuration-options/)
59
59
  */
60
- output?: T extends 'vite'
60
+ output?: T extends 'vite'
61
61
  ? Pick<RollupOutputOptions, 'chunkFileNames'> & OutputExt
62
62
  : Webpack.Configuration['output'] & OutputExt
63
63
 
@@ -1,7 +1,7 @@
1
1
  import type Webpack from 'webpack'
2
2
  import type Chain from 'webpack-chain'
3
3
  import { type Input } from 'postcss'
4
- import type { Compiler, IPrebundle, CompilerTypes, CompilerWebpackTypes } from '../compiler'
4
+ import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
5
5
  import type { IModifyChainData } from '../hooks'
6
6
  import type { ICopyOptions, IOption, ISassOptions, TogglableOptions } from './util'
7
7
  import type { IH5Config } from './h5'
@@ -314,4 +314,4 @@ export interface IProjectConfig<T extends CompilerTypes = CompilerWebpackTypes>
314
314
  rn?: IRNConfig
315
315
 
316
316
  [key: string]: any
317
- }
317
+ }
@@ -103,7 +103,7 @@ export interface ICopyOptions {
103
103
  from: string
104
104
  to: string
105
105
  ignore?: string[]
106
- transform?: Function
106
+ transform?: Func
107
107
  watch?: boolean
108
108
  }[]
109
109
  options: {
package/types/global.d.ts CHANGED
@@ -2,6 +2,7 @@ declare namespace TaroGeneral {
2
2
  type IAnyObject = Record<string, any>
3
3
  type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
4
4
  type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
5
+ type TFunc = (...args: any[]) => any
5
6
  /** 事件监听函数 */
6
7
  type EventCallback = (
7
8
  /** 触发事件参数 */
package/types/index.d.ts CHANGED
@@ -87,6 +87,8 @@
87
87
  * │ │ └── index.d.ts 路由 API
88
88
  * │ ├── share
89
89
  * │ │ └── index.d.ts 转发 API
90
+ * │ ├── skyline
91
+ * │ │ └── index.d.ts 微信 Skyline API
90
92
  * │ ├── storage
91
93
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
92
94
  * │ │ └── index.d.ts 数据缓存 API
@@ -109,6 +109,7 @@
109
109
  /// <reference path="api/wxml/index.d.ts" />
110
110
  /// <reference path="api/ext/index.d.ts" />
111
111
  /// <reference path="api/ad/index.d.ts" />
112
+ /// <reference path="api/skyline/index.d.ts" />
112
113
 
113
114
  /// <reference path="api/cloud/index.d.ts" />
114
115
  /// <reference path="api/open-api/facial.d.ts" />
@@ -363,16 +363,41 @@ declare module './index' {
363
363
 
364
364
  interface RenderOptions {
365
365
  skyline: {
366
- /**
367
- * 开启默认Block布局
366
+ /** 开启默认Block布局
368
367
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/wxss.html#%E5%BC%80%E5%90%AF%E9%BB%98%E8%AE%A4Block%E5%B8%83%E5%B1%80
368
+ * @supported weapp
369
369
  */
370
370
  defaultDisplayBlock?: boolean
371
- /**
372
- * 关闭 Skyline AB 实验
371
+ /** 关闭 Skyline AB 实验
373
372
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/release.html#%E5%8F%91%E5%B8%83%E4%B8%8A%E7%BA%BF
373
+ * @supported weapp
374
374
  */
375
375
  disableABTest?: boolean
376
+ /** 基础库最低版本
377
+ * @supported weapp
378
+ */
379
+ sdkVersionBegin?: string
380
+ /** 基础库最高版本
381
+ * @supported weapp
382
+ */
383
+ sdkVersionEnd?: string
384
+ /** iOS 微信最低版本
385
+ * @supported weapp
386
+ */
387
+ iosVersionBegin?: string
388
+ /** iOS 微信最高版本
389
+ * @supported weapp
390
+ */
391
+ iosVersionEnd?: string
392
+ /** 安卓微信最低版本
393
+ * @supported weapp
394
+ */
395
+ androidVersionBegin?: string
396
+ /** 安卓微信最高版本
397
+ * @supported weapp
398
+ */
399
+ androidVersionEnd?: string
400
+ [key: string]: unknown
376
401
  }
377
402
  }
378
403