@tarojs/taro 3.4.0 → 3.4.3

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 (92) hide show
  1. package/package.json +5 -5
  2. package/types/api/ai/face.d.ts +133 -0
  3. package/types/api/ai/visionkit.d.ts +303 -0
  4. package/types/api/base/crypto.d.ts +90 -0
  5. package/types/api/base/debug.d.ts +152 -13
  6. package/types/api/base/env.d.ts +2 -1
  7. package/types/api/base/index.d.ts +10 -2
  8. package/types/api/base/performance.d.ts +195 -0
  9. package/types/api/base/system.d.ts +539 -101
  10. package/types/api/base/update.d.ts +59 -7
  11. package/types/api/base/weapp/app-event.d.ts +46 -23
  12. package/types/api/base/weapp/life-cycle.d.ts +141 -1
  13. package/types/api/canvas/index.d.ts +150 -136
  14. package/types/api/cloud/index.d.ts +17 -2
  15. package/types/api/device/accelerometer.d.ts +3 -3
  16. package/types/api/device/accessibility.d.ts +26 -0
  17. package/types/api/device/battery.d.ts +2 -2
  18. package/types/api/device/{ble.d.ts → bluetooth-ble.d.ts} +228 -62
  19. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  20. package/types/api/device/bluetooth.d.ts +67 -2
  21. package/types/api/device/calendar.d.ts +88 -0
  22. package/types/api/device/contact.d.ts +74 -50
  23. package/types/api/device/gyroscope.d.ts +5 -5
  24. package/types/api/device/iBeacon.d.ts +33 -19
  25. package/types/api/{ui → device}/keyboard.d.ts +0 -0
  26. package/types/api/device/{performance.d.ts → memory.d.ts} +4 -4
  27. package/types/api/device/motion.d.ts +3 -3
  28. package/types/api/device/network.d.ts +53 -12
  29. package/types/api/device/nfc.d.ts +1089 -13
  30. package/types/api/device/scan.d.ts +1 -1
  31. package/types/api/device/screen.d.ts +40 -12
  32. package/types/api/device/wifi.d.ts +41 -6
  33. package/types/api/files/index.d.ts +371 -184
  34. package/types/api/location/index.d.ts +116 -55
  35. package/types/api/media/audio.d.ts +653 -60
  36. package/types/api/media/background-audio.d.ts +47 -41
  37. package/types/api/media/camera.d.ts +38 -19
  38. package/types/api/media/editor.d.ts +22 -2
  39. package/types/api/media/image.d.ts +61 -32
  40. package/types/api/media/live.d.ts +66 -6
  41. package/types/api/media/map.d.ts +469 -49
  42. package/types/api/media/media-recorder.d.ts +92 -0
  43. package/types/api/media/recorder.d.ts +20 -20
  44. package/types/api/media/video-decoder.d.ts +117 -0
  45. package/types/api/media/video-processing.d.ts +11 -7
  46. package/types/api/media/video.d.ts +45 -16
  47. package/types/api/media/voip.d.ts +290 -0
  48. package/types/api/{open-api/navigate.d.ts → navigate/index.d.ts} +63 -27
  49. package/types/api/network/download.d.ts +39 -16
  50. package/types/api/network/request.d.ts +128 -40
  51. package/types/api/network/tcp.d.ts +181 -0
  52. package/types/api/network/udp.d.ts +154 -83
  53. package/types/api/network/upload.d.ts +41 -25
  54. package/types/api/network/websocket.d.ts +16 -15
  55. package/types/api/open-api/authorize.d.ts +41 -2
  56. package/types/api/open-api/channels.d.ts +178 -0
  57. package/types/api/open-api/customer-service.d.ts +1 -1
  58. package/types/api/open-api/facial.d.ts +3 -0
  59. package/types/api/open-api/favorites.d.ts +100 -0
  60. package/types/api/open-api/group.d.ts +59 -0
  61. package/types/api/open-api/invoice.d.ts +2 -2
  62. package/types/api/open-api/license-plate.d.ts +27 -0
  63. package/types/api/open-api/login.d.ts +21 -0
  64. package/types/api/open-api/redpackage.d.ts +24 -0
  65. package/types/api/open-api/settings.d.ts +80 -15
  66. package/types/api/open-api/soter.d.ts +2 -2
  67. package/types/api/open-api/subscribe-message.d.ts +88 -3
  68. package/types/api/open-api/user-info.d.ts +55 -18
  69. package/types/api/open-api/werun.d.ts +33 -6
  70. package/types/api/payment/index.d.ts +119 -0
  71. package/types/api/route/index.d.ts +13 -9
  72. package/types/api/share/index.d.ts +192 -9
  73. package/types/api/storage/index.d.ts +29 -83
  74. package/types/api/swan/index.d.ts +1 -1
  75. package/types/api/ui/animation.d.ts +84 -70
  76. package/types/api/ui/background.d.ts +4 -2
  77. package/types/api/ui/custom-component.d.ts +1 -1
  78. package/types/api/ui/fonts.d.ts +27 -31
  79. package/types/api/ui/navigation-bar.d.ts +1 -0
  80. package/types/api/ui/scroll.d.ts +73 -7
  81. package/types/api/ui/sticky.d.ts +4 -4
  82. package/types/api/ui/tab-bar.d.ts +7 -7
  83. package/types/api/ui/window.d.ts +22 -2
  84. package/types/api/worker/index.d.ts +9 -1
  85. package/types/api/wxml/index.d.ts +143 -105
  86. package/types/compile.d.ts +5 -0
  87. package/types/global.d.ts +142 -111
  88. package/types/taro.api.d.ts +79 -62
  89. package/types/taro.component.d.ts +75 -55
  90. package/types/taro.config.d.ts +172 -168
  91. package/types/taro.extend.d.ts +8 -1
  92. package/types/api/open-api/payment.d.ts +0 -61
