@spcsn/taro 0.1.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.
Files changed (140) hide show
  1. package/README.md +12 -0
  2. package/dist/index.js +147 -0
  3. package/dist/index.js.map +1 -0
  4. package/index.js +9 -0
  5. package/package.json +86 -0
  6. package/types/api/ad/index.d.ts +197 -0
  7. package/types/api/ai/face.d.ts +133 -0
  8. package/types/api/ai/inference.d.ts +129 -0
  9. package/types/api/ai/visionkit.d.ts +874 -0
  10. package/types/api/alipay/index.d.ts +69 -0
  11. package/types/api/base/crypto.d.ts +104 -0
  12. package/types/api/base/debug.d.ts +329 -0
  13. package/types/api/base/env.d.ts +19 -0
  14. package/types/api/base/index.d.ts +102 -0
  15. package/types/api/base/performance.d.ts +258 -0
  16. package/types/api/base/system.d.ts +742 -0
  17. package/types/api/base/update.d.ts +130 -0
  18. package/types/api/base/weapp/app-event.d.ts +265 -0
  19. package/types/api/base/weapp/life-cycle.d.ts +155 -0
  20. package/types/api/canvas/index.d.ts +2162 -0
  21. package/types/api/cloud/index.d.ts +2622 -0
  22. package/types/api/data-analysis/index.d.ts +122 -0
  23. package/types/api/device/accelerometer.d.ts +102 -0
  24. package/types/api/device/accessibility.d.ts +26 -0
  25. package/types/api/device/battery.d.ts +46 -0
  26. package/types/api/device/bluetooth-ble.d.ts +601 -0
  27. package/types/api/device/bluetooth-peripheral.d.ts +430 -0
  28. package/types/api/device/bluetooth.d.ts +463 -0
  29. package/types/api/device/calendar.d.ts +98 -0
  30. package/types/api/device/clipboard.d.ts +81 -0
  31. package/types/api/device/compass.d.ts +105 -0
  32. package/types/api/device/contact.d.ts +110 -0
  33. package/types/api/device/gyroscope.d.ts +85 -0
  34. package/types/api/device/iBeacon.d.ts +168 -0
  35. package/types/api/device/keyboard.d.ts +97 -0
  36. package/types/api/device/memory.d.ts +52 -0
  37. package/types/api/device/motion.d.ts +88 -0
  38. package/types/api/device/network.d.ts +172 -0
  39. package/types/api/device/nfc.d.ts +1238 -0
  40. package/types/api/device/phone.d.ts +30 -0
  41. package/types/api/device/scan.d.ts +111 -0
  42. package/types/api/device/screen.d.ts +217 -0
  43. package/types/api/device/sms.d.ts +26 -0
  44. package/types/api/device/vibrate.d.ts +51 -0
  45. package/types/api/device/wifi.d.ts +301 -0
  46. package/types/api/ext/index.d.ts +64 -0
  47. package/types/api/files/index.d.ts +1472 -0
  48. package/types/api/framework/index.d.ts +51 -0
  49. package/types/api/location/index.d.ts +517 -0
  50. package/types/api/media/audio.d.ts +1013 -0
  51. package/types/api/media/background-audio.d.ts +291 -0
  52. package/types/api/media/camera.d.ts +207 -0
  53. package/types/api/media/editor.d.ts +239 -0
  54. package/types/api/media/image.d.ts +469 -0
  55. package/types/api/media/live.d.ts +461 -0
  56. package/types/api/media/map.d.ts +638 -0
  57. package/types/api/media/media-recorder.d.ts +117 -0
  58. package/types/api/media/recorder.d.ts +317 -0
  59. package/types/api/media/video-decoder.d.ts +117 -0
  60. package/types/api/media/video-processing.d.ts +84 -0
  61. package/types/api/media/video.d.ts +527 -0
  62. package/types/api/media/voip.d.ts +393 -0
  63. package/types/api/navigate/index.d.ts +327 -0
  64. package/types/api/network/download.d.ts +173 -0
  65. package/types/api/network/mdns.d.ts +191 -0
  66. package/types/api/network/request.d.ts +480 -0
  67. package/types/api/network/tcp.d.ts +181 -0
  68. package/types/api/network/udp.d.ts +218 -0
  69. package/types/api/network/upload.d.ts +201 -0
  70. package/types/api/network/websocket.d.ts +383 -0
  71. package/types/api/open-api/account.d.ts +51 -0
  72. package/types/api/open-api/address.d.ts +68 -0
  73. package/types/api/open-api/authorize.d.ts +80 -0
  74. package/types/api/open-api/card.d.ts +110 -0
  75. package/types/api/open-api/channels.d.ts +225 -0
  76. package/types/api/open-api/customer-service.d.ts +45 -0
  77. package/types/api/open-api/device-voip.d.ts +103 -0
  78. package/types/api/open-api/facial.d.ts +98 -0
  79. package/types/api/open-api/favorites.d.ts +101 -0
  80. package/types/api/open-api/group.d.ts +59 -0
  81. package/types/api/open-api/invoice.d.ts +87 -0
  82. package/types/api/open-api/license-plate.d.ts +27 -0
  83. package/types/api/open-api/login.d.ts +115 -0
  84. package/types/api/open-api/my-miniprogram.d.ts +28 -0
  85. package/types/api/open-api/privacy.d.ts +107 -0
  86. package/types/api/open-api/redpackage.d.ts +24 -0
  87. package/types/api/open-api/settings.d.ts +174 -0
  88. package/types/api/open-api/soter.d.ts +184 -0
  89. package/types/api/open-api/sticker.d.ts +83 -0
  90. package/types/api/open-api/subscribe-message.d.ts +305 -0
  91. package/types/api/open-api/user-info.d.ts +182 -0
  92. package/types/api/open-api/werun.d.ts +101 -0
  93. package/types/api/payment/index.d.ts +119 -0
  94. package/types/api/qq/index.d.ts +354 -0
  95. package/types/api/route/index.d.ts +324 -0
  96. package/types/api/share/index.d.ts +354 -0
  97. package/types/api/skyline/index.d.ts +345 -0
  98. package/types/api/storage/background-fetch.d.ts +131 -0
  99. package/types/api/storage/cache-manager.d.ts +249 -0
  100. package/types/api/storage/index.d.ts +405 -0
  101. package/types/api/swan/bookshelf.d.ts +307 -0
  102. package/types/api/swan/download-package.d.ts +80 -0
  103. package/types/api/swan/index.d.ts +251 -0
  104. package/types/api/swan/pay.d.ts +139 -0
  105. package/types/api/taro.extend.d.ts +233 -0
  106. package/types/api/taro.hooks.d.ts +148 -0
  107. package/types/api/ui/animation.d.ts +427 -0
  108. package/types/api/ui/background.d.ts +69 -0
  109. package/types/api/ui/custom-component.d.ts +23 -0
  110. package/types/api/ui/fonts.d.ts +77 -0
  111. package/types/api/ui/interaction.d.ts +281 -0
  112. package/types/api/ui/menu.d.ts +29 -0
  113. package/types/api/ui/navigation-bar.d.ts +130 -0
  114. package/types/api/ui/pull-down-refresh.d.ts +50 -0
  115. package/types/api/ui/scroll.d.ts +114 -0
  116. package/types/api/ui/sticky.d.ts +32 -0
  117. package/types/api/ui/tab-bar.d.ts +196 -0
  118. package/types/api/ui/window.d.ts +71 -0
  119. package/types/api/worker/index.d.ts +83 -0
  120. package/types/api/wxml/index.d.ts +540 -0
  121. package/types/compile/compiler.d.ts +32 -0
  122. package/types/compile/config/h5.d.ts +134 -0
  123. package/types/compile/config/harmony.d.ts +118 -0
  124. package/types/compile/config/index.d.ts +8 -0
  125. package/types/compile/config/manifest.d.ts +155 -0
  126. package/types/compile/config/mini.d.ts +118 -0
  127. package/types/compile/config/plugin.d.ts +34 -0
  128. package/types/compile/config/project.d.ts +338 -0
  129. package/types/compile/config/rn.d.ts +85 -0
  130. package/types/compile/config/util.d.ts +179 -0
  131. package/types/compile/hooks.d.ts +13 -0
  132. package/types/compile/index.d.ts +11 -0
  133. package/types/compile/viteCompilerContext.d.ts +167 -0
  134. package/types/global.d.ts +428 -0
  135. package/types/index.d.ts +190 -0
  136. package/types/taro.api.d.ts +130 -0
  137. package/types/taro.component.d.ts +168 -0
  138. package/types/taro.config.d.ts +712 -0
  139. package/types/taro.lifecycle.d.ts +220 -0
  140. package/types/taro.runtime.d.ts +9 -0
