@tramvai/tokens-router 2.109.0 → 2.110.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.
package/lib/index.d.ts CHANGED
@@ -30,6 +30,13 @@ export declare const ROUTER_GUARD_TOKEN: NavigationGuard & {
30
30
  export declare const PAGE_SERVICE_TOKEN: PageService & {
31
31
  __type?: "base token" | undefined;
32
32
  };
33
+ /**
34
+ * @description
35
+ * Managers registration for additions related to pages and bundles
36
+ */
37
+ export declare const PAGE_REGISTRY_TOKEN: PageRegistry & {
38
+ __type?: "base token" | undefined;
39
+ };
33
40
  /**
34
41
  * @description
35
42
  * Hook to resolve route dynamically
@@ -56,6 +63,9 @@ export declare const ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN: ("before" & {
56
63
  export declare const LINK_PREFETCH_MANAGER_TOKEN: LinkPrefetchManager & {
57
64
  __type?: "base token" | undefined;
58
65
  };
66
+ export declare const LINK_PREFETCH_HANDLER_TOKEN: ((route: Route) => Promise<void>) & {
67
+ __type?: "multi token" | undefined;
68
+ };
59
69
  export declare const ROUTER_MODE_TOKEN: ("spa" & {
60
70
  __type?: "base token" | undefined;
61
71
  }) | ("no-spa" & {
@@ -65,9 +75,9 @@ export type PageServiceComponentType = 'page' | 'layout' | 'nestedLayout' | 'hea
65
75
  export interface PageService {
66
76
  getCurrentRoute(): NavigationRoute;
67
77
  getCurrentUrl(): ReturnType<AbstractRouter['getCurrentUrl']>;
68
- getConfig(): Route['config'];
69
- getContent(): Record<string, any>;
70
- getMeta(): {
78
+ getConfig(route?: Route): Route['config'];
79
+ getContent(route?: Route): Record<string, any>;
80
+ getMeta(route?: Route): {
71
81
  seo: Record<string, string>;
72
82
  analytics: Record<string, string>;
73
83
  };
@@ -76,9 +86,12 @@ export interface PageService {
76
86
  back(options?: HistoryOptions): Promise<void>;
77
87
  forward(): Promise<void>;
78
88
  go(to: number, options?: HistoryOptions): Promise<void>;
79
- addComponent(name: string, component: TramvaiComponent): void;
80
- getComponent(name: string): TramvaiComponent | undefined;
81
- resolveComponentFromConfig(property: PageServiceComponentType): TramvaiComponent | undefined;
89
+ addComponent(name: string, component: TramvaiComponent, route?: Route): void;
90
+ getComponent(name: string, route?: Route): TramvaiComponent | undefined;
91
+ resolveComponentFromConfig(property: PageServiceComponentType, route?: Route): TramvaiComponent | undefined;
92
+ }
93
+ export interface PageRegistry {
94
+ resolve(route: Route): Promise<void>;
82
95
  }
83
96
  export type RouteResolve = (navigation: Navigation) => Promise<Route | void>;
84
97
  export type RouteTransform = (route: Route) => Route;
package/lib/index.es.js CHANGED
@@ -20,6 +20,11 @@ const ROUTER_GUARD_TOKEN = createToken('router guard', { multi: true });
20
20
  * Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
21
21
  */
22
22
  const PAGE_SERVICE_TOKEN = createToken('router pageService');
23
+ /**
24
+ * @description
25
+ * Managers registration for additions related to pages and bundles
26
+ */
27
+ const PAGE_REGISTRY_TOKEN = createToken('router pageRegistry');
23
28
  /**
24
29
  * @description
25
30
  * Hook to resolve route dynamically
@@ -38,6 +43,7 @@ const ROUTE_TRANSFORM_TOKEN = createToken('router routeTransform', {
38
43
  */
39
44
  const ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN = createToken('router spaRunMode');
40
45
  const LINK_PREFETCH_MANAGER_TOKEN = createToken('link prefetch manager');
46
+ const LINK_PREFETCH_HANDLER_TOKEN = createToken('link prefetch handler', { multi: true });
41
47
  const ROUTER_MODE_TOKEN = createToken('router mode');
42
48
 
43
- export { LINK_PREFETCH_MANAGER_TOKEN, PAGE_SERVICE_TOKEN, ROUTER_GUARD_TOKEN, ROUTER_MODE_TOKEN, ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN, ROUTER_TOKEN, ROUTES_TOKEN, ROUTE_RESOLVE_TOKEN, ROUTE_TRANSFORM_TOKEN };
49
+ export { LINK_PREFETCH_HANDLER_TOKEN, LINK_PREFETCH_MANAGER_TOKEN, PAGE_REGISTRY_TOKEN, PAGE_SERVICE_TOKEN, ROUTER_GUARD_TOKEN, ROUTER_MODE_TOKEN, ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN, ROUTER_TOKEN, ROUTES_TOKEN, ROUTE_RESOLVE_TOKEN, ROUTE_TRANSFORM_TOKEN };
package/lib/index.js CHANGED
@@ -24,6 +24,11 @@ const ROUTER_GUARD_TOKEN = dippy.createToken('router guard', { multi: true });
24
24
  * Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
25
25
  */
26
26
  const PAGE_SERVICE_TOKEN = dippy.createToken('router pageService');
27
+ /**
28
+ * @description
29
+ * Managers registration for additions related to pages and bundles
30
+ */
31
+ const PAGE_REGISTRY_TOKEN = dippy.createToken('router pageRegistry');
27
32
  /**
28
33
  * @description
29
34
  * Hook to resolve route dynamically
@@ -42,9 +47,12 @@ const ROUTE_TRANSFORM_TOKEN = dippy.createToken('router routeTransform', {
42
47
  */
43
48
  const ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN = dippy.createToken('router spaRunMode');
44
49
  const LINK_PREFETCH_MANAGER_TOKEN = dippy.createToken('link prefetch manager');
50
+ const LINK_PREFETCH_HANDLER_TOKEN = dippy.createToken('link prefetch handler', { multi: true });
45
51
  const ROUTER_MODE_TOKEN = dippy.createToken('router mode');
46
52
 
53
+ exports.LINK_PREFETCH_HANDLER_TOKEN = LINK_PREFETCH_HANDLER_TOKEN;
47
54
  exports.LINK_PREFETCH_MANAGER_TOKEN = LINK_PREFETCH_MANAGER_TOKEN;
55
+ exports.PAGE_REGISTRY_TOKEN = PAGE_REGISTRY_TOKEN;
48
56
  exports.PAGE_SERVICE_TOKEN = PAGE_SERVICE_TOKEN;
49
57
  exports.ROUTER_GUARD_TOKEN = ROUTER_GUARD_TOKEN;
50
58
  exports.ROUTER_MODE_TOKEN = ROUTER_MODE_TOKEN;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tramvai/tokens-router",
3
- "version": "2.109.0",
3
+ "version": "2.110.0",
4
4
  "description": "Tramvai tokens for @tramvai/module-router",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/index.es.js",
@@ -19,7 +19,7 @@
19
19
  },
20
20
  "dependencies": {
21
21
  "@tinkoff/router": "0.2.16",
22
- "@tramvai/react": "2.109.0"
22
+ "@tramvai/react": "2.110.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "@tinkoff/dippy": "0.8.15",