@tarojs/taro 3.4.0 → 3.4.3

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 (92) hide show
  1. package/package.json +5 -5
  2. package/types/api/ai/face.d.ts +133 -0
  3. package/types/api/ai/visionkit.d.ts +303 -0
  4. package/types/api/base/crypto.d.ts +90 -0
  5. package/types/api/base/debug.d.ts +152 -13
  6. package/types/api/base/env.d.ts +2 -1
  7. package/types/api/base/index.d.ts +10 -2
  8. package/types/api/base/performance.d.ts +195 -0
  9. package/types/api/base/system.d.ts +539 -101
  10. package/types/api/base/update.d.ts +59 -7
  11. package/types/api/base/weapp/app-event.d.ts +46 -23
  12. package/types/api/base/weapp/life-cycle.d.ts +141 -1
  13. package/types/api/canvas/index.d.ts +150 -136
  14. package/types/api/cloud/index.d.ts +17 -2
  15. package/types/api/device/accelerometer.d.ts +3 -3
  16. package/types/api/device/accessibility.d.ts +26 -0
  17. package/types/api/device/battery.d.ts +2 -2
  18. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  19. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  20. package/types/api/device/bluetooth.d.ts +67 -2
  21. package/types/api/device/calendar.d.ts +88 -0
  22. package/types/api/device/contact.d.ts +74 -50
  23. package/types/api/device/gyroscope.d.ts +5 -5
  24. package/types/api/device/iBeacon.d.ts +33 -19
  25. package/types/api/{ui → device}/keyboard.d.ts +0 -0
  26. package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
  27. package/types/api/device/motion.d.ts +3 -3
  28. package/types/api/device/network.d.ts +53 -12
  29. package/types/api/device/nfc.d.ts +1089 -13
  30. package/types/api/device/scan.d.ts +1 -1
  31. package/types/api/device/screen.d.ts +40 -12
  32. package/types/api/device/wifi.d.ts +41 -6
  33. package/types/api/files/index.d.ts +371 -184
  34. package/types/api/location/index.d.ts +116 -55
  35. package/types/api/media/audio.d.ts +653 -60
  36. package/types/api/media/background-audio.d.ts +47 -41
  37. package/types/api/media/camera.d.ts +38 -19
  38. package/types/api/media/editor.d.ts +22 -2
  39. package/types/api/media/image.d.ts +61 -32
  40. package/types/api/media/live.d.ts +66 -6
  41. package/types/api/media/map.d.ts +469 -49
  42. package/types/api/media/media-recorder.d.ts +92 -0
  43. package/types/api/media/recorder.d.ts +20 -20
  44. package/types/api/media/video-decoder.d.ts +117 -0
  45. package/types/api/media/video-processing.d.ts +11 -7
  46. package/types/api/media/video.d.ts +45 -16
  47. package/types/api/media/voip.d.ts +290 -0
  48. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -27
  49. package/types/api/network/download.d.ts +39 -16
  50. package/types/api/network/request.d.ts +128 -40
  51. package/types/api/network/tcp.d.ts +181 -0
  52. package/types/api/network/udp.d.ts +154 -83
  53. package/types/api/network/upload.d.ts +41 -25
  54. package/types/api/network/websocket.d.ts +16 -15
  55. package/types/api/open-api/authorize.d.ts +41 -2
  56. package/types/api/open-api/channels.d.ts +178 -0
  57. package/types/api/open-api/customer-service.d.ts +1 -1
  58. package/types/api/open-api/facial.d.ts +3 -0
  59. package/types/api/open-api/favorites.d.ts +100 -0
  60. package/types/api/open-api/group.d.ts +59 -0
  61. package/types/api/open-api/invoice.d.ts +2 -2
  62. package/types/api/open-api/license-plate.d.ts +27 -0
  63. package/types/api/open-api/login.d.ts +21 -0
  64. package/types/api/open-api/redpackage.d.ts +24 -0
  65. package/types/api/open-api/settings.d.ts +80 -15
  66. package/types/api/open-api/soter.d.ts +2 -2
  67. package/types/api/open-api/subscribe-message.d.ts +88 -3
  68. package/types/api/open-api/user-info.d.ts +55 -18
  69. package/types/api/open-api/werun.d.ts +33 -6
  70. package/types/api/payment/index.d.ts +119 -0
  71. package/types/api/route/index.d.ts +13 -9
  72. package/types/api/share/index.d.ts +192 -9
  73. package/types/api/storage/index.d.ts +29 -83
  74. package/types/api/swan/index.d.ts +1 -1
  75. package/types/api/ui/animation.d.ts +84 -70
  76. package/types/api/ui/background.d.ts +4 -2
  77. package/types/api/ui/custom-component.d.ts +1 -1
  78. package/types/api/ui/fonts.d.ts +27 -31
  79. package/types/api/ui/navigation-bar.d.ts +1 -0
  80. package/types/api/ui/scroll.d.ts +73 -7
  81. package/types/api/ui/sticky.d.ts +4 -4
  82. package/types/api/ui/tab-bar.d.ts +7 -7
  83. package/types/api/ui/window.d.ts +22 -2
  84. package/types/api/worker/index.d.ts +9 -1
  85. package/types/api/wxml/index.d.ts +143 -105
  86. package/types/compile.d.ts +5 -0
  87. package/types/global.d.ts +142 -111
  88. package/types/taro.api.d.ts +79 -62
  89. package/types/taro.component.d.ts +75 -55
  90. package/types/taro.config.d.ts +172 -168
  91. package/types/taro.extend.d.ts +8 -1
  92. package/types/api/open-api/payment.d.ts +0 -61
