@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.
- package/html.css +50 -14
- package/html5.css +167 -64
- package/index.js +3 -4
- package/package.json +21 -11
- package/types/api/ad/index.d.ts +2 -2
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/visionkit.d.ts +303 -0
- package/types/api/base/crypto.d.ts +90 -0
- package/types/api/base/debug.d.ts +152 -13
- package/types/api/base/env.d.ts +2 -1
- package/types/api/base/index.d.ts +11 -3
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +541 -103
- package/types/api/base/update.d.ts +60 -8
- package/types/api/base/weapp/app-event.d.ts +99 -37
- package/types/api/base/weapp/life-cycle.d.ts +142 -2
- package/types/api/canvas/index.d.ts +151 -137
- package/types/api/cloud/index.d.ts +17 -2
- package/types/api/data-analysis/index.d.ts +1 -1
- package/types/api/device/accelerometer.d.ts +6 -6
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +2 -2
- package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +67 -2
- package/types/api/device/calendar.d.ts +88 -0
- package/types/api/device/clipboard.d.ts +2 -2
- package/types/api/device/compass.d.ts +3 -3
- package/types/api/device/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +6 -6
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +1 -1
- package/types/api/device/{performance.d.ts → memory.d.ts} +5 -5
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +56 -15
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/phone.d.ts +1 -1
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +42 -14
- package/types/api/device/vibrate.d.ts +6 -2
- package/types/api/device/wifi.d.ts +44 -9
- package/types/api/ext/index.d.ts +2 -2
- package/types/api/files/index.d.ts +392 -205
- package/types/api/framework/index.d.ts +5 -4
- package/types/api/location/index.d.ts +156 -53
- package/types/api/media/audio.d.ts +629 -38
- package/types/api/media/background-audio.d.ts +9 -9
- package/types/api/media/camera.d.ts +41 -22
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +64 -35
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +474 -54
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +21 -21
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +11 -7
- package/types/api/media/video.d.ts +47 -18
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +65 -27
- package/types/api/network/download.d.ts +61 -19
- package/types/api/network/request.d.ts +129 -41
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +154 -83
- package/types/api/network/upload.d.ts +55 -28
- package/types/api/network/websocket.d.ts +20 -19
- package/types/api/open-api/address.d.ts +1 -1
- package/types/api/open-api/authorize.d.ts +42 -3
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/facial.d.ts +3 -0
- package/types/api/open-api/favorites.d.ts +100 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +2 -2
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +21 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +82 -17
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +89 -4
- package/types/api/open-api/user-info.d.ts +56 -19
- package/types/api/open-api/werun.d.ts +33 -6
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/route/index.d.ts +18 -14
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +38 -92
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +105 -155
- package/types/api/ui/background.d.ts +4 -2
- package/types/api/ui/custom-component.d.ts +1 -1
- package/types/api/ui/fonts.d.ts +27 -31
- package/types/api/ui/interaction.d.ts +6 -6
- package/types/api/ui/menu.d.ts +1 -1
- package/types/api/ui/navigation-bar.d.ts +6 -5
- package/types/api/ui/pull-down-refresh.d.ts +2 -2
- package/types/api/ui/scroll.d.ts +75 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +8 -8
- package/types/api/ui/window.d.ts +22 -2
- package/types/api/worker/index.d.ts +9 -1
- package/types/api/wxml/index.d.ts +116 -112
- package/types/compile.d.ts +57 -6
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +21 -65
- package/types/taro.config.d.ts +31 -0
- package/types/taro.extend.d.ts +31 -18
- package/types/taro.hooks.d.ts +55 -3
- package/types/taro.lifecycle.d.ts +21 -14
- package/LICENSE +0 -21
- package/types/api/open-api/payment.d.ts +0 -61
package/types/taro.api.d.ts
CHANGED
|
@@ -6,89 +6,106 @@
|
|
|
6
6
|
* thanks for the great work by @qiu8310 👍👍👍
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
|
-
/// <reference path="api/
|
|
9
|
+
/// <reference path="api/framework/index.d.ts" />
|
|
10
10
|
/// <reference path="api/base/index.d.ts" />
|
|
11
|
-
/// <reference path="api/base/debug.d.ts" />
|
|
12
11
|
/// <reference path="api/base/system.d.ts" />
|
|
13
12
|
/// <reference path="api/base/update.d.ts" />
|
|
14
13
|
/// <reference path="api/base/weapp/life-cycle.d.ts" />
|
|
15
14
|
/// <reference path="api/base/weapp/app-event.d.ts" />
|
|
15
|
+
/// <reference path="api/base/debug.d.ts" />
|
|
16
|
+
/// <reference path="api/base/performance.d.ts" />
|
|
17
|
+
/// <reference path="api/base/crypto.d.ts" />
|
|
16
18
|
/// <reference path="api/base/env.d.ts" />
|
|
17
|
-
/// <reference path="api/
|
|
18
|
-
/// <reference path="api/
|
|
19
|
+
/// <reference path="api/route/index.d.ts" />
|
|
20
|
+
/// <reference path="api/navigate/index.d.ts" />
|
|
21
|
+
/// <reference path="api/share/index.d.ts" />
|
|
22
|
+
/// <reference path="api/ui/interaction.d.ts" />
|
|
23
|
+
/// <reference path="api/ui/navigation-bar.d.ts" />
|
|
24
|
+
/// <reference path="api/ui/background.d.ts" />
|
|
25
|
+
/// <reference path="api/ui/tab-bar.d.ts" />
|
|
26
|
+
/// <reference path="api/ui/fonts.d.ts" />
|
|
27
|
+
/// <reference path="api/ui/pull-down-refresh.d.ts" />
|
|
28
|
+
/// <reference path="api/ui/scroll.d.ts" />
|
|
29
|
+
/// <reference path="api/ui/animation.d.ts" />
|
|
30
|
+
/// <reference path="api/ui/sticky.d.ts" />
|
|
31
|
+
/// <reference path="api/ui/custom-component.d.ts" />
|
|
32
|
+
/// <reference path="api/ui/menu.d.ts" />
|
|
33
|
+
/// <reference path="api/ui/window.d.ts" />
|
|
34
|
+
/// <reference path="api/network/request.d.ts" />
|
|
35
|
+
/// <reference path="api/network/download.d.ts" />
|
|
36
|
+
/// <reference path="api/network/upload.d.ts" />
|
|
37
|
+
/// <reference path="api/network/websocket.d.ts" />
|
|
38
|
+
/// <reference path="api/network/mdns.d.ts" />
|
|
39
|
+
/// <reference path="api/network/tcp.d.ts" />
|
|
40
|
+
/// <reference path="api/network/udp.d.ts" />
|
|
41
|
+
/// <reference path="api/payment/index.d.ts" />
|
|
42
|
+
/// <reference path="api/storage/index.d.ts" />
|
|
43
|
+
/// <reference path="api/storage/background-fetch.d.ts" />
|
|
19
44
|
/// <reference path="api/data-analysis/index.d.ts" />
|
|
20
|
-
/// <reference path="api/
|
|
21
|
-
/// <reference path="api/
|
|
22
|
-
/// <reference path="api/
|
|
23
|
-
/// <reference path="api/
|
|
24
|
-
/// <reference path="api/device/clipboard.d.ts" />
|
|
25
|
-
/// <reference path="api/device/compass.d.ts" />
|
|
26
|
-
/// <reference path="api/device/contact.d.ts" />
|
|
27
|
-
/// <reference path="api/device/gyroscope.d.ts" />
|
|
28
|
-
/// <reference path="api/device/iBeacon.d.ts" />
|
|
29
|
-
/// <reference path="api/device/motion.d.ts" />
|
|
30
|
-
/// <reference path="api/device/network.d.ts" />
|
|
31
|
-
/// <reference path="api/device/nfc.d.ts" />
|
|
32
|
-
/// <reference path="api/device/performance.d.ts" />
|
|
33
|
-
/// <reference path="api/device/phone.d.ts" />
|
|
34
|
-
/// <reference path="api/device/scan.d.ts" />
|
|
35
|
-
/// <reference path="api/device/screen.d.ts" />
|
|
36
|
-
/// <reference path="api/device/vibrate.d.ts" />
|
|
37
|
-
/// <reference path="api/device/wifi.d.ts" />
|
|
38
|
-
/// <reference path="api/ext/index.d.ts" />
|
|
39
|
-
/// <reference path="api/files/index.d.ts" />
|
|
40
|
-
/// <reference path="api/framework/index.d.ts" />
|
|
41
|
-
/// <reference path="api/location/index.d.ts" />
|
|
45
|
+
/// <reference path="api/canvas/index.d.ts" />
|
|
46
|
+
/// <reference path="api/media/map.d.ts" />
|
|
47
|
+
/// <reference path="api/media/image.d.ts" />
|
|
48
|
+
/// <reference path="api/media/video.d.ts" />
|
|
42
49
|
/// <reference path="api/media/audio.d.ts" />
|
|
43
50
|
/// <reference path="api/media/background-audio.d.ts" />
|
|
44
|
-
/// <reference path="api/media/camera.d.ts" />
|
|
45
|
-
/// <reference path="api/media/editor.d.ts" />
|
|
46
|
-
/// <reference path="api/media/image.d.ts" />
|
|
47
51
|
/// <reference path="api/media/live.d.ts" />
|
|
48
|
-
/// <reference path="api/media/map.d.ts" />
|
|
49
52
|
/// <reference path="api/media/recorder.d.ts" />
|
|
50
|
-
/// <reference path="api/media/
|
|
53
|
+
/// <reference path="api/media/camera.d.ts" />
|
|
54
|
+
/// <reference path="api/media/editor.d.ts" />
|
|
51
55
|
/// <reference path="api/media/video-processing.d.ts" />
|
|
52
|
-
/// <reference path="api/
|
|
53
|
-
/// <reference path="api/
|
|
54
|
-
/// <reference path="api/
|
|
55
|
-
/// <reference path="api/
|
|
56
|
-
/// <reference path="api/
|
|
57
|
-
/// <reference path="api/
|
|
56
|
+
/// <reference path="api/media/voip.d.ts" />
|
|
57
|
+
/// <reference path="api/media/media-recorder.d.ts" />
|
|
58
|
+
/// <reference path="api/media/video-decoder.d.ts" />
|
|
59
|
+
/// <reference path="api/location/index.d.ts" />
|
|
60
|
+
/// <reference path="api/files/index.d.ts" />
|
|
61
|
+
/// <reference path="api/open-api/login.d.ts" />
|
|
58
62
|
/// <reference path="api/open-api/account.d.ts" />
|
|
59
|
-
/// <reference path="api/open-api/
|
|
63
|
+
/// <reference path="api/open-api/user-info.d.ts" />
|
|
60
64
|
/// <reference path="api/open-api/authorize.d.ts" />
|
|
65
|
+
/// <reference path="api/open-api/settings.d.ts" />
|
|
66
|
+
/// <reference path="api/open-api/address.d.ts" />
|
|
61
67
|
/// <reference path="api/open-api/card.d.ts" />
|
|
62
|
-
/// <reference path="api/open-api/facial.d.ts" />
|
|
63
68
|
/// <reference path="api/open-api/invoice.d.ts" />
|
|
64
|
-
/// <reference path="api/open-api/login.d.ts" />
|
|
65
|
-
/// <reference path="api/open-api/navigate.d.ts" />
|
|
66
|
-
/// <reference path="api/open-api/payment.d.ts" />
|
|
67
|
-
/// <reference path="api/open-api/settings.d.ts" />
|
|
68
69
|
/// <reference path="api/open-api/soter.d.ts" />
|
|
69
|
-
/// <reference path="api/open-api/subscribe-message.d.ts" />
|
|
70
|
-
/// <reference path="api/open-api/user-info.d.ts" />
|
|
71
70
|
/// <reference path="api/open-api/werun.d.ts" />
|
|
71
|
+
/// <reference path="api/open-api/subscribe-message.d.ts" />
|
|
72
|
+
/// <reference path="api/open-api/redpackage.d.ts" />
|
|
73
|
+
/// <reference path="api/open-api/favorites.d.ts" />
|
|
74
|
+
/// <reference path="api/open-api/license-plate.d.ts" />
|
|
75
|
+
/// <reference path="api/open-api/channels.d.ts" />
|
|
76
|
+
/// <reference path="api/open-api/group.d.ts" />
|
|
72
77
|
/// <reference path="api/open-api/customer-service.d.ts" />
|
|
73
|
-
/// <reference path="api/
|
|
74
|
-
/// <reference path="api/
|
|
75
|
-
/// <reference path="api/
|
|
76
|
-
/// <reference path="api/
|
|
77
|
-
/// <reference path="api/
|
|
78
|
-
/// <reference path="api/
|
|
79
|
-
/// <reference path="api/
|
|
80
|
-
/// <reference path="api/
|
|
81
|
-
/// <reference path="api/
|
|
82
|
-
/// <reference path="api/
|
|
83
|
-
/// <reference path="api/
|
|
84
|
-
/// <reference path="api/
|
|
85
|
-
/// <reference path="api/
|
|
86
|
-
/// <reference path="api/
|
|
87
|
-
/// <reference path="api/
|
|
88
|
-
/// <reference path="api/
|
|
89
|
-
/// <reference path="api/
|
|
78
|
+
/// <reference path="api/device/bluetooth.d.ts" />
|
|
79
|
+
/// <reference path="api/device/bluetooth-ble.d.ts" />
|
|
80
|
+
/// <reference path="api/device/bluetooth-peripheral.d.ts" />
|
|
81
|
+
/// <reference path="api/device/iBeacon.d.ts" />
|
|
82
|
+
/// <reference path="api/device/nfc.d.ts" />
|
|
83
|
+
/// <reference path="api/device/wifi.d.ts" />
|
|
84
|
+
/// <reference path="api/device/calendar.d.ts" />
|
|
85
|
+
/// <reference path="api/device/contact.d.ts" />
|
|
86
|
+
/// <reference path="api/device/accessibility.d.ts" />
|
|
87
|
+
/// <reference path="api/device/battery.d.ts" />
|
|
88
|
+
/// <reference path="api/device/clipboard.d.ts" />
|
|
89
|
+
/// <reference path="api/device/network.d.ts" />
|
|
90
|
+
/// <reference path="api/device/screen.d.ts" />
|
|
91
|
+
/// <reference path="api/device/keyboard.d.ts" />
|
|
92
|
+
/// <reference path="api/device/phone.d.ts" />
|
|
93
|
+
/// <reference path="api/device/accelerometer.d.ts" />
|
|
94
|
+
/// <reference path="api/device/compass.d.ts" />
|
|
95
|
+
/// <reference path="api/device/motion.d.ts" />
|
|
96
|
+
/// <reference path="api/device/gyroscope.d.ts" />
|
|
97
|
+
/// <reference path="api/device/memory.d.ts" />
|
|
98
|
+
/// <reference path="api/device/scan.d.ts" />
|
|
99
|
+
/// <reference path="api/device/vibrate.d.ts" />
|
|
100
|
+
/// <reference path="api/ai/visionkit.d.ts" />
|
|
101
|
+
/// <reference path="api/ai/face.d.ts" />
|
|
90
102
|
/// <reference path="api/worker/index.d.ts" />
|
|
91
103
|
/// <reference path="api/wxml/index.d.ts" />
|
|
104
|
+
/// <reference path="api/ext/index.d.ts" />
|
|
105
|
+
/// <reference path="api/ad/index.d.ts" />
|
|
106
|
+
|
|
107
|
+
/// <reference path="api/cloud/index.d.ts" />
|
|
108
|
+
/// <reference path="api/open-api/facial.d.ts" />
|
|
92
109
|
|
|
93
110
|
/// <reference path="api/alipay/index.d.ts" />
|
|
94
111
|
/// <reference path="api/swan/index.d.ts" />
|
|
@@ -1,38 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import Vue from 'vue'
|
|
3
3
|
|
|
4
4
|
import Taro, { Config } from './index'
|
|
5
5
|
|
|
6
6
|
declare module './index' {
|
|
7
|
-
// Components
|
|
8
|
-
interface ComponentLifecycle<P, S, SS = any> extends NewLifecycle<P, S, SS> {
|
|
9
|
-
componentWillMount?(): void
|
|
10
|
-
componentDidMount?(): void
|
|
11
|
-
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void
|
|
12
|
-
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean
|
|
13
|
-
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void
|
|
14
|
-
componentWillUnmount?(): void
|
|
15
|
-
componentDidShow?(): void
|
|
16
|
-
componentDidHide?(): void
|
|
17
|
-
componentDidCatchError?(err: string): void
|
|
18
|
-
componentDidNotFound?(obj: PageNotFoundObject): void
|
|
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
|
|
25
|
-
}
|
|
26
|
-
interface ComponentOptions {
|
|
27
|
-
addGlobalClass?: boolean
|
|
28
|
-
styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
|
|
29
|
-
}
|
|
30
|
-
interface ComponentClass<P = {}, S = any> extends StaticLifecycle<P, S> {
|
|
31
|
-
new (...args: any[]): Component<P, {}>
|
|
32
|
-
propTypes?: any // TODO: Use prop-types type definition.
|
|
33
|
-
defaultProps?: Partial<P>
|
|
34
|
-
displayName?: string
|
|
35
|
-
}
|
|
36
7
|
// ref: packages/taro-runtime/src/current.ts
|
|
37
8
|
interface RouterInfo<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>> {
|
|
38
9
|
/** 路由参数 */
|
|
@@ -47,24 +18,8 @@ declare module './index' {
|
|
|
47
18
|
|
|
48
19
|
shareTicket: string | undefined
|
|
49
20
|
scene: number | undefined
|
|
21
|
+
exitState?: any
|
|
50
22
|
}
|
|
51
|
-
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
|
52
|
-
$scope?: any
|
|
53
|
-
}
|
|
54
|
-
type PropsWithChildren<P> = P & { children?: React.ReactNode }
|
|
55
|
-
interface FunctionComponent<P = {}> {
|
|
56
|
-
(props: PropsWithChildren<P>, context?: any): React.ReactElement | null
|
|
57
|
-
propTypes?: any // TODO: Use prop-types type definition.
|
|
58
|
-
defaultProps?: Partial<P>
|
|
59
|
-
config?: Config
|
|
60
|
-
options?: ComponentOptions
|
|
61
|
-
externalClasses?: string[]
|
|
62
|
-
}
|
|
63
|
-
type FC<P = {}> = FunctionComponent<P>
|
|
64
|
-
interface StatelessFunctionComponent {
|
|
65
|
-
(): JSX.Element
|
|
66
|
-
}
|
|
67
|
-
type SFC = StatelessFunctionComponent
|
|
68
23
|
|
|
69
24
|
interface Show {
|
|
70
25
|
componentDidShow?(): void
|
|
@@ -73,10 +28,10 @@ declare module './index' {
|
|
|
73
28
|
onHide?(): void
|
|
74
29
|
}
|
|
75
30
|
interface AppInstance extends Show {
|
|
76
|
-
mount(component: React.
|
|
31
|
+
mount(component: React.Component | Vue.ComponentOptions<Vue>, id: string, cb: (...args: any[]) => void): void
|
|
77
32
|
componentDidShow?(options?: Record<string, unknown>): void
|
|
78
33
|
onShow?(options?: Record<string, unknown>): void
|
|
79
|
-
unmount(id: string, cb
|
|
34
|
+
unmount(id: string, cb?: () => void): void
|
|
80
35
|
}
|
|
81
36
|
type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
|
|
82
37
|
interface MpEvent {
|
|
@@ -86,18 +41,18 @@ declare module './index' {
|
|
|
86
41
|
currentTarget: Target
|
|
87
42
|
}
|
|
88
43
|
interface PageLifeCycle extends Show {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
onPageScroll?(obj: { scrollTop: number }): void
|
|
92
|
-
onShareAppMessage?(obj: { from: string; target?: any; webViewUrl: string }): void
|
|
93
|
-
onResize?(options: unknown): void
|
|
94
|
-
onTabItemTap?(obj: { index: string; pagePath: string; text: string }): void
|
|
95
|
-
onTitleClick?(): void
|
|
44
|
+
eh?(event: MpEvent): void
|
|
45
|
+
onLoad(options: Record<string, unknown>): void
|
|
96
46
|
onOptionMenuClick?(): void
|
|
47
|
+
onPageScroll?(opt: PageScrollObject): void
|
|
97
48
|
onPopMenuClick?(): void
|
|
49
|
+
onPullDownRefresh?(): void
|
|
98
50
|
onPullIntercept?(): void
|
|
99
|
-
|
|
100
|
-
|
|
51
|
+
onReachBottom?(): void
|
|
52
|
+
onResize?(opt: PageResizeObject): void
|
|
53
|
+
onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
|
|
54
|
+
onTabItemTap?(opt: TabItemTapObject): void
|
|
55
|
+
onTitleClick?(): void
|
|
101
56
|
onUnload(): void
|
|
102
57
|
}
|
|
103
58
|
interface ComponentInstance<
|
|
@@ -162,6 +117,10 @@ declare module './index' {
|
|
|
162
117
|
getPageId?(): string
|
|
163
118
|
/** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
164
119
|
animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
|
|
120
|
+
/** 滚动驱动的动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
121
|
+
animate?(selector: string, keyFrames: KeyFrame[], duration: number, scrollTimeline: ScrollTimelineOption): void
|
|
122
|
+
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
123
|
+
clearAnimation?(selector: string, callback: () => void): void
|
|
165
124
|
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
166
125
|
clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
|
|
167
126
|
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
@@ -173,14 +132,11 @@ declare module './index' {
|
|
|
173
132
|
interface PageInstance extends PageLifeCycle, ComponentInstance {
|
|
174
133
|
/** 页面配置 */
|
|
175
134
|
config?: PageConfig
|
|
135
|
+
/** 页面的初始数据 */
|
|
176
136
|
data?: Record<string, unknown>
|
|
137
|
+
/** 页面路径 */
|
|
177
138
|
path?: string
|
|
139
|
+
/** 页面的组件选项 */
|
|
178
140
|
options?: Record<string, unknown>
|
|
179
141
|
}
|
|
180
|
-
interface TaroStatic {
|
|
181
|
-
memo<P = {}>(
|
|
182
|
-
FunctionComponent: FunctionComponent<P>,
|
|
183
|
-
compare?: (oldProps: P, newProps: P) => boolean
|
|
184
|
-
): FunctionComponent<P>
|
|
185
|
-
}
|
|
186
142
|
}
|
package/types/taro.config.d.ts
CHANGED
|
@@ -174,6 +174,8 @@ declare module './index' {
|
|
|
174
174
|
name?: string
|
|
175
175
|
/** 分包是否是独立分包 */
|
|
176
176
|
independent?: boolean
|
|
177
|
+
/** 分包支持引用独立的插件 */
|
|
178
|
+
plugins?: Plugins
|
|
177
179
|
}
|
|
178
180
|
|
|
179
181
|
interface Plugins {
|
|
@@ -269,6 +271,19 @@ declare module './index' {
|
|
|
269
271
|
* @since 微信客户端 6.7.2 及以上版本支持
|
|
270
272
|
*/
|
|
271
273
|
requiredBackgroundModes?: ('audio' | 'location')[]
|
|
274
|
+
/** 申明需要使用的地理位置相关接口,类型为数组。目前支持以下项目:
|
|
275
|
+
* 自 2022 年 7 月 14 日后发布的小程序,使用以下8个地理位置相关接口时,需要声明该字段,否则将无法正常使用。2022 年 7 月 14 日前发布的小程序不受影响。
|
|
276
|
+
* - getFuzzyLocation: 获取模糊地理位置
|
|
277
|
+
* - getLocation: 获取精确地理位置
|
|
278
|
+
* - onLocationChange: 监听试试地理位置变化事件
|
|
279
|
+
* - startLocationUpdate: 接收位置消息(前台)
|
|
280
|
+
* - startLocationUpdateBackground: 接收位置消息(前后台)
|
|
281
|
+
* - chooseLocation: 打开地图选择位置
|
|
282
|
+
* - choosePoi: 打开 POI 列表选择位置
|
|
283
|
+
* - chooseAddress: 获取用户地址信息
|
|
284
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#requiredPrivateInfos
|
|
285
|
+
*/
|
|
286
|
+
requiredPrivateInfos?: ('getFuzzyLocation' | 'getLocation' | 'onLocationChange' | 'startLocationUpdate' | 'startLocationUpdateBackground' | 'chooseLocation' | 'choosePoi' | 'chooseAddress')[]
|
|
272
287
|
/** 使用到的插件
|
|
273
288
|
* @since 1.9.6
|
|
274
289
|
*/
|
|
@@ -357,6 +372,22 @@ declare module './index' {
|
|
|
357
372
|
/** 视频号直播打开的第一个页面的全屏状态使用自定义顶部,支持 */
|
|
358
373
|
firstPageNavigationStyle?: 'default' | 'custom'
|
|
359
374
|
}
|
|
375
|
+
/** 小程序调试相关配置项 */
|
|
376
|
+
debugOptions?: {
|
|
377
|
+
/** 是否开启 FPS 面板,默认false */
|
|
378
|
+
enableFPSPanel?: boolean
|
|
379
|
+
}
|
|
380
|
+
/** touch 事件监听是否为 passive,默认false */
|
|
381
|
+
enablePassiveEvent?: boolean | {
|
|
382
|
+
/** 是否设置 touchstart 事件为 passive,默认false */
|
|
383
|
+
touchstart?: boolean
|
|
384
|
+
/** 是否设置 touchmove 事件为 passive,默认false */
|
|
385
|
+
touchmove?: boolean
|
|
386
|
+
/** 是否设置 wheel 事件为 passive,默认false */
|
|
387
|
+
wheel?: boolean
|
|
388
|
+
}
|
|
389
|
+
/** 自定义模块映射规则 */
|
|
390
|
+
resolveAlias?: Record<string, string>
|
|
360
391
|
/** 接受一个数组,每一项都是字符串,来指定编译为原生小程序组件的组件入口 */
|
|
361
392
|
components?: string[]
|
|
362
393
|
/** 渲染页面的容器 id
|
package/types/taro.extend.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
import Taro from './index'
|
|
2
4
|
|
|
3
5
|
declare module './index' {
|
|
4
6
|
type MessageType = 'info' | 'success' | 'error' | 'warning'
|
|
@@ -9,7 +11,7 @@ declare module './index' {
|
|
|
9
11
|
duration?: number
|
|
10
12
|
}
|
|
11
13
|
|
|
12
|
-
interface RequestParams extends request.Option<any> {
|
|
14
|
+
interface RequestParams<T=any> extends request.Option<T, any> {
|
|
13
15
|
[propName: string]: any
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -47,36 +49,41 @@ declare module './index' {
|
|
|
47
49
|
new (): TaroGeneral.Events
|
|
48
50
|
}
|
|
49
51
|
|
|
50
|
-
|
|
52
|
+
/** 事件中心
|
|
53
|
+
* @supported global
|
|
54
|
+
*/
|
|
51
55
|
eventCenter: TaroGeneral.Events
|
|
52
56
|
|
|
53
57
|
ENV_TYPE: TARO_ENV_TYPE
|
|
54
58
|
|
|
59
|
+
/** 获取环境变量
|
|
60
|
+
* @supported global
|
|
61
|
+
*/
|
|
55
62
|
getEnv(): TaroGeneral.ENV_TYPE
|
|
56
63
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
internal_safe_get(...arg: any[]): any
|
|
61
|
-
|
|
62
|
-
atMessage(options: AtMessageOptions): void
|
|
63
|
-
|
|
64
|
+
/** 尺寸转换
|
|
65
|
+
* @supported global
|
|
66
|
+
*/
|
|
64
67
|
pxTransform(size: number, designWidth?: number): string
|
|
68
|
+
|
|
69
|
+
/** 尺寸转换初始化
|
|
70
|
+
* @supported global
|
|
71
|
+
*/
|
|
65
72
|
initPxTransform(config: { designWidth: number; deviceRatio: TaroGeneral.TDeviceRatio }): void
|
|
66
73
|
|
|
67
|
-
/**
|
|
68
|
-
*
|
|
74
|
+
/** 小程序引用插件 JS 接口
|
|
75
|
+
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
|
|
69
76
|
*/
|
|
70
77
|
requirePlugin(pluginName: string): any
|
|
71
78
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
79
|
+
/** 获取当前页面实例
|
|
80
|
+
* @supported global
|
|
81
|
+
*/
|
|
76
82
|
getCurrentInstance(): Current
|
|
83
|
+
Current: Current
|
|
77
84
|
|
|
78
|
-
/**
|
|
79
|
-
* @
|
|
85
|
+
/** Vue3 插件,用于设置 `getApp()` 中的全局变量
|
|
86
|
+
* @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
|
|
80
87
|
* @example
|
|
81
88
|
* ```js
|
|
82
89
|
* // 使用插件
|
|
@@ -89,5 +96,11 @@ declare module './index' {
|
|
|
89
96
|
* ```
|
|
90
97
|
*/
|
|
91
98
|
setGlobalDataPlugin: SetGlobalDataPlugin
|
|
99
|
+
|
|
100
|
+
/** 获取自定义 TabBar 对应的 React 或 Vue 组件实例
|
|
101
|
+
* @supported weapp
|
|
102
|
+
* @param page 小程序页面对象,可以通过 Taro.getCurrentInstance().page 获取
|
|
103
|
+
*/
|
|
104
|
+
getTabBar<T>(page: Current['page']): T | undefined
|
|
92
105
|
}
|
|
93
106
|
}
|
package/types/taro.hooks.d.ts
CHANGED
|
@@ -4,80 +4,132 @@ 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
|
|
|
65
|
+
/**
|
|
66
|
+
* 页面销毁前保留状态回调
|
|
67
|
+
* @supported weapp
|
|
68
|
+
*/
|
|
69
|
+
useSaveExitState(callback: () => {
|
|
70
|
+
data: Record<any, any>
|
|
71
|
+
expireTimeStamp?: number
|
|
72
|
+
}): void
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* 小程序初始化完成时的回调。
|
|
76
|
+
* @supported weapp, h5
|
|
77
|
+
*/
|
|
78
|
+
useLaunch(callback: (options: getLaunchOptionsSync.LaunchOptions) => void): void
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* 小程序发生脚本错误或 API 调用报错时触发的回调。
|
|
82
|
+
* @supported weapp, h5
|
|
83
|
+
*/
|
|
84
|
+
useError(callback: (error: string) => void): void
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* 小程序要打开的页面不存在时触发的回调。
|
|
88
|
+
* @supported weapp, h5
|
|
89
|
+
* @h5 多页面模式不支持该方法
|
|
90
|
+
*/
|
|
91
|
+
usePageNotFound(callback: (res: { path: string, query: Record<any, any>, isEntryPage: boolean, [key: string]: any }) => void): void
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* 页面加载完成时的回调。
|
|
95
|
+
* @supported weapp, h5
|
|
96
|
+
*/
|
|
97
|
+
useLoad(callback: () => void): void
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 页面卸载时的回调。
|
|
101
|
+
* @supported weapp, h5
|
|
102
|
+
*/
|
|
103
|
+
useUnload(callback: () => void): void
|
|
104
|
+
|
|
55
105
|
/**
|
|
56
106
|
* 页面初次渲染完成的回调。
|
|
57
107
|
* 此时页面已经准备妥当,可以和视图层进行交互。
|
|
108
|
+
* @supported weapp, h5
|
|
58
109
|
*/
|
|
59
110
|
useReady(callback: () => void): void
|
|
60
111
|
|
|
61
112
|
/**
|
|
62
113
|
* 获取当前路由参数。
|
|
114
|
+
* @supported global
|
|
63
115
|
*/
|
|
64
116
|
useRouter<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>>(dynamic?: boolean): RouterInfo<TParams>
|
|
65
117
|
|
|
66
118
|
/**
|
|
67
119
|
* 导航栏的标题被点击时的回调。
|
|
68
|
-
*
|
|
120
|
+
* @supported alipay
|
|
69
121
|
*/
|
|
70
122
|
useTitleClick(callback: () => void): void
|
|
71
123
|
|
|
72
124
|
/**
|
|
73
125
|
* 导航栏的额外图标被点击时的回调。
|
|
74
|
-
*
|
|
126
|
+
* @supported alipay
|
|
75
127
|
*/
|
|
76
128
|
useOptionMenuClick(callback: () => void): void
|
|
77
129
|
|
|
78
130
|
/**
|
|
79
131
|
* 下拉中断时的回调。
|
|
80
|
-
*
|
|
132
|
+
* @supported alipay, h5
|
|
81
133
|
*/
|
|
82
134
|
usePullIntercept(callback: () => void): void
|
|
83
135
|
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import Taro from './index'
|
|
2
2
|
|
|
3
3
|
type TaroGetDerivedStateFromProps<P, S> =
|
|
4
|
-
/**
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
(nextProps: Readonly<P>, prevState: S) => Partial<S> | null
|
|
4
|
+
/**
|
|
5
|
+
* Returns an update to a component's state based on its new props and old state.
|
|
6
|
+
*
|
|
7
|
+
* Note: its presence prevents any of the deprecated lifecycle methods from being invoked
|
|
8
|
+
*/
|
|
9
|
+
(nextProps: Readonly<P>, prevState: S) => Partial<S> | null
|
|
10
10
|
|
|
11
11
|
interface TaroStaticLifecycle<P, S> {
|
|
12
|
-
getDerivedStateFromProps?: TaroGetDerivedStateFromProps<P, S
|
|
12
|
+
getDerivedStateFromProps?: TaroGetDerivedStateFromProps<P, S>
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
interface TaroNewLifecycle<P, S, SS> {
|
|
@@ -21,13 +21,13 @@ interface TaroNewLifecycle<P, S, SS> {
|
|
|
21
21
|
* Note: the presence of getSnapshotBeforeUpdate prevents any of the deprecated
|
|
22
22
|
* lifecycle events from running.
|
|
23
23
|
*/
|
|
24
|
-
getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null
|
|
24
|
+
getSnapshotBeforeUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>): SS | null
|
|
25
25
|
/**
|
|
26
26
|
* Called immediately after updating occurs. Not called for the initial render.
|
|
27
27
|
*
|
|
28
28
|
* The snapshot is only present if getSnapshotBeforeUpdate is present and returns non-null.
|
|
29
29
|
*/
|
|
30
|
-
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void
|
|
30
|
+
componentDidUpdate?(prevProps: Readonly<P>, prevState: Readonly<S>, snapshot?: SS): void
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
declare module './index' {
|
|
@@ -165,11 +165,18 @@ declare module './index' {
|
|
|
165
165
|
imageUrl?: string
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
168
|
+
interface ComponentLifecycle<P, S, SS = any> extends TaroNewLifecycle<P, S, SS> {
|
|
169
|
+
componentWillMount?(): void
|
|
170
|
+
componentDidMount?(): void
|
|
171
|
+
componentWillReceiveProps?(nextProps: Readonly<P>, nextContext: any): void
|
|
172
|
+
shouldComponentUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): boolean
|
|
173
|
+
componentWillUpdate?(nextProps: Readonly<P>, nextState: Readonly<S>, nextContext: any): void
|
|
174
|
+
componentWillUnmount?(): void
|
|
175
|
+
componentDidShow?(): void
|
|
176
|
+
componentDidHide?(): void
|
|
177
|
+
componentDidCatchError?(err: string): void
|
|
178
|
+
componentDidNotFound?(opt: PageNotFoundObject): void
|
|
179
|
+
}
|
|
173
180
|
|
|
174
181
|
interface TaroStatic {
|
|
175
182
|
PageNotFoundObject: PageNotFoundObject
|