@tarojs/taro 4.0.0-beta.0 → 4.0.0-beta.10

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 (68) hide show
  1. package/package.json +10 -5
  2. package/types/api/base/debug.d.ts +8 -8
  3. package/types/api/base/env.d.ts +1 -1
  4. package/types/api/base/index.d.ts +3 -3
  5. package/types/api/base/system.d.ts +6 -6
  6. package/types/api/base/weapp/app-event.d.ts +10 -10
  7. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  8. package/types/api/canvas/index.d.ts +367 -63
  9. package/types/api/device/battery.d.ts +1 -1
  10. package/types/api/device/clipboard.d.ts +2 -2
  11. package/types/api/device/keyboard.d.ts +1 -1
  12. package/types/api/device/network.d.ts +3 -3
  13. package/types/api/device/phone.d.ts +1 -1
  14. package/types/api/device/screen.d.ts +2 -2
  15. package/types/api/files/index.d.ts +7 -7
  16. package/types/api/framework/index.d.ts +2 -2
  17. package/types/api/location/index.d.ts +4 -4
  18. package/types/api/media/audio.d.ts +21 -12
  19. package/types/api/media/background-audio.d.ts +1 -1
  20. package/types/api/media/image.d.ts +5 -5
  21. package/types/api/media/video.d.ts +11 -11
  22. package/types/api/navigate/index.d.ts +1 -1
  23. package/types/api/network/download.d.ts +5 -5
  24. package/types/api/network/request.d.ts +7 -7
  25. package/types/api/network/upload.d.ts +7 -7
  26. package/types/api/network/websocket.d.ts +8 -8
  27. package/types/api/open-api/account.d.ts +1 -1
  28. package/types/api/open-api/address.d.ts +13 -5
  29. package/types/api/open-api/authorize.d.ts +1 -1
  30. package/types/api/open-api/channels.d.ts +16 -0
  31. package/types/api/open-api/device-voip.d.ts +40 -0
  32. package/types/api/open-api/invoice.d.ts +1 -1
  33. package/types/api/open-api/login.d.ts +15 -2
  34. package/types/api/open-api/privacy.d.ts +8 -0
  35. package/types/api/open-api/settings.d.ts +3 -2
  36. package/types/api/open-api/sticker.d.ts +83 -0
  37. package/types/api/open-api/subscribe-message.d.ts +148 -6
  38. package/types/api/open-api/user-info.d.ts +6 -1
  39. package/types/api/qq/index.d.ts +306 -1
  40. package/types/api/route/index.d.ts +5 -5
  41. package/types/api/storage/index.d.ts +10 -10
  42. package/types/api/swan/bookshelf.d.ts +307 -0
  43. package/types/api/swan/download-package.d.ts +80 -0
  44. package/types/api/swan/index.d.ts +151 -0
  45. package/types/api/swan/pay.d.ts +139 -0
  46. package/types/api/taro.extend.d.ts +7 -4
  47. package/types/api/taro.hooks.d.ts +9 -9
  48. package/types/api/ui/animation.d.ts +32 -32
  49. package/types/api/ui/custom-component.d.ts +1 -1
  50. package/types/api/ui/fonts.d.ts +1 -1
  51. package/types/api/ui/interaction.d.ts +6 -6
  52. package/types/api/ui/menu.d.ts +1 -1
  53. package/types/api/ui/navigation-bar.d.ts +2 -2
  54. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  55. package/types/api/ui/scroll.d.ts +1 -1
  56. package/types/api/ui/tab-bar.d.ts +8 -8
  57. package/types/api/ui/window.d.ts +2 -2
  58. package/types/api/wxml/index.d.ts +17 -17
  59. package/types/compile/compiler.d.ts +2 -0
  60. package/types/compile/config/harmony.d.ts +5 -0
  61. package/types/compile/config/mini.d.ts +1 -1
  62. package/types/compile/viteCompilerContext.d.ts +6 -0
  63. package/types/global.d.ts +2 -1
  64. package/types/index.d.ts +91 -45
  65. package/types/taro.api.d.ts +22 -14
  66. package/types/taro.config.d.ts +6 -2
  67. package/types/taro.lifecycle.d.ts +3 -0
  68. package/types/taro.runtime.d.ts +9 -0
