@tarojs/taro 3.6.2 → 3.6.4

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.2",
3
+ "version": "3.6.4",
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.2",
25
- "@tarojs/runtime": "3.6.2"
24
+ "@tarojs/api": "3.6.4",
25
+ "@tarojs/runtime": "3.6.4"
26
26
  },
27
27
  "peerDependenciesMeta": {
28
28
  "@types/react": {
@@ -4,7 +4,7 @@ declare module '../../index' {
4
4
  namespace openEmbeddedMiniProgram {
5
5
  interface Option {
6
6
  /** 要打开的小程序 appId */
7
- appId: string
7
+ appId?: string
8
8
  /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [Taro.onShow](#) 回调函数、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
9
9
  path?: string
10
10
  /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [Taro.onShow](#)、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到这份数据数据。 */
@@ -45,7 +45,7 @@ declare module '../../index' {
45
45
  namespace navigateToMiniProgram {
46
46
  interface Option {
47
47
  /** 要打开的小程序 appId */
48
- appId: string
48
+ appId?: string
49
49
  /** 打开的页面路径,如果为空则打开首页。path 中 ? 后面的部分会成为 query,在小程序的 `App.onLaunch`、`App.onShow` 和 `Page.onLoad` 的回调函数或小游戏的 [Taro.onShow](#) 回调函数、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到 query 数据。对于小游戏,可以只传入 query 部分,来实现传参效果,如:传入 "?foo=bar"。 */
50
50
  path?: string
51
51
  /** 需要传递给目标小程序的数据,目标小程序可在 `App.onLaunch`,`App.onShow` 中获取到这份数据。如果跳转的是小游戏,可以在 [Taro.onShow](#)、[Taro.getLaunchOptionsSync](/docs/apis/base/weapp/life-cycle/getLaunchOptionsSync) 中可以获取到这份数据数据。 */
@@ -150,6 +150,8 @@ declare module '../../index' {
150
150
  POST
151
151
  /** HTTP 请求 PUT */
152
152
  PUT
153
+ /** HTTP 请求 PATCH */
154
+ PATCH
153
155
  /** HTTP 请求 DELETE */
154
156
  DELETE
155
157
  /** HTTP 请求 TRACE */
@@ -304,12 +306,8 @@ declare module '../../index' {
304
306
  namespace onChunkReceived {
305
307
  /** Transfer-Encoding Chunk Received 事件的回调函数 */
306
308
  type Callback = (result: CallbackResult) => void
307
- interface CallbackResult {
308
- /** 开发者服务器每次返回新 chunk 时的 Response */
309
- res: Response
310
- }
311
309
  /** 开发者服务器每次返回新 chunk 时的 Response */
312
- interface Response {
310
+ interface CallbackResult {
313
311
  /** 返回的chunk buffer */
314
312
  data: ArrayBuffer
315
313
  }
@@ -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
  /** 节点的下边界坐标 */
@@ -19,7 +19,7 @@ interface IPrebundle {
19
19
 
20
20
  interface ICompiler {
21
21
  type: CompilerTypes
22
- prebundle: IPrebundle
22
+ prebundle?: IPrebundle
23
23
  }
24
24
 
25
25
  export type Compiler = CompilerTypes | ICompiler
@@ -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>
package/types/global.d.ts CHANGED
@@ -410,13 +410,15 @@ declare namespace TaroGeneral {
410
410
  // ENV_TYPE
411
411
  enum ENV_TYPE {
412
412
  WEAPP = 'WEAPP',
413
- WEB = 'WEB',
414
- RN = 'RN',
415
413
  SWAN = 'SWAN',
416
414
  ALIPAY = 'ALIPAY',
417
415
  TT = 'TT',
418
416
  QQ = 'QQ',
419
- JD = 'JD'
417
+ JD = 'JD',
418
+ WEB = 'WEB',
419
+ RN = 'RN',
420
+ HARMONY = 'HARMONY',
421
+ QUICKAPP = 'QUICKAPP'
420
422
  }
421
423
 
422
424
  type TDeviceRatio = Record<string, number>
@@ -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 开始