@tarojs/taro 4.0.0-beta.7 → 4.0.0-beta.9

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "4.0.0-beta.7",
3
+ "version": "4.0.0-beta.9",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,17 +21,17 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "4.0.0-beta.7"
24
+ "@tarojs/api": "4.0.0-beta.9"
25
25
  },
26
26
  "devDependencies": {
27
- "@tarojs/helper": "4.0.0-beta.7",
28
- "@tarojs/runtime": "4.0.0-beta.7",
29
- "@tarojs/shared": "4.0.0-beta.7"
27
+ "@tarojs/helper": "4.0.0-beta.9",
28
+ "@tarojs/shared": "4.0.0-beta.9",
29
+ "@tarojs/runtime": "4.0.0-beta.9"
30
30
  },
31
31
  "peerDependencies": {
32
- "@tarojs/helper": "~4.0.0-beta.7",
33
- "@tarojs/runtime": "~4.0.0-beta.7",
34
- "@tarojs/shared": "~4.0.0-beta.7"
32
+ "@tarojs/shared": "~4.0.0-beta.9",
33
+ "@tarojs/helper": "~4.0.0-beta.9",
34
+ "@tarojs/runtime": "~4.0.0-beta.9"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@types/react": {
@@ -800,6 +800,15 @@ declare module '../../index' {
800
800
  setPosition(...args: any[]): void
801
801
  }
802
802
 
803
+ namespace createInnerAudioContext {
804
+ interface Option {
805
+ /** 是否使用 WebAudio 作为底层音频驱动,默认关闭。对于短音频、播放频繁的音频建议开启此选项,开启后将获得更优的性能表现。由于开启此选项后也会带来一定的内存增长,因此对于长音频建议关闭此选项。
806
+ * @supported weapp
807
+ */
808
+ useWebAudioImplement: boolean
809
+ }
810
+ }
811
+
803
812
  interface TaroStatic {
804
813
  /** 结束播放语音。
805
814
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
@@ -979,7 +988,7 @@ declare module '../../index' {
979
988
  * ```
980
989
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/audio/wx.createInnerAudioContext.html
981
990
  */
982
- createInnerAudioContext(): InnerAudioContext
991
+ createInnerAudioContext(option?: createInnerAudioContext.Option): InnerAudioContext
983
992
 
984
993
  /** 创建 audio 上下文 AudioContext 对象。
985
994
  * **注意:1.6.0 版本开始,本接口不再维护。建议使用能力更强的 [Taro.createInnerAudioContext](./createInnerAudioContext) 接口**
@@ -13,8 +13,8 @@ declare module '../../index' {
13
13
  */
14
14
  header?: TaroGeneral.IAnyObject
15
15
  /** 超时时间,单位为毫秒
16
- * @default 2000
17
- * @supported weapp, h5, tt, alipay
16
+ * @default 60000
17
+ * @supported weapp, h5, tt, alipay, rn
18
18
  */
19
19
  timeout?: number
20
20
  /** HTTP 请求方法
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
  1
44
44
  }
45
45
  }
46
-
46
+
47
47
  namespace deleteBookshelf {
48
48
  interface Option {
49
49
  /** 要删除的内容分类 */
@@ -115,13 +115,13 @@ declare module '../../index' {
115
115
  1
116
116
  }
117
117
  }
118
-
118
+
119
119
  namespace updateBookshelfReadTime {
120
120
  interface Option {
121
121
  /** 添加的内容分类 */
122
122
  category: keyof Category | string
123
123
  /** 要更新内容的 id;注释:contentId 为内容 id,内容的唯一标识,自定义,最长 22 字符(不能含有空格、中文字符) */
124
- contentIds: string[]
124
+ contentIds: string[]
125
125
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
126
126
  complete?: (res: TaroGeneral.CallbackResult) => void
127
127
  /** 接口调用失败的回调函数 */
@@ -278,7 +278,7 @@ declare module '../../index' {
278
278
  * @see https://smartprogram.baidu.com/docs/develop/api/open/swan-queryBookshelf/
279
279
  */
280
280
  updateBookshelfReadTime(option: updateBookshelfReadTime.Option): void
281
-
281
+
282
282
  /** 跳转到宿主书架
283
283
  * @supported swan
284
284
  * @swan (需宿主支持书架入口)
@@ -304,4 +304,4 @@ declare module '../../index' {
304
304
  */
305
305
  navigateToBookshelf(option: navigateToBookshelf.Option): void
306
306
  }
307
- }
307
+ }
@@ -147,7 +147,7 @@ declare module '../index' {
147
147
  Current: getCurrentInstance.Current
148
148
 
149
149
  /** Vue3 插件,用于设置 `getApp()` 中的全局变量
150
- * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
150
+ * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp, harmony_hybrid
151
151
  * @example
152
152
  * ```js
153
153
  * // 使用插件
package/types/index.d.ts CHANGED
@@ -3,53 +3,64 @@
3
3
  *
4
4
  * 目录结构
5
5
  * ├── api 小程序端能力 API
6
- * │ ├── ad
6
+ * │   ├── ad
7
7
  * │ │ └── index.d.ts 广告 API
8
- * │ ├── alipay
8
+ * │   ├── ai
9
+ * │   │   ├── face.d.ts 人脸检测 API
10
+ * │   │   ├── inference.d.ts AI 推理 API
11
+ * │   │   └── visionkit.d.ts 视觉算法 API
12
+ * │   ├── alipay
9
13
  * │ │ └── index.d.ts 支付宝小程序 API
10
- * │ ├── base
14
+ * │   ├── base
11
15
  * │ │ ├── index.d.ts 基础 API
16
+ * │   │   ├── crypto.d.ts 基础 -> 加密 API
12
17
  * │ │ ├── debug.d.ts 基础 -> 调试 API
18
+ * │   │   ├── env.d.ts 基础 -> ENV
19
+ * │   │   ├── performance.d.ts
13
20
  * │ │ ├── system.d.ts 基础 -> 系统 API
14
- * │ ├── update.d.ts 基础 -> 更新 API
15
- * │ ├── weapp 基础 -> 小程序 API
16
- * │ ├── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
17
- * │ └── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
18
- * │ │ └── env.d.ts 基础 -> ENV
19
- * │ ├── canvas
21
+ * │      ├── update.d.ts 基础 -> 更新 API
22
+ * │      └── weapp 基础 -> 小程序 API
23
+ * │      ├── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
24
+ * │      └── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
25
+ * │   ├── canvas
20
26
  * │ │ └── index.d.ts 画布 API
21
- * │ ├── cloud
27
+ * │   ├── cloud
22
28
  * │ │ └── index.d.ts 微信小程序云开发 API
23
- * │ ├── data-analysis
29
+ * │   ├── data-analysis
24
30
  * │ │ └── index.d.ts 数据分析 API
25
- * │ ├── device
31
+ * │   ├── device
26
32
  * │ │ ├── accelerometer.d.ts 设备 -> 加速计 API
33
+ * │   │   ├── accessibility.d.ts 设备 -> 无障碍 API
27
34
  * │ │ ├── battery.d.ts 设备 -> 电量 API
28
- * │ ├── ble.d.ts 设备 -> 低功耗蓝牙 API
29
- * │ ├── bluetooth.d. 设备 -> 蓝牙 API
35
+ * │      ├── bluetooth-ble.d.ts 设备 -> 蓝牙-低功耗中心设备 API
36
+ * │      ├── bluetooth-peripheral.d.ts 设备 -> 蓝牙-低功耗外围设备 API
37
+ * │   │   ├── bluetooth.d.ts 设备 -> 蓝牙-通用 API
38
+ * │   │   ├── calendar.d.ts 设备 -> 日历 API
30
39
  * │ │ ├── clipboard.d.ts 设备 -> 剪贴板 API
31
40
  * │ │ ├── compass.d.ts 设备 -> 罗盘 API
32
41
  * │ │ ├── contact.d.ts 设备 -> 联系人 API
33
- * │ │ ├── motion.d.ts 设备 -> 设备方向 API
34
42
  * │ │ ├── gyroscope.d.ts 设备 -> 陀螺仪 API
35
43
  * │ │ ├── iBeacon.d.ts 设备 -> iBeacon API
36
- * │ ├── network.d.ts 设备 -> 网络 API
37
- * │ ├── nfc.d.ts 设备 -> NFC API
38
- * │ │ ├── performance.d.ts 设备 -> 性能 API
44
+ * │      ├── keyboard.d.ts 设备 -> 键盘 API
45
+ * │      ├── memory.d.ts 设备 -> 内存 API
46
+ * │ │ ├── motion.d.ts 设备 -> 设备方向 API
47
+ * │   │   ├── network.d.ts 设备 -> 网络 API
48
+ * │   │   ├── nfc.d.ts 设备 -> NFC 读写 API
39
49
  * │ │ ├── phone.d.ts 设备 -> 电话 API
40
50
  * │ │ ├── scan.d.ts 设备 -> 扫码 API
41
51
  * │ │ ├── screen.d.ts 设备 -> 屏幕 API
52
+ * │   │   ├── sms.d.ts 设备 -> 短信 API
42
53
  * │ │ ├── vibrate.d.ts 设备 -> 振动 API
43
54
  * │ │ └── wifi.d.ts 设备 -> Wi-Fi API
44
- * │ ├── ext
55
+ * │   ├── ext
45
56
  * │ │ └── index.d.ts 第三方平台 API
46
- * │ ├── files
57
+ * │   ├── files
47
58
  * │ │ └── index.d.ts 文件 API
48
- * │ ├── framework
59
+ * │   ├── framework
49
60
  * │ │ └── index.d.ts 小程序框架 API
50
- * │ ├── location
61
+ * │   ├── location
51
62
  * │ │ └── index.d.ts 位置 API
52
- * │ ├── media
63
+ * │   ├── media
53
64
  * │ │ ├── audio.d.ts 媒体 -> 音频 API
54
65
  * │ │ ├── background-audio.d.ts 媒体 -> 背景音频 API
55
66
  * │ │ ├── camera.d.ts 媒体 -> 相机 API
@@ -57,21 +68,26 @@
57
68
  * │ │ ├── image.d.ts 媒体 -> 图片 API
58
69
  * │ │ ├── live.d.ts 媒体 -> 实时音视频 API
59
70
  * │ │ ├── map.d.ts 媒体 -> 地图 API
71
+ * │   │   ├── media-recorder.d.ts 媒体 -> 画面录制器 API
60
72
  * │ │ ├── recorder.d.ts 媒体 -> 录音 API
61
- * │ ├── video.d.ts 媒体 -> 视频 API
73
+ * │      ├── video-decoder.d.ts 媒体 -> 视频解码器 API
62
74
  * │ │ └── video-processing.d.ts 媒体 -> 音视频合成 API
63
- * │ ├── network
75
+ * │ ├── video.d.ts 媒体 -> 视频 API
76
+ * │   │   └── voip.d.ts 媒体 -> 实时语音 API
77
+ * │   ├── navigate
78
+ * │   │   └── index.d.ts 跳转 API
79
+ * │   ├── network
64
80
  * │ │ ├── download.d.ts 网络 -> 下载 API
65
81
  * │ │ ├── mdns.d.ts 网络 -> mDNS API
66
82
  * │ │ ├── request.d.ts 网络 -> 发起请求 API
83
+ * │   │   ├── tcp.d.ts 网络 -> TCP 通信 API
67
84
  * │ │ ├── udp.d.ts 网络 -> UDP 通信 API
68
85
  * │ │ ├── upload.d.ts 网络 -> 上传 API
69
86
  * │ │ └── websocket.d.ts 网络 -> WebSocket API
70
- * │ ├── open-api
87
+ * │   ├── open-api
71
88
  * │ │ ├── account.d.ts 开放接口 -> 账号信息 API
72
89
  * │ │ ├── address.d.ts 开放接口 -> 收货地址 API
73
90
  * │ │ ├── authorize.d.ts 开放接口 -> 授权 API
74
- * │ │ ├── bookshelf.d.ts 开放接口 -> 书架 API
75
91
  * │ │ ├── card.d.ts 开放接口 -> 卡券 API
76
92
  * | | ├── channels.d.ts 开放接口 -> 视频号 API
77
93
  * | | ├── customer-service.d.ts 开放接口 -> 微信客服 API
@@ -80,11 +96,10 @@
80
96
  * │ │ ├── favorites.d.ts 开放接口 -> 收藏 API
81
97
  * │ │ ├── group.d.ts 开放接口 -> 微信群 API
82
98
  * │ │ ├── invoice.d.ts 开放接口 -> 发票 API
83
- * │ ├── licence-plate.d.ts 开放接口 -> 车牌 API
99
+ * │      ├── license-plate.d.ts 开放接口 -> 车牌 API
84
100
  * │ │ ├── login.d.ts 开放接口 -> 登录 API
85
101
  * │ │ ├── my-miniprogram.d.ts 开放接口 -> 我的小程序 API
86
102
  * │ │ ├── privacy.d.ts 开放接口 -> 隐私信息授权 API
87
- * │ │ ├── payment.d.ts 开放接口 -> 支付 API
88
103
  * │ │ ├── redpackage.d.ts 开放接口 -> 微信红包 API
89
104
  * │ │ ├── settings.d.ts 开放接口 -> 设置 API
90
105
  * │ │ ├── soter.d.ts 开放接口 -> 生物认证 API
@@ -92,23 +107,33 @@
92
107
  * | | ├── subscribe-message.d.ts 开放接口 -> 订阅消息 API
93
108
  * │ │ ├── user-info.d.ts 开放接口 -> 用户信息 API
94
109
  * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
95
- * │ ├── route
110
+ * │   ├── payment
111
+ * │   │   └── index.d.ts 支付 API
112
+ * │   ├── qq
113
+ * │   │   └── index.d.ts QQ 小程序 API
114
+ * │   ├── route
96
115
  * │ │ └── index.d.ts 路由 API
97
- * │ ├── share
116
+ * │   ├── share
98
117
  * │ │ └── index.d.ts 转发 API
99
- * │ ├── skyline
118
+ * │   ├── skyline
100
119
  * │ │ └── index.d.ts 微信 Skyline API
101
- * │ ├── storage
120
+ * │   ├── storage
102
121
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
103
- * │ └── index.d.ts 数据缓存 API
104
- * │ ├── swan
122
+ * │      ├── cache-manager.d.ts 数据缓存 -> 缓存管理 API
123
+ * │   │   └── index.d.ts 数据缓存 API
124
+ * │   ├── swan
125
+ * │   │   ├── bookshelf.d.ts 百度小程序 -> 书架 API
126
+ * │   │   ├── download-package.d.ts 百度小程序 -> 下载包 API
105
127
  * │ │ └── index.d.ts 百度小程序 API
106
- * │ ├── ui
128
+ * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
+ * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
+ * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
+ * │   ├── ui
107
132
  * │ │ ├── animation.d.ts 界面 -> 动画 API
108
133
  * │ │ ├── background.d.ts 界面 -> 背景 API
109
134
  * │ │ ├── custom-component.d.ts 界面 -> 自定义组件 API
110
135
  * │ │ ├── fonts.d.ts 界面 -> 字体 API
111
- * │ ├── keyboard.d.ts 界面 -> 键盘 API
136
+ * │      ├── interaction.d.ts 界面 -> 交互 API
112
137
  * │ │ ├── menu.d.ts 界面 -> 菜单 API
113
138
  * │ │ ├── navigation-bar.d.ts 界面 -> 导航栏 API
114
139
  * │ │ ├── pull-down-refresh.d.ts 界面 -> 下拉刷新 API
@@ -116,14 +141,25 @@
116
141
  * │ │ ├── sticky.d.ts 界面 -> 置顶 API
117
142
  * │ │ ├── tab-bar.d.ts 界面 -> TabBar API
118
143
  * │ │ ├── window.d.ts 界面 -> 窗口 API
119
- * │ │ └── interaction.d.ts 界面 -> 交互 API
120
- * │ ├── worker
144
+ * │   ├── worker
121
145
  * │ │ └── index.d.ts Worker API
122
- * │ ├── wxml
146
+ * │   └── wxml
123
147
  * │ │ └── index.d.ts WXML API
124
- * ├── taro.extend.d.ts Taro 扩展 API 类型定义
125
- * │ └── taro.hooks.d.ts Taro Hooks 类型定义
148
+ * ├── compile
149
+ * │   ├── compiler.d.ts
150
+ * │   ├── config
151
+ * │   │   ├── h5.d.ts
152
+ * │   │   ├── index.d.ts
153
+ * │   │   ├── manifest.d.ts
154
+ * │   │   ├── mini.d.ts
155
+ * │   │   ├── project.d.ts
156
+ * │   │   ├── rn.d.ts
157
+ * │   │   └── util.d.ts
158
+ * │   ├── hooks.d.ts Taro Hooks 类型定义
159
+ * │   └── index.d.ts
160
+ * ├── global.d.ts
126
161
  * ├── index.d.ts 此文件
162
+ * ├── taro.api.d.ts
127
163
  * ├── taro.component.d.ts Taro Component 类型定义
128
164
  * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
129
165
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
@@ -135,6 +171,7 @@
135
171
  /// <reference path="taro.component.d.ts" />
136
172
  /// <reference path="taro.config.d.ts" />
137
173
  /// <reference path="taro.lifecycle.d.ts" />
174
+ /// <reference path="taro.runtime.d.ts" />
138
175
 
139
176
  /// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
140
177
  /// <reference types="@tarojs/plugin-platform-jd/types/shims-jd" />
@@ -154,6 +191,6 @@ declare namespace Taro {
154
191
  interface TaroStatic {}
155
192
  }
156
193
  declare global {
157
- const defineAppConfig: (config: Taro.Config) => Taro.Config
158
- const definePageConfig: (config: Taro.Config) => Taro.Config
194
+ const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
195
+ const definePageConfig: (config: Taro.PageConfig) => Taro.Config
159
196
  }
@@ -63,7 +63,6 @@
63
63
  /// <reference path="api/open-api/account.d.ts" />
64
64
  /// <reference path="api/open-api/address.d.ts" />
65
65
  /// <reference path="api/open-api/authorize.d.ts" />
66
- /// <reference path="api/open-api/bookshelf.d.ts" />
67
66
  /// <reference path="api/open-api/card.d.ts" />
68
67
  /// <reference path="api/open-api/channels.d.ts" />
69
68
  /// <reference path="api/open-api/customer-service.d.ts" />
@@ -121,6 +120,7 @@
121
120
  /// <reference path="api/alipay/index.d.ts" />
122
121
  /// <reference path="api/qq/index.d.ts" />
123
122
 
123
+ /// <reference path="api/swan/bookshelf.d.ts" />
124
124
  /// <reference path="api/swan/download-package.d.ts" />
125
125
  /// <reference path="api/swan/index.d.ts" />
126
126
  /// <reference path="api/swan/pay.d.ts" />
@@ -34,7 +34,7 @@ declare module './index' {
34
34
  backgroundColor?: string
35
35
  /** 下拉背景字体、loading 图的样式,仅支持 dark/light
36
36
  * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
37
- * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
37
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
38
38
  * @default: "dark"
39
39
  */
40
40
  backgroundTextStyle?: 'dark' | 'light' | string
@@ -56,9 +56,12 @@ declare module './index' {
56
56
  }
57
57
 
58
58
  interface PageResizeObject {
59
+ deviceOrientation?: 'portrait' | 'landscape'
59
60
  size: {
60
61
  windowWidth: number
61
62
  windowHeight: number
63
+ screenWidth?: number
64
+ screenHeight?: number
62
65
  }
63
66
  }
64
67
 
@@ -0,0 +1,9 @@
1
+ import type { options } from '@tarojs/runtime'
2
+
3
+ import Taro from './index'
4
+
5
+ declare module './index' {
6
+ interface TaroStatic {
7
+ options: typeof options
8
+ }
9
+ }