@tarojs/taro 3.7.0-alpha.2 → 3.7.0-alpha.20

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.
Files changed (49) hide show
  1. package/package.json +16 -3
  2. package/types/api/ad/index.d.ts +6 -18
  3. package/types/api/ai/inference.d.ts +129 -0
  4. package/types/api/ai/visionkit.d.ts +625 -54
  5. package/types/api/alipay/index.d.ts +43 -0
  6. package/types/api/base/crypto.d.ts +18 -4
  7. package/types/api/base/index.d.ts +2 -2
  8. package/types/api/base/performance.d.ts +65 -2
  9. package/types/api/base/system.d.ts +65 -0
  10. package/types/api/base/weapp/app-event.d.ts +18 -18
  11. package/types/api/canvas/index.d.ts +67 -54
  12. package/types/api/device/calendar.d.ts +2 -2
  13. package/types/api/device/screen.d.ts +61 -0
  14. package/types/api/device/sms.d.ts +26 -0
  15. package/types/api/media/audio.d.ts +50 -30
  16. package/types/api/media/image.d.ts +40 -17
  17. package/types/api/media/live.d.ts +52 -0
  18. package/types/api/media/video.d.ts +64 -23
  19. package/types/api/media/voip.d.ts +103 -0
  20. package/types/api/network/download.d.ts +2 -10
  21. package/types/api/network/request.d.ts +84 -24
  22. package/types/api/network/upload.d.ts +2 -10
  23. package/types/api/open-api/address.d.ts +12 -10
  24. package/types/api/open-api/channels.d.ts +31 -0
  25. package/types/api/open-api/device-voip.d.ts +63 -0
  26. package/types/api/open-api/login.d.ts +1 -1
  27. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  28. package/types/api/open-api/privacy.d.ts +99 -0
  29. package/types/api/route/index.d.ts +3 -0
  30. package/types/api/share/index.d.ts +1 -1
  31. package/types/api/skyline/index.d.ts +59 -0
  32. package/types/api/storage/cache-manager.d.ts +198 -0
  33. package/types/api/taro.extend.d.ts +223 -0
  34. package/types/{taro.hooks.d.ts → api/taro.hooks.d.ts} +4 -4
  35. package/types/api/ui/navigation-bar.d.ts +1 -1
  36. package/types/compile/compiler.d.ts +8 -6
  37. package/types/compile/config/h5.d.ts +76 -9
  38. package/types/compile/config/mini.d.ts +80 -10
  39. package/types/compile/config/project.d.ts +242 -20
  40. package/types/compile/config/rn.d.ts +64 -0
  41. package/types/compile/config/util.d.ts +83 -11
  42. package/types/compile/hooks.d.ts +1 -1
  43. package/types/compile/viteCompilerContext.d.ts +128 -0
  44. package/types/global.d.ts +9 -8
  45. package/types/index.d.ts +9 -7
  46. package/types/taro.api.d.ts +11 -1
  47. package/types/taro.component.d.ts +3 -2
  48. package/types/taro.config.d.ts +122 -2
  49. package/types/taro.extend.d.ts +0 -112
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.7.0-alpha.2",
3
+ "version": "3.7.0-alpha.20",
4
4
  "description": "Taro framework",
5
5
  "homepage": "https://github.com/nervjs/taro/tree/master/packages/taro#readme",
6
6
  "main": "index.js",
@@ -21,8 +21,12 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.7.0-alpha.2",
25
- "@tarojs/runtime": "3.7.0-alpha.2"
24
+ "@tarojs/api": "3.7.0-alpha.20",
25
+ "@tarojs/runtime": "3.7.0-alpha.20"
26
+ },
27
+ "devDependencies": {
28
+ "@tarojs/helper": "3.7.0-alpha.20",
29
+ "@tarojs/shared": "3.7.0-alpha.20"
26
30
  },
