@dcloudio/uni-app-x 0.6.2 → 0.6.4

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dcloudio/uni-app-x",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
4
4
  "description": "uni-app x types",
5
5
  "typings": "index.d.ts",
6
6
  "author": "DCloud",
@@ -1,4 +1,5 @@
1
1
  import { IPageManager } from "./IPageManager"
2
+ import { NativeLoadFontFaceOptions } from "./NativeLoadFontFaceOptions"
2
3
 
3
4
  /**
4
5
  * @package io.dcloud.uniapp.runtime
@@ -21,7 +22,7 @@ export interface IApp {
21
22
 
22
23
  getAppStartDuration(): number
23
24
 
24
- loadFontFace(options: LoadFontFaceOptions): void
25
+ loadFontFace(options: NativeLoadFontFaceOptions): void
25
26
 
26
27
  getRedirectInfo(): Map<string, any | null>
27
28
  }
@@ -6,6 +6,7 @@ import { PageEvent } from "./PageEvent";
6
6
  import { PageScrollEvent } from "./PageScrollEvent";
7
7
  import { ResizeEvent } from "./ResizeEvent";
8
8
  import { ITabsNode } from "./UniTabsElement";
9
+ import { NativeLoadFontFaceOptions } from './NativeLoadFontFaceOptions'
9
10
 
10
11
  export enum Type {
11
12
  DEFAULT,
@@ -115,8 +116,7 @@ export interface IPage {
115
116
  dispatchPageEvent(event: string, data: PageEvent): void
116
117
  viewToTempFilePath(options: ViewToTempFilePathOptions): void
117
118
  dispatchActivityState(key: number, ...params: any[]): void
118
- // LoadFontFaceOptions 类型全局命名冲突
119
- // loadFontFace(options: LoadFontFaceOptions): void
119
+ loadFontFace(options: NativeLoadFontFaceOptions): void
120
120
  /**
121
121
  * 停止排版渲染
122
122
  */
