mobx-route 0.18.0 → 0.19.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.
Files changed (163) hide show
  1. package/index.cjs +536 -17
  2. package/index.cjs.map +1 -0
  3. package/index.d.ts +420 -2
  4. package/index.js +532 -2
  5. package/index.js.map +1 -0
  6. package/package.json +20 -63
  7. package/react.cjs +170 -0
  8. package/react.cjs.map +1 -0
  9. package/react.d.ts +71 -0
  10. package/react.js +170 -0
  11. package/react.js.map +1 -0
  12. package/view-model.cjs +56 -0
  13. package/view-model.cjs.map +1 -0
  14. package/view-model.d.ts +14 -0
  15. package/view-model.js +56 -0
  16. package/view-model.js.map +1 -0
  17. package/core/config/config.cjs +0 -36
  18. package/core/config/config.d.cts +0 -7
  19. package/core/config/config.d.cts.map +0 -1
  20. package/core/config/config.d.ts +0 -7
  21. package/core/config/config.d.ts.map +0 -1
  22. package/core/config/config.js +0 -33
  23. package/core/config/config.types.cjs +0 -2
  24. package/core/config/config.types.d.cts +0 -11
  25. package/core/config/config.types.d.cts.map +0 -1
  26. package/core/config/config.types.d.ts +0 -11
  27. package/core/config/config.types.d.ts.map +0 -1
  28. package/core/config/config.types.js +0 -1
  29. package/core/config/index.cjs +0 -18
  30. package/core/config/index.d.cts +0 -3
  31. package/core/config/index.d.cts.map +0 -1
  32. package/core/config/index.d.ts +0 -3
  33. package/core/config/index.d.ts.map +0 -1
  34. package/core/config/index.js +0 -2
  35. package/core/index.cjs +0 -21
  36. package/core/index.d.cts +0 -6
  37. package/core/index.d.cts.map +0 -1
  38. package/core/index.d.ts +0 -6
  39. package/core/index.d.ts.map +0 -1
  40. package/core/index.js +0 -5
  41. package/core/route/index.cjs +0 -18
  42. package/core/route/index.d.cts +0 -3
  43. package/core/route/index.d.cts.map +0 -1
  44. package/core/route/index.d.ts +0 -3
  45. package/core/route/index.d.ts.map +0 -1
  46. package/core/route/index.js +0 -2
  47. package/core/route/route.cjs +0 -296
  48. package/core/route/route.d.cts +0 -107
  49. package/core/route/route.d.cts.map +0 -1
  50. package/core/route/route.d.ts +0 -107
  51. package/core/route/route.d.ts.map +0 -1
  52. package/core/route/route.js +0 -291
  53. package/core/route/route.types.cjs +0 -2
  54. package/core/route/route.types.d.cts +0 -142
  55. package/core/route/route.types.d.cts.map +0 -1
  56. package/core/route/route.types.d.ts +0 -142
  57. package/core/route/route.types.d.ts.map +0 -1
  58. package/core/route/route.types.js +0 -1
  59. package/core/route-group/index.cjs +0 -18
  60. package/core/route-group/index.d.cts +0 -3
  61. package/core/route-group/index.d.cts.map +0 -1
  62. package/core/route-group/index.d.ts +0 -3
  63. package/core/route-group/index.d.ts.map +0 -1
  64. package/core/route-group/index.js +0 -2
  65. package/core/route-group/route-group.cjs +0 -67
  66. package/core/route-group/route-group.d.cts +0 -31
  67. package/core/route-group/route-group.d.cts.map +0 -1
  68. package/core/route-group/route-group.d.ts +0 -31
  69. package/core/route-group/route-group.d.ts.map +0 -1
  70. package/core/route-group/route-group.js +0 -62
  71. package/core/route-group/route-group.types.cjs +0 -2
  72. package/core/route-group/route-group.types.d.cts +0 -15
  73. package/core/route-group/route-group.types.d.cts.map +0 -1
  74. package/core/route-group/route-group.types.d.ts +0 -15
  75. package/core/route-group/route-group.types.d.ts.map +0 -1
  76. package/core/route-group/route-group.types.js +0 -1
  77. package/core/router/index.cjs +0 -18
  78. package/core/router/index.d.cts +0 -3
  79. package/core/router/index.d.cts.map +0 -1
  80. package/core/router/index.d.ts +0 -3
  81. package/core/router/index.d.ts.map +0 -1
  82. package/core/router/index.js +0 -2
  83. package/core/router/router.cjs +0 -42
  84. package/core/router/router.d.cts +0 -18
  85. package/core/router/router.d.cts.map +0 -1
  86. package/core/router/router.d.ts +0 -18
  87. package/core/router/router.d.ts.map +0 -1
  88. package/core/router/router.js +0 -37
  89. package/core/router/router.types.cjs +0 -2
  90. package/core/router/router.types.d.cts +0 -13
  91. package/core/router/router.types.d.cts.map +0 -1
  92. package/core/router/router.types.d.ts +0 -13
  93. package/core/router/router.types.d.ts.map +0 -1
  94. package/core/router/router.types.js +0 -1
  95. package/core/utils/is-route-entity.cjs +0 -5
  96. package/core/utils/is-route-entity.d.cts +0 -3
  97. package/core/utils/is-route-entity.d.cts.map +0 -1
  98. package/core/utils/is-route-entity.d.ts +0 -3
  99. package/core/utils/is-route-entity.d.ts.map +0 -1
  100. package/core/utils/is-route-entity.js +0 -1
  101. package/core/virtual-route/index.cjs +0 -18
  102. package/core/virtual-route/index.d.cts +0 -3
  103. package/core/virtual-route/index.d.cts.map +0 -1
  104. package/core/virtual-route/index.d.ts +0 -3
  105. package/core/virtual-route/index.d.ts.map +0 -1
  106. package/core/virtual-route/index.js +0 -2
  107. package/core/virtual-route/virtual-route.cjs +0 -133
  108. package/core/virtual-route/virtual-route.d.cts +0 -39
  109. package/core/virtual-route/virtual-route.d.cts.map +0 -1
  110. package/core/virtual-route/virtual-route.d.ts +0 -39
  111. package/core/virtual-route/virtual-route.d.ts.map +0 -1
  112. package/core/virtual-route/virtual-route.js +0 -128
  113. package/core/virtual-route/virtual-route.types.cjs +0 -2
  114. package/core/virtual-route/virtual-route.types.d.cts +0 -61
  115. package/core/virtual-route/virtual-route.types.d.cts.map +0 -1
  116. package/core/virtual-route/virtual-route.types.d.ts +0 -61
  117. package/core/virtual-route/virtual-route.types.d.ts.map +0 -1
  118. package/core/virtual-route/virtual-route.types.js +0 -1
  119. package/index.d.cts +0 -3
  120. package/index.d.cts.map +0 -1
  121. package/index.d.ts.map +0 -1
  122. package/react/components/index.cjs +0 -21
  123. package/react/components/index.d.cts +0 -4
  124. package/react/components/index.d.cts.map +0 -1
  125. package/react/components/index.d.ts +0 -4
  126. package/react/components/index.d.ts.map +0 -1
  127. package/react/components/index.js +0 -5
  128. package/react/components/link.cjs +0 -79
  129. package/react/components/link.d.cts +0 -23
  130. package/react/components/link.d.cts.map +0 -1
  131. package/react/components/link.d.ts +0 -23
  132. package/react/components/link.d.ts.map +0 -1
  133. package/react/components/link.js +0 -76
  134. package/react/components/route-view-group.cjs +0 -57
  135. package/react/components/route-view-group.d.cts +0 -26
  136. package/react/components/route-view-group.d.cts.map +0 -1
  137. package/react/components/route-view-group.d.ts +0 -26
  138. package/react/components/route-view-group.d.ts.map +0 -1
  139. package/react/components/route-view-group.js +0 -54
  140. package/react/components/route-view.cjs +0 -43
  141. package/react/components/route-view.d.cts +0 -25
  142. package/react/components/route-view.d.cts.map +0 -1
  143. package/react/components/route-view.d.ts +0 -25
  144. package/react/components/route-view.d.ts.map +0 -1
  145. package/react/components/route-view.js +0 -40
  146. package/react/index.cjs +0 -17
  147. package/react/index.d.cts +0 -2
  148. package/react/index.d.cts.map +0 -1
  149. package/react/index.d.ts +0 -2
  150. package/react/index.d.ts.map +0 -1
  151. package/react/index.js +0 -1
  152. package/view-model/index.cjs +0 -17
  153. package/view-model/index.d.cts +0 -2
  154. package/view-model/index.d.cts.map +0 -1
  155. package/view-model/index.d.ts +0 -2
  156. package/view-model/index.d.ts.map +0 -1
  157. package/view-model/index.js +0 -1
  158. package/view-model/route-view-model.cjs +0 -37
  159. package/view-model/route-view-model.d.cts +0 -13
  160. package/view-model/route-view-model.d.cts.map +0 -1
  161. package/view-model/route-view-model.d.ts +0 -13
  162. package/view-model/route-view-model.d.ts.map +0 -1
  163. package/view-model/route-view-model.js +0 -33
