@ray-js/api 1.4.59 → 1.4.60

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,94 +1,7 @@
1
- declare enum WidgetVersionType {
2
- /** 线上版本 */
3
- release = 'release',
4
-
5
- /** 预发版本 */
6
- preview = 'preview',
7
- }
8
-
9
- declare enum WidgetPosition {
10
- /** 居底展示 */
11
- bottom = 'bottom',
12
-
13
- /** 居顶展示 */
14
- top = 'top',
15
- }
16
-
17
- declare enum HTTPMethod {
18
- /** HTTP 请求 OPTIONS */
19
- OPTIONS = 'OPTIONS',
20
-
21
- /** HTTP 请求 GET */
22
- GET = 'GET',
23
-
24
- /** HTTP 请求 HEAD */
25
- HEAD = 'HEAD',
26
-
27
- /** HTTP 请求 POST */
28
- POST = 'POST',
29
-
30
- /** HTTP 请求 PUT */
31
- PUT = 'PUT',
32
-
33
- /** HTTP 请求 DELETE */
34
- DELETE = 'DELETE',
35
-
36
- /** HTTP 请求 TRACE */
37
- TRACE = 'TRACE',
38
-
39
- /** HTTP 请求 TRACE */
40
- CONNECT = 'CONNECT',
41
- }
42
-
43
- declare enum AccelerometerInterval {
44
- /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
45
- game = 'game',
46
-
47
- /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
48
- ui = 'ui',
49
-
50
- /** 普通的回调频率,在 200ms/次 左右 */
51
- normal = 'normal',
52
- }
53
-
54
- declare enum DeviceMotionInterval {
55
- /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
56
- game = 'game',
57
-
58
- /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
59
- ui = 'ui',
60
-
61
- /** 普通的回调频率,在 200ms/次 左右 */
62
- normal = 'normal',
63
- }
64
-
65
- declare enum GyroscopeInterval {
66
- /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
67
- game = 'game',
68
-
69
- /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
70
- ui = 'ui',
71
-
72
- /** 普通的回调频率,在 200ms/次 左右 */
73
- normal = 'normal',
74
- }
75
-
76
- declare enum Themes {
77
- dark = 'dark',
78
-
79
- light = 'light',
80
- }
81
-
82
- declare enum Orientation {
83
- portrait = 'portrait',
84
-
85
- landscape = 'landscape',
86
- }
87
-
88
1
  /**
89
2
  * BaseKit
90
3
  *
91
- * @version 3.3.13
4
+ * @version 3.11.0
92
5
  */
