@tarojs/taro 3.8.0-canary.0 → 4.0.0-alpha.2

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 (101) hide show
  1. package/html.css +9 -0
  2. package/package.json +16 -4
  3. package/types/api/ad/index.d.ts +6 -18
  4. package/types/api/ai/inference.d.ts +4 -8
  5. package/types/api/ai/visionkit.d.ts +625 -54
  6. package/types/api/base/debug.d.ts +8 -8
  7. package/types/api/base/env.d.ts +1 -1
  8. package/types/api/base/index.d.ts +3 -3
  9. package/types/api/base/performance.d.ts +5 -5
  10. package/types/api/base/system.d.ts +6 -6
  11. package/types/api/base/weapp/app-event.d.ts +10 -10
  12. package/types/api/base/weapp/life-cycle.d.ts +1 -1
  13. package/types/api/canvas/index.d.ts +389 -72
  14. package/types/api/data-analysis/index.d.ts +51 -1
  15. package/types/api/device/accelerometer.d.ts +8 -6
  16. package/types/api/device/accessibility.d.ts +1 -1
  17. package/types/api/device/battery.d.ts +3 -3
  18. package/types/api/device/bluetooth-ble.d.ts +40 -17
  19. package/types/api/device/bluetooth-peripheral.d.ts +26 -26
  20. package/types/api/device/bluetooth.d.ts +37 -13
  21. package/types/api/device/calendar.d.ts +11 -1
  22. package/types/api/device/clipboard.d.ts +17 -17
  23. package/types/api/device/compass.d.ts +5 -5
  24. package/types/api/device/gyroscope.d.ts +4 -4
  25. package/types/api/device/iBeacon.d.ts +10 -8
  26. package/types/api/device/keyboard.d.ts +7 -5
  27. package/types/api/device/memory.d.ts +3 -4
  28. package/types/api/device/motion.d.ts +8 -6
  29. package/types/api/device/network.d.ts +12 -6
  30. package/types/api/device/nfc.d.ts +13 -13
  31. package/types/api/device/phone.d.ts +1 -1
  32. package/types/api/device/scan.d.ts +5 -3
  33. package/types/api/device/screen.d.ts +28 -12
  34. package/types/api/device/sms.d.ts +1 -1
  35. package/types/api/device/vibrate.d.ts +5 -5
  36. package/types/api/device/wifi.d.ts +25 -13
  37. package/types/api/files/index.d.ts +73 -43
  38. package/types/api/framework/index.d.ts +2 -2
  39. package/types/api/location/index.d.ts +167 -19
  40. package/types/api/media/audio.d.ts +71 -42
  41. package/types/api/media/background-audio.d.ts +1 -1
  42. package/types/api/media/camera.d.ts +6 -3
  43. package/types/api/media/image.d.ts +5 -5
  44. package/types/api/media/video.d.ts +11 -11
  45. package/types/api/navigate/index.d.ts +3 -1
  46. package/types/api/network/download.d.ts +7 -15
  47. package/types/api/network/request.d.ts +7 -7
  48. package/types/api/network/upload.d.ts +9 -17
  49. package/types/api/network/websocket.d.ts +8 -8
  50. package/types/api/open-api/account.d.ts +1 -1
  51. package/types/api/open-api/address.d.ts +13 -5
  52. package/types/api/open-api/authorize.d.ts +1 -1
  53. package/types/api/open-api/channels.d.ts +16 -0
  54. package/types/api/open-api/device-voip.d.ts +42 -2
  55. package/types/api/open-api/invoice.d.ts +1 -1
  56. package/types/api/open-api/login.d.ts +16 -3
  57. package/types/api/open-api/my-miniprogram.d.ts +2 -2
  58. package/types/api/open-api/privacy.d.ts +107 -0
  59. package/types/api/open-api/settings.d.ts +3 -2
  60. package/types/api/open-api/sticker.d.ts +83 -0
  61. package/types/api/open-api/subscribe-message.d.ts +148 -6
  62. package/types/api/open-api/user-info.d.ts +6 -1
  63. package/types/api/qq/index.d.ts +306 -1
  64. package/types/api/route/index.d.ts +8 -5
  65. package/types/api/skyline/index.d.ts +59 -0
  66. package/types/api/storage/background-fetch.d.ts +63 -11
  67. package/types/api/storage/cache-manager.d.ts +61 -10
  68. package/types/api/storage/index.d.ts +125 -10
  69. package/types/api/swan/bookshelf.d.ts +307 -0
  70. package/types/api/swan/download-package.d.ts +80 -0
  71. package/types/api/swan/index.d.ts +151 -0
  72. package/types/api/swan/pay.d.ts +139 -0
  73. package/types/api/taro.extend.d.ts +15 -6
  74. package/types/api/taro.hooks.d.ts +9 -9
  75. package/types/api/ui/animation.d.ts +32 -32
  76. package/types/api/ui/custom-component.d.ts +1 -1
  77. package/types/api/ui/fonts.d.ts +4 -3
  78. package/types/api/ui/interaction.d.ts +6 -6
  79. package/types/api/ui/menu.d.ts +1 -1
  80. package/types/api/ui/navigation-bar.d.ts +5 -5
  81. package/types/api/ui/pull-down-refresh.d.ts +2 -2
  82. package/types/api/ui/scroll.d.ts +1 -1
  83. package/types/api/ui/tab-bar.d.ts +8 -8
  84. package/types/api/ui/window.d.ts +2 -2
  85. package/types/api/wxml/index.d.ts +19 -19
  86. package/types/compile/compiler.d.ts +9 -4
  87. package/types/compile/config/h5.d.ts +23 -10
  88. package/types/compile/config/harmony.d.ts +82 -0
  89. package/types/compile/config/index.d.ts +1 -0
  90. package/types/compile/config/mini.d.ts +58 -30
  91. package/types/compile/config/plugin.d.ts +34 -0
  92. package/types/compile/config/project.d.ts +26 -13
  93. package/types/compile/config/util.d.ts +22 -8
  94. package/types/compile/viteCompilerContext.d.ts +155 -0
  95. package/types/global.d.ts +3 -1
  96. package/types/index.d.ts +92 -44
  97. package/types/taro.api.d.ts +24 -13
  98. package/types/taro.component.d.ts +2 -1
  99. package/types/taro.config.d.ts +47 -6
  100. package/types/taro.lifecycle.d.ts +3 -0
  101. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,155 @@