@@ -0,0 +1,712 @@
1
+ import Taro from './index'
2
+
3
+ declare module './index' {
4
+ /**
5
+ * 微信小程序全局 Window 配置和页面配置的公共项目
6
+ */
7
+ interface CommonConfig {
8
+ /** 导航栏背景颜色,HexColor
9
+ * @default: "#000000"
10
+ */
11
+ navigationBarBackgroundColor?: string
12
+ /** 导航栏标题颜色,仅支持 black/white
13
+ * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
14
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
15
+ * @default: "white"
16
+ */
17
+ navigationBarTextStyle?: 'white' | 'black' | string
18
+ /** 导航栏标题文字内容 */
19
+ navigationBarTitleText?: string
20
+ /** 导航栏样式,仅支持以下值:
21
+ * - default 默认样式
22
+ * - custom 自定义导航栏
23
+ */
24
+ navigationStyle?: 'default' | 'custom'
25
+ /**
26
+ * 在非首页、非页面栈最底层页面或非 tabbar 内页面中的导航栏展示 home 键
27
+ * @default false
28
+ * @supported weapp
29
+ */
30
+ homeButton?: boolean
31
+ /** 窗口的背景色, HexColor
32
+ * @default: "#ffffff"
33
+ */
34
+ backgroundColor?: string
35
+ /** 页面容器背景色, HexColor
36
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/runtime/skyline/custom-route.html#%E8%AE%BE%E7%BD%AE%E9%A1%B5%E9%9D%A2%E9%80%8F%E6%98%8E
37
+ * @default: "#ffffff"
38
+ */
39
+ backgroundColorContent?: string
40
+ /** 下拉背景字体、loading 图的样式,仅支持 dark/light
41
+ * 当 app.json 中配置 darkmode 为 true 时可通过变量的形式配置
42
+ * @see: https://developers.weixin.qq.com/miniprogram/dev/framework/ability/darkmode.html
43
+ * @default: "dark"
44
+ */
45
+ backgroundTextStyle?: 'dark' | 'light' | string
46
+ /** 顶部窗口的背景色,仅 iOS 支持
47
+ * @default: "#ffffff"
48
+ */
49
+ backgroundColorTop?: string
50
+ /** 底部窗口的背景色,仅 iOS 支持
51
+ * @default: "#ffffff"
52
+ */
53
+ backgroundColorBottom?: string
54
+ /** 是否开启下拉刷新
55
+ * @default: false
56
+ */
57
+ enablePullDownRefresh?: boolean
58
+ /** 页面上拉触底事件触发时距页面底部距离,单位为 px
59
+ * @default: 50
60
+ */
61
+ onReachBottomDistance?: number
62
+ /** 屏幕旋转设置,支持 auto / portrait / landscape
63
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/view/resizable.html
64
+ */
65
+ pageOrientation?: 'auto' | 'portrait' | 'landscape'
66
+ /** 页面[初始渲染缓存](https://developers.weixin.qq.com/miniprogram/dev/framework/view/initial-rendering-cache.html)配置,支持 static / dynamic */
67
+ initialRenderingCache?: 'static' | 'dynamic'
68
+ /** 重新启动策略配置
69
+ * - homePage: 如果从这个页面退出小程序,下次将从首页冷启动
70
+ * - homePageAndLatestPage: 如果从这个页面退出小程序,下次冷启动后立刻加载这个页面,页面的参数保持不变(不可用于 tab 页)
71
+ * @default "homePage"
72
+ */
73
+ restartStrategy?: 'homePage' | 'homePageAndLatestPage'
74
+ /**
75
+ * 切入系统后台时,隐藏页面内容,保护用户隐私。支持 hidden / none
76
+ * @default "none"
77
+ */
78
+ visualEffectInBackground?: 'hidden' | 'none'
79
+ /**
80
+ * 控制[预加载下个页面的时机](https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips/runtime_nav.html#_2-4-%E6%8E%A7%E5%88%B6%E9%A2%84%E5%8A%A0%E8%BD%BD%E4%B8%8B%E4%B8%AA%E9%A1%B5%E9%9D%A2%E7%9A%84%E6%97%B6%E6%9C%BA)。
81
+ * 支持 static / manual / auto
82
+ */
83
+ handleWebviewPreload?: string
84
+ /** 是否允许向下拉拽。
85
+ * @default: "YES"
86
+ * @supported alipay
87
+ */
88
+ allowsBounceVertical?: 'YES' | 'NO'
89
+ /**
90
+ * 下拉露出显示背景图的底色。例:白色 "#FFFFFF"。**仅安卓下有效,iOS 下页面背景图底色会使用 backgroundColor 的值**
91
+ * @supported alipay
92
+ * @type {HexColor}
93
+ */
94
+ backgroundImageColor?: string
95
+ /**
96
+ * 下拉露出显示背景图的链接
97
+ * @supported alipay
98
+ */
99
+ backgroundImageUrl?: string
100
+ /**
101
+ * 页面默认标题
102
+ * @supported alipay
103
+ */
104
+ defaultTitle?: string
105
+ /**
106
+ * 仅支持 Android,是否显示 WebView 滚动条。默认 YES,支持 YES / NO。
107
+ * @default "YES"
108
+ * @supported alipay
109
+ */
110
+ enableScrollBar?: string
111
+ /**
112
+ * 仅支持 iOS,是否支持手势返回。默认 YES,支持 YES / NO。
113
+ * @supported alipay
114
+ */
115
+ gestureBack?: string
116
+ /** 是否允许下拉刷新
117
+ * @desc
118
+ * 1. 下拉刷新生效的前提是 allowsBounceVertical 值为 true
119
+ * 2. window 全局配置后全局生效,但是如果单个页面配置了该参数,以页面的配置为准。
120
+ * @default true
121
+ * @supported alipay
122
+ */
123
+ pullRefresh?: boolean
124
+ /**
125
+ * rpx 单位是否宽度自适应 ,默认 true,当设置为 false 时,2 rpx 将恒等于 1 px,不再根据屏幕宽度进行自适应,注意,此时 750 rpx 将不再等于 100% 宽度。
126
+ * @supported alipay
127
+ */
128
+ responsive?: boolean
129
+ /**
130
+ * 是否进入时显示导航栏的 loading。默认 NO,支持 YES / NO。
131
+ * @default "NO"
132
+ * @supported alipay
133
+ */
134
+ showTitleLoading?: string
135
+ /**
136
+ * 导航栏透明设置。默认 none,支持 always 一直透明 / auto 滑动自适应 / none 不透明。
137
+ * @default "none"
138
+ * @supported alipay
139
+ */
140
+ transparentTitle?: string
141
+ /**
142
+ * 是否允许导航栏点击穿透。默认 NO,支持 YES / NO。
143
+ * @default "NO"
144
+ * @supported alipay
145
+ */
146
+ titlePenetrate?: string
147
+ /**
148
+ * 导航栏图片地址。
149
+ * @supported alipay
150
+ */
151
+ titleImage?: string
152
+ /**
153
+ * 导航栏背景色。例:白色 "#FFFFFF"。
154
+ * @supported alipay
155
+ * @type {HexColor}
156
+ */
157
+ titleBarColor?: string
158
+ }
159
+
160
+ interface PageConfig extends CommonConfig {
161
+ /** 设置为 true 则页面整体不能上下滚动;
162
+ * 只在页面配置中有效,无法在 app.json 中设置该项
163
+ * @default: false
164
+ */
165
+ disableScroll?: boolean
166
+ /** 是否使用页面全局滚动,MPA下默认为全局滚动,SPA默认为局部滚动
167
+ * 只在H5生效
168
+ * @default: MPA:true SPA:false
169
+ */
170
+ usingWindowScroll?: boolean
171
+ /** 禁止页面右滑手势返回
172
+ *
173
+ * **注意** 自微信客户端 7.0.5 开始,页面配置中的 disableSwipeBack 属性将不再生效,
174
+ * 详情见[右滑手势返回能力调整](https://developers.weixin.qq.com/community/develop/doc/000868190489286620a8b27f156c01)公告
175
+ * @default: false
176
+ * @since 微信客户端 7.0.0
177
+ */
178
+ disableSwipeBack?: boolean
179
+ /** 是否启用分享给好友。
180
+ * @default false
181
+ */
182
+ enableShareAppMessage?: boolean
183
+ /** 是否启用分享到朋友圈。
184
+ * @default false
185
+ */
186
+ enableShareTimeline?: boolean
187
+ /**
188
+ * 页面是否需要使用 \<page-meta\> 和 \<navigation-bar\> 组件
189
+ * @default false
190
+ * @support weapp, alipay
191
+ */
192
+ enablePageMeta?: boolean
193
+ /** 页面自定义组件配置
194
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
195
+ */
196
+ usingComponents?: Record<string, string | [string, string]>
197
+ /** 指定使用升级后的 weui 样式
198
+ * - v2: 可表明启用新版的组件样式
199
+ * @default default
200
+ */
201
+ style?: string
202
+ /** 单页模式相关配置 */
203
+ singlePage?: SinglePage
204
+ /**
205
+ * 事件监听是否为 passive
206
+ * @default false
207
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#enablePassiveEvent
208
+ */
209
+ enablePassiveEvent?:
210
+ | boolean
211
+ | {
212
+ /**
213
+ * 是否设置 touchstart 事件为 passive
214
+ * @default false
215
+ */
216
+ touchstart?: boolean
217
+ /**
218
+ * 是否设置 touchmove 事件为 passive
219
+ * @default false
220
+ */
221
+ touchmove?: boolean
222
+ /**
223
+ * 是否设置 wheel 事件为 passive
224
+ * @default false
225
+ */
226
+ wheel?: boolean
227
+ }
228
+ /**
229
+ * 渲染后端
230
+ * @default "webview"
231
+ */
232
+ renderer?: 'webview' | 'skyline'
233
+ /**
234
+ * 组件框架
235
+ * @default "exparser"
236
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/migration.html
237
+ */
238
+ componentFramework?: 'exparser' | 'glass-easel'
239
+ /**
240
+ * 指定特殊的样式隔离选项
241
+ *
242
+ * isolated 表示启用样式隔离,在自定义组件内外,使用 class 指定的样式将不会相互影响(一般情况下的默认值)
243
+ *
244
+ * apply-shared 表示页面 wxss 样式将影响到自定义组件,但自定义组件 wxss 中指定的样式不会影响页面
245
+ *
246
+ * shared 表示页面 wxss 样式将影响到自定义组件,自定义组件 wxss 中指定的样式也会影响页面和其他设置了 apply-shared 或 shared 的自定义组件。(这个选项在插件中不可用。)
247
+ */
248
+ styleIsolation?: 'isolated' | 'apply-shared' | 'shared'
249
+ /**
250
+ * 设置导航栏额外图标,目前支持设置属性 icon,值为图标 url(以 https/http 开头)或 base64 字符串,大小建议 30*30 px
251
+ *
252
+ * 点击后触发 onOptionMenuClick(**注意**:该配置即将废弃。)。
253
+ * @supported alipay
254
+ */
255
+ optionMenu?: Record<string, string>
256
+ /**
257
+ * 设置导航栏图标主题,仅支持真机预览。"default" 为蓝色图标,"light" 为白色图标。
258
+ * @supported alipay
259
+ */
260
+ barButtonTheme?: string
261
+ }
262
+
263
+ interface WindowConfig extends CommonConfig {}
264
+
265
+ interface TabBarItem {
266
+ /** 页面路径,必须在 pages 中先定义 */
267
+ pagePath: string
268
+ /** tab 上按钮文字 */
269
+ text: string
270
+ /** 图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px,当 position 为 top 时,此参数无效,不支持网络图片 */
271
+ iconPath?: string
272
+ /** 选中时的图片路径,icon 大小限制为 40kb,建议尺寸为 81px * 81px ,当 position 为 top 时,此参数无效 */
273
+ selectedIconPath?: string
274
+ }
275
+
276
+ interface TabBar {
277
+ /** tab 上的文字默认颜色 */
278
+ color?: string
279
+ /** tab 上的文字选中时的颜色 */
280
+ selectedColor?: string
281
+ /** tab 的背景色 */
282
+ backgroundColor?: string
283
+ /** tabbar上边框的颜色, 仅支持 black/white
284
+ * @default: black
285
+ */
286
+ borderStyle?: 'black' | 'white'
287
+ /** tab 的列表,详见 list 属性说明,最少 2 个、最多 5 个 tab */
288
+ list: TabBarItem[]
289
+ /** tabbar 的位置,可选值 bottom、top
290
+ * @default: 'bottom'
291
+ */
292
+ position?: 'bottom' | 'top'
293
+ /** 自定义 tabBar,见[详情](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html)
294
+ * @default false
295
+ * @since 2.1.0
296
+ */
297
+ custom?: boolean
298
+ }
299
+
300
+ interface NetworkTimeout {
301
+ /** Taro.request 的超时时间,单位毫秒。
302
+ * @default 60000
303
+ */
304
+ request?: number
305
+ /** Taro.connectSocket 的超时时间,单位毫秒。
306
+ * @default 60000
307
+ */
308
+ connectSocket?: number
309
+ /** Taro.uploadFile 的超时时间,单位毫秒。
310
+ * @default 60000
311
+ */
312
+ uploadFile?: number
313
+ /** Taro.downloadFile 的超时时间,单位毫秒。
314
+ * @default 60000
315
+ */
316
+ downloadFile?: number
317
+ }
318
+
319
+ interface SubPackage {
320
+ /** 分包根路径
321
+ * - 注意:不能放在主包pages目录下
322
+ */
323
+ root: string
324
+ /** 分包路径下的所有页面配置 */
325
+ pages: string[]
326
+ /** 分包别名,分包预下载时可以使用 */
327
+ name?: string
328
+ /** 分包是否是独立分包 */
329
+ independent?: boolean
330
+ /** 分包支持引用独立的插件 */
331
+ plugins?: Plugins
332
+ }
333
+
334
+ interface Plugins {
335
+ [key: string]: {
336
+ version: string
337
+ provider: string
338
+ }
339
+ }
340
+
341
+ interface PreloadRule {
342
+ [key: string]: {
343
+ /** 进入页面后预下载分包的 root 或 name。__APP__ 表示主包。 */
344
+ packages: string[]
345
+ /** 在指定网络下预下载,可选值为:
346
+ * - all: 不限网络
347
+ * - wifi: 仅wifi下预下载
348
+ * @default "wifi"
349
+ */
350
+ network?: 'all' | 'wifi'
351
+ }
352
+ }
353
+
354
+ interface Permission {
355
+ [key: string]: {
356
+ /** 小程序获取权限时展示的接口用途说明。最长30个字符 */
357
+ desc: string
358
+ }
359
+ }
360
+
361
+ interface SinglePage {
362
+ /** 导航栏与页面的相交状态,值为 float 时表示导航栏浮在页面上,与页面相交;值为 squeezed 时表示页面被导航栏挤压,与页面不相交
363
+ * @default "默认自动调整,若原页面是自定义导航栏,则为 float,否则为 squeezed"
364
+ */
365
+ navigationBarFit?: string
366
+ }
367
+
368
+ interface RouterAnimate {
369
+ /** 动画切换时间,单位毫秒
370
+ * @default 300
371
+ */
372
+ duration?: number
373
+ /** 动画切换时间,单位毫秒
374
+ * @default 50
375
+ */
376
+ delay?: number
377
+ }
378
+
379
+ interface RenderOptions {
380
+ skyline: {
381
+ /** 开启默认Block布局
382
+ * @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
383
+ * @supported weapp
384
+ */
385
+ defaultDisplayBlock?: boolean
386
+ /** 关闭 Skyline AB 实验
387
+ * @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
388
+ * @supported weapp
389
+ */
390
+ disableABTest?: boolean
391
+ /** 基础库最低版本
392
+ * @supported weapp
393
+ */
394
+ sdkVersionBegin?: string
395
+ /** 基础库最高版本
396
+ * @supported weapp
397
+ */
398
+ sdkVersionEnd?: string
399
+ /** iOS 微信最低版本
400
+ * @supported weapp
401
+ */
402
+ iosVersionBegin?: string
403
+ /** iOS 微信最高版本
404
+ * @supported weapp
405
+ */
406
+ iosVersionEnd?: string
407
+ /** 安卓微信最低版本
408
+ * @supported weapp
409
+ */
410
+ androidVersionBegin?: string
411
+ /** 安卓微信最高版本
412
+ * @supported weapp
413
+ */
414
+ androidVersionEnd?: string
415
+ [key: string]: unknown
416
+ }
417
+ }
418
+
419
+ interface Behavior {
420
+ /**
421
+ * 使用小程序默认分享功能时(即不显式设置 Page.onShareAppMessage),当设置此字段后,会使客户端生成的用于分享的 scheme 带上当前用户打开的页面所携带的 query 参数。
422
+ * @supported alipay 基础库 2.7.10 及以上开始支持,同时需使用 IDE 2.7.0 及以上版本进行构建。
423
+ */
424
+ shareAppMessage?: 'appendQuery'
425
+ /**
426
+ * 小程序在解析全局参数、页面参数时默认会对键/值做 encodeURIComponent。当设置为 disable 后,则不再对键/值做encodeURIComponent
427
+ * @supported alipay 基础库 2.7.19 及以上开始支持,同时需使用 IDE 3.0.0 及以上版本进行构建。
428
+ */
429
+ decodeQuery?: 'disable'
430
+ }
431
+
432
+ export interface AppConfig {
433
+ /** 小程序默认启动首页,未指定 entryPagePath 时,数组的第一项代表小程序的初始页面(首页)。 */
434
+ entryPagePath?: string
435
+ /** 接受一个数组,每一项都是字符串,来指定小程序由哪些页面组成,数组的第一项代表小程序的初始页面 */
436
+ pages?: string[]
437
+ /** 全局的默认窗口表现 */
438
+ window?: WindowConfig
439
+ /** 底部 tab 栏的表现 */
440
+ tabBar?: TabBar
441
+ /** 各类网络请求的超时时间,单位均为毫秒。 */
442
+ networkTimeout?: NetworkTimeout
443
+ /** 是否开启 debug 模式,默认关闭
444
+ * @default false
445
+ */
446
+ debug?: boolean
447
+ /** 启用插件功能页时,插件所有者小程序需要设置其 functionalPages 为 true。
448
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/plugin/functional-pages.html
449
+ * @default false
450
+ * @since 2.1.0
451
+ */
452
+ functionalPages?:
453
+ | boolean
454
+ | {
455
+ independent?: boolean
456
+ }
457
+ /** 分包结构配置
458
+ * @example
459
+ * ```json
460
+ * [
461
+ * {
462
+ * root: 'packages/module',
463
+ * pages: [
464
+ * 'pages/page/index'
465
+ * ]
466
+ * }
467
+ * ]
468
+ * ```
469
+ * @since 1.7.3
470
+ */
471
+ subPackages?: SubPackage[]
472
+ subpackages?: SubPackage[]
473
+ /** Worker 代码放置的目录
474
+ * 使用 Worker 处理多线程任务时,设置 Worker 代码放置的目录
475
+ * @since 1.9.90
476
+ */
477
+ workers?: string | string[]
478
+ /** 申明需要后台运行的能力,类型为数组。目前支持以下项目:
479
+ * - audio: 后台音乐播放
480
+ * - location: 后台定位
481
+ * @since 微信客户端 6.7.2 及以上版本支持
482
+ */
483
+ requiredBackgroundModes?: ('audio' | 'location')[]
484
+ /** 申明需要使用的地理位置相关接口,类型为数组。目前支持以下项目:
485
+ * 自 2022 年 7 月 14 日后发布的小程序,使用以下8个地理位置相关接口时,需要声明该字段,否则将无法正常使用。2022 年 7 月 14 日前发布的小程序不受影响。
486
+ * - getFuzzyLocation: 获取模糊地理位置
487
+ * - getLocation: 获取精确地理位置
488
+ * - onLocationChange: 监听试试地理位置变化事件
489
+ * - startLocationUpdate: 接收位置消息(前台)
490
+ * - startLocationUpdateBackground: 接收位置消息(前后台)
491
+ * - chooseLocation: 打开地图选择位置
492
+ * - choosePoi: 打开 POI 列表选择位置
493
+ * - chooseAddress: 获取用户地址信息
494
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#requiredPrivateInfos
495
+ */
496
+ requiredPrivateInfos?: (
497
+ | 'getFuzzyLocation'
498
+ | 'getLocation'
499
+ | 'onLocationChange'
500
+ | 'startLocationUpdate'
501
+ | 'startLocationUpdateBackground'
502
+ | 'chooseLocation'
503
+ | 'choosePoi'
504
+ | 'chooseAddress'
505
+ )[]
506
+ /** 使用到的插件
507
+ * @since 1.9.6
508
+ */
509
+ plugins?: Plugins
510
+ /** 声明分包预下载的规则。
511
+ * preloadRule 中,key 是页面路径,value 是进入此页面的预下载配置
512
+ * 注意: 分包预下载目前只支持通过配置方式使用,暂不支持通过调用API完成。
513
+ * vConsole 里有 preloadSubpackages 开头的日志信息,可以用来验证预下载的情况。
514
+ * @since 2.3.0
515
+ */
516
+ preloadRule?: PreloadRule
517
+ /** PC 小程序是否支持用户任意改变窗口大小(包括最大化窗口);iPad 小程序是否支持屏幕旋转
518
+ * @default false
519
+ * @since 2.3.0
520
+ */
521
+ resizable?: boolean
522
+ /** 需要跳转的小程序列表
523
+ * @since 2.4.0
524
+ */
525
+ navigateToMiniProgramAppIdList?: string[]
526
+ /** 全局自定义组件配置
527
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/
528
+ */
529
+ usingComponents?: Record<string, string>
530
+ /** 小程序接口权限相关设置
531
+ * @since 微信客户端 7.0.0
532
+ */
533
+ permission?: Permission
534
+ /** 指明 sitemap.json 的位置 */
535
+ sitemapLocation?: string
536
+ /** 指定使用升级后的 weui 样式
537
+ * - v2: 可表明启用新版的组件样式
538
+ * @default default
539
+ */
540
+ style?: string
541
+ /** 指定需要引用的扩展库
542
+ * 指定需要引用的扩展库。目前支持以下项目:
543
+ * - kbone: 多端开发框架
544
+ * - weui: WeUI 组件库
545
+ */
546
+ useExtendedLib?: Record<string, boolean>
547
+ /** 微信消息用小程序打开
548
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/open-ability/location-message.html
549
+ */
550
+ entranceDeclare?: {
551
+ /** 声明“位置消息”场景进入小程序的启动页面 */
552
+ locationMessage?: {
553
+ /** 启动页路径,必须是在pages中已经定义 */
554
+ path?: string
555
+ /** 启动页参数 */
556
+ query?: string
557
+ }
558
+ }
559
+ /**
560
+ * 配置 darkMode 为 true,即表示当前小程序已适配 DarkMode
561
+ * @since 2.11.0
562
+ */
563
+ darkmode?: boolean
564
+ /** 指明 theme.json 的位置,darkmode为true为必填
565
+ * @since 2.11.0
566
+ */
567
+ themeLocation?: string
568
+ /** 配置自定义组件代码按需注入 */
569
+ lazyCodeLoading?: 'requiredComponents' | string
570
+ /** 单页模式相关配置 */
571
+ singlePage?: SinglePage
572
+ /** 聊天素材小程序打开相关配置
573
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/material/support_material.html
574
+ */
575
+ supportedMaterials?: {
576
+ /** 支持文件类型的MimeType,音频,视频支持二级配置的通配模式,例如: video/*。通配模式配置和精确类型配置同时存在时,则优先使用精确类型的配置(例如video/*和video/mp4同时存在,会优先使用video/mp4的配置)。 */
577
+ materialType: string
578
+ /** 开发者配置的标题,在素材页面会展示该标题,配置中必须包含${nickname}, 代码包编译后会自动替换为小程序名称,如果声明了简称则会优先使用简称。除去${nickname}其余字数不得超过6个。 */
579
+ name: string
580
+ /** 用途描述,会在推荐列表展示该描述,限定字数不超过22个。 */
581
+ desc: string
582
+ /** 在该场景下打开小程序时跳转页面 */
583
+ path: string
584
+ }[]
585
+ /** 定制化型服务商票据 */
586
+ serviceProviderTicket?: string
587
+ /** 半屏小程序 appId */
588
+ embeddedAppIdList?: string[]
589
+ /** 视频号直播半屏场景设置 */
590
+ halfPage?: {
591
+ /** 视频号直播打开的第一个页面的全屏状态使用自定义顶部,支持 */
592
+ firstPageNavigationStyle?: 'default' | 'custom'
593
+ }
594
+ /** 小程序调试相关配置项 */
595
+ debugOptions?: {
596
+ /** 是否开启 FPS 面板,默认false */
597
+ enableFPSPanel?: boolean
598
+ }
599
+ /**
600
+ * touch 相关事件默认的 passive 为 false。如果小程序不使用 catchtouch 事件时,可以通过这个选项将 passive 置为 true,以提高滚动性能。
601
+ * 具体原理可参考[MDN](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#improving_scrolling_performance_with_passive_listeners)
602
+ *
603
+ * 可以直接设置这个选项为 true,也可以分别控制某个事件。
604
+ * @default false
605
+ */
606
+ enablePassiveEvent?:
607
+ | boolean
608
+ | {
609
+ /**
610
+ * 是否设置 touchstart 事件为 passive
611
+ * @default false
612
+ */
613
+ touchstart?: boolean
614
+ /**
615
+ * 是否设置 touchmove 事件为 passive
616
+ * @default false
617
+ */
618
+ touchmove?: boolean
619
+ /**
620
+ * 是否设置 wheel 事件为 passive
621
+ * @default false
622
+ */
623
+ wheel?: boolean
624
+ }
625
+ /** 自定义模块映射规则 */
626
+ resolveAlias?: Record<string, string>
627
+ /** 接受一个数组,每一项都是字符串,来指定编译为原生小程序组件的组件入口 */
628
+ components?: string[]
629
+ /** 渲染页面的容器 id
630
+ * @default "app"
631
+ * @since 3.3.18
632
+ */
633
+ appId?: string
634
+ /** 是否开启 h5 端路由动画功能,默认开启
635
+ * @supported h5
636
+ * @since 3.3.18
637
+ */
638
+ animation?: RouterAnimate | boolean
639
+ /**
640
+ * 指定小程序全局的默认渲染后端。
641
+ * @default "webview"
642
+ */
643
+ renderer?: 'webview' | 'skyline'
644
+ /**
645
+ * 渲染后端选项
646
+ * @see https://developers.weixin.qq.com/miniprogram/dev/reference/configuration/app.html#rendererOptions
647
+ */
648
+ rendererOptions?: RenderOptions
649
+ /**
650
+ * 指定小程序使用的组件框架
651
+ * @default "exparser"
652
+ * @see https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/glass-easel/migration.html
653
+ */
654
+ componentFramework?: 'exparser' | 'glass-easel'
655
+ /**
656
+ * 多端模式场景接入身份管理服务时开启小程序授权页相关配置
657
+ * @see https://dev.weixin.qq.com/docs/framework/getting_started/auth.html#%E6%96%B0%E6%89%8B%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B
658
+ */
659
+ miniApp?: {
660
+ /**
661
+ * 用于 wx.weixinMinProgramLogin 在小程序中插入「小程序授权 Page」
662
+ */
663
+ useAuthorizePage: boolean
664
+ }
665
+ /**
666
+ * 在 2023年9月15号之前,在 app.json 中配置 __usePrivacyCheck__: true 后,会启用隐私相关功能,如果不配置或者配置为 false 则不会启用。
667
+ * 在 2023年9月15号之后,不论 app.json 中是否有配置 __usePrivacyCheck__,隐私相关功能都会启用
668
+ * @supported weapp
669
+ */
670
+ __usePrivacyCheck__?: boolean
671
+ /**
672
+ * 正常情况下默认所有资源文件都被打包发布到所有平台,可以通过 static 字段配置特定每个目录/文件只能发布到特定的平台(多端场景)
673
+ * @see https://dev.weixin.qq.com/docs/framework/guideline/devtools/condition-compile.html#%E8%B5%84%E6%BA%90
674
+ */
675
+ static?: { pattern: string; platforms: string[] }[]
676
+ /**
677
+ * 动态插件配置规则,声明小程序需要使用动态插件
678
+ * @supported alipay
679
+ */
680
+ useDynamicPlugins?: boolean
681
+ /**
682
+ * 用于改变小程序若干运行行为
683
+ * @supported alipay
684
+ */
685
+ behavior?: Behavior
686
+ /**
687
+ * 用于开启抖音小程序的 tt-dom 渲染模式
688
+ * @supported tt
689
+ */
690
+ enableTTDom?: boolean
691
+ }
692
+
693
+ interface Config extends PageConfig, AppConfig {
694
+ cloud?: boolean
695
+ }
696
+
697
+ interface TaroStatic {
698
+ CommonConfig: CommonConfig
699
+ PageConfig: PageConfig
700
+ WindowConfig: WindowConfig
701
+ TarBarList: TabBarItem
702
+ TabBar: TabBar
703
+ NetworkTimeout: NetworkTimeout
704
+ SubPackage: SubPackage
705
+ Plugins: Plugins
706
+ PreloadRule: PreloadRule
707
+ Permission: Permission
708
+ AppConfig: AppConfig
709
+ RouterAnimate: RouterAnimate
710
+ Config: Config
711
+ }
712
+ }