升级package, 以及更新声明文件
This commit is contained in:
113
typings/types/wx/index.d.ts
vendored
113
typings/types/wx/index.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -24,9 +24,11 @@ SOFTWARE.
|
||||
/// <reference path="./lib.wx.page.d.ts" />
|
||||
/// <reference path="./lib.wx.api.d.ts" />
|
||||
/// <reference path="./lib.wx.cloud.d.ts" />
|
||||
/// <reference path="./lib.wx.canvas.d.ts" />
|
||||
/// <reference path="./lib.wx.component.d.ts" />
|
||||
/// <reference path="./lib.wx.behavior.d.ts" />
|
||||
/// <reference path="./lib.wx.event.d.ts" />
|
||||
/// <reference path="./lib.wx.wasm.d.ts" />
|
||||
|
||||
declare namespace WechatMiniprogram {
|
||||
type IAnyObject = Record<string, any>
|
||||
@@ -38,27 +40,77 @@ declare namespace WechatMiniprogram {
|
||||
type PromisifySuccessResult<
|
||||
P,
|
||||
T extends AsyncMethodOptionLike
|
||||
> = P extends { success: any }
|
||||
> = P extends {
|
||||
success: any
|
||||
}
|
||||
? void
|
||||
: P extends { fail: any }
|
||||
? void
|
||||
: P extends { complete: any }
|
||||
? void
|
||||
: Promise<Parameters<Exclude<T['success'], undefined>>[0]>
|
||||
|
||||
// TODO: Extract real definition from `lib.dom.d.ts` to replace this
|
||||
type IIRFilterNode = any
|
||||
type WaveShaperNode = any
|
||||
type ConstantSourceNode = any
|
||||
type OscillatorNode = any
|
||||
type GainNode = any
|
||||
type BiquadFilterNode = any
|
||||
type PeriodicWaveNode = any
|
||||
type AudioNode = any
|
||||
type ChannelSplitterNode = any
|
||||
type ChannelMergerNode = any
|
||||
type DelayNode = any
|
||||
type DynamicsCompressorNode = any
|
||||
type ScriptProcessorNode = any
|
||||
type PannerNode = any
|
||||
type AnalyserNode = any
|
||||
type WebGLTexture = any
|
||||
type WebGLRenderingContext = any
|
||||
|
||||
// TODO: fill worklet type
|
||||
type WorkletFunction = (...args: any) => any
|
||||
type AnimationObject = any
|
||||
type SharedValue<T = any> = T
|
||||
type DerivedValue<T = any> = T
|
||||
}
|
||||
|
||||
declare const console: WechatMiniprogram.Console
|
||||
declare const wx: WechatMiniprogram.Wx
|
||||
declare let console: WechatMiniprogram.Console
|
||||
|
||||
declare let wx: WechatMiniprogram.Wx
|
||||
/** 引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
|
||||
declare function require(
|
||||
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
|
||||
module: string
|
||||
): any
|
||||
interface Require {
|
||||
(
|
||||
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
|
||||
module: string,
|
||||
/** 用于异步获取其他分包中的模块的引用结果,详见 [分包异步化]((subpackages/async)) */
|
||||
callback?: (moduleExport: any) => void,
|
||||
/** 异步获取分包失败时的回调,详见 [分包异步化]((subpackages/async)) */
|
||||
errorCallback?: (err: any) => void
|
||||
): any
|
||||
/** 以 Promise 形式异步引入模块。返回模块通过 `module.exports` 或 `exports` 暴露的接口。 */
|
||||
async(
|
||||
/** 需要引入模块文件相对于当前文件的相对路径,或 npm 模块名,或 npm 模块路径。不支持绝对路径 */
|
||||
module: string
|
||||
): Promise<any>
|
||||
}
|
||||
declare const require: Require
|
||||
/** 引入插件。返回插件通过 `main` 暴露的接口。 */
|
||||
declare function requirePlugin(
|
||||
/** 需要引入的插件的 alias */
|
||||
module: string
|
||||
): any
|
||||
interface RequirePlugin {
|
||||
(
|
||||
/** 需要引入的插件的 alias */
|
||||
module: string,
|
||||
/** 用于异步获取其他分包中的插件的引用结果,详见 [分包异步化]((subpackages/async)) */
|
||||
callback?: (pluginExport: any) => void
|
||||
): any
|
||||
/** 以 Promise 形式异步引入插件。返回插件通过 `main` 暴露的接口。 */
|
||||
async(
|
||||
/** 需要引入的插件的 alias */
|
||||
module: string
|
||||
): Promise<any>
|
||||
}
|
||||
declare const requirePlugin: RequirePlugin
|
||||
/** 插件引入当前使用者小程序。返回使用者小程序通过 [插件配置中 `export` 暴露的接口](https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/using.html#%E5%AF%BC%E5%87%BA%E5%88%B0%E6%8F%92%E4%BB%B6)。
|
||||
*
|
||||
* 该接口只在插件中存在
|
||||
@@ -72,3 +124,40 @@ declare let module: {
|
||||
}
|
||||
/** `module.exports` 的引用 */
|
||||
declare let exports: any
|
||||
|
||||
/** [clearInterval(number intervalID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearInterval.html)
|
||||
*
|
||||
* 取消由 setInterval 设置的定时器。 */
|
||||
declare function clearInterval(
|
||||
/** 要取消的定时器的 ID */
|
||||
intervalID: number
|
||||
): void
|
||||
/** [clearTimeout(number timeoutID)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/clearTimeout.html)
|
||||
*
|
||||
* 取消由 setTimeout 设置的定时器。 */
|
||||
declare function clearTimeout(
|
||||
/** 要取消的定时器的 ID */
|
||||
timeoutID: number
|
||||
): void
|
||||
/** [number setInterval(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setInterval.html)
|
||||
*
|
||||
* 设定一个定时器。按照指定的周期(以毫秒计)来执行注册的回调函数 */
|
||||
declare function setInterval(
|
||||
/** 回调函数 */
|
||||
callback: (...args: any[]) => any,
|
||||
/** 执行回调函数之间的时间间隔,单位 ms。 */
|
||||
delay?: number,
|
||||
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
|
||||
...rest: any[]
|
||||
): number
|
||||
/** [number setTimeout(function callback, number delay, any rest)](https://developers.weixin.qq.com/miniprogram/dev/api/base/timer/setTimeout.html)
|
||||
*
|
||||
* 设定一个定时器。在定时到期以后执行注册的回调函数 */
|
||||
declare function setTimeout(
|
||||
/** 回调函数 */
|
||||
callback: (...args: any[]) => any,
|
||||
/** 延迟的时间,函数的调用会在该延迟之后发生,单位 ms。 */
|
||||
delay?: number,
|
||||
/** param1, param2, ..., paramN 等附加参数,它们会作为参数传递给回调函数。 */
|
||||
...rest: any[]
|
||||
): number
|
||||
|
||||
29924
typings/types/wx/lib.wx.api.d.ts
vendored
29924
typings/types/wx/lib.wx.api.d.ts
vendored
File diff suppressed because it is too large
Load Diff
210
typings/types/wx/lib.wx.app.d.ts
vendored
210
typings/types/wx/lib.wx.app.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -21,28 +21,14 @@ SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace WechatMiniprogram.App {
|
||||
interface ReferrerInfo {
|
||||
/** 来源小程序或公众号或App的 appId
|
||||
*
|
||||
* 以下场景支持返回 referrerInfo.appId:
|
||||
* - 1020(公众号 profile 页相关小程序列表): appId
|
||||
* - 1035(公众号自定义菜单):来源公众号 appId
|
||||
* - 1036(App 分享消息卡片):来源应用 appId
|
||||
* - 1037(小程序打开小程序):来源小程序 appId
|
||||
* - 1038(从另一个小程序返回):来源小程序 appId
|
||||
* - 1043(公众号模板消息):来源公众号 appId
|
||||
*/
|
||||
appId: string
|
||||
/** 来源小程序传过来的数据,scene=1037或1038时支持 */
|
||||
extraData?: any
|
||||
}
|
||||
|
||||
type SceneValues =
|
||||
| 1000
|
||||
| 1001
|
||||
| 1005
|
||||
| 1006
|
||||
| 1007
|
||||
| 1008
|
||||
| 1010
|
||||
| 1011
|
||||
| 1012
|
||||
| 1013
|
||||
@@ -50,6 +36,7 @@ declare namespace WechatMiniprogram.App {
|
||||
| 1017
|
||||
| 1019
|
||||
| 1020
|
||||
| 1022
|
||||
| 1023
|
||||
| 1024
|
||||
| 1025
|
||||
@@ -76,12 +63,16 @@ declare namespace WechatMiniprogram.App {
|
||||
| 1049
|
||||
| 1052
|
||||
| 1053
|
||||
| 1054
|
||||
| 1056
|
||||
| 1057
|
||||
| 1058
|
||||
| 1059
|
||||
| 1060
|
||||
| 1064
|
||||
| 1065
|
||||
| 1067
|
||||
| 1068
|
||||
| 1069
|
||||
| 1071
|
||||
| 1072
|
||||
@@ -93,6 +84,7 @@ declare namespace WechatMiniprogram.App {
|
||||
| 1081
|
||||
| 1082
|
||||
| 1084
|
||||
| 1088
|
||||
| 1089
|
||||
| 1090
|
||||
| 1091
|
||||
@@ -101,11 +93,76 @@ declare namespace WechatMiniprogram.App {
|
||||
| 1096
|
||||
| 1097
|
||||
| 1099
|
||||
| 1100
|
||||
| 1101
|
||||
| 1102
|
||||
| 1103
|
||||
| 1104
|
||||
| 1106
|
||||
| 1107
|
||||
| 1113
|
||||
| 1114
|
||||
| 1119
|
||||
| 1120
|
||||
| 1121
|
||||
| 1124
|
||||
| 1125
|
||||
| 1126
|
||||
| 1129
|
||||
| 1131
|
||||
| 1133
|
||||
| 1135
|
||||
| 1144
|
||||
| 1145
|
||||
| 1146
|
||||
| 1148
|
||||
| 1150
|
||||
| 1151
|
||||
| 1152
|
||||
| 1153
|
||||
| 1154
|
||||
| 1155
|
||||
| 1157
|
||||
| 1158
|
||||
| 1160
|
||||
| 1167
|
||||
| 1168
|
||||
| 1169
|
||||
| 1171
|
||||
| 1173
|
||||
| 1175
|
||||
| 1176
|
||||
| 1177
|
||||
| 1178
|
||||
| 1179
|
||||
| 1181
|
||||
| 1183
|
||||
| 1184
|
||||
| 1185
|
||||
| 1186
|
||||
| 1187
|
||||
| 1189
|
||||
| 1191
|
||||
| 1192
|
||||
| 1193
|
||||
| 1194
|
||||
| 1195
|
||||
| 1196
|
||||
| 1197
|
||||
| 1198
|
||||
| 1200
|
||||
| 1201
|
||||
| 1202
|
||||
| 1203
|
||||
| 1206
|
||||
| 1207
|
||||
| 1208
|
||||
| 1212
|
||||
| 1215
|
||||
| 1216
|
||||
| 1223
|
||||
| 1228
|
||||
| 1231
|
||||
|
||||
interface LaunchShowOption {
|
||||
/** 打开小程序的路径 */
|
||||
@@ -113,18 +170,21 @@ declare namespace WechatMiniprogram.App {
|
||||
/** 打开小程序的query */
|
||||
query: IAnyObject
|
||||
/** 打开小程序的场景值
|
||||
* - 1001:发现栏小程序主入口,「最近使用」列表(基础库2.2.4版本起包含「我的小程序」列表)
|
||||
* - 1000:其他
|
||||
* - 1001:发现栏小程序主入口,「最近使用」列表(基础库 2.2.4 版本起包含「我的小程序」列表)
|
||||
* - 1005:微信首页顶部搜索框的搜索结果页
|
||||
* - 1006:发现栏小程序主入口搜索框的搜索结果页
|
||||
* - 1007:单人聊天会话中的小程序消息卡片
|
||||
* - 1008:群聊会话中的小程序消息卡片
|
||||
* - 1010:收藏夹
|
||||
* - 1011:扫描二维码
|
||||
* - 1012:长按图片识别二维码
|
||||
* - 1013:扫描手机相册中选取的二维码
|
||||
* - 1014:小程序模板消息
|
||||
* - 1014:小程序订阅消息(与 1107 相同)
|
||||
* - 1017:前往小程序体验版的入口页
|
||||
* - 1019:微信钱包(微信客户端7.0.0版本改为支付入口)
|
||||
* - 1020:公众号 profile 页相关小程序列表
|
||||
* - 1019:微信钱包(微信客户端 7.0.0 版本改为支付入口)
|
||||
* - 1020:公众号 profile 页相关小程序列表(已废弃)
|
||||
* - 1022:聊天顶部置顶小程序入口(微信客户端 6.6.1 版本起废弃)
|
||||
* - 1023:安卓系统桌面图标
|
||||
* - 1024:小程序 profile 页
|
||||
* - 1025:扫描一维码
|
||||
@@ -151,42 +211,136 @@ declare namespace WechatMiniprogram.App {
|
||||
* - 1049:扫描手机相册中选取的小程序码
|
||||
* - 1052:卡券的适用门店列表
|
||||
* - 1053:搜一搜的结果页
|
||||
* - 1054:顶部搜索框小程序快捷入口(微信客户端版本 6.7.4 起废弃)
|
||||
* - 1056:聊天顶部音乐播放器右上角菜单
|
||||
* - 1057:钱包中的银行卡详情页
|
||||
* - 1058:公众号文章
|
||||
* - 1059:体验版小程序绑定邀请页
|
||||
* - 1064:微信首页连Wi-Fi状态栏
|
||||
* - 1060:微信支付完成页(与 1034 相同)
|
||||
* - 1064:微信首页连 Wi-Fi 状态栏
|
||||
* - 1065:URL scheme [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-scheme.html)
|
||||
* - 1067:公众号文章广告
|
||||
* - 1069:移动应用
|
||||
* - 1068:附近小程序列表广告(已废弃)
|
||||
* - 1069:移动应用通过 openSDK 进入微信,打开小程序
|
||||
* - 1071:钱包中的银行卡列表页
|
||||
* - 1072:二维码收款页面
|
||||
* - 1073:客服消息列表下发的小程序消息卡片
|
||||
* - 1074:公众号会话下发的小程序消息卡片
|
||||
* - 1077:摇周边
|
||||
* - 1078:微信连Wi-Fi成功提示页
|
||||
* - 1078:微信连 Wi-Fi 成功提示页
|
||||
* - 1079:微信游戏中心
|
||||
* - 1081:客服消息下发的文字链
|
||||
* - 1082:公众号会话下发的文字链
|
||||
* - 1084:朋友圈广告原生页
|
||||
* - 1089:微信聊天主界面下拉,「最近使用」栏(基础库2.2.4版本起包含「我的小程序」栏)
|
||||
* - 1088:会话中查看系统消息,打开小程序
|
||||
* - 1089:微信聊天主界面下拉,「最近使用」栏(基础库 2.2.4 版本起包含「我的小程序」栏)
|
||||
* - 1090:长按小程序右上角菜单唤出最近使用历史
|
||||
* - 1091:公众号文章商品卡片
|
||||
* - 1092:城市服务入口
|
||||
* - 1095:小程序广告组件
|
||||
* - 1096:聊天记录
|
||||
* - 1097:微信支付签约页
|
||||
* - 1096:聊天记录,打开小程序
|
||||
* - 1097:微信支付签约原生页,打开小程序
|
||||
* - 1099:页面内嵌插件
|
||||
* - 1100:红包封面详情页打开小程序
|
||||
* - 1101:远程调试热更新(开发者工具中,预览 -> 自动预览 -> 编译并预览)
|
||||
* - 1102:公众号 profile 页服务预览
|
||||
* - 1103:发现栏小程序主入口,「我的小程序」列表(基础库 2.2.4 版本起废弃)
|
||||
* - 1104:微信聊天主界面下拉,「我的小程序」栏(基础库 2.2.4 版本起废弃)
|
||||
* - 1106:聊天主界面下拉,从顶部搜索结果页,打开小程序
|
||||
* - 1107:订阅消息,打开小程序
|
||||
* - 1113:安卓手机负一屏,打开小程序(三星)
|
||||
* - 1114:安卓手机侧边栏,打开小程序(三星)
|
||||
* - 1119:【企业微信】工作台内打开小程序
|
||||
* - 1120:【企业微信】个人资料页内打开小程序
|
||||
* - 1121:【企业微信】聊天加号附件框内打开小程序
|
||||
* - 1124:扫“一物一码”打开小程序
|
||||
* - 1125:长按图片识别“一物一码”
|
||||
* - 1126:扫描手机相册中选取的“一物一码”
|
||||
* - 1129:微信爬虫访问 [详情](https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/sitemap.html)
|
||||
* - 1131:浮窗(8.0 版本起仅包含被动浮窗)
|
||||
* - 1133:硬件设备打开小程序 [详情](https://developers.weixin.qq.com/doc/oplatform/Miniprogram_Frame/)
|
||||
* - 1135:小程序 profile 页相关小程序列表,打开小程序
|
||||
* - 1144:公众号文章 - 视频贴片
|
||||
* - 1145:发现栏 - 发现小程序
|
||||
* - 1146:地理位置信息打开出行类小程序
|
||||
* - 1148:卡包-交通卡,打开小程序
|
||||
* - 1150:扫一扫商品条码结果页打开小程序
|
||||
* - 1151:发现栏 - 我的订单
|
||||
* - 1152:订阅号视频打开小程序
|
||||
* - 1153:“识物”结果页打开小程序
|
||||
* - 1154:朋友圈内打开“单页模式”
|
||||
* - 1155:“单页模式”打开小程序
|
||||
* - 1157:服务号会话页打开小程序
|
||||
* - 1158:群工具打开小程序
|
||||
* - 1160:群待办
|
||||
* - 1167:H5 通过开放标签打开小程序 [详情](https://developers.weixin.qq.com/doc/offiaccount/OA_Web_Apps/Wechat_Open_Tag.html)
|
||||
* - 1168:移动应用直接运行小程序
|
||||
* - 1169:发现栏小程序主入口,各个生活服务入口(例如快递服务、出行服务等)
|
||||
* - 1171:微信运动记录(仅安卓)
|
||||
* - 1173:聊天素材用小程序打开 [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html)
|
||||
* - 1175:视频号主页商店入口
|
||||
* - 1176:视频号直播间主播打开小程序
|
||||
* - 1177:视频号直播商品
|
||||
* - 1178:在电脑打开手机上打开的小程序
|
||||
* - 1179:#话题页打开小程序
|
||||
* - 1181:网站应用打开 PC 小程序
|
||||
* - 1183:PC 微信 - 小程序面板 - 发现小程序 - 搜索
|
||||
* - 1184:视频号链接打开小程序
|
||||
* - 1185:群公告
|
||||
* - 1186:收藏 - 笔记
|
||||
* - 1187:浮窗(8.0 版本起)
|
||||
* - 1189:表情雨广告
|
||||
* - 1191:视频号活动
|
||||
* - 1192:企业微信联系人 profile 页
|
||||
* - 1193:视频号主页服务菜单打开小程序
|
||||
* - 1194:URL Link [详情](https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/url-link.html)
|
||||
* - 1195:视频号主页商品 tab
|
||||
* - 1196:个人状态打开小程序
|
||||
* - 1197:视频号主播从直播间返回小游戏
|
||||
* - 1198:视频号开播界面打开小游戏
|
||||
* - 1200:视频号广告打开小程序
|
||||
* - 1201:视频号广告详情页打开小程序
|
||||
* - 1202:企微客服号会话打开小程序卡片
|
||||
* - 1203:微信小程序压测工具的请求
|
||||
* - 1206:视频号小游戏直播间打开小游戏
|
||||
* - 1207:企微客服号会话打开小程序文字链
|
||||
* - 1208:聊天打开商品卡片
|
||||
* - 1212:青少年模式申请页打开小程序
|
||||
* - 1215:广告预约打开小程序
|
||||
* - 1216:视频号订单中心打开小程序
|
||||
* - 1223:安卓桌面 Widget 打开小程序
|
||||
* - 1228:视频号原生广告组件打开小程序
|
||||
* - 1231:动态消息提醒入口打开小程序
|
||||
*/
|
||||
scene: SceneValues
|
||||
/** shareTicket,详见 [获取更多转发信息]((转发#获取更多转发信息)) */
|
||||
shareTicket: string
|
||||
/** 当场景为由从另一个小程序或公众号或App打开时,返回此字段 */
|
||||
referrerInfo?: ReferrerInfo
|
||||
/** 打开的文件信息数组,只有从聊天素材场景打开(scene为1173)才会携带该参数 */
|
||||
forwardMaterials: ForwardMaterials[]
|
||||
/** 从微信群聊/单聊打开小程序时,chatType 表示具体微信群聊/单聊类型
|
||||
*
|
||||
* 可选值:
|
||||
* - 1: 微信联系人单聊;
|
||||
* - 2: 企业微信联系人单聊;
|
||||
* - 3: 普通微信群聊;
|
||||
* - 4: 企业微信互通群聊; */
|
||||
chatType?: 1 | 2 | 3 | 4
|
||||
/** 需要基础库: `2.20.0`
|
||||
*
|
||||
* API 类别
|
||||
*
|
||||
* 可选值:
|
||||
* - 'default': 默认类别;
|
||||
* - 'nativeFunctionalized': 原生功能化,视频号直播商品、商品橱窗等场景打开的小程序;
|
||||
* - 'browseOnly': 仅浏览,朋友圈快照页等场景打开的小程序;
|
||||
* - 'embedded': 内嵌,通过打开半屏小程序能力打开的小程序; */
|
||||
apiCategory:
|
||||
| 'default'
|
||||
| 'nativeFunctionalized'
|
||||
| 'browseOnly'
|
||||
| 'embedded'
|
||||
}
|
||||
|
||||
interface PageNotFoundOption {
|
||||
@@ -262,7 +416,7 @@ declare namespace WechatMiniprogram.App {
|
||||
}
|
||||
|
||||
interface GetApp {
|
||||
<T = IAnyObject>(opts?: GetAppOption): Instance<T>
|
||||
<T extends IAnyObject = IAnyObject>(opts?: GetAppOption): Instance<T>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
35
typings/types/wx/lib.wx.behavior.d.ts
vendored
35
typings/types/wx/lib.wx.behavior.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -21,47 +21,64 @@ SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace WechatMiniprogram.Behavior {
|
||||
type BehaviorIdentifier = string
|
||||
|
||||
type BehaviorIdentifier<
|
||||
TData extends DataOption = {},
|
||||
TProperty extends PropertyOption = {},
|
||||
TMethod extends MethodOption = {},
|
||||
TBehavior extends BehaviorOption = []
|
||||
> = string & {
|
||||
[key in 'BehaviorType']?: {
|
||||
data: Component.FilterUnknownType<TData> & Component.MixinData<TBehavior>
|
||||
properties: Component.FilterUnknownType<TProperty> & Component.MixinProperties<TBehavior, true>
|
||||
methods: Component.FilterUnknownType<TMethod> & Component.MixinMethods<TBehavior>
|
||||
}
|
||||
}
|
||||
type Instance<
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends MethodOption,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||
> = Component.Instance<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject>
|
||||
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject>
|
||||
> = Component.Instance<TData, TProperty, TMethod, TBehavior, TCustomInstanceProperty>
|
||||
type TrivialInstance = Instance<IAnyObject, IAnyObject, IAnyObject, Component.IEmptyArray>
|
||||
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, Component.IEmptyArray>
|
||||
type Options<
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends MethodOption,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||
> = Partial<Data<TData>> &
|
||||
Partial<Property<TProperty>> &
|
||||
Partial<Method<TMethod>> &
|
||||
Partial<Behavior<TBehavior>> &
|
||||
Partial<OtherOption> &
|
||||
Partial<Lifetimes> &
|
||||
ThisType<Instance<TData, TProperty, TMethod, TCustomInstanceProperty>>
|
||||
ThisType<Instance<TData, TProperty, TMethod, TBehavior, TCustomInstanceProperty>>
|
||||
interface Constructor {
|
||||
<
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends MethodOption,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = Record<string, never>
|
||||
>(
|
||||
options: Options<TData, TProperty, TMethod, TCustomInstanceProperty>
|
||||
): BehaviorIdentifier
|
||||
options: Options<TData, TProperty, TMethod, TBehavior, TCustomInstanceProperty>
|
||||
): BehaviorIdentifier<TData, TProperty, TMethod, TBehavior>
|
||||
}
|
||||
|
||||
type DataOption = Component.DataOption
|
||||
type PropertyOption = Component.PropertyOption
|
||||
type MethodOption = Component.MethodOption
|
||||
type BehaviorOption = Component.BehaviorOption
|
||||
type Data<D extends DataOption> = Component.Data<D>
|
||||
type Property<P extends PropertyOption> = Component.Property<P>
|
||||
type Method<M extends MethodOption> = Component.Method<M>
|
||||
type Behavior<B extends BehaviorOption> = Component.Behavior<B>
|
||||
|
||||
type DefinitionFilter = Component.DefinitionFilter
|
||||
type Lifetimes = Component.Lifetimes
|
||||
|
||||
type OtherOption = Omit<Component.OtherOption, 'options'>
|
||||
}
|
||||
/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
|
||||
|
||||
2623
typings/types/wx/lib.wx.canvas.d.ts
vendored
Normal file
2623
typings/types/wx/lib.wx.canvas.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
233
typings/types/wx/lib.wx.cloud.d.ts
vendored
233
typings/types/wx/lib.wx.cloud.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -20,6 +20,12 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/// <reference lib="es2018.asynciterable" />
|
||||
|
||||
/**
|
||||
* Common interfaces and types
|
||||
*/
|
||||
|
||||
interface IAPIError {
|
||||
errMsg: string
|
||||
}
|
||||
@@ -121,6 +127,19 @@ interface WxCloud {
|
||||
|
||||
CloudID: ICloud.ICloudIDConstructor
|
||||
CDN: ICloud.ICDNConstructor
|
||||
|
||||
callContainer(param: OQ<ICloud.CallContainerParam>): void
|
||||
callContainer(
|
||||
param: RQ<ICloud.CallContainerParam>
|
||||
): Promise<ICloud.CallContainerResult>
|
||||
|
||||
connectContainer(param: OQ<ICloud.ConnectContainerParam>): void
|
||||
connectContainer(
|
||||
param: RQ<ICloud.ConnectContainerParam>
|
||||
): Promise<ICloud.ConnectContainerResult>
|
||||
|
||||
services: ICloud.CloudServices
|
||||
extend: ICloud.ICloudExtendServices
|
||||
}
|
||||
|
||||
declare namespace ICloud {
|
||||
@@ -142,6 +161,146 @@ declare namespace ICloud {
|
||||
}
|
||||
// === end ===
|
||||
|
||||
// === API: container ===
|
||||
type CallContainerData = AnyObject
|
||||
|
||||
interface CallContainerResult extends IAPISuccessParam {
|
||||
data: any
|
||||
statusCode: number
|
||||
header: Record<string, any>
|
||||
callID: string
|
||||
}
|
||||
|
||||
interface CallContainerParam extends ICloudAPIParam<CallContainerResult> {
|
||||
path: string
|
||||
service?: string
|
||||
method?: string
|
||||
header?: Record<string, any>
|
||||
data?: any // string, object, ArrayBuffer
|
||||
dataType?: string
|
||||
responseType?: string
|
||||
timeout?: number
|
||||
verbose?: boolean
|
||||
followRedirect?: boolean
|
||||
}
|
||||
|
||||
interface ConnectContainerResult extends IAPISuccessParam {
|
||||
socketTask: WechatMiniprogram.SocketTask
|
||||
}
|
||||
|
||||
interface ConnectSocketOptions extends IAPIParam<void> {
|
||||
header?: Record<string, string>
|
||||
protocols?: string[]
|
||||
tcpNoDelay?: boolean
|
||||
perMessageDeflate?: boolean
|
||||
timeout?: number
|
||||
}
|
||||
|
||||
type ConnectContainerParam = Omit<
|
||||
ConnectSocketOptions,
|
||||
'success' | 'fail' | 'complete'
|
||||
> &
|
||||
ICloudAPIParam<ConnectContainerResult> & {
|
||||
service: string
|
||||
path?: string
|
||||
}
|
||||
// === end ===
|
||||
|
||||
// === API: services ===
|
||||
type AsyncSession<T> = T | PromiseLike<T>
|
||||
interface GatewayCallOptions {
|
||||
path: string
|
||||
data: any
|
||||
shouldSerialize?: boolean
|
||||
apiVersion?: number
|
||||
}
|
||||
interface GatewayInstance {
|
||||
call: (
|
||||
param: CallContainerParam & GatewayCallOptions
|
||||
) => Promise<CallContainerResult>
|
||||
refresh: (session: AsyncSession<string>) => Promise<void>
|
||||
}
|
||||
interface GatewayConstructOptions {
|
||||
id?: string
|
||||
appid?: string
|
||||
domain?: string
|
||||
keepalive?: boolean
|
||||
prefetch?: boolean
|
||||
prefetchOptions?: {
|
||||
concurrent?: number
|
||||
enableQuic?: boolean
|
||||
enableHttp2?: boolean
|
||||
}
|
||||
}
|
||||
interface CloudServices {
|
||||
Gateway: (opts: GatewayConstructOptions) => GatewayInstance
|
||||
}
|
||||
// === end ===
|
||||
|
||||
// === API: extend ===
|
||||
interface ICloudExtendServices {
|
||||
AI: ICloudAI
|
||||
}
|
||||
interface ICloudAI {
|
||||
createModel: (modelName: string) => ICloudAIModel
|
||||
bot: ICloudBot
|
||||
}
|
||||
interface ICloudAICallbackOptions {
|
||||
onEvent?: (ev: ICloudAIEvent) => void
|
||||
onText?: (text: string) => void
|
||||
onFinish?: (text: string) => void
|
||||
}
|
||||
interface ICloudBot {
|
||||
get: ({ botId: string }: any) => any
|
||||
list: (data: any) => any
|
||||
create: (data: any) => any
|
||||
update: (data: any) => any
|
||||
delete: (data: any) => any
|
||||
getChatRecords: (data: any) => any
|
||||
sendFeedback: (data: any) => any
|
||||
getFeedBack: (data: any) => any
|
||||
getRecommendQuestions: (options: ICloudAICallbackOptions & ICloudBotOptions) => Promise<ICloudAIStreamResult>
|
||||
sendMessage: (options: ICloudAICallbackOptions & ICloudBotOptions) => Promise<ICloudAIStreamResult>
|
||||
}
|
||||
|
||||
interface ICloudBotOptions { data: any, botId: string, timeout?: number }
|
||||
interface ICloudAIModel {
|
||||
streamText: (opts: ICloudAIOptions & ICloudAICallbackOptions) => Promise<ICloudAIStreamResult>
|
||||
generateText: (opts: ICloudAIOptions & ICloudAICallbackOptions) => Promise<string>
|
||||
}
|
||||
interface ICloudAIChatMessage {
|
||||
role: 'user' | 'assistant' | string
|
||||
content: string
|
||||
}
|
||||
interface ICloudAIChatModelInput {
|
||||
model: string
|
||||
messages: ICloudAIChatMessage[]
|
||||
temperature?: number
|
||||
top_p?: number
|
||||
}
|
||||
interface ICloudAIOptions{
|
||||
data: ICloudAIChatModelInput
|
||||
}
|
||||
interface ICloudAIEvent {
|
||||
event: string
|
||||
id: string
|
||||
data: string
|
||||
json?: any
|
||||
}
|
||||
|
||||
interface AsyncIterator<T> {
|
||||
next(value?: any): Promise<IteratorResult<T>>
|
||||
return?(value?: any): Promise<IteratorResult<T>>
|
||||
throw?(e?: any): Promise<IteratorResult<T>>
|
||||
[Symbol.asyncIterator](): AsyncIterableIterator<T>
|
||||
}
|
||||
interface ICloudAIStreamResult {
|
||||
textStream: AsyncIterator<string>
|
||||
eventStream: AsyncIterator<ICloudAIEvent>
|
||||
abort?: () => void
|
||||
}
|
||||
// === end ===
|
||||
|
||||
// === API: uploadFile ===
|
||||
interface UploadFileResult extends IAPISuccessParam {
|
||||
fileID: string
|
||||
@@ -247,6 +406,77 @@ declare namespace DB {
|
||||
collection(collectionName: string): CollectionReference
|
||||
}
|
||||
|
||||
interface Aggregate {
|
||||
/**
|
||||
* @description 聚合阶段。添加新字段到输出的记录。经过 addFields 聚合阶段,输出的所有记录中除了输入时带有的字段外,还将带有 addFields 指定的字段。
|
||||
*/
|
||||
addFields(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。将输入记录根据给定的条件和边界划分成不同的组,每组即一个 bucket。
|
||||
*/
|
||||
bucket(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。将输入记录根据给定的条件划分成不同的组,每组即一个 bucket。与 bucket 的其中一个不同之处在于无需指定 boundaries,bucketAuto 会自动尝试将记录尽可能平均地分散到每组中。
|
||||
*/
|
||||
bucketAuto(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。计算上一聚合阶段输入到本阶段的记录数,输出一个记录,其中指定字段的值为记录数。
|
||||
*/
|
||||
count(fieldName: string): Aggregate
|
||||
/**
|
||||
* @description 标志聚合操作定义完成,发起实际聚合操作。
|
||||
*/
|
||||
end(): Promise<any>
|
||||
/**
|
||||
* @description 聚合阶段。将记录按照离给定点从近到远输出。
|
||||
*/
|
||||
geoNear(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。将输入记录按给定表达式分组,输出时每个记录代表一个分组,每个记录的 _id 是区分不同组的 key。输出记录中也可以包括累计值,将输出字段设为累计值即会从该分组中计算累计值。
|
||||
*/
|
||||
group(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。限制输出到下一阶段的记录数。
|
||||
*/
|
||||
limit(value: number): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。聚合阶段。联表查询。与同个数据库下的一个指定的集合做 left outer join(左外连接)。对该阶段的每一个输入记录,lookup 会在该记录中增加一个数组字段,该数组是被联表中满足匹配条件的记录列表。lookup 会将连接后的结果输出给下个阶段。
|
||||
*/
|
||||
lookup(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。根据条件过滤文档,并且把符合条件的文档传递给下一个流水线阶段。
|
||||
*/
|
||||
match(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。把指定的字段传递给下一个流水线,指定的字段可以是某个已经存在的字段,也可以是计算出来的新字段。
|
||||
*/
|
||||
project(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。指定一个已有字段作为输出的根节点,也可以指定一个计算出的新字段作为根节点。
|
||||
*/
|
||||
replaceRoot(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。随机从文档中选取指定数量的记录。
|
||||
*/
|
||||
sample(size: number): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。指定一个正整数,跳过对应数量的文档,输出剩下的文档。
|
||||
*/
|
||||
skip(value: number): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。根据指定的字段,对输入的文档进行排序。
|
||||
*/
|
||||
sort(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。根据传入的表达式,将传入的集合进行分组(group)。然后计算不同组的数量,并且将这些组按照它们的数量进行排序,返回排序后的结果。
|
||||
*/
|
||||
sortByCount(object: any): Aggregate
|
||||
/**
|
||||
* @description 聚合阶段。使用指定的数组字段中的每个元素,对文档进行拆分。拆分后,文档会从一个变为一个或多个,分别对应数组的每个元素。
|
||||
*/
|
||||
unwind(value: string | object): Aggregate
|
||||
}
|
||||
|
||||
class CollectionReference extends Query {
|
||||
readonly collectionName: string
|
||||
|
||||
@@ -256,6 +486,7 @@ declare namespace DB {
|
||||
|
||||
add(options: OQ<IAddDocumentOptions>): void
|
||||
add(options: RQ<IAddDocumentOptions>): Promise<IAddResult>
|
||||
aggregate(): Aggregate
|
||||
}
|
||||
|
||||
class DocumentReference {
|
||||
|
||||
167
typings/types/wx/lib.wx.component.d.ts
vendored
167
typings/types/wx/lib.wx.component.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -21,38 +21,50 @@ SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace WechatMiniprogram.Component {
|
||||
type FilterUnknownType<T> = {
|
||||
[P in keyof T as string extends P ? never : P]: T[P]
|
||||
}
|
||||
type Instance<
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends Partial<MethodOption>,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = {},
|
||||
TIsPage extends boolean = false
|
||||
> = InstanceProperties &
|
||||
InstanceMethods<TData> &
|
||||
TMethod &
|
||||
MixinMethods<TBehavior> &
|
||||
(TIsPage extends true ? Page.ILifetime : {}) &
|
||||
TCustomInstanceProperty & {
|
||||
Omit<TCustomInstanceProperty, 'properties' | 'methods' | 'data'> & {
|
||||
/** 组件数据,**包括内部数据和属性值** */
|
||||
data: TData & PropertyOptionToData<TProperty>
|
||||
data: FilterUnknownType<TData> & MixinData<TBehavior> &
|
||||
MixinProperties<TBehavior> & PropertyOptionToData<FilterUnknownType<TProperty>>
|
||||
/** 组件数据,**包括内部数据和属性值**(与 `data` 一致) */
|
||||
properties: TData & PropertyOptionToData<TProperty>
|
||||
properties: FilterUnknownType<TData> & MixinData<TBehavior> &
|
||||
MixinProperties<TBehavior> & PropertyOptionToData<FilterUnknownType<TProperty>>
|
||||
}
|
||||
|
||||
type IEmptyArray = []
|
||||
type TrivialInstance = Instance<
|
||||
IAnyObject,
|
||||
IAnyObject,
|
||||
IAnyObject,
|
||||
IEmptyArray,
|
||||
IAnyObject
|
||||
>
|
||||
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IAnyObject>
|
||||
type TrivialOption = Options<IAnyObject, IAnyObject, IAnyObject, IEmptyArray, IAnyObject>
|
||||
type Options<
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends MethodOption,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = {},
|
||||
TIsPage extends boolean = false
|
||||
> = Partial<Data<TData>> &
|
||||
Partial<Property<TProperty>> &
|
||||
Partial<Method<TMethod, TIsPage>> &
|
||||
Partial<Behavior<TBehavior>> &
|
||||
Partial<OtherOption> &
|
||||
Partial<Lifetimes> &
|
||||
ThisType<
|
||||
@@ -60,6 +72,7 @@ declare namespace WechatMiniprogram.Component {
|
||||
TData,
|
||||
TProperty,
|
||||
TMethod,
|
||||
TBehavior,
|
||||
TCustomInstanceProperty,
|
||||
TIsPage
|
||||
>
|
||||
@@ -69,6 +82,7 @@ declare namespace WechatMiniprogram.Component {
|
||||
TData extends DataOption,
|
||||
TProperty extends PropertyOption,
|
||||
TMethod extends MethodOption,
|
||||
TBehavior extends BehaviorOption,
|
||||
TCustomInstanceProperty extends IAnyObject = {},
|
||||
TIsPage extends boolean = false
|
||||
>(
|
||||
@@ -76,6 +90,7 @@ declare namespace WechatMiniprogram.Component {
|
||||
TData,
|
||||
TProperty,
|
||||
TMethod,
|
||||
TBehavior,
|
||||
TCustomInstanceProperty,
|
||||
TIsPage
|
||||
>
|
||||
@@ -85,6 +100,22 @@ declare namespace WechatMiniprogram.Component {
|
||||
type PropertyOption = Record<string, AllProperty>
|
||||
type MethodOption = Record<string, Function>
|
||||
|
||||
type BehaviorOption = Behavior.BehaviorIdentifier[]
|
||||
type ExtractBehaviorType<T> = T extends { BehaviorType?: infer B } ? B : never
|
||||
type ExtractData<T> = T extends { data: infer D } ? D : never
|
||||
type ExtractProperties<T, TIsBehavior extends boolean = false> = T extends { properties: infer P } ?
|
||||
TIsBehavior extends true ? P : PropertyOptionToData<P extends PropertyOption ? P : {}> : never
|
||||
type ExtractMethods<T> = T extends { methods: infer M } ? M : never
|
||||
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never
|
||||
type MixinData<T extends any[]> = UnionToIntersection<ExtractData<ExtractBehaviorType<T[number]>>>
|
||||
type MixinProperties<T extends any[], TIsBehavior extends boolean = false> = UnionToIntersection<ExtractProperties<ExtractBehaviorType<T[number]>, TIsBehavior>>
|
||||
type MixinMethods<T extends any[]> = UnionToIntersection<ExtractMethods<ExtractBehaviorType<T[number]>>>
|
||||
|
||||
interface Behavior<B extends BehaviorOption> {
|
||||
/** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */
|
||||
behaviors?: B
|
||||
}
|
||||
|
||||
interface Data<D extends DataOption> {
|
||||
/** 组件的内部数据,和 `properties` 一同用于组件的模板渲染 */
|
||||
data?: D
|
||||
@@ -151,11 +182,20 @@ declare namespace WechatMiniprogram.Component {
|
||||
type PropertyToData<T extends AllProperty> = T extends ShortProperty
|
||||
? ValueType<T>
|
||||
: FullPropertyToData<Exclude<T, ShortProperty>>
|
||||
type FullPropertyToData<T extends AllFullProperty> = ValueType<T['type']>
|
||||
type ArrayOrObject = ArrayConstructor | ObjectConstructor
|
||||
type FullPropertyToData<T extends AllFullProperty> = T['type'] extends ArrayOrObject ? unknown extends T['value'] ? ValueType<T['type']> : T['value'] : ValueType<T['type']>
|
||||
type PropertyOptionToData<P extends PropertyOption> = {
|
||||
[name in keyof P]: PropertyToData<P[name]>
|
||||
}
|
||||
|
||||
interface Router {
|
||||
switchTab: Wx['switchTab']
|
||||
reLaunch: Wx['reLaunch']
|
||||
redirectTo: Wx['redirectTo']
|
||||
navigateTo: Wx['navigateTo']
|
||||
navigateBack: Wx['navigateBack']
|
||||
}
|
||||
|
||||
interface InstanceProperties {
|
||||
/** 组件的文件路径 */
|
||||
is: string
|
||||
@@ -163,6 +203,14 @@ declare namespace WechatMiniprogram.Component {
|
||||
id: string
|
||||
/** 节点dataset */
|
||||
dataset: Record<string, string>
|
||||
/** 上一次退出前 onSaveExitState 保存的数据 */
|
||||
exitState: any
|
||||
/** 相对于当前自定义组件的 Router 对象 */
|
||||
router: Router
|
||||
/** 相对于当前自定义组件所在页面的 Router 对象 */
|
||||
pageRouter: Router
|
||||
/** 渲染当前组件的渲染后端 */
|
||||
renderer: 'webview' | 'skyline'
|
||||
}
|
||||
|
||||
interface InstanceMethods<D extends DataOption> {
|
||||
@@ -202,6 +250,8 @@ declare namespace WechatMiniprogram.Component {
|
||||
createIntersectionObserver(
|
||||
options: CreateIntersectionObserverOption
|
||||
): IntersectionObserver
|
||||
/** 创建一个 MediaQueryObserver 对象 */
|
||||
createMediaQueryObserver(): MediaQueryObserver
|
||||
/** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 `wx://component-export` 影响) */
|
||||
selectComponent(selector: string): TrivialInstance
|
||||
/** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组 */
|
||||
@@ -270,7 +320,68 @@ declare namespace WechatMiniprogram.Component {
|
||||
options?: ClearAnimationOptions,
|
||||
callback?: () => void
|
||||
): void
|
||||
getOpenerEventChannel(): EventChannel
|
||||
/**
|
||||
* 当从另一页面跳转到该页面时,获得与来源页面实例通信当事件通道,详见 [wx.navigateTo]((wx.navigateTo))
|
||||
*
|
||||
* 最低基础库版本:[`2.7.3`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
getOpenerEventChannel(): EventChannel | EmptyEventChannel
|
||||
/**
|
||||
* 绑定由 worklet 驱动的样式到相应的节点,详见 [worklet 动画](https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/worklet.html)
|
||||
*
|
||||
* 最低基础库版本:[`2.29.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
applyAnimatedStyle(
|
||||
selector: string,
|
||||
updater: () => Record<string, string>,
|
||||
userConfig?: { immediate: boolean, flush: 'sync' | 'async' },
|
||||
callback?: (res: { styleId: number }) => void
|
||||
): void
|
||||
/**
|
||||
* 清除节点上 worklet 驱动样式的绑定关系
|
||||
*
|
||||
* 最低基础库版本:[`2.30.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
clearAnimatedStyle(
|
||||
selector: string,
|
||||
styleIds: number[],
|
||||
callback?: () => void
|
||||
): void
|
||||
/**
|
||||
* 获取更新性能统计信息,详见 [获取更新性能统计信息]((custom-component/update-perf-stat))
|
||||
*
|
||||
*
|
||||
* 最低基础库版本:[`2.12.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
setUpdatePerformanceListener<WithDataPath extends boolean = false>(
|
||||
options: SetUpdatePerformanceListenerOption<WithDataPath>,
|
||||
callback?: UpdatePerformanceListener<WithDataPath>
|
||||
): void
|
||||
|
||||
/**
|
||||
* 在运行时获取页面或组件所在页面 `touch` 相关事件的 passive 配置,详见 [enablePassiveEvent]((configuration/app#enablePassiveEvent))
|
||||
*
|
||||
* 最低基础库版本:[`2.25.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
getPassiveEvent(callback: (config: PassiveConfig) => void): void
|
||||
/**
|
||||
* 在运行时切换页面或组件所在页面 `touch` 相关事件的 passive 配置,详见 [enablePassiveEvent]((configuration/app#enablePassiveEvent))
|
||||
*
|
||||
* 最低基础库版本:[`2.25.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
setPassiveEvent(config: PassiveConfig): void
|
||||
/**
|
||||
* 设置初始渲染缓存的动态数据
|
||||
*
|
||||
* 最低基础库版本:[`2.11.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
setInitialRenderingCache(dynamicData: IAnyObject | null): void
|
||||
/**
|
||||
* 返回当前页面的 appBar 组件实例
|
||||
*
|
||||
* 最低基础库版本:[`3.3.1`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
|
||||
*/
|
||||
getAppBar(): TrivialInstance
|
||||
}
|
||||
|
||||
interface ComponentOptions {
|
||||
@@ -348,6 +459,11 @@ declare namespace WechatMiniprogram.Component {
|
||||
* 所在页面尺寸变化时执行
|
||||
*/
|
||||
resize(size: Page.IResizeOption): void
|
||||
/** 页面生命周期回调—监听页面路由动画完成
|
||||
*
|
||||
* 所在页面路由动画完成时执行
|
||||
*/
|
||||
routeDone(): void
|
||||
}
|
||||
|
||||
type DefinitionFilter = <T extends TrivialOption>(
|
||||
@@ -450,8 +566,6 @@ declare namespace WechatMiniprogram.Component {
|
||||
}
|
||||
|
||||
interface OtherOption {
|
||||
/** 类似于mixins和traits的组件间代码复用机制,参见 [behaviors](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/behaviors.html) */
|
||||
behaviors: Behavior.BehaviorIdentifier[]
|
||||
/**
|
||||
* 组件数据字段监听器,用于监听 properties 和 data 的变化,参见 [数据监听器](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/observer.html)
|
||||
*
|
||||
@@ -623,6 +737,41 @@ declare namespace WechatMiniprogram.Component {
|
||||
/** 起始和结束的滚动范围映射的时间长度,该时间可用于与关键帧动画里的时间 (duration) 相匹配,单位 ms */
|
||||
timeRange: number
|
||||
}
|
||||
|
||||
interface SetUpdatePerformanceListenerOption<WithDataPath> {
|
||||
/** 是否返回变更的 data 字段信息 */
|
||||
withDataPaths?: WithDataPath
|
||||
}
|
||||
interface UpdatePerformanceListener<WithDataPath> {
|
||||
(res: UpdatePerformance<WithDataPath>): void
|
||||
}
|
||||
interface UpdatePerformance<WithDataPath> {
|
||||
/** 此次更新过程的 ID */
|
||||
updateProcessId: number
|
||||
/** 对于子更新,返回它所属的更新过程 ID */
|
||||
parentUpdateProcessId?: number
|
||||
/** 是否是被合并更新,如果是,则 updateProcessId 表示被合并到的更新过程 ID */
|
||||
isMergedUpdate: boolean
|
||||
/** 此次更新的 data 字段信息,只有 withDataPaths 设为 true 时才会返回 */
|
||||
dataPaths: WithDataPath extends true ? string[] : undefined
|
||||
/** 此次更新进入等待队列时的时间戳 */
|
||||
pendingStartTimestamp: number
|
||||
/** 更新运算开始时的时间戳 */
|
||||
updateStartTimestamp: number
|
||||
/** 更新运算结束时的时间戳 */
|
||||
updateEndTimestamp: number
|
||||
}
|
||||
|
||||
type PassiveConfig =
|
||||
| {
|
||||
/** 是否设置 touchmove 事件为 passive,默认为 `false` */
|
||||
touchmove?: boolean
|
||||
/** 是否设置 touchstart 事件为 passive,默认为 `false` */
|
||||
touchstart?: boolean
|
||||
/** 是否设置 wheel 事件为 passive,默认为 `false` */
|
||||
wheel?: boolean
|
||||
}
|
||||
| boolean
|
||||
}
|
||||
/** Component构造器可用于定义组件,调用Component构造器时可以指定组件的属性、数据、方法等。
|
||||
*
|
||||
|
||||
17
typings/types/wx/lib.wx.event.d.ts
vendored
17
typings/types/wx/lib.wx.event.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -419,7 +419,10 @@ declare namespace WechatMiniprogram {
|
||||
* 最低基础库: 1.2.0
|
||||
*/
|
||||
type ButtonGetPhoneNumber = CustomEvent<
|
||||
GeneralCallbackResult & Partial<GetWeRunDataSuccessCallbackResult>
|
||||
GeneralCallbackResult &
|
||||
Partial<GetWeRunDataSuccessCallbackResult> & {
|
||||
code: string
|
||||
}
|
||||
>
|
||||
|
||||
/**
|
||||
@@ -920,18 +923,16 @@ declare namespace WechatMiniprogram {
|
||||
*
|
||||
* 最低基础库: 2.1.0
|
||||
*/
|
||||
type FunctionalNavigatorSuccess<
|
||||
Detail extends IAnyObject = IAnyObject
|
||||
> = CustomEvent<Detail, never, never>
|
||||
type FunctionalNavigatorSuccess<Detail extends IAnyObject = IAnyObject> =
|
||||
CustomEvent<Detail, never, never>
|
||||
|
||||
/**
|
||||
* 功能页返回,且操作失败时触发, detail 格式与具体功能页相关
|
||||
*
|
||||
* 最低基础库: 2.1.0
|
||||
*/
|
||||
type FunctionalNavigatorFail<
|
||||
Detail extends IAnyObject = IAnyObject
|
||||
> = CustomEvent<Detail, never, never>
|
||||
type FunctionalNavigatorFail<Detail extends IAnyObject = IAnyObject> =
|
||||
CustomEvent<Detail, never, never>
|
||||
|
||||
/**
|
||||
* 当 `target="miniProgram"` 时有效,跳转小程序成功
|
||||
|
||||
48
typings/types/wx/lib.wx.page.d.ts
vendored
48
typings/types/wx/lib.wx.page.d.ts
vendored
@@ -1,5 +1,5 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2021 Tencent, Inc. All rights reserved.
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
@@ -32,7 +32,11 @@ declare namespace WechatMiniprogram.Page {
|
||||
type Options<
|
||||
TData extends DataOption,
|
||||
TCustom extends CustomOption
|
||||
> = (TCustom & Partial<Data<TData>> & Partial<ILifetime>) &
|
||||
> = (TCustom &
|
||||
Partial<Data<TData>> &
|
||||
Partial<ILifetime> & {
|
||||
options?: Component.ComponentOptions
|
||||
}) &
|
||||
ThisType<Instance<TData, TCustom>>
|
||||
type TrivialInstance = Instance<IAnyObject, IAnyObject>
|
||||
interface Constructor {
|
||||
@@ -72,6 +76,11 @@ declare namespace WechatMiniprogram.Page {
|
||||
* 页面卸载时触发。如`redirectTo`或`navigateBack`到其他页面时。
|
||||
*/
|
||||
onUnload(): void | Promise<void>
|
||||
/** 生命周期回调—监听路由动画完成
|
||||
*
|
||||
* 路由动画完成时触发。如 wx.navigateTo 页面完全推入后 或 wx.navigateBack 页面完全恢复时。
|
||||
*/
|
||||
onRouteDone(): void | Promise<void>
|
||||
/** 监听用户下拉动作
|
||||
*
|
||||
* 监听用户下拉刷新事件。
|
||||
@@ -98,7 +107,12 @@ declare namespace WechatMiniprogram.Page {
|
||||
onShareAppMessage(
|
||||
/** 分享发起来源参数 */
|
||||
options: IShareAppMessageOption
|
||||
): ICustomShareContent | void
|
||||
):
|
||||
| ICustomShareContent
|
||||
| IAsyncCustomShareContent
|
||||
| Promise<ICustomShareContent>
|
||||
| void
|
||||
| Promise<void>
|
||||
/**
|
||||
* 监听右上角菜单“分享到朋友圈”按钮的行为,并自定义分享内容
|
||||
*
|
||||
@@ -134,6 +148,9 @@ declare namespace WechatMiniprogram.Page {
|
||||
* 基础库 2.10.3,安卓 7.0.15 版本起支持,iOS 暂不支持
|
||||
*/
|
||||
onAddToFavorites(options: IAddToFavoritesOption): IAddToFavoritesContent
|
||||
|
||||
/** 每当小程序可能被销毁之前会被调用,可以进行退出状态的保存。最低基础库: `2.7.4` */
|
||||
onSaveExitState(): ISaveExitState
|
||||
}
|
||||
interface InstanceProperties {
|
||||
/** 页面的文件路径 */
|
||||
@@ -144,6 +161,18 @@ declare namespace WechatMiniprogram.Page {
|
||||
|
||||
/** 打开当前页面路径中的参数 */
|
||||
options: Record<string, string | undefined>
|
||||
|
||||
/** 上一次退出前 onSaveExitState 保存的数据 */
|
||||
exitState: any
|
||||
|
||||
/** 相对于当前页面的 Router 对象 */
|
||||
router: Component.Router
|
||||
|
||||
/** 相对于当前页面的 Router 对象 */
|
||||
pageRouter: Component.Router
|
||||
|
||||
/** 渲染当前页面的渲染后端 */
|
||||
renderer: 'webview' | 'skyline'
|
||||
}
|
||||
|
||||
type DataOption = Record<string, any>
|
||||
@@ -172,6 +201,10 @@ declare namespace WechatMiniprogram.Page {
|
||||
imageUrl?: string
|
||||
}
|
||||
|
||||
interface IAsyncCustomShareContent extends ICustomShareContent {
|
||||
promise: Promise<ICustomShareContent>
|
||||
}
|
||||
|
||||
interface ICustomTimelineContent {
|
||||
/** 自定义标题,即朋友圈列表页上显示的标题。默认值:当前小程序名称 */
|
||||
title?: string
|
||||
@@ -195,7 +228,7 @@ declare namespace WechatMiniprogram.Page {
|
||||
*
|
||||
* 最低基础库: `1.2.4`
|
||||
*/
|
||||
from: 'button' | 'menu' | string
|
||||
from: 'button' | 'menu'
|
||||
/** 如果 `from` 值是 `button`,则 `target` 是触发这次转发事件的 `button`,否则为 `undefined`
|
||||
*
|
||||
* 最低基础库: `1.2.4` */
|
||||
@@ -239,6 +272,13 @@ declare namespace WechatMiniprogram.Page {
|
||||
query?: string
|
||||
}
|
||||
|
||||
interface ISaveExitState {
|
||||
/** 需要保存的数据(只能是 JSON 兼容的数据) */
|
||||
data: any
|
||||
/** 超时时刻,在这个时刻后,保存的数据保证一定被丢弃,默认为 (当前时刻 + 1 天) */
|
||||
expireTimeStamp?: number
|
||||
}
|
||||
|
||||
interface GetCurrentPages {
|
||||
(): Array<Instance<IAnyObject, IAnyObject>>
|
||||
}
|
||||
|
||||
409
typings/types/wx/lib.wx.phys3D.d.ts
vendored
Normal file
409
typings/types/wx/lib.wx.phys3D.d.ts
vendored
Normal file
@@ -0,0 +1,409 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
declare namespace phys3D {
|
||||
// pvd调试配置
|
||||
export interface PhysicsDebugConfig {
|
||||
isNetwork: boolean // 采用网络的方式
|
||||
ip?: string // 如果isNetwork为true,调试信息会通过tcp转发的方式转发到打开了pvd调试软件的电脑,需要注意的是,防火墙要对pvd打开
|
||||
port?: 5425 // pvd默认接口
|
||||
timeout?: 1000 // 默认耗时
|
||||
path?: string // 如果isNetwork为false,调试信息会通过写本地文件的方式落地,文件名建议为xxx.pxd2,导入pvd调试即可
|
||||
}
|
||||
|
||||
export enum QueryTriggerInteraction {
|
||||
UseGlobal = 0,
|
||||
Ignore = 1,
|
||||
Collide = 2
|
||||
}
|
||||
|
||||
export class PhysSystem {
|
||||
constructor(config?: PhysicsDebugConfig)
|
||||
gravity: RawVec3f
|
||||
bounceThreshold: number
|
||||
defaultMaxAngularSpeed: number
|
||||
defaultSolverIterations: number
|
||||
defaultSolverVelocityIterations: number
|
||||
sleepThreshold: number
|
||||
defaultContactOffset: number
|
||||
destroyScene: () => void
|
||||
createScene: () => number
|
||||
Simulate: (step: number) => void
|
||||
SyncFromTransforms: (() => void) | undefined // added in 2021.06
|
||||
SetCollisionMask: (mask: ArrayBuffer) => void
|
||||
Raycast: (
|
||||
origin: RawVec3f,
|
||||
unitDir: RawVec3f,
|
||||
distance: number,
|
||||
hit: RaycastHit,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => boolean
|
||||
RaycastAll: (
|
||||
origin: RawVec3f,
|
||||
unitDir: RawVec3f,
|
||||
distance: number,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => RaycastHit[]
|
||||
CapsuleCast(
|
||||
p1: RawVec3f,
|
||||
p2: RawVec3f,
|
||||
radius: number,
|
||||
direction: RawVec3f,
|
||||
hit: RaycastHit,
|
||||
maxDistance: number,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
): void
|
||||
CapsuleCastAll: (
|
||||
p1: RawVec3f,
|
||||
p2: RawVec3f,
|
||||
radius: number,
|
||||
direction: RawVec3f,
|
||||
maxDistance: number,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => RaycastHit[]
|
||||
BoxCast(
|
||||
center: RawVec3f,
|
||||
halfExt: RawVec3f,
|
||||
direction: RawVec3f,
|
||||
hit: RaycastHit,
|
||||
orientation: RawQuaternion,
|
||||
maxDistance: number,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
): void
|
||||
BoxCastAll: (
|
||||
center: RawVec3f,
|
||||
halfExt: RawVec3f,
|
||||
direction: RawVec3f,
|
||||
orientation: RawQuaternion,
|
||||
maxDistance: number,
|
||||
layerMask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => RaycastHit[]
|
||||
OverlapBox: (
|
||||
center: RawVec3f,
|
||||
halfExt: RawVec3f,
|
||||
orientation: RawQuaternion,
|
||||
layermask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => Collider[]
|
||||
OverlapCapsule: (
|
||||
p1: RawVec3f,
|
||||
p2: RawVec3f,
|
||||
radius: number,
|
||||
layermask?: number,
|
||||
queryTriggerInteraction?: QueryTriggerInteraction
|
||||
) => Collider[]
|
||||
}
|
||||
|
||||
export class Rigidbody {
|
||||
constructor(system: PhysSystem)
|
||||
enabled?: boolean // since 2021.06
|
||||
position: RawVec3f
|
||||
rotation: RawQuaternion
|
||||
AttachToEntity: (pollObj: any, id: number) => void
|
||||
Remove(): void
|
||||
Detach(): void
|
||||
IsAttached(): boolean
|
||||
}
|
||||
|
||||
export enum CollisionDetectionMode {
|
||||
Discrete = 0,
|
||||
Continuous = 1,
|
||||
ContinuousDynamic = 2,
|
||||
ContinuousSpeculative = 3
|
||||
}
|
||||
|
||||
export enum RigidbodyConstraints {
|
||||
None = 0,
|
||||
FreezePositionX = 1 << 0,
|
||||
FreezePositionY = 1 << 1,
|
||||
FreezePositionZ = 1 << 2,
|
||||
FreezeRotationX = 1 << 3,
|
||||
FreezeRotationY = 1 << 4,
|
||||
FreezeRotationZ = 1 << 5,
|
||||
FreezePosition = FreezePositionX | FreezePositionY | FreezePositionZ,
|
||||
FreezeRotation = FreezeRotationX | FreezeRotationY | FreezeRotationZ,
|
||||
FreezeAll = FreezePosition | FreezeRotation
|
||||
}
|
||||
|
||||
export enum ForceMode {
|
||||
kForceModeForce = 0,
|
||||
kForceModeImpulse = 1 << 0,
|
||||
kForceModeVelocityChange = 1 << 1,
|
||||
kForceModeAcceleration = 1 << 2
|
||||
}
|
||||
|
||||
export enum CombineMode {
|
||||
eAverage = 0,
|
||||
eMin,
|
||||
eMultiply,
|
||||
eMax
|
||||
}
|
||||
|
||||
export enum CookingFlag {
|
||||
None = 0,
|
||||
CookForFasterSimulation = 1 << 0,
|
||||
EnableMeshCleaning = 1 << 1,
|
||||
WeldColocatedVertices = 1 << 2
|
||||
}
|
||||
|
||||
export enum CollisionFlags {
|
||||
None = 0,
|
||||
Sides = 1 << 0,
|
||||
Above = 1 << 1,
|
||||
Below = 1 << 2
|
||||
}
|
||||
|
||||
export class RawVec3f {
|
||||
constructor()
|
||||
constructor(x: number, y: number, z: number)
|
||||
x: number
|
||||
y: number
|
||||
z: number
|
||||
}
|
||||
|
||||
export class RawQuaternion {
|
||||
constructor()
|
||||
constructor(x: number, y: number, z: number, w: number)
|
||||
x: number
|
||||
y: number
|
||||
z: number
|
||||
w: number
|
||||
}
|
||||
|
||||
export class Collider {
|
||||
attachedRigidbody: Rigidbody
|
||||
bounds: Bounds
|
||||
name: string
|
||||
contactOffset: number
|
||||
enabled: boolean
|
||||
isTrigger: boolean
|
||||
scale: RawVec3f
|
||||
material?: Material
|
||||
sharedMateiral?: Material
|
||||
ClosestPoint: (raw: RawVec3f) => RawVec3f
|
||||
ClosestPointOnBounds: (raw: RawVec3f) => RawVec3f
|
||||
|
||||
onCollisionEnter?: (collision: Collision) => void
|
||||
onCollisionExit?: (collision: Collision) => void
|
||||
onCollisionStay?: (collision: Collision) => void
|
||||
onTriggerEnter?: (collision: Collision) => void
|
||||
onTriggerExit?: (collision: Collision) => void
|
||||
onTriggerStay?: (collision: Collision) => void
|
||||
|
||||
dettachRigidbody?: () => void
|
||||
|
||||
userData?: unknown
|
||||
layer: number
|
||||
}
|
||||
|
||||
export class BoxCollider extends Collider {
|
||||
constructor(system: PhysSystem, center: RawVec3f, size: RawVec3f)
|
||||
center: RawVec3f
|
||||
size: RawVec3f
|
||||
}
|
||||
|
||||
export class SphereCollider extends Collider {
|
||||
constructor(system: PhysSystem, center: RawVec3f, radius: number)
|
||||
center: RawVec3f
|
||||
radius: number
|
||||
}
|
||||
|
||||
export class CapsuleCollider extends Collider {
|
||||
constructor(
|
||||
system: PhysSystem,
|
||||
center: RawVec3f,
|
||||
height: number,
|
||||
radius: number
|
||||
)
|
||||
center: RawVec3f
|
||||
height: number
|
||||
radius: number
|
||||
}
|
||||
|
||||
export class MeshCollider extends Collider {
|
||||
constructor(
|
||||
system: PhysSystem,
|
||||
convex: boolean,
|
||||
cookingOptions: number,
|
||||
sharedMesh: PhysMesh
|
||||
)
|
||||
cookingOptions: number
|
||||
sharedMesh: PhysMesh | null
|
||||
convex: boolean
|
||||
}
|
||||
|
||||
export class CharacterController extends Collider {
|
||||
constructor(system: PhysSystem)
|
||||
position: RawVec3f
|
||||
center: RawVec3f
|
||||
collisionFlags: CollisionFlags
|
||||
detectCollisions: boolean
|
||||
enableOverlapRecovery: boolean
|
||||
height: number
|
||||
isGrounded: boolean
|
||||
minMoveDistance: number
|
||||
radius: number
|
||||
skinWidth: number
|
||||
slopeLimit: number
|
||||
stepOffset: number
|
||||
velocity: RawVec3f
|
||||
|
||||
Move: (movement: RawVec3f) => CollisionFlags
|
||||
SimpleMove: (speed: RawVec3f) => boolean
|
||||
AttachToEntity: (pollObj: any, id: number) => void
|
||||
|
||||
OnControllerColliderHit?: (hit: ControllerColliderHit) => void
|
||||
}
|
||||
|
||||
export interface ContactPoint {
|
||||
normal: RawVec3f
|
||||
this_collider: Collider
|
||||
other_collider: Collider
|
||||
point: RawVec3f
|
||||
separation: number
|
||||
}
|
||||
|
||||
export interface Collision {
|
||||
collider: Collider
|
||||
contacts: ContactPoint[]
|
||||
impulse: RawVec3f
|
||||
relative_velocity: RawVec3f
|
||||
}
|
||||
|
||||
export interface ControllerColliderHit {
|
||||
collider: Collider
|
||||
controller: CharacterController
|
||||
moveDirection: RawVec3f
|
||||
normal: RawVec3f
|
||||
moveLength: number
|
||||
point: RawVec3f
|
||||
}
|
||||
|
||||
export class Bounds {
|
||||
constructor(center: RawVec3f, size: RawVec3f)
|
||||
|
||||
center: RawVec3f
|
||||
extents: RawVec3f
|
||||
max: RawVec3f
|
||||
min: RawVec3f
|
||||
size: RawVec3f
|
||||
|
||||
ClosestPoint: (point: RawVec3f) => RawVec3f
|
||||
Contains: (point: RawVec3f) => boolean
|
||||
Expand: (amount: number) => void
|
||||
Intersects: (bounds: Bounds) => boolean
|
||||
SetMinMax: (min: RawVec3f, max: RawVec3f) => void
|
||||
SqrDistance: (point: RawVec3f) => number
|
||||
}
|
||||
|
||||
export class Material {
|
||||
constructor(system: PhysSystem)
|
||||
dynamicFriction: number
|
||||
staticFriction: number
|
||||
bounciness: number
|
||||
frictionCombine: CombineMode
|
||||
bounceCombine: CombineMode
|
||||
id: number
|
||||
}
|
||||
|
||||
export class DynamicRigidbody extends Rigidbody {
|
||||
mass: number
|
||||
angularDamping: number
|
||||
angularVelocity: RawVec3f
|
||||
centerOfMass: RawVec3f
|
||||
collisionDetectionMode: CollisionDetectionMode
|
||||
constraints: number
|
||||
detectCollisions: boolean
|
||||
linearDamping: number
|
||||
freezeRotation: boolean
|
||||
inertiaTensor: number
|
||||
// inertiaTensorRotation
|
||||
// interpolation
|
||||
isKinematic: boolean
|
||||
maxAngularVelocity: number
|
||||
maxDepenetrationVelocity: number
|
||||
sleepThreshold: number
|
||||
solverIterations: number
|
||||
solverVelocityIterations: number
|
||||
useGravity: boolean
|
||||
velocity: RawVec3f
|
||||
userData?: unknown
|
||||
|
||||
GetWorldCenterOfMass: () => RawVec3f
|
||||
AddForce: (force: RawVec3f, mode: ForceMode) => void
|
||||
AddTorque: (torque: RawVec3f, mode: ForceMode) => void
|
||||
IsSleeping: () => boolean
|
||||
Sleep: () => void
|
||||
WakeUp: () => void
|
||||
AddExplosionForce: (
|
||||
explosionForce: number,
|
||||
explosionPosition: RawVec3f,
|
||||
explosionRadius: number,
|
||||
upwardsModifier: number,
|
||||
mode: ForceMode
|
||||
) => void
|
||||
AddForceAtPosition: (
|
||||
force: RawVec3f,
|
||||
position: RawVec3f,
|
||||
mode: ForceMode
|
||||
) => void
|
||||
AddRelativeForce: (force: RawVec3f, mode: ForceMode) => void
|
||||
AddRelativeTorque: (torque: RawVec3f, mode: ForceMode) => void
|
||||
ClosestPointOnBounds: (position: RawVec3f) => RawVec3f
|
||||
GetPointVelocity: (worldPoint: RawVec3f) => RawVec3f
|
||||
GetRelativePointVelocity: (relativePoint: RawVec3f) => RawVec3f
|
||||
MovePosition: (position: RawVec3f) => void
|
||||
MoveRotation: (rotation: RawQuaternion) => void
|
||||
ResetCenterOfMass: () => void
|
||||
ResetInertiaTensor: () => void
|
||||
SetDensity: (density: number) => void
|
||||
// SweepTest: () => void;
|
||||
// SweepTestAll: () => void;
|
||||
}
|
||||
|
||||
export class PhysMesh {
|
||||
constructor(system: PhysSystem)
|
||||
// set vertices
|
||||
SetVertices: (buffer: Float32Array, count: number) => void
|
||||
// set indices
|
||||
SetTriangles: (
|
||||
buffer: Uint16Array | Uint32Array,
|
||||
count: number,
|
||||
useUint16: boolean
|
||||
) => void
|
||||
}
|
||||
|
||||
export class RaycastHit {
|
||||
constructor()
|
||||
collider: Collider
|
||||
distance: number
|
||||
normal: RawVec3f
|
||||
point: RawVec3f
|
||||
rigidbody: Rigidbody
|
||||
}
|
||||
}
|
||||
152
typings/types/wx/lib.wx.wasm.d.ts
vendored
Normal file
152
typings/types/wx/lib.wx.wasm.d.ts
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) 2025 Tencent, Inc. All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
||||
of the Software, and to permit persons to whom the Software is furnished to do
|
||||
so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
***************************************************************************** */
|
||||
|
||||
/** [WXWebAssembly](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/wasm.html)
|
||||
*
|
||||
* WXWebAssembly */
|
||||
declare namespace WXWebAssembly {
|
||||
type BufferSource = ArrayBufferView | ArrayBuffer
|
||||
|
||||
type CompileError = Error
|
||||
|
||||
const CompileError: {
|
||||
prototype: CompileError
|
||||
new (message?: string): CompileError
|
||||
(message?: string): CompileError
|
||||
}
|
||||
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance) */
|
||||
interface Instance {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Instance/exports) */
|
||||
readonly exports: Exports
|
||||
}
|
||||
|
||||
const Instance: {
|
||||
prototype: Instance
|
||||
new (module: Module, importObject?: Imports): Instance
|
||||
}
|
||||
|
||||
type LinkError = Error
|
||||
|
||||
const LinkError: {
|
||||
prototype: LinkError
|
||||
new (message?: string): LinkError
|
||||
(message?: string): LinkError
|
||||
}
|
||||
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory) */
|
||||
interface Memory {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory/buffer) */
|
||||
readonly buffer: ArrayBuffer
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Memory/grow) */
|
||||
grow(delta: number): number
|
||||
}
|
||||
|
||||
const Memory: {
|
||||
prototype: Memory
|
||||
new (descriptor: MemoryDescriptor): Memory
|
||||
}
|
||||
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module) */
|
||||
interface Module {}
|
||||
|
||||
const Module: {
|
||||
prototype: Module
|
||||
new (bytes: BufferSource): Module
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/customSections) */
|
||||
customSections(moduleObject: Module, sectionName: string): ArrayBuffer[]
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/exports) */
|
||||
exports(moduleObject: Module): ModuleExportDescriptor[]
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Module/imports) */
|
||||
imports(moduleObject: Module): ModuleImportDescriptor[]
|
||||
}
|
||||
|
||||
interface RuntimeError extends Error {}
|
||||
|
||||
const RuntimeError: {
|
||||
prototype: RuntimeError
|
||||
new (message?: string): RuntimeError
|
||||
(message?: string): RuntimeError
|
||||
}
|
||||
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table) */
|
||||
interface Table {
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/length) */
|
||||
readonly length: number
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/get) */
|
||||
get(index: number): any
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/grow) */
|
||||
grow(delta: number, value?: any): number
|
||||
/** [MDN Reference](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/Table/set) */
|
||||
set(index: number, value?: any): void
|
||||
}
|
||||
|
||||
const Table: {
|
||||
prototype: Table
|
||||
new (descriptor: TableDescriptor, value?: any): Table
|
||||
}
|
||||
|
||||
interface MemoryDescriptor {
|
||||
initial: number
|
||||
maximum?: number
|
||||
shared?: boolean
|
||||
}
|
||||
|
||||
interface ModuleExportDescriptor {
|
||||
kind: ImportExportKind
|
||||
name: string
|
||||
}
|
||||
|
||||
interface ModuleImportDescriptor {
|
||||
kind: ImportExportKind
|
||||
module: string
|
||||
name: string
|
||||
}
|
||||
|
||||
interface TableDescriptor {
|
||||
element: TableKind
|
||||
initial: number
|
||||
maximum?: number
|
||||
}
|
||||
|
||||
type ImportExportKind = 'function' | 'global' | 'memory' | 'table'
|
||||
type TableKind = 'anyfunc' | 'externref'
|
||||
type ValueType =
|
||||
| 'anyfunc'
|
||||
| 'externref'
|
||||
| 'f32'
|
||||
| 'f64'
|
||||
| 'i32'
|
||||
| 'i64'
|
||||
| 'v128'
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
type ExportValue = Function | Memory | Table
|
||||
type Exports = Record<string, ExportValue>
|
||||
type ImportValue = ExportValue | number
|
||||
type Imports = Record<string, ModuleImports>
|
||||
type ModuleImports = Record<string, ImportValue>
|
||||
/** [WXWebAssembly](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/wasm.html) */
|
||||
function instantiate(
|
||||
path: string,
|
||||
importObject?: Imports
|
||||
): Promise<Instance>
|
||||
}
|
||||
16375
typings/types/wx/lib.wx.xr-frame.d.ts
vendored
Normal file
16375
typings/types/wx/lib.wx.xr-frame.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user