@tarojs/taro 3.5.0-canary.1 → 3.5.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 (109) hide show
  1. package/html.css +50 -14
  2. package/html5.css +167 -64
  3. package/index.js +3 -4
  4. package/package.json +21 -11
  5. package/types/api/ad/index.d.ts +2 -2
  6. package/types/api/ai/face.d.ts +133 -0
  7. package/types/api/ai/visionkit.d.ts +303 -0
  8. package/types/api/base/crypto.d.ts +90 -0
  9. package/types/api/base/debug.d.ts +152 -13
  10. package/types/api/base/env.d.ts +2 -1
  11. package/types/api/base/index.d.ts +11 -3
  12. package/types/api/base/performance.d.ts +195 -0
  13. package/types/api/base/system.d.ts +541 -103
  14. package/types/api/base/update.d.ts +60 -8
  15. package/types/api/base/weapp/app-event.d.ts +99 -37
  16. package/types/api/base/weapp/life-cycle.d.ts +142 -2
  17. package/types/api/canvas/index.d.ts +151 -137
  18. package/types/api/cloud/index.d.ts +17 -2
  19. package/types/api/data-analysis/index.d.ts +1 -1
  20. package/types/api/device/accelerometer.d.ts +6 -6
  21. package/types/api/device/accessibility.d.ts +26 -0
  22. package/types/api/device/battery.d.ts +2 -2
  23. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  24. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  25. package/types/api/device/bluetooth.d.ts +67 -2
  26. package/types/api/device/calendar.d.ts +88 -0
  27. package/types/api/device/clipboard.d.ts +2 -2
  28. package/types/api/device/compass.d.ts +3 -3
  29. package/types/api/device/contact.d.ts +74 -50
  30. package/types/api/device/gyroscope.d.ts +6 -6
  31. package/types/api/device/iBeacon.d.ts +33 -19
  32. package/types/api/{ui → device}/keyboard.d.ts +1 -1
  33. package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
  34. package/types/api/device/motion.d.ts +3 -3
  35. package/types/api/device/network.d.ts +56 -15
  36. package/types/api/device/nfc.d.ts +1089 -13
  37. package/types/api/device/phone.d.ts +1 -1
  38. package/types/api/device/scan.d.ts +1 -1
  39. package/types/api/device/screen.d.ts +42 -14
  40. package/types/api/device/vibrate.d.ts +6 -2
  41. package/types/api/device/wifi.d.ts +44 -9
  42. package/types/api/ext/index.d.ts +2 -2
  43. package/types/api/files/index.d.ts +392 -205
  44. package/types/api/framework/index.d.ts +5 -4
  45. package/types/api/location/index.d.ts +156 -53
  46. package/types/api/media/audio.d.ts +629 -38
  47. package/types/api/media/background-audio.d.ts +9 -9
  48. package/types/api/media/camera.d.ts +41 -22
  49. package/types/api/media/editor.d.ts +22 -2
  50. package/types/api/media/image.d.ts +64 -35
  51. package/types/api/media/live.d.ts +66 -6
  52. package/types/api/media/map.d.ts +474 -54
  53. package/types/api/media/media-recorder.d.ts +92 -0
  54. package/types/api/media/recorder.d.ts +21 -21
  55. package/types/api/media/video-decoder.d.ts +117 -0
  56. package/types/api/media/video-processing.d.ts +11 -7
  57. package/types/api/media/video.d.ts +47 -18
  58. package/types/api/media/voip.d.ts +290 -0
  59. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
  60. package/types/api/network/download.d.ts +61 -19
  61. package/types/api/network/request.d.ts +129 -41
  62. package/types/api/network/tcp.d.ts +181 -0
  63. package/types/api/network/udp.d.ts +154 -83
  64. package/types/api/network/upload.d.ts +55 -28
  65. package/types/api/network/websocket.d.ts +20 -19
  66. package/types/api/open-api/address.d.ts +1 -1
  67. package/types/api/open-api/authorize.d.ts +42 -3
  68. package/types/api/open-api/channels.d.ts +178 -0
  69. package/types/api/open-api/facial.d.ts +3 -0
  70. package/types/api/open-api/favorites.d.ts +100 -0
  71. package/types/api/open-api/group.d.ts +59 -0
  72. package/types/api/open-api/invoice.d.ts +2 -2
  73. package/types/api/open-api/license-plate.d.ts +27 -0
  74. package/types/api/open-api/login.d.ts +21 -0
  75. package/types/api/open-api/redpackage.d.ts +24 -0
  76. package/types/api/open-api/settings.d.ts +82 -17
  77. package/types/api/open-api/soter.d.ts +2 -2
  78. package/types/api/open-api/subscribe-message.d.ts +89 -4
  79. package/types/api/open-api/user-info.d.ts +56 -19
  80. package/types/api/open-api/werun.d.ts +33 -6
  81. package/types/api/payment/index.d.ts +119 -0
  82. package/types/api/route/index.d.ts +18 -14
  83. package/types/api/share/index.d.ts +192 -9
  84. package/types/api/storage/index.d.ts +38 -92
  85. package/types/api/swan/index.d.ts +1 -1
  86. package/types/api/ui/animation.d.ts +105 -155
  87. package/types/api/ui/background.d.ts +4 -2
  88. package/types/api/ui/custom-component.d.ts +1 -1
  89. package/types/api/ui/fonts.d.ts +27 -31
  90. package/types/api/ui/interaction.d.ts +6 -6
  91. package/types/api/ui/menu.d.ts +1 -1
  92. package/types/api/ui/navigation-bar.d.ts +6 -5
  93. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  94. package/types/api/ui/scroll.d.ts +75 -7
  95. package/types/api/ui/sticky.d.ts +4 -4
  96. package/types/api/ui/tab-bar.d.ts +8 -8
  97. package/types/api/ui/window.d.ts +22 -2
  98. package/types/api/worker/index.d.ts +9 -1
  99. package/types/api/wxml/index.d.ts +116 -112
  100. package/types/compile.d.ts +57 -6
  101. package/types/global.d.ts +142 -111
  102. package/types/taro.api.d.ts +79 -62
  103. package/types/taro.component.d.ts +21 -65
  104. package/types/taro.config.d.ts +31 -0
  105. package/types/taro.extend.d.ts +31 -18
  106. package/types/taro.hooks.d.ts +55 -3
  107. package/types/taro.lifecycle.d.ts +21 -14
  108. package/LICENSE +0 -21
  109. package/types/api/open-api/payment.d.ts +0 -61
