@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
@@ -16,7 +16,7 @@ declare module '../../index' {
16
16
 
17
17
  interface TaroStatic {
18
18
  /** 拨打电话
19
- * @supported weapp, h5, rn, tt
19
+ * @supported weapp, swan, jd, qq, tt, h5, rn, harmony, harmony_hybrid
20
20
  * @example
21
21
  * ```tsx
22
22
  * Taro.makePhoneCall({
@@ -7,7 +7,9 @@ declare module '../../index' {
7
7
  complete?: (res: TaroGeneral.CallbackResult) => void
8
8
  /** 接口调用失败的回调函数 */
9
9
  fail?: (res: TaroGeneral.CallbackResult) => void
10
- /** 是否只能从相机扫码,不允许从相册选择图片 */
10
+ /** 是否只能从相机扫码,不允许从相册选择图片
11
+ * @default false
12
+ */
11
13
  onlyFromCamera?: boolean
12
14
  /** 扫码类型 */
13
15
  scanType?: (keyof ScanType)[]
@@ -85,7 +87,7 @@ declare module '../../index' {
85
87
  interface TaroStatic {
86
88
  /**
87
89
  * 调起客户端扫码界面,扫码成功后返回对应的结果
88
- * @supported weapp, h5, rn, tt
90
+ * @supported weapp, swan, jd, qq, tt, h5, rn
89
91
  * @example
90
92
  * ```tsx
91
93
  * // 允许从相机和相册扫码
@@ -94,7 +96,7 @@ declare module '../../index' {
94
96
  * console.log(res)
95
97
  * }
96
98
  * })
97
- * // 只允许从相机扫码
99
+ * // 只允许从相机扫码
98
100
  * Taro.scanCode({
99
101
  * onlyFromCamera: true,
100
102
  * success: (res) => {
@@ -77,10 +77,10 @@ declare module '../../index' {
77
77
  success?: (option: SuccessCallbackResult) => void
78
78
  }
79
79
  interface ScreenRecordingState {
80
- /** 开始录屏 */
81
- start
82
- /** 结束录屏 */
83
- stop
80
+ /** 开启 */
81
+ on
82
+ /** 关闭 */
83
+ off
84
84
  }
85
85
  interface SuccessCallbackResult {
86
86
  /** 录屏状态 */
@@ -106,13 +106,13 @@ declare module '../../index' {
106
106
 
107
107
  interface TaroStatic {
108
108
  /** 设置截屏/录屏时屏幕表现,仅支持在 Android 端调用
109
- * @supported weapp
109
+ * @supported weapp, alipay
110
110
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.setVisualEffectOnCapture.html
111
111
  */
112
112
  setVisualEffectOnCapture(option: setVisualEffectOnCapture.Option): Promise<TaroGeneral.CallbackResult>
113
113
 
114
114
  /** 设置屏幕亮度。
115
- * @supported weapp, rn, tt
115
+ * @supported weapp, swan, jd, qq, tt, rn
116
116
  * @example
117
117
  * ```tsx
118
118
  * Taro.setScreenBrightness(params).then(...)
@@ -123,7 +123,7 @@ declare module '../../index' {
123
123
 
124
124
  /**
125
125
  * 设置是否保持常亮状态。仅在当前小程序生效,离开小程序后设置失效。
126
- * @supported weapp, rn, tt
126
+ * @supported weapp, alipay, swan, jd, qq, tt, rn, harmony_hybrid
127
127
  * @example
128
128
  * ```tsx
129
129
  * // 保持屏幕常亮
@@ -137,7 +137,7 @@ declare module '../../index' {
137
137
 
138
138
  /**
139
139
  * 监听用户主动截屏事件,用户使用系统截屏按键截屏时触发此事件
140
- * @supported weapp, tt
140
+ * @supported weapp, alipay, swan, jd, tt, harmony_hybrid
141
141
  * @example
142
142
  * ```tsx
143
143
  * Taro.onUserCaptureScreen(function (res) {
@@ -154,6 +154,14 @@ declare module '../../index' {
154
154
  /** 监听用户录屏事件
155
155
  * @supported weapp
156
156
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.onScreenRecordingStateChanged.html
157
+ * @example
158
+ * ```tsx
159
+ * // 监听用户录屏事件
160
+ * const handler = function (res) {
161
+ * console.log(res.state)
162
+ * }
163
+ * Taro.onScreenRecordingStateChanged(handler)
164
+ * ```
157
165
  */
158
166
  onScreenRecordingStateChanged(
159
167
  /** 用户录屏事件的监听函数 */
@@ -161,7 +169,7 @@ declare module '../../index' {
161
169
  ): void
162
170
 
163
171
  /** 用户主动截屏事件。取消事件监听。
164
- * @supported weapp, tt
172
+ * @supported weapp, alipay, swan, jd, tt
165
173
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offUserCaptureScreen.html
166
174
  */
167
175
  offUserCaptureScreen(
@@ -171,16 +179,24 @@ declare module '../../index' {
171
179
 
172
180
  /** 取消用户录屏事件的监听函数
173
181
  * @supported weapp
174
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html
182
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.offScreenRecordingStateChanged.html
175
183
  */
176
184
  offScreenRecordingStateChanged(
177
185
  /** 用户录屏事件的监听函数 */
178
- callback: onScreenRecordingStateChanged.Callback
186
+ callback?: onScreenRecordingStateChanged.Callback
179
187
  ): void
180
188
 
181
189
  /** 查询用户是否在录屏
182
190
  * @supported weapp
183
191
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenRecordingState.html
192
+ * @example
193
+ * ```tsx
194
+ * Taro.getScreenRecordingState({
195
+ * success: function (res) {
196
+ * console.log(res.state)
197
+ * },
198
+ * })
199
+ * ```
184
200
  */
185
201
  getScreenRecordingState(
186
202
  option?: getScreenRecordingState.Option
@@ -191,7 +207,7 @@ declare module '../../index' {
191
207
  *
192
208
  * **说明**
193
209
  * - 若安卓系统设置中开启了自动调节亮度功能,则屏幕亮度会根据光线自动调整,该接口仅能获取自动调节亮度之前的值,而非实时的亮度值。
194
- * @supported weapp, rn, tt
210
+ * @supported weapp, alipay, swan, jd, qq, rn, harmony
195
211
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/screen/wx.getScreenBrightness.html
196
212
  */
197
213
  getScreenBrightness(
@@ -18,7 +18,7 @@ declare module '../../index' {
18
18
 
19
19
  interface TaroStatic {
20
20
  /** 拉起手机发送短信界面
21
- * @supported weap
21
+ * @supported weapp, tt
22
22
  * @see declare module '../../index'
23
23
  */
24
24
  sendSms(option: sendSms.Option): Promise<TaroGeneral.CallbackResul>
@@ -4,7 +4,7 @@ declare module '../../index' {
4
4
  namespace vibrateShort {
5
5
  interface Option {
6
6
  /** 震动强度类型,有效值为:heavy、medium、light */
7
- type: 'heavy' | 'medium' | 'light'
7
+ type?: 'heavy' | 'medium' | 'light'
8
8
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
9
9
  complete?: (res: TaroGeneral.CallbackResult) => void
10
10
  /** 接口调用失败的回调函数 */
@@ -27,9 +27,9 @@ declare module '../../index' {
27
27
 
28
28
  interface TaroStatic {
29
29
  /** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
30
- * @h5 不支持 type 参数
31
- * @rn 不支持 type 参数
32
- * @supported weapp, h5, rn, tt
30
+ *
31
+ * 仅微信小程序平台支持 type 参数
32
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
33
33
  * @example
34
34
  * ```tsx
35
35
  * Taro.vibrateShort(params).then(...)
@@ -39,7 +39,7 @@ declare module '../../index' {
39
39
  vibrateShort(option?: vibrateShort.Option): Promise<TaroGeneral.CallbackResult>
40
40
 
41
41
  /** 使手机发生较长时间的振动(400ms)
42
- * @supported weapp, h5, rn, tt
42
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
43
43
  * @example
44
44
  * ```tsx
45
45
  * Taro.vibrateLong(params).then(...)
@@ -90,6 +90,10 @@ declare module '../../index' {
90
90
 
91
91
  namespace getConnectedWifi {
92
92
  interface Option {
93
+ /** 是否需要返回部分 Wi-Fi 信息
94
+ * @default false
95
+ */
96
+ partialInfo?: boolean
93
97
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
94
98
  complete?: (res: TaroGeneral.WifiError) => void
95
99
  /** 接口调用失败的回调函数 */
@@ -113,6 +117,14 @@ declare module '../../index' {
113
117
  password: string
114
118
  /** Wi-Fi 设备 BSSID */
115
119
  BSSID?: string
120
+ /** 跳转到系统设置页进行连接
121
+ * @default false
122
+ */
123
+ maunal?: boolean
124
+ /** 是否需要返回部分 Wi-Fi 信息,仅安卓生效
125
+ * @default false
126
+ */
127
+ partialInfo?: boolean
116
128
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
117
129
  complete?: (res: TaroGeneral.WifiError) => void
118
130
  /** 接口调用失败的回调函数 */
@@ -142,7 +154,7 @@ declare module '../../index' {
142
154
 
143
155
  interface TaroStatic {
144
156
  /** 关闭 Wi-Fi 模块。
145
- * @supported weapp
157
+ * @supported weapp, alipay, swan, jd
146
158
  * @example
147
159
  * ```tsx
148
160
  * Taro.stopWifi({
@@ -156,7 +168,7 @@ declare module '../../index' {
156
168
  stopWifi(option?: stopWifi.Option): Promise<TaroGeneral.WifiError>
157
169
 
158
170
  /** 初始化 Wi-Fi 模块。
159
- * @supported weapp
171
+ * @supported weapp, alipay, swan, jd
160
172
  * @example
161
173
  * ```tsx
162
174
  * Taro.startWifi({
@@ -175,7 +187,7 @@ declare module '../../index' {
175
187
  * - 该接口只能在 `onGetWifiList` 回调之后才能调用。
176
188
  * - 此时客户端会挂起,等待小程序设置 Wi-Fi 信息,请务必尽快调用该接口,若无数据请传入一个空数组。
177
189
  * - 有可能随着周边 Wi-Fi 列表的刷新,单个流程内收到多次带有存在重复的 Wi-Fi 列表的回调。
178
- * @supported weapp
190
+ * @supported weapp, swan, jd
179
191
  * @example
180
192
  * ```tsx
181
193
  * Taro.onGetWifiList(function (res) {
@@ -209,7 +221,7 @@ declare module '../../index' {
209
221
  ): void
210
222
 
211
223
  /** 监听连接上 Wi-Fi 的事件。
212
- * @supported weapp
224
+ * @supported weapp, alipay, swan, jd
213
225
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onWifiConnected.html
214
226
  */
215
227
  onWifiConnected(
@@ -218,7 +230,7 @@ declare module '../../index' {
218
230
  ): void
219
231
 
220
232
  /** 监听获取到 Wi-Fi 列表数据事件
221
- * @supported weapp, tt
233
+ * @supported weapp, alipay, swan, jd, tt
222
234
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.onGetWifiList.html
223
235
  */
224
236
  onGetWifiList(
@@ -232,39 +244,39 @@ declare module '../../index' {
232
244
  */
233
245
  offWifiConnectedWithPartialInfo(
234
246
  /** 连接上 Wi-Fi 的事件的回调函数 */
235
- callback: onWifiConnectedWithPartialInfo.Callback,
247
+ callback?: onWifiConnectedWithPartialInfo.Callback,
236
248
  ): void
237
249
 
238
250
  /**
239
251
  * 取消监听连接上 Wi-Fi 的事件。
240
- * @supported weapp
252
+ * @supported weapp, alipay, swan, jd
241
253
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offWifiConnected.html
242
254
  */
243
255
  offWifiConnected(
244
256
  /** 连接上 Wi-Fi 的事件的回调函数 */
245
- callback: onWifiConnected.Callback,
257
+ callback?: onWifiConnected.Callback,
246
258
  ): void
247
259
 
248
260
  /**
249
261
  * 取消监听获取到 Wi-Fi 列表数据事件。
250
- * @supported weapp, tt
262
+ * @supported weapp, alipay, swan, jd, tt
251
263
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.offGetWifiList.html
252
264
  */
253
265
  offGetWifiList(
254
266
  /** 获取到 Wi-Fi 列表数据事件的回调函数 */
255
- callback: onGetWifiList.Callback,
267
+ callback?: onGetWifiList.Callback,
256
268
  ): void
257
269
 
258
270
  /** 请求获取 Wi-Fi 列表。在 `onGetWifiList` 注册的回调中返回 `wifiList` 数据。 **Android 调用前需要 [用户授权](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/authorize.html) scope.userLocation。**
259
271
  *
260
272
  * iOS 将跳转到系统的 Wi-Fi 界面,Android 不会跳转。 iOS 11.0 及 iOS 11.1 两个版本因系统问题,该方法失效。但在 iOS 11.2 中已修复。
261
- * @supported weapp, tt
273
+ * @supported weapp, alipay, swan, jd, tt
262
274
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getWifiList.html
263
275
  */
264
276
  getWifiList(option?: getWifiList.Option): Promise<TaroGeneral.WifiError>
265
277
 
266
278
  /** 获取已连接中的 Wi-Fi 信息。
267
- * @supported weapp
279
+ * @supported weapp, alipay, swan, tt
268
280
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.getConnectedWifi.html
269
281
  */
270
282
  getConnectedWifi(option?: getConnectedWifi.Option): Promise<TaroGeneral.WifiError>
@@ -281,7 +293,7 @@ declare module '../../index' {
281
293
  * }
282
294
  * })
283
295
  * ```
284
- * @supported weapp
296
+ * @supported weapp, alipay, swan, jd
285
297
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/wifi/wx.connectWifi.html
286
298
  */
287
299
  connectWifi(option: connectWifi.Option): Promise<TaroGeneral.WifiError>