package/index.d.ts CHANGED
@@ -1,3 +1,421 @@
1
+ import { IQueryParams, RawQueryParamsData, History } from 'mobx-location-history';
1
2
  export * from 'mobx-location-history';
2
- export * from "./core/index.js";
3
- //# sourceMappingURL=index.d.ts.map
3
+ import { ParseOptions, MatchOptions, ParamData, TokenData } from 'path-to-regexp';
4
+ import { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/types';
5
+
6
+ type AnyVirtualRoute = VirtualRoute<any> | AbstractVirtualRoute<any>;
7
+ interface VirtualOpenExtraParams extends Omit<RouteNavigateParams, 'state' | 'mergeQuery'> {
8
+ }
9
+ interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> {
10
+ isOpened: boolean;
11
+ params: TParams | null;
12
+ /**
13
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open-params-extraparams-query-replace-promise-void)
14
+ */
15
+ open(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams] : [params: TParams, extraParams?: VirtualOpenExtraParams]): Promise<void>;
16
+ }
17
+ interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject> {
18
+ /**
19
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#abortsignal)
20
+ */
21
+ abortSignal?: AbortSignal;
22
+ queryParams?: IQueryParams;
23
+ /**
24
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#initialparams)
25
+ */
26
+ initialParams?: MaybeFn<Maybe<TParams>, [
27
+ route: VirtualRoute<NoInfer<TParams>>
28
+ ]>;
29
+ /**
30
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#meta)
31
+ */
32
+ meta?: AnyObject;
33
+ /**
34
+ * Custom implementation of open behaviour for this route
35
+ *
36
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
37
+ */
38
+ open?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<boolean | void>;
39
+ /**
40
+ * Custom implementation of close behaviour for this route
41
+ *
42
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)
43
+ */
44
+ close?: (route: VirtualRoute<TParams>) => boolean | void;
45
+ /**
46
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#checkopened)
47
+ */
48
+ checkOpened?: (route: VirtualRoute<TParams>) => boolean;
49
+ /**
50
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#beforeopen)
51
+ */
52
+ beforeOpen?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<void | boolean>;
53
+ /**
54
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afterclose)
55
+ */
56
+ afterClose?: () => void;
57
+ /**
58
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afteropen)
59
+ */
60
+ afterOpen?: (params: NoInfer<TParams>, route: VirtualRoute<NoInfer<TParams>>) => void;
61
+ }
62
+
63
+ /**
64
+ * Class for creating routes with custom activation logic
65
+ *
66
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)
67
+ */
68
+ declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> implements AbstractVirtualRoute<TParams> {
69
+ protected config: VirtualRouteConfiguration<TParams>;
70
+ protected abortController: AbortController;
71
+ query: IQueryParams;
72
+ params: TParams | null;
73
+ private isLocalOpened;
74
+ private openChecker;
75
+ private reactionDisposer;
76
+ constructor(config?: VirtualRouteConfiguration<TParams>);
77
+ /**
78
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened-boolean)
79
+ */
80
+ get isOpened(): boolean;
81
+ /**
82
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker-openchecker-void)
83
+ */
84
+ setOpenChecker(openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>): void;
85
+ /**
86
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open-params-extraparams-query-replace-promise-void)
87
+ */
88
+ open(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams] : [params: TParams, extraParams?: VirtualOpenExtraParams]): Promise<void>;
89
+ /**
90
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close-void)
91
+ */
92
+ close(): void;
93
+ private firstOpenedStateCheck;
94
+ private processOpenedState;
95
+ destroy(): void;
96
+ }
97
+ declare const createVirtualRoute: <TParams extends AnyObject | EmptyObject = EmptyObject>(config?: VirtualRouteConfiguration<TParams>) => VirtualRoute<TParams>;
98
+
99
+ type AnyRouteGroup = RouteGroup<RoutesCollection>;
100
+ type AnyRouteEntity = AnyRoute | AnyRouteGroup | AnyVirtualRoute;
101
+ interface AbstractRouteGroup<TRoutesCollection extends RoutesCollection = RoutesCollection> {
102
+ routes: TRoutesCollection;
103
+ isOpened: boolean;
104
+ }
105
+ type AnyAbstractRoute = AnyRoute | AbstractVirtualRoute<any>;
106
+ type AnyAbstractRouteEntity = AnyAbstractRoute | AbstractRouteGroup;
107
+ type RoutesArrayCollection = AnyAbstractRouteEntity[];
108
+ type RoutesObjectCollection = Record<string, AnyAbstractRouteEntity>;
109
+ type RoutesCollection = RoutesArrayCollection | RoutesObjectCollection;
110
+
111
+ /**
112
+ * Class for grouping related routes and managing their state.
113
+ *
114
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/RouteGroup.html)
115
+ */
116
+ declare class RouteGroup<TRoutesCollection extends RoutesCollection> implements AbstractRouteGroup<TRoutesCollection> {
117
+ private _indexRoute?;
118
+ routes: TRoutesCollection;
119
+ constructor(routes: TRoutesCollection, _indexRoute?: AnyRouteEntity | undefined);
120
+ /**
121
+ * Returns true if at least one route in the group is open.
122
+ *
123
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/RouteGroup.html#isopened-boolean)
124
+ */
125
+ get isOpened(): boolean;
126
+ /**
127
+ * First found index route.
128
+ *
129
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/RouteGroup.html#indexroute-route-undefined)
130
+ */
131
+ get indexRoute(): AnyRouteEntity | undefined;
132
+ /**
133
+ * Main navigation method for the group.
134
+ *
135
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/RouteGroup.html#open-args-any-void)
136
+ */
137
+ open(...args: any[]): void;
138
+ }
139
+ declare const createRouteGroup: <TRoutesCollection extends RoutesCollection>(routes: TRoutesCollection, indexRoute?: AnyRouteEntity) => RouteGroup<TRoutesCollection>;
140
+
141
+ type PreparedNavigationData<TParams extends AnyObject = AnyObject> = {
142
+ state?: any;
143
+ /**
144
+ * path parameters
145
+ *
146
+ * can be received from extended routes
147
+ */
148
+ params?: TParams;
149
+ url: string;
150
+ replace?: boolean;
151
+ query?: AnyObject;
152
+ };
153
+ /**
154
+ * Returning `false` means ignore navigation
155
+ */
156
+ type BeforeOpenFeedback = void | boolean | {
157
+ url: string;
158
+ state?: any;
159
+ replace?: boolean;
160
+ };
161
+ interface UrlCreateParams<TInputParams> {
162
+ baseUrl?: string | undefined;
163
+ params: TInputParams;
164
+ query: AnyObject;
165
+ }
166
+ type UrlCreateParamsFn<TInputParams = any> = (params: UrlCreateParams<TInputParams>, currentQueryData: RawQueryParamsData) => Maybe<UrlCreateParams<TInputParams>>;
167
+ interface CreatedUrlOutputParams {
168
+ mergeQuery?: boolean;
169
+ omitQuery?: boolean;
170
+ }
171
+ interface RouteConfiguration<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<string, any, any, any> | null = null> extends Omit<Partial<RouteGlobalConfig>, 'createUrl'> {
172
+ /**
173
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#abortsignal)
174
+ */
175
+ abortSignal?: AbortSignal;
176
+ index?: boolean;
177
+ hash?: boolean;
178
+ /**
179
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#meta)
180
+ */
181
+ meta?: AnyObject;
182
+ parseOptions?: ParseOptions;
183
+ matchOptions?: MatchOptions & ParseOptions;
184
+ parent?: TParentRoute;
185
+ children?: AnyRoute[];
186
+ /**
187
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params)
188
+ */
189
+ params?: (params: ParsedPathParams<TPath>, meta: AnyObject | undefined) => TOutputParams | null | false;
190
+ /**
191
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#checkopened)
192
+ */
193
+ checkOpened?: (parsedPathData: ParsedPathData<NoInfer<TPath>>) => boolean;
194
+ /**
195
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#beforeopen)
196
+ */
197
+ beforeOpen?: (preparedNavigationData: PreparedNavigationData<NoInfer<TInputParams>>) => MaybePromise<BeforeOpenFeedback>;
198
+ /**
199
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afterclose)
200
+ */
201
+ afterClose?: () => void;
202
+ /**
203
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afteropen)
204
+ */
205
+ afterOpen?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>>) => void;
206
+ /**
207
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)
208
+ */
209
+ createUrl?: UrlCreateParamsFn<TInputParams>;
210
+ }
211
+ type AnyRoute = IRoute;
212
+ interface IRoute<TPath extends string = string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>> {
213
+ isOpened: boolean;
214
+ path: TPath;
215
+ /**
216
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren-boolean)
217
+ */
218
+ hasOpenedChildren: boolean;
219
+ /**
220
+ * Navigates to this route.
221
+ *
222
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open-args)
223
+ */
224
+ open(...args: IsPartial<TInputParams> extends true ? [
225
+ params?: TInputParams | null | undefined,
226
+ navigateParams?: RouteNavigateParams
227
+ ] : [params: TInputParams, navigateParams?: RouteNavigateParams]): Promise<void>;
228
+ open(...args: IsPartial<TInputParams> extends true ? [
229
+ params?: TInputParams | null | undefined,
230
+ replace?: RouteNavigateParams['replace'],
231
+ query?: RouteNavigateParams['query']
232
+ ] : [
233
+ params: TInputParams,
234
+ replace?: RouteNavigateParams['replace'],
235
+ query?: RouteNavigateParams['query']
236
+ ]): Promise<void>;
237
+ open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
238
+ open(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
239
+ createUrl(...args: IsPartial<TInputParams> extends true ? [params?: Maybe<TInputParams>, query?: AnyObject, mergeQuery?: boolean] : [params: TInputParams, query?: AnyObject, mergeQuery?: boolean]): string;
240
+ destroy(): void;
241
+ readonly params: TOutputParams | null;
242
+ }
243
+ type InputPathParam = string | number | boolean | null;
244
+ type ParsedPathParam = string;
245
+ type Simplify<T> = T extends infer U ? {
246
+ [K in keyof U]: U[K];
247
+ } : never;
248
+ type RouteParams<TRoute extends AnyAbstractRouteEntity> = TRoute extends {
249
+ path: string;
250
+ } ? ParsedPathParams<TRoute['path']> : TRoute extends {
251
+ params: infer TParams;
252
+ } ? Exclude<TParams, null> : AnyObject;
253
+ type PathToObject<Path extends string, PropertyValue = string> = Simplify<Path extends `${infer Prefix}{${infer Optional}}${infer Suffix}` ? PathToObject<`${Prefix}${Suffix}`, PropertyValue> & Partial<PathToObject<Optional, PropertyValue>> : Path extends `${infer PartA}/${infer PartB}` ? PathToObject<PartA, PropertyValue> & PathToObject<PartB, PropertyValue> : Path extends `:${infer Param}?` ? {
254
+ [K in Param]?: PropertyValue;
255
+ } : Path extends `:${infer Param}` ? {
256
+ [K in Param]: PropertyValue;
257
+ } : Path extends `*${infer Wildcard}` ? {
258
+ [K in Wildcard]: PropertyValue[];
259
+ } : {}>;
260
+ type ParsedPathParams<Path extends string> = PathToObject<Path, ParsedPathParam>;
261
+ type InputPathParams<Path extends string> = PathToObject<Path, InputPathParam>;
262
+ interface RouteNavigateParams {
263
+ replace?: boolean;
264
+ state?: any;
265
+ query?: AnyObject;
266
+ mergeQuery?: boolean;
267
+ }
268
+ interface ParsedPathData<TPath extends string> {
269
+ path: string;
270
+ params: ParsedPathParams<TPath>;
271
+ }
272
+ type InferPath<T extends AnyRoute> = T extends IRoute<infer TPath, any, any> ? TPath : never;
273
+ type InferInputParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends IRoute<any, infer TInputParams, any> ? TInputParams : never;
274
+ type InferParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends IRoute<any, any, infer TParams> ? TParams : never;
275
+
276
+ /**
277
+ * Class for creating path based route.
278
+ *
279
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)
280
+ */
281
+ declare class Route<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<any, any, any, any> | null = null> implements IRoute<TPath, TInputParams, TOutputParams> {
282
+ path: TPath;
283
+ protected config: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>;
284
+ protected abortController: AbortController;
285
+ protected history: History;
286
+ parent: TParentRoute;
287
+ query: IQueryParams;
288
+ private _tokenData;
289
+ private _matcher?;
290
+ private _compiler?;
291
+ private reactionDisposer;
292
+ meta?: AnyObject;
293
+ /**
294
+ * Indicates if this route is an index route. Index routes activate when parent route path matches exactly.
295
+ *
296
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isindex-boolean)
297
+ */
298
+ isIndex: boolean;
299
+ /**
300
+ * Indicates if this route is an hash route.
301
+ *
302
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#ishash-boolean)
303
+ */
304
+ isHash: boolean;
305
+ children: AnyRoute[];
306
+ constructor(path: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>);
307
+ protected get baseUrl(): string | undefined;
308
+ protected get parsedPathData(): ParsedPathData<TPath> | null;
309
+ /**
310
+ * Matched path segment for current URL.
311
+ *
312
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#currentpath-parsedpathname-null)
313
+ */
314
+ get currentPath(): string | null;
315
+ /**
316
+ * Current parsed path parameters.
317
+ *
318
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params-parsedpathparams-null)
319
+ */
320
+ get params(): TOutputParams | null;
321
+ /**
322
+ * Defines the "open" state for this route.
323
+ *
324
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopened-boolean)
325
+ */
326
+ get isOpened(): boolean;
327
+ /**
328
+ * Allows to create child route based on this route with merging this route path and extending path.
329
+ *
330
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend-path-config-route)
331
+ */
332
+ extend<TExtendedPath extends string, TExtendedInputParams extends InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>, TExtendedOutputParams extends AnyObject = TInputParams & ParsedPathParams<`${TPath}${TExtendedPath}`>>(path: TExtendedPath, config?: Omit<RouteConfiguration<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, any>, 'parent'>): Route<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, this>;
333
+ addChildren(...routes: AnyRoute[]): void;
334
+ removeChildren(...routes: AnyRoute[]): void;
335
+ /**
336
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren-boolean)
337
+ */
338
+ get hasOpenedChildren(): boolean;
339
+ protected processParams(params?: TInputParams | null | undefined): ParamData | undefined;
340
+ createUrl(...args: IsPartial<TInputParams> extends true ? [
341
+ params?: Maybe<TInputParams>,
342
+ query?: Maybe<AnyObject>,
343
+ mergeQueryOrParams?: boolean | CreatedUrlOutputParams
344
+ ] : [
345
+ params: TInputParams,
346
+ query?: Maybe<AnyObject>,
347
+ mergeQueryOrParams?: boolean | CreatedUrlOutputParams
348
+ ]): string;
349
+ /**
350
+ * Navigates to this route.
351
+ *
352
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open-args)
353
+ */
354
+ open(...args: IsPartial<TInputParams> extends true ? [
355
+ params?: TInputParams | null | undefined,
356
+ navigateParams?: RouteNavigateParams
357
+ ] : [params: TInputParams, navigateParams?: RouteNavigateParams]): Promise<void>;
358
+ open(...args: IsPartial<TInputParams> extends true ? [
359
+ params?: TInputParams | null | undefined,
360
+ replace?: RouteNavigateParams['replace'],
361
+ query?: RouteNavigateParams['query']
362
+ ] : [
363
+ params: TInputParams,
364
+ replace?: RouteNavigateParams['replace'],
365
+ query?: RouteNavigateParams['query']
366
+ ]): Promise<void>;
367
+ open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
368
+ open(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
369
+ protected beforeOpen(openData: PreparedNavigationData<TInputParams>): MaybePromise<BeforeOpenFeedback>;
370
+ protected afterClose(): true | void;
371
+ protected get tokenData(): TokenData;
372
+ private firstOpenedStateCheck;
373
+ private processOpenedState;
374
+ private get isAbleToMergeQuery();
375
+ destroy(): void;
376
+ }
377
+ declare const createRoute: <TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<any, any, any, any> | null = null>(path: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>) => Route<TPath, TInputParams, TOutputParams, TParentRoute>;
378
+
379
+ interface RouteGlobalConfig {
380
+ history: History;
381
+ queryParams: IQueryParams;
382
+ baseUrl?: string;
383
+ mergeQuery?: boolean;
384
+ createUrl?: UrlCreateParamsFn;
385
+ formatLinkHref?: (href: string) => string;
386
+ }
387
+
388
+ declare const routeConfig: {
389
+ get: () => RouteGlobalConfig;
390
+ set: (value: RouteGlobalConfig | null | undefined) => RouteGlobalConfig | null | undefined;
391
+ update: (value: Partial<RouteGlobalConfig>) => void;
392
+ };
393
+
394
+ interface RouterConfiguration<TRoutesStruct extends RoutesCollection> {
395
+ routes: TRoutesStruct;
396
+ history?: History;
397
+ queryParams?: IQueryParams;
398
+ }
399
+ interface RouterNavigateOptions extends RouteNavigateParams {
400
+ }
401
+ type AnyRouter = Router<RoutesCollection>;
402
+
403
+ /**
404
+ * Class for centralized routing management.
405
+ *
406
+ * [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)
407
+ */
408
+ declare class Router<TRoutesCollection extends RoutesCollection> {
409
+ routes: TRoutesCollection;
410
+ history: History;
411
+ query: IQueryParams;
412
+ constructor(config: RouterConfiguration<TRoutesCollection>);
413
+ get location(): any;
414
+ navigate(url: string, options?: RouterNavigateOptions): void;
415
+ }
416
+ declare const createRouter: <TRoutesCollection extends RoutesCollection>(config: RouterConfiguration<TRoutesCollection>) => Router<TRoutesCollection>;
417
+
418
+ declare const isRouteEntity: (route: any) => route is AnyRouteEntity;
419
+
420
+ export { Route, RouteGroup, Router, VirtualRoute, createRoute, createRouteGroup, createRouter, createVirtualRoute, isRouteEntity, routeConfig };
421
+ export type { AbstractRouteGroup, AbstractVirtualRoute, AnyAbstractRoute, AnyAbstractRouteEntity, AnyRoute, AnyRouteEntity, AnyRouteGroup, AnyRouter, AnyVirtualRoute, BeforeOpenFeedback, CreatedUrlOutputParams, IRoute, InferInputParams, InferParams, InferPath, InputPathParam, InputPathParams, ParsedPathData, ParsedPathParam, ParsedPathParams, PathToObject, PreparedNavigationData, RouteConfiguration, RouteGlobalConfig, RouteNavigateParams, RouteParams, RouterConfiguration, RouterNavigateOptions, RoutesArrayCollection, RoutesCollection, RoutesObjectCollection, UrlCreateParams, UrlCreateParamsFn, VirtualOpenExtraParams, VirtualRouteConfiguration };