@@ -72,11 +72,11 @@ declare module '../../index' {
72
72
  /** 选定音频的长度(单位:s),只有在音乐播放中时返回 */
73
73
  duration: number
74
74
  /** 播放状态 */
75
- status: keyof status
75
+ status: keyof Status
76
76
  /** 调用结果 */
77
77
  errMsg: string
78
78
  }
79
- interface status {
79
+ interface Status {
80
80
  /** 暂停中 */
81
81
  0
82
82
  /** 播放中 */
@@ -86,16 +86,16 @@ declare module '../../index' {
86
86
  }
87
87
  }
88
88
 
89
- /** BackgroundAudioManager 实例,可通过 [Taro.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 获取。
89
+ /** BackgroundAudioManager 实例,可通过 [Taro.getBackgroundAudioManager](/docs/apis/media/background-audio/getBackgroundAudioManager) 获取。
90
90
  * @example
91
91
  * ```tsx
92
92
  * const backgroundAudioManager = Taro.getBackgroundAudioManager()
93
93
  * backgroundAudioManager.title = '此时此刻'
94
94
  * backgroundAudioManager.epname = '此时此刻'
95
95
  * backgroundAudioManager.singer = '许巍'
96
- * backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
96
+ * backgroundAudioManager.coverImgUrl = 'https://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
97
97
  * // 设置了 src 之后会自动播放
98
- * backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
98
+ * backgroundAudioManager.src = 'https://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46'
99
99
  * ```
100
100
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/BackgroundAudioManager.html
101
101
  */
@@ -252,7 +252,7 @@ declare module '../../index' {
252
252
  ): void
253
253
 
254
254
  /** 获取后台音乐播放状态。
255
- * **注意:1.2.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getBackgroundAudioManager](https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html) 接口**
255
+ * **注意:1.2.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.getBackgroundAudioManager](/docs/apis/media/background-audio/getBackgroundAudioManager) 接口**
256
256
  * @supported weapp
257
257
  * @example
258
258
  * ```tsx
@@ -274,15 +274,15 @@ 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
277
+ * @supported weapp, tt
278
278
  * @example
279
279
  * ```tsx
280
280
  * const backgroundAudioManager = Taro.getBackgroundAudioManager()
281
281
  * backgroundAudioManager.title = '此时此刻'
282
282
  * backgroundAudioManager.epname = '此时此刻'
283
283
  * backgroundAudioManager.singer = '许巍'
284
- * backgroundAudioManager.coverImgUrl = 'http://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
285
- * backgroundAudioManager.src = 'http://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' // 设置了 src 之后会自动播放
284
+ * backgroundAudioManager.coverImgUrl = 'https://y.gtimg.cn/music/photo_new/T002R300x300M000003rsKF44GyaSk.jpg?max_age=2592000'
285
+ * backgroundAudioManager.src = 'https://ws.stream.qqmusic.qq.com/M500001VfvsJ21xFqb.mp3?guid=ffffffff82def4af4b12b3cd9337d5e7&uin=346897220&vkey=6292F51E1E384E061FF02C31F716658E5C81F5594D561F2E88B854E81CAAB7806D5E4F103E55D33C16F3FAC506D1AB172DE8600B37E43FAD&fromtag=46' // 设置了 src 之后会自动播放
286
286
  * ```
287
287
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/background-audio/wx.getBackgroundAudioManager.html
288
288
  */
@@ -5,27 +5,12 @@ declare module '../../index' {
5
5
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.html
6
6
  */
7
7
  interface CameraContext {
8
- /** 开始录像
9
- * @supported weapp
10
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html
11
- */
12
- startRecord(option: CameraContext.StartRecordOption): void
13
- /** 结束录像
14
- * @supported weapp
15
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html
16
- */
17
- stopRecord(option?: CameraContext.StopRecordOption): void
18
- /** 拍摄照片
19
- * @supported weapp
20
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html
21
- */
22
- takePhoto(option: CameraContext.TakePhotoOption): void
23
8
  /** 获取 Camera 实时帧数据
24
9
  *
25
10
  * ****
26
11
  *
27
- * 注: 使用该接口需同时在 [camera](https://developers.weixin.qq.com/miniprogram/dev/component/camera.html) 组件属性中指定 frame-size。
28
- * @supported weapp
12
+ * 注: 使用该接口需同时在 [camera](/docs/components/media/camera) 组件属性中指定 frame-size。
13
+ * @supported weapp, tt
29
14
  * @example
30
15
  * ```tsx
31
16
  * const context = wx.createCameraContext()
@@ -40,9 +25,43 @@ declare module '../../index' {
40
25
  /** 回调函数 */
41
26
  callback: CameraContext.OnCameraFrameCallback,
42
27
  ): CameraFrameListener
28
+ /** 设置缩放级别
29
+ * @supported weapp, tt
30
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.setZoom.html
31
+ */
32
+ setZoom(option: CameraContext.SetZoomOption): void
33
+ /** 开始录像
34
+ * @supported weapp, rn, tt
35
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.startRecord.html
36
+ */
37
+ startRecord(option: CameraContext.StartRecordOption): void
38
+ /** 结束录像
39
+ * @supported weapp, rn, tt
40
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.stopRecord.html
41
+ */
42
+ stopRecord(option?: CameraContext.StopRecordOption): void
43
+ /** 拍摄照片
44
+ * @supported weapp, rn, tt
45
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraContext.takePhoto.html
46
+ */
47
+ takePhoto(option: CameraContext.TakePhotoOption): void
43
48
  }
44
49
 
45
50
  namespace CameraContext {
51
+ interface SetZoomOption {
52
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
53
+ complete?: (res: TaroGeneral.CallbackResult) => void
54
+ /** 接口调用失败的回调函数 */
55
+ fail?: (res: TaroGeneral.CallbackResult) => void
56
+ /** 接口调用成功的回调函数 */
57
+ success?: (res: StartRecordSuccessCallbackResult) => void
58
+ /** 缩放级别,范围[1, maxZoom]。zoom 可取小数,精确到小数后一位。maxZoom 可在 bindinitdone 返回值中获取。 */
59
+ zoom: number
60
+ }
61
+ interface StartRecordSuccessCallbackResult extends TaroGeneral.CallbackResult {
62
+ /** 实际设置的缩放级别。由于系统限制,某些机型可能无法设置成指定值,会改用最接近的可设值。 */
63
+ zoom: number
64
+ }
46
65
  interface StartRecordOption {
47
66
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
48
67
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -85,7 +104,7 @@ declare module '../../index' {
85
104
  /** 接口调用失败的回调函数 */
86
105
  fail?: (res: TaroGeneral.CallbackResult) => void
87
106
  /** 成像质量 */
88
- quality?: keyof quality
107
+ quality?: keyof Quality
89
108
  /** 接口调用成功的回调函数 */
90
109
  success?: (result: TakePhotoSuccessCallbackResult) => void
91
110
  }
@@ -105,7 +124,7 @@ declare module '../../index' {
105
124
  /** 图像数据矩形的宽度 */
106
125
  width: number
107
126
  }
108
- interface quality {
127
+ interface Quality {
109
128
  /** 高质量 */
110
129
  high
111
130
  /** 普通质量 */
@@ -120,12 +139,12 @@ declare module '../../index' {
120
139
  */
121
140
  interface CameraFrameListener {
122
141
  /** 开始监听帧数据
123
- * @supported weapp
142
+ * @supported weapp, tt
124
143
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.start.html
125
144
  */
126
145
  start(option?: CameraFrameListener.StartOption): void
127
146
  /** 停止监听帧数据
128
- * @supported weapp
147
+ * @supported weapp, tt
129
148
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/camera/CameraFrameListener.stop.html
130
149
  */
131
150
  stop(option?: CameraFrameListener.StopOption): void
@@ -152,7 +171,7 @@ declare module '../../index' {
152
171
 
153
172
  interface TaroStatic {
154
173
  /** 创建 camera 上下文 CameraContext 对象。
155
- * @supported weapp
174
+ * @supported weapp, rn, tt
156
175
  * @example
157
176
  * ```tsx
158
177
  * const cameraContext = Taro.createCameraContext()
@@ -3,6 +3,7 @@ import Taro from '../../index'
3
3
  declare module '../../index' {
4
4
  /** `EditorContext` 实例,可通过 `Taro.createSelectorQuery` 获取。
5
5
  * `EditorContext` 通过 `id` 跟一个 `editor` 组件绑定,操作对应的 `editor` 组件。
6
+ * @supported weapp
6
7
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html
7
8
  */
8
9
  interface EditorContext {
@@ -59,6 +60,11 @@ declare module '../../index' {
59
60
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getContents.html
60
61
  */
61
62
  getContents(option?: EditorContext.GetContentsOption): void
63
+ /** 获取编辑器已选区域内的纯文本内容。当编辑器失焦或未选中一段区间时,返回内容为空。
64
+ * @supported weapp
65
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.getSelectionText.html
66
+ */
67
+ getSelectionText(option?: EditorContext.getSelectionText.Option): void
62
68
  /** 插入分割线
63
69
  * @supported weapp
64
70
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.insertDivider.html
@@ -66,9 +72,9 @@ declare module '../../index' {
66
72
  insertDivider(option?: EditorContext.InsertDividerOption): void
67
73
  /** 插入图片。
68
74
  *
69
- * 地址为临时文件时,获取的编辑器html格式内容中 <img> 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
75
+ * 地址为临时文件时,获取的编辑器html格式内容中 `<img>` 标签增加属性 data-local,delta 格式内容中图片 attributes 属性增加 data-local 字段,该值为传入的临时文件地址。
70
76
  *
71
- * 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 <img> 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
77
+ * 开发者可选择在提交阶段上传图片到服务器,获取到网络地址后进行替换。替换时对于html内容应替换掉 `<img>` 的 src 值,对于 delta 内容应替换掉 `insert { image: abc }` 值。
72
78
  * @supported weapp
73
79
  * @example
74
80
  * ```tsx
@@ -139,6 +145,20 @@ declare module '../../index' {
139
145
  /** 接口调用成功的回调函数 */
140
146
  success?: (res: TaroGeneral.CallbackResult) => void
141
147
  }
148
+ namespace getSelectionText {
149
+ interface Option {
150
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
151
+ complete?: (res: TaroGeneral.CallbackResult) => void
152
+ /** 接口调用失败的回调函数 */
153
+ fail?: (res: TaroGeneral.CallbackResult) => void
154
+ /** 接口调用成功的回调函数 */
155
+ success?: (res: SuccessCallbackResult) => void
156
+ }
157
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
158
+ /** 纯文本内容 */
159
+ text: string
160
+ }
161
+ }
142
162
  interface InsertDividerOption {
143
163
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
144
164
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -77,7 +77,7 @@ declare module '../../index' {
77
77
  /** [拍照时设备方向](http://sylvana.net/jpegcrop/exif_orientation.html)
78
78
  * @default "up"
79
79
  */
80
- orientation: keyof orientation
80
+ orientation: keyof Orientation
81
81
  /** 图片的本地路径 */
82
82
  path: string
83
83
  /** 图片格式 */
@@ -88,7 +88,7 @@ declare module '../../index' {
88
88
  errMsg: string
89
89
  }
90
90
 
91
- interface orientation {
91
+ interface Orientation {
92
92
  /** 默认方向(手机横持拍照),对应 Exif 中的 1。或无 orientation 信息。 */
93
93
  'up'
94
94
  /** 同 up,但镜像翻转,对应 Exif 中的 2 */
@@ -108,6 +108,23 @@ declare module '../../index' {
108
108
  }
109
109
  }
110
110
 
111
+ namespace editImage {
112
+ interface Option {
113
+ /** 图片路径,图片的路径,支持本地路径、代码包路径 */
114
+ src: string
115
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
116
+ complete?: (res: TaroGeneral.CallbackResult) => void
117
+ /** 接口调用失败的回调函数 */
118
+ fail?: (res: TaroGeneral.CallbackResult) => void
119
+ /** 接口调用成功的回调函数 */
120
+ success?: (result: SuccessCallbackResult) => void
121
+ }
122
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
123
+ /** 编辑后图片的临时文件路径 (本地路径) */
124
+ tempFilePath: string
125
+ }
126
+ }
127
+
111
128
  namespace chooseImage {
112
129
  interface Option {
113
130
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -202,7 +219,7 @@ declare module '../../index' {
202
219
  /** 接口调用成功的回调函数 */
203
220
  success?: (result: SuccessCallbackResult) => void
204
221
  /** 所选的文件的类型 */
205
- type?: keyof selectType
222
+ type?: keyof SelectType
206
223
  }
207
224
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
208
225
  /** 返回选择的文件的本地临时文件对象数组 */
@@ -221,9 +238,9 @@ declare module '../../index' {
221
238
  /** 选择的文件的会话发送时间,Unix时间戳,工具暂不支持此属性 */
222
239
  time: number
223
240
  /** 选择的文件类型 */
224
- type: keyof selectedType
241
+ type: keyof SelectedType
225
242
  }
226
- interface selectType {
243
+ interface SelectType {
227
244
  /** 从所有文件选择 */
228
245
  all
229
246
  /** 只能选择视频文件 */
@@ -233,7 +250,7 @@ declare module '../../index' {
233
250
  /** 可以选择除了图片和视频之外的其它的文件 */
234
251
  file
235
252
  }
236
- interface selectedType {
253
+ interface SelectedType {
237
254
  /** 选择了视频文件 */
238
255
  video
239
256
  /** 选择了图片文件 */
@@ -245,7 +262,7 @@ declare module '../../index' {
245
262
 
246
263
  interface TaroStatic {
247
264
  /** 保存图片到系统相册。需要[用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.writePhotosAlbum
248
- * @supported weapp, rn, alipay, swan
265
+ * @supported weapp, rn, alipay, swan, tt
249
266
  * @example
250
267
  * ```tsx
251
268
  * Taro.saveImageToPhotosAlbum({
@@ -256,19 +273,6 @@ declare module '../../index' {
256
273
  */
257
274
  saveImageToPhotosAlbum(option: saveImageToPhotosAlbum.Option): Promise<TaroGeneral.CallbackResult>
258
275
 
259
- /** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
260
- * @supported weapp, h5, rn, alipay, swan
261
- * @example
262
- * ```tsx
263
- * Taro.previewImage({
264
- * current: '', // 当前显示图片的http链接
265
- * urls: [] // 需要预览的图片http链接列表
266
- * })
267
- * ```
268
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
269
- */
270
- previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
271
-
272
276
  /** 预览图片和视频。
273
277
  * @supported weapp
274
278
  * @example
@@ -281,8 +285,21 @@ declare module '../../index' {
281
285
  */
282
286
  previewMedia(option: previewMedia.Option): Promise<TaroGeneral.CallbackResult>
283
287
 
288
+ /** 在新页面中全屏预览图片。预览的过程中用户可以进行保存图片、发送给朋友等操作。
289
+ * @supported weapp, h5, rn, alipay, swan, tt
290
+ * @example
291
+ * ```tsx
292
+ * Taro.previewImage({
293
+ * current: '', // 当前显示图片的http链接
294
+ * urls: [] // 需要预览的图片http链接列表
295
+ * })
296
+ * ```
297
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.previewImage.html
298
+ */
299
+ previewImage(option: previewImage.Option): Promise<TaroGeneral.CallbackResult>
300
+
284
301
  /** 获取图片信息。网络图片需先配置download域名才能生效。
285
- * @supported weapp, h5, rn, alipay, swan
302
+ * @supported weapp, h5, rn, alipay, swan, tt
286
303
  * @example
287
304
  * ```tsx
288
305
  * Taro.getImageInfo({
@@ -308,27 +325,20 @@ declare module '../../index' {
308
325
  */
309
326
  getImageInfo(option: getImageInfo.Option): Promise<getImageInfo.SuccessCallbackResult>
310
327
 
311
- /**
312
- * 从本地相册选择图片或使用相机拍照。
313
- * @supported weapp, h5, rn, alipay, swan
328
+ /** 编辑图片接口
329
+ * @supported weapp
314
330
  * @example
315
331
  * ```tsx
316
- * Taro.chooseImage({
317
- * count: 1, // 默认9
318
- * sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
319
- * sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
320
- * success: function (res) {
321
- * // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
322
- * var tempFilePaths = res.tempFilePaths
323
- * }
332
+ * Taro.editImage({
333
+ * src: '', // 图片路径
324
334
  * })
325
335
  * ```
326
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
336
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.editImage.html
327
337
  */
328
- chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
338
+ editImage(option: editImage.Option): Promise<editImage.SuccessCallbackResult>
329
339
 
330
340
  /** 压缩图片接口,可选压缩质量
331
- * @supported weapp
341
+ * @supported weapp, rn, tt
332
342
  * @example
333
343
  * ```tsx
334
344
  * Taro.compressImage({
@@ -356,5 +366,24 @@ declare module '../../index' {
356
366
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseMessageFile.html
357
367
  */
358
368
  chooseMessageFile(option: chooseMessageFile.Option): Promise<chooseMessageFile.SuccessCallbackResult>
369
+
370
+ /**
371
+ * 从本地相册选择图片或使用相机拍照。
372
+ * @supported weapp, h5, rn, alipay, swan, tt
373
+ * @example
374
+ * ```tsx
375
+ * Taro.chooseImage({
376
+ * count: 1, // 默认9
377
+ * sizeType: ['original', 'compressed'], // 可以指定是原图还是压缩图,默认二者都有
378
+ * sourceType: ['album', 'camera'], // 可以指定来源是相册还是相机,默认二者都有,在H5浏览器端支持使用 `user` 和 `environment`分别指定为前后摄像头
379
+ * success: function (res) {
380
+ * // 返回选定照片的本地文件路径列表,tempFilePath可以作为img标签的src属性显示图片
381
+ * var tempFilePaths = res.tempFilePaths
382
+ * }
383
+ * })
384
+ * ```
385
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/image/wx.chooseImage.html
386
+ */
387
+ chooseImage(option: chooseImage.Option): Promise<chooseImage.SuccessCallbackResult>
359
388
  }
360
389
  }
@@ -44,9 +44,29 @@ declare module '../../index' {
44
44
  /** 接口调用成功的回调函数 */
45
45
  success?: (res: TaroGeneral.CallbackResult) => void
46
46
  }
47
+ interface SendMessageOption {
48
+ /** SEI消息 */
49
+ msg: string
50
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
51
+ complete?: (res: TaroGeneral.CallbackResult) => void
52
+ /** 接口调用失败的回调函数 */
53
+ fail?: (res: TaroGeneral.CallbackResult) => void
54
+ /** 接口调用成功的回调函数 */
55
+ success?: (res: TaroGeneral.CallbackResult) => void
56
+ }
47
57
  interface SetBGMVolumeOption {
48
58
  /** 音量大小,范围是 0-1 */
49
- volume: string
59
+ volume: number
60
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
61
+ complete?: (res: TaroGeneral.CallbackResult) => void
62
+ /** 接口调用失败的回调函数 */
63
+ fail?: (res: TaroGeneral.CallbackResult) => void
64
+ /** 接口调用成功的回调函数 */
65
+ success?: (res: TaroGeneral.CallbackResult) => void
66
+ }
67
+ interface SetMICVolumeOption {
68
+ /** 音量大小,范围是 0-1 */
69
+ volume: number
50
70
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
51
71
  complete?: (res: TaroGeneral.CallbackResult) => void
52
72
  /** 接口调用失败的回调函数 */
@@ -121,6 +141,7 @@ declare module '../../index' {
121
141
  }
122
142
  /** `LivePusherContext` 实例,可通过 `Taro.createLivePusherContext` 获取。
123
143
  * `LivePusherContext` 与页面内唯一的 `live-pusher` 组件绑定,操作对应的 `live-pusher` 组件。
144
+ * @supported weapp
124
145
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html
125
146
  */
126
147
  interface LivePusherContext {
@@ -149,11 +170,21 @@ declare module '../../index' {
149
170
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.resumeBGM.html
150
171
  */
151
172
  resumeBGM(option?: LivePusherContext.ResumeBGMOption): void
173
+ /** 发送SEI消息
174
+ * @supported weapp
175
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.sendMessage.html
176
+ */
177
+ sendMessage(option?: LivePusherContext.SendMessageOption): void
152
178
  /** 设置背景音音量
153
179
  * @supported weapp
154
180
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setBGMVolume.html
155
181
  */
156
182
  setBGMVolume(option: LivePusherContext.SetBGMVolumeOption): void
183
+ /** 设置麦克风音量
184
+ * @supported weapp
185
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.setMICVolume.html
186
+ */
187
+ setMICVolume(option: LivePusherContext.SetMICVolumeOption): void
157
188
  /** 快照
158
189
  * @supported weapp
159
190
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.snapshot.html
@@ -204,6 +235,14 @@ declare module '../../index' {
204
235
  /** 接口调用成功的回调函数 */
205
236
  success?: (res: TaroGeneral.CallbackResult) => void
206
237
  }
238
+ interface ExitPictureInPictureOption {
239
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
240
+ complete?: (res: TaroGeneral.CallbackResult) => void
241
+ /** 接口调用失败的回调函数 */
242
+ fail?: (res: TaroGeneral.CallbackResult) => void
243
+ /** 接口调用成功的回调函数 */
244
+ success?: (res: TaroGeneral.CallbackResult) => void
245
+ }
207
246
  interface MuteOption {
208
247
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
209
248
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -243,6 +282,14 @@ declare module '../../index' {
243
282
  /** 接口调用成功的回调函数 */
244
283
  success?: (res: TaroGeneral.CallbackResult) => void
245
284
  }
285
+ interface RequestPictureInPictureOption {
286
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
287
+ complete?: (res: TaroGeneral.CallbackResult) => void
288
+ /** 接口调用失败的回调函数 */
289
+ fail?: (res: TaroGeneral.CallbackResult) => void
290
+ /** 接口调用成功的回调函数 */
291
+ success?: (res: TaroGeneral.CallbackResult) => void
292
+ }
246
293
  interface ResumeOption {
247
294
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
248
295
  complete?: (res: TaroGeneral.CallbackResult) => void
@@ -281,6 +328,7 @@ declare module '../../index' {
281
328
 
282
329
  /** `LivePlayerContext` 实例,可通过 `Taro.createLivePlayerContext` 获取。
283
330
  * `LivePlayerContext` 通过 `id` 跟一个 `live-player` 组件绑定,操作对应的 `live-player` 组件。
331
+ * @supported weapp
284
332
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html
285
333
  */
286
334
  interface LivePlayerContext {
@@ -289,6 +337,11 @@ declare module '../../index' {
289
337
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitFullScreen.html
290
338
  */
291
339
  exitFullScreen(option?: LivePlayerContext.ExitFullScreenOption): void
340
+ /** 退出小窗,该方法可在任意页面调用
341
+ * @supported weapp
342
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.exitPictureInPicture.html
343
+ */
344
+ exitPictureInPicture(option?: LivePlayerContext.ExitPictureInPictureOption): void
292
345
  /** 静音
293
346
  * @supported weapp
294
347
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.mute.html
@@ -309,7 +362,14 @@ declare module '../../index' {
309
362
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestFullScreen.html
310
363
  */
311
364
  requestFullScreen(
312
- option: LivePlayerContext.RequestFullScreenOption,
365
+ option: LivePlayerContext.RequestFullScreenOption,
366
+ ): void
367
+ /** 进入全屏
368
+ * @supported weapp
369
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.requestPictureInPicture.html
370
+ */
371
+ requestPictureInPicture(
372
+ option: LivePlayerContext.RequestPictureInPictureOption,
313
373
  ): void
314
374
  /** 恢复
315
375
  * @supported weapp
@@ -329,20 +389,20 @@ declare module '../../index' {
329
389
  }
330
390
 
331
391
  interface TaroStatic {
332
- /** 创建 [live-pusher](https://developers.weixin.qq.com/miniprogram/dev/component/live-pusher.html) 上下文 [LivePusherContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePusherContext.html) 对象。
392
+ /** 创建 [live-pusher](/docs/components/media/live-pusher) 上下文 [LivePusherContext](/docs/apis/media/live/LivePusherContext) 对象。
333
393
  * @supported weapp
334
394
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePusherContext.html
335
395
  */
336
396
  createLivePusherContext(): LivePusherContext
337
397
 
338
- /** 创建 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 上下文 [LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html) 对象。
398
+ /** 创建 [live-player](/docs/components/media/live-player) 上下文 [LivePlayerContext](/docs/apis/media/live/LivePlayerContext) 对象。
339
399
  * @supported weapp
340
400
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/live/wx.createLivePlayerContext.html
341
401
  */
342
402
  createLivePlayerContext(
343
- /** [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件的 id */
403
+ /** [live-player](/docs/components/media/live-player) 组件的 id */
344
404
  id: string,
345
- /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](https://developers.weixin.qq.com/miniprogram/dev/component/live-player.html) 组件 */
405
+ /** 在自定义组件下,当前组件实例的this,以操作组件内 [live-player](/docs/components/media/live-player) 组件 */
346
406
  component?: TaroGeneral.IAnyObject,
347
407
  ): LivePlayerContext
348
408
  }