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