@fox-js/fox 2.1.0 → 3.0.2
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/libs/index.css +144 -1
- package/libs/index.d.ts +1725 -0
- package/libs/index.js +1 -1
- package/main.js +1 -4
- package/package.json +8 -4
package/libs/index.d.ts
ADDED
|
@@ -0,0 +1,1725 @@
|
|
|
1
|
+
import { Ref, ComponentInternalInstance, App } from 'vue';
|
|
2
|
+
|
|
3
|
+
declare const idKey: unique symbol;
|
|
4
|
+
declare const valueKey: unique symbol;
|
|
5
|
+
declare const childrenKey: unique symbol;
|
|
6
|
+
declare const growKey: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* tree node
|
|
9
|
+
*/
|
|
10
|
+
interface TreeNode {
|
|
11
|
+
[propName: string]: any;
|
|
12
|
+
[idKey]: string;
|
|
13
|
+
[valueKey]: any;
|
|
14
|
+
[growKey]: boolean;
|
|
15
|
+
[childrenKey]: Map<string, TreeNode>;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* tree接口
|
|
19
|
+
*/
|
|
20
|
+
interface Tree extends TreeNode {
|
|
21
|
+
/**
|
|
22
|
+
* 加入数据
|
|
23
|
+
* @param args
|
|
24
|
+
* @returns {boolean}
|
|
25
|
+
*/
|
|
26
|
+
put(...args: any[]): boolean;
|
|
27
|
+
/**
|
|
28
|
+
* 获取内容
|
|
29
|
+
* @param args
|
|
30
|
+
* @returns {any}
|
|
31
|
+
*/
|
|
32
|
+
get(...args: any[]): any | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* 移除数据
|
|
35
|
+
* @param args
|
|
36
|
+
* @returns {boolean}
|
|
37
|
+
*/
|
|
38
|
+
remove(...args: any[]): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* 判断是否包含数据
|
|
41
|
+
* @param args
|
|
42
|
+
* @returns {boolean}
|
|
43
|
+
*/
|
|
44
|
+
contains(...args: any[]): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 清空所以数据
|
|
47
|
+
*/
|
|
48
|
+
clear(): void;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* 导出Bus
|
|
52
|
+
*/
|
|
53
|
+
declare let Bus: any;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 更新类型
|
|
57
|
+
*/
|
|
58
|
+
declare enum UpdateType {
|
|
59
|
+
/**
|
|
60
|
+
* 部分替换
|
|
61
|
+
*/
|
|
62
|
+
Part = 0,
|
|
63
|
+
/**
|
|
64
|
+
* 整体替换
|
|
65
|
+
*/
|
|
66
|
+
All = 1
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 操作类型
|
|
71
|
+
* @type {Enum}
|
|
72
|
+
*/
|
|
73
|
+
declare enum OperationType {
|
|
74
|
+
/**
|
|
75
|
+
* Push策略(生产历史记录)
|
|
76
|
+
*/
|
|
77
|
+
Push = 0,
|
|
78
|
+
/**
|
|
79
|
+
* 替换策略(替换当前历史记录)
|
|
80
|
+
*/
|
|
81
|
+
Replace = 1,
|
|
82
|
+
/**
|
|
83
|
+
* 修改策略(不影响历史记录)
|
|
84
|
+
*/
|
|
85
|
+
Put = 2,
|
|
86
|
+
/**
|
|
87
|
+
* 增加策略(生成历史记录)
|
|
88
|
+
*/
|
|
89
|
+
Append = 3,
|
|
90
|
+
/**
|
|
91
|
+
* 打开策略,如果不存在则打开,否则切换(生成历史记录)
|
|
92
|
+
*/
|
|
93
|
+
Open = 4
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* 路由配置
|
|
98
|
+
*/
|
|
99
|
+
interface RouteConfig {
|
|
100
|
+
/**
|
|
101
|
+
* 路径
|
|
102
|
+
*/
|
|
103
|
+
path?: string;
|
|
104
|
+
/**
|
|
105
|
+
* 名称
|
|
106
|
+
*/
|
|
107
|
+
name?: string;
|
|
108
|
+
/**
|
|
109
|
+
* 转发路径
|
|
110
|
+
*/
|
|
111
|
+
redirect?: string;
|
|
112
|
+
/**
|
|
113
|
+
* 组件
|
|
114
|
+
*/
|
|
115
|
+
component?: any;
|
|
116
|
+
/**
|
|
117
|
+
* 组件映射
|
|
118
|
+
*/
|
|
119
|
+
components?: {
|
|
120
|
+
[propName: string]: any;
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* 孩子节点
|
|
124
|
+
*/
|
|
125
|
+
children?: any[];
|
|
126
|
+
/**
|
|
127
|
+
* 属性
|
|
128
|
+
*/
|
|
129
|
+
props?: Record<string | number | symbol, any> | boolean | {
|
|
130
|
+
(route: Route): any;
|
|
131
|
+
};
|
|
132
|
+
/**
|
|
133
|
+
* 元数据
|
|
134
|
+
*/
|
|
135
|
+
meta?: Record<string | number | symbol, any>;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* 插槽
|
|
139
|
+
*/
|
|
140
|
+
declare class Slot {
|
|
141
|
+
/**
|
|
142
|
+
* 插槽名称
|
|
143
|
+
*/
|
|
144
|
+
name: string;
|
|
145
|
+
/**
|
|
146
|
+
* 层次
|
|
147
|
+
*/
|
|
148
|
+
level: number;
|
|
149
|
+
/**
|
|
150
|
+
* root插槽节点名称
|
|
151
|
+
*/
|
|
152
|
+
rootName: string | undefined;
|
|
153
|
+
/**
|
|
154
|
+
* root插槽节点index
|
|
155
|
+
*/
|
|
156
|
+
rootIndex: number;
|
|
157
|
+
/**
|
|
158
|
+
* 构造函数
|
|
159
|
+
* @param name
|
|
160
|
+
* @param level
|
|
161
|
+
* @param rootName
|
|
162
|
+
*/
|
|
163
|
+
constructor(name: string, level: number, rootName: string | undefined, rootIndex: number);
|
|
164
|
+
}
|
|
165
|
+
declare class Session {
|
|
166
|
+
/**
|
|
167
|
+
* 目标路由
|
|
168
|
+
*/
|
|
169
|
+
to?: Route;
|
|
170
|
+
/**
|
|
171
|
+
* 目标路由
|
|
172
|
+
*/
|
|
173
|
+
routeModel?: RouteModel;
|
|
174
|
+
/**
|
|
175
|
+
* 来源路由
|
|
176
|
+
*/
|
|
177
|
+
from?: Route;
|
|
178
|
+
/**
|
|
179
|
+
* 流程数据
|
|
180
|
+
*/
|
|
181
|
+
data: {
|
|
182
|
+
[propName: string]: any;
|
|
183
|
+
};
|
|
184
|
+
/**
|
|
185
|
+
* 构造函数
|
|
186
|
+
* @param to
|
|
187
|
+
* @param from
|
|
188
|
+
*/
|
|
189
|
+
constructor(to?: Route, from?: Route);
|
|
190
|
+
/**
|
|
191
|
+
* 转换为session
|
|
192
|
+
* @param src
|
|
193
|
+
* @returns
|
|
194
|
+
*/
|
|
195
|
+
static from(src: {
|
|
196
|
+
[propName: string]: any;
|
|
197
|
+
}): Session;
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* 路由(跳转目标)
|
|
201
|
+
*/
|
|
202
|
+
declare class Route {
|
|
203
|
+
/**
|
|
204
|
+
* 路径
|
|
205
|
+
*/
|
|
206
|
+
path?: string;
|
|
207
|
+
/**
|
|
208
|
+
* 返回full path
|
|
209
|
+
*/
|
|
210
|
+
get fullPath(): string;
|
|
211
|
+
/**
|
|
212
|
+
* 名称
|
|
213
|
+
*/
|
|
214
|
+
name?: string;
|
|
215
|
+
/**
|
|
216
|
+
* 嵌入root节点
|
|
217
|
+
*/
|
|
218
|
+
root?: string;
|
|
219
|
+
/**
|
|
220
|
+
* 参数
|
|
221
|
+
*/
|
|
222
|
+
params?: Record<string | number | symbol, any>;
|
|
223
|
+
/**
|
|
224
|
+
* 查询
|
|
225
|
+
*/
|
|
226
|
+
query: any;
|
|
227
|
+
/**
|
|
228
|
+
* 获取匹配的元数组列表
|
|
229
|
+
*/
|
|
230
|
+
matched?: {
|
|
231
|
+
meta: Record<string | number | symbol, any>;
|
|
232
|
+
}[];
|
|
233
|
+
/**
|
|
234
|
+
* route本身的元数据
|
|
235
|
+
*/
|
|
236
|
+
meta?: Record<string | number | symbol, any>;
|
|
237
|
+
/**
|
|
238
|
+
* 成功回调函数
|
|
239
|
+
*/
|
|
240
|
+
success?: {
|
|
241
|
+
(...arg: any[]): void;
|
|
242
|
+
};
|
|
243
|
+
/**
|
|
244
|
+
* 失败回调函数
|
|
245
|
+
*/
|
|
246
|
+
error?: {
|
|
247
|
+
(...arg: any[]): void;
|
|
248
|
+
};
|
|
249
|
+
/**
|
|
250
|
+
* 页面销毁回答函数
|
|
251
|
+
*/
|
|
252
|
+
destroy?: {
|
|
253
|
+
(...arg: any[]): void;
|
|
254
|
+
};
|
|
255
|
+
/**
|
|
256
|
+
* 操作类型(Push, Replace, Put, Append)
|
|
257
|
+
*/
|
|
258
|
+
opsType?: OperationType;
|
|
259
|
+
/**
|
|
260
|
+
* 更新类型(All,Part)
|
|
261
|
+
*/
|
|
262
|
+
updateType?: UpdateType;
|
|
263
|
+
/**
|
|
264
|
+
* view属性集合(用于multi view的tab view属性)
|
|
265
|
+
*/
|
|
266
|
+
viewTagAttrs?: any;
|
|
267
|
+
/**
|
|
268
|
+
* 索引(用于opsType为Append的情况下,可以精确卸载的需求)
|
|
269
|
+
*/
|
|
270
|
+
index?: number;
|
|
271
|
+
/**
|
|
272
|
+
* 是否激活状态(用于多视图,Open操作的情况下,标志view是否为激活状态)
|
|
273
|
+
*/
|
|
274
|
+
active?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* 插槽(用于历史还原)
|
|
277
|
+
*/
|
|
278
|
+
slot?: Slot;
|
|
279
|
+
/**
|
|
280
|
+
* session(router执行链路session)
|
|
281
|
+
*/
|
|
282
|
+
session?: Session;
|
|
283
|
+
/**
|
|
284
|
+
* 克隆
|
|
285
|
+
* @param target
|
|
286
|
+
* @param plain 是否只克隆plain对象
|
|
287
|
+
*/
|
|
288
|
+
static clone(target: Route, plain: boolean): Route;
|
|
289
|
+
/**
|
|
290
|
+
* 判断路由是否相同
|
|
291
|
+
* @param x
|
|
292
|
+
* @param y
|
|
293
|
+
* @returns
|
|
294
|
+
*/
|
|
295
|
+
static isSame(x: Route, y: Route): boolean;
|
|
296
|
+
/**
|
|
297
|
+
* 判断路由对应的route model是否一致
|
|
298
|
+
* @param x
|
|
299
|
+
* @param y
|
|
300
|
+
* @returns
|
|
301
|
+
*/
|
|
302
|
+
static isSameForRouteModel(x: Route, y: Route): boolean;
|
|
303
|
+
/**
|
|
304
|
+
* 由对象生成路由
|
|
305
|
+
* @param obj
|
|
306
|
+
* @returns
|
|
307
|
+
*/
|
|
308
|
+
static from(obj: any): Route;
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* model (RouteModel > ModelLayer > Model)
|
|
312
|
+
*/
|
|
313
|
+
declare class Model {
|
|
314
|
+
/**
|
|
315
|
+
* 唯一ID(用于区分model)
|
|
316
|
+
*/
|
|
317
|
+
id: number;
|
|
318
|
+
/**
|
|
319
|
+
* 名称
|
|
320
|
+
*/
|
|
321
|
+
name: string;
|
|
322
|
+
/**
|
|
323
|
+
* 属性
|
|
324
|
+
*/
|
|
325
|
+
props: Record<string | number | symbol, any> | boolean | {
|
|
326
|
+
(route: Route): any;
|
|
327
|
+
} | undefined;
|
|
328
|
+
/**
|
|
329
|
+
* 元数据
|
|
330
|
+
*/
|
|
331
|
+
meta?: Record<string | number | symbol, any>;
|
|
332
|
+
/**
|
|
333
|
+
* 原始组件数据
|
|
334
|
+
*/
|
|
335
|
+
src: any;
|
|
336
|
+
/**
|
|
337
|
+
* 组件(解析后组件)
|
|
338
|
+
*/
|
|
339
|
+
component: any;
|
|
340
|
+
/**
|
|
341
|
+
* 构造函数
|
|
342
|
+
*
|
|
343
|
+
* @param name
|
|
344
|
+
* @param src
|
|
345
|
+
* @param props
|
|
346
|
+
* @param meta
|
|
347
|
+
*/
|
|
348
|
+
constructor(name: string, src: any, props?: Record<string | number | symbol, any> | {
|
|
349
|
+
(route: Route): any;
|
|
350
|
+
} | boolean, meta?: Record<string | number | symbol, any>);
|
|
351
|
+
/**
|
|
352
|
+
* 是否已经解析完成
|
|
353
|
+
*/
|
|
354
|
+
get isResolved(): boolean;
|
|
355
|
+
/**
|
|
356
|
+
* 解析组件
|
|
357
|
+
*/
|
|
358
|
+
resolve(): Promise<void>;
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* 层(RouteModel > ModelLayer > Model)
|
|
362
|
+
*/
|
|
363
|
+
declare class ModelLayer {
|
|
364
|
+
/**
|
|
365
|
+
* 节点
|
|
366
|
+
*/
|
|
367
|
+
models: Model[];
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* Route Model(RouteModel > ModelLayer > Model)
|
|
371
|
+
*/
|
|
372
|
+
declare class RouteModel {
|
|
373
|
+
/**
|
|
374
|
+
* 路径
|
|
375
|
+
*/
|
|
376
|
+
path?: string;
|
|
377
|
+
/**
|
|
378
|
+
* 路径match
|
|
379
|
+
*/
|
|
380
|
+
match: any;
|
|
381
|
+
/**
|
|
382
|
+
* 转发路径
|
|
383
|
+
*/
|
|
384
|
+
redirect?: string;
|
|
385
|
+
/**
|
|
386
|
+
* 名称
|
|
387
|
+
*/
|
|
388
|
+
name?: string;
|
|
389
|
+
/**
|
|
390
|
+
* layer集合
|
|
391
|
+
*/
|
|
392
|
+
layers: ModelLayer[];
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
declare const rootKey: unique symbol;
|
|
396
|
+
declare const rootNodeKey: unique symbol;
|
|
397
|
+
declare const parentNodeKey: unique symbol;
|
|
398
|
+
declare const nameKey: unique symbol;
|
|
399
|
+
/**
|
|
400
|
+
* model插槽
|
|
401
|
+
*/
|
|
402
|
+
declare class ModelSlot {
|
|
403
|
+
/**
|
|
404
|
+
* 实例
|
|
405
|
+
*/
|
|
406
|
+
instance: ComponentInternalInstance | null;
|
|
407
|
+
/**
|
|
408
|
+
* model
|
|
409
|
+
*/
|
|
410
|
+
model: Model;
|
|
411
|
+
/**
|
|
412
|
+
* route
|
|
413
|
+
*/
|
|
414
|
+
route: Route | null;
|
|
415
|
+
/**
|
|
416
|
+
* 是否激活状态
|
|
417
|
+
*/
|
|
418
|
+
active: boolean;
|
|
419
|
+
/**
|
|
420
|
+
* 索引
|
|
421
|
+
*/
|
|
422
|
+
index: number;
|
|
423
|
+
/**
|
|
424
|
+
* 构造函数
|
|
425
|
+
* @param route
|
|
426
|
+
* @param model
|
|
427
|
+
* @param index
|
|
428
|
+
* @param active
|
|
429
|
+
*/
|
|
430
|
+
constructor(route: Route | null, model: Model, index?: number, active?: boolean);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* 视图
|
|
434
|
+
*/
|
|
435
|
+
declare class View {
|
|
436
|
+
private scope;
|
|
437
|
+
/**
|
|
438
|
+
* 设置补偿函数
|
|
439
|
+
*/
|
|
440
|
+
set compensation(func: {
|
|
441
|
+
(): boolean;
|
|
442
|
+
});
|
|
443
|
+
/**
|
|
444
|
+
* model slots列表
|
|
445
|
+
*/
|
|
446
|
+
private _slots?;
|
|
447
|
+
/**
|
|
448
|
+
* getter for models
|
|
449
|
+
*/
|
|
450
|
+
get slots(): Ref<ModelSlot[]>;
|
|
451
|
+
/**
|
|
452
|
+
* 是否为空视图
|
|
453
|
+
*/
|
|
454
|
+
get empty(): boolean;
|
|
455
|
+
/**
|
|
456
|
+
* name
|
|
457
|
+
*/
|
|
458
|
+
[nameKey]: string;
|
|
459
|
+
/**
|
|
460
|
+
* 是否分支根节点标志(true/false)
|
|
461
|
+
*/
|
|
462
|
+
[rootKey]: boolean;
|
|
463
|
+
/**
|
|
464
|
+
* view的所在的root(最近一个)
|
|
465
|
+
*/
|
|
466
|
+
[rootNodeKey]: ViewPlace | null;
|
|
467
|
+
/**
|
|
468
|
+
* view的父亲记得引用(会在router的[sync]方法中建立关系)
|
|
469
|
+
*/
|
|
470
|
+
[parentNodeKey]: ViewPlace | null;
|
|
471
|
+
/**
|
|
472
|
+
* 名称
|
|
473
|
+
*/
|
|
474
|
+
get name(): string;
|
|
475
|
+
/**
|
|
476
|
+
* 构造函数
|
|
477
|
+
* @param name
|
|
478
|
+
* @param isRoot
|
|
479
|
+
* @param rootNodeRef
|
|
480
|
+
*/
|
|
481
|
+
constructor(name: string, isRoot: boolean, rootNodeRef?: ViewPlace | null);
|
|
482
|
+
}
|
|
483
|
+
/**
|
|
484
|
+
* view place
|
|
485
|
+
*/
|
|
486
|
+
declare class ViewPlace {
|
|
487
|
+
/**
|
|
488
|
+
* view
|
|
489
|
+
*/
|
|
490
|
+
view: View;
|
|
491
|
+
/**
|
|
492
|
+
* 索引
|
|
493
|
+
*/
|
|
494
|
+
index: number;
|
|
495
|
+
/**
|
|
496
|
+
* 层次
|
|
497
|
+
*/
|
|
498
|
+
level: number;
|
|
499
|
+
/**
|
|
500
|
+
* 构造函数
|
|
501
|
+
* @param view
|
|
502
|
+
* @param index
|
|
503
|
+
* @param level
|
|
504
|
+
*/
|
|
505
|
+
constructor(view: View, index: number, level: number);
|
|
506
|
+
/**
|
|
507
|
+
* 判断是否在队列中
|
|
508
|
+
* @param list
|
|
509
|
+
* @param view
|
|
510
|
+
*/
|
|
511
|
+
static include(list: ViewPlace[], viewPlace: ViewPlace): boolean;
|
|
512
|
+
}
|
|
513
|
+
/**
|
|
514
|
+
* 层
|
|
515
|
+
*/
|
|
516
|
+
declare class Layer {
|
|
517
|
+
/**
|
|
518
|
+
* 节点(view集合)
|
|
519
|
+
*/
|
|
520
|
+
views: View[];
|
|
521
|
+
}
|
|
522
|
+
/**
|
|
523
|
+
* page
|
|
524
|
+
*/
|
|
525
|
+
declare class Page {
|
|
526
|
+
/**
|
|
527
|
+
* 层
|
|
528
|
+
*/
|
|
529
|
+
layers: Layer[];
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* 操作类型
|
|
534
|
+
* @type {Enum}
|
|
535
|
+
*/
|
|
536
|
+
declare enum ModuleStatus {
|
|
537
|
+
/**
|
|
538
|
+
* 加载中
|
|
539
|
+
*/
|
|
540
|
+
Loading = 0,
|
|
541
|
+
/**
|
|
542
|
+
* 加载完成
|
|
543
|
+
*/
|
|
544
|
+
Loaded = 1,
|
|
545
|
+
/**
|
|
546
|
+
* 定义中状态
|
|
547
|
+
*/
|
|
548
|
+
Defining = 2,
|
|
549
|
+
/**
|
|
550
|
+
* 定义完成状态
|
|
551
|
+
*/
|
|
552
|
+
Defined = 3
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
/**
|
|
556
|
+
* Session类型
|
|
557
|
+
*/
|
|
558
|
+
interface EventChainSession {
|
|
559
|
+
[propName: string]: any;
|
|
560
|
+
}
|
|
561
|
+
/**
|
|
562
|
+
* event chain 上下文
|
|
563
|
+
*/
|
|
564
|
+
interface EventChainContext {
|
|
565
|
+
/**
|
|
566
|
+
* 任务跳转
|
|
567
|
+
*/
|
|
568
|
+
go: {
|
|
569
|
+
(step: number, ...args: any[]): void;
|
|
570
|
+
};
|
|
571
|
+
/**
|
|
572
|
+
* 触发链路
|
|
573
|
+
*/
|
|
574
|
+
resolve: {
|
|
575
|
+
(...args: any[]): void;
|
|
576
|
+
};
|
|
577
|
+
/**
|
|
578
|
+
* 中断链路
|
|
579
|
+
*/
|
|
580
|
+
reject: {
|
|
581
|
+
(...args: any[]): void;
|
|
582
|
+
};
|
|
583
|
+
/**
|
|
584
|
+
* 插入任务
|
|
585
|
+
*/
|
|
586
|
+
insert: {
|
|
587
|
+
(...args: any[]): void;
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* chain session
|
|
591
|
+
*/
|
|
592
|
+
session: EventChainSession;
|
|
593
|
+
}
|
|
594
|
+
/**
|
|
595
|
+
* Task类型
|
|
596
|
+
*/
|
|
597
|
+
interface Task {
|
|
598
|
+
(context: EventChainContext, ...args: any[]): void;
|
|
599
|
+
}
|
|
600
|
+
/**
|
|
601
|
+
* 完成Task类型(Exception,Finish, Wait)
|
|
602
|
+
*/
|
|
603
|
+
interface EndTask {
|
|
604
|
+
(context: {
|
|
605
|
+
session: EventChainSession;
|
|
606
|
+
}, ...args: any[]): void;
|
|
607
|
+
}
|
|
608
|
+
declare const chainKey: unique symbol;
|
|
609
|
+
declare const cursorKey: unique symbol;
|
|
610
|
+
declare const persistentModeKey: unique symbol;
|
|
611
|
+
declare const statusKey: unique symbol;
|
|
612
|
+
declare const argsKey: unique symbol;
|
|
613
|
+
declare const exArgsKey: unique symbol;
|
|
614
|
+
declare const successFnsKey: unique symbol;
|
|
615
|
+
declare const errorFnsKey: unique symbol;
|
|
616
|
+
declare const sessionKey: unique symbol;
|
|
617
|
+
declare const _go: unique symbol;
|
|
618
|
+
/**
|
|
619
|
+
* 任务链路
|
|
620
|
+
*/
|
|
621
|
+
declare class EventChain {
|
|
622
|
+
/**
|
|
623
|
+
* 事件链路
|
|
624
|
+
*/
|
|
625
|
+
private [chainKey];
|
|
626
|
+
/**
|
|
627
|
+
* 游标
|
|
628
|
+
*/
|
|
629
|
+
private [cursorKey];
|
|
630
|
+
/**
|
|
631
|
+
* 是否持久模式(该状态为true的情况,已经执行的任务会继续保存在队列中)
|
|
632
|
+
*/
|
|
633
|
+
private [persistentModeKey];
|
|
634
|
+
/**
|
|
635
|
+
* 状态
|
|
636
|
+
*/
|
|
637
|
+
private [statusKey];
|
|
638
|
+
/**
|
|
639
|
+
* 参数
|
|
640
|
+
*/
|
|
641
|
+
private [argsKey];
|
|
642
|
+
/**
|
|
643
|
+
* 异常参数
|
|
644
|
+
*/
|
|
645
|
+
private [exArgsKey];
|
|
646
|
+
/**
|
|
647
|
+
* 移除函数
|
|
648
|
+
*/
|
|
649
|
+
private [successFnsKey];
|
|
650
|
+
/**
|
|
651
|
+
* 错误函数
|
|
652
|
+
*/
|
|
653
|
+
private [errorFnsKey];
|
|
654
|
+
/**
|
|
655
|
+
* 链路session
|
|
656
|
+
*/
|
|
657
|
+
private [sessionKey]?;
|
|
658
|
+
/**
|
|
659
|
+
* 获取session
|
|
660
|
+
*/
|
|
661
|
+
get session(): EventChainSession | undefined;
|
|
662
|
+
/**
|
|
663
|
+
* 构造函数
|
|
664
|
+
*
|
|
665
|
+
* @param session
|
|
666
|
+
* @param persistentMode
|
|
667
|
+
*/
|
|
668
|
+
constructor(session?: EventChainSession, persistentMode?: boolean);
|
|
669
|
+
/**
|
|
670
|
+
* 触发链路的下一个任务
|
|
671
|
+
* @param step
|
|
672
|
+
* @param params
|
|
673
|
+
*/
|
|
674
|
+
private [_go];
|
|
675
|
+
/**
|
|
676
|
+
* 跳转
|
|
677
|
+
* @param step
|
|
678
|
+
* @param params
|
|
679
|
+
*/
|
|
680
|
+
go(step: number, ...params: any[]): EventChain;
|
|
681
|
+
/**
|
|
682
|
+
* 结束事件链调用,直接触发wait函数(success方法)
|
|
683
|
+
* @param params
|
|
684
|
+
*/
|
|
685
|
+
finish(...params: any[]): EventChain;
|
|
686
|
+
/**
|
|
687
|
+
* 结束事件链调用,直接触发wait函数(error方法)
|
|
688
|
+
* @param params
|
|
689
|
+
*/
|
|
690
|
+
reject(...params: any[]): EventChain;
|
|
691
|
+
/**
|
|
692
|
+
* 结束事件链调用,直接触发error函数
|
|
693
|
+
* @param params
|
|
694
|
+
*/
|
|
695
|
+
throw(...params: any[]): EventChain;
|
|
696
|
+
/**
|
|
697
|
+
* 重置事件链,直接触发wait函数
|
|
698
|
+
* @param params
|
|
699
|
+
*/
|
|
700
|
+
reset(...params: any[]): EventChain;
|
|
701
|
+
/**
|
|
702
|
+
* 加入任务
|
|
703
|
+
* @param task
|
|
704
|
+
* @returns {EventChain}
|
|
705
|
+
*/
|
|
706
|
+
post(task: Task): EventChain;
|
|
707
|
+
/**
|
|
708
|
+
* 加入等待任务
|
|
709
|
+
* @param successFn
|
|
710
|
+
* @param errorFn
|
|
711
|
+
* @returns
|
|
712
|
+
*/
|
|
713
|
+
wait(successFn: EndTask, errorFn: EndTask): EventChain;
|
|
714
|
+
/**
|
|
715
|
+
* 加入异常处理任务
|
|
716
|
+
* @param errorFn
|
|
717
|
+
* @returns
|
|
718
|
+
*/
|
|
719
|
+
exception(errorFn: EndTask): EventChain;
|
|
720
|
+
/**
|
|
721
|
+
* 判断事件链是否已经执行完成
|
|
722
|
+
* @returns {boolean}
|
|
723
|
+
*/
|
|
724
|
+
isFinish(): boolean;
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
/**
|
|
728
|
+
* AMD加载器
|
|
729
|
+
*/
|
|
730
|
+
declare class Require {
|
|
731
|
+
/**
|
|
732
|
+
* head对象
|
|
733
|
+
*/
|
|
734
|
+
private head;
|
|
735
|
+
/**
|
|
736
|
+
* 是否为老的webkit浏览器
|
|
737
|
+
*/
|
|
738
|
+
private isOldWebKit;
|
|
739
|
+
/**
|
|
740
|
+
* moudel manager
|
|
741
|
+
* @type {ModuleManager}
|
|
742
|
+
*/
|
|
743
|
+
private moduleManager;
|
|
744
|
+
/**
|
|
745
|
+
* resource
|
|
746
|
+
*/
|
|
747
|
+
private resource;
|
|
748
|
+
/**
|
|
749
|
+
* 参数配置
|
|
750
|
+
*/
|
|
751
|
+
private options;
|
|
752
|
+
/**
|
|
753
|
+
* 设置query
|
|
754
|
+
*/
|
|
755
|
+
private _query?;
|
|
756
|
+
/**
|
|
757
|
+
* 设置query
|
|
758
|
+
*/
|
|
759
|
+
set query(val: Record<string, string | number> | undefined);
|
|
760
|
+
/**
|
|
761
|
+
* 获取query
|
|
762
|
+
*/
|
|
763
|
+
get query(): Record<string, string | number> | undefined;
|
|
764
|
+
/**
|
|
765
|
+
* 构造函数
|
|
766
|
+
*/
|
|
767
|
+
constructor(options?: any);
|
|
768
|
+
/**
|
|
769
|
+
* 加载
|
|
770
|
+
*/
|
|
771
|
+
ensure(...args: any[]): Require;
|
|
772
|
+
/**
|
|
773
|
+
* 卸载
|
|
774
|
+
*/
|
|
775
|
+
remove(...args: any): Require;
|
|
776
|
+
/**
|
|
777
|
+
* 加载
|
|
778
|
+
*
|
|
779
|
+
* @param chain
|
|
780
|
+
* @param taskNode
|
|
781
|
+
*/
|
|
782
|
+
mount(chain: EventChain, taskNode: TaskNode): void;
|
|
783
|
+
/**
|
|
784
|
+
* 加载html
|
|
785
|
+
*
|
|
786
|
+
* @param chain
|
|
787
|
+
* @param task
|
|
788
|
+
* @param point
|
|
789
|
+
*/
|
|
790
|
+
private mountHTML;
|
|
791
|
+
/**
|
|
792
|
+
* 加载css
|
|
793
|
+
* @param chain
|
|
794
|
+
* @param task
|
|
795
|
+
* @param point
|
|
796
|
+
*/
|
|
797
|
+
private mountCSS;
|
|
798
|
+
/**
|
|
799
|
+
* 加载js
|
|
800
|
+
*
|
|
801
|
+
* @param chain
|
|
802
|
+
* @param task
|
|
803
|
+
* @param point
|
|
804
|
+
*/
|
|
805
|
+
private mountJS;
|
|
806
|
+
/**
|
|
807
|
+
* 卸载资源
|
|
808
|
+
*/
|
|
809
|
+
unmount(path: string, options?: any): void;
|
|
810
|
+
/**
|
|
811
|
+
* 去掉空元素
|
|
812
|
+
*/
|
|
813
|
+
private trimEmptyElement;
|
|
814
|
+
/**
|
|
815
|
+
* 创建define函数
|
|
816
|
+
* @param module
|
|
817
|
+
* @param task
|
|
818
|
+
* @returns {Function}
|
|
819
|
+
*/
|
|
820
|
+
private createDefine;
|
|
821
|
+
/**
|
|
822
|
+
* 解析路径
|
|
823
|
+
* @param uri
|
|
824
|
+
* @returns {string}
|
|
825
|
+
*/
|
|
826
|
+
private resolvePath;
|
|
827
|
+
/**
|
|
828
|
+
* 创建search字符串
|
|
829
|
+
*/
|
|
830
|
+
private createSearch;
|
|
831
|
+
/**
|
|
832
|
+
* 获取文件名后缀
|
|
833
|
+
* @param name
|
|
834
|
+
* @returns {string}
|
|
835
|
+
*/
|
|
836
|
+
getFileNamePostfix(name: string): string;
|
|
837
|
+
/**
|
|
838
|
+
* 是否为不处理的路径
|
|
839
|
+
* @param uri
|
|
840
|
+
* @param type
|
|
841
|
+
* @returns {boolean}
|
|
842
|
+
*/
|
|
843
|
+
private isNaturePath;
|
|
844
|
+
/**
|
|
845
|
+
* 解析路径
|
|
846
|
+
* @param uri
|
|
847
|
+
* @param replace
|
|
848
|
+
*/
|
|
849
|
+
private parserPath;
|
|
850
|
+
}
|
|
851
|
+
/**
|
|
852
|
+
* 进程
|
|
853
|
+
*/
|
|
854
|
+
declare class Progress {
|
|
855
|
+
/**
|
|
856
|
+
* 回调函数
|
|
857
|
+
*/
|
|
858
|
+
private callback;
|
|
859
|
+
/**
|
|
860
|
+
* values
|
|
861
|
+
*/
|
|
862
|
+
private values;
|
|
863
|
+
/**
|
|
864
|
+
* 状态
|
|
865
|
+
*/
|
|
866
|
+
private status;
|
|
867
|
+
/**
|
|
868
|
+
* 工作量
|
|
869
|
+
*/
|
|
870
|
+
private size;
|
|
871
|
+
/**
|
|
872
|
+
* 最新的index
|
|
873
|
+
*/
|
|
874
|
+
private lastIndex;
|
|
875
|
+
/**
|
|
876
|
+
* 构造函数
|
|
877
|
+
*/
|
|
878
|
+
constructor(size: number, callback: {
|
|
879
|
+
(status: ModuleStatus, values: any[]): void;
|
|
880
|
+
});
|
|
881
|
+
/**
|
|
882
|
+
* work
|
|
883
|
+
* @param status 工作状态(true/false)
|
|
884
|
+
* @param index
|
|
885
|
+
* @param value
|
|
886
|
+
*/
|
|
887
|
+
work(status: boolean, index: number, value: any): void;
|
|
888
|
+
/**
|
|
889
|
+
* 判断进程是否为正常状态
|
|
890
|
+
*/
|
|
891
|
+
isOK(): boolean;
|
|
892
|
+
}
|
|
893
|
+
/**
|
|
894
|
+
* 任务节点
|
|
895
|
+
*/
|
|
896
|
+
declare class TaskNode {
|
|
897
|
+
/**
|
|
898
|
+
* 索引
|
|
899
|
+
*/
|
|
900
|
+
index: number;
|
|
901
|
+
/**
|
|
902
|
+
* 来源
|
|
903
|
+
*/
|
|
904
|
+
src: string;
|
|
905
|
+
/**
|
|
906
|
+
* 参数
|
|
907
|
+
*/
|
|
908
|
+
params: any;
|
|
909
|
+
/**
|
|
910
|
+
* 进程
|
|
911
|
+
*/
|
|
912
|
+
progress: Progress;
|
|
913
|
+
/**
|
|
914
|
+
* 构造函数
|
|
915
|
+
* @param index
|
|
916
|
+
* @param src
|
|
917
|
+
* @param params
|
|
918
|
+
* @param progress
|
|
919
|
+
*/
|
|
920
|
+
constructor(index: number, src: string, params: any, progress: Progress);
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
declare const sync: unique symbol;
|
|
924
|
+
declare const resolveRoute: unique symbol;
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* router options
|
|
928
|
+
*/
|
|
929
|
+
interface RouterOptions {
|
|
930
|
+
/**
|
|
931
|
+
* 默认操作类型
|
|
932
|
+
*/
|
|
933
|
+
defaultOperationType?: OperationType;
|
|
934
|
+
/**
|
|
935
|
+
* 模块路径解释
|
|
936
|
+
*/
|
|
937
|
+
modulePathResolve?: {
|
|
938
|
+
(route: Route): string;
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* hash monitor(路由跳转是否基于URL hash的变化)
|
|
942
|
+
*/
|
|
943
|
+
hashMonitor?: boolean;
|
|
944
|
+
/**
|
|
945
|
+
* 无痕迹模式,不修改历史记录
|
|
946
|
+
*/
|
|
947
|
+
traceless?: boolean;
|
|
948
|
+
/**
|
|
949
|
+
* 默认加载的路由对应路径
|
|
950
|
+
*/
|
|
951
|
+
defaultPath?: string;
|
|
952
|
+
/**
|
|
953
|
+
* base query
|
|
954
|
+
*/
|
|
955
|
+
query?: any;
|
|
956
|
+
/**
|
|
957
|
+
* 路由配置列表
|
|
958
|
+
*/
|
|
959
|
+
routes?: RouteConfig[];
|
|
960
|
+
/**
|
|
961
|
+
* not found 路由
|
|
962
|
+
*/
|
|
963
|
+
notFound?: RouteConfig;
|
|
964
|
+
}
|
|
965
|
+
/**
|
|
966
|
+
* before route update filter
|
|
967
|
+
*/
|
|
968
|
+
interface BeforeRouteFilter {
|
|
969
|
+
(to: Route, from: Route, next: {
|
|
970
|
+
(pass?: boolean | Route): void;
|
|
971
|
+
}, session: Record<string | number | symbol, any>): void;
|
|
972
|
+
}
|
|
973
|
+
/**
|
|
974
|
+
* after route update filter
|
|
975
|
+
*/
|
|
976
|
+
interface AfterRouteFilter {
|
|
977
|
+
(to: Route, from: Route, session: Record<string | number | symbol, any>): void;
|
|
978
|
+
}
|
|
979
|
+
/**
|
|
980
|
+
* destroy route update filter
|
|
981
|
+
*/
|
|
982
|
+
interface DestroyRouteFilter {
|
|
983
|
+
(to: Route, session: Record<string | number | symbol, any>): void;
|
|
984
|
+
}
|
|
985
|
+
declare const _constructRouteModel: unique symbol;
|
|
986
|
+
declare const _findRouteModel: unique symbol;
|
|
987
|
+
declare const _findRootView: unique symbol;
|
|
988
|
+
declare const _getFirstView: unique symbol;
|
|
989
|
+
declare const _removeView: unique symbol;
|
|
990
|
+
declare const _buildPage: unique symbol;
|
|
991
|
+
declare const _resolveComponent: unique symbol;
|
|
992
|
+
declare const _update: unique symbol;
|
|
993
|
+
declare const _merge: unique symbol;
|
|
994
|
+
declare const ignoreHistoryChangeOnceKey: unique symbol;
|
|
995
|
+
declare const _handleHistoryChange: unique symbol;
|
|
996
|
+
declare const _handleRouteUpated: unique symbol;
|
|
997
|
+
declare const routeUpdatedCallback: unique symbol;
|
|
998
|
+
declare const currentRoutes: unique symbol;
|
|
999
|
+
declare const currentKey: unique symbol;
|
|
1000
|
+
declare const _addRouteRecorder: unique symbol;
|
|
1001
|
+
declare const _removeRouteRecorder: unique symbol;
|
|
1002
|
+
declare const _cloneRouteRecorder: unique symbol;
|
|
1003
|
+
declare const _handleError: unique symbol;
|
|
1004
|
+
declare const errorCallback: unique symbol;
|
|
1005
|
+
declare const registerKey$1: unique symbol;
|
|
1006
|
+
declare const notFoundKey: unique symbol;
|
|
1007
|
+
declare const forestKey: unique symbol;
|
|
1008
|
+
declare const historyKey: unique symbol;
|
|
1009
|
+
declare const beforeFiltersKey: unique symbol;
|
|
1010
|
+
declare const afterFiltersKey: unique symbol;
|
|
1011
|
+
declare const destroyFiltersKey: unique symbol;
|
|
1012
|
+
declare const mainDispatcherKey: unique symbol;
|
|
1013
|
+
declare const initKey: unique symbol;
|
|
1014
|
+
declare const requireKey: unique symbol;
|
|
1015
|
+
declare const _createNextFn: unique symbol;
|
|
1016
|
+
declare const _start: unique symbol;
|
|
1017
|
+
declare const _before: unique symbol;
|
|
1018
|
+
declare const _after: unique symbol;
|
|
1019
|
+
declare const _destroy: unique symbol;
|
|
1020
|
+
declare const _load: unique symbol;
|
|
1021
|
+
declare const _unload: unique symbol;
|
|
1022
|
+
declare const _loadDependency: unique symbol;
|
|
1023
|
+
declare const resolvedModulesKey: unique symbol;
|
|
1024
|
+
declare const resolveDependencyKey: unique symbol;
|
|
1025
|
+
declare const routerGuardKey: unique symbol;
|
|
1026
|
+
declare class Router {
|
|
1027
|
+
/**
|
|
1028
|
+
* 注册表
|
|
1029
|
+
*/
|
|
1030
|
+
private [registerKey$1];
|
|
1031
|
+
/**
|
|
1032
|
+
* not found route
|
|
1033
|
+
*/
|
|
1034
|
+
private [notFoundKey]?;
|
|
1035
|
+
/**
|
|
1036
|
+
* 页面根节点
|
|
1037
|
+
*/
|
|
1038
|
+
private [forestKey];
|
|
1039
|
+
/**
|
|
1040
|
+
* 历史记录控制器
|
|
1041
|
+
*/
|
|
1042
|
+
private [historyKey]?;
|
|
1043
|
+
/**
|
|
1044
|
+
* 当前路由集合
|
|
1045
|
+
*/
|
|
1046
|
+
private [currentRoutes];
|
|
1047
|
+
/**
|
|
1048
|
+
* 错误回调
|
|
1049
|
+
*/
|
|
1050
|
+
private [errorCallback];
|
|
1051
|
+
/**
|
|
1052
|
+
* 全局route更新监听器
|
|
1053
|
+
*/
|
|
1054
|
+
private [routeUpdatedCallback];
|
|
1055
|
+
/**
|
|
1056
|
+
* before过滤器队列
|
|
1057
|
+
*/
|
|
1058
|
+
private [beforeFiltersKey];
|
|
1059
|
+
/**
|
|
1060
|
+
* after过滤器队列
|
|
1061
|
+
*/
|
|
1062
|
+
private [afterFiltersKey];
|
|
1063
|
+
/**
|
|
1064
|
+
* destroy过滤器队列
|
|
1065
|
+
*/
|
|
1066
|
+
private [destroyFiltersKey];
|
|
1067
|
+
/**
|
|
1068
|
+
* 主任务分发器
|
|
1069
|
+
*/
|
|
1070
|
+
private [mainDispatcherKey];
|
|
1071
|
+
/**
|
|
1072
|
+
* 已解析模块集合
|
|
1073
|
+
*/
|
|
1074
|
+
private [resolvedModulesKey];
|
|
1075
|
+
/**
|
|
1076
|
+
* 解析依赖函数
|
|
1077
|
+
*/
|
|
1078
|
+
private [resolveDependencyKey];
|
|
1079
|
+
/**
|
|
1080
|
+
* 路由守护者
|
|
1081
|
+
*/
|
|
1082
|
+
private [routerGuardKey];
|
|
1083
|
+
/**
|
|
1084
|
+
* 是否初始化
|
|
1085
|
+
*/
|
|
1086
|
+
private [initKey];
|
|
1087
|
+
/**
|
|
1088
|
+
* 当前最新路由
|
|
1089
|
+
*/
|
|
1090
|
+
private [currentKey];
|
|
1091
|
+
/**
|
|
1092
|
+
* 创建require
|
|
1093
|
+
*/
|
|
1094
|
+
private [requireKey];
|
|
1095
|
+
get require(): Require;
|
|
1096
|
+
/**
|
|
1097
|
+
* 获取当前最新route
|
|
1098
|
+
*/
|
|
1099
|
+
get current(): Route | null;
|
|
1100
|
+
private options;
|
|
1101
|
+
/**
|
|
1102
|
+
* 构造函数
|
|
1103
|
+
* @param options
|
|
1104
|
+
*/
|
|
1105
|
+
constructor(options: RouterOptions);
|
|
1106
|
+
/**
|
|
1107
|
+
* 记录错误日志
|
|
1108
|
+
* @param msg
|
|
1109
|
+
* @param route
|
|
1110
|
+
*/
|
|
1111
|
+
private [_handleError];
|
|
1112
|
+
/**
|
|
1113
|
+
* 初始化
|
|
1114
|
+
*/
|
|
1115
|
+
init(): void;
|
|
1116
|
+
/**
|
|
1117
|
+
* 是否忽略历史记录改变
|
|
1118
|
+
* @type {boolean}
|
|
1119
|
+
*/
|
|
1120
|
+
private [ignoreHistoryChangeOnceKey];
|
|
1121
|
+
/**
|
|
1122
|
+
* 处理历史记录
|
|
1123
|
+
* @param record
|
|
1124
|
+
*/
|
|
1125
|
+
private [_handleHistoryChange];
|
|
1126
|
+
/**
|
|
1127
|
+
* 处理route updated事件
|
|
1128
|
+
* @param route
|
|
1129
|
+
*/
|
|
1130
|
+
private [_handleRouteUpated];
|
|
1131
|
+
/**
|
|
1132
|
+
* 加入路由记录
|
|
1133
|
+
* @param route
|
|
1134
|
+
*/
|
|
1135
|
+
private [_addRouteRecorder];
|
|
1136
|
+
/**
|
|
1137
|
+
* 克隆路由记录
|
|
1138
|
+
* @returns
|
|
1139
|
+
*/
|
|
1140
|
+
private [_cloneRouteRecorder];
|
|
1141
|
+
/**
|
|
1142
|
+
* 移除路由记录
|
|
1143
|
+
*
|
|
1144
|
+
* @param route
|
|
1145
|
+
*/
|
|
1146
|
+
private [_removeRouteRecorder];
|
|
1147
|
+
/**
|
|
1148
|
+
* 设置hash monitor是否启动
|
|
1149
|
+
*/
|
|
1150
|
+
set hashMonitor(val: boolean);
|
|
1151
|
+
/**
|
|
1152
|
+
* 获取hash minitor
|
|
1153
|
+
*/
|
|
1154
|
+
get hashMonitor(): boolean;
|
|
1155
|
+
/**
|
|
1156
|
+
* 设置无痕模式,不改变历史记录
|
|
1157
|
+
*/
|
|
1158
|
+
set traceless(val: boolean);
|
|
1159
|
+
/**
|
|
1160
|
+
* 获取无痕模式(不改变历史记录)
|
|
1161
|
+
*/
|
|
1162
|
+
get traceless(): boolean;
|
|
1163
|
+
/**
|
|
1164
|
+
* 注册route updated处理函数
|
|
1165
|
+
* @param callback
|
|
1166
|
+
*/
|
|
1167
|
+
onRouteUpdated(callback: {
|
|
1168
|
+
(route?: Route | null): void;
|
|
1169
|
+
} | null): void;
|
|
1170
|
+
/**
|
|
1171
|
+
* 注册全局异常处理函数
|
|
1172
|
+
* @param callback
|
|
1173
|
+
*/
|
|
1174
|
+
onError(callback: {
|
|
1175
|
+
(...args: any[]): void;
|
|
1176
|
+
} | null): void;
|
|
1177
|
+
/**
|
|
1178
|
+
* 添加before filter
|
|
1179
|
+
* @param filter
|
|
1180
|
+
*/
|
|
1181
|
+
beforeEach(filter: BeforeRouteFilter): void;
|
|
1182
|
+
/**
|
|
1183
|
+
* 移除before filter
|
|
1184
|
+
* @param filter
|
|
1185
|
+
*/
|
|
1186
|
+
removeBeforeEach(filter: BeforeRouteFilter): boolean;
|
|
1187
|
+
/**
|
|
1188
|
+
* 添加after filter
|
|
1189
|
+
* @param filter
|
|
1190
|
+
*/
|
|
1191
|
+
afterEach(filter: AfterRouteFilter): void;
|
|
1192
|
+
/**
|
|
1193
|
+
* 移除after filter
|
|
1194
|
+
* @param filter
|
|
1195
|
+
* @returns
|
|
1196
|
+
*/
|
|
1197
|
+
removeAfterEach(filter: AfterRouteFilter): boolean;
|
|
1198
|
+
/**
|
|
1199
|
+
* 添加destroy filter
|
|
1200
|
+
* @param filter
|
|
1201
|
+
*/
|
|
1202
|
+
destroyEach(filter: DestroyRouteFilter): void;
|
|
1203
|
+
/**
|
|
1204
|
+
* 移除after filter
|
|
1205
|
+
* @param filter
|
|
1206
|
+
* @returns
|
|
1207
|
+
*/
|
|
1208
|
+
removeDestroyEach(filter: DestroyRouteFilter): boolean;
|
|
1209
|
+
/**
|
|
1210
|
+
* 设置依赖模块解释函数
|
|
1211
|
+
* @param resolveDependency
|
|
1212
|
+
*/
|
|
1213
|
+
setResolveDependency(resolveDependency: {
|
|
1214
|
+
(route: Route): string;
|
|
1215
|
+
}): void;
|
|
1216
|
+
/**
|
|
1217
|
+
* 加入路由配置列表
|
|
1218
|
+
* @param routes
|
|
1219
|
+
*/
|
|
1220
|
+
addRoutes(routeConfigs: RouteConfig[]): void;
|
|
1221
|
+
/**
|
|
1222
|
+
* 加入路由配置
|
|
1223
|
+
* @param route
|
|
1224
|
+
* @param index
|
|
1225
|
+
*/
|
|
1226
|
+
addRoute(routeConfig: RouteConfig, index?: number): void;
|
|
1227
|
+
/**
|
|
1228
|
+
* 移除路由
|
|
1229
|
+
*
|
|
1230
|
+
* @param target
|
|
1231
|
+
*/
|
|
1232
|
+
removeRoute(route: Route | string): boolean;
|
|
1233
|
+
/**
|
|
1234
|
+
* 判断路由是否存在
|
|
1235
|
+
*
|
|
1236
|
+
* @param target
|
|
1237
|
+
*/
|
|
1238
|
+
hasRoute(route: Route | string): boolean;
|
|
1239
|
+
/**
|
|
1240
|
+
* 配置not found路由配置
|
|
1241
|
+
* @param routeConfig
|
|
1242
|
+
*/
|
|
1243
|
+
setNotFoundRoute(routeConfig: RouteConfig): void;
|
|
1244
|
+
/**
|
|
1245
|
+
* 返回目前加载的routes
|
|
1246
|
+
*/
|
|
1247
|
+
getRoutes(): RouteModel[];
|
|
1248
|
+
/**
|
|
1249
|
+
* 根据路由构建route model
|
|
1250
|
+
*
|
|
1251
|
+
* @param routeConfig
|
|
1252
|
+
*/
|
|
1253
|
+
private [_constructRouteModel];
|
|
1254
|
+
/**
|
|
1255
|
+
* 查找route model
|
|
1256
|
+
* @param cite
|
|
1257
|
+
*/
|
|
1258
|
+
private [_findRouteModel];
|
|
1259
|
+
/**
|
|
1260
|
+
* 解释路由
|
|
1261
|
+
* @param args
|
|
1262
|
+
* @returns
|
|
1263
|
+
*/
|
|
1264
|
+
[resolveRoute](args: any): Route | null;
|
|
1265
|
+
/**
|
|
1266
|
+
* 路由跳转(operation类型为Push)
|
|
1267
|
+
* @param args
|
|
1268
|
+
*/
|
|
1269
|
+
push(...args: any[]): Router;
|
|
1270
|
+
/**
|
|
1271
|
+
* 路由跳转(operation类型为Put)
|
|
1272
|
+
* @param args
|
|
1273
|
+
*/
|
|
1274
|
+
put(...args: any[]): Router;
|
|
1275
|
+
/**
|
|
1276
|
+
* 路由跳转(operation类型为Replace)
|
|
1277
|
+
* @param args
|
|
1278
|
+
*/
|
|
1279
|
+
replace(...args: any[]): Router;
|
|
1280
|
+
/**
|
|
1281
|
+
* 路由跳转(operation类型为Append)
|
|
1282
|
+
* @param path
|
|
1283
|
+
*/
|
|
1284
|
+
append(...args: any[]): Router;
|
|
1285
|
+
/**
|
|
1286
|
+
* 移除
|
|
1287
|
+
* @param term
|
|
1288
|
+
*/
|
|
1289
|
+
remove(term?: any): Promise<boolean>;
|
|
1290
|
+
/**
|
|
1291
|
+
* 路由跳转(operation类型为Open)
|
|
1292
|
+
* @param args
|
|
1293
|
+
*/
|
|
1294
|
+
open(...args: any[]): Router;
|
|
1295
|
+
/**
|
|
1296
|
+
* 关闭路由跳转的页面
|
|
1297
|
+
* @param args
|
|
1298
|
+
*/
|
|
1299
|
+
close(args: any): Router;
|
|
1300
|
+
/**
|
|
1301
|
+
* 路由跳转
|
|
1302
|
+
* @param args
|
|
1303
|
+
*/
|
|
1304
|
+
to(...args: any[]): Router;
|
|
1305
|
+
/**
|
|
1306
|
+
* 历史回退
|
|
1307
|
+
* @param n
|
|
1308
|
+
*/
|
|
1309
|
+
back(n?: number): void;
|
|
1310
|
+
/**
|
|
1311
|
+
* 创建next函数
|
|
1312
|
+
*/
|
|
1313
|
+
private [_createNextFn];
|
|
1314
|
+
/**
|
|
1315
|
+
* 开始链路
|
|
1316
|
+
* @param route
|
|
1317
|
+
* @returns {EventChain}
|
|
1318
|
+
*/
|
|
1319
|
+
private [_start];
|
|
1320
|
+
/**
|
|
1321
|
+
* 执行before事件
|
|
1322
|
+
* @param chain
|
|
1323
|
+
*/
|
|
1324
|
+
private [_before];
|
|
1325
|
+
/**
|
|
1326
|
+
* 执行after事件
|
|
1327
|
+
* @param chain
|
|
1328
|
+
*/
|
|
1329
|
+
private [_after];
|
|
1330
|
+
/**
|
|
1331
|
+
* 执行销毁事件
|
|
1332
|
+
*/
|
|
1333
|
+
private [_destroy];
|
|
1334
|
+
/**
|
|
1335
|
+
* 加载依赖模块
|
|
1336
|
+
* @param chain
|
|
1337
|
+
* @param depencies
|
|
1338
|
+
*/
|
|
1339
|
+
private [_loadDependency];
|
|
1340
|
+
/**
|
|
1341
|
+
* 加载路由
|
|
1342
|
+
* @param route
|
|
1343
|
+
*/
|
|
1344
|
+
private [_load];
|
|
1345
|
+
/**
|
|
1346
|
+
* 卸载(只能用于卸载多视图上的view)
|
|
1347
|
+
*
|
|
1348
|
+
* @param routes
|
|
1349
|
+
*/
|
|
1350
|
+
private [_unload];
|
|
1351
|
+
/**
|
|
1352
|
+
* 查找root view索引
|
|
1353
|
+
* @param route
|
|
1354
|
+
*/
|
|
1355
|
+
private [_findRootView];
|
|
1356
|
+
/**
|
|
1357
|
+
* 查找first view
|
|
1358
|
+
* @param route
|
|
1359
|
+
*/
|
|
1360
|
+
private [_getFirstView];
|
|
1361
|
+
/**
|
|
1362
|
+
* 移除view
|
|
1363
|
+
* @param page
|
|
1364
|
+
* @param pos
|
|
1365
|
+
* @param indexs
|
|
1366
|
+
* @param under
|
|
1367
|
+
*/
|
|
1368
|
+
private [_removeView];
|
|
1369
|
+
/**
|
|
1370
|
+
* 恢复
|
|
1371
|
+
* @param routes
|
|
1372
|
+
*
|
|
1373
|
+
* @returns
|
|
1374
|
+
*/
|
|
1375
|
+
restore(routes?: Route[]): Promise<void>;
|
|
1376
|
+
/**
|
|
1377
|
+
* build page
|
|
1378
|
+
* @param route
|
|
1379
|
+
* @param routeModel
|
|
1380
|
+
* @returns {boolean}
|
|
1381
|
+
*/
|
|
1382
|
+
private [_buildPage];
|
|
1383
|
+
/**
|
|
1384
|
+
* 解析组件
|
|
1385
|
+
*/
|
|
1386
|
+
private [_resolveComponent];
|
|
1387
|
+
/**
|
|
1388
|
+
* 更新页面
|
|
1389
|
+
* @param routeModel
|
|
1390
|
+
* @param route
|
|
1391
|
+
* @param session
|
|
1392
|
+
* @param updateType
|
|
1393
|
+
* @returns
|
|
1394
|
+
*/
|
|
1395
|
+
private [_update];
|
|
1396
|
+
/**
|
|
1397
|
+
* 合并view
|
|
1398
|
+
* @param page
|
|
1399
|
+
* @param startViewLevel
|
|
1400
|
+
* @param routeModel
|
|
1401
|
+
* @param startModelLevel
|
|
1402
|
+
* @param rootNodeRef
|
|
1403
|
+
*/
|
|
1404
|
+
[_merge](page: Page, startViewLevel: number, routeModel: RouteModel, startModelLevel: number, rootNodeRef: ViewPlace): void;
|
|
1405
|
+
/**
|
|
1406
|
+
* router view与view同步数据
|
|
1407
|
+
* @param name
|
|
1408
|
+
* @param level
|
|
1409
|
+
* @param rootView
|
|
1410
|
+
* @param rootViewIndex
|
|
1411
|
+
* @param parentView
|
|
1412
|
+
* @param parentViewIndex
|
|
1413
|
+
* @returns
|
|
1414
|
+
*/
|
|
1415
|
+
[sync](name: string, level: number, rootView: View | null, rootViewIndex: number, parentView: View | null, parentViewIndex: number): View | null;
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
declare const registerKey: unique symbol;
|
|
1419
|
+
/**
|
|
1420
|
+
* callback function
|
|
1421
|
+
*/
|
|
1422
|
+
interface Callback {
|
|
1423
|
+
(...args: any[]): void;
|
|
1424
|
+
}
|
|
1425
|
+
/**
|
|
1426
|
+
* 事件代理
|
|
1427
|
+
*/
|
|
1428
|
+
declare class EventProxy {
|
|
1429
|
+
/**
|
|
1430
|
+
* 注册表
|
|
1431
|
+
*/
|
|
1432
|
+
private [registerKey];
|
|
1433
|
+
/**
|
|
1434
|
+
* 构造函数
|
|
1435
|
+
*/
|
|
1436
|
+
constructor();
|
|
1437
|
+
/**
|
|
1438
|
+
* 绑定事件
|
|
1439
|
+
* @param key
|
|
1440
|
+
* @param callback
|
|
1441
|
+
* @param once
|
|
1442
|
+
* @returns
|
|
1443
|
+
*/
|
|
1444
|
+
on(key: string, callback: Callback, once?: boolean): EventProxy;
|
|
1445
|
+
/**
|
|
1446
|
+
* 解除绑定
|
|
1447
|
+
* @param key
|
|
1448
|
+
* @param callback
|
|
1449
|
+
* @returns
|
|
1450
|
+
*/
|
|
1451
|
+
off(key: string, callback: Callback): EventProxy;
|
|
1452
|
+
/**
|
|
1453
|
+
* 绑定事件
|
|
1454
|
+
* @param key
|
|
1455
|
+
* @param callback
|
|
1456
|
+
* @param once
|
|
1457
|
+
* @returns
|
|
1458
|
+
*/
|
|
1459
|
+
bind(key: string, callback: Callback, once?: boolean): EventProxy;
|
|
1460
|
+
/**
|
|
1461
|
+
* 解除绑定
|
|
1462
|
+
* @param key
|
|
1463
|
+
* @param callback
|
|
1464
|
+
* @returns
|
|
1465
|
+
*/
|
|
1466
|
+
unbind(key: string, callback: Callback): EventProxy;
|
|
1467
|
+
/**
|
|
1468
|
+
* 绑定一次性触发函数
|
|
1469
|
+
* @param key
|
|
1470
|
+
* @param callback
|
|
1471
|
+
* @returns
|
|
1472
|
+
*/
|
|
1473
|
+
once(key: string, callback: Callback): EventProxy;
|
|
1474
|
+
/**
|
|
1475
|
+
* 绑定多条件触发函数
|
|
1476
|
+
* @param args
|
|
1477
|
+
*/
|
|
1478
|
+
all(...args: any[]): this;
|
|
1479
|
+
/**
|
|
1480
|
+
* 触发函数
|
|
1481
|
+
* @param key
|
|
1482
|
+
* @param value
|
|
1483
|
+
*/
|
|
1484
|
+
emit(key: string, ...value: any[]): this;
|
|
1485
|
+
/**
|
|
1486
|
+
* 触发函数
|
|
1487
|
+
* @param key
|
|
1488
|
+
* @param value
|
|
1489
|
+
* @returns
|
|
1490
|
+
*/
|
|
1491
|
+
trigger(key: string, ...value: any[]): EventProxy;
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
/**
|
|
1495
|
+
* 是否数组
|
|
1496
|
+
*/
|
|
1497
|
+
declare const isArray: (arg: any) => arg is any[];
|
|
1498
|
+
/**
|
|
1499
|
+
* 是否为Map
|
|
1500
|
+
* @param val
|
|
1501
|
+
* @returns
|
|
1502
|
+
*/
|
|
1503
|
+
declare const isMap: (val: unknown) => val is Map<any, any>;
|
|
1504
|
+
/**
|
|
1505
|
+
* 是否为Set
|
|
1506
|
+
* @param val
|
|
1507
|
+
* @returns
|
|
1508
|
+
*/
|
|
1509
|
+
declare const isSet: (val: unknown) => val is Set<any>;
|
|
1510
|
+
/**
|
|
1511
|
+
* 是否为Date
|
|
1512
|
+
* @param val
|
|
1513
|
+
* @returns
|
|
1514
|
+
*/
|
|
1515
|
+
declare const isDate: (val: unknown) => val is Date;
|
|
1516
|
+
/**
|
|
1517
|
+
* 是否为函数
|
|
1518
|
+
* @param val
|
|
1519
|
+
* @returns
|
|
1520
|
+
*/
|
|
1521
|
+
declare const isFunction: (val: unknown) => val is Function;
|
|
1522
|
+
/**
|
|
1523
|
+
* 是否为字符串
|
|
1524
|
+
* @param val
|
|
1525
|
+
* @returns
|
|
1526
|
+
*/
|
|
1527
|
+
declare const isString: (val: unknown) => val is string;
|
|
1528
|
+
/**
|
|
1529
|
+
* 是否为symbol
|
|
1530
|
+
* @param val
|
|
1531
|
+
* @returns
|
|
1532
|
+
*/
|
|
1533
|
+
declare const isSymbol: (val: unknown) => val is symbol;
|
|
1534
|
+
/**
|
|
1535
|
+
* 是否为object
|
|
1536
|
+
*/
|
|
1537
|
+
declare const isObject: (val: unknown) => val is Record<any, any>;
|
|
1538
|
+
/**
|
|
1539
|
+
* 是否为promise
|
|
1540
|
+
* @param val
|
|
1541
|
+
* @returns
|
|
1542
|
+
*/
|
|
1543
|
+
declare const isPromise: <T = any>(val: unknown) => val is Promise<T>;
|
|
1544
|
+
declare const toTypeString: (value: unknown) => string;
|
|
1545
|
+
/**
|
|
1546
|
+
* 是否为plain对象
|
|
1547
|
+
* @param val
|
|
1548
|
+
* @returns
|
|
1549
|
+
*/
|
|
1550
|
+
declare const isPlainObject: (val: unknown) => val is object;
|
|
1551
|
+
/**
|
|
1552
|
+
* 是否为es module
|
|
1553
|
+
* @param obj
|
|
1554
|
+
* @returns
|
|
1555
|
+
*/
|
|
1556
|
+
declare function isESModule(obj: any): obj is Object;
|
|
1557
|
+
/**
|
|
1558
|
+
* 继承(是否深度拷贝,dest,src1,src2,src3...)
|
|
1559
|
+
*
|
|
1560
|
+
* @returns
|
|
1561
|
+
*/
|
|
1562
|
+
declare function extend(...args: any[]): any;
|
|
1563
|
+
/**
|
|
1564
|
+
* 克隆对象
|
|
1565
|
+
* @param target
|
|
1566
|
+
* @param source
|
|
1567
|
+
* @param plain
|
|
1568
|
+
*
|
|
1569
|
+
* @returns
|
|
1570
|
+
*/
|
|
1571
|
+
declare function clone(target: any, source: any, plain?: boolean): any;
|
|
1572
|
+
/**
|
|
1573
|
+
* 转换为boolean值
|
|
1574
|
+
* @param val
|
|
1575
|
+
* @returns
|
|
1576
|
+
*/
|
|
1577
|
+
declare function toBoolean(val: unknown): boolean;
|
|
1578
|
+
/**
|
|
1579
|
+
* 转换为number值
|
|
1580
|
+
* @param val
|
|
1581
|
+
* @returns
|
|
1582
|
+
*/
|
|
1583
|
+
declare function toNumber(val: unknown): number;
|
|
1584
|
+
/**
|
|
1585
|
+
* 判断两个对象是否一致
|
|
1586
|
+
* @param x
|
|
1587
|
+
* @param y
|
|
1588
|
+
* @returns {boolean}
|
|
1589
|
+
*/
|
|
1590
|
+
declare function isEqual(x: any, y: any): boolean;
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* 发起请求
|
|
1594
|
+
* @param args
|
|
1595
|
+
* @returns
|
|
1596
|
+
*/
|
|
1597
|
+
declare function request(args: any): Promise<any>;
|
|
1598
|
+
/**
|
|
1599
|
+
* 取消ajax请求
|
|
1600
|
+
* @param args
|
|
1601
|
+
*/
|
|
1602
|
+
declare function cancel(id: any): boolean;
|
|
1603
|
+
|
|
1604
|
+
interface GenericFunction {
|
|
1605
|
+
(...args: any[]): any;
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
declare let onFoxActivated: (hook: GenericFunction) => void;
|
|
1609
|
+
declare let onFoxDeactivated: (hook: GenericFunction) => void;
|
|
1610
|
+
|
|
1611
|
+
/**
|
|
1612
|
+
* Tool工具集合接口
|
|
1613
|
+
*/
|
|
1614
|
+
interface Tools {
|
|
1615
|
+
get each(): Function;
|
|
1616
|
+
get type(): Function;
|
|
1617
|
+
get isFunction(): Function;
|
|
1618
|
+
get isArray(): Function;
|
|
1619
|
+
get isArrayLike(): Function;
|
|
1620
|
+
get makeArray(): Function;
|
|
1621
|
+
get merge(): Function;
|
|
1622
|
+
get isWindow(): Function;
|
|
1623
|
+
get isPlainObject(): Function;
|
|
1624
|
+
get isEqual(): Function;
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
/**
|
|
1628
|
+
* 参数
|
|
1629
|
+
*/
|
|
1630
|
+
interface FoxOptions extends RouterOptions {
|
|
1631
|
+
}
|
|
1632
|
+
/**
|
|
1633
|
+
* Fox接口
|
|
1634
|
+
*/
|
|
1635
|
+
interface Fox extends Tools {
|
|
1636
|
+
/**
|
|
1637
|
+
* 返回router
|
|
1638
|
+
*/
|
|
1639
|
+
get router(): Router;
|
|
1640
|
+
/**
|
|
1641
|
+
* 返回全局Bus
|
|
1642
|
+
*/
|
|
1643
|
+
get bus(): Tree;
|
|
1644
|
+
/**
|
|
1645
|
+
* 返回Bus类型
|
|
1646
|
+
*/
|
|
1647
|
+
get Bus(): typeof Bus;
|
|
1648
|
+
/**
|
|
1649
|
+
* 返回全局event proxy
|
|
1650
|
+
*/
|
|
1651
|
+
get eventproxy(): EventProxy;
|
|
1652
|
+
/**
|
|
1653
|
+
* 返回全局event proxy
|
|
1654
|
+
*/
|
|
1655
|
+
get EventProxy(): typeof EventProxy;
|
|
1656
|
+
/**
|
|
1657
|
+
* 返回event chain类型
|
|
1658
|
+
*/
|
|
1659
|
+
get EventChain(): typeof EventChain;
|
|
1660
|
+
/**
|
|
1661
|
+
* 返回require
|
|
1662
|
+
*/
|
|
1663
|
+
get require(): Require;
|
|
1664
|
+
/**
|
|
1665
|
+
* 返回fectch
|
|
1666
|
+
*/
|
|
1667
|
+
get request(): Function;
|
|
1668
|
+
/**
|
|
1669
|
+
* 返回extend
|
|
1670
|
+
*/
|
|
1671
|
+
get extend(): Function;
|
|
1672
|
+
/**
|
|
1673
|
+
* 返回clone
|
|
1674
|
+
*/
|
|
1675
|
+
get clone(): Function;
|
|
1676
|
+
/**
|
|
1677
|
+
* 安装
|
|
1678
|
+
* @param app
|
|
1679
|
+
*/
|
|
1680
|
+
install(app: App): void;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* 创建Fox
|
|
1684
|
+
* @param options
|
|
1685
|
+
* @returns
|
|
1686
|
+
*/
|
|
1687
|
+
declare function createFox(options?: FoxOptions): Fox;
|
|
1688
|
+
/**
|
|
1689
|
+
* Returns the current router
|
|
1690
|
+
*/
|
|
1691
|
+
declare function useRouter(): Router;
|
|
1692
|
+
/**
|
|
1693
|
+
* Returns the current route
|
|
1694
|
+
*/
|
|
1695
|
+
declare function useRoute(): Route | null;
|
|
1696
|
+
/**
|
|
1697
|
+
* Returns the current fox
|
|
1698
|
+
*/
|
|
1699
|
+
declare function useFox(): Fox | null;
|
|
1700
|
+
/**
|
|
1701
|
+
* Returns the global bus
|
|
1702
|
+
* @returns
|
|
1703
|
+
*/
|
|
1704
|
+
declare function useBus(): Tree | null;
|
|
1705
|
+
/**
|
|
1706
|
+
* Returns the global event proxy
|
|
1707
|
+
* @returns
|
|
1708
|
+
*/
|
|
1709
|
+
declare function useEventProxy(): EventProxy | null;
|
|
1710
|
+
/**
|
|
1711
|
+
* 路由更新前执行
|
|
1712
|
+
* @param callback
|
|
1713
|
+
*/
|
|
1714
|
+
declare function onBeforeRouteUpdate(callback: {
|
|
1715
|
+
(to: Route, from?: Route): void;
|
|
1716
|
+
}): void;
|
|
1717
|
+
/**
|
|
1718
|
+
* 路由更新后执行
|
|
1719
|
+
* @param callback
|
|
1720
|
+
*/
|
|
1721
|
+
declare function onAfterRouteUpdate(callback: {
|
|
1722
|
+
(to: Route, from?: Route): void;
|
|
1723
|
+
}): void;
|
|
1724
|
+
|
|
1725
|
+
export { Bus, EventChain, EventProxy, Route, Router, cancel, clone, createFox, extend, isArray, isDate, isESModule, isEqual, isFunction, isMap, isObject, isPlainObject, isPromise, isSet, isString, isSymbol, onAfterRouteUpdate, onBeforeRouteUpdate, onFoxActivated, onFoxDeactivated, request, toBoolean, toNumber, toTypeString, useBus, useEventProxy, useFox, useRoute, useRouter };
|