@tarojs/taro 3.4.0-beta.2 → 3.4.2
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 +5 -7
- 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 +10 -2
- package/types/api/base/performance.d.ts +195 -0
- package/types/api/base/system.d.ts +539 -101
- package/types/api/base/update.d.ts +59 -7
- package/types/api/base/weapp/app-event.d.ts +49 -26
- package/types/api/base/weapp/life-cycle.d.ts +141 -1
- package/types/api/canvas/index.d.ts +171 -136
- package/types/api/cloud/index.d.ts +2 -2
- package/types/api/device/accelerometer.d.ts +3 -3
- 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/contact.d.ts +74 -50
- package/types/api/device/gyroscope.d.ts +5 -5
- package/types/api/device/iBeacon.d.ts +33 -19
- package/types/api/{ui → device}/keyboard.d.ts +0 -0
- package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
- package/types/api/device/motion.d.ts +3 -3
- package/types/api/device/network.d.ts +53 -12
- package/types/api/device/nfc.d.ts +1089 -13
- package/types/api/device/scan.d.ts +1 -1
- package/types/api/device/screen.d.ts +40 -12
- package/types/api/device/wifi.d.ts +41 -6
- package/types/api/files/index.d.ts +371 -184
- package/types/api/location/index.d.ts +116 -55
- package/types/api/media/audio.d.ts +653 -60
- package/types/api/media/background-audio.d.ts +47 -41
- package/types/api/media/camera.d.ts +38 -19
- package/types/api/media/editor.d.ts +22 -2
- package/types/api/media/image.d.ts +54 -105
- package/types/api/media/live.d.ts +66 -6
- package/types/api/media/map.d.ts +469 -49
- package/types/api/media/media-recorder.d.ts +92 -0
- package/types/api/media/recorder.d.ts +20 -20
- 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 +327 -39
- package/types/api/media/voip.d.ts +290 -0
- package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -27
- package/types/api/network/download.d.ts +39 -16
- package/types/api/network/request.d.ts +143 -38
- 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 +41 -25
- package/types/api/network/websocket.d.ts +16 -15
- package/types/api/open-api/authorize.d.ts +41 -2
- package/types/api/open-api/channels.d.ts +178 -0
- package/types/api/open-api/customer-service.d.ts +1 -1
- 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 +76 -14
- package/types/api/open-api/soter.d.ts +2 -2
- package/types/api/open-api/subscribe-message.d.ts +88 -3
- package/types/api/open-api/user-info.d.ts +55 -18
- 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 +13 -9
- package/types/api/share/index.d.ts +192 -9
- package/types/api/storage/index.d.ts +29 -83
- package/types/api/swan/index.d.ts +1 -1
- package/types/api/ui/animation.d.ts +84 -70
- 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/navigation-bar.d.ts +1 -0
- package/types/api/ui/scroll.d.ts +73 -7
- package/types/api/ui/sticky.d.ts +4 -4
- package/types/api/ui/tab-bar.d.ts +7 -7
- 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 +143 -105
- package/types/compile.d.ts +111 -106
- package/types/global.d.ts +142 -111
- package/types/taro.api.d.ts +79 -62
- package/types/taro.component.d.ts +82 -60
- package/types/taro.config.d.ts +174 -170
- package/types/taro.extend.d.ts +0 -17
- package/types/taro.hooks.d.ts +12 -12
- package/types/taro.lifecycle.d.ts +7 -0
- package/h5.js +0 -4
- package/types/api/open-api/payment.d.ts +0 -61
|
@@ -21,31 +21,24 @@ declare module './index' {
|
|
|
21
21
|
onPageScroll?(obj: PageScrollObject): void
|
|
22
22
|
onShareAppMessage?(obj: ShareAppMessageObject): ShareAppMessageReturn
|
|
23
23
|
onTabItemTap?(obj: TabItemTapObject): void
|
|
24
|
-
onResize?(obj:
|
|
24
|
+
onResize?(obj: PageResizeObject): void
|
|
25
25
|
}
|
|
26
|
-
|
|
27
26
|
interface ComponentOptions {
|
|
28
27
|
addGlobalClass?: boolean
|
|
29
28
|
styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
|
|
30
29
|
}
|
|
31
|
-
|
|
32
30
|
interface ComponentClass<P = {}, S = any> extends StaticLifecycle<P, S> {
|
|
33
31
|
new (...args: any[]): Component<P, {}>
|
|
34
32
|
propTypes?: any // TODO: Use prop-types type definition.
|
|
35
33
|
defaultProps?: Partial<P>
|
|
36
34
|
displayName?: string
|
|
37
35
|
}
|
|
38
|
-
|
|
39
36
|
// ref: packages/taro-runtime/src/current.ts
|
|
40
37
|
interface RouterInfo<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>> {
|
|
41
|
-
/**
|
|
42
|
-
* 路由参数。
|
|
43
|
-
*/
|
|
38
|
+
/** 路由参数 */
|
|
44
39
|
params: TParams
|
|
45
40
|
|
|
46
|
-
/**
|
|
47
|
-
* 页面路径。
|
|
48
|
-
*/
|
|
41
|
+
/** 页面路径 */
|
|
49
42
|
path: string
|
|
50
43
|
|
|
51
44
|
onReady: string
|
|
@@ -55,13 +48,10 @@ declare module './index' {
|
|
|
55
48
|
shareTicket: string | undefined
|
|
56
49
|
scene: number | undefined
|
|
57
50
|
}
|
|
58
|
-
|
|
59
51
|
interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
|
|
60
52
|
$scope?: any
|
|
61
53
|
}
|
|
62
|
-
|
|
63
54
|
type PropsWithChildren<P> = P & { children?: React.ReactNode }
|
|
64
|
-
|
|
65
55
|
interface FunctionComponent<P = {}> {
|
|
66
56
|
(props: PropsWithChildren<P>, context?: any): React.ReactElement | null
|
|
67
57
|
propTypes?: any // TODO: Use prop-types type definition.
|
|
@@ -70,36 +60,31 @@ declare module './index' {
|
|
|
70
60
|
options?: ComponentOptions
|
|
71
61
|
externalClasses?: string[]
|
|
72
62
|
}
|
|
73
|
-
|
|
74
63
|
type FC<P = {}> = FunctionComponent<P>
|
|
75
|
-
|
|
76
64
|
interface StatelessFunctionComponent {
|
|
77
65
|
(): JSX.Element
|
|
78
66
|
}
|
|
79
|
-
|
|
80
67
|
type SFC = StatelessFunctionComponent
|
|
81
68
|
|
|
82
69
|
interface Show {
|
|
83
|
-
componentDidShow?(
|
|
84
|
-
componentDidHide?(
|
|
85
|
-
onShow?(
|
|
86
|
-
onHide?(
|
|
70
|
+
componentDidShow?(): void
|
|
71
|
+
componentDidHide?(): void
|
|
72
|
+
onShow?(): void
|
|
73
|
+
onHide?(): void
|
|
87
74
|
}
|
|
88
|
-
|
|
89
75
|
interface AppInstance extends Show {
|
|
90
76
|
mount(component: React.ComponentClass | Vue.ComponentOptions<Vue>, id: string, cb: () => void): void
|
|
77
|
+
componentDidShow?(options?: Record<string, unknown>): void
|
|
78
|
+
onShow?(options?: Record<string, unknown>): void
|
|
91
79
|
unmount(id: string, cb: () => void): void
|
|
92
80
|
}
|
|
93
|
-
|
|
94
81
|
type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
|
|
95
|
-
|
|
96
82
|
interface MpEvent {
|
|
97
83
|
type: string
|
|
98
84
|
detail: Record<string, unknown>
|
|
99
85
|
target: Target
|
|
100
86
|
currentTarget: Target
|
|
101
87
|
}
|
|
102
|
-
|
|
103
88
|
interface PageLifeCycle extends Show {
|
|
104
89
|
onPullDownRefresh?(): void
|
|
105
90
|
onReachBottom?(): void
|
|
@@ -115,50 +100,87 @@ declare module './index' {
|
|
|
115
100
|
onLoad(options: Record<string, unknown>): void
|
|
116
101
|
onUnload(): void
|
|
117
102
|
}
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
103
|
+
interface ComponentInstance<
|
|
104
|
+
TData extends Record<string, unknown> = Record<string, unknown>,
|
|
105
|
+
TParams extends Record<string, string> = Record<string, string>
|
|
106
|
+
> {
|
|
107
|
+
/** 组件的文件路径 */
|
|
108
|
+
is?: string
|
|
109
|
+
/** 节点id */
|
|
110
|
+
id?: string
|
|
111
|
+
/** 节点dataset */
|
|
112
|
+
dataset?: string
|
|
113
|
+
/** 组件数据,包括内部数据和属性值 */
|
|
114
|
+
data?: TData
|
|
115
|
+
/** 组件数据,包括内部数据和属性值(与 data 一致) */
|
|
116
|
+
properties?: TData
|
|
117
|
+
/** 相对于当前自定义组件的 Router 对象 */
|
|
118
|
+
router?: RouterInfo<TParams>
|
|
119
|
+
/** 相对于当前自定义组件所在页面的 Router 对象 */
|
|
120
|
+
pageRouter?: RouterInfo<TParams>
|
|
121
|
+
/** 设置data并执行视图层渲染 */
|
|
122
|
+
setData?(newData: Partial<TData>): void
|
|
123
|
+
/** 检查组件是否具有 behavior (检查时会递归检查被直接或间接引入的所有behavior) */
|
|
124
|
+
hasBehavior?(behavior: unknown): boolean
|
|
125
|
+
/** 触发事件,参见[组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */
|
|
126
|
+
triggerEvent?(name: string, detail: Record<string, unknown>, options: {
|
|
127
|
+
/** 事件是否冒泡 */
|
|
128
|
+
bubbles?: boolean
|
|
129
|
+
/** 事件是否可以穿越组件边界,为 false 时,事件将只能在引用组件的节点树上触发,不进入其他任何组件内部 */
|
|
130
|
+
composed?: boolean
|
|
131
|
+
/** 事件是否拥有捕获阶段 */
|
|
132
|
+
capturePhase?: boolean
|
|
133
|
+
}): void
|
|
134
|
+
/** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
|
|
135
|
+
createSelectorQuery?(): SelectorQuery
|
|
136
|
+
/** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
|
|
137
|
+
createIntersectionObserver?(): IntersectionObserver
|
|
138
|
+
/** 创建一个 MediaQueryObserver 对象 */
|
|
139
|
+
createMediaQueryObserver?(): MediaQueryObserver
|
|
140
|
+
/** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
|
|
141
|
+
selectComponent?<
|
|
142
|
+
TD extends Record<string, unknown> = Record<string, unknown>,
|
|
143
|
+
TP extends Record<string, string> = Record<string, string>
|
|
144
|
+
>(selector: string): ComponentInstance<TD, TP>
|
|
145
|
+
/** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组(会被 wx://component-export 影响) */
|
|
146
|
+
selectAllComponents?<
|
|
147
|
+
TD extends Record<string, unknown> = Record<string, unknown>,
|
|
148
|
+
TP extends Record<string, string> = Record<string, string>
|
|
149
|
+
>(selector: string): ComponentInstance<TD, TP>
|
|
150
|
+
/** 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 wx://component-export 影响) */
|
|
151
|
+
selectOwnerComponent?<
|
|
152
|
+
TD extends Record<string, unknown> = Record<string, unknown>,
|
|
153
|
+
TP extends Record<string, string> = Record<string, string>
|
|
154
|
+
>(): ComponentInstance<TD, TP>
|
|
155
|
+
/** 获取这个关系所对应的所有关联节点,参见[组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/relations.html) */
|
|
156
|
+
getRelationNodes?(relationKey: string): NodesRef[]
|
|
157
|
+
/** 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) */
|
|
158
|
+
groupSetData?(callback: () => void): void
|
|
159
|
+
/** 返回当前页面的 custom-tab-bar 的组件实例,详见[自定义 tabBar](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html) */
|
|
160
|
+
getTabBar?(): ComponentInstance
|
|
161
|
+
/** 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 */
|
|
162
|
+
getPageId?(): string
|
|
163
|
+
/** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
164
|
+
animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
|
|
165
|
+
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
166
|
+
clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
|
|
167
|
+
/** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
|
|
168
|
+
setUpdatePerformanceListener?(options: {
|
|
169
|
+
/** 是否返回变更的 data 字段信息 */
|
|
170
|
+
withDataPaths?: boolean
|
|
171
|
+
}, listener: () => void): void
|
|
172
|
+
}
|
|
173
|
+
interface PageInstance extends PageLifeCycle, ComponentInstance {
|
|
174
|
+
/** 页面配置 */
|
|
123
175
|
config?: PageConfig
|
|
124
176
|
data?: Record<string, unknown>
|
|
125
177
|
path?: string
|
|
126
178
|
options?: Record<string, unknown>
|
|
127
|
-
/**
|
|
128
|
-
* 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
|
129
|
-
*
|
|
130
|
-
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
|
131
|
-
**/
|
|
132
|
-
animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
|
|
133
|
-
/**
|
|
134
|
-
* 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
|
135
|
-
*
|
|
136
|
-
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
|
137
|
-
**/
|
|
138
|
-
animate?(
|
|
139
|
-
selector: string,
|
|
140
|
-
keyFrames: ScrollTimelineKeyframe[],
|
|
141
|
-
duration: number,
|
|
142
|
-
scrollTimeline: ScrollTimelineOption
|
|
143
|
-
): void
|
|
144
|
-
/**
|
|
145
|
-
* 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
|
146
|
-
*
|
|
147
|
-
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
|
148
|
-
**/
|
|
149
|
-
clearAnimation?(selector: string, callback: () => void): void
|
|
150
|
-
/**
|
|
151
|
-
* 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
|
|
152
|
-
*
|
|
153
|
-
* 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
|
154
|
-
**/
|
|
155
|
-
clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
|
|
156
179
|
}
|
|
157
|
-
|
|
158
180
|
interface TaroStatic {
|
|
159
181
|
memo<P = {}>(
|
|
160
182
|
FunctionComponent: FunctionComponent<P>,
|
|
161
|
-
compare?: (oldProps: P, newProps: P) =>
|
|
183
|
+
compare?: (oldProps: P, newProps: P) => boolean
|
|
162
184
|
): FunctionComponent<P>
|
|
163
185
|
}
|
|
164
186
|
}
|