@tarojs/taro 3.6.16-alpha.1 → 3.6.17

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.
@@ -0,0 +1,59 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ /**
5
+ * Snapshot 实例,可通过 SelectorQuery 获取。
6
+ *
7
+ * Snapshot 通过 id 跟一个 snapshot 组件绑定,操作对应的 snapshot 组件。
8
+ * @supported weapp
9
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.html
10
+ */
11
+ interface Snapshot {
12
+ /**
13
+ * 画布宽度
14
+ */
15
+ width: number
16
+ /**
17
+ * 画布高度
18
+ */
19
+ height: number
20
+ /**
21
+ * 对 snapshot 组件子树进行截图
22
+ * @param option
23
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/skyline/Snapshot.takeSnapshot.html
24
+ */
25
+ takeSnapshot(option: Snapshot.TakeSnapshot.Option): Promise<TaroGeneral.CallbackResult>
26
+ }
27
+
28
+ namespace Snapshot {
29
+ namespace TakeSnapshot {
30
+ interface Option {
31
+ /**
32
+ * 截图导出类型,'file' 保存到临时文件目录或 'arraybuffer' 返回图片二进制数据,默认值为 'file'
33
+ */
34
+ type: string
35
+ /**
36
+ * 截图文件格式,'rgba' 或 'png',默认值为 'png'
37
+ */
38
+ format: string
39
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
40
+ complete?: (res: TaroGeneral.CallbackResult) => void
41
+ /** 接口调用失败的回调函数 */
42
+ fail?: (res: TaroGeneral.CallbackResult) => void
43
+ /** 接口调用成功的回调函数 */
44
+ success?: (res: SuccessCallbackResult) => void
45
+ }
46
+
47
+ interface SuccessCallbackResult {
48
+ /**
49
+ * 截图保存的临时文件路径,当 type 为 file 该字段生效
50
+ */
51
+ tempFilePath: string
52
+ /**
53
+ * 截图对应的二进制数据,当 type 为 arraybuffer 该字段生效
54
+ */
55
+ data: string
56
+ }
57
+ }
58
+ }
59
+ }
@@ -26,7 +26,7 @@ declare module '../../index' {
26
26
  * @supported weapp
27
27
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteCache.html
28
28
  */
29
- deleteCache(
29
+ deleteCache(
30
30
  /** 缓存 id */
31
31
  id: string
32
32
  ): void
@@ -40,7 +40,7 @@ declare module '../../index' {
40
40
  ): void
41
41
  /** 删除规则,同时会删除对应规则下所有缓存
42
42
  * @supported weapp
43
- * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
43
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.deleteRule.html
44
44
  */
45
45
  deleteRule(
46
46
  /** 规则 id */
@@ -67,17 +67,17 @@ declare module '../../index' {
67
67
  /** 事件名称 */
68
68
  eventName: string,
69
69
  /** 事件监听函数 */
70
- handler: Function
70
+ handler: TaroGeneral.EventCallback
71
71
  ): void
72
72
  /** 监听事件
73
73
  * @supported weapp
74
74
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/CacheManager.on.html
75
75
  */
76
- on(
76
+ on(
77
77
  /** 事件名称 */
78
78
  eventName: keyof CacheManager.OnEventName,
79
79
  /** 事件监听函数 */
80
- handler: Function
80
+ handler: TaroGeneral.EventCallback
81
81
  ): void
82
82
  /** 开启缓存,仅在 mode 为 none 时生效,调用后缓存管理器的 state 会置为 1
83
83
  * @supported weapp
@@ -117,7 +117,7 @@ declare module '../../index' {
117
117
  method: string
118
118
  /** uri 匹配规则,可参考规则字符串写法和正则写法 */
119
119
  url: any
120
- /**
120
+ /**
121
121
  * 缓存有效时间,单位为 ms,不填则默认取缓存管理器全局的缓存有效时间
122
122
  * @default 7 * 24 * 60 * 60 * 1000
123
123
  */
@@ -189,10 +189,10 @@ declare module '../../index' {
189
189
  }
190
190
 
191
191
  interface TaroStatic {
192
- /** 拉起手机发送短信界面
193
- * @supported weap
194
- * @see declare module '../../index'
192
+ /** 创建缓存管理器
193
+ * @supported weapp
194
+ * @see declare https://developers.weixin.qq.com/miniprogram/dev/api/storage/cachemanager/wx.createCacheManager.html
195
195
  */
196
196
  createCacheManager(option: createCacheManager.Option): CacheManager
197
197
  }
198
- }
198
+ }
@@ -89,7 +89,7 @@ export interface ICopyOptions {
89
89
  from: string
90
90
  to: string
91
91
  ignore?: string[]
92
- transform?: Function
92
+ transform?: Func
93
93
  watch?: boolean
94
94
  }[]
95
95
  options: {
package/types/global.d.ts CHANGED
@@ -2,6 +2,7 @@ declare namespace TaroGeneral {
2
2
  type IAnyObject = Record<string, any>
3
3
  type Optional<F> = F extends (arg: infer P) => infer R ? (arg?: P) => R : F
4
4
  type OptionalInterface<T> = { [K in keyof T]: Optional<T[K]> }
5
+ type TFunc = (...args: any[]) => any
5
6
  /** 事件监听函数 */
6
7
  type EventCallback = (
7
8
  /** 触发事件参数 */
package/types/index.d.ts CHANGED
@@ -87,6 +87,8 @@
87
87
  * │ │ └── index.d.ts 路由 API
88
88
  * │ ├── share
89
89
  * │ │ └── index.d.ts 转发 API
90
+ * │ ├── skyline
91
+ * │ │ └── index.d.ts 微信 Skyline API
90
92
  * │ ├── storage
91
93
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
92
94
  * │ │ └── index.d.ts 数据缓存 API
@@ -72,10 +72,12 @@
72
72
  /// <reference path="api/open-api/subscribe-message.d.ts" />
73
73
  /// <reference path="api/open-api/redpackage.d.ts" />
74
74
  /// <reference path="api/open-api/favorites.d.ts" />
75
+ /// <reference path="api/open-api/my-miniprogram.d.ts" />
75
76
  /// <reference path="api/open-api/license-plate.d.ts" />
76
77
  /// <reference path="api/open-api/channels.d.ts" />
77
78
  /// <reference path="api/open-api/device-voip.d.ts" />
78
79
  /// <reference path="api/open-api/group.d.ts" />
80
+ /// <reference path="api/open-api/privacy.d.ts" />
79
81
  /// <reference path="api/open-api/customer-service.d.ts" />
80
82
  /// <reference path="api/device/bluetooth.d.ts" />
81
83
  /// <reference path="api/device/bluetooth-ble.d.ts" />
@@ -107,7 +109,7 @@
107
109
  /// <reference path="api/wxml/index.d.ts" />
108
110
  /// <reference path="api/ext/index.d.ts" />
109
111
  /// <reference path="api/ad/index.d.ts" />
110
- /// <reference path="api/privacy/index.d.ts" />
112
+ /// <reference path="api/skyline/index.d.ts" />
111
113
 
112
114
  /// <reference path="api/cloud/index.d.ts" />
113
115
  /// <reference path="api/open-api/facial.d.ts" />
@@ -89,7 +89,7 @@ declare module './index' {
89
89
  /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
90
90
  createSelectorQuery?(): SelectorQuery
91
91
  /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
92
- createIntersectionObserver?(): IntersectionObserver
92
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
93
93
  /** 创建一个 MediaQueryObserver 对象 */
94
94
  createMediaQueryObserver?(): MediaQueryObserver
95
95
  /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
@@ -625,7 +625,7 @@ declare module './index' {
625
625
  /**
626
626
  * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
627
627
  * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
628
- * @supported wx
628
+ * @supported weapp
629
629
  */
630
630
  __usePrivacyCheck__?: boolean
631
631
  /**