@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
@@ -1,154 +1,506 @@
1
1
  import Taro from '../../index'
2
2
 
3
3
  declare module '../../index' {
4
- namespace getSystemInfoSync {
5
- /**
6
- * 注意:**H5** 端不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
7
- * 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
8
- */
4
+ namespace openSystemBluetoothSetting {
5
+ interface Option {
6
+ /** 接口调用成功的回调函数 */
7
+ success?: (res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ }
13
+ }
14
+
15
+ namespace openAppAuthorizeSetting {
16
+ interface Option {
17
+ /** 接口调用成功的回调函数 */
18
+ success?: (res: TaroGeneral.CallbackResult) => void
19
+ /** 接口调用失败的回调函数 */
20
+ fail?: (res: TaroGeneral.CallbackResult) => void
21
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
22
+ complete?: (res: TaroGeneral.CallbackResult) => void
23
+ }
24
+ }
25
+
26
+ namespace getWindowInfo {
27
+ interface Result {
28
+ /** 设备像素比 */
29
+ pixelRatio: number
30
+ /** 屏幕宽度,单位px */
31
+ screenWidth: number
32
+ /** 屏幕高度,单位px */
33
+ screenHeight: number
34
+ /** 可使用窗口宽度,单位px */
35
+ windowWidth: number
36
+ /** 可使用窗口高度,单位px */
37
+ windowHeight: number
38
+ /** 状态栏的高度,单位px */
39
+ statusBarHeight?: number
40
+ /** 在竖屏正方向下的安全区域 */
41
+ safeArea?: TaroGeneral.SafeAreaResult
42
+ }
43
+ }
44
+
45
+ namespace getSystemSetting {
9
46
  interface Result {
10
- /** 客户端基础库版本 */
11
- SDKVersion: string
12
- /** 允许微信使用相册的开关(仅 iOS 有效) */
13
- albumAuthorized: boolean
14
- /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
15
- benchmarkLevel: number
16
47
  /** 蓝牙的系统开关 */
17
- bluetoothEnabled: boolean
48
+ bluetoothEnabled?: boolean
49
+ /** 地理位置的系统开关 */
50
+ locationEnabled?: boolean
51
+ /** Wi-Fi 的系统开关 */
52
+ wifiEnabled?: boolean
53
+ /** 设备方向 */
54
+ deviceOrientation?: keyof DeviceOrientation
55
+ }
56
+ /** 设备方向合法值 */
57
+ interface DeviceOrientation {
58
+ /** 竖屏 */
59
+ portrait
60
+ /** 横屏 */
61
+ landscape
62
+ }
63
+ }
64
+
65
+ namespace getSystemInfoSync {
66
+ interface Result {
18
67
  /** 设备品牌 */
19
68
  brand: string
20
- /** 允许微信使用摄像头的开关 */
21
- cameraAuthorized: boolean
22
- /** 是否已打开调试。可通过右上角菜单或 Taro.setEnableDebug 打开调试。 */
23
- enableDebug: boolean
24
- /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
25
- fontSizeSetting: number
69
+ /** 设备型号 */
70
+ model: string
71
+ /** 设备像素比 */
72
+ pixelRatio: number
73
+ /** 屏幕宽度,单位px */
74
+ screenWidth: number
75
+ /** 屏幕高度,单位px */
76
+ screenHeight: number
77
+ /** 可使用窗口宽度,单位px */
78
+ windowWidth: number
79
+ /** 可使用窗口高度,单位px */
80
+ windowHeight: number
81
+ /** 状态栏的高度,单位px */
82
+ statusBarHeight?: number
26
83
  /** 微信设置的语言 */
27
84
  language: string
85
+ /** 微信版本号 */
86
+ version?: string
87
+ /** 操作系统及版本 */
88
+ system: string
89
+ /** 客户端平台 */
90
+ platform: string
91
+ /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
92
+ fontSizeSetting?: number
93
+ /** 客户端基础库版本 */
94
+ SDKVersion?: string
95
+ /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
96
+ benchmarkLevel: number
97
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
98
+ albumAuthorized?: boolean
99
+ /** 允许微信使用摄像头的开关 */
100
+ cameraAuthorized?: boolean
28
101
  /** 允许微信使用定位的开关 */
29
- locationAuthorized: boolean
30
- /** 地理位置的系统开关 */
31
- locationEnabled: boolean
102
+ locationAuthorized?: boolean
32
103
  /** 允许微信使用麦克风的开关 */
33
- microphoneAuthorized: boolean
34
- /** 设备型号 */
35
- model: string
36
- /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
37
- notificationAlertAuthorized: boolean
104
+ microphoneAuthorized?: boolean
38
105
  /** 允许微信通知的开关 */
39
- notificationAuthorized: boolean
106
+ notificationAuthorized?: boolean
107
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
108
+ notificationAlertAuthorized?: boolean
40
109
  /** 允许微信通知带有标记的开关(仅 iOS 有效) */
41
- notificationBadgeAuthorized: boolean
110
+ notificationBadgeAuthorized?: boolean
42
111
  /** 允许微信通知带有声音的开关(仅 iOS 有效) */
43
- notificationSoundAuthorized: boolean
112
+ notificationSoundAuthorized?: boolean
113
+ /** 允许微信使用日历的开关 */
114
+ phoneCalendarAuthorized?: boolean
115
+ /** 蓝牙的系统开关 */
116
+ bluetoothEnabled?: boolean
117
+ /** 地理位置的系统开关 */
118
+ locationEnabled?: boolean
119
+ /** Wi-Fi 的系统开关 */
120
+ wifiEnabled?: boolean
121
+ /** 在竖屏正方向下的安全区域 */
122
+ safeArea?: TaroGeneral.SafeAreaResult
123
+ /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
124
+ locationReducedAccuracy?: boolean
125
+ /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
126
+ theme?: keyof Theme
127
+ /** 当前小程序运行的宿主环境 */
128
+ host?: Host
129
+ /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */
130
+ enableDebug?: boolean
131
+ /** 设备方向 */
132
+ deviceOrientation?: keyof DeviceOrientation
133
+ /** 小程序当前运行环境 */
134
+ environment?: string
135
+ }
136
+ /** 系统主题合法值 */
137
+ interface Theme {
138
+ /** 深色主题 */
139
+ dark
140
+ /** 浅色主题 */
141
+ light
142
+ }
143
+ interface Host {
144
+ /** 宿主 app 对应的 appId */
145
+ appId: string
146
+ }
147
+ /** 设备方向合法值 */
148
+ interface DeviceOrientation {
149
+ /** 竖屏 */
150
+ portrait
151
+ /** 横屏 */
152
+ landscape
153
+ }
154
+ }
155
+
156
+ namespace getSystemInfoAsync {
157
+ interface Option {
158
+ /** 接口调用成功的回调函数 */
159
+ success?: (res: Result) => void
160
+ /** 接口调用失败的回调函数 */
161
+ fail?: (res: TaroGeneral.CallbackResult) => void
162
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
163
+ complete?: (res: TaroGeneral.CallbackResult | Result) => void
164
+ }
165
+ interface Result extends TaroGeneral.CallbackResult {
166
+ /** 设备品牌 */
167
+ brand: string
168
+ /** 设备型号 */
169
+ model: string
44
170
  /** 设备像素比 */
45
171
  pixelRatio: number
46
- /** 客户端平台 */
47
- platform: string
48
- /** 在竖屏正方向下的安全区域 */
49
- safeArea: TaroGeneral.SafeAreaResult
50
- /** 屏幕高度,单位px */
51
- screenHeight: number
52
172
  /** 屏幕宽度,单位px */
53
173
  screenWidth: number
174
+ /** 屏幕高度,单位px */
175
+ screenHeight: number
176
+ /** 可使用窗口宽度,单位px */
177
+ windowWidth: number
178
+ /** 可使用窗口高度,单位px */
179
+ windowHeight: number
54
180
  /** 状态栏的高度,单位px */
55
- statusBarHeight: number
181
+ statusBarHeight?: number
182
+ /** 微信设置的语言 */
183
+ language: string
184
+ /** 微信版本号 */
185
+ version?: string
56
186
  /** 操作系统及版本 */
57
187
  system: string
58
- /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
59
- theme?: 'light' | 'dark'
60
- /** 微信版本号 */
61
- version: string
188
+ /** 客户端平台 */
189
+ platform: string
190
+ /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
191
+ fontSizeSetting?: number
192
+ /** 客户端基础库版本 */
193
+ SDKVersion?: string
194
+ /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
195
+ benchmarkLevel: number
196
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
197
+ albumAuthorized?: boolean
198
+ /** 允许微信使用摄像头的开关 */
199
+ cameraAuthorized?: boolean
200
+ /** 允许微信使用定位的开关 */
201
+ locationAuthorized?: boolean
202
+ /** 允许微信使用麦克风的开关 */
203
+ microphoneAuthorized?: boolean
204
+ /** 允许微信通知的开关 */
205
+ notificationAuthorized?: boolean
206
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
207
+ notificationAlertAuthorized?: boolean
208
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
209
+ notificationBadgeAuthorized?: boolean
210
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
211
+ notificationSoundAuthorized?: boolean
212
+ /** 允许微信使用日历的开关 */
213
+ phoneCalendarAuthorized?: boolean
214
+ /** 蓝牙的系统开关 */
215
+ bluetoothEnabled?: boolean
216
+ /** 地理位置的系统开关 */
217
+ locationEnabled?: boolean
62
218
  /** Wi-Fi 的系统开关 */
63
- wifiEnabled: boolean
64
- /** 可使用窗口高度,单位px */
65
- windowHeight: number
66
- /** 可使用窗口宽度,单位px */
67
- windowWidth: number
219
+ wifiEnabled?: boolean
220
+ /** 在竖屏正方向下的安全区域 */
221
+ safeArea?: TaroGeneral.SafeAreaResult
222
+ /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
223
+ locationReducedAccuracy?: boolean
224
+ /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
225
+ theme?: keyof Theme
226
+ /** 当前小程序运行的宿主环境 */
227
+ host?: Host
228
+ /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */
229
+ enableDebug?: boolean
230
+ /** 设备方向 */
231
+ deviceOrientation?: keyof DeviceOrientation
68
232
  /** 小程序当前运行环境 */
69
233
  environment?: string
70
234
  }
235
+ /** 系统主题合法值 */
236
+ interface Theme {
237
+ /** 深色主题 */
238
+ dark
239
+ /** 浅色主题 */
240
+ light
241
+ }
242
+ interface Host {
243
+ /** 宿主 app 对应的 appId */
244
+ appId: string
245
+ }
246
+ /** 设备方向合法值 */
247
+ interface DeviceOrientation {
248
+ /** 竖屏 */
249
+ portrait
250
+ /** 横屏 */
251
+ landscape
252
+ }
71
253
  }
72
254
 
73
255
  namespace getSystemInfo {
74
256
  interface Option {
75
- /** 接口调用结束的回调函数(调用成功、失败都会执行) */
76
- complete?: (res: Result | any) => void
77
- /** 接口调用失败的回调函数 */
78
- fail?: (res: any) => void
79
257
  /** 接口调用成功的回调函数 */
80
258
  success?: (res: Result) => void
259
+ /** 接口调用失败的回调函数 */
260
+ fail?: (res: TaroGeneral.CallbackResult) => void
261
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
262
+ complete?: (res: TaroGeneral.CallbackResult | Result) => void
81
263
  }
82
- /**
83
- * 注意:**H5** 端不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
84
- * 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
85
- */
86
264
  interface Result extends TaroGeneral.CallbackResult {
87
- /** 客户端基础库版本 */
88
- SDKVersion: string
89
- /** 允许微信使用相册的开关(仅 iOS 有效) */
90
- albumAuthorized: boolean
91
- /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
92
- benchmarkLevel: number
93
- /** 蓝牙的系统开关 */
94
- bluetoothEnabled: boolean
95
265
  /** 设备品牌 */
96
266
  brand: string
97
- /** 允许微信使用摄像头的开关 */
98
- cameraAuthorized: boolean
99
- /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
100
- fontSizeSetting: number
101
- /** 微信设置的语言 */
102
- language: string
103
- /** 允许微信使用定位的开关 */
104
- locationAuthorized: boolean
105
- /** 地理位置的系统开关 */
106
- locationEnabled: boolean
107
- /** 允许微信使用麦克风的开关 */
108
- microphoneAuthorized: boolean
109
267
  /** 设备型号 */
110
268
  model: string
111
- /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
112
- notificationAlertAuthorized: boolean
113
- /** 允许微信通知的开关 */
114
- notificationAuthorized: boolean
115
- /** 允许微信通知带有标记的开关(仅 iOS 有效) */
116
- notificationBadgeAuthorized: boolean
117
- /** 允许微信通知带有声音的开关(仅 iOS 有效) */
118
- notificationSoundAuthorized: boolean
119
269
  /** 设备像素比 */
120
270
  pixelRatio: number
121
- /** 客户端平台 */
122
- platform: string
123
- /** 在竖屏正方向下的安全区域 */
124
- safeArea: TaroGeneral.SafeAreaResult
125
- /** 屏幕高度,单位px */
126
- screenHeight: number
127
271
  /** 屏幕宽度,单位px */
128
272
  screenWidth: number
273
+ /** 屏幕高度,单位px */
274
+ screenHeight: number
275
+ /** 可使用窗口宽度,单位px */
276
+ windowWidth: number
277
+ /** 可使用窗口高度,单位px */
278
+ windowHeight: number
129
279
  /** 状态栏的高度,单位px */
130
- statusBarHeight: number
280
+ statusBarHeight?: number
281
+ /** 微信设置的语言 */
282
+ language: string
283
+ /** 微信版本号 */
284
+ version?: string
131
285
  /** 操作系统及版本 */
132
286
  system: string
133
- /** 微信版本号 */
134
- version: string
287
+ /** 客户端平台 */
288
+ platform: string
289
+ /** 用户字体大小(单位px)。以微信客户端「我-设置-通用-字体大小」中的设置为准 */
290
+ fontSizeSetting?: number
291
+ /** 客户端基础库版本 */
292
+ SDKVersion?: string
293
+ /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
294
+ benchmarkLevel: number
295
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
296
+ albumAuthorized?: boolean
297
+ /** 允许微信使用摄像头的开关 */
298
+ cameraAuthorized?: boolean
299
+ /** 允许微信使用定位的开关 */
300
+ locationAuthorized?: boolean
301
+ /** 允许微信使用麦克风的开关 */
302
+ microphoneAuthorized?: boolean
303
+ /** 允许微信通知的开关 */
304
+ notificationAuthorized?: boolean
305
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
306
+ notificationAlertAuthorized?: boolean
307
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
308
+ notificationBadgeAuthorized?: boolean
309
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
310
+ notificationSoundAuthorized?: boolean
311
+ /** 允许微信使用日历的开关 */
312
+ phoneCalendarAuthorized?: boolean
313
+ /** 蓝牙的系统开关 */
314
+ bluetoothEnabled?: boolean
315
+ /** 地理位置的系统开关 */
316
+ locationEnabled?: boolean
135
317
  /** Wi-Fi 的系统开关 */
136
- wifiEnabled: boolean
137
- /** 可使用窗口高度,单位px */
138
- windowHeight: number
139
- /** 可使用窗口宽度,单位px */
140
- windowWidth: number
318
+ wifiEnabled?: boolean
319
+ /** 在竖屏正方向下的安全区域 */
320
+ safeArea?: TaroGeneral.SafeAreaResult
321
+ /** `true` 表示模糊定位,`false` 表示精确定位,仅 iOS 支持 */
322
+ locationReducedAccuracy?: boolean
323
+ /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
324
+ theme?: keyof Theme
325
+ /** 当前小程序运行的宿主环境 */
326
+ host?: Host
327
+ /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */
328
+ enableDebug?: boolean
329
+ /** 设备方向 */
330
+ deviceOrientation?: keyof DeviceOrientation
141
331
  /** 小程序当前运行环境 */
142
332
  environment?: string
143
- /** 调用结果 */
144
- errMsg: string
333
+ }
334
+ /** 系统主题合法值 */
335
+ interface Theme {
336
+ /** 深色主题 */
337
+ dark
338
+ /** 浅色主题 */
339
+ light
340
+ }
341
+ interface Host {
342
+ /** 宿主 app 对应的 appId */
343
+ appId: string
344
+ }
345
+ /** 设备方向合法值 */
346
+ interface DeviceOrientation {
347
+ /** 竖屏 */
348
+ portrait
349
+ /** 横屏 */
350
+ landscape
351
+ }
352
+ }
353
+
354
+ namespace getDeviceInfo {
355
+ interface Result {
356
+ /** 应用二进制接口类型(仅 Android 支持) */
357
+ abi?: string
358
+ /** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
359
+ benchmarkLevel: number
360
+ /** 设备品牌 */
361
+ brand: string
362
+ /** 设备型号 */
363
+ model: string
364
+ /** 操作系统及版本 */
365
+ system: string
366
+ /** 客户端平台 */
367
+ platform: string
368
+ }
369
+ }
370
+
371
+ namespace getAppBaseInfo {
372
+ interface Result {
373
+ /** 客户端基础库版本 */
374
+ SDKVersion?: string
375
+ /** 是否已打开调试。可通过右上角菜单或 [Taro.setEnableDebug](/docs/apis/base/debug/setEnableDebug) 打开调试。 */
376
+ enableDebug?: boolean
377
+ /** 当前小程序运行的宿主环境 */
378
+ host?: Host
379
+ /** 微信设置的语言 */
380
+ language: string
381
+ /** 微信版本号 */
382
+ version?: string
383
+ /** 系统当前主题,取值为light或dark,全局配置"darkmode":true时才能获取,否则为 undefined (不支持小游戏) */
384
+ theme?: keyof Theme
385
+ }
386
+ /** 系统主题合法值 */
387
+ interface Theme {
388
+ /** 深色主题 */
389
+ dark
390
+ /** 浅色主题 */
391
+ light
392
+ }
393
+ interface Host {
394
+ /** 宿主 app 对应的 appId */
395
+ appId: string
396
+ }
397
+ }
398
+
399
+ namespace getAppAuthorizeSetting {
400
+ interface Result {
401
+ /** 允许微信使用相册的开关(仅 iOS 有效) */
402
+ albumAuthorized: keyof Authorized
403
+ /** 允许微信使用蓝牙的开关(仅 iOS 有效) */
404
+ bluetoothAuthorized: keyof Authorized
405
+ /** 允许微信使用摄像头的开关 */
406
+ cameraAuthorized: keyof Authorized
407
+ /** 允许微信使用定位的开关 */
408
+ locationAuthorized: keyof Authorized
409
+ /** 定位准确度。true 表示模糊定位,false 表示精确定位(仅 iOS 有效) */
410
+ locationReducedAccuracy: boolean
411
+ /** 允许微信使用麦克风的开关 */
412
+ microphoneAuthorized: keyof Authorized
413
+ /** 允许微信通知的开关 */
414
+ notificationAuthorized: keyof Authorized
415
+ /** 允许微信通知带有提醒的开关(仅 iOS 有效) */
416
+ notificationAlertAuthorized: keyof Authorized
417
+ /** 允许微信通知带有标记的开关(仅 iOS 有效) */
418
+ notificationBadgeAuthorized: keyof Authorized
419
+ /** 允许微信通知带有声音的开关(仅 iOS 有效) */
420
+ notificationSoundAuthorized: keyof Authorized
421
+ /** 允许微信读写日历的开关 */
422
+ phoneCalendarAuthorized: keyof Authorized
423
+ }
424
+ /** 授权合法值 */
425
+ interface Authorized {
426
+ /** 表示已经获得授权,无需再次请求授权 */
427
+ authorized
428
+ /** 表示请求授权被拒绝,无法再次请求授权 (此情况需要引导用户打开[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),在设置页中打开权限) */
429
+ denied
430
+ /** 表示尚未请求授权,会在微信下一次调用系统相应权限时请求 (仅 iOS 会出现。此种情况下引导用户[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),不展示开关) */
431
+ 'not determined'
145
432
  }
146
433
  }
147
434
 
148
435
  interface TaroStatic {
149
- /**
150
- * 获取系统信息同步接口。
151
- * @supported weapp, h5, rn
436
+ /** 跳转系统蓝牙设置页
437
+ * @supported weapp
438
+ * @example
439
+ * ```tsx
440
+ * Taro.openSystemBluetoothSetting({
441
+ * success (res) {
442
+ * console.log(res)
443
+ * }
444
+ * })
445
+ * ```
446
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openSystemBluetoothSetting.html
447
+ */
448
+ openSystemBluetoothSetting(option: openSystemBluetoothSetting.Option): Promise<TaroGeneral.CallbackResult>
449
+
450
+ /** 跳转系统微信授权管理页
451
+ * @supported weapp
452
+ * @example
453
+ * ```tsx
454
+ * Taro.openAppAuthorizeSetting({
455
+ * success (res) {
456
+ * console.log(res)
457
+ * }
458
+ * })
459
+ * ```
460
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html
461
+ */
462
+ openAppAuthorizeSetting(option: openAppAuthorizeSetting.Option): Promise<TaroGeneral.CallbackResult>
463
+
464
+ /** 获取窗口信息
465
+ * @supported weapp
466
+ * @h5 不支持 statusBarHeight、safeArea
467
+ * @example
468
+ * ```tsx
469
+ * const windowInfo = Taro.getWindowInfo()
470
+ *
471
+ * console.log(windowInfo.pixelRatio)
472
+ * console.log(windowInfo.screenWidth)
473
+ * console.log(windowInfo.screenHeight)
474
+ * console.log(windowInfo.windowWidth)
475
+ * console.log(windowInfo.windowHeight)
476
+ * console.log(windowInfo.statusBarHeight)
477
+ * console.log(windowInfo.safeArea)
478
+ * console.log(windowInfo.screenTop)
479
+ * ```
480
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getWindowInfo.html
481
+ */
482
+ getWindowInfo(): getWindowInfo.Result
483
+
484
+ /** 获取设备设置
485
+ * @supported weapp, h5
486
+ * @h5 不支持 bluetoothEnabled、locationEnabled、wifiEnabled
487
+ * @example
488
+ * ```tsx
489
+ * const systemSetting = Taro.getSystemSetting()
490
+ *
491
+ * console.log(systemSetting.bluetoothEnabled)
492
+ * console.log(systemSetting.deviceOrientation)
493
+ * console.log(systemSetting.locationEnabled)
494
+ * console.log(systemSetting.wifiEnabled)
495
+ * ```
496
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemSetting.html
497
+ */
498
+ getSystemSetting(): getSystemSetting.Result
499
+
500
+ /** [Taro.getSystemInfo](./getSystemInfo) 的同步版本
501
+ * @supported weapp, h5, rn, tt
502
+ * @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
503
+ * @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
152
504
  * @example
153
505
  * ```tsx
154
506
  * try {
@@ -168,9 +520,32 @@ declare module '../../index' {
168
520
  */
169
521
  getSystemInfoSync(): getSystemInfoSync.Result
170
522
 
171
- /**
172
- * 获取系统信息,支持 `Promise` 化使用。
173
- * @supported weapp, h5, rn
523
+ /** 异步获取系统信息。需要一定的微信客户端版本支持,在不支持的客户端上,会使用同步实现来返回。
524
+ * @supported weapp, h5
525
+ * @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
526
+ * @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
527
+ * @example
528
+ * ```tsx
529
+ * Taro.getSystemInfoAsync({
530
+ * success (res) {
531
+ * console.log(res.model)
532
+ * console.log(res.pixelRatio)
533
+ * console.log(res.windowWidth)
534
+ * console.log(res.windowHeight)
535
+ * console.log(res.language)
536
+ * console.log(res.version)
537
+ * console.log(res.platform)
538
+ * }
539
+ * })
540
+ * ```
541
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getSystemInfoAsync.html
542
+ */
543
+ getSystemInfoAsync(res?: getSystemInfoAsync.Option): Promise<getSystemInfo.Result>
544
+
545
+ /** 获取系统信息,支持 `Promise` 化使用。
546
+ * @supported weapp, h5, rn, tt
547
+ * @h5 不支持 version、statusBarHeight、fontSizeSetting、SDKVersion
548
+ * @weapp 小程序可以在微信和企业微信中调用此接口,但是在企业微信中调用此接口时,会额外返回一个 environment 字段(微信中不返回),如此字段值为 wxwork,则表示当前小程序运行在企业微信环境中。
174
549
  * @example
175
550
  * ```tsx
176
551
  * Taro.getSystemInfo({
@@ -195,5 +570,68 @@ declare module '../../index' {
195
570
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/system-info/wx.getSystemInfo.html
196
571
  */
197
572
  getSystemInfo(res?: getSystemInfo.Option): Promise<getSystemInfo.Result>
573
+
574
+ /** 获取设备基础信息
575
+ * @supported weapp, h5
576
+ * @h5 不支持 abi、benchmarkLevel
577
+ * @example
578
+ * ```tsx
579
+ * const deviceInfo = Taro.getDeviceInfo()
580
+ *
581
+ * console.log(deviceInfo.abi)
582
+ * console.log(deviceInfo.benchmarkLevel)
583
+ * console.log(deviceInfo.brand)
584
+ * console.log(deviceInfo.model)
585
+ * console.log(deviceInfo.platform)
586
+ * console.log(deviceInfo.system)
587
+ * ```
588
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getDeviceInfo.html
589
+ */
590
+ getDeviceInfo(): getDeviceInfo.Result
591
+
592
+ /** 获取微信APP基础信息
593
+ * @supported weapp, h5
594
+ * @h5 不支持 SDKVersion、host、version
595
+ * @example
596
+ * ```tsx
597
+ * const appBaseInfo = Taro.getAppBaseInfo()
598
+ *
599
+ * console.log(appBaseInfo.SDKVersion)
600
+ * console.log(appBaseInfo.enableDebug)
601
+ * console.log(appBaseInfo.host)
602
+ * console.log(appBaseInfo.language)
603
+ * console.log(appBaseInfo.version)
604
+ * console.log(appBaseInfo.theme)
605
+ * ```
606
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppBaseInfo.html
607
+ */
608
+ getAppBaseInfo(): getAppBaseInfo.Result
609
+
610
+ /** 获取微信APP授权设置
611
+ *
612
+ * - 'authorized' 表示已经获得授权,无需再次请求授权;
613
+ * - 'denied' 表示请求授权被拒绝,无法再次请求授权;(此情况需要引导用户[打开系统设置](https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.openAppAuthorizeSetting.html),在设置页中打开权限)
614
+ * - 'non determined' 表示尚未请求授权,会在微信下一次调用系统相应权限时请求;(仅 iOS 会出现。此种情况下引导用户打开系统设置,不展示开关)
615
+ * @supported weapp, h5
616
+ * @h5 暂未支持设置权限
617
+ * @example
618
+ * ```tsx
619
+ * const appAuthorizeSetting = Taro.getAppAuthorizeSetting()
620
+ *
621
+ * console.log(appAuthorizeSetting.albumAuthorized)
622
+ * console.log(appAuthorizeSetting.bluetoothAuthorized)
623
+ * console.log(appAuthorizeSetting.cameraAuthorized)
624
+ * console.log(appAuthorizeSetting.locationAuthorized)
625
+ * console.log(appAuthorizeSetting.locationReducedAccuracy)
626
+ * console.log(appAuthorizeSetting.microphoneAuthorized)
627
+ * console.log(appAuthorizeSetting.notificationAlertAuthorized)
628
+ * console.log(appAuthorizeSetting.notificationAuthorized)
629
+ * console.log(appAuthorizeSetting.notificationBadgeAuthorized)
630
+ * console.log(appAuthorizeSetting.notificationSoundAuthorized)
631
+ * console.log(appAuthorizeSetting.phoneCalendarAuthorized)
632
+ * ```
633
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/base/system/wx.getAppAuthorizeSetting.html
634
+ */
635
+ getAppAuthorizeSetting(): getAppAuthorizeSetting.Result
198
636
  }
199
637
  }