@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
@@ -3,10 +3,11 @@ import Taro from '../../index'
3
3
  declare module '../../index' {
4
4
  /** 注册小程序中的一个页面。接受一个 `Object` 类型参数,其指定页面的初始数据、生命周期回调、事件处理函数等。 */
5
5
  interface Page {
6
- /**
7
- * 当前页面的路径
6
+ /** 当前页面的路径
7
+ * @note 推荐使用 Taro.getCurrentInstance().router?.path 方法
8
8
  */
9
- route: string
9
+ route?: string
10
+ __route__?: string
10
11
  /** @ignore */
11
12
  [k: string]: any
12
13
  }
@@ -32,7 +33,7 @@ declare module '../../index' {
32
33
  * __注意:__
33
34
  * - __不要尝试修改页面栈,会导致路由以及页面状态错误。__
34
35
  * - 不要在 `App.onLaunch` 的时候调用 `getCurrentPages()`,此时 `page` 还没有生成。
35
- * @supported weapp, h5
36
+ * @supported weapp, h5, rn, tt
36
37
  * @example
37
38
  * ```tsx
38
39
  * Taro.getCurrentPages().length
@@ -59,18 +59,50 @@ declare module '../../index' {
59
59
  }
60
60
  }
61
61
 
62
- namespace chooseLocation {
62
+ namespace choosePoi {
63
63
  interface Option {
64
64
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
65
65
  complete?: (res: TaroGeneral.CallbackResult) => void
66
66
  /** 接口调用失败的回调函数 */
67
67
  fail?: (res: TaroGeneral.CallbackResult) => void
68
+ /** 接口调用成功的回调函数 */
69
+ success?: (result: SuccessCallbackResult) => void
70
+ }
71
+
72
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
73
+ /** 选择城市时,值为 1,选择精确位置时,值为 2 */
74
+ type: number
75
+ /** 城市名称 */
76
+ city: number
77
+ /** 位置名称 */
78
+ name: string
79
+ /** 详细地址 */
80
+ address: string
81
+ /** 纬度,浮点数,范围为-90~90,负数表示南纬。使用 gcj02 国测局坐标系 */
82
+ latitude: string
83
+ /** 经度,浮点数,范围为-180~180,负数表示西经。使用 gcj02 国测局坐标系 */
84
+ longitude: string
85
+ }
86
+ }
87
+
88
+ namespace chooseLocation {
89
+ interface Option {
68
90
  /** 目标地纬度 */
69
91
  latitude?: number
70
92
  /** 目标地经度 */
71
93
  longitude?: number
94
+ /** 地图选点组件参数
95
+ * @supported h5
96
+ * @h5 仅支持 H5 使用
97
+ * @see https://lbs.qq.com/webApi/component/componentGuide/componentPicker
98
+ */
99
+ mapOpts?: Record<string, unknown>
72
100
  /** 接口调用成功的回调函数 */
73
101
  success?: (result: SuccessCallbackResult) => void
102
+ /** 接口调用失败的回调函数 */
103
+ fail?: (res: TaroGeneral.CallbackResult) => void
104
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
105
+ complete?: (res: TaroGeneral.CallbackResult) => void
74
106
  }
75
107
 
76
108
  interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
@@ -120,6 +152,18 @@ declare module '../../index' {
120
152
  }
121
153
  }
122
154
 
155
+ namespace onLocationChangeError {
156
+ /** 监听持续定位接口返回失败时触发的回调函数 */
157
+ type Callback = (
158
+ result: CallbackResult,
159
+ ) => void
160
+
161
+ interface CallbackResult {
162
+ /** 错误码 */
163
+ errCode: number
164
+ }
165
+ }
166
+
123
167
  namespace onLocationChange {
124
168
  /** 实时地理位置变化事件的回调函数 */
125
169
  type Callback = (
@@ -144,9 +188,57 @@ declare module '../../index' {
144
188
  }
145
189
  }
146
190
 
191
+ namespace getFuzzyLocation {
192
+ interface Option {
193
+ /** wgs84 返回 gps 坐标,gcj02 返回可用于 Taro.openLocation 的坐标 */
194
+ type?: 'wgs84' | 'gcj02'
195
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
196
+ complete?: (res: TaroGeneral.CallbackResult) => void
197
+ /** 接口调用失败的回调函数 */
198
+ fail?: (res: TaroGeneral.CallbackResult) => void
199
+ /** 接口调用成功的回调函数 */
200
+ success?: (result: SuccessCallbackResult) => void
201
+ }
202
+
203
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
204
+ /** 纬度,范围为 -90~90,负数表示南纬 */
205
+ latitude: string
206
+ /** 经度,范围为 -180~180,负数表示西经 */
207
+ longitude: string
208
+ }
209
+ }
210
+
147
211
  interface TaroStatic {
212
+ /** 关闭监听实时位置变化,前后台都停止消息接收
213
+ * @supported weapp, rn, tt
214
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html
215
+ */
216
+ stopLocationUpdate(option?: stopLocationUpdate.Option): void
217
+
218
+ /** 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权](./apis/open-api/authorize/authorize.md#后台定位)。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
219
+ *
220
+ * **注意**
221
+ * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
222
+ * - 需在app.json中配置requiredBackgroundModes: ['location']后使用
223
+ * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
224
+ * @supported weapp
225
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html
226
+ */
227
+ startLocationUpdateBackground(
228
+ option?: startLocationUpdateBackground.Option,
229
+ ): void
230
+
231
+ /** 开启小程序进入前台时接收位置消息
232
+ *
233
+ * **注意**
234
+ * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
235
+ * @supported weapp, rn, tt
236
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html
237
+ */
238
+ startLocationUpdate(option?: startLocationUpdate.Option): void
239
+
148
240
  /** 使用微信内置地图查看位置
149
- * @supported weapp, h5
241
+ * @supported weapp, h5, tt
150
242
  * @example
151
243
  * ```tsx
152
244
  * Taro.getLocation({
@@ -166,12 +258,56 @@ declare module '../../index' {
166
258
  */
167
259
  openLocation(option: openLocation.Option): Promise<TaroGeneral.CallbackResult>
168
260
 
261
+ /** 监听持续定位接口返回失败时触发
262
+ * @supported weapp, tt
263
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChangeError.html
264
+ */
265
+ onLocationChangeError(
266
+ /** 监听持续定位接口返回失败时触发的回调函数 */
267
+ callback: onLocationChangeError.Callback,
268
+ ): void
269
+
270
+ /** 监听实时地理位置变化事件,需结合 Taro.startLocationUpdateBackground、Taro.startLocationUpdate 使用。
271
+ * @supported weapp, rn, tt
272
+ * @example
273
+ * ```tsx
274
+ * const _locationChangeFn = function (res) {
275
+ * console.log('location change', res)
276
+ * }
277
+ * Taro.onLocationChange(_locationChangeFn)
278
+ * Taro.offLocationChange(_locationChangeFn)
279
+ * ```
280
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html
281
+ */
282
+ onLocationChange(
283
+ /** 实时地理位置变化事件的回调函数 */
284
+ callback: onLocationChange.Callback,
285
+ ): void
286
+
287
+ /** 取消监听持续定位接口返回失败时触发
288
+ * @supported weapp, tt
289
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChangeError.html
290
+ */
291
+ offLocationChangeError(
292
+ /** 监听持续定位接口返回失败时触发的回调函数 */
293
+ callback: onLocationChangeError.Callback,
294
+ ): void
295
+
296
+ /** 取消监听实时地理位置变化事件
297
+ * @supported weapp, rn, tt
298
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html
299
+ */
300
+ offLocationChange(
301
+ /** 实时地理位置变化事件的回调函数 */
302
+ callback: (res: TaroGeneral.CallbackResult) => void,
303
+ ): void
304
+
169
305
  /** 获取当前的地理位置、速度。当用户离开小程序后,此接口无法调用。开启高精度定位,接口耗时会增加,可指定 highAccuracyExpireTime 作为超时时间。
170
306
  *
171
307
  * **注意**
172
308
  * - 工具中定位模拟使用IP定位,可能会有一定误差。且工具目前仅支持 gcj02 坐标。
173
309
  * - 使用第三方服务进行逆地址解析时,请确认第三方服务默认的坐标系,正确进行坐标转换。
174
- * @supported weapp
310
+ * @supported weapp, rn, tt
175
311
  * @example
176
312
  * ```tsx
177
313
  * Taro.getLocation({
@@ -188,12 +324,17 @@ declare module '../../index' {
188
324
  */
189
325
  getLocation(option: getLocation.Option): Promise<getLocation.SuccessCallbackResult>
190
326
 
327
+ /** 打开POI列表选择位置,支持模糊定位(精确到市)和精确定位混选。
328
+ * @supported weapp
329
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.choosePoi.html
330
+ */
331
+ choosePoi(option: choosePoi.Option): Promise<choosePoi.SuccessCallbackResult>
332
+
191
333
  /** 打开地图选择位置。
192
334
  *
193
335
  * `chooseLocation` api功能是依赖于腾讯位置服务,所以需要使用 api 密钥。如果您没有,可以前往腾讯位置服务[开发者控制台](https://lbs.qq.com/console/mykey.html?console=mykey)进行申请。
194
- * @supported weapp, h5
336
+ * @supported weapp, h5, tt
195
337
  * @example
196
- *
197
338
  * ```tsx
198
339
  * // config/index.js
199
340
  *
@@ -209,58 +350,20 @@ declare module '../../index' {
209
350
  */
210
351
  chooseLocation(option: chooseLocation.Option): Promise<chooseLocation.SuccessCallbackResult>
211
352
 
212
- /** 关闭监听实时位置变化,前后台都停止消息接收
213
- * @supported weapp
214
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.stopLocationUpdate.html
215
- */
216
- stopLocationUpdate(option?: stopLocationUpdate.Option): void
217
-
218
- /** 开启小程序进入前后台时均接收位置消息,需引导用户开启[授权]((open-ability/authorize#后台定位))。授权以后,小程序在运行中或进入后台均可接受位置消息变化。
219
- *
220
- * **注意**
221
- * - 安卓微信7.0.6版本,iOS 7.0.5版本起支持该接口
222
- * - 需在app.json中配置requiredBackgroundModes: ['location']后使用
223
- * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
224
- * @supported weapp
225
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdateBackground.html
226
- */
227
- startLocationUpdateBackground(
228
- option?: startLocationUpdateBackground.Option,
229
- ): void
230
-
231
- /** 开启小程序进入前台时接收位置消息
232
- *
233
- * **注意**
234
- * - 获取位置信息需配置[地理位置用途说明](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#permission)。
235
- * @supported weapp
236
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.startLocationUpdate.html
237
- */
238
- startLocationUpdate(option?: startLocationUpdate.Option): void
239
-
240
- /** 监听实时地理位置变化事件,需结合 Taro.startLocationUpdateBackground、Taro.startLocationUpdate 使用。
353
+ /** 获取当前的模糊地理位置
241
354
  * @supported weapp
242
355
  * @example
243
356
  * ```tsx
244
- * const _locationChangeFn = function (res) {
245
- * console.log('location change', res)
246
- * }
247
- * Taro.onLocationChange(_locationChangeFn)
248
- * Taro.offLocationChange(_locationChangeFn)
357
+ * Taro.getFuzzyLocation({
358
+ * type: 'wgs84',
359
+ * success (res) {
360
+ * const latitude = res.latitude
361
+ * const longitude = res.longitude
362
+ * },
363
+ * })
249
364
  * ```
250
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.onLocationChange.html
365
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html
251
366
  */
252
- onLocationChange(
253
- /** 实时地理位置变化事件的回调函数 */
254
- callback: onLocationChange.Callback,
255
- ): void
256
-
257
- /** 取消监听实时地理位置变化事件
258
- * @supported weapp
259
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.offLocationChange.html
260
- */
261
- offLocationChange(
262
- /** 实时地理位置变化事件的回调函数 */
263
- callback: (res: TaroGeneral.CallbackResult) => void,
264
- ): void
367
+ getFuzzyLocation(option: getFuzzyLocation.Option): Promise<getFuzzyLocation.SuccessCallbackResult>
265
368
  }
266
369
  }