@tarojs/taro 3.6.1 → 3.6.2-canary.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tarojs/taro",
3
- "version": "3.6.1",
3
+ "version": "3.6.2-canary.0",
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,8 @@
21
21
  "author": "O2Team",
22
22
  "license": "MIT",
23
23
  "dependencies": {
24
- "@tarojs/api": "3.6.1",
25
- "@tarojs/runtime": "3.6.1"
24
+ "@tarojs/api": "3.6.2-canary.0",
25
+ "@tarojs/runtime": "3.6.2-canary.0"
26
26
  },
27
27
  "peerDependenciesMeta": {
28
28
  "@types/react": {
@@ -82,11 +82,36 @@ declare module '../../index' {
82
82
  }
83
83
  }
84
84
 
85
+ namespace createMediaRecorder {
86
+ /**
87
+ * createMediaRecorder Option
88
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html
89
+ */
90
+ interface Option {
91
+ /** 指定录制的时长(s),到达自动停止。最大 7200,最小 5
92
+ * @default 600
93
+ */
94
+ duration?: number
95
+ /** 视频比特率(kbps),最小值 600,最大值 3000
96
+ * @default 1000
97
+ */
98
+ videoBitsPerSecond?: number
99
+ /** 视频关键帧间隔
100
+ * @default 12
101
+ */
102
+ gop?: number
103
+ /** 视频 fps
104
+ * @default 24
105
+ */
106
+ fps?: number
107
+ }
108
+ }
109
+
85
110
  interface TaroStatic {
86
111
  /** 创建 WebGL 画面录制器,可逐帧录制在 WebGL 上渲染的画面并导出视频文件
87
112
  * @supported weapp
88
113
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/media/media-recorder/wx.createMediaRecorder.html
89
114
  */
90
- createMediaRecorder(): MediaRecorder
115
+ createMediaRecorder(canvas?: Canvas | OffscreenCanvas, option?: createMediaRecorder.Option): MediaRecorder
91
116
  }
92
117
  }
@@ -322,6 +322,8 @@ declare module '../../index' {
322
322
  video
323
323
  /** 只能拍摄图片或从相册选择图片 */
324
324
  image
325
+ /** 可同时选择图片和视频 */
326
+ mix
325
327
  }
326
328
  interface sourceType {
327
329
  /** 从相册选择 */
@@ -31,6 +31,22 @@ declare module '../../index' {
31
31
  }
32
32
  }
33
33
 
34
+ namespace checkIsAddedToMyMiniProgram {
35
+ interface Option {
36
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
37
+ complete?: (res: TaroGeneral.CallbackResult) => void
38
+ /** 接口调用失败的回调函数 */
39
+ fail?: (res: TaroGeneral.CallbackResult) => void
40
+ /** 接口调用成功的回调函数 */
41
+ success?: (res: TaroGeneral.CallbackResult) => void
42
+ }
43
+
44
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
45
+ /**是否被添加至 「我的小程序」 */
46
+ added: boolean
47
+ }
48
+ }
49
+
34
50
  interface TaroStatic {
35
51
  /** 收藏视频
36
52
  * @supported weapp
@@ -96,5 +112,11 @@ declare module '../../index' {
96
112
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/favorites/wx.addFileToFavorites.html
97
113
  */
98
114
  addFileToFavorites(option?: addFileToFavorites.Option): Promise<TaroGeneral.CallbackResult>
115
+ /**
116
+ * 检查小程序是否被添加至 「我的小程序」
117
+ * @supported weapp
118
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/open-api/my-miniprogram/wx.checkIsAddedToMyMiniProgram.html
119
+ */
120
+ checkIsAddedToMyMiniProgram(option?: checkIsAddedToMyMiniProgram.Option):Promise<checkIsAddedToMyMiniProgram.SuccessCallbackResult>
99
121
  }
100
122
  }
