@fox-js/fox 3.1.1-7 → 3.1.1-9

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.
@@ -14,7 +14,7 @@ declare const afterFiltersKey: unique symbol;
14
14
  * after route update filter
15
15
  */
16
16
  declare interface AfterRouteFilter {
17
- (to: Route, from: Route, session: Record<string | number | symbol, any>): void;
17
+ (to: Route, from: Route | null, session: Record<string | number | symbol, any>): void;
18
18
  }
19
19
 
20
20
  declare const argsKey: unique symbol;
@@ -34,7 +34,7 @@ declare interface BeforeResotreFilter {
34
34
  * before route update filter
35
35
  */
36
36
  declare interface BeforeRouteFilter {
37
- (to: Route, from: Route, next: {
37
+ (to: Route, from: Route | null, next: {
38
38
  (pass?: boolean | Route): void;
39
39
  }, session: Record<string | number | symbol, any>): void;
40
40
  }
@@ -118,6 +118,8 @@ export declare function createWebHashHistory(navigateFirstRoute?: boolean, query
118
118
  */
119
119
  export declare function createWebHistory(navigateFirstRoute?: boolean, base?: string | null, query?: string, historyMonitor?: boolean | IfFunction, traceless?: boolean | IfFunction, storage?: Storage_2): RouterHistory;
120
120
 
121
+ declare const currentRoute: unique symbol;
122
+
121
123
  declare const currentRoutes: unique symbol;
122
124
 
123
125
  declare const cursorKey: unique symbol;
@@ -445,7 +447,7 @@ export declare interface Fox {
445
447
  * 安装
446
448
  * @param app
447
449
  */
448
- install(app: App): void;
450
+ install(app: App<Element>): void;
449
451
  }
450
452
 
451
453
  /**
@@ -473,8 +475,7 @@ export declare const FoxEnter = "FoxEnter";
473
475
  */
474
476
  export declare const foxEventProxyKey: FoxInjectionKey<EventProxy>;
475
477
 
476
- declare interface FoxInjectionKey<T> extends InjectionKey<T> {
477
- }
478
+ declare type FoxInjectionKey<T> = InjectionKey<T>;
478
479
 
479
480
  /**
480
481
  * 全局Fox
@@ -765,6 +766,8 @@ declare class ModelSlot {
765
766
 
766
767
  declare const nameKey: unique symbol;
767
768
 
769
+ declare const normalizeRoute: unique symbol;
770
+
768
771
  declare const notFoundKey: unique symbol;
769
772
 
770
773
  declare const notFoundPathKey: unique symbol;
@@ -831,14 +834,18 @@ declare const parentNodeKey: unique symbol;
831
834
  declare const persistentModeKey: unique symbol;
832
835
 
833
836
  /**
834
- * 持久化策略
837
+ * 持久化参数
835
838
  */
836
- declare type PersistPolicy = 'memory' | 'session' | 'local' | 'custom';
839
+ declare type PersistOptions = {
840
+ name?: string;
841
+ persistPolicy?: PersistPolicy;
842
+ storage?: Storage_2;
843
+ };
837
844
 
838
845
  /**
839
846
  * 持久化策略
840
847
  */
841
- declare type PersistPolicy_2 = 'memory' | 'session' | 'local' | 'custom';
848
+ declare type PersistPolicy = 'memory' | 'session' | 'local' | 'custom';
842
849
 
843
850
  /**
844
851
  * 属性函数
@@ -872,7 +879,7 @@ declare type Proxy_2 = ComponentPublicInstance | null;
872
879
  * @param options
873
880
  * @returns
874
881
  */
875
- export declare function rawState<T extends Record<string, any>>(state: T, options?: StateOptions): T;
882
+ export declare function rawState<T extends Record<string, any>>(state: T, options?: StatePersistOptions): T;
876
883
 
877
884
  /**
878
885
  * reactive state
@@ -880,7 +887,7 @@ export declare function rawState<T extends Record<string, any>>(state: T, option
880
887
  * @param options
881
888
  * @returns
882
889
  */
883
- export declare function reactiveState<T extends Record<string, any>>(state: T, options?: StateOptions): T;
890
+ export declare function reactiveState<T extends Record<string, any>>(state: T, options?: StatePersistOptions): T;
884
891
 
885
892
  declare const readyHandlersKey: unique symbol;
886
893
 
@@ -1044,8 +1051,6 @@ declare class Require {
1044
1051
 
1045
1052
  declare const _resolveComponent: unique symbol;
1046
1053
 
1047
- declare const resolveRoute: unique symbol;
1048
-
1049
1054
  declare const rootKey: unique symbol;
1050
1055
 
1051
1056
  declare const rootNodeKey: unique symbol;
@@ -1275,6 +1280,10 @@ export declare class Router {
1275
1280
  * 当前路由集合
1276
1281
  */
1277
1282
  private [currentRoutes];
1283
+ /**
1284
+ * 当前路由
1285
+ */
1286
+ private [currentRoute];
1278
1287
  /**
1279
1288
  * route sessin key
1280
1289
  */
@@ -1318,7 +1327,101 @@ export declare class Router {
1318
1327
  /**
1319
1328
  * 获取当前最新route
1320
1329
  */
1321
- get current(): Route | null;
1330
+ get currentRoute(): Readonly<Ref<{
1331
+ readonly path?: string | undefined;
1332
+ readonly fullPath?: string;
1333
+ readonly alias?: string | undefined;
1334
+ readonly name?: string | undefined;
1335
+ readonly root?: string | undefined;
1336
+ readonly params?: {
1337
+ readonly [x: string]: any;
1338
+ readonly [x: number]: any;
1339
+ readonly [x: symbol]: any;
1340
+ } | undefined;
1341
+ readonly query?: any;
1342
+ readonly traceless?: boolean | undefined;
1343
+ readonly template?: string | undefined;
1344
+ readonly matched?: readonly {
1345
+ readonly meta: {
1346
+ readonly [x: string]: any;
1347
+ readonly [x: number]: any;
1348
+ readonly [x: symbol]: any;
1349
+ };
1350
+ }[] | undefined;
1351
+ readonly meta?: {
1352
+ readonly [x: string]: any;
1353
+ readonly [x: number]: any;
1354
+ readonly [x: symbol]: any;
1355
+ } | undefined;
1356
+ readonly success?: {
1357
+ (...arg: any[]): void;
1358
+ } | undefined;
1359
+ readonly error?: {
1360
+ (...arg: any[]): void;
1361
+ } | undefined;
1362
+ readonly destroy?: {
1363
+ (...arg: any[]): void;
1364
+ } | undefined;
1365
+ readonly opsType?: OperationType | undefined;
1366
+ readonly updateType?: UpdateType | undefined;
1367
+ readonly historyUpdatePolicy?: HistoryUpdatePolicy | undefined;
1368
+ readonly viewTagAttrs?: any;
1369
+ readonly index?: number | undefined;
1370
+ readonly active?: boolean | undefined;
1371
+ readonly slot?: {
1372
+ readonly name: string;
1373
+ readonly level: number;
1374
+ readonly rootName: string | undefined;
1375
+ readonly rootIndex: number;
1376
+ } | undefined;
1377
+ } | null, {
1378
+ readonly path?: string | undefined;
1379
+ readonly fullPath?: string;
1380
+ readonly alias?: string | undefined;
1381
+ readonly name?: string | undefined;
1382
+ readonly root?: string | undefined;
1383
+ readonly params?: {
1384
+ readonly [x: string]: any;
1385
+ readonly [x: number]: any;
1386
+ readonly [x: symbol]: any;
1387
+ } | undefined;
1388
+ readonly query?: any;
1389
+ readonly traceless?: boolean | undefined;
1390
+ readonly template?: string | undefined;
1391
+ readonly matched?: readonly {
1392
+ readonly meta: {
1393
+ readonly [x: string]: any;
1394
+ readonly [x: number]: any;
1395
+ readonly [x: symbol]: any;
1396
+ };
1397
+ }[] | undefined;
1398
+ readonly meta?: {
1399
+ readonly [x: string]: any;
1400
+ readonly [x: number]: any;
1401
+ readonly [x: symbol]: any;
1402
+ } | undefined;
1403
+ readonly success?: {
1404
+ (...arg: any[]): void;
1405
+ } | undefined;
1406
+ readonly error?: {
1407
+ (...arg: any[]): void;
1408
+ } | undefined;
1409
+ readonly destroy?: {
1410
+ (...arg: any[]): void;
1411
+ } | undefined;
1412
+ readonly opsType?: OperationType | undefined;
1413
+ readonly updateType?: UpdateType | undefined;
1414
+ readonly historyUpdatePolicy?: HistoryUpdatePolicy | undefined;
1415
+ readonly viewTagAttrs?: any;
1416
+ readonly index?: number | undefined;
1417
+ readonly active?: boolean | undefined;
1418
+ readonly slot?: {
1419
+ readonly name: string;
1420
+ readonly level: number;
1421
+ readonly rootName: string | undefined;
1422
+ readonly rootIndex: number;
1423
+ } | undefined;
1424
+ } | null>>;
1322
1425
  private options;
1323
1426
  /**
1324
1427
  * 构造函数
@@ -1504,11 +1607,11 @@ export declare class Router {
1504
1607
  */
1505
1608
  private [_findRouteModel];
1506
1609
  /**
1507
- * 解释路由
1610
+ * 解析并格式化路由
1508
1611
  * @param args
1509
1612
  * @returns
1510
1613
  */
1511
- [resolveRoute](args: any): Route | null;
1614
+ [normalizeRoute](args: any): Route | null;
1512
1615
  /**
1513
1616
  * 路由跳转(operation类型为Push)
1514
1617
  * @param args
@@ -1785,7 +1888,7 @@ export declare const sessionKey: unique symbol;
1785
1888
  * @param options
1786
1889
  * @returns
1787
1890
  */
1788
- export declare function shallowReactiveState<T extends Record<string, any>>(state: T, options?: StateOptions): T;
1891
+ export declare function shallowReactiveState<T extends Record<string, any>>(state: T, options?: StatePersistOptions): T;
1789
1892
 
1790
1893
  /**
1791
1894
  * 插槽
@@ -1821,14 +1924,19 @@ declare const _start: unique symbol;
1821
1924
  /**
1822
1925
  * state参数
1823
1926
  */
1824
- export declare type StateOptions = {
1927
+ export declare type StatePersistOptions = {
1825
1928
  name?: string;
1826
- persistPolicy?: PersistPolicy_2;
1929
+ persistPolicy?: StatePersistPolicy;
1827
1930
  storage?: Storage;
1828
1931
  debounce?: boolean;
1829
1932
  debounceDelay?: number;
1830
1933
  };
1831
1934
 
1935
+ /**
1936
+ * 持久化策略
1937
+ */
1938
+ declare type StatePersistPolicy = 'memory' | 'session' | 'local' | 'custom';
1939
+
1832
1940
  declare const statusKey: unique symbol;
1833
1941
 
1834
1942
  /**
@@ -1933,7 +2041,7 @@ declare class TreeImpl extends TreeNodeImpl implements Tree {
1933
2041
  /**
1934
2042
  * 默认构造函数
1935
2043
  */
1936
- constructor(options?: TreeOptions, defaultState?: Record<string, any>);
2044
+ constructor(options?: PersistOptions, defaultState?: Record<string, any>);
1937
2045
  /**
1938
2046
  * 加入数据
1939
2047
  * @param args
@@ -2005,15 +2113,6 @@ declare class TreeNodeImpl implements TreeNode {
2005
2113
  constructor(id: string);
2006
2114
  }
2007
2115
 
2008
- /**
2009
- * Tree参数
2010
- */
2011
- declare type TreeOptions = {
2012
- name?: string;
2013
- persistPolicy?: PersistPolicy;
2014
- storage?: Storage_2;
2015
- };
2016
-
2017
2116
  /**
2018
2117
  * 判断类型
2019
2118
  * @param obj