1
+ import type { RecursiveTemplate, UnRecursiveTemplate } from '@tarojs/shared/dist/template'
2
+ import type { PluginContext } from 'rollup'
3
+ import type { AppConfig, PageConfig } from '../index'
4
+ import type { IMiniFilesConfig, IH5Config, IHarmonyConfig, IMiniAppConfig } from './config'
5
+ import type { IProjectConfig } from './config/project'
6
+ import type { IComponentConfig } from './hooks'
7
+
8
+ export interface ViteNativeCompMeta {
9
+ name: string
10
+ scriptPath: string
11
+ configPath: string
12
+ config: PageConfig
13
+ isNative: true
14
+ templatePath: string
15
+ cssPath?: string
16
+ }
17
+
18
+ export interface ViteFileType {
19
+ config: string
20
+ script: string
21
+ templ: string
22
+ style: string
23
+ xs?: string
24
+ }
25
+
26
+ export interface ViteAppMeta {
27
+ name: string
28
+ scriptPath: string
29
+ configPath: string
30
+ config: AppConfig
31
+ isNative: false
32
+ }
33
+
34
+ export interface VitePageMeta {
35
+ name: string
36
+ scriptPath: string
37
+ configPath: string
38
+ config: PageConfig
39
+ isNative: boolean
40
+ templatePath?: string
41
+ cssPath?: string
42
+ }
43
+
44
+
45
+ export interface ViteH5BuildConfig extends CommonBuildConfig, IH5Config<'vite'> {
46
+ entryFileName?: string
47
+ runtimePath?: string | string[]
48
+ }
49
+
50
+ export interface ViteHarmonyBuildConfig extends CommonBuildConfig, IHarmonyConfig {
51
+ fileType: IFileType
52
+ useETS?: boolean
53
+ useJSON5?: boolean
54
+ blended?: boolean
55
+ runtimePath?: string | string[]
56
+ taroComponentsPath: string
57
+ }
58
+
59
+ export interface CommonBuildConfig extends IProjectConfig<'vite'> {
60
+ entry: {
61
+ app: string | string[]
62
+ }
63
+ mode: 'production' | 'development' | 'none'
64
+ buildAdapter: string // weapp | swan | alipay | tt | qq | jd | h5
65
+ platformType: string // mini | web
66
+ /** special mode */
67
+ isBuildNativeComp?: boolean
68
+ /** hooks */
69
+ onCompilerMake: (compilation) => Promise<any>
70
+ onParseCreateElement: (nodeName, componentConfig) => Promise<any>
71
+ }
72
+
73
+
74
+ export interface ViteMiniBuildConfig extends CommonBuildConfig, IMiniAppConfig<'vite'> {
75
+ isBuildPlugin: boolean
76
+ isSupportRecursive: boolean
77
+ isSupportXS: boolean
78
+ nodeModulesPath: string
79
+ fileType: ViteFileType
80
+ globalObject: string
81
+ template: RecursiveTemplate | UnRecursiveTemplate
82
+ runtimePath?: string | string[]
83
+ taroComponentsPath?: string
84
+ blended?: boolean
85
+ hot?: boolean
86
+ injectOptions?: {
87
+ include?: Record<string, string | string[]>
88
+ exclude?: string[]
89
+ }
90
+ /** hooks */
91
+ modifyComponentConfig: (componentConfig: IComponentConfig, config: Partial<ViteMiniBuildConfig>) => Promise<any>
92
+ }
93
+
94
+ export interface ViteCompilerContext<T> {
95
+ cwd: string
96
+ sourceDir: string
97
+ taroConfig: T
98
+ rawTaroConfig: T
99
+ frameworkExts: string[]
100
+ app: ViteAppMeta
101
+ pages: VitePageMeta[]
102
+ components?: VitePageMeta[]
103
+ loaderMeta: any
104
+ logger
105
+ filesConfig: IMiniFilesConfig
106
+ configFileList: string[]
107
+ compilePage: (pageName: string) => VitePageMeta
108
+ watchConfigFile: (rollupCtx: PluginContext) => void
109
+ getAppScriptPath: () => string
110
+ getApp: () => ViteAppMeta
111
+ getPages: () => VitePageMeta[]
112
+ isApp: (id: string) => boolean
113
+ isPage: (id: string) => boolean
114
+ isComponent: (id: string) => boolean
115
+ isNativePageORComponent: (templatePath: string) => boolean
116
+ getPageById: (id: string) => VitePageMeta| undefined
117
+ getComponentById: (id: string) => VitePageMeta| undefined
118
+ getConfigFilePath: (filePath: string) => string
119
+ getTargetFilePath: (filePath: string, targetExtName: string) => string
120
+ }
121
+
122
+ export interface ViteH5CompilerContext extends ViteCompilerContext<ViteH5BuildConfig> {
123
+ getBrowserslist: () => void
124
+ routerMeta: {
125
+ routerCreator: string
126
+ getRoutesConfig: (pageName?: string) => string
127
+ }
128
+ browserslist: string[]
129
+ }
130
+
131
+ export interface ViteHarmonyCompilerContext extends ViteCompilerContext<ViteHarmonyBuildConfig> {
132
+ nativeExt: string[]
133
+ fileType: ViteFileType
134
+ commonChunks: string[]
135
+ nativeComponents : Map<string, ViteNativeCompMeta>
136
+ getCommonChunks: () => string[]
137
+ modifyHarmonyConfig: (config: Partial<AppConfig>) => void
138
+ modifyHostPackageDep: (outDir: string, deps?: Record<string, string>, devDeps?: Record<string, string>) => void
139
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
140
+ getScriptPath: (filePath: string) => string
141
+ getStylePath: (filePath: string) => string
142
+ getConfigPath: (filePath: string) => string
143
+ }
144
+
145
+ export interface ViteMiniCompilerContext extends ViteCompilerContext<ViteMiniBuildConfig> {
146
+ fileType: ViteFileType
147
+ commonChunks: string[]
148
+ nativeComponents : Map<string, ViteNativeCompMeta>
149
+ getCommonChunks: () => string[]
150
+ collectNativeComponents: (meta: ViteAppMeta | VitePageMeta | ViteNativeCompMeta) => void
151
+ getScriptPath: (filePath: string) => string
152
+ getTemplatePath: (filePath: string) => string
153
+ getStylePath: (filePath: string) => string
154
+ getConfigPath: (filePath: string) => string
155
+ }
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
  /** 触发事件参数 */
