@tarojs/taro 3.3.13 → 3.3.17

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 (98) hide show
  1. package/package.json +5 -5
  2. package/types/api/ad/index.d.ts +34 -28
  3. package/types/api/alipay/index.d.ts +11 -7
  4. package/types/api/base/debug.d.ts +60 -54
  5. package/types/api/base/env.d.ts +12 -8
  6. package/types/api/base/index.d.ts +87 -83
  7. package/types/api/base/system.d.ts +59 -54
  8. package/types/api/base/update.d.ts +37 -33
  9. package/types/api/base/weapp/app-event.d.ts +147 -131
  10. package/types/api/base/weapp/life-cycle.d.ts +14 -10
  11. package/types/api/canvas/index.d.ts +116 -111
  12. package/types/api/cloud/index.d.ts +99 -94
  13. package/types/api/data-analysis/index.d.ts +68 -64
  14. package/types/api/device/accelerometer.d.ts +57 -50
  15. package/types/api/device/battery.d.ts +19 -15
  16. package/types/api/device/ble.d.ts +241 -228
  17. package/types/api/device/bluetooth.d.ts +207 -194
  18. package/types/api/device/clipboard.d.ts +48 -43
  19. package/types/api/device/compass.d.ts +55 -48
  20. package/types/api/device/contact.d.ts +13 -9
  21. package/types/api/device/gyroscope.d.ts +41 -35
  22. package/types/api/device/iBeacon.d.ts +79 -73
  23. package/types/api/device/motion.d.ts +42 -37
  24. package/types/api/device/network.d.ts +80 -42
  25. package/types/api/device/nfc.d.ts +105 -96
  26. package/types/api/device/performance.d.ts +32 -18
  27. package/types/api/device/phone.d.ts +20 -15
  28. package/types/api/device/scan.d.ts +31 -26
  29. package/types/api/device/screen.d.ts +74 -67
  30. package/types/api/device/vibrate.d.ts +31 -25
  31. package/types/api/device/wifi.d.ts +151 -140
  32. package/types/api/ext/index.d.ts +44 -39
  33. package/types/api/files/index.d.ts +219 -209
  34. package/types/api/framework/index.d.ts +25 -20
  35. package/types/api/location/index.d.ts +140 -136
  36. package/types/api/media/audio.d.ts +135 -127
  37. package/types/api/media/background-audio.d.ts +135 -126
  38. package/types/api/media/camera.d.ts +30 -26
  39. package/types/api/media/editor.d.ts +35 -33
  40. package/types/api/media/image.d.ts +163 -150
  41. package/types/api/media/live.d.ts +88 -82
  42. package/types/api/media/map.d.ts +47 -43
  43. package/types/api/media/recorder.d.ts +90 -84
  44. package/types/api/media/video-processing.d.ts +10 -6
  45. package/types/api/media/video.d.ts +63 -58
  46. package/types/api/network/download.d.ts +40 -30
  47. package/types/api/network/mdns.d.ts +104 -91
  48. package/types/api/network/request.d.ts +83 -79
  49. package/types/api/network/udp.d.ts +20 -16
  50. package/types/api/network/upload.d.ts +66 -56
  51. package/types/api/network/websocket.d.ts +201 -194
  52. package/types/api/open-api/account.d.ts +18 -14
  53. package/types/api/open-api/address.d.ts +27 -23
  54. package/types/api/open-api/authorize.d.ts +30 -26
  55. package/types/api/open-api/card.d.ts +55 -51
  56. package/types/api/open-api/customer-service.d.ts +21 -17
  57. package/types/api/open-api/facial.d.ts +28 -24
  58. package/types/api/open-api/invoice.d.ts +38 -34
  59. package/types/api/open-api/login.d.ts +56 -52
  60. package/types/api/open-api/navigate.d.ts +79 -75
  61. package/types/api/open-api/payment.d.ts +34 -30
  62. package/types/api/open-api/settings.d.ts +49 -45
  63. package/types/api/open-api/soter.d.ts +92 -86
  64. package/types/api/open-api/subscribe-message.d.ts +24 -20
  65. package/types/api/open-api/user-info.d.ts +60 -57
  66. package/types/api/open-api/werun.d.ts +50 -46
  67. package/types/api/route/index.d.ts +122 -118
  68. package/types/api/share/index.d.ts +68 -64
  69. package/types/api/storage/background-fetch.d.ts +40 -35
  70. package/types/api/storage/index.d.ts +267 -262
  71. package/types/api/swan/index.d.ts +47 -42
  72. package/types/api/ui/animation.d.ts +21 -17
  73. package/types/api/ui/background.d.ts +38 -34
  74. package/types/api/ui/custom-component.d.ts +22 -18
  75. package/types/api/ui/fonts.d.ts +26 -21
  76. package/types/api/ui/interaction.d.ts +159 -150
  77. package/types/api/ui/keyboard.d.ts +59 -55
  78. package/types/api/ui/menu.d.ts +10 -6
  79. package/types/api/ui/navigation-bar.d.ts +67 -63
  80. package/types/api/ui/pull-down-refresh.d.ts +33 -29
  81. package/types/api/ui/scroll.d.ts +30 -26
  82. package/types/api/ui/sticky.d.ts +22 -19
  83. package/types/api/ui/tab-bar.d.ts +101 -97
  84. package/types/api/ui/window.d.ts +24 -18
  85. package/types/api/worker/index.d.ts +28 -24
  86. package/types/api/wxml/index.d.ts +42 -38
  87. package/types/compile.d.ts +1 -5
  88. package/types/global.d.ts +392 -0
  89. package/types/index.d.ts +12 -98
  90. package/types/taro.api.d.ts +94 -0
  91. package/types/taro.component.d.ts +10 -57
  92. package/types/taro.config.d.ts +28 -6
  93. package/types/taro.extend.d.ts +50 -75
  94. package/types/taro.hooks.d.ts +68 -67
  95. package/types/taro.lifecycle.d.ts +47 -28
  96. package/types/api/ad/index.ts +0 -6
  97. package/types/api/alipay/index.ts +0 -7
  98. package/types/api/index.d.ts +0 -352
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace createAnimation {
3
5
  interface Option {
4
6
  /** 动画延迟时间,单位 ms */
@@ -27,28 +29,13 @@ declare namespace Taro {
27
29
  }
28
30
  }
29
31
 
30
- /** 创建一个动画实例 animation。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
31
- * @supported weapp, h5
32
- * @example
33
- * ```tsx
34
- * var animation = Taro.createAnimation({
35
- * transformOrigin: "50% 50%",
36
- * duration: 1000,
37
- * timingFunction: "ease",
38
- * delay: 0
39
- * })
40
- * ```
41
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html
42
- */
43
- function createAnimation(option: createAnimation.Option): Animation
44
-
45
32
  interface Animation {
46
33
  /** 导出动画队列。**export 方法每次调用后会清掉之前的动画操作。**
47
34
  * @supported weapp
48
35
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/Animation.export.html
49
36
  */
50
37
  export(): {
51
- actions: General.IAnyObject[]
38
+ actions: TaroGeneral.IAnyObject[]
52
39
  }
53
40
  /** 设置背景色
54
41
  * @supported weapp
@@ -465,4 +452,21 @@ declare namespace Taro {
465
452
  /** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */
466
453
  timeRange: number
467
454
  }
455
+
456
+ interface TaroStatic {
457
+ /** 创建一个动画实例 animation。调用实例的方法来描述动画。最后通过动画实例的 export 方法导出动画数据传递给组件的 animation 属性。
458
+ * @supported weapp, h5
459
+ * @example
460
+ * ```tsx
461
+ * var animation = Taro.createAnimation({
462
+ * transformOrigin: "50% 50%",
463
+ * duration: 1000,
464
+ * timingFunction: "ease",
465
+ * delay: 0
466
+ * })
467
+ * ```
468
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/animation/wx.createAnimation.html
469
+ */
470
+ createAnimation(option: createAnimation.Option): Animation
471
+ }
468
472
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace setBackgroundTextStyle {
3
5
  interface Option {
4
6
  /** 下拉背景字体、loading 图的样式。
@@ -8,26 +10,14 @@ declare namespace Taro {
8
10
  * - 'light': light 样式; */
9
11
  textStyle: 'dark' | 'light'
10
12
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
- complete?: (res: General.CallbackResult) => void
13
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
14
  /** 接口调用失败的回调函数 */
13
- fail?: (res: General.CallbackResult) => void
15
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
16
  /** 接口调用成功的回调函数 */
15
- success?: (res: General.CallbackResult) => void
17
+ success?: (res: TaroGeneral.CallbackResult) => void
16
18
  }
17
19
  }
18
20
 
19
- /** 动态设置下拉背景字体、loading 图的样式
20
- * @supported weapp
21
- * @example
22
- * ```tsx
23
- * Taro.setBackgroundTextStyle({
24
- * textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark
25
- * })
26
- * ```
27
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html
28
- */
29
- function setBackgroundTextStyle(option: setBackgroundTextStyle.Option): Promise<General.CallbackResult>
30
-
31
21
  namespace setBackgroundColor {
32
22
  interface Option {
33
23
  /** 窗口的背景色,必须为十六进制颜色值 */
@@ -37,27 +27,41 @@ declare namespace Taro {
37
27
  /** 顶部窗口的背景色,必须为十六进制颜色值,仅 iOS 支持 */
38
28
  backgroundColorTop?: string
39
29
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
40
- complete?: (res: General.CallbackResult) => void
30
+ complete?: (res: TaroGeneral.CallbackResult) => void
41
31
  /** 接口调用失败的回调函数 */
42
- fail?: (res: General.CallbackResult) => void
32
+ fail?: (res: TaroGeneral.CallbackResult) => void
43
33
  /** 接口调用成功的回调函数 */
44
- success?: (res: General.CallbackResult) => void
34
+ success?: (res: TaroGeneral.CallbackResult) => void
45
35
  }
46
36
  }
47
37
 
48
- /** 动态设置窗口的背景色
49
- * @supported weapp
50
- * @example
51
- * ```tsx
52
- * Taro.setBackgroundColor({
53
- * backgroundColor: '#ffffff', // 窗口的背景色为白色
54
- * })
55
- * Taro.setBackgroundColor({
56
- * backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
57
- * backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
58
- * })
59
- * ```
60
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html
61
- */
62
- function setBackgroundColor(option: setBackgroundColor.Option): Promise<General.CallbackResult>
38
+ interface TaroStatic {
39
+ /** 动态设置下拉背景字体、loading 图的样式
40
+ * @supported weapp
41
+ * @example
42
+ * ```tsx
43
+ * Taro.setBackgroundTextStyle({
44
+ * textStyle: 'dark' // 下拉背景字体、loading 图的样式为dark
45
+ * })
46
+ * ```
47
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundTextStyle.html
48
+ */
49
+ setBackgroundTextStyle(option: setBackgroundTextStyle.Option): Promise<TaroGeneral.CallbackResult>
50
+
51
+ /** 动态设置窗口的背景色
52
+ * @supported weapp
53
+ * @example
54
+ * ```tsx
55
+ * Taro.setBackgroundColor({
56
+ * backgroundColor: '#ffffff', // 窗口的背景色为白色
57
+ * })
58
+ * Taro.setBackgroundColor({
59
+ * backgroundColorTop: '#ffffff', // 顶部窗口的背景色为白色
60
+ * backgroundColorBottom: '#ffffff', // 底部窗口的背景色为白色
61
+ * })
62
+ * ```
63
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/background/wx.setBackgroundColor.html
64
+ */
65
+ setBackgroundColor(option: setBackgroundColor.Option): Promise<TaroGeneral.CallbackResult>
66
+ }
63
67
  }
@@ -1,19 +1,23 @@
1
- declare namespace Taro {
2
- /** 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
3
- *
4
- * **说明**
5
- * 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
6
- * 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
7
- * @supported weapp
8
- * @example
9
- * ```tsx
10
- * this.setData({ number: 1 }) // 直接在当前同步流程中执行
11
- * Taro.nextTick(() => {
12
- * this.setData({ number: 3 }) // 在当前同步流程结束后,下一个时间片执行
13
- * })
14
- * this.setData({ number: 2 }) // 直接在当前同步流程中执行
15
- * ```
16
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html
17
- */
18
- function nextTick(callback: (...args: any[]) => any): void
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ interface TaroStatic {
5
+ /** 延迟一部分操作到下一个时间片再执行。(类似于 setTimeout)
6
+ *
7
+ * **说明**
8
+ * 因为自定义组件中的 setData 和 triggerEvent 等接口本身是同步的操作,当这几个接口被连续调用时,都是在一个同步流程中执行完的,因此若逻辑不当可能会导致出错。
9
+ * 一个极端的案例:当父组件的 setData 引发了子组件的 triggerEvent,进而使得父组件又进行了一次 setData,期间有通过 wx:if 语句对子组件进行卸载,就有可能引发奇怪的错误,所以对于不需要在一个同步流程内完成的逻辑,可以使用此接口延迟到下一个时间片再执行。
10
+ * @supported weapp
11
+ * @example
12
+ * ```tsx
13
+ * this.setData({ number: 1 }) // 直接在当前同步流程中执行
14
+ * Taro.nextTick(() => {
15
+ * this.setData({ number: 3 }) // 在当前同步流程结束后,下一个时间片执行
16
+ * })
17
+ * this.setData({ number: 2 }) // 直接在当前同步流程中执行
18
+ * ```
19
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/custom-component/wx.nextTick.html
20
+ */
21
+ nextTick(callback: (...args: any[]) => any): void
22
+ }
19
23
  }
@@ -1,4 +1,6 @@
1
- declare namespace Taro {
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
2
4
  namespace loadFontFace {
3
5
  interface Option {
4
6
  /** 是否全局生效
@@ -52,24 +54,27 @@ declare namespace Taro {
52
54
  status: string
53
55
  }
54
56
  }
55
- /** 动态加载网络字体。文件地址需为下载类型。iOS 仅支持 https 格式文件地址。
56
- *
57
- * 注意:
58
- * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
59
- * 2. 字体链接必须是https(ios不支持http)
60
- * 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
61
- * 4. canvas等原生组件不支持使用接口添加的字体
62
- * 5. 工具里提示 Faild to load font可以忽略
63
- * @supported weapp
64
- * @example
65
- * ```tsx
66
- * Taro.loadFontFace({
67
- * family: 'Bitstream Vera Serif Bold',
68
- * source: 'url("https://sungd.github.io/Pacifico.ttf")',
69
- * success: console.log
70
- * })
71
- * ```
72
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html
73
- */
74
- function loadFontFace(option: loadFontFace.Option): void
57
+
58
+ interface TaroStatic {
59
+ /** 动态加载网络字体。文件地址需为下载类型。iOS 仅支持 https 格式文件地址。
60
+ *
61
+ * 注意:
62
+ * 1. 字体文件返回的 contet-type 参考 [font](https://www.iana.org/assignments/media-types/media-types.xhtml#font),格式不正确时会解析失败。
63
+ * 2. 字体链接必须是https(ios不支持http)
64
+ * 3. 字体链接必须是同源下的,或开启了cors支持,小程序的域名是`servicewechat.com`
65
+ * 4. canvas等原生组件不支持使用接口添加的字体
66
+ * 5. 工具里提示 Faild to load font可以忽略
67
+ * @supported weapp
68
+ * @example
69
+ * ```tsx
70
+ * Taro.loadFontFace({
71
+ * family: 'Bitstream Vera Serif Bold',
72
+ * source: 'url("https://sungd.github.io/Pacifico.ttf")',
73
+ * success: console.log
74
+ * })
75
+ * ```
76
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/font/wx.loadFontFace.html
77
+ */
78
+ loadFontFace(option: loadFontFace.Option): void
79
+ }
75
80
  }