@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,122 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getCommonConfig {
5
+ interface Option {
6
+ /** 需要获取的数据指标的对象数组,每个string的格式约定:配置类型_分表key */
7
+ keys?: string[]
8
+ /** 0:通用配置模式 1:实验模式, 参数与返回结果的使用等效于接口wx.getExptInfoSync */
9
+ mode: 0 | 1
10
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
11
+ complete?: (res: TaroGeneral.CallbackResult) => void
12
+ /** 接口调用失败的回调函数 */
13
+ fail?: (res: TaroGeneral.CallbackResult) => void
14
+ /** 接口调用成功的回调函数 */
15
+ success?: (res: SuccessCallbackResult) => void
16
+ }
17
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
18
+ /** 错误码 */
19
+ errcode: number
20
+ /** 错误信息 */
21
+ errmsg: string
22
+ /** 配置类型, 1-表类型 2-kv类型 */
23
+ conf_type: number
24
+ /** 根据conf_type来确定conf内容, conf_type为1时conf是一个json数组, 类似"[{xxx},{xxx}]", 每一项对应表类型每一行配置内容, 其中conf_type为2时conf是一个json对象,类似"{xxxx}" */
25
+ conf: string
26
+ /** 过期时间,单位秒. 0表示当次有效 */
27
+ expire_sec: number
28
+ }
29
+ }
30
+
31
+ interface TaroStatic {
32
+ /** 自定义业务数据监控上报接口。
33
+ *
34
+ * **使用说明**
35
+ * 使用前,需要在「小程序管理后台-运维中心-性能监控-业务数据监控」中新建监控事件,配置监控描述与告警类型。每一个监控事件对应唯一的监控ID,开发者最多可以创建128个监控事件。
36
+ * @supported weapp
37
+ * @example
38
+ * ```tsx
39
+ * Taro.reportMonitor('1', 1)
40
+ * ```
41
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportMonitor.html
42
+ */
43
+ reportMonitor(
44
+ /** 监控ID,在「小程序管理后台」新建数据指标后获得 */
45
+ name: string,
46
+ /** 上报数值,经处理后会在「小程序管理后台」上展示每分钟的上报总量 */
47
+ value: number,
48
+ ): void
49
+
50
+ /** 自定义分析数据上报接口。使用前,需要在小程序管理后台自定义分析中新建事件,配置好事件名与字段。
51
+ * @supported weapp, swan, tt
52
+ * @example
53
+ * ```tsx
54
+ * Taro.reportAnalytics('purchase', {
55
+ * price: 120,
56
+ * color: 'red'
57
+ * })
58
+ * ```
59
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportAnalytics.html
60
+ */
61
+ reportAnalytics(
62
+ /** 事件名 */
63
+ eventName: string,
64
+ /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */
65
+ data: TaroGeneral.IAnyObject,
66
+ ): void
67
+
68
+ /** 事件上报
69
+ * @supported weapp
70
+ * @example
71
+ * ```tsx
72
+ * Taro.reportEvent('purchase', {
73
+ * price: 120,
74
+ * color: 'red'
75
+ * })
76
+ * ```
77
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.reportEvent.html
78
+ */
79
+ reportEvent(
80
+ /** 事件名 */
81
+ eventId: string,
82
+ /** 上报的自定义数据,key 为配置中的字段名,value 为上报的数据。 */
83
+ data: TaroGeneral.IAnyObject,
84
+ ): void
85
+
86
+ /** 给定实验参数数组,获取对应的实验参数值
87
+ * @supported weapp
88
+ * @example
89
+ * ```tsx
90
+ * Taro.getExptInfoSync(['color'])
91
+ * ```
92
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getExptInfoSync.html
93
+ */
94
+ getExptInfoSync(
95
+ /** 实验参数数组,不填则获取所有实验参数 */
96
+ keys?: Array<string>
97
+ ): TaroGeneral.IAnyObject
98
+
99
+ /** 给定实验参数数组,获取对应的实验参数值
100
+ * @supported weapp
101
+ * @example
102
+ * ```tsx
103
+ * Taro.getCommonConfig({
104
+ * keys:["key1", "key2"],
105
+ * mode: 0,
106
+ * success: (res) => {
107
+ * console.log("success")
108
+ * console.log(res)
109
+ * },
110
+ * fail: (res) => {
111
+ * console.log("fail")
112
+ * console.log(res)
113
+ * }
114
+ * })
115
+ * ```
116
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/data-analysis/wx.getCommonConfig.html
117
+ */
118
+ getCommonConfig(
119
+ option: getCommonConfig.Option
120
+ ): Promise<getCommonConfig.SuccessCallbackResult>
121
+ }
122
+ }
@@ -0,0 +1,102 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace startAccelerometer {
5
+ type Option = {
6
+ /**
7
+ * 监听加速度数据回调函数的执行频率
8
+ * @default "normal"
9
+ */
10
+ interval?: keyof Interval
11
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
12
+ complete?: (res: TaroGeneral.CallbackResult) => void
13
+ /** 接口调用失败的回调函数 */
14
+ fail?: (res: TaroGeneral.CallbackResult) => void
15
+ /** 接口调用成功的回调函数 */
16
+ success?: (res: TaroGeneral.CallbackResult) => void
17
+ }
18
+
19
+ type Interval = {
20
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
21
+ game: 'game',
22
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
23
+ ui: 'ui',
24
+ /** 普通的回调频率,在 200ms/次 左右 */
25
+ normal: 'normal'
26
+ }
27
+ }
28
+
29
+ namespace stopAccelerometer {
30
+ type Option = {
31
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
32
+ complete?: (res: TaroGeneral.CallbackResult) => void
33
+ /** 接口调用失败的回调函数 */
34
+ fail?: (res: TaroGeneral.CallbackResult) => void
35
+ /** 接口调用成功的回调函数 */
36
+ success?: (res: TaroGeneral.CallbackResult) => void
37
+ }
38
+ }
39
+
40
+ namespace onAccelerometerChange {
41
+ type Callback = (res: Result) => void
42
+ type Result = {
43
+ /** X 轴 */
44
+ x: number
45
+ /** Y 轴 */
46
+ y: number
47
+ /** Z 轴 */
48
+ z: number
49
+ }
50
+ }
51
+
52
+ interface TaroStatic {
53
+ /**
54
+ * 开始监听加速度数据。
55
+ * @example
56
+ * ```tsx
57
+ * Taro.startAccelerometer({ interval: 'game' })
58
+ * ```
59
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
60
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.startAccelerometer.html
61
+ */
62
+ startAccelerometer (res?: startAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
63
+
64
+ /**
65
+ * 停止监听加速度数据。
66
+ * @example
67
+ * ```tsx
68
+ * Taro.stopAccelerometer()
69
+ * ```
70
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
71
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.stopAccelerometer.html
72
+ */
73
+ stopAccelerometer (res?: stopAccelerometer.Option): Promise<TaroGeneral.CallbackResult>
74
+
75
+ /**
76
+ * 监听加速度数据,频率:5次/秒,接口调用后会自动开始监听,可使用 `Taro.stopAccelerometer` 停止监听。
77
+ * @supported weapp, alipay, swan, jd, qq, tt, h5, rn, harmony
78
+ * @example
79
+ * ```tsx
80
+ * Taro.onAccelerometerChange(res => {
81
+ * console.log(res.x)
82
+ * console.log(res.y)
83
+ * console.log(res.z)
84
+ * })
85
+ * ```
86
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.onAccelerometerChange.html
87
+ */
88
+ onAccelerometerChange(
89
+ callback: onAccelerometerChange.Callback
90
+ ): void
91
+
92
+ /**
93
+ * 取消监听加速度数据事件,参数为空,则取消所有的事件监听。
94
+ * @supported weapp, alipay, swan, jd, tt, h5, rn, harmony
95
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accelerometer/wx.offAccelerometerChange.html
96
+ */
97
+ offAccelerometerChange(
98
+ /** 加速度数据事件的回调函数 */
99
+ callback?: onAccelerometerChange.Callback
100
+ ): void
101
+ }
102
+ }
@@ -0,0 +1,26 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace checkIsOpenAccessibility {
5
+ interface Option {
6
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
7
+ complete?: (res: TaroGeneral.CallbackResult) => void
8
+ /** 接口调用失败的回调函数 */
9
+ fail?: (res: TaroGeneral.CallbackResult) => void
10
+ /** 接口调用成功的回调函数 */
11
+ success?: (result: SuccessCallbackResult) => void
12
+ }
13
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
14
+ /** iOS 上开启辅助功能旁白,安卓开启 talkback 时返回 true */
15
+ open: boolean
16
+ }
17
+ }
18
+
19
+ interface TaroStatic {
20
+ /** 检测是否开启视觉无障碍功能。
21
+ * @supported weapp, jd
22
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/accessibility/wx.checkIsOpenAccessibility.html
23
+ */
24
+ checkIsOpenAccessibility(option: checkIsOpenAccessibility.Option): Promise<TaroGeneral.CallbackResult>
25
+ }
26
+ }
@@ -0,0 +1,46 @@
1
+ import Taro from '../../index'
2
+
3
+ declare module '../../index' {
4
+ namespace getBatteryInfoSync {
5
+ interface Result {
6
+ /** 是否正在充电中 */
7
+ isCharging: boolean
8
+ /** 设备电量,范围 1 - 100 */
9
+ level: number
10
+ }
11
+ }
12
+
13
+ namespace getBatteryInfo {
14
+ interface Option {
15
+ /** 接口调用结束的回调函数(调用成功、失败都会执行) */
16
+ complete?: (res: TaroGeneral.CallbackResult) => void
17
+ /** 接口调用失败的回调函数 */
18
+ fail?: (res: TaroGeneral.CallbackResult) => void
19
+ /** 接口调用成功的回调函数 */
20
+ success?: (res: SuccessCallbackResult) => void
21
+ }
22
+
23
+ interface SuccessCallbackResult extends TaroGeneral.CallbackResult {
24
+ /** 是否正在充电中 */
25
+ isCharging: boolean
26
+ /** 设备电量,范围 1 - 100 */
27
+ level: number
28
+ /** 调用结果 */
29
+ errMsg: string
30
+ }
31
+ }
32
+
33
+ interface TaroStatic {
34
+ /** Taro.getBatteryInfo 的同步版本
35
+ * @supported weapp, alipay, swan, jd, qq, harmony
36
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfoSync.html
37
+ */
38
+ getBatteryInfoSync(): getBatteryInfoSync.Result
39
+
40
+ /** 获取设备电量。同步 API Taro.getBatteryInfoSync 在 iOS 上不可用。
41
+ * @supported weapp, alipay, swan, jd, qq, h5, harmony, harmony_hybrid
42
+ * @see https://developers.weixin.qq.com/miniprogram/dev/api/device/battery/wx.getBatteryInfo.html
43
+ */
44
+ getBatteryInfo(option?: getBatteryInfo.Option): Promise<getBatteryInfo.SuccessCallbackResult>
45
+ }
46
+ }