@@ -418,7 +419,8 @@ declare namespace TaroGeneral {
418
419
  WEB = 'WEB',
419
420
  RN = 'RN',
420
421
  HARMONY = 'HARMONY',
421
- QUICKAPP = 'QUICKAPP'
422
+ QUICKAPP = 'QUICKAPP',
423
+ HARMONYHYBRID = 'HARMONYHYBRID'
422
424
  }
423
425
 
424
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,49 +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
- * │ ├── storage
118
+ * │   ├── skyline
119
+ * │ │ └── index.d.ts 微信 Skyline API
120
+ * │   ├── storage
91
121
  * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
92
- * │ └── index.d.ts 数据缓存 API
93
- * │ ├── 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
94
127
  * │ │ └── index.d.ts 百度小程序 API
95
- * │ ├── ui
128
+ * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
+ * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
+ * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
+ * │   ├── ui
96
132
  * │ │ ├── animation.d.ts 界面 -> 动画 API
97
133
  * │ │ ├── background.d.ts 界面 -> 背景 API
98
134
  * │ │ ├── custom-component.d.ts 界面 -> 自定义组件 API
99
135
  * │ │ ├── fonts.d.ts 界面 -> 字体 API
100
- * │ ├── keyboard.d.ts 界面 -> 键盘 API
136
+ * │      ├── interaction.d.ts 界面 -> 交互 API
101
137
  * │ │ ├── menu.d.ts 界面 -> 菜单 API