@@ -0,0 +1,11 @@
1
+ import { UniError } from './UniError'
2
+
3
+ export class NativeLoadFontFaceFail extends UniError { }
4
+
5
+ export class NativeLoadFontFaceOptions {
6
+ family?: string | null
7
+ source?: string | null
8
+ success?: (res: any) => void
9
+ fail?: (res: NativeLoadFontFaceFail) => void
10
+ complete?: (res: any) => void
11
+ }
@@ -68,6 +68,8 @@ import {
68
68
  NodeData as NodeDataOrigin,
69
69
  INodeData as INodeDataOrigin,
70
70
  NestedPreScrollEvent as NestedPreScrollEventOrigin,
71
+ NativeLoadFontFaceFail as NativeLoadFontFaceFailOrigin,
72
+ NativeLoadFontFaceOptions as NativeLoadFontFaceOptionsOrigin,
71
73
  MouseEvent as MouseEventOrigin,
72
74
  InputKeyboardHeightChangeEvent as InputKeyboardHeightChangeEventOrigin,
73
75
  InputFocusEvent as InputFocusEventOrigin,
@@ -208,6 +210,10 @@ declare global {
208
210
  type INodeData = INodeDataOrigin
209
211
  const NestedPreScrollEvent: typeof NestedPreScrollEventOrigin
210
212
  type NestedPreScrollEvent = NestedPreScrollEventOrigin
213
+ const NativeLoadFontFaceFail: typeof NativeLoadFontFaceFailOrigin
214
+ type NativeLoadFontFaceFail = NativeLoadFontFaceFailOrigin
215
+ const NativeLoadFontFaceOptions: typeof NativeLoadFontFaceOptionsOrigin
216
+ type NativeLoadFontFaceOptions = NativeLoadFontFaceOptionsOrigin
211
217
  const MouseEvent: typeof MouseEventOrigin
212
218
  type MouseEvent = MouseEventOrigin
213
219
  const InputKeyboardHeightChangeEvent: typeof InputKeyboardHeightChangeEventOrigin
@@ -36,6 +36,7 @@ export * from './PageScrollEvent'
36
36
  export * from './PageEvent'
37
37
  export * from './NodeData'
38
38
  export * from './NestedPreScrollEvent'
39
+ export * from './NativeLoadFontFaceOptions'
39
40
  export * from './MouseEvent'
40
41
  export * from './InputKeyboardHeightChangeEvent'
41
42
  export * from './InputFocusEvent'
@@ -4,11 +4,28 @@ export type ReadFileSuccessResult = {
4
4
  }
5
5
 
6
6
 
7
- export type ReadFileSuccessCallback = (res: ReadFileSuccessResult) => void
7
+ /**
8
+ * 通用的正确返回结果
9
+ */
10
+ export type FileManagerSuccessResult = {
11
+ errMsg: string,
12
+ }
13
+ /**
14
+ * 通用的正确返回结果回调
15
+ */
16
+ export type FileManagerSuccessCallback = (res: FileManagerSuccessResult) => void
17
+ /**
18
+ * 通用的错误返回结果回调
19
+ */
20
+ export type FileManagerFailCallback = (res: UniError) => void
21
+ /**
22
+ * 通用的结束返回结果回调
23
+ */
24
+ export type FileManagerCompleteCallback = (res: any) => void
8
25
 
9
- export type ReadFileFailCallback = (res: UniError) => void
10
26
 
11
- export type ReadFileCompleteCallback = (res: any) => void
27
+
28
+ export type ReadFileSuccessCallback = (res: ReadFileSuccessResult) => void
12
29
 
13
30
 
14
31
 
@@ -28,53 +45,275 @@ export type ReadFileOptions = {
28
45
  /**
29
46
  * 接口调用失败的回调函数
30
47
  */
31
- fail?: ReadFileFailCallback | null,
48
+ fail?: FileManagerFailCallback | null,
32
49
  /**
33
50
  * 接口调用结束的回调函数(调用成功、失败都会执行)
34
51
  */
35
- complete?: ReadFileCompleteCallback | null
52
+ complete?: FileManagerCompleteCallback | null
36
53
  }
37
54
 
38
55
 
39
- export type WriteFileSuccessResult = {
56
+
57
+
58
+
59
+ export type WriteFileOptions = {
60
+ /**
61
+ * 文件路径,只支持绝对地址
62
+ */
40
63
  filePath: string,
64
+ /**
65
+ * 写入的文本内容
66
+ */
67
+ data: string,
68
+ /**
69
+ * 接口调用的回调函数
70
+ */
71
+ success?: FileManagerSuccessCallback | null,
72
+ /**
73
+ * 接口调用失败的回调函数
74
+ */
75
+ fail?: FileManagerFailCallback | null,
76
+ /**
77
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
78
+ */
79
+ complete?: FileManagerCompleteCallback | null
41
80
  }
42
81
 
43
82
 
44
- export type WriteFileSuccessCallback = (res: WriteFileSuccessResult) => void
45
83
 
46
- export type WriteFileFailCallback = (res: UniError) => void
84
+ export type UnLinkSuccessCallback = (res: FileManagerSuccessResult) => void
47
85
 
48
- export type WriteFileCompleteCallback = (res: any) => void
49
86
 
50
87
 
51
- export type WriteFileOptions = {
88
+ export type UnLinkOptions = {
52
89
  /**
53
90
  * 文件路径,只支持绝对地址
54
91
  */
55
92
  filePath: string,
56
93
  /**
57
- * 写入的文本内容
94
+ * 接口调用的回调函数
58
95
  */
59
- data: string,
96
+ success?: UnLinkSuccessCallback | null,
97
+ /**
98
+ * 接口调用失败的回调函数
99
+ */
100
+ fail?: FileManagerFailCallback | null,
101
+ /**
102
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
103
+ */
104
+ complete?: FileManagerCompleteCallback | null
105
+ }
106
+
107
+ export type MkDirSuccessCallback = (res: FileManagerSuccessResult) => void
108
+
109
+
110
+
111
+
112
+ export type MkDirOptions = {
113
+ /**
114
+ * 创建的目录路径 (本地路径)
115
+ */
116
+ dirPath: string,
117
+ /**
118
+ *是否在递归创建该目录的上级目录后再创建该目录。如果对应的上级目录已经存在,则不创建该上级目录。如 dirPath 为 a/b/c/d 且 recursive 为 true,将创建 a 目录,再在 a 目录下创建 b 目录,以此类推直至创建 a/b/c 目录下的 d 目录。
119
+ */
120
+ recursive: boolean,
121
+ /**
122
+ * 接口调用的回调函数
123
+ */
124
+ success?: MkDirSuccessCallback | null,
125
+ /**
126
+ * 接口调用失败的回调函数
127
+ */
128
+ fail?: FileManagerFailCallback | null,
129
+ /**
130
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
131
+ */
132
+ complete?: FileManagerCompleteCallback | null
133
+ }
134
+
135
+
136
+ export type RmDirSuccessCallback = (res: FileManagerSuccessResult) => void
137
+
138
+
139
+
140
+
141
+ export type RmDirOptions = {
142
+ /**
143
+ * 要删除的目录路径 (本地路径)
144
+ */
145
+ dirPath: string,
146
+ /**
147
+ *是否递归删除目录。如果为 true,则删除该目录和该目录下的所有子目录以及文件。
148
+ */
149
+ recursive: boolean,
60
150
  /**
61
151
  * 接口调用的回调函数
62
152
  */
63
- success?: WriteFileSuccessCallback | null,
153
+ success?: MkDirSuccessCallback | null,
64
154
  /**
65
155
  * 接口调用失败的回调函数
66
156
  */
67
- fail?: WriteFileFailCallback | null,
157
+ fail?: FileManagerFailCallback | null,
68
158
  /**
69
159
  * 接口调用结束的回调函数(调用成功、失败都会执行)
70
160
  */
71
- complete?: WriteFileCompleteCallback | null
161
+ complete?: FileManagerCompleteCallback | null
72
162
  }
73
163
 
74
164
 
165
+ export type ReadDirSuccessResult = {
166
+ files: string[],
167
+ }
168
+
169
+ export type ReadDirSuccessCallback = (res: ReadDirSuccessResult) => void
170
+
171
+
172
+ export type ReadDirOptions = {
173
+ /**
174
+ * 要读取的目录路径 (本地路径)
175
+ */
176
+ dirPath: string,
177
+
178
+ /**
179
+ * 接口调用的回调函数
180
+ */
181
+ success?: ReadDirSuccessCallback | null,
182
+ /**
183
+ * 接口调用失败的回调函数
184
+ */
185
+ fail?: FileManagerFailCallback | null,
186
+ /**
187
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
188
+ */
189
+ complete?: FileManagerCompleteCallback | null
190
+ }
191
+
192
+
193
+
194
+
195
+ export type AccessOptions = {
196
+ /**
197
+ * 要删除的目录路径 (本地路径)
198
+ */
199
+ path: string,
200
+
201
+ /**
202
+ * 接口调用的回调函数
203
+ */
204
+ success?: FileManagerSuccessCallback | null,
205
+ /**
206
+ * 接口调用失败的回调函数
207
+ */
208
+ fail?: FileManagerFailCallback | null,
209
+ /**
210
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
211
+ */
212
+ complete?: FileManagerCompleteCallback | null
213
+ }
214
+
215
+ export type RenameOptions = {
216
+ /**
217
+ * 源文件路径,支持本地路径
218
+ */
219
+ oldPath: string,
220
+ /**
221
+ * 新文件路径,支持本地路径
222
+ */
223
+ newPath: string,
224
+
225
+ /**
226
+ * 接口调用的回调函数
227
+ */
228
+ success?: FileManagerSuccessCallback | null,
229
+ /**
230
+ * 接口调用失败的回调函数
231
+ */
232
+ fail?: FileManagerFailCallback | null,
233
+ /**
234
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
235
+ */
236
+ complete?: FileManagerCompleteCallback | null
237
+ }
238
+
239
+ export type CopyFileOptions = {
240
+ /**
241
+ * 源文件路径,支持本地路径
242
+ */
243
+ srcPath: string,
244
+ /**
245
+ * 新文件路径,支持本地路径
246
+ */
247
+ destPath: string,
248
+
249
+ /**
250
+ * 接口调用的回调函数
251
+ */
252
+ success?: FileManagerSuccessCallback | null,
253
+ /**
254
+ * 接口调用失败的回调函数
255
+ */
256
+ fail?: FileManagerFailCallback | null,
257
+ /**
258
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
259
+ */
260
+ complete?: FileManagerCompleteCallback | null
261
+ }
262
+
263
+
264
+ export type GetFileInfoSuccessResult = {
265
+ digest: string,
266
+ size:number,
267
+ errMsg:string
268
+ }
269
+
270
+ export type GetFileInfoSuccessCallback = (res: GetFileInfoSuccessResult) => void
271
+
272
+ export type GetFileInfoOptions = {
273
+ /**
274
+ * 要读取的文件路径 (本地路径)
275
+ */
276
+ filePath: string,
277
+ /**
278
+ * md5 / sha1
279
+ */
280
+ digestAlgorithm: string|null,
281
+ /**
282
+ * 接口调用的回调函数
283
+ */
284
+ success?: GetFileInfoSuccessCallback | null,
285
+ /**
286
+ * 接口调用失败的回调函数
287
+ */
288
+ fail?: FileManagerFailCallback | null,
289
+ /**
290
+ * 接口调用结束的回调函数(调用成功、失败都会执行)
291
+ */
292
+ complete?: FileManagerCompleteCallback | null
293
+ }
294
+
295
+
296
+
75
297
  export interface FileSystemManager {
76
298
  readFile(config: ReadFileOptions): void;
299
+ // readFileSync(filePath: string,encoding:string): string|null;
77
300
  writeFile(config: WriteFileOptions): void;
301
+ // writeFileSync(filePath: string,data:string): number;
302
+ unlink(config: UnLinkOptions): void;
303
+ // unlinkSync(filePath: string): number;
304
+ mkdir(config: MkDirOptions): void;
305
+ // mkdirSync(dirPath: string,recursive:boolean): number;
306
+ rmdir(config: RmDirOptions): void;
307
+ // rmdirSync(dirPath: string,recursive:boolean): number;
308
+ readdir(config: ReadDirOptions): void;
309
+ // readdirSync(dirPath: string): string[] | null;
310
+ access(config: AccessOptions): void;
311
+ // accessSync(path: string): number;
312
+ rename(config: RenameOptions): void;
313
+ // renameSync(oldPath:string,newPath:string): number;
314
+ copyFile(config: CopyFileOptions): void;
315
+ // copyFileSync(srcPath:string,destPath:string): number;
316
+ getFileInfo(config: GetFileInfoOptions): void;
78
317
  }
79
318
 
80
319
 
@@ -17,7 +17,6 @@ import {
17
17
  LoginComplete as LoginCompleteOrigin,
18
18
  LoginCompleteCallback as LoginCompleteCallbackOrigin,
19
19
  UniverifyErrorCode as UniverifyErrorCodeOrigin,
20
- UniverifyErrorCode as UniverifyErrorCodeOrigin,
21
20
  InternalResponse as InternalResponseOrigin,
22
21
  Uni as UniOrigin
23
22
  } from './interface'
@@ -40,7 +39,6 @@ declare global {
40
39
  type LoginComplete = LoginCompleteOrigin
41
40
  type LoginCompleteCallback = LoginCompleteCallbackOrigin
42
41
  type UniverifyErrorCode = UniverifyErrorCodeOrigin
43
- type UniverifyErrorCode = UniverifyErrorCodeOrigin
44
42
  type InternalResponse = InternalResponseOrigin
45
43
  interface Uni extends UniOrigin { }
46
44
  }
@@ -94,7 +94,7 @@ export interface UniverifyManager {
94
94
  * }
95
95
  * }
96
96
  */
97
- isPreLoginResultValid() : boolean
97
+ isPreLoginValid() : boolean
98
98
  }
99
99
 
100
100
  /**
@@ -150,7 +150,7 @@ export type LoginSuccess = {
150
150
  /**
151
151
  * 登录授权唯一标识
152
152
  */
153
- openid : string,
153
+ openId : string,
154
154
  /**
155
155
  * token
156
156
  */
@@ -171,7 +171,6 @@ export type LoginCompleteCallback = (res : LoginComplete) => void
171
171
  * 30005 预登录失败
172
172
  * 30006 一键登录失败
173
173
  */
174
- // export type UniverifyErrorCode = 30002 | 30003 | 30004 | 30005 | 30006;
175
174
  export type UniverifyErrorCode = 30004 | 30005 | 30006;
176
175
 
177
176
  /**
@@ -6,6 +6,8 @@ import {
6
6
  ConnectSocketFail as ConnectSocketFailOrigin,
7
7
  ConnectSocketOptions as ConnectSocketOptionsOrigin,
8
8
  GeneralCallbackResult as GeneralCallbackResultOrigin,
9
+ SendSocketMessageErrorCode as SendSocketMessageErrorCodeOrigin,
10
+ SendSocketMessageFail as SendSocketMessageFailOrigin,
9
11
  SendSocketMessageOptions as SendSocketMessageOptionsOrigin,
10
12
  CloseSocketOptions as CloseSocketOptionsOrigin,
11
13
  OnSocketOpenCallbackResult as OnSocketOpenCallbackResultOrigin,
@@ -33,6 +35,8 @@ declare global {
33
35
  type ConnectSocketFail = ConnectSocketFailOrigin
34
36
  type ConnectSocketOptions = ConnectSocketOptionsOrigin
35
37
  type GeneralCallbackResult = GeneralCallbackResultOrigin
38
+ type SendSocketMessageErrorCode = SendSocketMessageErrorCodeOrigin
39
+ type SendSocketMessageFail = SendSocketMessageFailOrigin
36
40
  type SendSocketMessageOptions = SendSocketMessageOptionsOrigin
37
41
  type CloseSocketOptions = CloseSocketOptionsOrigin
38
42
  type OnSocketOpenCallbackResult = OnSocketOpenCallbackResultOrigin
@@ -264,6 +264,19 @@ export type GeneralCallbackResult = {
264
264
  * 错误信息
265
265
  */
266
266
  errMsg: string
267
+ };
268
+ /**
269
+ * 错误码
270
+ * - 10001 发送数据超限,发送队列不能超过16M大小。
271
+ * - 10002 websocket未连接
272
+ * - 602001 websocket系统错误
273
+ */
274
+ export type SendSocketMessageErrorCode = 10001 | 10002 | 602001;
275
+ /**
276
+ * 发送失败的错误回调参数
277
+ */
278
+ export interface SendSocketMessageFail extends IUniError {
279
+ errCode: SendSocketMessageErrorCode;
267
280
  };
268
281
  export type SendSocketMessageOptions = {
269
282
  /**
@@ -281,12 +294,12 @@ export type SendSocketMessageOptions = {
281
294
  * 接口调用失败的回调函数
282
295
  * @defaultValue null
283
296
  */
284
- fail?: ((result: GeneralCallbackResult) => void) | null,
297
+ fail?: ((result: SendSocketMessageFail) => void) | null,
285
298
  /**
286
299
  * 接口调用结束的回调函数(调用成功、失败都会执行)
287
300
  * @defaultValue null
288
301
  */
289
- complete?: ((result: GeneralCallbackResult) => void) | null
302
+ complete?: ((result: any) => void) | null
290
303
  };
291
304
  export type CloseSocketOptions = {
292
305
  /**