93
6
  declare namespace ty {
94
7
  /**
@@ -112,7 +25,7 @@ declare namespace ty {
112
25
  */
113
26
  export function startAccelerometer(params?: {
114
27
  /** 监听加速度数据回调函数的执行频率 */
115
- interval?: keyof typeof AccelerometerInterval
28
+ interval?: AccelerometerInterval
116
29
  complete?: () => void
117
30
  success?: (params: null) => void
118
31
  fail?: (params: {
@@ -269,7 +182,7 @@ declare namespace ty {
269
182
  */
270
183
  export function startDeviceMotionListening(params?: {
271
184
  /** 监听加速度数据回调函数的执行频率 */
272
- interval?: keyof typeof DeviceMotionInterval
185
+ interval?: DeviceMotionInterval
273
186
  complete?: () => void
274
187
  success?: (params: null) => void
275
188
  fail?: (params: {
@@ -317,12 +230,34 @@ declare namespace ty {
317
230
  }) => void
318
231
  }): void
319
232
 
233
+ /**
234
+ * 写日志文件,需要APP配套使用检测设备网络功能进行日志上传查看。
235
+ */
236
+ export function writeLogFile(params: {
237
+ /** 标识信息,传入devId或groupId */
238
+ resId: string
239
+ /** 要写入的文本数据, 使用utf8编码 */
240
+ data: string
241
+ /** 内容添加形式,true为追加在文件尾部,false为覆写文件 */
242
+ append?: boolean
243
+ complete?: () => void
244
+ success?: (params: null) => void
245
+ fail?: (params: {
246
+ errorMsg: string
247
+ errorCode: string | number
248
+ innerError: {
249
+ errorCode: string | number
250
+ errorMsg: string
251
+ }
252
+ }) => void
253
+ }): void
254
+
320
255
  /**
321
256
  * 开始监听陀螺仪数据。
322
257
  */
323
258
  export function startGyroscope(params?: {
324
259
  /** 监听陀螺仪数据回调函数的执行频率 */
325
- interval?: keyof typeof GyroscopeInterval
260
+ interval?: GyroscopeInterval
326
261
  complete?: () => void
327
262
  success?: (params: null) => void
328
263
  fail?: (params: {
@@ -578,6 +513,24 @@ declare namespace ty {
578
513
  }) => void
579
514
  }): void
580
515
 
516
+ /**
517
+ * 保存图片到系统相册
518
+ */
519
+ export function saveImageToPhotosAlbum(params: {
520
+ /** 图片文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
521
+ filePath: string
522
+ complete?: () => void
523
+ success?: (params: null) => void
524
+ fail?: (params: {
525
+ errorMsg: string
526
+ errorCode: string | number
527
+ innerError: {
528
+ errorCode: string | number
529
+ errorMsg: string
530
+ }
531
+ }) => void
532
+ }): void
533
+
581
534
  /**
582
535
  * 显示消息提示框
583
536
  */
@@ -669,6 +622,8 @@ declare namespace ty {
669
622
  itemList: string[]
670
623
  /** 按钮的文字颜色 */
671
624
  itemColor?: string
625
+ /** 按钮的文字颜色 */
626
+ itemColors?: string[]
672
627
  complete?: () => void
673
628
  success?: (params: {
674
629
  /** 用户点击的按钮序号,从上到下的顺序,从0开始 */
@@ -999,10 +954,18 @@ declare namespace ty {
999
954
  bluetoothEnabled: boolean
1000
955
  locationEnabled: boolean
1001
956
  wifiEnabled: boolean
1002
- theme?: keyof typeof Themes
1003
- deviceOrientation?: keyof typeof Orientation
957
+ theme?: Themes
958
+ deviceOrientation?: Orientation
1004
959
  /** 设备等级(低:low-中:middle-高:high) */
1005
960
  deviceLevel: string
961
+ /** 手机系统是否支持创建快捷方式(仅Android使用) */
962
+ isSupportPinShortcut?: boolean
963
+ /**
964
+ * 设备类型
965
+ * phone:手机
966
+ * pad:平板
967
+ */
968
+ deviceType?: string
1006
969
  }) => void
1007
970
  fail?: (params: {
1008
971
  errorMsg: string
@@ -1047,10 +1010,18 @@ declare namespace ty {
1047
1010
  bluetoothEnabled: boolean
1048
1011
  locationEnabled: boolean
1049
1012
  wifiEnabled: boolean
1050
- theme?: keyof typeof Themes
1051
- deviceOrientation?: keyof typeof Orientation
1013
+ theme?: Themes
1014
+ deviceOrientation?: Orientation
1052
1015
  /** 设备等级(低:low-中:middle-高:high) */
1053
1016
  deviceLevel: string
1017
+ /** 手机系统是否支持创建快捷方式(仅Android使用) */
1018
+ isSupportPinShortcut?: boolean
1019
+ /**
1020
+ * 设备类型
1021
+ * phone:手机
1022
+ * pad:平板
1023
+ */
1024
+ deviceType?: string
1054
1025
  }
1055
1026
 
1056
1027
  /**
@@ -1368,6 +1339,36 @@ declare namespace ty {
1368
1339
  */
1369
1340
  export function clearStorageSync(): null
1370
1341
 
1342
+ /**
1343
+ * onKeyboardHeightChange 发送键盘事件给js
1344
+ */
1345
+ export function onKeyboardHeightChange(listener: (params: BeanRes) => void): void
1346
+
1347
+ /**
1348
+ * 取消监听:onKeyboardHeightChange 发送键盘事件给js
1349
+ */
1350
+ export function offKeyboardHeightChange(listener: (params: BeanRes) => void): void
1351
+
1352
+ /**
1353
+ * 键盘弹出
1354
+ */
1355
+ export function onKeyboardWillShow(listener: (params: BeanRes) => void): void
1356
+
1357
+ /**
1358
+ * 取消监听:键盘弹出
1359
+ */
1360
+ export function offKeyboardWillShow(listener: (params: BeanRes) => void): void
1361
+
1362
+ /**
1363
+ * 键盘消息
1364
+ */
1365
+ export function onKeyboardWillHide(listener: (params: BeanRes) => void): void
1366
+
1367
+ /**
1368
+ * 取消监听:键盘消息
1369
+ */
1370
+ export function offKeyboardWillHide(listener: (params: BeanRes) => void): void
1371
+
1371
1372
  /**
1372
1373
  * 系统音量监听通知事件
1373
1374
  *
@@ -1593,6 +1594,25 @@ declare namespace ty {
1593
1594
  }) => void
1594
1595
  ): void
1595
1596
 
1597
+ export enum WidgetVersionType {
1598
+ /** 线上版本 */
1599
+ release = 'release',
1600
+
1601
+ /** 预发版本 */
1602
+ preview = 'preview',
1603
+ }
1604
+
1605
+ export enum WidgetPosition {
1606
+ /** 居底展示 */
1607
+ bottom = 'bottom',
1608
+
1609
+ /** 居顶展示 */
1610
+ top = 'top',
1611
+
1612
+ /** 居中展示 */
1613
+ center = 'center',
1614
+ }
1615
+
1596
1616
  export type Profile = {
1597
1617
  /** 第一个 HTTP 重定向发生时的时间。有跳转且是同域名内的重定向才算,否则值为 0 */
1598
1618
  redirectStart: number
@@ -1731,6 +1751,65 @@ declare namespace ty {
1731
1751
  encoding?: string
1732
1752
  }
1733
1753
 
1754
+ export enum HTTPMethod {
1755
+ /** HTTP 请求 OPTIONS */
1756
+ OPTIONS = 'OPTIONS',
1757
+
1758
+ /** HTTP 请求 GET */
1759
+ GET = 'GET',
1760
+
1761
+ /** HTTP 请求 HEAD */
1762
+ HEAD = 'HEAD',
1763
+
1764
+ /** HTTP 请求 POST */
1765
+ POST = 'POST',
1766
+
1767
+ /** HTTP 请求 PUT */
1768
+ PUT = 'PUT',
1769
+
1770
+ /** HTTP 请求 DELETE */
1771
+ DELETE = 'DELETE',
1772
+
1773
+ /** HTTP 请求 TRACE */
1774
+ TRACE = 'TRACE',
1775
+
1776
+ /** HTTP 请求 TRACE */
1777
+ CONNECT = 'CONNECT',
1778
+ }
1779
+
1780
+ export enum AccelerometerInterval {
1781
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
1782
+ game = 'game',
1783
+
1784
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
1785
+ ui = 'ui',
1786
+
1787
+ /** 普通的回调频率,在 200ms/次 左右 */
1788
+ normal = 'normal',
1789
+ }
1790
+
1791
+ export enum DeviceMotionInterval {
1792
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
1793
+ game = 'game',
1794
+
1795
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
1796
+ ui = 'ui',
1797
+
1798
+ /** 普通的回调频率,在 200ms/次 左右 */
1799
+ normal = 'normal',
1800
+ }
1801
+
1802
+ export enum GyroscopeInterval {
1803
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
1804
+ game = 'game',
1805
+
1806
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
1807
+ ui = 'ui',
1808
+
1809
+ /** 普通的回调频率,在 200ms/次 左右 */
1810
+ normal = 'normal',
1811
+ }
1812
+
1734
1813
  export type TempFileCB = {
1735
1814
  /** 本地临时文件路径 (本地路径) */
1736
1815
  path: string
@@ -1768,6 +1847,18 @@ declare namespace ty {
1768
1847
  height: number
1769
1848
  }
1770
1849
 
1850
+ export enum Themes {
1851
+ dark = 'dark',
1852
+
1853
+ light = 'light',
1854
+ }
1855
+
1856
+ export enum Orientation {
1857
+ portrait = 'portrait',
1858
+
1859
+ landscape = 'landscape',
1860
+ }
1861
+
1771
1862
  export type StorageDataBean = {
1772
1863
  /** 本地缓存中指定的 key */
1773
1864
  key: string
@@ -1780,6 +1871,11 @@ declare namespace ty {
1780
1871
  key: string
1781
1872
  }
1782
1873
 
1874
+ export type BeanRes = {
1875
+ /** 键盘高度 */
1876
+ height: number
1877
+ }
1878
+
1783
1879
  export type CurrentVolumeResponse = {
1784
1880
  /** 音量,阈值【0 - 1】 */
1785
1881
  value: number
@@ -1891,11 +1987,11 @@ declare namespace ty {
1891
1987
  /** 小部件样式,默认middle */
1892
1988
  style?: string
1893
1989
  /** 版本类型,默认release */
1894
- versionType?: keyof typeof WidgetVersionType
1990
+ versionType?: WidgetVersionType
1895
1991
  /** 版本号 */
1896
1992
  version?: string
1897
1993
  /** 展示位置,默认bottom */
1898
- position?: keyof typeof WidgetPosition
1994
+ position?: WidgetPosition
1899
1995
  /** 点击空白处是否关闭 */
1900
1996
  autoDismiss?: boolean
1901
1997
  /**
@@ -1914,7 +2010,7 @@ declare namespace ty {
1914
2010
 
1915
2011
  export type DeviceMotionBean = {
1916
2012
  /** 监听加速度数据回调函数的执行频率 */
1917
- interval?: keyof typeof DeviceMotionInterval
2013
+ interval?: DeviceMotionInterval
1918
2014
  }
1919
2015
 
1920
2016
  export type DownLoadBean = {
@@ -1978,9 +2074,18 @@ declare namespace ty {
1978
2074
  filePath: string
1979
2075
  }
1980
2076
 
2077
+ export type LogFileParams = {
2078
+ /** 标识信息,传入devId或groupId */
2079
+ resId: string
2080
+ /** 要写入的文本数据, 使用utf8编码 */
2081
+ data: string
2082
+ /** 内容添加形式,true为追加在文件尾部,false为覆写文件 */
2083
+ append?: boolean
2084
+ }
2085
+
1981
2086
  export type GyroscopeBean = {
1982
2087
  /** 监听陀螺仪数据回调函数的执行频率 */
1983
- interval?: keyof typeof GyroscopeInterval
2088
+ interval?: GyroscopeInterval
1984
2089
  }
1985
2090
 
1986
2091
  export type ChooseImageBean = {
@@ -2124,6 +2229,11 @@ declare namespace ty {
2124
2229
  filePath: string
2125
2230
  }
2126
2231
 
2232
+ export type SaveImageParams = {
2233
+ /** 图片文件路径,可以是临时文件路径也可以是永久文件路径 (本地路径) */
2234
+ filePath: string
2235
+ }
2236
+
2127
2237
  export type ToastBean = {
2128
2238
  /** 提示的内容 */
2129
2239
  title: string
@@ -2175,6 +2285,8 @@ declare namespace ty {
2175
2285
  itemList: string[]
2176
2286
  /** 按钮的文字颜色 */
2177
2287
  itemColor?: string
2288
+ /** 按钮的文字颜色 */
2289
+ itemColors?: string[]
2178
2290
  }
2179
2291
 
2180
2292
  export type ActionSheetCallback = {
@@ -2194,7 +2306,7 @@ declare namespace ty {
2194
2306
  /** 超时时间,单位为毫秒 */
2195
2307
  timeout?: number
2196
2308
  /** HTTP 请求方法 */
2197
- method?: keyof typeof HTTPMethod
2309
+ method?: HTTPMethod
2198
2310
  /** 返回的数据格式 */
2199
2311
  dataType?: any
2200
2312
  /** 返回的数据类型 */
@@ -2348,10 +2460,18 @@ declare namespace ty {
2348
2460
  bluetoothEnabled: boolean
2349
2461
  locationEnabled: boolean
2350
2462
  wifiEnabled: boolean
2351
- theme?: keyof typeof Themes
2352
- deviceOrientation?: keyof typeof Orientation
2463
+ theme?: Themes
2464
+ deviceOrientation?: Orientation
2353
2465
  /** 设备等级(低:low-中:middle-高:high) */
2354
2466
  deviceLevel: string
2467
+ /** 手机系统是否支持创建快捷方式(仅Android使用) */
2468
+ isSupportPinShortcut?: boolean
2469
+ /**
2470
+ * 设备类型
2471
+ * phone:手机
2472
+ * pad:平板
2473
+ */
2474
+ deviceType?: string
2355
2475
  }
2356
2476
 
2357
2477
  export type GetConnectedWifiParams = {
@@ -2668,11 +2788,11 @@ declare namespace ty {
2668
2788
  /** 小部件样式,默认middle */
2669
2789
  style?: string
2670
2790
  /** 版本类型,默认release */
2671
- versionType?: keyof typeof WidgetVersionType
2791
+ versionType?: WidgetVersionType
2672
2792
  /** 版本号 */
2673
2793
  version?: string
2674
2794
  /** 展示位置,默认bottom */
2675
- position?: keyof typeof WidgetPosition
2795
+ position?: WidgetPosition
2676
2796
  /** 点击空白处是否关闭 */
2677
2797
  autoDismiss?: boolean
2678
2798
  /**
@@ -3095,7 +3215,7 @@ declare namespace ty {
3095
3215
  /** 超时时间,单位为毫秒 */
3096
3216
  timeout?: number
3097
3217
  /** HTTP 请求方法 */
3098
- method?: keyof typeof HTTPMethod
3218
+ method?: HTTPMethod
3099
3219
  /** 返回的数据格式 */
3100
3220
  dataType?: any
3101
3221
  /** 返回的数据类型 */
package/@types/index.d.ts CHANGED
@@ -15,3 +15,90 @@ interface I18nInfo {
15
15
  declare class I18n {
16
16
  static t: (key: string) => string
17
17
  }
18
+
19
+ declare enum WidgetVersionType {
20
+ /** 线上版本 */
21
+ release = 'release',
22
+
23
+ /** 预发版本 */
24
+ preview = 'preview',
25
+ }
26
+
27
+ declare enum WidgetPosition {
28
+ /** 居底展示 */
29
+ bottom = 'bottom',
30
+
31
+ /** 居顶展示 */
32
+ top = 'top',
33
+ }
34
+
35
+ declare enum HTTPMethod {
36
+ /** HTTP 请求 OPTIONS */
37
+ OPTIONS = 'OPTIONS',
38
+
39
+ /** HTTP 请求 GET */
40
+ GET = 'GET',
41
+
42
+ /** HTTP 请求 HEAD */
43
+ HEAD = 'HEAD',
44
+
45
+ /** HTTP 请求 POST */
46
+ POST = 'POST',
47
+
48
+ /** HTTP 请求 PUT */
49
+ PUT = 'PUT',
50
+
51
+ /** HTTP 请求 DELETE */
52
+ DELETE = 'DELETE',
53
+
54
+ /** HTTP 请求 TRACE */
55
+ TRACE = 'TRACE',
56
+
57
+ /** HTTP 请求 TRACE */
58
+ CONNECT = 'CONNECT',
59
+ }
60
+
61
+ declare enum AccelerometerInterval {
62
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
63
+ game = 'game',
64
+
65
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
66
+ ui = 'ui',
67
+
68
+ /** 普通的回调频率,在 200ms/次 左右 */
69
+ normal = 'normal',
70
+ }
71
+
72
+ declare enum DeviceMotionInterval {
73
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
74
+ game = 'game',
75
+
76
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
77
+ ui = 'ui',
78
+
79
+ /** 普通的回调频率,在 200ms/次 左右 */
80
+ normal = 'normal',
81
+ }
82
+
83
+ declare enum GyroscopeInterval {
84
+ /** 适用于更新游戏的回调频率,在 20ms/次 左右 */
85
+ game = 'game',
86
+
87
+ /** 适用于更新 UI 的回调频率,在 60ms/次 左右 */
88
+ ui = 'ui',
89
+
90
+ /** 普通的回调频率,在 200ms/次 左右 */
91
+ normal = 'normal',
92
+ }
93
+
94
+ declare enum Themes {
95
+ dark = 'dark',
96
+
97
+ light = 'light',
98
+ }
99
+
100
+ declare enum Orientation {
101
+ portrait = 'portrait',
102
+
103
+ landscape = 'landscape',
104
+ }
@@ -81,3 +81,4 @@ export declare const getRecorderManager: typeof ty.getRecorderManager;
81
81
  export declare const uploadFile: typeof ty.uploadFile;
82
82
  export declare const openMiniWidget: typeof ty.openMiniWidget;
83
83
  export declare const getCurrentVolumeByMode: typeof ty.getCurrentVolumeByMode;
84
+ export declare const saveImageToPhotosAlbum: typeof ty.saveImageToPhotosAlbum;
@@ -86,4 +86,7 @@ export const uploadFile = factory('uploadFile');
86
86
  export const openMiniWidget = factory('openMiniWidget');
87
87
 
88
88
  // 3.3.10 新增 - 4.8.0 容器
89
- export const getCurrentVolumeByMode = factory('getCurrentVolumeByMode');
89
+ export const getCurrentVolumeByMode = factory('getCurrentVolumeByMode');
90
+
91
+ // 3.11.0 新增 - 5.12.0
92
+ export const saveImageToPhotosAlbum = factory('saveImageToPhotosAlbum');
package/lib/all-kits.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export * from './BaseKit-3.3.10';
1
+ export * from './BaseKit-3.11.0';
2
2
  export * from './BizKit-3.2.7';
3
3
  export * from './DeviceKit-3.3.1';
4
4
  export * from './MiniKit-3.1.0';
package/lib/all-kits.js CHANGED
@@ -1,4 +1,4 @@
1
- export * from './BaseKit-3.3.10';
1
+ export * from './BaseKit-3.11.0';
2
2
  export * from './BizKit-3.2.7';
3
3
  export * from './DeviceKit-3.3.1';
4
4
  export * from './MiniKit-3.1.0';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ray-js/api",
3
- "version": "1.4.59",
3
+ "version": "1.4.60",
4
4
  "description": "Ray universal api",
5
5
  "keywords": [
6
6
  "ray"
@@ -29,14 +29,14 @@
29
29
  "watch": "ray start --type=component"
30
30
  },
31
31
  "dependencies": {
32
- "@ray-js/framework": "1.4.59",
33
- "@ray-js/router": "1.4.59",
32
+ "@ray-js/framework": "1.4.60",
33
+ "@ray-js/router": "1.4.60",
34
34
  "@ray-js/wechat": "^0.2.8",
35
35
  "base64-browser": "^1.0.1",
36
36
  "query-string": "^7.1.3"
37
37
  },
38
38
  "devDependencies": {
39
- "@ray-js/cli": "1.4.59",
39
+ "@ray-js/cli": "1.4.60",
40
40
  "art-template": "^4.13.2",
41
41
  "fs-extra": "^10.1.0",
42
42
  "miniprogram-api-typings": "^3.12.2",
@@ -46,5 +46,5 @@
46
46
  "access": "public",
47
47
  "registry": "https://registry.npmjs.org"
48
48
  },
49
- "gitHead": "c0bcde71486faae4c61552e1bd83cef73cbabc1e"
49
+ "gitHead": "fe03dd457a54ab78a75747bcb370a48213086b06"
50
50
  }