@spcsn/taro 0.1.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/README.md +12 -0
- package/dist/index.js +147 -0
- package/dist/index.js.map +1 -0
- package/index.js +9 -0
- package/package.json +86 -0
- package/types/api/ad/index.d.ts +197 -0
- package/types/api/ai/face.d.ts +133 -0
- package/types/api/ai/inference.d.ts +129 -0
- package/types/api/ai/visionkit.d.ts +874 -0
- package/types/api/alipay/index.d.ts +69 -0
- package/types/api/base/crypto.d.ts +104 -0
- package/types/api/base/debug.d.ts +329 -0
- package/types/api/base/env.d.ts +19 -0
- package/types/api/base/index.d.ts +102 -0
- package/types/api/base/performance.d.ts +258 -0
- package/types/api/base/system.d.ts +742 -0
- package/types/api/base/update.d.ts +130 -0
- package/types/api/base/weapp/app-event.d.ts +265 -0
- package/types/api/base/weapp/life-cycle.d.ts +155 -0
- package/types/api/canvas/index.d.ts +2162 -0
- package/types/api/cloud/index.d.ts +2622 -0
- package/types/api/data-analysis/index.d.ts +122 -0
- package/types/api/device/accelerometer.d.ts +102 -0
- package/types/api/device/accessibility.d.ts +26 -0
- package/types/api/device/battery.d.ts +46 -0
- package/types/api/device/bluetooth-ble.d.ts +601 -0
- package/types/api/device/bluetooth-peripheral.d.ts +430 -0
- package/types/api/device/bluetooth.d.ts +463 -0
- package/types/api/device/calendar.d.ts +98 -0
- package/types/api/device/clipboard.d.ts +81 -0
- package/types/api/device/compass.d.ts +105 -0
- package/types/api/device/contact.d.ts +110 -0
- package/types/api/device/gyroscope.d.ts +85 -0
- package/types/api/device/iBeacon.d.ts +168 -0
- package/types/api/device/keyboard.d.ts +97 -0
- package/types/api/device/memory.d.ts +52 -0
- package/types/api/device/motion.d.ts +88 -0
- package/types/api/device/network.d.ts +172 -0
- package/types/api/device/nfc.d.ts +1238 -0
- package/types/api/device/phone.d.ts +30 -0
- package/types/api/device/scan.d.ts +111 -0
- package/types/api/device/screen.d.ts +217 -0
- package/types/api/device/sms.d.ts +26 -0
- package/types/api/device/vibrate.d.ts +51 -0
- package/types/api/device/wifi.d.ts +301 -0
- package/types/api/ext/index.d.ts +64 -0
- package/types/api/files/index.d.ts +1472 -0
- package/types/api/framework/index.d.ts +51 -0
- package/types/api/location/index.d.ts +517 -0
- package/types/api/media/audio.d.ts +1013 -0
- package/types/api/media/background-audio.d.ts +291 -0
- package/types/api/media/camera.d.ts +207 -0
- package/types/api/media/editor.d.ts +239 -0
- package/types/api/media/image.d.ts +469 -0
- package/types/api/media/live.d.ts +461 -0
- package/types/api/media/map.d.ts +638 -0
- package/types/api/media/media-recorder.d.ts +117 -0
- package/types/api/media/recorder.d.ts +317 -0
- package/types/api/media/video-decoder.d.ts +117 -0
- package/types/api/media/video-processing.d.ts +84 -0
- package/types/api/media/video.d.ts +527 -0
- package/types/api/media/voip.d.ts +393 -0
- package/types/api/navigate/index.d.ts +327 -0
- package/types/api/network/download.d.ts +173 -0
- package/types/api/network/mdns.d.ts +191 -0
- package/types/api/network/request.d.ts +480 -0
- package/types/api/network/tcp.d.ts +181 -0
- package/types/api/network/udp.d.ts +218 -0
- package/types/api/network/upload.d.ts +201 -0
- package/types/api/network/websocket.d.ts +383 -0
- package/types/api/open-api/account.d.ts +51 -0
- package/types/api/open-api/address.d.ts +68 -0
- package/types/api/open-api/authorize.d.ts +80 -0
- package/types/api/open-api/card.d.ts +110 -0
- package/types/api/open-api/channels.d.ts +225 -0
- package/types/api/open-api/customer-service.d.ts +45 -0
- package/types/api/open-api/device-voip.d.ts +103 -0
- package/types/api/open-api/facial.d.ts +98 -0
- package/types/api/open-api/favorites.d.ts +101 -0
- package/types/api/open-api/group.d.ts +59 -0
- package/types/api/open-api/invoice.d.ts +87 -0
- package/types/api/open-api/license-plate.d.ts +27 -0
- package/types/api/open-api/login.d.ts +115 -0
- package/types/api/open-api/my-miniprogram.d.ts +28 -0
- package/types/api/open-api/privacy.d.ts +107 -0
- package/types/api/open-api/redpackage.d.ts +24 -0
- package/types/api/open-api/settings.d.ts +174 -0
- package/types/api/open-api/soter.d.ts +184 -0
- package/types/api/open-api/sticker.d.ts +83 -0
- package/types/api/open-api/subscribe-message.d.ts +305 -0
- package/types/api/open-api/user-info.d.ts +182 -0
- package/types/api/open-api/werun.d.ts +101 -0
- package/types/api/payment/index.d.ts +119 -0
- package/types/api/qq/index.d.ts +354 -0
- package/types/api/route/index.d.ts +324 -0
- package/types/api/share/index.d.ts +354 -0
- package/types/api/skyline/index.d.ts +345 -0
- package/types/api/storage/background-fetch.d.ts +131 -0
- package/types/api/storage/cache-manager.d.ts +249 -0
- package/types/api/storage/index.d.ts +405 -0
- package/types/api/swan/bookshelf.d.ts +307 -0
- package/types/api/swan/download-package.d.ts +80 -0
- package/types/api/swan/index.d.ts +251 -0
- package/types/api/swan/pay.d.ts +139 -0
- package/types/api/taro.extend.d.ts +233 -0
- package/types/api/taro.hooks.d.ts +148 -0
- package/types/api/ui/animation.d.ts +427 -0
- package/types/api/ui/background.d.ts +69 -0
- package/types/api/ui/custom-component.d.ts +23 -0
- package/types/api/ui/fonts.d.ts +77 -0
- package/types/api/ui/interaction.d.ts +281 -0
- package/types/api/ui/menu.d.ts +29 -0
- package/types/api/ui/navigation-bar.d.ts +130 -0
- package/types/api/ui/pull-down-refresh.d.ts +50 -0
- package/types/api/ui/scroll.d.ts +114 -0
- package/types/api/ui/sticky.d.ts +32 -0
- package/types/api/ui/tab-bar.d.ts +196 -0
- package/types/api/ui/window.d.ts +71 -0
- package/types/api/worker/index.d.ts +83 -0
- package/types/api/wxml/index.d.ts +540 -0
- package/types/compile/compiler.d.ts +32 -0
- package/types/compile/config/h5.d.ts +134 -0
- package/types/compile/config/harmony.d.ts +118 -0
- package/types/compile/config/index.d.ts +8 -0
- package/types/compile/config/manifest.d.ts +155 -0
- package/types/compile/config/mini.d.ts +118 -0
- package/types/compile/config/plugin.d.ts +34 -0
- package/types/compile/config/project.d.ts +338 -0
- package/types/compile/config/rn.d.ts +85 -0
- package/types/compile/config/util.d.ts +179 -0
- package/types/compile/hooks.d.ts +13 -0
- package/types/compile/index.d.ts +11 -0
- package/types/compile/viteCompilerContext.d.ts +167 -0
- package/types/global.d.ts +428 -0
- package/types/index.d.ts +190 -0
- package/types/taro.api.d.ts +130 -0
- package/types/taro.component.d.ts +168 -0
- package/types/taro.config.d.ts +712 -0
- package/types/taro.lifecycle.d.ts +220 -0
- package/types/taro.runtime.d.ts +9 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import Taro from '../../index'
|
|
2
|
+
|
|
3
|
+
declare module '../../index' {
|
|
4
|
+
namespace getInferenceEnvInfo {
|
|
5
|
+
interface Option {
|
|
6
|
+
/** 接口调用结束的回调函数(调用成功、失败都会执行) */
|
|
7
|
+
complete?: (res: TaroGeneral.CallbackResult) => void
|
|
8
|
+
/** 接口调用失败的回调函数 */
|
|
9
|
+
fail?: (res: TaroGeneral.CallbackResult) => void
|
|
10
|
+
/** 接口调用成功的回调函数 */
|
|
11
|
+
success?: (result: SuccessCallbackResult) => void
|
|
12
|
+
}
|
|
13
|
+
interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
|
|
14
|
+
/** AI推理引擎版本*/
|
|
15
|
+
ver: string
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
namespace createInferenceSession {
|
|
20
|
+
interface Option {
|
|
21
|
+
/** 模型文件路径,目前只执行后缀为.onnx格式(支持代码包路径,和本地文件系统路径) */
|
|
22
|
+
model: string
|
|
23
|
+
/** 推理精度,有效值为 0 - 4。
|
|
24
|
+
* 一般来说,使用的precesionLevel等级越低,推理速度越快,但可能会损失精度。
|
|
25
|
+
* 推荐开发者在开发时,在效果满足需求时优先使用更低精度以提高推理速度,节约能耗。
|
|
26
|
+
*/
|
|
27
|
+
precesionLevel?: PrecesionLevel
|
|
28
|
+
/** 是否生成量化模型推理 */
|
|
29
|
+
allowQuantize?: boolean
|
|
30
|
+
/** 是否使用NPU推理,仅对IOS有效 */
|
|
31
|
+
allowNPU?: boolean
|
|
32
|
+
/** 输入典型分辨率 */
|
|
33
|
+
typicalShape?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
interface PrecesionLevel {
|
|
37
|
+
/** 使用fp16 存储浮点,fp16计算,Winograd 算法也采取fp16 计算,开启近似math计算 */
|
|
38
|
+
0
|
|
39
|
+
/** 使用fp16 存储浮点,fp16计算,禁用 Winograd 算法,开启近似math计算 */
|
|
40
|
+
1
|
|
41
|
+
/** 使用fp16 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
|
|
42
|
+
2
|
|
43
|
+
/** 使用fp32 存储浮点,fp32计算,开启 Winograd,开启近似math计算 */
|
|
44
|
+
3
|
|
45
|
+
/** 使用fp32 存储浮点,fp32计算,开启 Winograd,关闭近似math计算 */
|
|
46
|
+
4
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
interface InferenceSession {
|
|
51
|
+
/** 销毁 InferenceSession 实例
|
|
52
|
+
* @supported weapp
|
|
53
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
|
|
54
|
+
*/
|
|
55
|
+
destroy(): void
|
|
56
|
+
/** 取消监听模型加载失败事件. 传入指定回调函数则只取消指定回调,不传则取消所有回调
|
|
57
|
+
* @supported weapp
|
|
58
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offError.html
|
|
59
|
+
*/
|
|
60
|
+
offError(callback?: InferenceSession.OnErrorCallback): void
|
|
61
|
+
/** 取消监听模型加载完成事件
|
|
62
|
+
* @supported weapp
|
|
63
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.offLoad.html
|
|
64
|
+
*/
|
|
65
|
+
offLoad(callback?: InferenceSession.OnLoadCallback): void
|
|
66
|
+
/** 监听模型加载失败事件
|
|
67
|
+
* @supported weapp
|
|
68
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onError.html
|
|
69
|
+
*/
|
|
70
|
+
onError(callback: InferenceSession.OnErrorCallback): void
|
|
71
|
+
/** 监听模型加载完成事件
|
|
72
|
+
* @supported weapp
|
|
73
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.onLoad.html
|
|
74
|
+
*/
|
|
75
|
+
onLoad(callback: InferenceSession.OnLoadCallback): void
|
|
76
|
+
/** 运行推断
|
|
77
|
+
* 需要在 session.onLoad 回调后使用。接口参数为 Tensors 对象,返回 Promise。
|
|
78
|
+
* 一个 InferenceSession 被创建完成后可以重复多次调用 InferenceSession.run(), 直到调用 session.destroy() 进行销毁。
|
|
79
|
+
* @supported weapp
|
|
80
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/InferenceSession.destroy.html
|
|
81
|
+
*/
|
|
82
|
+
run(option: InferenceSession.Tensors): Promise<InferenceSession.Tensors>
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
namespace InferenceSession {
|
|
86
|
+
interface Type {
|
|
87
|
+
'uint8'
|
|
88
|
+
'int8'
|
|
89
|
+
'uint32'
|
|
90
|
+
'int32'
|
|
91
|
+
'float32'
|
|
92
|
+
}
|
|
93
|
+
interface Tensor {
|
|
94
|
+
/** Tensor shape (Tensor 形状,例如 [1, 3, 224, 224] 即表示一个4唯Tensor,每个维度的长度分别为1, 3, 224, 224) */
|
|
95
|
+
shape: number[]
|
|
96
|
+
/** Tensor 值,一段 ArrayBuffer */
|
|
97
|
+
data: ArrayBuffer
|
|
98
|
+
/** ArrayBuffer 值的类型,合法值有 uint8, int8, uint32, int32, float32 */
|
|
99
|
+
type: keyof Type
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
interface Tensors {
|
|
103
|
+
[key: string]: Tensor
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/** 模型加载失败回调函数 */
|
|
107
|
+
type OnErrorCallback = (res: TaroGeneral.CallbackResult) => void
|
|
108
|
+
/** 模型加载完成回调函数 */
|
|
109
|
+
type OnLoadCallback = (res: TaroGeneral.CallbackResult) => void
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
interface TaroStatic {
|
|
113
|
+
/** 获取通用AI推理引擎版本
|
|
114
|
+
* @supported weapp
|
|
115
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.getInferenceEnvInfo.html
|
|
116
|
+
*/
|
|
117
|
+
getInferenceEnvInfo(
|
|
118
|
+
option: getInferenceEnvInfo.Option
|
|
119
|
+
): void
|
|
120
|
+
|
|
121
|
+
/** 创建 AI 推理 Session
|
|
122
|
+
* @supported weapp
|
|
123
|
+
* @see https://developers.weixin.qq.com/miniprogram/dev/api/ai/inference/wx.createInferenceSession.html
|
|
124
|
+
*/
|
|
125
|
+
createInferenceSession(
|
|
126
|
+
option: createInferenceSession.Option
|
|
127
|
+
): InferenceSession
|
|
128
|
+
}
|
|
129
|
+
}
|