@tarojs/taro 4.0.7-canary.6 → 4.0.8-alpha.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 +9 -9
- package/types/api/route/index.d.ts +106 -2
- package/types/api/skyline/index.d.ts +286 -0
- package/types/taro.component.d.ts +20 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tarojs/taro",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.8-alpha.0",
|
|
4
4
|
"description": "Taro framework",
|
|
5
5
|
"author": "O2Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@types/postcss-url": "^10.0.4",
|
|
27
|
-
"@tarojs/api": "4.0.
|
|
28
|
-
"@tarojs/runtime": "4.0.
|
|
27
|
+
"@tarojs/api": "4.0.8-alpha.0",
|
|
28
|
+
"@tarojs/runtime": "4.0.8-alpha.0"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"@types/react": "^18.3.1",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"webpack-chain": "^6.5.1",
|
|
36
36
|
"webpack-dev-server": "^4.15.2",
|
|
37
37
|
"rollup": "^3.29.4",
|
|
38
|
-
"@tarojs/components": "4.0.
|
|
39
|
-
"@tarojs/
|
|
40
|
-
"@tarojs/
|
|
38
|
+
"@tarojs/components": "4.0.8-alpha.0",
|
|
39
|
+
"@tarojs/helper": "4.0.8-alpha.0",
|
|
40
|
+
"@tarojs/shared": "4.0.8-alpha.0"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@types/react": "^18",
|
|
@@ -48,9 +48,9 @@
|
|
|
48
48
|
"webpack": "^5",
|
|
49
49
|
"webpack-chain": "^6",
|
|
50
50
|
"webpack-dev-server": "^4",
|
|
51
|
-
"@tarojs/
|
|
52
|
-
"@tarojs/shared": "4.0.
|
|
53
|
-
"@tarojs/
|
|
51
|
+
"@tarojs/helper": "4.0.8-alpha.0",
|
|
52
|
+
"@tarojs/shared": "4.0.8-alpha.0",
|
|
53
|
+
"@tarojs/components": "4.0.8-alpha.0"
|
|
54
54
|
},
|
|
55
55
|
"peerDependenciesMeta": {
|
|
56
56
|
"@types/react": {
|
|
@@ -44,10 +44,16 @@ declare module '../../index' {
|
|
|
44
44
|
interface Option {
|
|
45
45
|
/** 需要跳转的应用内非 tabBar 的页面的路径, 路径后可以带参数。参数与路径之间使用 `?` 分隔,参数键与参数值用 `=` 相连,不同参数用 `&` 分隔;如 'path?key=value&key2=value2' */
|
|
46
46
|
url: string
|
|
47
|
-
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
48
|
-
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
49
47
|
/** 页面间通信接口,用于监听被打开页面发送到当前页面的数据。 */
|
|
50
48
|
events?: TaroGeneral.IAnyObject
|
|
49
|
+
/** 2.29.2 自定义路由类型 */
|
|
50
|
+
routeType?: string
|
|
51
|
+
/** 3.4.0 自定义路由配置 */
|
|
52
|
+
routeConfig?: TaroGeneral.IAnyObject
|
|
53
|
+
/** 3.4.0 自定义路由参数 */
|
|
54
|
+
routeOptions?: TaroGeneral.IAnyObject
|
|
55
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
56
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
51
57
|
/** 接口调用失败的回调函数 */
|
|
52
58
|
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
53
59
|
/** 接口调用成功的回调函数 */
|
|
@@ -115,6 +121,103 @@ declare module '../../index' {
|
|
|
115
121
|
): void
|
|
116
122
|
}
|
|
117
123
|
|
|
124
|
+
namespace router {
|
|
125
|
+
type CustomRouteBuilder = (routeContext: CustomRouteContext, routeOptions: Record<string, any>) => CustomRouteConfig
|
|
126
|
+
|
|
127
|
+
interface SharedValue<T> {
|
|
128
|
+
value: T
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
interface CustomRouteContext {
|
|
132
|
+
// 动画控制器,影响推入页面的进入和退出过渡效果
|
|
133
|
+
primaryAnimation: SharedValue<number>
|
|
134
|
+
// 动画控制器状态
|
|
135
|
+
primaryAnimationStatus: SharedValue<number>
|
|
136
|
+
// 动画控制器,影响栈顶页面的推出过渡效果
|
|
137
|
+
secondaryAnimation: SharedValue<number>
|
|
138
|
+
// 动画控制器状态
|
|
139
|
+
secondaryAnimationStatus: SharedValue<number>
|
|
140
|
+
// 当前路由进度由手势控制
|
|
141
|
+
userGestureInProgress: SharedValue<number>
|
|
142
|
+
// 手势开始控制路由
|
|
143
|
+
startUserGesture: () => void
|
|
144
|
+
// 手势不再控制路由
|
|
145
|
+
stopUserGesture: () => void
|
|
146
|
+
// 返回上一级,效果同 wx.navigateBack
|
|
147
|
+
didPop: () => void
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
interface CustomRouteConfig {
|
|
151
|
+
// 下一个页面推入后,不显示前一个页面
|
|
152
|
+
opaque?: boolean
|
|
153
|
+
// 是否保持前一个页面状态
|
|
154
|
+
maintainState?: boolean
|
|
155
|
+
// 页面推入动画时长,单位 ms
|
|
156
|
+
transitionDuration?: number
|
|
157
|
+
// 页面推出动画时长,单位 ms
|
|
158
|
+
reverseTransitionDuration?: number
|
|
159
|
+
// 遮罩层背景色,支持 rgba() 和 #RRGGBBAA 写法
|
|
160
|
+
barrierColor?: string
|
|
161
|
+
// 点击遮罩层返回上一页
|
|
162
|
+
barrierDismissible?: boolean
|
|
163
|
+
// 无障碍语义
|
|
164
|
+
barrierLabel?: string
|
|
165
|
+
// 是否与下一个页面联动,决定当前页 secondaryAnimation 是否生效
|
|
166
|
+
canTransitionTo?: boolean
|
|
167
|
+
// 是否与前一个页面联动,决定前一个页 secondaryAnimation 是否生效
|
|
168
|
+
canTransitionFrom?: boolean
|
|
169
|
+
// 处理当前页的进入/退出动画,返回 StyleObject
|
|
170
|
+
handlePrimaryAnimation?: RouteAnimationHandler
|
|
171
|
+
// 处理当前页的压入/压出动画,返回 StyleObject
|
|
172
|
+
handleSecondaryAnimation?: RouteAnimationHandler
|
|
173
|
+
// 处理上一级页面的压入/压出动画,返回 StyleObject 基础库 <3.0.0> 起支持
|
|
174
|
+
handlePreviousPageAnimation?: RouteAnimationHandler
|
|
175
|
+
// 页面进入时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持
|
|
176
|
+
allowEnterRouteSnapshotting?: boolean
|
|
177
|
+
// 页面退出时是否采用 snapshot 模式优化动画性能 基础库 <3.2.0> 起支持
|
|
178
|
+
allowExitRouteSnapshotting?: boolean
|
|
179
|
+
// 右滑返回时,可拖动范围是否撑满屏幕,基础库 <3.2.0> 起支持,常用于半屏弹窗
|
|
180
|
+
fullscreenDrag?: boolean
|
|
181
|
+
// 返回手势方向 基础库 <3.4.0> 起支持
|
|
182
|
+
popGestureDirection?: 'horizontal' | 'vertical' | 'multi'
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
type RouteAnimationHandler = () => { [key: string] : any}
|
|
186
|
+
|
|
187
|
+
/** 自定义路由
|
|
188
|
+
* @supported weapp
|
|
189
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/wx.router.html
|
|
190
|
+
*/
|
|
191
|
+
interface router {
|
|
192
|
+
/** 添加自定义路由配置
|
|
193
|
+
* @supported weapp
|
|
194
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.addRouteBuilder.html
|
|
195
|
+
*/
|
|
196
|
+
addRouteBuilder(
|
|
197
|
+
/** 路由类型 */
|
|
198
|
+
routeType: string,
|
|
199
|
+
/** 路由动画定义函数 */
|
|
200
|
+
routeBuilder: CustomRouteBuilder
|
|
201
|
+
): void
|
|
202
|
+
/** 获取页面对应的自定义路由上下文对象
|
|
203
|
+
* @supported weapp
|
|
204
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.getRouteContext.html
|
|
205
|
+
*/
|
|
206
|
+
getRouteContext(
|
|
207
|
+
/** 页面/自定义组件实例 */
|
|
208
|
+
instance: TaroGeneral.IAnyObject
|
|
209
|
+
): CustomRouteContext
|
|
210
|
+
/** 移除自定义路由配置
|
|
211
|
+
* @supported weapp
|
|
212
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/router/base/router.removeRouteBuilder.html
|
|
213
|
+
*/
|
|
214
|
+
removeRouteBuilder(
|
|
215
|
+
/** 路由类型 */
|
|
216
|
+
routeType: string,
|
|
217
|
+
): void
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
118
221
|
interface TaroStatic {
|
|
119
222
|
/** 跳转到 tabBar 页面,并关闭其他所有非 tabBar 页面
|
|
120
223
|
* @supported weapp, h5, rn, tt, harmony, harmony_hybrid
|
|
@@ -216,5 +319,6 @@ declare module '../../index' {
|
|
|
216
319
|
* @see https://developers.weixin.qq.com/miniprogram/dev/api/route/wx.navigateBack.html
|
|
217
320
|
*/
|
|
218
321
|
navigateBack(option?: navigateBack.Option): Promise<TaroGeneral.CallbackResult>
|
|
322
|
+
router: router.router
|
|
219
323
|
}
|
|
220
324
|
}
|
|
@@ -56,4 +56,290 @@ declare module '../../index' {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* DraggableSheet 实例,可通过 Taro.createSelectorQuery 的 NodesRef.node 方法获取。
|
|
62
|
+
*
|
|
63
|
+
* @supported weapp
|
|
64
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.html
|
|
65
|
+
*/
|
|
66
|
+
interface DraggableSheetContext {
|
|
67
|
+
/**
|
|
68
|
+
* 滚动到指定位置。size 取值 [0, 1],size = 1 时表示撑满 draggable-sheet 组件。size 和 pixels 同时传入时,仅 size 生效。
|
|
69
|
+
* @param option
|
|
70
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/DraggableSheetContext.scrollTo.html
|
|
71
|
+
*/
|
|
72
|
+
scrollTo(option: DraggableSheetContext.scrollTo.Option): void
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
namespace DraggableSheetContext {
|
|
76
|
+
namespace scrollTo {
|
|
77
|
+
interface Option {
|
|
78
|
+
/** 相对目标位置 */
|
|
79
|
+
size?: number
|
|
80
|
+
/** 绝对目标位置 */
|
|
81
|
+
pixels?: number
|
|
82
|
+
/**
|
|
83
|
+
* 是否启用滚动动画
|
|
84
|
+
* @default true
|
|
85
|
+
*/
|
|
86
|
+
animated?: boolean
|
|
87
|
+
/**
|
|
88
|
+
* 滚动动画时长(ms)
|
|
89
|
+
* @default 300
|
|
90
|
+
*/
|
|
91
|
+
duration?: number
|
|
92
|
+
/**
|
|
93
|
+
* 缓动函数
|
|
94
|
+
* @default ease
|
|
95
|
+
*/
|
|
96
|
+
easingFunction?: string
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
/**
|
|
102
|
+
* worklet 对象,可以通过 wx.worklet 获取
|
|
103
|
+
*
|
|
104
|
+
* @supported weapp-skyline
|
|
105
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/wx.worklet.html
|
|
106
|
+
*/
|
|
107
|
+
interface worklet {
|
|
108
|
+
/**
|
|
109
|
+
* 取消由 SharedValue 驱动的动画
|
|
110
|
+
* @param SharedValue
|
|
111
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.cancelAnimation.html
|
|
112
|
+
*/
|
|
113
|
+
cancelAnimation(SharedValue: worklet.SharedValue): void
|
|
114
|
+
/**
|
|
115
|
+
* 衍生值 DerivedValue,可基于已有的 SharedValue 生成其它共享变量。
|
|
116
|
+
* @param updaterWorklet
|
|
117
|
+
* @returns 返回 DerivedValue 类型值,可被 worklet 函数捕获。DerivedValue 也是 SharedValue 类型。
|
|
118
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.derived.html
|
|
119
|
+
*/
|
|
120
|
+
derived(updaterWorklet: worklet.WorkletFunction): worklet.DerivedValue
|
|
121
|
+
/**
|
|
122
|
+
* ScrollView 实例,可在 worklet 函数内操作 scroll-view 组件。
|
|
123
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.html
|
|
124
|
+
*/
|
|
125
|
+
scrollViewContext: {
|
|
126
|
+
/**
|
|
127
|
+
* 滚动至指定位置
|
|
128
|
+
* @param object
|
|
129
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.scrollViewContext.scrollTo.html
|
|
130
|
+
*/
|
|
131
|
+
scrollTo(NodesRef: TaroGeneral.IAnyObject, object: worklet.scrollViewContext.Option): void
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* 创建共享变量 SharedValue,用于跨线程共享数据和驱动动画。
|
|
135
|
+
* @param initialValue
|
|
136
|
+
* @returns 返回 SharedValue 类型值,可被 worklet 函数捕获。
|
|
137
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/base/worklet.shared.html
|
|
138
|
+
*/
|
|
139
|
+
shared(initialValue: number | string | bool | null | undefined | Object | Array | Function): worklet.SharedValue
|
|
140
|
+
/**
|
|
141
|
+
* 基于滚动衰减的动画。
|
|
142
|
+
* @param options 动画配置
|
|
143
|
+
* @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
|
|
144
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
145
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.decay.html
|
|
146
|
+
*/
|
|
147
|
+
decay(options?: worklet.decay.Option, callback?: (flag: boolean) => void): worklet.AnimationObject
|
|
148
|
+
Easing: worklet.Easing
|
|
149
|
+
/**
|
|
150
|
+
* 基于物理的动画。
|
|
151
|
+
* @param toValue 目标值
|
|
152
|
+
* @param options 动画配置
|
|
153
|
+
* @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
|
|
154
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
155
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.spring.html
|
|
156
|
+
*/
|
|
157
|
+
spring(toValue: number | string, options?: worklet.spring.Option, callback?: (flag: boolean) => void): worklet.AnimationObject
|
|
158
|
+
/**
|
|
159
|
+
* 基于时间的动画。
|
|
160
|
+
* @param toValue 目标值
|
|
161
|
+
* @param options 动画配置
|
|
162
|
+
* @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
|
|
163
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
164
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.timing.html
|
|
165
|
+
*/
|
|
166
|
+
timing(toValue: number | string, options?: worklet.timing.Option, callback?: (flag: boolean) => void): worklet.AnimationObject
|
|
167
|
+
/**
|
|
168
|
+
* 延迟执行动画。
|
|
169
|
+
* @param delayMS 动画开始前等待的时间,单位:毫秒
|
|
170
|
+
* @param delayedAnimation 动画对象
|
|
171
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
172
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.delay.html
|
|
173
|
+
*/
|
|
174
|
+
delay(delayMS: number, delayedAnimation: worklet.AnimationObject): worklet.AnimationObject
|
|
175
|
+
/**
|
|
176
|
+
* 重复执行动画。
|
|
177
|
+
* @param animation 动画对象
|
|
178
|
+
* @param numberOfReps 重复次数。为负值时一直循环,直到被取消动画。
|
|
179
|
+
* @param reverse 反向运行动画,每周期结束动画由尾到头运行。该字段仅对 timing 和 spring 返回的动画对象生效。
|
|
180
|
+
* @param callback 动画完成回调。动画被取消时,返回 fasle,正常完成时返回 true。
|
|
181
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
182
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.repeat.html
|
|
183
|
+
*/
|
|
184
|
+
repeat(delayedAnimation: worklet.AnimationObject, numberOfReps: number, reverse?: boolean, callback?: (flag: boolean) => void): worklet.AnimationObject
|
|
185
|
+
/**
|
|
186
|
+
* 组合动画序列,依次执行传入的动画。
|
|
187
|
+
* @param animation 动画对象
|
|
188
|
+
* @returns 返回 AnimationObject 类型值,可直接赋值给 SharedValue。
|
|
189
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/combine-animation/worklet.sequence.html
|
|
190
|
+
*/
|
|
191
|
+
sequence(...delayedAnimation: worklet.AnimationObject): worklet.AnimationObject
|
|
192
|
+
/**
|
|
193
|
+
* worklet 函数运行在 UI 线程时,捕获的外部函数可能为 worklet 类型或普通函数,为了更明显的对其区分,要求必须使用 runOnJS 调回 JS 线程的普通函数。 有这样的要求是因为,调用其它 worklet 函数时是同步调用,但在 UI 线程执行 JS 线程的函数只能是异步,开发者容易混淆,试图同步获取 JS 线程的返回值。
|
|
194
|
+
* @param fn worklet 类型函数
|
|
195
|
+
* @returns runOnJS 为高阶函数,返回一个函数,执行时运行在 JS 线程
|
|
196
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnJS.html
|
|
197
|
+
*/
|
|
198
|
+
runOnJS(fn: TaroGeneral.TFunc): TaroGeneral.TFunc
|
|
199
|
+
/**
|
|
200
|
+
* 在 UI 线程执行 worklet 函数
|
|
201
|
+
* @param fn worklet 类型函数
|
|
202
|
+
* @returns runOnUI 为高阶函数,返回一个函数,执行时运行在 UI 线程
|
|
203
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/tool-function/worklet.runOnUI.html
|
|
204
|
+
*/
|
|
205
|
+
runOnUI(fn: TaroGeneral.TFunc): TaroGeneral.TFunc
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
namespace worklet {
|
|
209
|
+
type SharedValue = TaroGeneral.IAnyObject
|
|
210
|
+
type DerivedValue = worklet.SharedValue
|
|
211
|
+
type AnimationObject = TaroGeneral.IAnyObject
|
|
212
|
+
type WorkletFunction = TaroGeneral.TFunc
|
|
213
|
+
|
|
214
|
+
namespace scrollViewContext {
|
|
215
|
+
interface Option {
|
|
216
|
+
/** 顶部距离 */
|
|
217
|
+
top?: number
|
|
218
|
+
/** 左边界距离 */
|
|
219
|
+
left?: number
|
|
220
|
+
/** 滚动动画时长 */
|
|
221
|
+
duration?: number
|
|
222
|
+
/** 是否启用滚动动画 */
|
|
223
|
+
animated?: boolean
|
|
224
|
+
/** 动画曲线 */
|
|
225
|
+
easingFunction?: string
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
namespace decay {
|
|
230
|
+
interface Option {
|
|
231
|
+
/** 初速度 */
|
|
232
|
+
velocity?: number
|
|
233
|
+
/** 衰减速率 */
|
|
234
|
+
deceleration?: number
|
|
235
|
+
/** 边界值,长度为 2 的数组 */
|
|
236
|
+
clamp?: Array<number>
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface Easing {
|
|
241
|
+
/**
|
|
242
|
+
* 简单的反弹效果
|
|
243
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
244
|
+
*/
|
|
245
|
+
bounce(t: number): any;
|
|
246
|
+
/**
|
|
247
|
+
* 简单的惯性动画
|
|
248
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
249
|
+
*/
|
|
250
|
+
ease(t: number): any;
|
|
251
|
+
/**
|
|
252
|
+
* 简单的弹性动画,类似弹簧来回摆动,高阶函数。默认弹性为 1,会稍微超出一次。弹性为 0 时 不会过冲
|
|
253
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
254
|
+
*/
|
|
255
|
+
elastic(bounciness?: number): any;
|
|
256
|
+
/**
|
|
257
|
+
* 线性函数
|
|
258
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
259
|
+
*/
|
|
260
|
+
linear(t: number): any;
|
|
261
|
+
/**
|
|
262
|
+
* 二次方函数
|
|
263
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
264
|
+
*/
|
|
265
|
+
quad(t: number): any;
|
|
266
|
+
/**
|
|
267
|
+
* 立方函数
|
|
268
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
269
|
+
*/
|
|
270
|
+
cubic(t: number): any;
|
|
271
|
+
/**
|
|
272
|
+
* 高阶函数,返回幂函数
|
|
273
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
274
|
+
*/
|
|
275
|
+
poly(n: number): any;
|
|
276
|
+
/**
|
|
277
|
+
* 三次贝塞尔曲线,效果同 css transition-timing-function
|
|
278
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
279
|
+
*/
|
|
280
|
+
bezier(x1: number, y1: number, x2: number, y2: number): any;
|
|
281
|
+
/**
|
|
282
|
+
* 圆形曲线
|
|
283
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
284
|
+
*/
|
|
285
|
+
circle(t: number): any;
|
|
286
|
+
/**
|
|
287
|
+
* 正弦函数
|
|
288
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
289
|
+
*/
|
|
290
|
+
sin(t: number): any;
|
|
291
|
+
/**
|
|
292
|
+
* 指数函数
|
|
293
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
294
|
+
*/
|
|
295
|
+
exp(t: number): any;
|
|
296
|
+
/**
|
|
297
|
+
* 正向运行 easing function,高阶函数。
|
|
298
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
299
|
+
*/
|
|
300
|
+
in(easing: (t: number) => any): any;
|
|
301
|
+
/**
|
|
302
|
+
* 反向运行 easing function,高阶函数。
|
|
303
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
304
|
+
*/
|
|
305
|
+
out(easing: (t: number) => any): any;
|
|
306
|
+
/**
|
|
307
|
+
* 前半程正向,后半程反向,高阶函数。
|
|
308
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/worklet/animation/worklet.Easing.html
|
|
309
|
+
*/
|
|
310
|
+
inOut(easing: (t: number) => any): any;
|
|
311
|
+
}
|
|
312
|
+
|
|
313
|
+
namespace spring {
|
|
314
|
+
interface Option {
|
|
315
|
+
/** 阻尼系数 */
|
|
316
|
+
damping?: number
|
|
317
|
+
/** 重量系数,值越大移动越慢 */
|
|
318
|
+
mass?: number
|
|
319
|
+
/** 弹性系数 */
|
|
320
|
+
stiffness?: number
|
|
321
|
+
/** 动画是否可以在指定值上反弹 */
|
|
322
|
+
overshootClamping?: boolean
|
|
323
|
+
/** 弹簧静止时的位移 */
|
|
324
|
+
restDisplacementThreshold?: number
|
|
325
|
+
/** 弹簧静止的速度 */
|
|
326
|
+
restSpeedThreshold?: number
|
|
327
|
+
/** 速度 */
|
|
328
|
+
velocity?: number
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
namespace timing {
|
|
333
|
+
interface Option {
|
|
334
|
+
/** 动画时长 */
|
|
335
|
+
duration?: number
|
|
336
|
+
/** 动画曲线 */
|
|
337
|
+
easing?: (t: number) => number
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
interface TaroStatic {
|
|
343
|
+
worklet: worklet
|
|
344
|
+
}
|
|
59
345
|
}
|
|
@@ -130,6 +130,26 @@ declare module './index' {
|
|
|
130
130
|
/** 是否返回变更的 data 字段信息 */
|
|
131
131
|
withDataPaths?: boolean
|
|
132
132
|
}, listener: () => void): void
|
|
133
|
+
/**
|
|
134
|
+
* 绑定由 worklet 驱动的样式到相应的节点
|
|
135
|
+
* @param selector 节点选择器
|
|
136
|
+
* @param updater worklet 样式更新函数
|
|
137
|
+
* @param config 配置项
|
|
138
|
+
* @param callback 完成样式绑定的回调
|
|
139
|
+
* */
|
|
140
|
+
applyAnimatedStyle?(selector: string, updater: TaroGeneral.TFunc, config?: {
|
|
141
|
+
/** 是否立即执行一次 updater 函数 */
|
|
142
|
+
immediate?: boolean
|
|
143
|
+
/** 刷新时机,枚举值 async / sync */
|
|
144
|
+
flush?: string
|
|
145
|
+
}, callback?: TaroGeneral.TFunc): void
|
|
146
|
+
/**
|
|
147
|
+
* 清除节点上 worklet 驱动样式的绑定关系
|
|
148
|
+
* @param selector 节点选择器
|
|
149
|
+
* @param styleIds 需要清除的 styleId 集合
|
|
150
|
+
* @param callback 清除样式绑定的回调
|
|
151
|
+
* */
|
|
152
|
+
clearAnimatedStyle?(selector: string, styleIds: Array<Number>, callback?: TaroGeneral.TFunc): void
|
|
133
153
|
}
|
|
134
154
|
interface PageInstance extends PageLifeCycle, ComponentInstance {
|
|
135
155
|
/** 页面配置 */
|