@@ -23,29 +23,22 @@ declare module './index' {
23
23
  onTabItemTap?(obj: TabItemTapObject): void
24
24
  onResize?(obj: PageResizeObject): void
25
25
  }
26
-
27
26
  interface ComponentOptions {
28
27
  addGlobalClass?: boolean
29
28
  styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
30
29
  }
31
-
32
30
  interface ComponentClass<P = {}, S = any> extends StaticLifecycle<P, S> {
33
31
  new (...args: any[]): Component<P, {}>
34
32
  propTypes?: any // TODO: Use prop-types type definition.
35
33
  defaultProps?: Partial<P>
36
34
  displayName?: string
37
35
  }
38
-
39
36
  // ref: packages/taro-runtime/src/current.ts
40
37
  interface RouterInfo<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>> {
41
- /**
42
- * 路由参数。
43
- */
38
+ /** 路由参数 */
44
39
  params: TParams
45
40
 
46
- /**
47
- * 页面路径。
48
- */
41
+ /** 页面路径 */
49
42
  path: string
50
43
 
51
44
  onReady: string
@@ -55,13 +48,10 @@ declare module './index' {
55
48
  shareTicket: string | undefined
56
49
  scene: number | undefined
57
50
  }
58
-
59
51
  interface Component<P = {}, S = {}, SS = any> extends ComponentLifecycle<P, S, SS> {
60
52
  $scope?: any
61
53
  }
62
-
63
54
  type PropsWithChildren<P> = P & { children?: React.ReactNode }
64
-
65
55
  interface FunctionComponent<P = {}> {
66
56
  (props: PropsWithChildren<P>, context?: any): React.ReactElement | null
67
57
  propTypes?: any // TODO: Use prop-types type definition.
@@ -70,13 +60,10 @@ declare module './index' {
70
60
  options?: ComponentOptions
71
61
  externalClasses?: string[]
72
62
  }
73
-
74
63
  type FC<P = {}> = FunctionComponent<P>
75
-
76
64
  interface StatelessFunctionComponent {
77
65
  (): JSX.Element
78
66
  }
79
-
80
67
  type SFC = StatelessFunctionComponent
81
68
 
82
69
  interface Show {
@@ -85,23 +72,19 @@ declare module './index' {
85
72
  onShow?(): void
86
73
  onHide?(): void
87
74
  }
88
-
89
75
  interface AppInstance extends Show {
90
76
  mount(component: React.ComponentClass | Vue.ComponentOptions<Vue>, id: string, cb: () => void): void
91
77
  componentDidShow?(options?: Record<string, unknown>): void
92
78
  onShow?(options?: Record<string, unknown>): void
93
79
  unmount(id: string, cb: () => void): void
94
80
  }
95
-
96
81
  type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
97
-
98
82
  interface MpEvent {
99
83
  type: string
100
84
  detail: Record<string, unknown>
101
85
  target: Target
102
86
  currentTarget: Target
103
87
  }
104
-
105
88
  interface PageLifeCycle extends Show {
106
89
  onPullDownRefresh?(): void
107
90
  onReachBottom?(): void
@@ -117,50 +100,87 @@ declare module './index' {
117
100
  onLoad(options: Record<string, unknown>): void
118
101
  onUnload(): void
119
102
  }
120
-
121
- interface PageInstance extends PageLifeCycle {
122
- /**
123
- * 页面配置。
124
- */
103
+ interface ComponentInstance<
104
+ TData extends Record<string, unknown> = Record<string, unknown>,
105
+ TParams extends Record<string, string> = Record<string, string>
106
+ > {
107
+ /** 组件的文件路径 */
108
+ is?: string
109
+ /** 节点id */
110
+ id?: string
111
+ /** 节点dataset */
112
+ dataset?: string
113
+ /** 组件数据,包括内部数据和属性值 */
114
+ data?: TData
115
+ /** 组件数据,包括内部数据和属性值(与 data 一致) */
116
+ properties?: TData
117
+ /** 相对于当前自定义组件的 Router 对象 */
118
+ router?: RouterInfo<TParams>
119
+ /** 相对于当前自定义组件所在页面的 Router 对象 */
120
+ pageRouter?: RouterInfo<TParams>
121
+ /** 设置data并执行视图层渲染 */
122
+ setData?(newData: Partial<TData>): void
123
+ /** 检查组件是否具有 behavior (检查时会递归检查被直接或间接引入的所有behavior) */
124
+ hasBehavior?(behavior: unknown): boolean
125
+ /** 触发事件,参见[组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */
126
+ triggerEvent?(name: string, detail: Record<string, unknown>, options: {
127
+ /** 事件是否冒泡 */
128
+ bubbles?: boolean
129
+ /** 事件是否可以穿越组件边界,为 false 时,事件将只能在引用组件的节点树上触发,不进入其他任何组件内部 */
130
+ composed?: boolean
131
+ /** 事件是否拥有捕获阶段 */
132
+ capturePhase?: boolean
133
+ }): void
134
+ /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
135
+ createSelectorQuery?(): SelectorQuery
136
+ /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
137
+ createIntersectionObserver?(): IntersectionObserver
138
+ /** 创建一个 MediaQueryObserver 对象 */
139
+ createMediaQueryObserver?(): MediaQueryObserver
140
+ /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
141
+ selectComponent?<
142
+ TD extends Record<string, unknown> = Record<string, unknown>,
143
+ TP extends Record<string, string> = Record<string, string>
144
+ >(selector: string): ComponentInstance<TD, TP>
145
+ /** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组(会被 wx://component-export 影响) */
146
+ selectAllComponents?<
147
+ TD extends Record<string, unknown> = Record<string, unknown>,
148
+ TP extends Record<string, string> = Record<string, string>
149
+ >(selector: string): ComponentInstance<TD, TP>
150
+ /** 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 wx://component-export 影响) */
151
+ selectOwnerComponent?<
152
+ TD extends Record<string, unknown> = Record<string, unknown>,
153
+ TP extends Record<string, string> = Record<string, string>
154
+ >(): ComponentInstance<TD, TP>
155
+ /** 获取这个关系所对应的所有关联节点,参见[组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/relations.html) */
156
+ getRelationNodes?(relationKey: string): NodesRef[]
157
+ /** 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) */
158
+ groupSetData?(callback: () => void): void
159
+ /** 返回当前页面的 custom-tab-bar 的组件实例,详见[自定义 tabBar](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html) */
160
+ getTabBar?(): ComponentInstance
161
+ /** 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 */
162
+ getPageId?(): string
163
+ /** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
164
+ animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
165
+ /** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
166
+ clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
167
+ /** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
168
+ setUpdatePerformanceListener?(options: {
169
+ /** 是否返回变更的 data 字段信息 */
170
+ withDataPaths?: boolean
171
+ }, listener: () => void): void
172
+ }
173
+ interface PageInstance extends PageLifeCycle, ComponentInstance {
174
+ /** 页面配置 */
125
175
  config?: PageConfig
126
176
  data?: Record<string, unknown>
127
177
  path?: string
128
178
  options?: Record<string, unknown>
129
- /**
130
- * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
131
- *
132
- * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
133
- **/
134
- animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
135
- /**
136
- * 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
137
- *
138
- * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
139
- **/
140
- animate?(
141
- selector: string,
142
- keyFrames: ScrollTimelineKeyframe[],
143
- duration: number,
144
- scrollTimeline: ScrollTimelineOption
145
- ): void
146
- /**
147
- * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
148
- *
149
- * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
150
- **/
151
- clearAnimation?(selector: string, callback: () => void): void
152
- /**
153
- * 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html)
154
- *
155
- * 最低基础库版本:[`2.9.0`](https://developers.weixin.qq.com/miniprogram/dev/framework/compatibility.html)
156
- **/
157
- clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
158
179
  }
159
-
160
180
  interface TaroStatic {
161
181
  memo<P = {}>(
162
182
  FunctionComponent: FunctionComponent<P>,
163
- compare?: (oldProps: P, newProps: P) => Boolean
183
+ compare?: (oldProps: P, newProps: P) => boolean
164
184
  ): FunctionComponent<P>
165
185
  }
166
186
  }