@tramvai/tokens-router 7.5.3 → 7.7.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 +57 -9
- package/lib/index.es.js +5 -2
- package/lib/index.js +4 -0
- package/package.json +4 -3
package/lib/index.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import type { AbstractRouter, NavigationGuard, Route, Navigation, NavigationRoute, NavigateOptions, UpdateCurrentRouteOptions, HistoryOptions, RouteConfig, RouterPlugin } from '@tinkoff/router';
|
|
2
|
+
import type { AsyncParallelTapableHookInstance, AsyncTapableHookInstance } from '@tinkoff/hook-runner';
|
|
2
3
|
import type { TramvaiComponent } from '@tramvai/react';
|
|
3
4
|
/**
|
|
4
5
|
* @description
|
|
5
6
|
* Token to access the router instance
|
|
6
7
|
*/
|
|
7
8
|
export declare const ROUTER_TOKEN: AbstractRouter & {
|
|
8
|
-
__type?: "base token" | undefined;
|
|
9
|
+
__type?: "base token" | undefined; /**
|
|
10
|
+
* @description
|
|
11
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
12
|
+
*/
|
|
9
13
|
};
|
|
10
14
|
/**
|
|
11
15
|
* @description
|
|
@@ -28,21 +32,30 @@ export declare const ROUTER_GUARD_TOKEN: NavigationGuard & {
|
|
|
28
32
|
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
29
33
|
*/
|
|
30
34
|
export declare const PAGE_SERVICE_TOKEN: PageService & {
|
|
31
|
-
__type?: "base token" | undefined;
|
|
35
|
+
__type?: "base token" | undefined; /**
|
|
36
|
+
* @description
|
|
37
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
38
|
+
*/
|
|
32
39
|
};
|
|
33
40
|
/**
|
|
34
41
|
* @description
|
|
35
42
|
* Managers registration for additions related to pages and bundles
|
|
36
43
|
*/
|
|
37
44
|
export declare const PAGE_REGISTRY_TOKEN: PageRegistry & {
|
|
38
|
-
__type?: "base token" | undefined;
|
|
45
|
+
__type?: "base token" | undefined; /**
|
|
46
|
+
* @description
|
|
47
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
48
|
+
*/
|
|
39
49
|
};
|
|
40
50
|
/**
|
|
41
51
|
* @description
|
|
42
52
|
* Hook to resolve route dynamically
|
|
43
53
|
*/
|
|
44
54
|
export declare const ROUTE_RESOLVE_TOKEN: RouteResolve & {
|
|
45
|
-
__type?: "base token" | undefined;
|
|
55
|
+
__type?: "base token" | undefined; /**
|
|
56
|
+
* @description
|
|
57
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
58
|
+
*/
|
|
46
59
|
};
|
|
47
60
|
/**
|
|
48
61
|
* @description
|
|
@@ -56,20 +69,35 @@ export declare const ROUTE_TRANSFORM_TOKEN: RouteTransform & {
|
|
|
56
69
|
* Flag for SPA-transitions, indicating that actions must be executed before or after a route update in the stor
|
|
57
70
|
*/
|
|
58
71
|
export declare const ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN: ("before" & {
|
|
59
|
-
__type?: "base token" | undefined;
|
|
72
|
+
__type?: "base token" | undefined; /**
|
|
73
|
+
* @description
|
|
74
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
75
|
+
*/
|
|
60
76
|
}) | ("after" & {
|
|
61
|
-
__type?: "base token" | undefined;
|
|
77
|
+
__type?: "base token" | undefined; /**
|
|
78
|
+
* @description
|
|
79
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
80
|
+
*/
|
|
62
81
|
});
|
|
63
82
|
export declare const LINK_PREFETCH_MANAGER_TOKEN: LinkPrefetchManager & {
|
|
64
|
-
__type?: "base token" | undefined;
|
|
83
|
+
__type?: "base token" | undefined; /**
|
|
84
|
+
* @description
|
|
85
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
86
|
+
*/
|
|
65
87
|
};
|
|
66
88
|
export declare const LINK_PREFETCH_HANDLER_TOKEN: ((route: Route) => Promise<void>) & {
|
|
67
89
|
__type?: "multi token" | undefined;
|
|
68
90
|
};
|
|
69
91
|
export declare const ROUTER_MODE_TOKEN: ("spa" & {
|
|
70
|
-
__type?: "base token" | undefined;
|
|
92
|
+
__type?: "base token" | undefined; /**
|
|
93
|
+
* @description
|
|
94
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
95
|
+
*/
|
|
71
96
|
}) | ("no-spa" & {
|
|
72
|
-
__type?: "base token" | undefined;
|
|
97
|
+
__type?: "base token" | undefined; /**
|
|
98
|
+
* @description
|
|
99
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
100
|
+
*/
|
|
73
101
|
});
|
|
74
102
|
export type PageServiceComponentType = 'page' | 'layout' | 'nestedLayout' | 'header' | 'footer' | 'errorBoundary';
|
|
75
103
|
export interface PageService {
|
|
@@ -102,4 +130,24 @@ export interface LinkPrefetchManager {
|
|
|
102
130
|
export declare const ROUTER_PLUGIN: RouterPlugin & {
|
|
103
131
|
__type?: "multi token" | undefined;
|
|
104
132
|
};
|
|
133
|
+
export interface PrerenderRequest {
|
|
134
|
+
/**
|
|
135
|
+
* Page path, for example, '/product/123/', without query parameters
|
|
136
|
+
*/
|
|
137
|
+
pathname: string;
|
|
138
|
+
headers?: Record<string, string>;
|
|
139
|
+
query?: Record<string, string>;
|
|
140
|
+
}
|
|
141
|
+
export type PrerenderHooksToken = {
|
|
142
|
+
'prerender:routes': AsyncParallelTapableHookInstance<Array<string | PrerenderRequest>>;
|
|
143
|
+
'prerender:generate': AsyncTapableHookInstance<NavigationRoute & {
|
|
144
|
+
prerenderSkip?: boolean;
|
|
145
|
+
}>;
|
|
146
|
+
};
|
|
147
|
+
export declare const PRERENDER_HOOKS_TOKEN: PrerenderHooksToken & {
|
|
148
|
+
__type?: "base token" | undefined; /**
|
|
149
|
+
* @description
|
|
150
|
+
* Encapsulates the logic of working with the router - contains methods for getting the configuration of the route and performing navigation
|
|
151
|
+
*/
|
|
152
|
+
};
|
|
105
153
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { createToken } from '@tinkoff/dippy';
|
|
1
|
+
import { createToken, Scope } from '@tinkoff/dippy';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* @description
|
|
@@ -50,5 +50,8 @@ const ROUTER_MODE_TOKEN = createToken('router mode');
|
|
|
50
50
|
* Token to provide router plugins
|
|
51
51
|
*/
|
|
52
52
|
const ROUTER_PLUGIN = createToken('router plugin', { multi: true });
|
|
53
|
+
const PRERENDER_HOOKS_TOKEN = createToken('tramvai prerender hooks', {
|
|
54
|
+
scope: Scope.SINGLETON,
|
|
55
|
+
});
|
|
53
56
|
|
|
54
|
-
export { LINK_PREFETCH_HANDLER_TOKEN, LINK_PREFETCH_MANAGER_TOKEN, PAGE_REGISTRY_TOKEN, PAGE_SERVICE_TOKEN, ROUTER_GUARD_TOKEN, ROUTER_MODE_TOKEN, ROUTER_PLUGIN, ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN, ROUTER_TOKEN, ROUTES_TOKEN, ROUTE_RESOLVE_TOKEN, ROUTE_TRANSFORM_TOKEN };
|
|
57
|
+
export { LINK_PREFETCH_HANDLER_TOKEN, LINK_PREFETCH_MANAGER_TOKEN, PAGE_REGISTRY_TOKEN, PAGE_SERVICE_TOKEN, PRERENDER_HOOKS_TOKEN, ROUTER_GUARD_TOKEN, ROUTER_MODE_TOKEN, ROUTER_PLUGIN, ROUTER_SPA_ACTIONS_RUN_MODE_TOKEN, ROUTER_TOKEN, ROUTES_TOKEN, ROUTE_RESOLVE_TOKEN, ROUTE_TRANSFORM_TOKEN };
|
package/lib/index.js
CHANGED
|
@@ -54,11 +54,15 @@ const ROUTER_MODE_TOKEN = dippy.createToken('router mode');
|
|
|
54
54
|
* Token to provide router plugins
|
|
55
55
|
*/
|
|
56
56
|
const ROUTER_PLUGIN = dippy.createToken('router plugin', { multi: true });
|
|
57
|
+
const PRERENDER_HOOKS_TOKEN = dippy.createToken('tramvai prerender hooks', {
|
|
58
|
+
scope: dippy.Scope.SINGLETON,
|
|
59
|
+
});
|
|
57
60
|
|
|
58
61
|
exports.LINK_PREFETCH_HANDLER_TOKEN = LINK_PREFETCH_HANDLER_TOKEN;
|
|
59
62
|
exports.LINK_PREFETCH_MANAGER_TOKEN = LINK_PREFETCH_MANAGER_TOKEN;
|
|
60
63
|
exports.PAGE_REGISTRY_TOKEN = PAGE_REGISTRY_TOKEN;
|
|
61
64
|
exports.PAGE_SERVICE_TOKEN = PAGE_SERVICE_TOKEN;
|
|
65
|
+
exports.PRERENDER_HOOKS_TOKEN = PRERENDER_HOOKS_TOKEN;
|
|
62
66
|
exports.ROUTER_GUARD_TOKEN = ROUTER_GUARD_TOKEN;
|
|
63
67
|
exports.ROUTER_MODE_TOKEN = ROUTER_MODE_TOKEN;
|
|
64
68
|
exports.ROUTER_PLUGIN = ROUTER_PLUGIN;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/tokens-router",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.7.0",
|
|
4
4
|
"description": "Tramvai tokens for @tramvai/module-router",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/index.es.js",
|
|
@@ -18,8 +18,9 @@
|
|
|
18
18
|
"watch": "tsc -w"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@tinkoff/
|
|
22
|
-
"@
|
|
21
|
+
"@tinkoff/hook-runner": "0.9.1",
|
|
22
|
+
"@tinkoff/router": "0.7.25",
|
|
23
|
+
"@tramvai/react": "7.7.0"
|
|
23
24
|
},
|
|
24
25
|
"peerDependencies": {
|
|
25
26
|
"@tinkoff/dippy": "0.13.2",
|