@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
@@ -16,7 +16,7 @@ declare module '../../index' {
16
16
 
17
17
  interface TaroStatic {
18
18
  /** 拨打电话
19
- * @supported weapp, h5, rn
19
+ * @supported weapp, h5, rn, tt
20
20
  * @example
21
21
  * ```tsx
22
22
  * Taro.makePhoneCall({
@@ -85,7 +85,7 @@ declare module '../../index' {
85
85
  interface TaroStatic {
86
86
  /**
87
87
  * 调起客户端扫码界面,扫码成功后返回对应的结果
88
- * @supported weapp, h5
88
+ * @supported weapp, h5, rn, tt
89
89
  * @example
90
90
  * ```tsx
91
91
  * // 允许从相机和相册扫码
@@ -1,6 +1,21 @@
1
1
  import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
+ namespace setVisualEffectOnCapture {
5
+ interface Option {
6
+ /** 截屏/录屏时的表现,仅支持 none / hidden,传入 hidden 则表示在截屏/录屏时隐藏屏幕
7
+ * @default "none"
8
+ */
9
+ visualEffect?: 'none' | 'hidden'
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: TaroGeneral.CallbackResult) => void
16
+ }
17
+ }
18
+
4
19
  namespace setScreenBrightness {
5
20
  interface Option {
6
21
  /** 屏幕亮度值,范围 0 ~ 1。0 最暗,1 最亮 */
@@ -31,6 +46,13 @@ declare module '../../index' {
31
46
  }
32
47
  }
33
48
 
49
+ namespace onUserCaptureScreen {
50
+ /** 用户主动截屏事件的回调函数 */
51
+ type Callback = (
52
+ result: TaroGeneral.CallbackResult,
53
+ ) => void
54
+ }
55
+
34
56
  namespace getScreenBrightness {
35
57
  interface Option {
36
58
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
@@ -48,8 +70,14 @@ declare module '../../index' {
48
70
  }
49
71
 
50
72
  interface TaroStatic {
73
+ /** 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用
74
+ * @supported weapp
75
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setVisualEffectOnCapture.html
76
+ */
77
+ setVisualEffectOnCapture(option: setVisualEffectOnCapture.Option): Promise<TaroGeneral.CallbackResult>
78
+
51
79
  /** 设置屏幕亮度。
52
- * @supported weapp, rn
80
+ * @supported weapp, rn, tt
53
81
  * @example
54
82
  * ```tsx
55
83
  * Taro.setScreenBrightness(params).then(...)
@@ -60,7 +88,7 @@ declare module '../../index' {
60
88
 
61
89
  /**
62
90
  * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
63
- * @supported weapp
91
+ * @supported weapp, rn, tt
64
92
  * @example
65
93
  * ```tsx
66
94
  * // 保持屏幕常亮
@@ -74,7 +102,7 @@ declare module '../../index' {
74
102
 
75
103
  /**
76
104
  * 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件
77
- * @supported weapp
105
+ * @supported weapp, tt
78
106
  * @example
79
107
  * ```tsx
80
108
  * Taro.onUserCaptureScreen(function (res) {
@@ -85,7 +113,16 @@ declare module '../../index' {
85
113
  */
86
114
  onUserCaptureScreen(
87
115
  /** 用户主动截屏事件的回调函数 */
88
- callback: (res: TaroGeneral.CallbackResult) => void,
116
+ callback: onUserCaptureScreen.Callback,
117
+ ): void
118
+
119
+ /** 用户主动截屏事件。取消事件监听。
120
+ * @supported weapp, tt
121
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
122
+ */
123
+ offUserCaptureScreen(
124
+ /** 用户主动截屏事件的回调函数 */
125
+ callback: onUserCaptureScreen.Callback,
89
126
  ): void
90
127
 
91
128
  /**
@@ -93,20 +130,11 @@ declare module '../../index' {
93
130
  *
94
131
  * **说明**
95
132
  * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
96
- * @supported weapp
133
+ * @supported weapp, rn, tt
97
134
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html
98
135
  */
99
136
  getScreenBrightness(
100
137
  option?: getScreenBrightness.Option
101
138
  ): Promise<getScreenBrightness.SuccessCallbackOption>
102
-
103
- /** 用户主动截屏事件。取消事件监听。
104
- * @supported weapp
105
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
106
- */
107
- offUserCaptureScreen(
108
- /** 用户主动截屏事件的回调函数 */
109
- callback: (...args: any[]) => any,
110
- ): void
111
139
  }
112
140
  }
@@ -3,6 +3,8 @@ import Taro from '../../index'
3
3
  declare module '../../index' {
4
4
  namespace vibrateShort {
5
5
  interface Option {
6
+ /** 震动强度类型,有效值为:heavy、medium、light */
7
+ type: 'heavy' | 'medium' | 'light'
6
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
9
  complete?: (res: TaroGeneral.CallbackResult) => void
8
10
  /** 接口调用失败的回调函数 */
@@ -25,7 +27,9 @@ declare module '../../index' {
25
27
 
26
28
  interface TaroStatic {
27
29
  /** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
28
- * @supported weapp, h5, rn
30
+ * @h5 不支持 type 参数
31
+ * @rn 不支持 type 参数
32
+ * @supported weapp, h5, rn, tt
29
33
  * @example
30
34
  * ```tsx
31
35
  * Taro.vibrateShort(params).then(...)
@@ -35,7 +39,7 @@ declare module '../../index' {
35
39
  vibrateShort(option?: vibrateShort.Option): Promise<TaroGeneral.CallbackResult>
36
40
 
37
41
  /** 使手机发生较长时间的振动(400ms)
38
- * @supported weapp, h5, rn
42
+ * @supported weapp, h5, rn, tt
39
43
  * @example
40
44
  * ```tsx
41
45
  * Taro.vibrateLong(params).then(...)
@@ -46,6 +46,17 @@ declare module '../../index' {
46
46
  }
47
47
  }
48
48
 
49
+ namespace onWifiConnectedWithPartialInfo {
50
+ /** 连接上 Wi-Fi 的事件的回调函数 */
51
+ type Callback = (
52
+ result: CallbackResult,
53
+ ) => void
54
+ interface CallbackResult {
55
+ /** 只包含 SSID 属性的 WifiInfo 对象 */
56
+ wifi: Pick<WifiInfo, 'SSID'>
57
+ }
58
+ }
59
+
49
60
  namespace onWifiConnected {
50
61
  /** 连接上 Wi-Fi 的事件的回调函数 */
51
62
  type Callback = (
@@ -111,16 +122,22 @@ declare module '../../index' {
111
122
  }
112
123
  }
113
124
 
114
- /** Wifi 信息 */
125
+ /** Wifi 信息
126
+ *
127
+ * 注意:
128
+ * 安卓 Taro.connectWifi / Taro.getConnectedWifi 若设置了 partialInfo:true ,或者调用了 Taro.onWifiConnectedWithPartialInfo 事件。将会返回只包含 SSID 属性的 WifiInfo 对象。 在某些情况下,可能 Wi-Fi 已经连接成功,但会因为获取不到完整的 WifiInfo 对象报错。具体错误信息为 errCode: 12010, errMsg: can't gain current wifi 。如果开发者不需要完整的 WifiInfo 对象,则可以通过采取上述策略解决报错问题。
129
+ */
115
130
  interface WifiInfo {
116
- /** Wi-Fi 的 BSSID */
117
- BSSID: string
118
131
  /** Wi-Fi 的 SSID */
119
132
  SSID: string
133
+ /** Wi-Fi 的 BSSID */
134
+ BSSID: string
120
135
  /** Wi-Fi 是否安全 */
121
136
  secure: boolean
122
- /** Wi-Fi 信号强度 */
137
+ /** Wi-Fi 信号强度, 安卓取值 0 ~ 100 ,iOS 取值 0 ~ 1 ,值越大强度越大 */
123
138
  signalStrength: number
139
+ /** Wi-Fi 频段单位 MHz */
140
+ frequency?: number
124
141
  }
125
142
 
126
143
  interface TaroStatic {
@@ -182,6 +199,15 @@ declare module '../../index' {
182
199
  */
183
200
  setWifiList(option: setWifiList.Option): Promise<TaroGeneral.WifiError>
184
201
 
202
+ /** 监听连接上 Wi-Fi 的事件
203
+ * @supported weapp
204
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnectedWithPartialInfo.html
205
+ */
206
+ onWifiConnectedWithPartialInfo(
207
+ /** 连接上 Wi-Fi 的事件的回调函数 */
208
+ callback: onWifiConnectedWithPartialInfo.Callback,
209
+ ): void
210
+
185
211
  /** 监听连接上 Wi-Fi 的事件。
186
212
  * @supported weapp
187
213
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html
@@ -192,7 +218,7 @@ declare module '../../index' {
192
218
  ): void
193
219
 
194
220
  /** 监听获取到 Wi-Fi 列表数据事件
195
- * @supported weapp
221
+ * @supported weapp, tt
196
222
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html
197
223
  */
198
224
  onGetWifiList(
@@ -200,6 +226,15 @@ declare module '../../index' {
200
226
  callback: onGetWifiList.Callback,
201
227
  ): void
202
228
 
229
+ /** 取消监听连接上 Wi-Fi 的事件
230
+ * @supported weapp
231
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnectedWithPartialInfo.html
232
+ */
233
+ offWifiConnectedWithPartialInfo(
234
+ /** 连接上 Wi-Fi 的事件的回调函数 */
235
+ callback: onWifiConnectedWithPartialInfo.Callback,
236
+ ): void
237
+
203
238
  /**
204
239
  * 取消监听连接上 Wi-Fi 的事件。
205
240
  * @supported weapp
@@ -207,23 +242,23 @@ declare module '../../index' {
207
242
  */
208
243
  offWifiConnected(
209
244
  /** 连接上 Wi-Fi 的事件的回调函数 */
210
- callback: (...args: any[]) => any,
245
+ callback: onWifiConnected.Callback,
211
246
  ): void
212
247
 
213
248
  /**
214
249
  * 取消监听获取到 Wi-Fi 列表数据事件。
215
- * @supported weapp
250
+ * @supported weapp, tt
216
251
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html
217
252
  */
218
253
  offGetWifiList(
219
254
  /** 获取到 Wi-Fi 列表数据事件的回调函数 */
220
- callback: (...args: any[]) => any,
255
+ callback: onGetWifiList.Callback,
221
256
  ): void
222
257
 
223
258
  /** 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
224
259
  *
225
260
  * iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
226
- * @supported weapp
261
+ * @supported weapp, tt
227
262
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html
228
263
  */
229
264
  getWifiList(option?: getWifiList.Option): Promise<TaroGeneral.WifiError>
@@ -31,7 +31,7 @@ declare module '../../index' {
31
31
  *
32
32
  * **Tips**
33
33
  * 1. 本接口暂时无法通过 Taro.canIUse 判断是否兼容,开发者需要自行判断 Taro.getExtConfigSync 是否存在来兼容
34
- * @supported weapp
34
+ * @supported weapp, tt
35
35
  * @example
36
36
  * ```tsx
37
37
  * let extConfig = Taro.getExtConfigSync? Taro.getExtConfigSync(): {}
@@ -46,7 +46,7 @@ declare module '../../index' {
46
46
  *
47
47
  * **Tips**
48
48
  * 1. 本接口暂时无法通过 Taro.canIUse 判断是否兼容,开发者需要自行判断 Taro.getExtConfig 是否存在来兼容
49
- * @supported weapp
49
+ * @supported weapp, tt
50
50
  * @example
51
51
  * ```tsx
52
52
  * if(Taro.getExtConfig) {