@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,190 @@
1
+ /**
2
+ * Taro 类型定义文件
3
+ *
4
+ * 目录结构
5
+ * ├── api 小程序端能力 API
6
+ * │   ├── ad
7
+ * │ │ └── index.d.ts 广告 API
8
+ * │   ├── ai
9
+ * │   │   ├── face.d.ts 人脸检测 API
10
+ * │   │   ├── inference.d.ts AI 推理 API
11
+ * │   │   └── visionkit.d.ts 视觉算法 API
12
+ * │   ├── alipay
13
+ * │ │ └── index.d.ts 支付宝小程序 API
14
+ * │   ├── base
15
+ * │ │ ├── index.d.ts 基础 API
16
+ * │   │   ├── crypto.d.ts 基础 -> 加密 API
17
+ * │ │ ├── debug.d.ts 基础 -> 调试 API
18
+ * │   │   ├── env.d.ts 基础 -> ENV
19
+ * │   │   ├── performance.d.ts
20
+ * │ │ ├── system.d.ts 基础 -> 系统 API
21
+ * │   │   ├── update.d.ts 基础 -> 更新 API
22
+ * │   │   └── weapp 基础 -> 小程序 API
23
+ * │   │   ├── app-event.d.ts 基础 -> 小程序 API -> 应用级事件
24
+ * │   │   └── life-cycle.d.ts 基础 -> 小程序 API -> 生命周期
25
+ * │   ├── canvas
26
+ * │ │ └── index.d.ts 画布 API
27
+ * │   ├── cloud
28
+ * │ │ └── index.d.ts 微信小程序云开发 API
29
+ * │   ├── data-analysis
30
+ * │ │ └── index.d.ts 数据分析 API
31
+ * │   ├── device
32
+ * │ │ ├── accelerometer.d.ts 设备 -> 加速计 API
33
+ * │   │   ├── accessibility.d.ts 设备 -> 无障碍 API
34
+ * │ │ ├── battery.d.ts 设备 -> 电量 API
35
+ * │   │   ├── bluetooth-ble.d.ts 设备 -> 蓝牙-低功耗中心设备 API
36
+ * │   │   ├── bluetooth-peripheral.d.ts 设备 -> 蓝牙-低功耗外围设备 API
37
+ * │   │   ├── bluetooth.d.ts 设备 -> 蓝牙-通用 API
38
+ * │   │   ├── calendar.d.ts 设备 -> 日历 API
39
+ * │ │ ├── clipboard.d.ts 设备 -> 剪贴板 API
40
+ * │ │ ├── compass.d.ts 设备 -> 罗盘 API
41
+ * │ │ ├── contact.d.ts 设备 -> 联系人 API
42
+ * │ │ ├── gyroscope.d.ts 设备 -> 陀螺仪 API
43
+ * │ │ ├── iBeacon.d.ts 设备 -> iBeacon 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
49
+ * │ │ ├── phone.d.ts 设备 -> 电话 API
50
+ * │ │ ├── scan.d.ts 设备 -> 扫码 API
51
+ * │ │ ├── screen.d.ts 设备 -> 屏幕 API
52
+ * │   │   ├── sms.d.ts 设备 -> 短信 API
53
+ * │ │ ├── vibrate.d.ts 设备 -> 振动 API
54
+ * │ │ └── wifi.d.ts 设备 -> Wi-Fi API
55
+ * │   ├── ext
56
+ * │ │ └── index.d.ts 第三方平台 API
57
+ * │   ├── files
58
+ * │ │ └── index.d.ts 文件 API
59
+ * │   ├── framework
60
+ * │ │ └── index.d.ts 小程序框架 API
61
+ * │   ├── location
62
+ * │ │ └── index.d.ts 位置 API
63
+ * │   ├── media
64
+ * │ │ ├── audio.d.ts 媒体 -> 音频 API
65
+ * │ │ ├── background-audio.d.ts 媒体 -> 背景音频 API
66
+ * │ │ ├── camera.d.ts 媒体 -> 相机 API
67
+ * │ │ ├── editor.d.ts 媒体 -> 富文本 API
68
+ * │ │ ├── image.d.ts 媒体 -> 图片 API
69
+ * │ │ ├── live.d.ts 媒体 -> 实时音视频 API
70
+ * │ │ ├── map.d.ts 媒体 -> 地图 API
71
+ * │   │   ├── media-recorder.d.ts 媒体 -> 画面录制器 API
72
+ * │ │ ├── recorder.d.ts 媒体 -> 录音 API
73
+ * │   │   ├── video-decoder.d.ts 媒体 -> 视频解码器 API
74
+ * │ │ └── video-processing.d.ts 媒体 -> 音视频合成 API
75
+ * │ │ ├── video.d.ts 媒体 -> 视频 API
76
+ * │   │   └── voip.d.ts 媒体 -> 实时语音 API
77
+ * │   ├── navigate
78
+ * │   │   └── index.d.ts 跳转 API
79
+ * │   ├── network
80
+ * │ │ ├── download.d.ts 网络 -> 下载 API
81
+ * │ │ ├── mdns.d.ts 网络 -> mDNS API
82
+ * │ │ ├── request.d.ts 网络 -> 发起请求 API
83
+ * │   │   ├── tcp.d.ts 网络 -> TCP 通信 API
84
+ * │ │ ├── udp.d.ts 网络 -> UDP 通信 API
85
+ * │ │ ├── upload.d.ts 网络 -> 上传 API
86
+ * │ │ └── websocket.d.ts 网络 -> WebSocket API
87
+ * │   ├── open-api
88
+ * │ │ ├── account.d.ts 开放接口 -> 账号信息 API
89
+ * │ │ ├── address.d.ts 开放接口 -> 收货地址 API
90
+ * │ │ ├── authorize.d.ts 开放接口 -> 授权 API
91
+ * │ │ ├── card.d.ts 开放接口 -> 卡券 API
92
+ * | | ├── channels.d.ts 开放接口 -> 视频号 API
93
+ * | | ├── customer-service.d.ts 开放接口 -> 微信客服 API
94
+ * | | ├── device-voip.d.ts 开放接口 -> 音视频通话 API
95
+ * │ │ ├── facial.d.ts 开放接口 -> 人脸识别 API // 在微信小程序文档已找不到
96
+ * │ │ ├── favorites.d.ts 开放接口 -> 收藏 API
97
+ * │ │ ├── group.d.ts 开放接口 -> 微信群 API
98
+ * │ │ ├── invoice.d.ts 开放接口 -> 发票 API
99
+ * │   │   ├── license-plate.d.ts 开放接口 -> 车牌 API
100
+ * │ │ ├── login.d.ts 开放接口 -> 登录 API
101
+ * │ │ ├── my-miniprogram.d.ts 开放接口 -> 我的小程序 API
102
+ * │ │ ├── privacy.d.ts 开放接口 -> 隐私信息授权 API
103
+ * │ │ ├── redpackage.d.ts 开放接口 -> 微信红包 API
104
+ * │ │ ├── settings.d.ts 开放接口 -> 设置 API
105
+ * │ │ ├── soter.d.ts 开放接口 -> 生物认证 API
106
+ * │ │ ├── sticker.d.ts 开放接口 -> 微信表情 API
107
+ * | | ├── subscribe-message.d.ts 开放接口 -> 订阅消息 API
108
+ * │ │ ├── user-info.d.ts 开放接口 -> 用户信息 API
109
+ * │ │ └── werun.d.ts 开放接口 -> 微信运动 API
110
+ * │   ├── payment
111
+ * │   │   └── index.d.ts 支付 API
112
+ * │   ├── qq
113
+ * │   │   └── index.d.ts QQ 小程序 API
114
+ * │   ├── route
115
+ * │ │ └── index.d.ts 路由 API
116
+ * │   ├── share
117
+ * │ │ └── index.d.ts 转发 API
118
+ * │   ├── skyline
119
+ * │ │ └── index.d.ts 微信 Skyline API
120
+ * │   ├── storage
121
+ * │ │ ├── background-fetch.d.ts 数据缓存 -> 后台获取 API
122
+ * │   │   ├── cache-manager.d.ts 数据缓存 -> 缓存管理 API
123
+ * │   │   └── index.d.ts 数据缓存 API
124
+ * │   ├── swan
125
+ * │   │   ├── bookshelf.d.ts 百度小程序 -> 书架 API
126
+ * │   │   ├── download-package.d.ts 百度小程序 -> 下载包 API
127
+ * │ │ └── index.d.ts 百度小程序 API
128
+ * │   │   └── pay.d.ts 百度小程序 -> 支付 API
129
+ * │   ├── taro.extend.d.ts Taro 扩展 API 类型定义
130
+ * │   ├── taro.hooks.d.ts Taro Hooks 类型定义
131
+ * │   ├── ui
132
+ * │ │ ├── animation.d.ts 界面 -> 动画 API
133
+ * │ │ ├── background.d.ts 界面 -> 背景 API
134
+ * │ │ ├── custom-component.d.ts 界面 -> 自定义组件 API
135
+ * │ │ ├── fonts.d.ts 界面 -> 字体 API
136
+ * │   │   ├── interaction.d.ts 界面 -> 交互 API
137
+ * │ │ ├── menu.d.ts 界面 -> 菜单 API
138
+ * │ │ ├── navigation-bar.d.ts 界面 -> 导航栏 API
139
+ * │ │ ├── pull-down-refresh.d.ts 界面 -> 下拉刷新 API
140
+ * │ │ ├── scroll.d.ts 界面 -> 滚动 API
141
+ * │ │ ├── sticky.d.ts 界面 -> 置顶 API
142
+ * │ │ ├── tab-bar.d.ts 界面 -> TabBar API
143
+ * │ │ ├── window.d.ts 界面 -> 窗口 API
144
+ * │   ├── worker
145
+ * │ │ └── index.d.ts Worker API
146
+ * │   └── wxml
147
+ * │ │ └── index.d.ts WXML API
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
161
+ * ├── index.d.ts 此文件
162
+ * ├── taro.api.d.ts
163
+ * ├── taro.component.d.ts Taro Component 类型定义
164
+ * ├── taro.config.d.ts Taro 小程序 App 与 Window 设置类型定义
165
+ * └── taro.lifecycle.d.ts Taro 生命周期类型定义
166
+ */
167
+
168
+ /// <reference path="global.d.ts" />
169
+
170
+ /// <reference path="taro.api.d.ts" />
171
+ /// <reference path="taro.component.d.ts" />
172
+ /// <reference path="taro.config.d.ts" />
173
+ /// <reference path="taro.lifecycle.d.ts" />
174
+ /// <reference path="taro.runtime.d.ts" />
175
+
176
+ /// <reference types="@spcsn/taro-plugin-platform-weapp/types/shims-weapp" />
177
+
178
+ export = Taro
179
+ export as namespace Taro
180
+
181
+ declare const Taro: Taro.TaroStatic
182
+
183
+ declare namespace Taro {
184
+ interface TaroStatic {}
185
+ }
186
+ declare global {
187
+ const defineAppConfig: (config: Taro.AppConfig) => Taro.AppConfig
188
+ const definePageConfig: (config: Taro.PageConfig) => Taro.Config
189
+ const importNativeComponent: <T> (path: string, name = '', exportName = 'default') => Awaited<T>
190
+ }
@@ -0,0 +1,130 @@
1
+ /**
2
+ *
3
+ * 微信端能力
4
+ * original code from: https://github.com/wx-minapp/minapp-wx/blob/master/typing/wx.d.ts
5
+ * Licensed under MIT license: https://github.com/qiu8310/minapp/issues/69
6
+ * thanks for the great work by @qiu8310 👍👍👍
7
+ *
8
+ */
9
+ /// <reference path="api/framework/index.d.ts" />
10
+ /// <reference path="api/base/index.d.ts" />
11
+ /// <reference path="api/base/system.d.ts" />
12
+ /// <reference path="api/base/update.d.ts" />
13
+ /// <reference path="api/base/weapp/life-cycle.d.ts" />
14
+ /// <reference path="api/base/weapp/app-event.d.ts" />
15
+ /// <reference path="api/base/debug.d.ts" />
16
+ /// <reference path="api/base/performance.d.ts" />
17
+ /// <reference path="api/base/crypto.d.ts" />
18
+ /// <reference path="api/base/env.d.ts" />
19
+ /// <reference path="api/route/index.d.ts" />
20
+ /// <reference path="api/navigate/index.d.ts" />
21
+ /// <reference path="api/share/index.d.ts" />
22
+ /// <reference path="api/ui/interaction.d.ts" />
23
+ /// <reference path="api/ui/navigation-bar.d.ts" />
24
+ /// <reference path="api/ui/background.d.ts" />
25
+ /// <reference path="api/ui/tab-bar.d.ts" />
26
+ /// <reference path="api/ui/fonts.d.ts" />
27
+ /// <reference path="api/ui/pull-down-refresh.d.ts" />
28
+ /// <reference path="api/ui/scroll.d.ts" />
29
+ /// <reference path="api/ui/animation.d.ts" />
30
+ /// <reference path="api/ui/sticky.d.ts" />
31
+ /// <reference path="api/ui/custom-component.d.ts" />
32
+ /// <reference path="api/ui/menu.d.ts" />
33
+ /// <reference path="api/ui/window.d.ts" />
34
+ /// <reference path="api/network/request.d.ts" />
35
+ /// <reference path="api/network/download.d.ts" />
36
+ /// <reference path="api/network/upload.d.ts" />
37
+ /// <reference path="api/network/websocket.d.ts" />
38
+ /// <reference path="api/network/mdns.d.ts" />
39
+ /// <reference path="api/network/tcp.d.ts" />
40
+ /// <reference path="api/network/udp.d.ts" />
41
+ /// <reference path="api/payment/index.d.ts" />
42
+ /// <reference path="api/storage/index.d.ts" />
43
+ /// <reference path="api/storage/background-fetch.d.ts" />
44
+ /// <reference path="api/storage/cache-manager.d.ts" />
45
+ /// <reference path="api/data-analysis/index.d.ts" />
46
+ /// <reference path="api/canvas/index.d.ts" />
47
+ /// <reference path="api/media/map.d.ts" />
48
+ /// <reference path="api/media/image.d.ts" />
49
+ /// <reference path="api/media/video.d.ts" />
50
+ /// <reference path="api/media/audio.d.ts" />
51
+ /// <reference path="api/media/background-audio.d.ts" />
52
+ /// <reference path="api/media/live.d.ts" />
53
+ /// <reference path="api/media/recorder.d.ts" />
54
+ /// <reference path="api/media/camera.d.ts" />
55
+ /// <reference path="api/media/editor.d.ts" />
56
+ /// <reference path="api/media/video-processing.d.ts" />
57
+ /// <reference path="api/media/voip.d.ts" />
58
+ /// <reference path="api/media/media-recorder.d.ts" />
59
+ /// <reference path="api/media/video-decoder.d.ts" />
60
+ /// <reference path="api/location/index.d.ts" />
61
+ /// <reference path="api/files/index.d.ts" />
62
+
63
+ /// <reference path="api/open-api/account.d.ts" />
64
+ /// <reference path="api/open-api/address.d.ts" />
65
+ /// <reference path="api/open-api/authorize.d.ts" />
66
+ /// <reference path="api/open-api/card.d.ts" />
67
+ /// <reference path="api/open-api/channels.d.ts" />
68
+ /// <reference path="api/open-api/customer-service.d.ts" />
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" />
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" />
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
+
86
+ /// <reference path="api/device/bluetooth.d.ts" />
87
+ /// <reference path="api/device/bluetooth-ble.d.ts" />
88
+ /// <reference path="api/device/bluetooth-peripheral.d.ts" />
89
+ /// <reference path="api/device/iBeacon.d.ts" />
90
+ /// <reference path="api/device/nfc.d.ts" />
91
+ /// <reference path="api/device/wifi.d.ts" />
92
+ /// <reference path="api/device/calendar.d.ts" />
93
+ /// <reference path="api/device/contact.d.ts" />
94
+ /// <reference path="api/device/accessibility.d.ts" />
95
+ /// <reference path="api/device/battery.d.ts" />
96
+ /// <reference path="api/device/clipboard.d.ts" />
97
+ /// <reference path="api/device/network.d.ts" />
98
+ /// <reference path="api/device/screen.d.ts" />
99
+ /// <reference path="api/device/sms.d.ts" />
100
+ /// <reference path="api/device/keyboard.d.ts" />
101
+ /// <reference path="api/device/phone.d.ts" />
102
+ /// <reference path="api/device/accelerometer.d.ts" />
103
+ /// <reference path="api/device/compass.d.ts" />
104
+ /// <reference path="api/device/motion.d.ts" />
105
+ /// <reference path="api/device/gyroscope.d.ts" />
106
+ /// <reference path="api/device/memory.d.ts" />
107
+ /// <reference path="api/device/scan.d.ts" />
108
+ /// <reference path="api/device/vibrate.d.ts" />
109
+ /// <reference path="api/ai/visionkit.d.ts" />
110
+ /// <reference path="api/ai/face.d.ts" />
111
+ /// <reference path="api/ai/inference.d.ts" />
112
+ /// <reference path="api/worker/index.d.ts" />
113
+ /// <reference path="api/wxml/index.d.ts" />
114
+ /// <reference path="api/ext/index.d.ts" />
115
+ /// <reference path="api/ad/index.d.ts" />
116
+ /// <reference path="api/skyline/index.d.ts" />
117
+
118
+ /// <reference path="api/cloud/index.d.ts" />
119
+
120
+ /// <reference path="api/alipay/index.d.ts" />
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" />
125
+ /// <reference path="api/swan/index.d.ts" />
126
+ /// <reference path="api/swan/pay.d.ts" />
127
+
128
+
129
+ /// <reference path="api/taro.extend.d.ts" />
130
+ /// <reference path="api/taro.hooks.d.ts" />
@@ -0,0 +1,168 @@
1
+ import React from 'react'
2
+ import Vue from 'vue'
3
+
4
+ import Taro from './index'
5
+
6
+ declare module './index' {
7
+ // ref: packages/taro-runtime/src/current.ts
8
+ interface RouterInfo<TParams extends Partial<Record<string, string>> = Partial<Record<string, string>>> {
9
+ /** 路由参数 */
10
+ params: TParams
11
+
12
+ /** 页面路径 */
13
+ path: string
14
+
15
+ onReady: string
16
+ onHide: string
17
+ onShow: string
18
+
19
+ shareTicket: string | undefined
20
+ scene: number | undefined
21
+ exitState?: any
22
+ $taroPath?: string
23
+ }
24
+
25
+ interface Show {
26
+ componentDidShow?(): void
27
+ componentDidHide?(): void
28
+ onShow?(): void
29
+ onHide?(): void
30
+ }
31
+ interface AppInstance extends Show {
32
+ mount(component: React.Component | Vue.ComponentOptions<typeof Vue>, id: string, cb: (...args: any[]) => void): void
33
+ componentDidShow?(options?: Record<string, unknown>): void
34
+ onShow?(options?: Record<string, unknown>): void
35
+ unmount(id: string, cb?: () => void): void
36
+ }
37
+ type Target = Record<string, unknown> & { dataset: Record<string, unknown>; id: string }
38
+ interface MpEvent {
39
+ type: string
40
+ detail: Record<string, unknown>
41
+ target: Target
42
+ currentTarget: Target
43
+ }
44
+ interface PageLifeCycle extends Show {
45
+ eh?(event: MpEvent): void
46
+ onLoad(options: Record<string, unknown>): void
47
+ onOptionMenuClick?(): void
48
+ /** 键盘高度变化时触发 @supported alipay */
49
+ onKeyboardHeight?(opt: { height: number; }): void
50
+ onPageScroll?(opt: PageScrollObject): void
51
+ onPopMenuClick?(): void
52
+ onPullDownRefresh?(): void
53
+ onPullIntercept?(): void
54
+ onReachBottom?(): void
55
+ onResize?(opt: PageResizeObject): void
56
+ onShareAppMessage?(opt: ShareAppMessageObject): ShareAppMessageReturn
57
+ onShareTimeline?(): ShareTimelineReturnObject
58
+ onTabItemTap?(opt: TabItemTapObject): void
59
+ onTitleClick?(): void
60
+ onUnload(): void
61
+ }
62
+ interface ComponentInstance<
63
+ TData extends Record<string, unknown> = Record<string, unknown>,
64
+ TParams extends Record<string, string> = Record<string, string>
65
+ > {
66
+ /** 组件的文件路径 */
67
+ is?: string
68
+ /** 节点id */
69
+ id?: string
70
+ /** 节点dataset */
71
+ dataset?: string
72
+ /** 组件数据,包括内部数据和属性值 */
73
+ data?: TData
74
+ /** 组件数据,包括内部数据和属性值(与 data 一致) */
75
+ properties?: TData
76
+ /** 相对于当前自定义组件的 Router 对象 */
77
+ router?: RouterInfo<TParams>
78
+ /** 相对于当前自定义组件所在页面的 Router 对象 */
79
+ pageRouter?: RouterInfo<TParams>
80
+ /** 设置data并执行视图层渲染 */
81
+ setData?(newData: Partial<TData>): void
82
+ /** 检查组件是否具有 behavior (检查时会递归检查被直接或间接引入的所有behavior) */
83
+ hasBehavior?(behavior: unknown): boolean
84
+ /** 触发事件,参见[组件间通信与事件](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/events.html) */
85
+ triggerEvent?(name: string, detail: Record<string, unknown>, options: {
86
+ /** 事件是否冒泡 */
87
+ bubbles?: boolean
88
+ /** 事件是否可以穿越组件边界,为 false 时,事件将只能在引用组件的节点树上触发,不进入其他任何组件内部 */
89
+ composed?: boolean
90
+ /** 事件是否拥有捕获阶段 */
91
+ capturePhase?: boolean
92
+ }): void
93
+ /** 创建一个 SelectorQuery 对象,选择器选取范围为这个组件实例内 */
94
+ createSelectorQuery?(): SelectorQuery
95
+ /** 创建一个 IntersectionObserver 对象,选择器选取范围为这个组件实例内 */
96
+ createIntersectionObserver?(options?: createIntersectionObserver.Option): IntersectionObserver
97
+ /** 创建一个 MediaQueryObserver 对象 */
98
+ createMediaQueryObserver?(): MediaQueryObserver
99
+ /** 使用选择器选择组件实例节点,返回匹配到的第一个组件实例对象(会被 wx://component-export 影响) */
100
+ selectComponent?<
101
+ TD extends Record<string, unknown> = Record<string, unknown>,
102
+ TP extends Record<string, string> = Record<string, string>
103
+ >(selector: string): ComponentInstance<TD, TP>
104
+ /** 使用选择器选择组件实例节点,返回匹配到的全部组件实例对象组成的数组(会被 wx://component-export 影响) */
105
+ selectAllComponents?<
106
+ TD extends Record<string, unknown> = Record<string, unknown>,
107
+ TP extends Record<string, string> = Record<string, string>
108
+ >(selector: string): ComponentInstance<TD, TP>
109
+ /** 选取当前组件节点所在的组件实例(即组件的引用者),返回它的组件实例对象(会被 wx://component-export 影响) */
110
+ selectOwnerComponent?<
111
+ TD extends Record<string, unknown> = Record<string, unknown>,
112
+ TP extends Record<string, string> = Record<string, string>
113
+ >(): ComponentInstance<TD, TP>
114
+ /** 获取这个关系所对应的所有关联节点,参见[组件间关系](https://developers.weixin.qq.com/miniprogram/dev/framework/custom-component/relations.html) */
115
+ getRelationNodes?(relationKey: string): NodesRef[]
116
+ /** 立刻执行 callback ,其中的多个 setData 之间不会触发界面绘制(只有某些特殊场景中需要,如用于在不同组件同时 setData 时进行界面绘制同步) */
117
+ groupSetData?(callback: () => void): void
118
+ /** 返回当前页面的 custom-tab-bar 的组件实例,详见[自定义 tabBar](https://developers.weixin.qq.com/miniprogram/dev/framework/ability/custom-tabbar.html) */
119
+ getTabBar?(): ComponentInstance
120
+ /** 返回页面标识符(一个字符串),可以用来判断几个自定义组件实例是不是在同一个页面内 */
121
+ getPageId?(): string
122
+ /** 执行关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
123
+ animate?(selector: string, keyFrames: KeyFrame[], duration: number, callback: () => void): void
124
+ /** 滚动驱动的动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
125
+ animate?(selector: string, keyFrames: KeyFrame[], duration: number, scrollTimeline: ScrollTimelineOption): void
126
+ /** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
127
+ clearAnimation?(selector: string, callback: () => void): void
128
+ /** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
129
+ clearAnimation?(selector: string, options: ClearAnimationOptions, callback: () => void): void
130
+ /** 清除关键帧动画,详见[动画](https://developers.weixin.qq.com/miniprogram/dev/framework/view/animation.html) */
131
+ setUpdatePerformanceListener?(options: {
132
+ /** 是否返回变更的 data 字段信息 */
133
+ withDataPaths?: boolean
134
+ }, listener: () => void): void
135
+ /**
136
+ * 绑定由 worklet 驱动的样式到相应的节点
137
+ * @param selector 节点选择器
138
+ * @param updater worklet 样式更新函数
139
+ * @param config 配置项
140
+ * @param callback 完成样式绑定的回调
141
+ * */
142
+ applyAnimatedStyle?(selector: string, updater: TaroGeneral.TFunc, config?: {
143
+ /** 是否立即执行一次 updater 函数 */
144
+ immediate?: boolean
145
+ /** 刷新时机,枚举值 async / sync */
146
+ flush?: string
147
+ }, callback?: TaroGeneral.TFunc): void
148
+ /**
149
+ * 清除节点上 worklet 驱动样式的绑定关系
150
+ * @param selector 节点选择器
151
+ * @param styleIds 需要清除的 styleId 集合
152
+ * @param callback 清除样式绑定的回调
153
+ * */
154
+ clearAnimatedStyle?(selector: string, styleIds: Array<Number>, callback?: TaroGeneral.TFunc): void
155
+ }
156
+ interface PageInstance extends PageLifeCycle, ComponentInstance {
157
+ /** 页面配置 */
158
+ config?: PageConfig
159
+ /** 页面的初始数据 */
160
+ data?: Record<string, unknown>
161
+ /** 页面路径 */
162
+ path?: string
163
+ /** 页面的组件选项 */
164
+ options?: Record<string, unknown>
165
+ /** 获得一个 EventChannel 对象,用于页面间通讯 */
166
+ getOpenerEventChannel?(): Record<string, any>
167
+ }
168
+ }