@tarojs/taro 3.6.0-canary.8 → 3.6.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.
- package/package.json +3 -3
- package/types/api/base/env.d.ts +5 -1
- package/types/api/base/system.d.ts +4 -0
- package/types/api/network/download.d.ts +1 -1
- package/types/api/network/upload.d.ts +1 -1
- package/types/api/wxml/index.d.ts +22 -5
- package/types/compile/config/h5.d.ts +5 -0
- package/types/compile/config/project.d.ts +2 -2
- package/types/index.d.ts +6 -0
- package/types/taro.hooks.d.ts +2 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "3.6.0
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
|
|
6
6
|
"main": "index.js",
|
|
@@ -21,8 +21,8 @@
|
|
|
21
21
|
"author": "O2Team",
|
|
22
22
|
"license": "MIT",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@tarojs/api": "3.6.0
|
|
25
|
-
"@tarojs/runtime": "3.6.0
|
|
24
|
+
"@tarojs/api": "3.6.0",
|
|
25
|
+
"@tarojs/runtime": "3.6.0"
|
|
26
26
|
},
|
|
27
27
|
"peerDependenciesMeta": {
|
|
28
28
|
"@types/react": {
|
package/types/api/base/env.d.ts
CHANGED
|
@@ -8,8 +8,12 @@ declare module '../../index' {
|
|
|
8
8
|
*/
|
|
9
9
|
env: {
|
|
10
10
|
[key: string]: string | undefined
|
|
11
|
+
/** 框架 */
|
|
12
|
+
FRAMEWORK: 'react' | 'preact' | 'nerv' | 'vue' | 'vue3'
|
|
13
|
+
/** Taro 环境变量 */
|
|
14
|
+
TARO_ENV: 'weapp' | 'h5' | 'rn' | 'swan' | 'alipay' | 'tt' | 'qq' | 'jd' | 'quickapp'
|
|
11
15
|
/** 文件系统中的用户目录路径 (本地路径) */
|
|
12
|
-
USER_DATA_PATH
|
|
16
|
+
USER_DATA_PATH?: string
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
}
|
|
@@ -355,6 +355,8 @@ declare module '../../index' {
|
|
|
355
355
|
interface Result {
|
|
356
356
|
/** 应用二进制接口类型(仅 Android 支持) */
|
|
357
357
|
abi?: string
|
|
358
|
+
/** 设备二进制接口类型(仅 Android 支持) */
|
|
359
|
+
deviceAbi: string
|
|
358
360
|
/** 设备性能等级(仅Android小游戏)。取值为:-2 或 0(该设备无法运行小游戏),-1(性能未知),>=1(设备性能值,该值越高,设备性能越好,目前最高不到50) */
|
|
359
361
|
benchmarkLevel: number
|
|
360
362
|
/** 设备品牌 */
|
|
@@ -365,6 +367,8 @@ declare module '../../index' {
|
|
|
365
367
|
system: string
|
|
366
368
|
/** 客户端平台 */
|
|
367
369
|
platform: string
|
|
370
|
+
/** 设备 CPU 型号(仅 Android 支持) */
|
|
371
|
+
CPUType: string
|
|
368
372
|
}
|
|
369
373
|
}
|
|
370
374
|
|
|
@@ -87,7 +87,7 @@ declare module '../../index' {
|
|
|
87
87
|
}
|
|
88
88
|
|
|
89
89
|
type DownloadTaskPromise = Promise<downloadFile.FileSuccessCallbackResult> & DownloadTask & {
|
|
90
|
-
headersReceive: DownloadTask['onHeadersReceived']
|
|
90
|
+
headersReceive: DownloadTask['onHeadersReceived']
|
|
91
91
|
progress: DownloadTask['onProgressUpdate']
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -86,7 +86,7 @@ declare module '../../index' {
|
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
type UploadTaskPromise = Promise<uploadFile.SuccessCallbackResult> & UploadTask & {
|
|
89
|
-
headersReceive: UploadTask['onHeadersReceived']
|
|
89
|
+
headersReceive: UploadTask['onHeadersReceived']
|
|
90
90
|
progress: UploadTask['onProgressUpdate']
|
|
91
91
|
}
|
|
92
92
|
}
|
|
@@ -18,12 +18,12 @@ declare module '../../index' {
|
|
|
18
18
|
*/
|
|
19
19
|
interface IntersectionObserver {
|
|
20
20
|
/** 停止监听。回调函数将不再触发
|
|
21
|
-
* @supported weapp, tt
|
|
21
|
+
* @supported weapp, tt, h5
|
|
22
22
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html
|
|
23
23
|
*/
|
|
24
24
|
disconnect(): void
|
|
25
25
|
/** 指定目标节点并开始监听相交状态变化情况
|
|
26
|
-
* @supported weapp, tt
|
|
26
|
+
* @supported weapp, tt, h5
|
|
27
27
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html
|
|
28
28
|
*/
|
|
29
29
|
observe(
|
|
@@ -33,7 +33,7 @@ declare module '../../index' {
|
|
|
33
33
|
callback: IntersectionObserver.ObserveCallback,
|
|
34
34
|
): void
|
|
35
35
|
/** 使用选择器指定一个节点,作为参照区域之一。
|
|
36
|
-
* @supported weapp, tt
|
|
36
|
+
* @supported weapp, tt, h5
|
|
37
37
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html
|
|
38
38
|
*/
|
|
39
39
|
relativeTo(
|
|
@@ -43,7 +43,7 @@ declare module '../../index' {
|
|
|
43
43
|
margins?: IntersectionObserver.RelativeToMargins,
|
|
44
44
|
): IntersectionObserver
|
|
45
45
|
/** 指定页面显示区域作为参照区域之一
|
|
46
|
-
* @supported weapp, tt
|
|
46
|
+
* @supported weapp, tt, h5
|
|
47
47
|
* @example
|
|
48
48
|
* 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
|
|
49
49
|
*
|
|
@@ -500,7 +500,7 @@ declare module '../../index' {
|
|
|
500
500
|
createSelectorQuery(): SelectorQuery
|
|
501
501
|
|
|
502
502
|
/** 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
|
|
503
|
-
* @supported weapp, tt
|
|
503
|
+
* @supported weapp, h5, tt
|
|
504
504
|
* @example
|
|
505
505
|
* ```tsx
|
|
506
506
|
* const observer = Taro.createIntersectionObserver(this, { thresholds: [0], observeAll: true })
|
|
@@ -513,5 +513,22 @@ declare module '../../index' {
|
|
|
513
513
|
/** 选项 */
|
|
514
514
|
options?: createIntersectionObserver.Option,
|
|
515
515
|
): IntersectionObserver
|
|
516
|
+
|
|
517
|
+
/** 创建并返回一个 MediaQueryObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createMediaQueryObserver()` 来代替。
|
|
518
|
+
* @supported h5
|
|
519
|
+
* @example
|
|
520
|
+
* ```tsx
|
|
521
|
+
* let createMediaQueryObserver
|
|
522
|
+
* if (process.env.TARO_ENV === 'weapp') {
|
|
523
|
+
* // 小程序没有组件实例,只能获取Page级组件实例
|
|
524
|
+
* createMediaQueryObserver = Taro.getCurrentInstance().page.createMediaQueryObserver
|
|
525
|
+
* } else if (process.env.TARO_ENV === 'h5') {
|
|
526
|
+
* createMediaQueryObserver= Taro.createMediaQueryObserver
|
|
527
|
+
* }
|
|
528
|
+
* const mediaQueryObserver = createMediaQueryObserver()
|
|
529
|
+
* ```
|
|
530
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html#Media%20Query
|
|
531
|
+
*/
|
|
532
|
+
createMediaQueryObserver(): MediaQueryObserver
|
|
516
533
|
}
|
|
517
534
|
}
|
|
@@ -24,9 +24,9 @@ export interface IProjectBaseConfig {
|
|
|
24
24
|
port?: number
|
|
25
25
|
projectName?: string
|
|
26
26
|
date?: string
|
|
27
|
-
designWidth?: number
|
|
28
|
-
watcher?: any[]
|
|
27
|
+
designWidth?: number | ((size: number) => number)
|
|
29
28
|
deviceRatio?: TaroGeneral.TDeviceRatio
|
|
29
|
+
watcher?: any[]
|
|
30
30
|
sourceRoot?: string
|
|
31
31
|
outputRoot?: string
|
|
32
32
|
env?: IOption
|
package/types/index.d.ts
CHANGED
|
@@ -127,6 +127,12 @@
|
|
|
127
127
|
/// <reference path="taro.hooks.d.ts" />
|
|
128
128
|
/// <reference path="taro.lifecycle.d.ts" />
|
|
129
129
|
|
|
130
|
+
/// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
|
|
131
|
+
/// <reference types="@tarojs/plugin-platform-jd/types/shims-jd" />
|
|
132
|
+
/// <reference types="@tarojs/plugin-platform-swan/types/shims-swan" />
|
|
133
|
+
/// <reference types="@tarojs/plugin-platform-tt/types/shims-tt" />
|
|
134
|
+
/// <reference types="@tarojs/plugin-platform-weapp/types/shims-weapp" />
|
|
135
|
+
|
|
130
136
|
export = Taro
|
|
131
137
|
export as namespace Taro
|
|
132
138
|
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ declare module './index' {
|
|
|
6
6
|
* 页面展示时的回调。
|
|
7
7
|
* @supported global
|
|
8
8
|
*/
|
|
9
|
-
useDidShow(callback: () => void): void
|
|
9
|
+
useDidShow(callback: (options?: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* 页面隐藏时的回调。
|
|
@@ -100,7 +100,7 @@ declare module './index' {
|
|
|
100
100
|
* 页面加载完成时的回调。
|
|
101
101
|
* @supported weapp, h5
|
|
102
102
|
*/
|
|
103
|
-
useLoad(callback: () => void): void
|
|
103
|
+
useLoad<T extends {} = Record<string, any>>(callback: (param: T) => void): void
|
|
104
104
|
|
|
105
105
|
/**
|
|
106
106
|
* 页面卸载时的回调。
|