@tarojs/taro 3.8.0-canary.0 → 4.0.0-alpha.2

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 (101) hide show
  1. package/html.css +9 -0
  2. package/package.json +16 -4
  3. package/types/api/ad/index.d.ts +6 -18
  4. package/types/api/ai/inference.d.ts +4 -8
  5. package/types/api/ai/visionkit.d.ts +625 -54
  6. package/types/api/base/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +1 -1
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +6 -6
  11. package/types/api/base/weapp/app-event.d.ts +10 -10
  12. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  13. package/types/api/canvas/index.d.ts +389 -72
  14. package/types/api/data-analysis/index.d.ts +51 -1
  15. package/types/api/device/accelerometer.d.ts +8 -6
  16. package/types/api/device/accessibility.d.ts +1 -1
  17. package/types/api/device/battery.d.ts +3 -3
  18. package/types/api/device/bluetooth-ble.d.ts +40 -17
  19. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  20. package/types/api/device/bluetooth.d.ts +37 -13
  21. package/types/api/device/calendar.d.ts +11 -1
  22. package/types/api/device/clipboard.d.ts +17 -17
  23. package/types/api/device/compass.d.ts +5 -5
  24. package/types/api/device/gyroscope.d.ts +4 -4
  25. package/types/api/device/iBeacon.d.ts +10 -8
  26. package/types/api/device/keyboard.d.ts +7 -5
  27. package/types/api/device/memory.d.ts +3 -4
  28. package/types/api/device/motion.d.ts +8 -6
  29. package/types/api/device/network.d.ts +12 -6
  30. package/types/api/device/nfc.d.ts +13 -13
  31. package/types/api/device/phone.d.ts +1 -1
  32. package/types/api/device/scan.d.ts +5 -3
  33. package/types/api/device/screen.d.ts +28 -12
  34. package/types/api/device/sms.d.ts +1 -1
  35. package/types/api/device/vibrate.d.ts +5 -5
  36. package/types/api/device/wifi.d.ts +25 -13
  37. package/types/api/files/index.d.ts +73 -43
  38. package/types/api/framework/index.d.ts +2 -2
  39. package/types/api/location/index.d.ts +167 -19
  40. package/types/api/media/audio.d.ts +71 -42
  41. package/types/api/media/background-audio.d.ts +1 -1
  42. package/types/api/media/camera.d.ts +6 -3
  43. package/types/api/media/image.d.ts +5 -5
  44. package/types/api/media/video.d.ts +11 -11
  45. package/types/api/navigate/index.d.ts +3 -1
  46. package/types/api/network/download.d.ts +7 -15
  47. package/types/api/network/request.d.ts +7 -7
  48. package/types/api/network/upload.d.ts +9 -17
  49. package/types/api/network/websocket.d.ts +8 -8
  50. package/types/api/open-api/account.d.ts +1 -1
  51. package/types/api/open-api/address.d.ts +13 -5
  52. package/types/api/open-api/authorize.d.ts +1 -1
  53. package/types/api/open-api/channels.d.ts +16 -0
  54. package/types/api/open-api/device-voip.d.ts +42 -2
  55. package/types/api/open-api/invoice.d.ts +1 -1
  56. package/types/api/open-api/login.d.ts +16 -3
  57. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  58. package/types/api/open-api/privacy.d.ts +107 -0
  59. package/types/api/open-api/settings.d.ts +3 -2
  60. package/types/api/open-api/sticker.d.ts +83 -0
  61. package/types/api/open-api/subscribe-message.d.ts +148 -6
  62. package/types/api/open-api/user-info.d.ts +6 -1
  63. package/types/api/qq/index.d.ts +306 -1
  64. package/types/api/route/index.d.ts +8 -5
  65. package/types/api/skyline/index.d.ts +59 -0
  66. package/types/api/storage/background-fetch.d.ts +63 -11
  67. package/types/api/storage/cache-manager.d.ts +61 -10
  68. package/types/api/storage/index.d.ts +125 -10
  69. package/types/api/swan/bookshelf.d.ts +307 -0
  70. package/types/api/swan/download-package.d.ts +80 -0
  71. package/types/api/swan/index.d.ts +151 -0
  72. package/types/api/swan/pay.d.ts +139 -0
  73. package/types/api/taro.extend.d.ts +15 -6
  74. package/types/api/taro.hooks.d.ts +9 -9
  75. package/types/api/ui/animation.d.ts +32 -32
  76. package/types/api/ui/custom-component.d.ts +1 -1
  77. package/types/api/ui/fonts.d.ts +4 -3
  78. package/types/api/ui/interaction.d.ts +6 -6
  79. package/types/api/ui/menu.d.ts +1 -1
  80. package/types/api/ui/navigation-bar.d.ts +5 -5
  81. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  82. package/types/api/ui/scroll.d.ts +1 -1
  83. package/types/api/ui/tab-bar.d.ts +8 -8
  84. package/types/api/ui/window.d.ts +2 -2
  85. package/types/api/wxml/index.d.ts +19 -19
  86. package/types/compile/compiler.d.ts +9 -4
  87. package/types/compile/config/h5.d.ts +23 -10
  88. package/types/compile/config/harmony.d.ts +82 -0
  89. package/types/compile/config/index.d.ts +1 -0
  90. package/types/compile/config/mini.d.ts +58 -30
  91. package/types/compile/config/plugin.d.ts +34 -0
  92. package/types/compile/config/project.d.ts +26 -13
  93. package/types/compile/config/util.d.ts +22 -8
  94. package/types/compile/viteCompilerContext.d.ts +155 -0
  95. package/types/global.d.ts +3 -1
  96. package/types/index.d.ts +92 -44
  97. package/types/taro.api.d.ts +24 -13
  98. package/types/taro.component.d.ts +2 -1
  99. package/types/taro.config.d.ts +47 -6
  100. package/types/taro.lifecycle.d.ts +3 -0
  101. package/types/taro.runtime.d.ts +9 -0