@@ -18,10 +18,12 @@ declare module '../../index' {
18
18
  */
19
19
  interface IntersectionObserver {
20
20
  /** 停止监听。回调函数将不再触发
21
+ * @supported weapp
21
22
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html
22
23
  */
23
24
  disconnect(): void
24
25
  /** 指定目标节点并开始监听相交状态变化情况
26
+ * @supported weapp
25
27
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html
26
28
  */
27
29
  observe(
@@ -31,6 +33,7 @@ declare module '../../index' {
31
33
  callback: IntersectionObserver.ObserveCallback,
32
34
  ): void
33
35
  /** 使用选择器指定一个节点,作为参照区域之一。
36
+ * @supported weapp
34
37
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html
35
38
  */
36
39
  relativeTo(
@@ -40,6 +43,7 @@ declare module '../../index' {
40
43
  margins?: IntersectionObserver.RelativeToMargins,
41
44
  ): IntersectionObserver
42
45
  /** 指定页面显示区域作为参照区域之一
46
+ * @supported weapp
43
47
  * @example
44
48
  * 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
45
49
  *
@@ -141,107 +145,38 @@ declare module '../../index' {
141
145
  }
142
146
  }
143
147
 
144
- /** 查询节点信息的对象
145
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html
146
- */
147
- interface SelectorQuery {
148
- /** 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。
149
- * @supported weapp, h5
150
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html
151
- */
152
- exec(
153
- /** 回调函数 */
154
- callback?: (...args: any[]) => any,
155
- ): NodesRef
156
- /** 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
157
- *
158
- * **selector 语法**
159
- *
160
- *
161
- * selector类似于 CSS 的选择器,但仅支持下列语法。
162
- *
163
- * - ID选择器:#the-id
164
- * - class选择器(可以连续指定多个):.a-class.another-class
165
- * - 子元素选择器:.the-parent > .the-child
166
- * - 后代选择器:.the-ancestor .the-descendant
167
- * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
168
- * - 多选择器的并集:#a-node, .some-other-nodes
169
- * @supported weapp, h5
170
- * @example
171
- * ```tsx
172
- * Taro.createSelectorQuery().select('#the-id').fields({
173
- * dataset: true,
174
- * size: true,
175
- * scrollOffset: true,
176
- * properties: ['scrollX', 'scrollY']
177
- * }, function (res){
178
- * res.dataset // 节点的dataset
179
- * res.width // 节点的宽度
180
- * res.height // 节点的高度
181
- * res.scrollLeft // 节点的水平滚动位置
182
- * res.scrollTop // 节点的竖直滚动位置
183
- * res.scrollX // 节点 scroll-x 属性的当前值
184
- * res.scrollY // 节点 scroll-x 属性的当前值
185
- * }).exec()
186
- * ```
187
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html
188
- */
189
- select(
190
- /** 选择器 */
191
- selector: string,
192
- ): NodesRef
193
- /** 在当前页面下选择匹配选择器 selector 的所有节点。
194
- *
195
- * **selector 语法**
196
- *
197
- * selector类似于 CSS 的选择器,但仅支持下列语法。
198
- *
199
- * - ID选择器:#the-id
200
- * - class选择器(可以连续指定多个):.a-class.another-class
201
- * - 子元素选择器:.the-parent > .the-child
202
- * - 后代选择器:.the-ancestor .the-descendant
203
- * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
204
- * - 多选择器的并集:#a-node, .some-other-nodes
205
- * @supported weapp, h5
206
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html
207
- */
208
- selectAll(
209
- /** 选择器 */
210
- selector: string,
211
- ): NodesRef
212
- /** 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。
213
- * @supported weapp, h5
214
- * @example
215
- * ```tsx
216
- * Taro.createSelectorQuery().selectViewport().scrollOffset(function (res) {
217
- * res.id // 节点的ID
218
- * res.dataset // 节点的dataset
219
- * res.scrollLeft // 节点的水平滚动位置
220
- * res.scrollTop // 节点的竖直滚动位置
221
- * }).exec()
222
- * ```
223
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html
224
- */
225
- selectViewport(): NodesRef
226
- /** 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
227
- * @supported weapp, h5
228
- * @example
229
- * ```tsx
230
- * Component({
231
- * queryMultipleNodes () {
232
- * const query = Taro.createSelectorQuery().in(this)
233
- * query.select('#the-id').boundingClientRect(function(res){
234
- * res.top // 这个组件内 #the-id 节点的上边界坐标
235
- * }).exec()
236
- * }
237
- * })
238
- * ```
239
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html
240
- */
241
- in(
242
- /** 自定义组件实例 */
243
- component: TaroGeneral.IAnyObject,
244
- ): SelectorQuery
148
+ /** `MediaQueryObserver` 对象,用于监听页面 media query 状态的变化,如界面的长宽是不是在某个指定的范围内。 */
149
+ interface MediaQueryObserver {
150
+ /** 开始监听页面 media query 变化情况 */
151
+ observe(descriptor: MediaQueryObserver.descriptor, callback: MediaQueryObserver.observeCallback): void
152
+ /** 停止监听。回调函数将不再触发 */
153
+ disconnect(): void
154
+ }
155
+
156
+ namespace MediaQueryObserver {
157
+ /** media query 描述符 */
158
+ interface descriptor {
159
+ /** 页面最小宽度 (单位: px) */
160
+ minWidth: number
161
+ /** 页面最大宽度 (单位: px) */
162
+ maxWidth: number
163
+ /** 页面宽度 (单位: px) */
164
+ width: number
165
+ /** 页面最小高度 (单位: px) */
166
+ minHeight: number
167
+ /** 页面最大高度(px 为单位) */
168
+ maxHeight: number
169
+ /** 页面高度(px 为单位) */
170
+ height: number
171
+ /** 屏幕方向 */
172
+ orientation: 'landscape' | 'portrait'
173
+ }
174
+
175
+ /** 监听 media query 状态变化的回调函数 */
176
+ type observeCallback = (res: {
177
+ /** 页面的当前状态是否满足所指定的 media query */
178
+ matches: boolean
179
+ }) => void
245
180
  }
246
181
 
247
182
  /** 用于获取 `WXML` 节点信息的对象
@@ -284,8 +219,8 @@ declare module '../../index' {
284
219
  /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
285
220
  callback?: NodesRef.BoundingClientRectCallback,
286
221
  ): SelectorQuery
287
- /** 添加节点的 Context 对象查询请求。目前支持 [VideoContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/video/VideoContext.html)、[CanvasContext](https://developers.weixin.qq.com/miniprogram/dev/api/canvas/CanvasContext.html)、[LivePlayerContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/live/LivePlayerContext.html)、[EditorContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/editor/EditorContext.html)和 [MapContext](https://developers.weixin.qq.com/miniprogram/dev/api/media/map/MapContext.html) 的获取。
288
- * @supported weapp
222
+ /** 添加节点的 Context 对象查询请求。目前支持 [VideoContext](/docs/apis/media/video/VideoContext)、[CanvasContext](/docs/apis/canvas/CanvasContext)、[LivePlayerContext](/docs/apis/media/live/LivePlayerContext)、[EditorContext](/docs/apis/media/editor/EditorContext)和 [MapContext](/docs/apis/media/map/MapContext) 的获取。
223
+ * @supported weapp, h5
289
224
  * @example
290
225
  * ```tsx
291
226
  * Taro.createSelectorQuery().select('.the-video-class').context(function (res) {
@@ -333,8 +268,8 @@ declare module '../../index' {
333
268
  /** 回调函数 */
334
269
  callback?: NodesRef.FieldsCallback,
335
270
  ): SelectorQuery
336
- /** 获取 Node 节点实例。目前支持 [Canvas](https://developers.weixin.qq.com/miniprogram/dev/component/canvas.html) 的获取。
337
- * @supported weapp
271
+ /** 获取 Node 节点实例。目前支持 [Canvas](/docs/components/canvas/canvas) 的获取。
272
+ * @supported weapp, h5
338
273
  * @example
339
274
  * ```tsx
340
275
  * Taro.createSelectorQuery().select('.canvas').node(function(res){
@@ -444,6 +379,109 @@ declare module '../../index' {
444
379
  }
445
380
  }
446
381
 
382
+ /** 查询节点信息的对象
383
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.html
384
+ */
385
+ interface SelectorQuery {
386
+ /** 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。
387
+ * @supported weapp, h5
388
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html
389
+ */
390
+ exec(
391
+ /** 回调函数 */
392
+ callback?: (...args: any[]) => any,
393
+ ): NodesRef
394
+ /** 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
395
+ * @supported weapp, h5
396
+ * @example
397
+ * ```tsx
398
+ * Component({
399
+ * queryMultipleNodes () {
400
+ * const query = Taro.createSelectorQuery().in(this)
401
+ * query.select('#the-id').boundingClientRect(function(res){
402
+ * res.top // 这个组件内 #the-id 节点的上边界坐标
403
+ * }).exec()
404
+ * }
405
+ * })
406
+ * ```
407
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.in.html
408
+ */
409
+ in(
410
+ /** 自定义组件实例 */
411
+ component: TaroGeneral.IAnyObject,
412
+ ): SelectorQuery
413
+ /** 在当前页面下选择第一个匹配选择器 `selector` 的节点。返回一个 `NodesRef` 对象实例,可以用于获取节点信息。
414
+ *
415
+ * **selector 语法**
416
+ *
417
+ *
418
+ * selector类似于 CSS 的选择器,但仅支持下列语法。
419
+ *
420
+ * - ID选择器:#the-id
421
+ * - class选择器(可以连续指定多个):.a-class.another-class
422
+ * - 子元素选择器:.the-parent > .the-child
423
+ * - 后代选择器:.the-ancestor .the-descendant
424
+ * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
425
+ * - 多选择器的并集:#a-node, .some-other-nodes
426
+ * @supported weapp, h5
427
+ * @example
428
+ * ```tsx
429
+ * Taro.createSelectorQuery().select('#the-id').fields({
430
+ * dataset: true,
431
+ * size: true,
432
+ * scrollOffset: true,
433
+ * properties: ['scrollX', 'scrollY']
434
+ * }, function (res){
435
+ * res.dataset // 节点的dataset
436
+ * res.width // 节点的宽度
437
+ * res.height // 节点的高度
438
+ * res.scrollLeft // 节点的水平滚动位置
439
+ * res.scrollTop // 节点的竖直滚动位置
440
+ * res.scrollX // 节点 scroll-x 属性的当前值
441
+ * res.scrollY // 节点 scroll-x 属性的当前值
442
+ * }).exec()
443
+ * ```
444
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.select.html
445
+ */
446
+ select(
447
+ /** 选择器 */
448
+ selector: string,
449
+ ): NodesRef
450
+ /** 在当前页面下选择匹配选择器 selector 的所有节点。
451
+ *
452
+ * **selector 语法**
453
+ *
454
+ * selector类似于 CSS 的选择器,但仅支持下列语法。
455
+ *
456
+ * - ID选择器:#the-id
457
+ * - class选择器(可以连续指定多个):.a-class.another-class
458
+ * - 子元素选择器:.the-parent > .the-child
459
+ * - 后代选择器:.the-ancestor .the-descendant
460
+ * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
461
+ * - 多选择器的并集:#a-node, .some-other-nodes
462
+ * @supported weapp, h5
463
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html
464
+ */
465
+ selectAll(
466
+ /** 选择器 */
467
+ selector: string,
468
+ ): NodesRef
469
+ /** 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。
470
+ * @supported weapp, h5
471
+ * @example
472
+ * ```tsx
473
+ * Taro.createSelectorQuery().selectViewport().scrollOffset(function (res) {
474
+ * res.id // 节点的ID
475
+ * res.dataset // 节点的dataset
476
+ * res.scrollLeft // 节点的水平滚动位置
477
+ * res.scrollTop // 节点的竖直滚动位置
478
+ * }).exec()
479
+ * ```
480
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectViewport.html
481
+ */
482
+ selectViewport(): NodesRef
483
+ }
484
+
447
485
  interface TaroStatic {
448
486
  /** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
449
487
  * @supported weapp, h5
@@ -110,6 +110,11 @@ export interface ICompileOption {
110
110
  interface Runtime {
111
111
  enableInnerHTML: boolean
112
112
  enableSizeAPIs: boolean
113
+ enableAdjacentHTML: boolean
114
+ enableTemplateContent: boolean
115
+ enableCloneNode: boolean
116
+ enableContains: boolean
117
+ enableMutationObserver: boolean
113
118
  }
114
119
 
115
120
  export interface IMiniAppConfig {