102
138
  * │ │ ├── navigation-bar.d.ts 界面 -> 导航栏 API
103
139
  * │ │ ├── pull-down-refresh.d.ts 界面 -> 下拉刷新 API
@@ -105,14 +141,25 @@
105
141
  * │ │ ├── sticky.d.ts 界面 -> 置顶 API
106
142
  * │ │ ├── tab-bar.d.ts 界面 -> TabBar API
107
143
  * │ │ ├── window.d.ts 界面 -> 窗口 API
108
- * │ │ └── interaction.d.ts 界面 -> 交互 API
109
- * │ ├── worker
144
+ * │   ├── worker
110
145
  * │ │ └── index.d.ts Worker API
111
- * │ ├── wxml
146
+ * │   └── wxml
112
147
  * │ │ └── index.d.ts WXML API
113
- * ├── taro.extend.d.ts Taro 扩展 API 类型定义
114
- * │ └── 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
115
161
  * ├── index.d.ts 此文件
162
+ * ├── taro.api.d.ts
116
163
  * ├── taro.component.d.ts Taro Component 类型定义
117
164
  * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
118
165
  * └── taro.lifecycle.d.ts Taro 生命周期类型定义
@@ -124,6 +171,7 @@
124
171
  /// <reference path="taro.component.d.ts" />
125
172
  /// <reference path="taro.config.d.ts" />
126
173
  /// <reference path="taro.lifecycle.d.ts" />
174
+ /// <reference path="taro.runtime.d.ts" />
127
175
 
128
176
  /// <reference types="@tarojs/plugin-platform-alipay/types/shims-alipay" />
129
177
  /// <reference types="@tarojs/plugin-platform-jd/types/shims-jd" />
@@ -143,6 +191,6 @@ declare namespace Taro {
143
191
  interface TaroStatic {}
144
192
  }
145
193
  declare global {
146
- const defineAppConfig: (config: Taro.Config) => Taro.Config
147
- const definePageConfig: (config: Taro.Config) => Taro.Config
194
+ const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
195
+ const definePageConfig: (config: Taro.PageConfig) => Taro.Config
148
196
  }
@@ -59,24 +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/license-plate.d.ts" />
76
67
  /// <reference path="api/open-api/channels.d.ts" />
68
+ /// <reference path="api/open-api/customer-service.d.ts" />
77
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" />
78
72
  /// <reference path="api/open-api/group.d.ts" />
79
- /// <reference path="api/open-api/customer-service.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" />
77
+ /// <reference path="api/open-api/privacy.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
+
80
86
  /// <reference path="api/device/bluetooth.d.ts" />
81
87
  /// <reference path="api/device/bluetooth-ble.d.ts" />