@@ -7,16 +7,23 @@ declare module '../../index' {
7
7
  latitude: number
8
8
  /** 经度,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
9
9
  longitude: number
10
+ /** 缩放比例
11
+ * @weapp 范围 5~18,默认值18
12
+ * @alipay 范围 3~19,默认值15
13
+ */
14
+ scale?: number
15
+ /** 位置名 */
16
+ name?: string
10
17
  /** 地址的详细说明 */
11
18
  address?: string
19
+ /** 定义在拉起的地图 App 面板中需要被屏蔽的地图类 App
20
+ * @supported swan
21
+ */
22
+ ignoredApps?: Array<any>
12
23
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
13
24
  complete?: (res: TaroGeneral.CallbackResult) => void
14
25
  /** 接口调用失败的回调函数 */
15
26
  fail?: (res: TaroGeneral.CallbackResult) => void
16
- /** 位置名 */
17
- name?: string
18
- /** 缩放比例,范围5~18 */
19
- scale?: number
20
27
  /** 接口调用成功的回调函数 */
21
28
  success?: (res: TaroGeneral.CallbackResult) => void
22
29
  }
@@ -24,20 +31,32 @@ declare module '../../index' {
24
31
 
25
32
  namespace getLocation {
26
33
  interface Option {
27
- /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度 */
28
- altitude?: string
34
+ /** 传入 true 会返回高度信息,由于获取高度需要较高精确度,会减慢接口返回速度
35
+ * @default false
36
+ */
37
+ altitude?: boolean
29
38
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
30
39
  complete?: (res: TaroGeneral.CallbackResult) => void
31
40
  /** 接口调用失败的回调函数 */
32
41
  fail?: (res: TaroGeneral.CallbackResult) => void
33
42
  /** 高精度定位超时时间(ms),指定时间内返回最高精度,该值3000ms以上高精度定位才有效果 */
34
43
  highAccuracyExpireTime?: number
35
- /** 开启高精度定位 */
44
+ /** 开启高精度定位
45
+ * @default false
46
+ */
36
47
  isHighAccuracy?: boolean
37
48
  /** 接口调用成功的回调函数 */
38
49
  success?: (result: SuccessCallbackResult) => void
39
- /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
50
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标
51
+ * @default "wgs84"
52
+ */
40
53
  type?: string
54
+ /** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
55
+ * 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
56
+ * @supported swan
57
+ * @default false
58
+ */
59
+ needFullAccuracy?: boolean
41
60
  }
42
61
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
43
62
  /** 位置的精确度 */
@@ -54,6 +73,42 @@ declare module '../../index' {
54
73
  speed: number
55
74
  /** 垂直精度,单位 m(Android 无法获取,返回 0) */
56
75
  verticalAccuracy: number
76
+ /** 城市名称
77
+ * @supported swan
78
+ */
79
+ street?: string
80
+ /** 国家代码
81
+ * @supported swan
82
+ */
83
+ cityCode?: string
84
+ /** 城市名称
85
+ * @supported swan, tt
86
+ */
87
+ city?: string
88
+ /** 国家
89
+ * @supported swan
90
+ */
91
+ country?: string
92
+ /** 国家代码
93
+ * @supported swan
94
+ */
95
+ countryCode?: string
96
+ /** 省份
97
+ * @supported swan
98
+ */
99
+ province?: string
100
+ /** 街道号码
101
+ * @supported swan
102
+ */
103
+ streetNumber?: string
104
+ /** 区
105
+ * @supported swan
106
+ */
107
+ district?: string
108
+ /** 是不是精确定位信息
109
+ * @supported swan
110
+ */
111
+ isFullAccuracy?: boolean
57
112
  /** 调用结果 */
58
113
  errMsg: string
59
114
  }
@@ -97,6 +152,12 @@ declare module '../../index' {
97
152
  * @see https://lbs.qq.com/webApi/component/componentGuide/componentPicker
98
153
  */
99
154
  mapOpts?: Record<string, unknown>
155
+ /** 页面显示标题
156
+ * @supported alipay
157
+ * @alipay 安卓默认值为 位置,iOS、IDE 默认值为 你在哪里?
158
+ * @see https://opendocs.alipay.com/mini/api/location?pathHash=951b46a1
159
+ */
160
+ title?: string
100
161
  /** 接口调用成功的回调函数 */
101
162
  success?: (result: SuccessCallbackResult) => void
102
163
  /** 接口调用失败的回调函数 */
@@ -114,6 +175,30 @@ declare module '../../index' {
114
175
  longitude: number
115
176
  /** 位置名称 */
116
177
  name: string
178
+ /** 区县代码
179
+ * @supported alipay
180
+ */
181
+ adCode?: number
182
+ /** 区县名称
183
+ * @supported alipay
184
+ */
185
+ adName?: string
186
+ /** 城市代码
187
+ * @supported alipay
188
+ */
189
+ cityCode?: string
190
+ /** 城市名称
191
+ * @supported alipay
192
+ */
193
+ cityName?: string
194
+ /** 省份代码
195
+ * @supported alipay
196
+ */
197
+ provinceCode?: number
198
+ /** 省份名称
199
+ * @supported alipay
200
+ */
201
+ provinceName?: string
117
202
  /** 调用结果 */
118
203
  errMsg: string
119
204
  }
@@ -132,6 +217,10 @@ declare module '../../index' {
132
217
 
133
218
  namespace startLocationUpdateBackground {
134
219
  interface Option {
220
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
221
+ * @default "gcj02"
222
+ */
223
+ type?: string
135
224
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
136
225
  complete?: (res: TaroGeneral.CallbackResult) => void
137
226
  /** 接口调用失败的回调函数 */
@@ -143,6 +232,16 @@ declare module '../../index' {
143
232
 
144
233
  namespace startLocationUpdate {
145
234
  interface Option {
235
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 wx.openLocation 的坐标
236
+ * @default "gcj02"
237
+ */
238
+ type?: string
239
+ /** 针对 iOS14/Android12 及以上的新特性,其他情况本参数忽略。默认情况宿主是精确定位就返回精确定位信息。
240
+ * 传入 true 会强制使用精确定位信息,iOS14/Android12 及以上如果没有精确定位权限,会弹出精确定位授权弹框
241
+ * @supported swan
242
+ * @default false
243
+ */
244
+ needFullAccuracy?: boolean
146
245
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
147
246
  complete?: (res: TaroGeneral.CallbackResult) => void
148
247
  /** 接口调用失败的回调函数 */
@@ -161,6 +260,11 @@ declare module '../../index' {
161
260
  interface CallbackResult {
162
261
  /** 错误码 */
163
262
  errCode: number
263
+ /** 错误信息
264
+ * @supported tt
265
+ * @tt 最低支持版本 2.48.0
266
+ */
267
+ errMsg?: string
164
268
  }
165
269
  }
166
270
 
@@ -185,13 +289,50 @@ declare module '../../index' {
185
289
  speed: number
186
290
  /** 垂直精度,单位 m(Android 无法获取,返回 0) */
187
291
  verticalAccuracy: number
292
+ /** 街道名称
293
+ * @supported swan
294
+ */
295
+ street?: string
296
+ /** 城市编码
297
+ * @supported swan
298
+ */
299
+ cityCode?: string
300
+ /** 城市名称
301
+ * @supported swan, tt
302
+ * @tt iOS 不支持
303
+ */
304
+ city?: string
305
+ /** 国家
306
+ * @supported swan
307
+ */
308
+ country?: string
309
+ /** 国家代码
310
+ * @supported swan
311
+ */
312
+ countryCode?: string
313
+ /** 省份
314
+ * @supported swan
315
+ */
316
+ province?: string
317
+ /** 街道号码
318
+ * @supported swan
319
+ */
320
+ streetNumber?: string
321
+ /** 区
322
+ * @supported swan
323
+ */
324
+ district?: string
325
+ /** 是不是精确定位信息
326
+ * @supported swan
327
+ */
328
+ isFullAccuracy?: boolean
188
329
  }
189
330
  }
190
331
 
191
332
  namespace getFuzzyLocation {
192
333
  interface Option {
193
334
  /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
194
- type?: 'wgs84' | 'gcj02'
335
+ type?: keyof Type
195
336
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
196
337
  complete?: (res: TaroGeneral.CallbackResult) => void
197
338
  /** 接口调用失败的回调函数 */
@@ -200,6 +341,13 @@ declare module '../../index' {
200
341
  success?: (result: SuccessCallbackResult) => void
201
342
  }
202
343
 
344
+ interface Type {
345
+ /** 返回 gps 坐标 */
346
+ wgs84
347
+ /** 返回 gcj02 坐标*/
348
+ gcj02
349
+ }
350
+
203
351
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
204
352
  /** 纬度,范围为 -90~90,负数表示南纬 */
205
353
  latitude: number
@@ -210,7 +358,7 @@ declare module '../../index' {
210
358
 
211
359
  interface TaroStatic {
212
360
  /** 关闭监听实时位置变化,前后台都停止消息接收
213
- * @supported weapp, rn, tt
361
+ * @supported weapp, swan, tt, rn
214
362
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html
215
363
  */
216
364
  stopLocationUpdate(option?: stopLocationUpdate.Option): void
@@ -232,13 +380,13 @@ declare module '../../index' {
232
380
  *
233
381
  * **注意**
234
382
  * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
235
- * @supported weapp, rn, tt
383
+ * @supported weapp, swan, tt, rn
236
384
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html
237
385
  */
238
386
  startLocationUpdate(option?: startLocationUpdate.Option): void
239
387
 
240
388
  /** 使用微信内置地图查看位置
241
- * @supported weapp, h5, tt
389
+ * @supported weapp, alipay, swan, jd, tt, h5, harmony_hybrid
242
390
  * @example
243
391
  * ```tsx
244
392
  * Taro.getLocation({
@@ -268,7 +416,7 @@ declare module '../../index' {
268
416
  ): void
269
417
 
270
418
  /** 监听实时地理位置变化事件,需结合 Taro.startLocationUpdateBackground、Taro.startLocationUpdate 使用。
271
- * @supported weapp, rn, tt
419
+ * @supported weapp, swan, tt, rn
272
420
  * @example
273
421
  * ```tsx
274
422
  * const _locationChangeFn = function (res) {
@@ -290,16 +438,16 @@ declare module '../../index' {
290
438
  */
291
439
  offLocationChangeError(
292
440
  /** 监听持续定位接口返回失败时触发的回调函数 */
293
- callback: onLocationChangeError.Callback,
441
+ callback?: onLocationChangeError.Callback,
294
442
  ): void
295
443
 
296
444
  /** 取消监听实时地理位置变化事件
297
- * @supported weapp, rn, tt
445
+ * @supported weapp, swan, tt, rn
298
446
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html
299
447
  */
300
448
  offLocationChange(
301
449
  /** 实时地理位置变化事件的回调函数 */
302
- callback: (res: TaroGeneral.CallbackResult) => void,
450
+ callback?: onLocationChange.Callback,
303
451
  ): void
304
452
 
305
453
  /** 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。
@@ -307,7 +455,7 @@ declare module '../../index' {
307
455
  * **注意**
308
456
  * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
309
457
  * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
310
- * @supported weapp, rn, tt
458
+ * @supported weapp, swan, jd, qq, tt, rn, harmony_hybrid
311
459
  * @example
312
460
  * ```tsx
313
461
  * Taro.getLocation({
@@ -333,7 +481,7 @@ declare module '../../index' {
333
481
  /** 打开地图选择位置。
334
482
  *
335
483
  * `chooseLocation` api功能是依赖于腾讯位置服务,所以需要使用 api 密钥。如果您没有,可以前往腾讯位置服务[开发者控制台](https://lbs.qq.com/console/mykey.html?console=mykey)进行申请。
336
- * @supported weapp, h5, tt
484
+ * @supported weapp, alipay, swan, jd, tt, h5, harmony_hybrid
337
485
  * @example
338
486
  * ```tsx
339
487
  * // config/index.js
@@ -351,7 +499,7 @@ declare module '../../index' {
351
499
  chooseLocation(option: chooseLocation.Option): Promise<chooseLocation.SuccessCallbackResult>
352
500
 
353
501
  /** 获取当前的模糊地理位置
354
- * @supported weapp
502
+ * @supported weapp, harmony_hybrid
355
503
  * @example
356
504
  * ```tsx
357
505
  * Taro.getFuzzyLocation({
@@ -160,17 +160,17 @@ declare module '../../index' {
160
160
  /** `AudioContext` 实例,可通过 `Taro.createAudioContext` 获取。
161
161
  *
162
162
  * `AudioContext` 通过 `id` 跟一个 `audio` 组件绑定,操作对应的 audio 组件。
163
- * @supported weapp
163
+ * @supported weapp, harmony_hybrid
164
164
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.html
165
165
  */
166
166
  interface AudioContext {
167
167
  /** 暂停音频。
168
- * @supported weapp
168
+ * @supported weapp, harmony_hybrid
169
169
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.pause.html
170
170
  */
171
171
  pause(): void
172
172
  /** 播放音频。
173
- * @supported weapp
173
+ * @supported weapp, harmony_hybrid
174
174
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/AudioContext.play.html
175
175
  */
176
176
  play(): void
@@ -270,7 +270,7 @@ declare module '../../index' {
270
270
  /** origin: 发送完整的 referrer; no-referrer: 不发送 */
271
271
  referrerPolicy?: 'origin' | 'no-referrer' | string
272
272
  /** 播放
273
- * @supported weapp, h5, rn
273
+ * @supported weapp, h5, rn, harmony_hybrid
274
274
  */
275
275
  play(): void
276
276
  /** 暂停
@@ -278,7 +278,7 @@ declare module '../../index' {
278
278
  */
279
279
  pause(): void
280
280
  /** 停止
281
- * @supported weapp, h5, rn
281
+ * @supported weapp, h5, rn, harmony_hybrid
282
282
  */
283
283
  stop(): void
284
284
  /** 跳转到指定位置,单位 s
@@ -292,83 +292,83 @@ declare module '../../index' {
292
292
  /** 音频进入可以播放状态,但不保证后面可以流畅播放
293
293
  * @supported weapp, h5, rn
294
294
  */
295
- onCanplay(callback?: () => void): void
295
+ onCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
296
296
  /** 音频播放事件
297
- * @supported weapp, h5, rn
297
+ * @supported weapp, h5, rn, harmony_hybrid
298
298
  */
299
- onPlay(callback?: () => void): void
299
+ onPlay(callback?: InnerAudioContext.OnPlayCallback): void
300
300
  /** 音频暂停事件
301
301
  * @supported weapp, h5, rn
302
302
  */
303
- onPause(callback?: () => void): void
303
+ onPause(callback?: InnerAudioContext.OnPauseCallback): void
304
304
  /** 音频停止事件
305
- * @supported weapp, h5, rn
305
+ * @supported weapp, h5, rn, harmony_hybrid
306
306
  */
307
- onStop(callback?: () => void): void
307
+ onStop(callback?: InnerAudioContext.OnStopCallback): void
308
308
  /** 音频自然播放结束事件
309
- * @supported weapp, h5, rn
309
+ * @supported weapp, h5, rn, harmony_hybrid
310
310
  */
311
- onEnded(callback?: () => void): void
311
+ onEnded(callback?: InnerAudioContext.OnEndedCallback): void
312
312
  /** 音频播放进度更新事件
313
313
  * @supported weapp, h5, rn
314
314
  */
315
- onTimeUpdate(callback?: () => void): void
315
+ onTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
316
316
  /** 音频播放错误事件
317
- * @supported weapp, h5, rn
317
+ * @supported weapp, h5, rn, harmony_hybrid
318
318
  */
319
- onError(callback?: (res: InnerAudioContext.onErrorDetail) => void): void
319
+ onError(callback?: InnerAudioContext.OnErrorCallback): void
320
320
  /** 音频加载中事件,当音频因为数据不足,需要停下来加载时会触发
321
321
  * @supported weapp, h5, rn
322
322
  */
323
- onWaiting(callback?: () => void): void
323
+ onWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
324
324
  /** 音频进行 seek 操作事件
325
325
  * @supported weapp, h5, rn
326
326
  */
327
- onSeeking(callback?: () => void): void
327
+ onSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
328
328
  /** 音频完成 seek 操作事件
329
329
  * @supported weapp, h5, rn
330
330
  */
331
- onSeeked(callback?: () => void): void
332
- /** 取消监听 onCanplay 事件
331
+ onSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
332
+ /** 取消监听 canplay 事件
333
333
  * @supported weapp, h5, rn
334
334
  */
335
- offCanplay(callback?: () => void): void
336
- /** 取消监听 onPlay 事件
335
+ offCanplay(callback?: InnerAudioContext.OnCanplayCallback): void
336
+ /** 取消监听 play 事件
337
337
  * @supported weapp, h5, rn
338
338
  */
339
- offPlay(callback?: () => void): void
340
- /** 取消监听 onPause 事件
339
+ offPlay(callback?: InnerAudioContext.OnPlayCallback): void
340
+ /** 取消监听 pause 事件
341
341
  * @supported weapp, h5, rn
342
342
  */
343
- offPause(callback?: () => void): void
344
- /** 取消监听 onStop 事件
343
+ offPause(callback?: InnerAudioContext.OnPauseCallback): void
344
+ /** 取消监听 stop 事件
345
345
  * @supported weapp, h5, rn
346
346
  */
347
- offStop(callback?: () => void): void
348
- /** 取消监听 onEnded 事件
347
+ offStop(callback?: InnerAudioContext.OnStopCallback): void
348
+ /** 取消监听 ended 事件
349
349
  * @supported weapp, h5, rn
350
350
  */
351
- offEnded(callback?: () => void): void
352
- /** 取消监听 onTimeUpdate 事件
351
+ offEnded(callback?: InnerAudioContext.OnEndedCallback): void
352
+ /** 取消监听 timeUpdate 事件
353
353
  * @supported weapp, h5, rn
354
354
  */
355
- offTimeUpdate(callback?: () => void): void
356
- /** 取消监听 onError 事件
355
+ offTimeUpdate(callback?: InnerAudioContext.OnTimeUpdateCallback): void
356
+ /** 取消监听 error 事件
357
357
  * @supported weapp, h5, rn
358
358
  */
359
- offError(callback?: () => void): void
360
- /** 取消监听 onWaiting 事件
359
+ offError(callback?: InnerAudioContext.OnErrorCallback): void
360
+ /** 取消监听 waiting 事件
361
361
  * @supported weapp, h5, rn
362
362
  */
363
- offWaiting(callback?: () => void): void
364
- /** 取消监听 onSeeking 事件
363
+ offWaiting(callback?: InnerAudioContext.OnWaitingCallback): void
364
+ /** 取消监听 seeking 事件
365
365
  * @supported weapp, h5, rn
366
366
  */
367
- offSeeking(callback?: () => void): void
368
- /** 取消监听 onSeeked 事件
367
+ offSeeking(callback?: InnerAudioContext.OnSeekingCallback): void
368
+ /** 取消监听 seeked 事件
369
369
  * @supported weapp, h5, rn
370
370
  */
371
- offSeeked(callback?: () => void): void
371
+ offSeeked(callback?: InnerAudioContext.OnSeekedCallback): void
372
372
  }
373
373
 
374
374
  namespace InnerAudioContext {
@@ -391,6 +391,26 @@ declare module '../../index' {
391
391
  /** 未知错误 */
392
392
  '-1'
393
393
  }
394
+ /** 音频进入可以播放状态事件的回调函数 */
395
+ type OnCanplayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
396
+ /** 音频播放事件的回调函数 */
397
+ type OnPlayCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
398
+ /** 音频暂停事件的回调函数 */
399
+ type OnPauseCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
400
+ /** 音频停止事件的回调函数 */
401
+ type OnStopCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
402
+ /** 音频自然播放结束事件的回调函数 */
403
+ type OnEndedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
404
+ /** 音频播放进度更新事件的回调函数 */
405
+ type OnTimeUpdateCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
406
+ /** 音频播放错误事件的回调函数 */
407
+ type OnErrorCallback = (res: onErrorDetail) => void
408
+ /** 音频加载中事件的回调函数 */
409
+ type OnWaitingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
410
+ /** 音频进行 seek 操作事件的回调函数 */
411
+ type OnSeekingCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
412
+ /** 音频完成 seek 操作事件的回调函数 */
413
+ type OnSeekedCallback = (res: Partial<TaroGeneral.CallbackResult>) => void
394
414
  }
395
415
 
396
416
  /** MediaAudioPlayer 实例,可通过 [Taro.createMediaAudioPlayer](./createMediaAudioPlayer) 接口获取实例。
@@ -780,6 +800,15 @@ declare module '../../index' {
780
800
  setPosition(...args: any[]): void
781
801
  }
782
802
 
803
+ namespace createInnerAudioContext {
804
+ interface Option {
805
+ /** 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。
806
+ * @supported weapp
807
+ */
808
+ useWebAudioImplement: boolean
809
+ }
810
+ }
811
+
783
812
  interface TaroStatic {
784
813
  /** 结束播放语音。
785
814
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
@@ -943,7 +972,7 @@ declare module '../../index' {
943
972
  createMediaAudioPlayer(): MediaAudioPlayer
944
973
 
945
974
  /** 创建内部 audio 上下文 InnerAudioContext 对象。
946
- * @supported weapp, h5, rn, tt
975
+ * @supported weapp, h5, rn, tt, harmony_hybrid
947
976
  * @example
948
977
  * ```tsx
949
978
  * const innerAudioContext = Taro.createInnerAudioContext()
@@ -959,11 +988,11 @@ declare module '../../index' {
959
988
  * ```
960
989
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html
961
990
  */
962
- createInnerAudioContext(): InnerAudioContext
991
+ createInnerAudioContext(option?: createInnerAudioContext.Option): InnerAudioContext
963
992
 
964
993
  /** 创建 audio 上下文 AudioContext 对象。
965
994
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
966
- * @supported weapp
995
+ * @supported weapp, harmony_hybrid
967
996
  * @example
968
997
  * ```tsx
969
998
  * const audioCtx = Taro.createAudioContext('myAudio')
@@ -274,7 +274,7 @@ declare module '../../index' {
274
274
  * 小程序切入后台,如果音频处于播放状态,可以继续播放。但是后台状态不能通过调用API操纵音频的播放状态。
275
275
  *
276
276
  * 从微信客户端6.7.2版本开始,若需要在小程序切后台后继续播放音频,需要在 [app.json](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html) 中配置 `requiredBackgroundModes` 属性。开发版和体验版上可以直接生效,正式版还需通过审核。
277
- * @supported weapp, tt
277
+ * @supported weapp, tt, harmony_hybrid
278
278
  * @example
279
279
  * ```tsx
280
280
  * const backgroundAudioManager = Taro.getBackgroundAudioManager()
@@ -90,15 +90,15 @@ declare module '../../index' {
90
90
  * @supported alipay
91
91
  */
92
92
  height: string
93
- /** 视频文件的宽度。
93
+ /** 视频文件的宽度。
94
94
  * @supported alipay
95
95
  */
96
96
  width: string
97
- /** 视频文件的尺寸。
97
+ /** 视频文件的尺寸。
98
98
  * @supported alipay
99
99
  */
100
100
  size: string
101
- /** 录制的持续时间。
101
+ /** 录制的持续时间。
102
102
  * @supported alipay
103
103
  */
104
104
  duration: string
@@ -152,6 +152,8 @@ declare module '../../index' {
152
152
  normal
153
153
  /** 低质量 */
154
154
  low
155
+ /** 原图 */
156
+ original
155
157
  }
156
158
  }
157
159
 
@@ -192,6 +194,7 @@ declare module '../../index' {
192
194
 
193
195
  interface TaroStatic {
194
196
  /** 创建 camera 上下文 CameraContext 对象。
197
+ * @alipay 支付宝小程序需指定 camera 组件中的 id 属性
195
198
  * @supported weapp, rn, tt, alipay
196
199
  * @example
197
200
  * ```tsx
@@ -324,7 +324,7 @@ declare module '../../index' {
324
324
 
325
325
  interface TaroStatic {
326
326
  /** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
327
- * @supported weapp, alipay, swan, tt, h5, rn
327
+ * @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
328
328
  * @example
329
329
  * ```tsx
330
330
  * Taro.saveImageToPhotosAlbum({
@@ -348,7 +348,7 @@ declare module '../../index' {
348
348
  previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
349
349
 
350
350
  /** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
351
- * @supported weapp, alipay, swan, tt, h5, rn
351
+ * @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
352
352
  * @example
353
353
  * ```tsx
354
354
  * Taro.previewImage({
@@ -361,7 +361,7 @@ declare module '../../index' {
361
361
  previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
362
362
 
363
363
  /** 获取图片信息。网络图片需先配置download域名才能生效。
364
- * @supported weapp, alipay, swan, tt, h5, rn
364
+ * @supported weapp, alipay, swan, tt, h5, rn, harmony, harmony_hybrid
365
365
  * @example
366
366
  * ```tsx
367
367
  * Taro.getImageInfo({
@@ -421,7 +421,7 @@ declare module '../../index' {
421
421
  * type: 'image',
422
422
  * success: function (res) {
423
423
  * // tempFilePath可以作为img标签的src属性显示图片
424
- * const tempFilePaths = res.tempFilePaths
424
+ * const tempFilePaths = res.tempFiles
425
425
  * }
426
426
  * })
427
427
  * ```
@@ -431,7 +431,7 @@ declare module '../../index' {
431
431
 
432
432
  /**
433
433
  * 从本地相册选择图片或使用相机拍照。
434
- * @supported weapp, alipay, swan, tt, h5, rn
434
+ * @supported weapp, alipay, swan, tt, h5, rn, harmony_hybrid
435
435
  * @example
436
436
  * ```tsx
437
437
  * Taro.chooseImage({