@@ -18,12 +18,12 @@ declare module '../../index' {
18
18
  */
19
19
  interface IntersectionObserver {
20
20
  /** 停止监听。回调函数将不再触发
21
- * @supported weapp, tt, h5
21
+ * @supported weapp, tt, h5, harmony_hybrid
22
22
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.disconnect.html
23
23
  */
24
24
  disconnect(): void
25
25
  /** 指定目标节点并开始监听相交状态变化情况
26
- * @supported weapp, tt, h5
26
+ * @supported weapp, tt, h5, harmony_hybrid
27
27
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.observe.html
28
28
  */
29
29
  observe(
@@ -33,7 +33,7 @@ declare module '../../index' {
33
33
  callback: IntersectionObserver.ObserveCallback,
34
34
  ): void
35
35
  /** 使用选择器指定一个节点,作为参照区域之一。
36
- * @supported weapp, tt, h5
36
+ * @supported weapp, tt, h5, harmony_hybrid
37
37
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/IntersectionObserver.relativeTo.html
38
38
  */
39
39
  relativeTo(
@@ -43,7 +43,7 @@ declare module '../../index' {
43
43
  margins?: IntersectionObserver.RelativeToMargins,
44
44
  ): IntersectionObserver
45
45
  /** 指定页面显示区域作为参照区域之一
46
- * @supported weapp, tt, h5
46
+ * @supported weapp, tt, h5, harmony_hybrid
47
47
  * @example
48
48
  * 下面的示例代码中,如果目标节点(用选择器 .target-class 指定)进入显示区域以下 100px 时,就会触发回调函数。
49
49
  *
@@ -184,7 +184,7 @@ declare module '../../index' {
184
184
  */
185
185
  interface NodesRef {
186
186
  /** 添加节点的布局位置的查询请求。相对于显示区域,以像素为单位。其功能类似于 DOM 的 `getBoundingClientRect`。返回 `NodesRef` 对应的 `SelectorQuery`。
187
- * @supported weapp, h5, tt
187
+ * @supported weapp, h5, tt, harmony_hybrid
188
188
  * @example
189
189
  * ```tsx
190
190
  * Taro.createSelectorQuery().select('#the-id').boundingClientRect(function(rect){
@@ -220,7 +220,7 @@ declare module '../../index' {
220
220
  callback?: NodesRef.BoundingClientRectCallback,
221
221
  ): SelectorQuery
222
222
  /** 添加节点的 Context 对象查询请求。目前支持 [VideoContext](/docs/apis/media/video/VideoContext)、[CanvasContext](/docs/apis/canvas/CanvasContext)、[LivePlayerContext](/docs/apis/media/live/LivePlayerContext)、[EditorContext](/docs/apis/media/editor/EditorContext)和 [MapContext](/docs/apis/media/map/MapContext) 的获取。
223
- * @supported weapp, h5, tt
223
+ * @supported weapp, h5, tt, harmony_hybrid
224
224
  * @example
225
225
  * ```tsx
226
226
  * Taro.createSelectorQuery().select('.the-video-class').context(function (res) {
@@ -237,7 +237,7 @@ declare module '../../index' {
237
237
  *
238
238
  * **注意**
239
239
  * computedStyle 的优先级高于 size,当同时在 computedStyle 里指定了 width/height 和传入了 size: true,则优先返回 computedStyle 获取到的 width/height。
240
- * @supported weapp, h5, tt
240
+ * @supported weapp, h5, tt, harmony_hybrid
241
241
  * @example
242
242
  * ```tsx
243
243
  * Taro.createSelectorQuery().select('#the-id').fields({
@@ -269,7 +269,7 @@ declare module '../../index' {
269
269
  callback?: NodesRef.FieldsCallback,
270
270
  ): SelectorQuery
271
271
  /** 获取 Node 节点实例。目前支持 [Canvas](/docs/components/canvas) 的获取。
272
- * @supported weapp, h5, tt
272
+ * @supported weapp, h5, tt, harmony_hybrid
273
273
  * @example
274
274
  * ```tsx
275
275
  * Taro.createSelectorQuery().select('.canvas').node(function(res){
@@ -283,7 +283,7 @@ declare module '../../index' {
283
283
  callback?: NodesRef.NodeCallback,
284
284
  ): SelectorQuery
285
285
  /** 添加节点的滚动位置查询请求。以像素为单位。节点必须是 `scroll-view` 或者 `viewport`,返回 `NodesRef` 对应的 `SelectorQuery`。
286
- * @supported weapp, h5, tt
286
+ * @supported weapp, h5, tt, harmony_hybrid
287
287
  * @example
288
288
  * ```tsx
289
289
  * Taro.createSelectorQuery().selectViewport().scrollOffset(function(res){
@@ -384,7 +384,7 @@ declare module '../../index' {
384
384
  */
385
385
  interface SelectorQuery {
386
386
  /** 执行所有的请求。请求结果按请求次序构成数组,在callback的第一个参数中返回。
387
- * @supported weapp, h5, tt
387
+ * @supported weapp, h5, tt, harmony_hybrid
388
388
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.exec.html
389
389
  */
390
390
  exec(
@@ -392,7 +392,7 @@ declare module '../../index' {
392
392
  callback?: (...args: any[]) => any,
393
393
  ): NodesRef
394
394
  /** 将选择器的选取范围更改为自定义组件 `component` 内。(初始时,选择器仅选取页面范围的节点,不会选取任何自定义组件中的节点)。
395
- * @supported weapp, h5, tt
395
+ * @supported weapp, h5, tt, harmony_hybrid
396
396
  * @example
397
397
  * ```tsx
398
398
  * Component({
@@ -423,7 +423,7 @@ declare module '../../index' {
423
423
  * - 后代选择器:.the-ancestor .the-descendant
424
424
  * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
425
425
  * - 多选择器的并集:#a-node, .some-other-nodes
426
- * @supported weapp, h5, tt
426
+ * @supported weapp, h5, tt, harmony_hybrid
427
427
  * @example
428
428
  * ```tsx
429
429
  * Taro.createSelectorQuery().select('#the-id').fields({
@@ -459,7 +459,7 @@ declare module '../../index' {
459
459
  * - 后代选择器:.the-ancestor .the-descendant
460
460
  * - 跨自定义组件的后代选择器:.the-ancestor >>> .the-descendant
461
461
  * - 多选择器的并集:#a-node, .some-other-nodes
462
- * @supported weapp, h5, tt
462
+ * @supported weapp, h5, tt, harmony_hybrid
463
463
  * @see https://developers.weixin.qq.com/miniprogram/dev/api/wxml/SelectorQuery.selectAll.html
464
464
  */
465
465
  selectAll(
@@ -467,7 +467,7 @@ declare module '../../index' {
467
467
  selector: string,
468
468
  ): NodesRef
469
469
  /** 选择显示区域。可用于获取显示区域的尺寸、滚动位置等信息。
470
- * @supported weapp, h5, tt
470
+ * @supported weapp, h5, tt, harmony_hybrid
471
471
  * @example
472
472
  * ```tsx
473
473
  * Taro.createSelectorQuery().selectViewport().scrollOffset(function (res) {
@@ -484,7 +484,7 @@ declare module '../../index' {
484
484
 
485
485
  interface TaroStatic {
486
486
  /** 返回一个 SelectorQuery 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createSelectorQuery()` 来代替。
487
- * @supported weapp, h5, tt, harmony
487
+ * @supported weapp, h5, tt, harmony, harmony_hybrid
488
488
  * @example
489
489
  * ```tsx
490
490
  * const query = Taro.createSelectorQuery()
@@ -500,7 +500,7 @@ declare module '../../index' {
500
500
  createSelectorQuery(): SelectorQuery
501
501
 
502
502
  /** 创建并返回一个 IntersectionObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createIntersectionObserver([options])` 来代替。
503
- * @supported weapp, h5, tt, harmony
503
+ * @supported weapp, h5, tt, harmony, harmony_hybrid
504
504
  * @example
505
505
  * ```tsx
506
506
  * const observer = Taro.createIntersectionObserver(this, { thresholds: [0], observeAll: true })
@@ -515,7 +515,7 @@ declare module '../../index' {
515
515
  ): IntersectionObserver
516
516
 
517
517
  /** 创建并返回一个 MediaQueryObserver 对象实例。在自定义组件或包含自定义组件的页面中,应使用 `this.createMediaQueryObserver()` 来代替。
518
- * @supported h5
518
+ * @supported h5, harmony_hybrid
519
519
  * @example
520
520
  * ```tsx
521
521
  * let createMediaQueryObserver
@@ -23,6 +23,8 @@ interface ICompiler<T> {
23
23
  type: T
24
24
  prebundle?: IPrebundle
25
25
  vitePlugins?: any
26
+ /** 错误处理级别。可选值:0、1 */
27
+ errorLevel?: number
26
28
  }
27
29
 
28
30
  export type Compiler<T extends CompilerTypes = CompilerWebpackTypes> = T | ICompiler<T>
@@ -1,7 +1,12 @@
1
1
  import type Chain from 'webpack-chain'
2
+
2
3
  import type { IOption, IPostcssOption, IUrlLoaderOption } from './util'
4
+ import type { Compiler, CompilerTypes, CompilerWebpackTypes } from '../compiler'
3
5
 
4
6
  export interface IHarmonyConfig<T extends CompilerTypes = CompilerWebpackTypes> {
7
+ /** Harmony 编译方式 */
8
+ compiler?: Compiler
9
+
5
10
  /** Harmony 项目地址 */
6
11
  projectPath: string
7
12
 
@@ -119,7 +119,7 @@ export interface IMiniAppConfig<T extends CompilerTypes = CompilerWebpackTypes>
119
119
  /** 体验式功能 */
120
120
  experimental?: {
121
121
  /** 是否开启编译模式 */
122
- compileMode?: boolean
122
+ compileMode?: boolean | string
123
123
  }
124
124
  }
125
125
 
@@ -51,6 +51,7 @@ export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfi
51
51
  fileType: IFileType
52
52
  useETS?: boolean
53
53
  useJSON5?: boolean
54
+ blended?: boolean
54
55
  runtimePath?: string | string[]
55
56
  taroComponentsPath: string
56
57
  }
@@ -110,8 +111,10 @@ export interface ViteCompilerContext<T> {
110
111
  getPages: () => VitePageMeta[]
111
112
  isApp: (id: string) => boolean
112
113
  isPage: (id: string) => boolean
114
+ isComponent: (id: string) => boolean
113
115
  isNativePageORComponent: (templatePath: string) => boolean
114
116
  getPageById: (id: string) => VitePageMeta| undefined
117
+ getComponentById: (id: string) => VitePageMeta| undefined
115
118
  getConfigFilePath: (filePath: string) => string
116
119
  getTargetFilePath: (filePath: string, targetExtName: string) => string
117
120
  }
@@ -126,11 +129,14 @@ export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildCo
126
129
  }
127
130
 
128
131
  export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarmonyBuildConfig> {
132
+ nativeExt: string[]
129
133
  fileType: ViteFileType
130
134
  commonChunks: string[]
135
+ nativeComponents : Map<string, ViteNativeCompMeta>
131
136
  getCommonChunks: () => string[]
132
137
  modifyHarmonyConfig: (config: Partial<AppConfig>) => void
133
138
  modifyHostPackageDep: (outDir: string, deps?: Record<string, string>, devDeps?: Record<string, string>) => void
139
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
134
140
  getScriptPath: (filePath: string) => string
135
141
  getStylePath: (filePath: string) => string
136
142
  getConfigPath: (filePath: string) => string
package/types/global.d.ts CHANGED
@@ -419,7 +419,8 @@ declare namespace TaroGeneral {
419
419
  WEB = 'WEB',
420
420
  RN = 'RN',
421
421
  HARMONY = 'HARMONY',
422
- QUICKAPP = 'QUICKAPP'
422
+ QUICKAPP = 'QUICKAPP',
423
+ HARMONYHYBRID = 'HARMONYHYBRID'
423
424
  }
424
425
 
425
426
  type TDeviceRatio = Record<string, number>
package/types/index.d.ts CHANGED
@@ -3,51 +3,64 @@
3
3
  *
4
4
  * 目录结构
5
5
  * ├── api 小程序端能力 API
6
- * │ ├── ad
6
+ * │   ├── ad
7
7
  * │ │ └── index.d.ts 广告 API
8
- * │ ├── alipay
8
+ * │   ├── ai
9
+ * │   │   ├── face.d.ts 人脸检测 API
10
+ * │   │   ├── inference.d.ts AI 推理 API
11
+ * │   │   └── visionkit.d.ts 视觉算法 API
12
+ * │   ├── alipay
9
13
  * │ │ └── index.d.ts 支付宝小程序 API
10
- * │ ├── base
14
+ * │   ├── base
11
15
  * │ │ ├── index.d.ts 基础 API
16
+ * │   │   ├── crypto.d.ts 基础 -> 加密 API
12
17
  * │ │ ├── debug.d.ts 基础 -> 调试 API
18
+ * │   │   ├── env.d.ts 基础 -> ENV
19
+ * │   │   ├── performance.d.ts
13
20
  * │ │ ├── system.d.ts 基础 -> 系统 API
14
- * │ ├── update.d.ts 基础 -> 更新 API
15
- * │ ├── weapp 基础 -> 小程序 API
16
- * │ ├── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
17
- * │ └── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
18
- * │ │ └── env.d.ts 基础 -> ENV
19
- * │ ├── canvas
21
+ * │      ├── update.d.ts 基础 -> 更新 API
22
+ * │      └── weapp 基础 -> 小程序 API
23
+ * │      ├── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
24
+ * │      └── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
25
+ * │   ├── canvas
20
26
  * │ │ └── index.d.ts 画布 API
21
- * │ ├── cloud
27
+ * │   ├── cloud
22
28
  * │ │ └── index.d.ts 微信小程序云开发 API
23
- * │ ├── device
29
+ * │   ├── data-analysis
30
+ * │ │ └── index.d.ts 数据分析 API
31
+ * │   ├── device
24
32
  * │ │ ├── accelerometer.d.ts 设备 -> 加速计 API
33
+ * │   │   ├── accessibility.d.ts 设备 -> 无障碍 API
25
34
  * │ │ ├── battery.d.ts 设备 -> 电量 API
26
- * │ ├── ble.d.ts 设备 -> 低功耗蓝牙 API
27
- * │ ├── bluetooth.d. 设备 -> 蓝牙 API
35
+ * │      ├── bluetooth-ble.d.ts 设备 -> 蓝牙-低功耗中心设备 API
36
+ * │      ├── bluetooth-peripheral.d.ts 设备 -> 蓝牙-低功耗外围设备 API
37
+ * │   │   ├── bluetooth.d.ts 设备 -> 蓝牙-通用 API
38
+ * │   │   ├── calendar.d.ts 设备 -> 日历 API
28
39
  * │ │ ├── clipboard.d.ts 设备 -> 剪贴板 API
29
40
  * │ │ ├── compass.d.ts 设备 -> 罗盘 API
30
41
  * │ │ ├── contact.d.ts 设备 -> 联系人 API
31
- * │ │ ├── motion.d.ts 设备 -> 设备方向 API
32
42
  * │ │ ├── gyroscope.d.ts 设备 -> 陀螺仪 API
33
43
  * │ │ ├── iBeacon.d.ts 设备 -> iBeacon API
34
- * │ ├── network.d.ts 设备 -> 网络 API
35
- * │ ├── nfc.d.ts 设备 -> NFC API
36
- * │ │ ├── performance.d.ts 设备 -> 性能 API
44
+ * │      ├── keyboard.d.ts 设备 -> 键盘 API
45
+ * │      ├── memory.d.ts 设备 -> 内存 API
46
+ * │ │ ├── motion.d.ts 设备 -> 设备方向 API
47
+ * │   │   ├── network.d.ts 设备 -> 网络 API
48
+ * │   │   ├── nfc.d.ts 设备 -> NFC 读写 API
37
49
  * │ │ ├── phone.d.ts 设备 -> 电话 API
38
50
  * │ │ ├── scan.d.ts 设备 -> 扫码 API
39
51
  * │ │ ├── screen.d.ts 设备 -> 屏幕 API
52
+ * │   │   ├── sms.d.ts 设备 -> 短信 API
40
53
  * │ │ ├── vibrate.d.ts 设备 -> 振动 API
41
54
  * │ │ └── wifi.d.ts 设备 -> Wi-Fi API
42
- * │ ├── ext
55
+ * │   ├── ext
43
56
  * │ │ └── index.d.ts 第三方平台 API
44
- * │ ├── files
57
+ * │   ├── files
45
58
  * │ │ └── index.d.ts 文件 API
46
- * │ ├── framework
59
+ * │   ├── framework
47
60
  * │ │ └── index.d.ts 小程序框架 API
48
- * │ ├── location
61
+ * │   ├── location
49
62
  * │ │ └── index.d.ts 位置 API
50
- * │ ├── media
63
+ * │   ├── media
51
64
  * │ │ ├── audio.d.ts 媒体 -> 音频 API
52
65
  * │ │ ├── background-audio.d.ts 媒体 -> 背景音频 API
53
66
  * │ │ ├── camera.d.ts 媒体 -> 相机 API
@@ -55,51 +68,72 @@
55
68
  * │ │ ├── image.d.ts 媒体 -> 图片 API
56
69
  * │ │ ├── live.d.ts 媒体 -> 实时音视频 API
57
70
  * │ │ ├── map.d.ts 媒体 -> 地图 API
71
+ * │   │   ├── media-recorder.d.ts 媒体 -> 画面录制器 API
58
72
  * │ │ ├── recorder.d.ts 媒体 -> 录音 API
59
- * │ ├── video.d.ts 媒体 -> 视频 API
73
+ * │      ├── video-decoder.d.ts 媒体 -> 视频解码器 API
60
74
  * │ │ └── video-processing.d.ts 媒体 -> 音视频合成 API
61
- * │ ├── network
75
+ * │ ├── video.d.ts 媒体 -> 视频 API
76
+ * │   │   └── voip.d.ts 媒体 -> 实时语音 API
77
+ * │   ├── navigate
78
+ * │   │   └── index.d.ts 跳转 API
79
+ * │   ├── network
62
80
  * │ │ ├── download.d.ts 网络 -> 下载 API
63
81
  * │ │ ├── mdns.d.ts 网络 -> mDNS API
64
82
  * │ │ ├── request.d.ts 网络 -> 发起请求 API
83
+ * │   │   ├── tcp.d.ts 网络 -> TCP 通信 API
65
84
  * │ │ ├── udp.d.ts 网络 -> UDP 通信 API
66
85
  * │ │ ├── upload.d.ts 网络 -> 上传 API
67
86
  * │ │ └── websocket.d.ts 网络 -> WebSocket API
68
- * │ ├── open-api
87
+ * │   ├── open-api
69
88
  * │ │ ├── account.d.ts 开放接口 -> 账号信息 API
70
89
  * │ │ ├── address.d.ts 开放接口 -> 收货地址 API
71
90
  * │ │ ├── authorize.d.ts 开放接口 -> 授权 API
72
91
  * │ │ ├── card.d.ts 开放接口 -> 卡券 API
73
- * ├── data-analysis.d.ts 开放接口 -> 数据分析 API
92
+ * | | ├── channels.d.ts 开放接口 -> 视频号 API
93
+ * | | ├── customer-service.d.ts 开放接口 -> 微信客服 API
94
+ * | | ├── device-voip.d.ts 开放接口 -> 音视频通话 API
74
95
  * │ │ ├── facial.d.ts 开放接口 -> 人脸识别 API // 在微信小程序文档已找不到
96
+ * │ │ ├── favorites.d.ts 开放接口 -> 收藏 API
97
+ * │ │ ├── group.d.ts 开放接口 -> 微信群 API
75
98
  * │ │ ├── invoice.d.ts 开放接口 -> 发票 API
99
+ * │   │   ├── license-plate.d.ts 开放接口 -> 车牌 API
76
100
  * │ │ ├── login.d.ts 开放接口 -> 登录 API
77
- * │ │ ├── navigate.d.ts 开放接口 -> 小程序跳转 API
78
- * │ │ ├── payment.d.ts 开放接口 -> 支付 API
79
- * │ │ ├── report.d.ts 开放接口 -> 数据上报 API
101
+ * │ │ ├── my-miniprogram.d.ts 开放接口 -> 我的小程序 API
102
+ * │ │ ├── privacy.d.ts 开放接口 -> 隐私信息授权 API
103
+ * │ │ ├── redpackage.d.ts 开放接口 -> 微信红包 API
80
104
  * │ │ ├── settings.d.ts 开放接口 -> 设置 API
81
105
  * │ │ ├── soter.d.ts 开放接口 -> 生物认证 API
106
+ * │ │ ├── sticker.d.ts 开放接口 -> 微信表情 API
82
107
  * | | ├── subscribe-message.d.ts 开放接口 -> 订阅消息 API
83
108
  * │ │ ├── user-info.d.ts 开放接口 -> 用户信息 API
84
- * │ │ ├── customer-service.d.ts 开放接口 -> 微信客服 API
85
109
  * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
86
- * │ ├── route
110
+ * │   ├── payment
111
+ * │   │   └── index.d.ts 支付 API
112
+ * │   ├── qq
113
+ * │   │   └── index.d.ts QQ 小程序 API
114
+ * │   ├── route
87
115
  * │ │ └── index.d.ts 路由 API
88
- * │ ├── share
116
+ * │   ├── share
89
117
  * │ │ └── index.d.ts 转发 API
90
- * │ ├── skyline
118
+ * │   ├── skyline
91
119
  * │ │ └── index.d.ts 微信 Skyline API
92
- * │ ├── storage
120
+ * │   ├── storage
93
121
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
94
- * │ └── index.d.ts 数据缓存 API
95
- * │ ├── swan
122
+ * │      ├── cache-manager.d.ts 数据缓存 -> 缓存管理 API
123
+ * │   │   └── index.d.ts 数据缓存 API
124
+ * │   ├── swan
125
+ * │   │   ├── bookshelf.d.ts 百度小程序 -> 书架 API
126
+ * │   │   ├── download-package.d.ts 百度小程序 -> 下载包 API
96
127
  * │ │ └── index.d.ts 百度小程序 API
97
- * │ ├── ui
128
+ * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
+ * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
+ * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
+ * │   ├── ui
98
132
  * │ │ ├── animation.d.ts 界面 -> 动画 API
99
133
  * │ │ ├── background.d.ts 界面 -> 背景 API
100
134
  * │ │ ├── custom-component.d.ts 界面 -> 自定义组件 API
101
135
  * │ │ ├── fonts.d.ts 界面 -> 字体 API
102
- * │ ├── keyboard.d.ts 界面 -> 键盘 API
136
+ * │      ├── interaction.d.ts 界面 -> 交互 API
103
137
  * │ │ ├── menu.d.ts 界面 -> 菜单 API
104
138
  * │ │ ├── navigation-bar.d.ts 界面 -> 导航栏 API
105
139
  * │ │ ├── pull-down-refresh.d.ts 界面 -> 下拉刷新 API
@@ -107,14 +141,25 @@
107
141
  * │ │ ├── sticky.d.ts 界面 -> 置顶 API
108
142
  * │ │ ├── tab-bar.d.ts 界面 -> TabBar API
109
143
  * │ │ ├── window.d.ts 界面 -> 窗口 API
110
- * │ │ └── interaction.d.ts 界面 -> 交互 API
111
- * │ ├── worker
144
+ * │   ├── worker
112
145
  * │ │ └── index.d.ts Worker API
113
- * │ ├── wxml
146
+ * │   └── wxml
114
147
  * │ │ └── index.d.ts WXML API
115
- * ├── taro.extend.d.ts Taro 扩展 API 类型定义
116
- * │ └── taro.hooks.d.ts Taro Hooks 类型定义
148
+ * ├── compile
149
+ * │   ├── compiler.d.ts
150
+ * │   ├── config
151
+ * │   │   ├── h5.d.ts
152
+ * │   │   ├── index.d.ts
153
+ * │   │   ├── manifest.d.ts
154
+ * │   │   ├── mini.d.ts
155
+ * │   │   ├── project.d.ts
156
+ * │   │   ├── rn.d.ts
157
+ * │   │   └── util.d.ts
158
+ * │   ├── hooks.d.ts Taro Hooks 类型定义
159
+ * │   └── index.d.ts
160
+ * ├── global.d.ts
117
161
  * ├── index.d.ts 此文件
162
+ * ├── taro.api.d.ts
118
163
  * ├── taro.component.d.ts Taro Component 类型定义
119
164
  * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
120
165
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
@@ -126,6 +171,7 @@
126
171
  /// <reference path="taro.component.d.ts" />
127
172
  /// <reference path="taro.config.d.ts" />
128
173
  /// <reference path="taro.lifecycle.d.ts" />
174
+ /// <reference path="taro.runtime.d.ts" />
129
175
 
130
176
  /// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
131
177
  /// <reference types="@tarojs/plugin-platform-jd/types/shims-jd" />
@@ -145,6 +191,6 @@ declare namespace Taro {
145
191
  interface TaroStatic {}
146
192
  }
147
193
  declare global {
148
- const defineAppConfig: (config: Taro.Config) => Taro.Config
149
- const definePageConfig: (config: Taro.Config) => Taro.Config
194
+ const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
195
+ const definePageConfig: (config: Taro.PageConfig) => Taro.Config
150
196
  }
@@ -59,26 +59,30 @@
59
59
  /// <reference path="api/media/video-decoder.d.ts" />
60
60
  /// <reference path="api/location/index.d.ts" />
61
61
  /// <reference path="api/files/index.d.ts" />
62
- /// <reference path="api/open-api/login.d.ts" />
62
+
63
63
  /// <reference path="api/open-api/account.d.ts" />
64
- /// <reference path="api/open-api/user-info.d.ts" />
65
- /// <reference path="api/open-api/authorize.d.ts" />
66
- /// <reference path="api/open-api/settings.d.ts" />
67
64
  /// <reference path="api/open-api/address.d.ts" />
65
+ /// <reference path="api/open-api/authorize.d.ts" />
68
66
  /// <reference path="api/open-api/card.d.ts" />
69
- /// <reference path="api/open-api/invoice.d.ts" />
70
- /// <reference path="api/open-api/soter.d.ts" />
71
- /// <reference path="api/open-api/werun.d.ts" />
72
- /// <reference path="api/open-api/subscribe-message.d.ts" />
73
- /// <reference path="api/open-api/redpackage.d.ts" />
74
- /// <reference path="api/open-api/favorites.d.ts" />
75
- /// <reference path="api/open-api/my-miniprogram.d.ts" />
76
- /// <reference path="api/open-api/license-plate.d.ts" />
77
67
  /// <reference path="api/open-api/channels.d.ts" />
68
+ /// <reference path="api/open-api/customer-service.d.ts" />
78
69
  /// <reference path="api/open-api/device-voip.d.ts" />
70
+ /// <reference path="api/open-api/facial.d.ts" />
71
+ /// <reference path="api/open-api/favorites.d.ts" />
79
72
  /// <reference path="api/open-api/group.d.ts" />
73
+ /// <reference path="api/open-api/invoice.d.ts" />
74
+ /// <reference path="api/open-api/license-plate.d.ts" />
75
+ /// <reference path="api/open-api/login.d.ts" />
76
+ /// <reference path="api/open-api/my-miniprogram.d.ts" />
80
77
  /// <reference path="api/open-api/privacy.d.ts" />
81
- /// <reference path="api/open-api/customer-service.d.ts" />
78
+ /// <reference path="api/open-api/redpackage.d.ts" />
79
+ /// <reference path="api/open-api/settings.d.ts" />
80
+ /// <reference path="api/open-api/soter.d.ts" />
81
+ /// <reference path="api/open-api/sticker.d.ts" />
82
+ /// <reference path="api/open-api/subscribe-message.d.ts" />
83
+ /// <reference path="api/open-api/user-info.d.ts" />
84
+ /// <reference path="api/open-api/werun.d.ts" />
85
+
82
86
  /// <reference path="api/device/bluetooth.d.ts" />
83
87
  /// <reference path="api/device/bluetooth-ble.d.ts" />
84
88
  /// <reference path="api/device/bluetooth-peripheral.d.ts" />
@@ -112,11 +116,15 @@
112
116
  /// <reference path="api/skyline/index.d.ts" />
113
117
 
114
118
  /// <reference path="api/cloud/index.d.ts" />
115
- /// <reference path="api/open-api/facial.d.ts" />
116
119
 
117
120
  /// <reference path="api/alipay/index.d.ts" />
118
121
  /// <reference path="api/qq/index.d.ts" />
122
+
123
+ /// <reference path="api/swan/bookshelf.d.ts" />
124
+ /// <reference path="api/swan/download-package.d.ts" />
119
125
  /// <reference path="api/swan/index.d.ts" />
126
+ /// <reference path="api/swan/pay.d.ts" />
127
+
120
128
 
121
129
  /// <reference path="api/taro.extend.d.ts" />
122
130
  /// <reference path="api/taro.hooks.d.ts" />
@@ -10,9 +10,11 @@ declare module './index' {
10
10
  */
11
11
  navigationBarBackgroundColor?: string
12
12
  /** 导航栏标题颜色,仅支持 black/white
13
+ * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
14
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
13
15
  * @default: "white"
14
16
  */
15
- navigationBarTextStyle?: 'white' | 'black'
17
+ navigationBarTextStyle?: 'white' | 'black' | string
16
18
  /** 导航栏标题文字内容 */
17
19
  navigationBarTitleText?: string
18
20
  /** 导航栏样式,仅支持以下值:
@@ -31,9 +33,11 @@ declare module './index' {
31
33
  */
32
34
  backgroundColor?: string
33
35
  /** 下拉背景字体、loading 图的样式,仅支持 dark/light
36
+ * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
37
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
34
38
  * @default: "dark"
35
39
  */
36
- backgroundTextStyle?: 'dark' | 'light'
40
+ backgroundTextStyle?: 'dark' | 'light' | string
37
41
  /** 顶部窗口的背景色,仅 iOS 支持
38
42
  * @default: "#ffffff"
39
43
  */
@@ -56,9 +56,12 @@ declare module './index' {
56
56
  }
57
57
 
58
58
  interface PageResizeObject {
59
+ deviceOrientation?: 'portrait' | 'landscape'
59
60
  size: {
60
61
  windowWidth: number
61
62
  windowHeight: number
63
+ screenWidth?: number
64
+ screenHeight?: number
62
65
  }
63
66
  }
64
67
 
@@ -0,0 +1,9 @@
1
+ import type { options } from '@tarojs/runtime'
2
+
3
+ import Taro from './index'
4
+
5
+ declare module './index' {
6
+ interface TaroStatic {
7
+ options: typeof options
8
+ }
9
+ }