@tarojs/taro 3.5.0-beta.3 → 3.5.0-beta.6
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 +7 -8
- package/types/api/canvas/index.d.ts +1 -1
- package/types/api/device/vibrate.d.ts +4 -0
- package/types/api/location/index.d.ts +36 -0
- package/types/compile.d.ts +10 -0
- package/types/taro.component.d.ts +12 -24
- package/types/taro.hooks.d.ts +22 -4
- package/LICENSE +0 -21
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.5.0-beta.
|
|
3
|
+
"version": "3.5.0-beta.6",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -11,9 +11,6 @@
|
|
|
11
11
|
"html.css",
|
|
12
12
|
"html5.css"
|
|
13
13
|
],
|
|
14
|
-
"scripts": {
|
|
15
|
-
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
16
|
-
},
|
|
17
14
|
"repository": {
|
|
18
15
|
"type": "git",
|
|
19
16
|
"url": "git+https://github.com/NervJS/taro.git"
|
|
@@ -24,8 +21,8 @@
|
|
|
24
21
|
"author": "O2Team",
|
|
25
22
|
"license": "MIT",
|
|
26
23
|
"dependencies": {
|
|
27
|
-
"@tarojs/api": "3.5.0-beta.
|
|
28
|
-
"@tarojs/runtime": "3.5.0-beta.
|
|
24
|
+
"@tarojs/api": "3.5.0-beta.6",
|
|
25
|
+
"@tarojs/runtime": "3.5.0-beta.6"
|
|
29
26
|
},
|
|
30
27
|
"peerDependenciesMeta": {
|
|
31
28
|
"@types/react": {
|
|
@@ -41,5 +38,7 @@
|
|
|
41
38
|
"optional": true
|
|
42
39
|
}
|
|
43
40
|
},
|
|
44
|
-
"
|
|
45
|
-
|
|
41
|
+
"scripts": {
|
|
42
|
+
"test": "echo \"Error: run tests from root\" && exit 1"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -4,7 +4,7 @@ declare module '../../index' {
|
|
|
4
4
|
namespace canvasToTempFilePath {
|
|
5
5
|
interface Option {
|
|
6
6
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件实例 (canvas type="2d" 时使用该属性)。 */
|
|
7
|
-
canvas?:
|
|
7
|
+
canvas?: Canvas
|
|
8
8
|
/** 画布标识,传入 [canvas](/docs/components/canvas) 组件的 canvas-id */
|
|
9
9
|
canvasId?: string
|
|
10
10
|
/** 图片的质量,目前仅对 jpg 有效。取值范围为 (0, 1],不在范围内时当作 1.0 处理。 */
|
|
@@ -3,6 +3,8 @@ import Taro from '../../index'
|
|
|
3
3
|
declare module '../../index' {
|
|
4
4
|
namespace vibrateShort {
|
|
5
5
|
interface Option {
|
|
6
|
+
/** 震动强度类型,有效值为:heavy、medium、light */
|
|
7
|
+
type: 'heavy' | 'medium' | 'light'
|
|
6
8
|
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
9
|
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
10
|
/** 接口调用失败的回调函数 */
|
|
@@ -25,6 +27,8 @@ declare module '../../index' {
|
|
|
25
27
|
|
|
26
28
|
interface TaroStatic {
|
|
27
29
|
/** 使手机发生较短时间的振动(15 ms)。仅在 iPhone `7 / 7 Plus` 以上及 Android 机型生效
|
|
30
|
+
* @h5 不支持 type 参数
|
|
31
|
+
* @rn 不支持 type 参数
|
|
28
32
|
* @supported weapp, h5, rn, tt
|
|
29
33
|
* @example
|
|
30
34
|
* ```tsx
|
|
@@ -188,6 +188,26 @@ declare module '../../index' {
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
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
|
+
|
|
191
211
|
interface TaroStatic {
|
|
192
212
|
/** 关闭监听实时位置变化,前后台都停止消息接收
|
|
193
213
|
* @supported weapp, rn, tt
|
|
@@ -329,5 +349,21 @@ declare module '../../index' {
|
|
|
329
349
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.chooseLocation.html
|
|
330
350
|
*/
|
|
331
351
|
chooseLocation(option: chooseLocation.Option): Promise<chooseLocation.SuccessCallbackResult>
|
|
352
|
+
|
|
353
|
+
/** 获取当前的模糊地理位置
|
|
354
|
+
* @supported weapp
|
|
355
|
+
* @example
|
|
356
|
+
* ```tsx
|
|
357
|
+
* Taro.getFuzzyLocation({
|
|
358
|
+
* type: 'wgs84',
|
|
359
|
+
* success (res) {
|
|
360
|
+
* const latitude = res.latitude
|
|
361
|
+
* const longitude = res.longitude
|
|
362
|
+
* },
|
|
363
|
+
* })
|
|
364
|
+
* ```
|
|
365
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/location/wx.getFuzzyLocation.html
|
|
366
|
+
*/
|
|
367
|
+
getFuzzyLocation(option: getFuzzyLocation.Option): Promise<getFuzzyLocation.SuccessCallbackResult>
|
|
332
368
|
}
|
|
333
369
|
}
|
package/types/compile.d.ts
CHANGED
|
@@ -388,6 +388,8 @@ interface ILogger {
|
|
|
388
388
|
}
|
|
389
389
|
|
|
390
390
|
export interface IProjectBaseConfig {
|
|
391
|
+
isWatch?: boolean
|
|
392
|
+
port?: number
|
|
391
393
|
projectName?: string
|
|
392
394
|
date?: string
|
|
393
395
|
designWidth?: number
|
|
@@ -410,9 +412,17 @@ export interface IProjectBaseConfig {
|
|
|
410
412
|
presets?: PluginItem[]
|
|
411
413
|
baseLevel?: number
|
|
412
414
|
framework?: string
|
|
415
|
+
frameworkExts?: string[]
|
|
413
416
|
compiler?: Compiler
|
|
414
417
|
cache?: ICache
|
|
415
418
|
logger?: ILogger
|
|
419
|
+
enableSourceMap?: boolean
|
|
420
|
+
/** hooks */
|
|
421
|
+
modifyWebpackChain?: HookModifyWebpackChain
|
|
422
|
+
modifyMiniConfigs?: (configMap) => Promise<any>
|
|
423
|
+
modifyBuildAssets?: (assets, plugin?) => Promise<any>
|
|
424
|
+
onWebpackChainReady?: (webpackChain: Chain) => Promise<any>
|
|
425
|
+
onBuildFinish?: (res: { error, stats, isWatch }) => Promise<any>
|
|
416
426
|
}
|
|
417
427
|
|
|
418
428
|
export interface IProjectConfig extends IProjectBaseConfig {
|
|
@@ -15,13 +15,7 @@ declare module './index' {
|
|
|
15
15
|
componentDidShow?(): void
|
|
16
16
|
componentDidHide?(): void
|
|
17
17
|
componentDidCatchError?(err: string): void
|
|
18
|
-
componentDidNotFound?(
|
|
19
|
-
onPullDownRefresh?(): void
|
|
20
|
-
onReachBottom?(): void
|
|
21
|
-
onPageScroll?(obj: PageScrollObject): void
|
|
22
|
-
onShareAppMessage?(obj: ShareAppMessageObject): ShareAppMessageReturn
|
|
23
|
-
onTabItemTap?(obj: TabItemTapObject): void
|
|
24
|
-
onResize?(obj: PageResizeObject): void
|
|
18
|
+
componentDidNotFound?(opt: PageNotFoundObject): void
|
|
25
19
|
}
|
|
26
20
|
interface ComponentOptions {
|
|
27
21
|
addGlobalClass?: boolean
|
|
@@ -74,10 +68,10 @@ declare module './index' {
|
|
|
74
68
|
onHide?(): void
|
|
75
69
|
}
|
|
76
70
|
interface AppInstance extends Show {
|
|
77
|
-
mount(component: React.Component | Vue.ComponentOptions<Vue>, id: string, cb: () => void): void
|
|
71
|
+
mount(component: React.Component | Vue.ComponentOptions<Vue>, id: string, cb: (...args: any[]) => void): void
|
|
78
72
|
componentDidShow?(options?: Record<string, unknown>): void
|
|
79
73
|
onShow?(options?: Record<string, unknown>): void
|
|
80
|
-
unmount(id: string, cb
|
|
74
|
+
unmount(id: string, cb?: () => void): void
|
|
81
75
|
}
|
|
82
76
|
type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
|
|
83
77
|
interface MpEvent {
|
|
@@ -87,18 +81,18 @@ declare module './index' {
|
|
|
87
81
|
currentTarget: Target
|
|
88
82
|
}
|
|
89
83
|
interface PageLifeCycle extends Show {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
onPageScroll?(obj: { scrollTop: number }): void
|
|
93
|
-
onShareAppMessage?(obj: { from: string; target?: any; webViewUrl: string }): void
|
|
94
|
-
onResize?(options: unknown): void
|
|
95
|
-
onTabItemTap?(obj: { index: string; pagePath: string; text: string }): void
|
|
96
|
-
onTitleClick?(): void
|
|
84
|
+
eh?(event: MpEvent): void
|
|
85
|
+
onLoad(options: Record<string, unknown>): void
|
|
97
86
|
onOptionMenuClick?(): void
|
|
87
|
+
onPageScroll?(opt: PageScrollObject): void
|
|
98
88
|
onPopMenuClick?(): void
|
|
89
|
+
onPullDownRefresh?(): void
|
|
99
90
|
onPullIntercept?(): void
|
|
100
|
-
|
|
101
|
-
|
|
91
|
+
onReachBottom?(): void
|
|
92
|
+
onResize?(opt: PageResizeObject): void
|
|
93
|
+
onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
|
|
94
|
+
onTabItemTap?(opt: TabItemTapObject): void
|
|
95
|
+
onTitleClick?(): void
|
|
102
96
|
onUnload(): void
|
|
103
97
|
}
|
|
104
98
|
interface ComponentInstance<
|
|
@@ -185,10 +179,4 @@ declare module './index' {
|
|
|
185
179
|
/** 页面的组件选项 */
|
|
186
180
|
options?: Record<string, unknown>
|
|
187
181
|
}
|
|
188
|
-
interface TaroStatic {
|
|
189
|
-
memo<P = {}>(
|
|
190
|
-
FunctionComponent: FunctionComponent<P>,
|
|
191
|
-
compare?: (oldProps: P, newProps: P) => boolean
|
|
192
|
-
): FunctionComponent<P>
|
|
193
|
-
}
|
|
194
182
|
}
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -4,57 +4,67 @@ declare module './index' {
|
|
|
4
4
|
interface TaroStatic {
|
|
5
5
|
/**
|
|
6
6
|
* 页面展示时的回调。
|
|
7
|
+
* @supported global
|
|
7
8
|
*/
|
|
8
9
|
useDidShow(callback: () => void): void
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* 页面隐藏时的回调。
|
|
13
|
+
* @supported global
|
|
12
14
|
*/
|
|
13
15
|
useDidHide(callback: () => void): void
|
|
14
16
|
|
|
15
17
|
/**
|
|
16
18
|
* 下拉刷新时的回调。
|
|
19
|
+
* @supported global
|
|
17
20
|
*/
|
|
18
21
|
usePullDownRefresh(callback: () => void): void
|
|
19
22
|
|
|
20
23
|
/**
|
|
21
24
|
* 上拉触底时的回调。
|
|
25
|
+
* @supported global
|
|
22
26
|
*/
|
|
23
27
|
useReachBottom(callback: () => void): void
|
|
24
28
|
|
|
25
29
|
/**
|
|
26
30
|
* 页面滚动时的回调。
|
|
31
|
+
* @supported global
|
|
27
32
|
*/
|
|
28
33
|
usePageScroll(callback: (payload: PageScrollObject) => void): void
|
|
29
34
|
|
|
30
35
|
/**
|
|
31
36
|
* 页面尺寸改变时的回调。
|
|
37
|
+
* @supported global
|
|
32
38
|
*/
|
|
33
39
|
useResize(callback: (payload: PageResizeObject) => void): void
|
|
34
40
|
|
|
35
41
|
/**
|
|
36
42
|
* 页面转发时的回调。
|
|
43
|
+
* @supported weapp
|
|
37
44
|
*/
|
|
38
45
|
useShareAppMessage(callback: (payload: ShareAppMessageObject) => ShareAppMessageReturn): void
|
|
39
46
|
|
|
40
47
|
/**
|
|
41
48
|
* 当前是 tab 页时,tab 被点击时的回调。
|
|
49
|
+
* @supported weapp, rn
|
|
42
50
|
*/
|
|
43
51
|
useTabItemTap(callback: (payload: TabItemTapObject) => void): void
|
|
44
52
|
|
|
45
53
|
/**
|
|
46
54
|
* 用户点击右上角菜单“收藏”按钮时的回调。
|
|
55
|
+
* @supported weapp
|
|
47
56
|
*/
|
|
48
57
|
useAddToFavorites(callback: (payload: AddToFavoritesObject) => AddToFavoritesReturnObject): void
|
|
49
58
|
|
|
50
59
|
/**
|
|
51
60
|
* 用户点击右上角菜单“分享到朋友圈”按钮时的回调。
|
|
61
|
+
* @supported weapp
|
|
52
62
|
*/
|
|
53
63
|
useShareTimeline(callback: () => ShareTimelineReturnObject): void
|
|
54
64
|
|
|
55
65
|
/**
|
|
56
66
|
* 页面销毁前保留状态回调
|
|
57
|
-
*
|
|
67
|
+
* @supported weapp
|
|
58
68
|
*/
|
|
59
69
|
useSaveExitState(callback: () => {
|
|
60
70
|
data: Record<any, any>
|
|
@@ -63,55 +73,63 @@ declare module './index' {
|
|
|
63
73
|
|
|
64
74
|
/**
|
|
65
75
|
* 小程序初始化完成时的回调。
|
|
76
|
+
* @supported weapp, h5
|
|
66
77
|
*/
|
|
67
78
|
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
68
79
|
|
|
69
80
|
/**
|
|
70
81
|
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
82
|
+
* @supported weapp, h5
|
|
71
83
|
*/
|
|
72
84
|
useError(callback: (error: string) => void): void
|
|
73
85
|
|
|
74
86
|
/**
|
|
75
87
|
* 小程序要打开的页面不存在时触发的回调。
|
|
88
|
+
* @supported weapp, h5
|
|
89
|
+
* @h5 多页面模式不支持该方法
|
|
76
90
|
*/
|
|
77
91
|
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
78
92
|
|
|
79
93
|
/**
|
|
80
94
|
* 页面加载完成时的回调。
|
|
95
|
+
* @supported weapp, h5
|
|
81
96
|
*/
|
|
82
97
|
useLoad(callback: () => void): void
|
|
83
98
|
|
|
84
99
|
/**
|
|
85
100
|
* 页面卸载时的回调。
|
|
101
|
+
* @supported weapp, h5
|
|
86
102
|
*/
|
|
87
103
|
useUnload(callback: () => void): void
|
|
88
104
|
|
|
89
105
|
/**
|
|
90
106
|
* 页面初次渲染完成的回调。
|
|
91
107
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
108
|
+
* @supported weapp, h5
|
|
92
109
|
*/
|
|
93
110
|
useReady(callback: () => void): void
|
|
94
111
|
|
|
95
112
|
/**
|
|
96
113
|
* 获取当前路由参数。
|
|
114
|
+
* @supported global
|
|
97
115
|
*/
|
|
98
116
|
useRouter<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>>(dynamic?: boolean): RouterInfo<TParams>
|
|
99
117
|
|
|
100
118
|
/**
|
|
101
119
|
* 导航栏的标题被点击时的回调。
|
|
102
|
-
*
|
|
120
|
+
* @supported alipay
|
|
103
121
|
*/
|
|
104
122
|
useTitleClick(callback: () => void): void
|
|
105
123
|
|
|
106
124
|
/**
|
|
107
125
|
* 导航栏的额外图标被点击时的回调。
|
|
108
|
-
*
|
|
126
|
+
* @supported alipay
|
|
109
127
|
*/
|
|
110
128
|
useOptionMenuClick(callback: () => void): void
|
|
111
129
|
|
|
112
130
|
/**
|
|
113
131
|
* 下拉中断时的回调。
|
|
114
|
-
*
|
|
132
|
+
* @supported alipay, h5
|
|
115
133
|
*/
|
|
116
134
|
usePullIntercept(callback: () => void): void
|
|
117
135
|
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|