@@ -0,0 +1,49 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace openQzonePublish {
5
+ interface Option {
6
+ /** 传递的文字内容 */
7
+ text: string
8
+ /** 传递的视频/图片内容,显示顺序为元素下标顺序 */
9
+ media: Media[]
10
+ /** 说说小尾巴跳转到的页面路径,不填则默认跳到主页 */
11
+ path: string
12
+ /** 说说小尾巴显示的文案,不填则默认显示小程序的简介文案 */
13
+ footnote: string
14
+ }
15
+ type Media = {
16
+ /** 图片填"photo",视频填"video" */
17
+ type: MediaType
18
+ /** 文件路径,必须为本地文件 */
19
+ path: string
20
+ }
21
+ type MediaType = 'photo' | 'video'
22
+ }
23
+
24
+ interface TaroStatic {
25
+ /**
26
+ * 此接口可打开手Q说说发表界面,并将文字内容和图片/视频内容传递到手Q说说发表界面。
27
+ * ```tsx
28
+ * Taro.openQzonePublish({
29
+ * footnote: '使用同款滤镜',
30
+ * path: 'pages/index/index',
31
+ * text: '我爱中国',
32
+ * media: [
33
+ * {
34
+ * type: 'photo',
35
+ * path: 'qqfile://1.png'
36
+ * },
37
+ * {
38
+ * type: 'video',
39
+ * path: 'qqfile://2.mp4'
40
+ * }
41
+ * ]
42
+ * })
43
+ * ```
44
+ * @supported qq
45
+ * @see https://q.qq.com/wiki/develop/miniprogram/API/open_port/port_openQzonePublish.html
46
+ */
47
+ openQzonePublish(option: openQzonePublish.Option): void
48
+ }
49
+ }
@@ -102,6 +102,10 @@ declare module '../../index' {
102
102
 
103
103
  namespace hideToast {
104
104
  interface Option {
105
+ /** 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性
106
+ * @default false
107
+ */
108
+ noConflict?: boolean
105
109
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
106
110
  complete?: (res: TaroGeneral.CallbackResult) => void
107
111
  /** 接口调用失败的回调函数 */
@@ -113,6 +117,10 @@ declare module '../../index' {
113
117
 
114
118
  namespace hideLoading {
115
119
  interface Option {
120
+ /** 目前 toast 和 loading 相关接口可以相互混用,此参数可用于取消混用特性
121
+ * @default false
122
+ */
123
+ noConflict?: boolean
116
124
  /** 接口调用结束的回调函数(调用成功、失败都会执行) */
117
125
  complete?: (res: TaroGeneral.CallbackResult) => void
118
126
  /** 接口调用失败的回调函数 */
@@ -60,5 +60,12 @@ declare module '../../index' {
60
60
  /** 窗口尺寸变化事件的回调函数 */
61
61
  callback: offWindowResize.Callback,
62
62
  ): void
63
+
64
+ /**
65
+ * 返回当前是否存在小窗播放(小窗在 video/live-player/live-pusher 下可用)
66
+ * @supported weapp
67
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/ui/window/wx.checkIsPictureInPictureActive.html
68
+ */
69
+ checkIsPictureInPictureActive(): boolean
63
70
  }
64
71
  }
@@ -304,7 +304,7 @@ declare module '../../index' {
304
304
  namespace NodesRef {
305
305
  /** 回调函数,在执行 `SelectorQuery.exec` 方法后,节点信息会在 `callback` 中返回。 */
306
306
  type BoundingClientRectCallback = (
307
- result: BoundingClientRectCallbackResult,
307
+ result: BoundingClientRectCallbackResult | BoundingClientRectCallbackResult[],
308
308
  ) => void
309
309
  interface BoundingClientRectCallbackResult {
310
310
  /** 节点的下边界坐标 */
@@ -40,6 +40,7 @@ export interface IH5Config {
40
40
  miniCssExtractPluginOption?: IOption
41
41
  esnextModules?: string[]
42
42
  useHtmlComponents?: boolean
43
+ useDeprecatedAdapterComponent?: boolean
43
44
 
44
45
  postcss?: IPostcssOption
45
46
  htmlPluginOption?: HtmlWebpackPlugin.Options
@@ -1,7 +1,7 @@
1
1
  type Tagname = string
2
2
  type Attrs = Set<string>
3
3
 
4
- interface IComponentConfig {
4
+ export interface IComponentConfig {
5
5
  includes: Set<string>
6
6
  exclude: Set<string>
7
7
  thirdPartyComponents: Map<Tagname, Attrs>
@@ -108,4 +108,5 @@
108
108
  /// <reference path="api/open-api/facial.d.ts" />
109
109
 
110
110
  /// <reference path="api/alipay/index.d.ts" />
111
+ /// <reference path="api/qq/index.d.ts" />
111
112
  /// <reference path="api/swan/index.d.ts" />
@@ -69,7 +69,13 @@ declare module './index' {
69
69
  /** 尺寸转换初始化
70
70
  * @supported global
71
71
  */
72
- initPxTransform(config: { designWidth: number; deviceRatio: TaroGeneral.TDeviceRatio }): void
72
+ initPxTransform(config: {
73
+ baseFontSize?: number
74
+ deviceRatio?: TaroGeneral.TDeviceRatio
75
+ designWidth?: number
76
+ targetUnit?: string
77
+ unitPrecision?: number
78
+ }): void
73
79
 
74
80
  /** 小程序引用插件 JS 接口
75
81
  * @supported weapp, alipay, h5, rn, jd, qq, swan, tt, quickapp
@@ -67,25 +67,19 @@ declare module './index' {
67
67
  * 转发事件来源
68
68
  * `button`:页面内转发按钮
69
69
  * `menu`:右上角转发菜单
70
- *
71
- * @since 1.2.4
72
70
  */
73
71
  from?: 'button' | 'menu' | string
74
72
  /**
75
73
  * 如果 `from` 值是 `button`,则 `target` 是触发这次转发事件的 `button`,否则为 `undefined`
76
- *
77
- * @since 1.2.4
78
74
  */
79
75
  target?: object
80
76
  /**
81
77
  * 页面中包含 `<web-view>` 组件时,返回当前 `<web-view>` 的 url
82
- *
83
- * @since 1.6.4
84
78
  */
85
79
  webViewUrl?: string
86
80
  }
87
81
 
88
- interface ShareAppMessageReturn {
82
+ interface ShareAppMessageReturnObject {
89
83
  /**
90
84
  * 转发标题,默认为当前小程序名称
91
85
  */
@@ -101,12 +95,44 @@ declare module './index' {
101
95
  * 支持PNG及JPG
102
96
  * 显示图片长宽比是 5:4
103
97
  * 默认使用截图
104
- *
105
- * @since 1.5.0
106
98
  */
107
99
  imageUrl?: string
108
100
  }
109
101
 
102
+ interface WeappShareAppMessageReturnObject extends ShareAppMessageReturnObject {
103
+ /**
104
+ * 如果该参数存在,则以 resolve 结果为准,如果三秒内不 resolve,分享会使用上面传入的默认参数
105
+ * @supported weapp
106
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onShareAppMessage-Object-object
107
+ * @example
108
+ * ```tsx
109
+ * import { ShareAppMessageReturnObject, useShareAppMessage } from "@tarojs/taro";
110
+ * // ... else code
111
+ * useShareAppMessage(() => {
112
+ * const p = new Promise<ShareAppMessageReturnObject>(resolve => {
113
+ * setTimeout(() => {
114
+ * resolve({
115
+ * title: "",
116
+ * imageUrl: "",
117
+ * path: ""
118
+ * })
119
+ * }, 2000)
120
+ * })
121
+ * return {
122
+ * title: "",
123
+ * imageUrl: "",
124
+ * path: "",
125
+ * promise: p
126
+ * }
127
+ * });
128
+ * ```
129
+ *
130
+ */
131
+ promise: Promise<ShareAppMessageReturnObject>
132
+ }
133
+
134
+ type ShareAppMessageReturn = ShareAppMessageReturnObject | Promise<ShareAppMessageReturnObject> | WeappShareAppMessageReturnObject
135
+
110
136
  interface TabItemTapObject {
111
137
  /**
112
138
  * 被点击tabItem的序号,从 0 开始