27
31
  "peerDependenciesMeta": {
28
32
  "@types/react": {
@@ -34,8 +38,17 @@
34
38
  "@types/webpack-dev-server": {
35
39
  "optional": true
36
40
  },
41
+ "@types/postcss-url": {
42
+ "optional": true
43
+ },
44
+ "postcss": {
45
+ "optional": true
46
+ },
37
47
  "vue": {
38
48
  "optional": true
49
+ },
50
+ "rollup": {
51
+ "optional": true
39
52
  }
40
53
  },
41
54
  "scripts": {
@@ -41,17 +41,17 @@ declare module '../../index' {
41
41
  * @supported weapp
42
42
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offClose.html
43
43
  */
44
- offClose(callback: InterstitialAd.OffCloseCallback): void
44
+ offClose(callback: InterstitialAd.OnCloseCallback): void
45
45
  /** 取消监听插屏错误事件
46
46
  * @supported weapp
47
47
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offError.html
48
48
  */
49
- offError(callback: InterstitialAd.OffErrorCallback): void
49
+ offError(callback: InterstitialAd.OnErrorCallback): void
50
50
  /** 取消监听插屏广告加载事件
51
51
  * @supported weapp
52
52
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.offLoad.html
53
53
  */
54
- offLoad(callback: InterstitialAd.OffLoadCallback): void
54
+ offLoad(callback: InterstitialAd.OnLoadCallback): void
55
55
  /** 监听插屏广告关闭事件。
56
56
  * @supported weapp
57
57
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/InterstitialAd.onClose.html
@@ -91,12 +91,6 @@ declare module '../../index' {
91
91
  show(): Promise<any>
92
92
  }
93
93
  namespace InterstitialAd {
94
- /** 插屏广告关闭事件的回调函数 */
95
- type OffCloseCallback = (res: TaroGeneral.CallbackResult) => void
96
- /** 插屏错误事件的回调函数 */
97
- type OffErrorCallback = (res: TaroGeneral.CallbackResult) => void
98
- /** 插屏广告加载事件的回调函数 */
99
- type OffLoadCallback = (res: TaroGeneral.CallbackResult) => void
100
94
  /** 插屏广告关闭事件的回调函数 */
101
95
  type OnCloseCallback = (res: TaroGeneral.CallbackResult) => void
102
96
  /** 插屏错误事件的回调函数 */
@@ -137,17 +131,17 @@ declare module '../../index' {
137
131
  * @supported weapp
138
132
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offClose.html
139
133
  */
140
- offClose(callback: RewardedVideoAd.OffCloseCallback): void
134
+ offClose(callback: RewardedVideoAd.OnCloseCallback): void
141
135
  /** 取消监听激励视频错误事件
142
136
  * @supported weapp
143
137
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offError.html
144
138
  */
145
- offError(callback: RewardedVideoAd.OffErrorCallback): void
139
+ offError(callback: RewardedVideoAd.OnErrorCallback): void
146
140
  /** 取消监听激励视频广告加载事件
147
141
  * @supported weapp
148
142
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.offLoad.html
149
143
  */
150
- offLoad(callback: RewardedVideoAd.OffLoadCallback): void
144
+ offLoad(callback: RewardedVideoAd.OnLoadCallback): void
151
145
  /** 监听用户点击 `关闭广告` 按钮的事件。
152
146
  * @supported weapp
153
147
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/ad/RewardedVideoAd.onClose.html
@@ -179,12 +173,6 @@ declare module '../../index' {
179
173
  isEnded: boolean
180
174
  }
181
175
  /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
182
- type OffCloseCallback = (res: TaroGeneral.CallbackResult) => void
183
- /** 激励视频错误事件的回调函数 */
184
- type OffErrorCallback = (res: TaroGeneral.CallbackResult) => void
185
- /** 激励视频广告加载事件的回调函数 */
186
- type OffLoadCallback = (res: TaroGeneral.CallbackResult) => void
187
- /** 用户点击 `关闭广告` 按钮的事件的回调函数 */
188
176
  type OnCloseCallback = (result: OnCloseCallbackResult) => void
189
177
  /** 激励视频错误事件的回调函数 */
190
178
  type OnErrorCallback = (result: OnErrorCallbackResult) => void
@@ -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
+ }