82
88
  /// <reference path="api/device/bluetooth-peripheral.d.ts" />
@@ -107,13 +113,18 @@
107
113
  /// <reference path="api/wxml/index.d.ts" />
108
114
  /// <reference path="api/ext/index.d.ts" />
109
115
  /// <reference path="api/ad/index.d.ts" />
116
+ /// <reference path="api/skyline/index.d.ts" />
110
117
 
111
118
  /// <reference path="api/cloud/index.d.ts" />
112
- /// <reference path="api/open-api/facial.d.ts" />
113
119
 
114
120
  /// <reference path="api/alipay/index.d.ts" />
115
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" />
116
125
  /// <reference path="api/swan/index.d.ts" />
126
+ /// <reference path="api/swan/pay.d.ts" />
127
+
117
128
 
118
129
  /// <reference path="api/taro.extend.d.ts" />
119
130
  /// <reference path="api/taro.hooks.d.ts" />
@@ -51,6 +51,7 @@ declare module './index' {
51
51
  onReachBottom?(): void
52
52
  onResize?(opt: PageResizeObject): void
53
53
  onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
54
+ onShareTimeline?(): ShareTimelineReturnObject
54
55
  onTabItemTap?(opt: TabItemTapObject): void
55
56
  onTitleClick?(): void
56
57
  onUnload(): void
@@ -89,7 +90,7 @@ declare module './index' {
89
90
  /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
90
91
  createSelectorQuery?(): SelectorQuery
91
92
  /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
92
- createIntersectionObserver?(): IntersectionObserver
93
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
93
94
  /** 创建一个 MediaQueryObserver 对象 */
94
95
  createMediaQueryObserver?(): MediaQueryObserver
95
96
  /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
@@ -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
  */
@@ -175,6 +179,12 @@ declare module './index' {
175
179
  * @default false
176
180
  */
177
181
  enableShareTimeline?: boolean
182
+ /**
183
+ * 页面是否需要使用 \<page-meta\> 和 \<navigation-bar\> 组件
184
+ * @default false
185
+ * @support weapp, alipay
186
+ */
187
+ enablePageMeta?: boolean
178
188
  /** 页面自定义组件配置
179
189
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
180
190
  */
@@ -363,16 +373,41 @@ declare module './index' {
363
373
 
364
374
  interface RenderOptions {
365
375
  skyline: {
366
- /**
367
- * 开启默认Block布局
376
+ /** 开启默认Block布局
368
377
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/wxss.html#%E5%BC%80%E5%90%AF%E9%BB%98%E8%AE%A4Block%E5%B8%83%E5%B1%80
378
+ * @supported weapp
369
379
  */
370
380
  defaultDisplayBlock?: boolean
371
- /**
372
- * 关闭 Skyline AB 实验
381
+ /** 关闭 Skyline AB 实验
373
382
  * @see https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/migration/release.html#%E5%8F%91%E5%B8%83%E4%B8%8A%E7%BA%BF
383
+ * @supported weapp
374
384
  */
375
385
  disableABTest?: boolean
386
+ /** 基础库最低版本
387
+ * @supported weapp
388
+ */
389
+ sdkVersionBegin?: string
390
+ /** 基础库最高版本
391
+ * @supported weapp
392
+ */
393
+ sdkVersionEnd?: string
394
+ /** iOS 微信最低版本
395
+ * @supported weapp
396
+ */
397
+ iosVersionBegin?: string
398
+ /** iOS 微信最高版本
399
+ * @supported weapp
400
+ */
401
+ iosVersionEnd?: string
402
+ /** 安卓微信最低版本
403
+ * @supported weapp
404
+ */
405
+ androidVersionBegin?: string
406
+ /** 安卓微信最高版本
407
+ * @supported weapp
408
+ */
409
+ androidVersionEnd?: string
410
+ [key: string]: unknown
376
411
  }
377
412
  }
378
413
 
@@ -622,6 +657,12 @@ declare module './index' {
622
657
  */
623
658
  useAuthorizePage: boolean
624
659
  }
660
+ /**
661
+ * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
662
+ * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
663
+ * @supported weapp
664
+ */
665
+ __usePrivacyCheck__?: boolean
625
666
  /**
626
667
  * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
627
668
  * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90
@@ -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
+ }