mobx-route 1.3.2 → 1.3.4
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/index.cjs +1 -1
- package/index.d.ts +63 -64
- package/index.js +1 -1
- package/package.json +7 -7
- package/view-model.cjs +1 -1
- package/view-model.d.ts +42 -47
- package/view-model.js +1 -1
- package/{virtual-route-BKBYuOMt.cjs → virtual-route-B_X_wClE.cjs} +30 -47
- package/virtual-route-B_X_wClE.cjs.map +1 -0
- package/{virtual-route-CqADneBu.js → virtual-route-C7NPJx5y.js} +30 -47
- package/virtual-route-C7NPJx5y.js.map +1 -0
- package/virtual-route-BKBYuOMt.cjs.map +0 -1
- package/virtual-route-CqADneBu.js.map +0 -1
package/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const mobxLocationHistory = require("mobx-location-history");
|
|
4
|
-
const virtualRoute = require("./virtual-route-
|
|
4
|
+
const virtualRoute = require("./virtual-route-B_X_wClE.cjs");
|
|
5
5
|
const isRouteEntity = (route) => route && "isOpened" in route;
|
|
6
6
|
exports.Route = virtualRoute.Route;
|
|
7
7
|
exports.RouteGroup = virtualRoute.RouteGroup;
|
package/index.d.ts
CHANGED
|
@@ -4,24 +4,27 @@ import * as yummies_complex from 'yummies/complex';
|
|
|
4
4
|
import { ParseOptions, MatchOptions, ParamData, TokenData } from 'path-to-regexp';
|
|
5
5
|
import { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/types';
|
|
6
6
|
|
|
7
|
-
type AnyVirtualRoute = VirtualRoute<any> | AbstractVirtualRoute<any>;
|
|
8
|
-
interface VirtualOpenExtraParams extends Omit<RouteNavigateParams
|
|
7
|
+
type AnyVirtualRoute = VirtualRoute<any, any> | AbstractVirtualRoute<any, any>;
|
|
8
|
+
interface VirtualOpenExtraParams<TQueryParams extends Record<string, any> = AnyObject> extends Omit<RouteNavigateParams<TQueryParams>, 'state' | 'mergeQuery'> {
|
|
9
9
|
}
|
|
10
|
-
interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
10
|
+
interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject, TQueryParams extends Record<string, any> = AnyObject> {
|
|
11
11
|
isOpened: boolean;
|
|
12
12
|
isOpening: boolean;
|
|
13
13
|
params: TParams | null;
|
|
14
14
|
/**
|
|
15
15
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
16
16
|
*/
|
|
17
|
-
open(...args: IsPartial<TParams> extends true ? [
|
|
17
|
+
open(...args: IsPartial<TParams> extends true ? [
|
|
18
|
+
params?: Maybe<TParams>,
|
|
19
|
+
extraParams?: VirtualOpenExtraParams<TQueryParams>
|
|
20
|
+
] : [params: TParams, extraParams?: VirtualOpenExtraParams<TQueryParams>]): Promise<void>;
|
|
18
21
|
}
|
|
19
|
-
interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
22
|
+
interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject, TQueryParams extends Record<string, any> = AnyObject> {
|
|
20
23
|
/**
|
|
21
24
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#abortsignal)
|
|
22
25
|
*/
|
|
23
26
|
abortSignal?: AbortSignal;
|
|
24
|
-
queryParams?: IQueryParams
|
|
27
|
+
queryParams?: IQueryParams<TQueryParams>;
|
|
25
28
|
/**
|
|
26
29
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#initialparams)
|
|
27
30
|
*/
|
|
@@ -73,9 +76,9 @@ interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = Em
|
|
|
73
76
|
*/
|
|
74
77
|
afterUpdate?: (params: NoInfer<TParams | null>, route: VirtualRoute<NoInfer<TParams>>) => void;
|
|
75
78
|
}
|
|
76
|
-
interface VirtualRouteTrx {
|
|
79
|
+
interface VirtualRouteTrx<TQueryParams extends Record<string, any> = AnyObject> {
|
|
77
80
|
params: any;
|
|
78
|
-
extra?: Maybe<VirtualOpenExtraParams
|
|
81
|
+
extra?: Maybe<VirtualOpenExtraParams<TQueryParams>>;
|
|
79
82
|
manual?: boolean;
|
|
80
83
|
}
|
|
81
84
|
|
|
@@ -84,11 +87,11 @@ interface VirtualRouteTrx {
|
|
|
84
87
|
*
|
|
85
88
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)
|
|
86
89
|
*/
|
|
87
|
-
declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> implements AbstractVirtualRoute<TParams> {
|
|
88
|
-
protected config: VirtualRouteConfiguration<TParams>;
|
|
90
|
+
declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject, TQueryParams extends Record<string, any> = AnyObject> implements AbstractVirtualRoute<TParams, TQueryParams> {
|
|
91
|
+
protected config: VirtualRouteConfiguration<TParams, TQueryParams>;
|
|
89
92
|
private isDestroyed?;
|
|
90
93
|
private disposer?;
|
|
91
|
-
query: IQueryParams
|
|
94
|
+
query: IQueryParams<TQueryParams>;
|
|
92
95
|
params: TParams | null;
|
|
93
96
|
protected status: 'opening' | 'open-rejected' | 'opened' | 'closing' | 'closed' | 'unknown';
|
|
94
97
|
private openChecker;
|
|
@@ -100,7 +103,7 @@ declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject
|
|
|
100
103
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isouteropened)
|
|
101
104
|
*/
|
|
102
105
|
isOuterOpened: boolean | undefined;
|
|
103
|
-
constructor(config?: VirtualRouteConfiguration<TParams>);
|
|
106
|
+
constructor(config?: VirtualRouteConfiguration<TParams, TQueryParams>);
|
|
104
107
|
/**
|
|
105
108
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened)
|
|
106
109
|
*/
|
|
@@ -120,7 +123,10 @@ declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject
|
|
|
120
123
|
/**
|
|
121
124
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
122
125
|
*/
|
|
123
|
-
open(...args: IsPartial<TParams> extends true ? [
|
|
126
|
+
open(...args: IsPartial<TParams> extends true ? [
|
|
127
|
+
params?: Maybe<TParams>,
|
|
128
|
+
extraParams?: VirtualOpenExtraParams<TQueryParams>
|
|
129
|
+
] : [params: TParams, extraParams?: VirtualOpenExtraParams<TQueryParams>]): Promise<void>;
|
|
124
130
|
/**
|
|
125
131
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)
|
|
126
132
|
*/
|
|
@@ -129,7 +135,7 @@ declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject
|
|
|
129
135
|
private confirmClosing;
|
|
130
136
|
destroy(): void;
|
|
131
137
|
}
|
|
132
|
-
declare const createVirtualRoute: <TParams extends AnyObject | EmptyObject = EmptyObject>(config?: VirtualRouteConfiguration<TParams>) => VirtualRoute<TParams>;
|
|
138
|
+
declare const createVirtualRoute: <TParams extends AnyObject | EmptyObject = EmptyObject, TQueryParams extends Record<string, any> = AnyObject>(config?: VirtualRouteConfiguration<TParams, TQueryParams>) => VirtualRoute<TParams, TQueryParams>;
|
|
133
139
|
|
|
134
140
|
/**
|
|
135
141
|
* Class for grouping related routes and managing their state.
|
|
@@ -185,7 +191,7 @@ type RoutesArrayCollection = AnyAbstractRouteEntity[];
|
|
|
185
191
|
type RoutesObjectCollection = Record<string, AnyAbstractRouteEntity>;
|
|
186
192
|
type RoutesCollection = RoutesArrayCollection | RoutesObjectCollection;
|
|
187
193
|
|
|
188
|
-
type NavigationTrx<TParams extends AnyObject = AnyObject> = {
|
|
194
|
+
type NavigationTrx<TParams extends AnyObject = AnyObject, TQueryParams extends Record<string, any> = AnyObject> = {
|
|
189
195
|
state?: any;
|
|
190
196
|
/**
|
|
191
197
|
* path parameters
|
|
@@ -195,19 +201,19 @@ type NavigationTrx<TParams extends AnyObject = AnyObject> = {
|
|
|
195
201
|
params?: TParams;
|
|
196
202
|
url: string;
|
|
197
203
|
replace?: boolean;
|
|
198
|
-
query?:
|
|
204
|
+
query?: Partial<TQueryParams>;
|
|
199
205
|
preferSkipHistoryUpdate?: boolean;
|
|
200
206
|
};
|
|
201
207
|
/**
|
|
202
208
|
* Returning `false` means ignore navigation
|
|
203
209
|
*/
|
|
204
210
|
type BeforeOpenFeedback = void | boolean | Pick<NavigationTrx, 'url' | 'state' | 'replace'>;
|
|
205
|
-
interface UrlCreateParams<TInputParams> {
|
|
211
|
+
interface UrlCreateParams<TInputParams, TQueryParams extends Record<string, any> = AnyObject> {
|
|
206
212
|
baseUrl?: string | undefined;
|
|
207
213
|
params: TInputParams;
|
|
208
|
-
query:
|
|
214
|
+
query: Partial<TQueryParams>;
|
|
209
215
|
}
|
|
210
|
-
type UrlCreateParamsFn<TInputParams = any> = (params: UrlCreateParams<TInputParams>, currentQueryData: RawQueryParamsData) => Maybe<UrlCreateParams<TInputParams>>;
|
|
216
|
+
type UrlCreateParamsFn<TInputParams = any, TQueryParams extends Record<string, any> = AnyObject> = (params: UrlCreateParams<TInputParams, TQueryParams>, currentQueryData: RawQueryParamsData) => Maybe<UrlCreateParams<TInputParams, TQueryParams>>;
|
|
211
217
|
/**
|
|
212
218
|
* Output options for `createUrl()` (third argument).
|
|
213
219
|
* @see [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)
|
|
@@ -218,7 +224,7 @@ interface CreatedUrlOutputParams {
|
|
|
218
224
|
/** @see [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl) */
|
|
219
225
|
omitQuery?: boolean;
|
|
220
226
|
}
|
|
221
|
-
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'> {
|
|
227
|
+
interface RouteConfiguration<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<string, any, any, any, any> | null = null, TQueryParams extends Record<string, any> = AnyObject> extends Omit<Partial<RouteGlobalConfig>, 'createUrl'> {
|
|
222
228
|
/**
|
|
223
229
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#abortsignal)
|
|
224
230
|
*/
|
|
@@ -249,7 +255,7 @@ interface RouteConfiguration<TPath extends string, TInputParams extends InputPat
|
|
|
249
255
|
/**
|
|
250
256
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#beforeopen)
|
|
251
257
|
*/
|
|
252
|
-
beforeOpen?: (navigationTransaction: NavigationTrx<NoInfer<TInputParams>>) => MaybePromise<BeforeOpenFeedback>;
|
|
258
|
+
beforeOpen?: (navigationTransaction: NavigationTrx<NoInfer<TInputParams>, NoInfer<TQueryParams>>) => MaybePromise<BeforeOpenFeedback>;
|
|
253
259
|
/**
|
|
254
260
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afterclose)
|
|
255
261
|
*/
|
|
@@ -257,17 +263,17 @@ interface RouteConfiguration<TPath extends string, TInputParams extends InputPat
|
|
|
257
263
|
/**
|
|
258
264
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afteropen)
|
|
259
265
|
*/
|
|
260
|
-
afterOpen?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>>) => void;
|
|
266
|
+
afterOpen?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>, NoInfer<TQueryParams>>) => void;
|
|
261
267
|
/**
|
|
262
268
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afterupdate)
|
|
263
269
|
*/
|
|
264
|
-
afterUpdate?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>>) => void;
|
|
270
|
+
afterUpdate?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>, NoInfer<TQueryParams>>) => void;
|
|
265
271
|
/**
|
|
266
272
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)
|
|
267
273
|
*/
|
|
268
|
-
createUrl?: UrlCreateParamsFn<TInputParams>;
|
|
274
|
+
createUrl?: UrlCreateParamsFn<TInputParams, TQueryParams>;
|
|
269
275
|
}
|
|
270
|
-
type AnyRoute = Route<any, any, any, any>;
|
|
276
|
+
type AnyRoute = Route<any, any, any, any, any>;
|
|
271
277
|
type InputPathParam = string | number | boolean | null;
|
|
272
278
|
type ParsedPathParam = string;
|
|
273
279
|
type Simplify<T> = T extends infer U ? {
|
|
@@ -287,27 +293,28 @@ type PathToObject<Path extends string, PropertyValue = string> = Simplify<Path e
|
|
|
287
293
|
} : {}>;
|
|
288
294
|
type ParsedPathParams<Path extends string> = PathToObject<Path, ParsedPathParam>;
|
|
289
295
|
type InputPathParams<Path extends string> = PathToObject<Path, InputPathParam>;
|
|
290
|
-
interface RouteNavigateParams {
|
|
296
|
+
interface RouteNavigateParams<TQueryParams extends Record<string, any> = AnyObject> {
|
|
291
297
|
replace?: boolean;
|
|
292
298
|
state?: any;
|
|
293
|
-
query?:
|
|
299
|
+
query?: Partial<TQueryParams>;
|
|
294
300
|
mergeQuery?: boolean;
|
|
295
301
|
}
|
|
296
302
|
interface ParsedPathData<TPath extends string> {
|
|
297
303
|
path: string;
|
|
298
304
|
params: ParsedPathParams<TPath>;
|
|
299
305
|
}
|
|
300
|
-
type InferPath<T extends AnyRoute> = T extends Route<infer TPath, any, any, any> ? TPath : never;
|
|
301
|
-
type InferInputParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends Route<any, infer TInputParams, any, any> ? TInputParams : never;
|
|
302
|
-
type InferParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends Route<any, any, infer TParams, any> ? TParams : never;
|
|
306
|
+
type InferPath<T extends AnyRoute> = T extends Route<infer TPath, any, any, any, any> ? TPath : never;
|
|
307
|
+
type InferInputParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends Route<any, infer TInputParams, any, any, any> ? TInputParams : never;
|
|
308
|
+
type InferParams<T extends AnyRoute> = T extends VirtualRoute<infer TParams> ? TParams : T extends Route<any, any, infer TParams, any, any> ? TParams : never;
|
|
309
|
+
type InferQueryParams<T extends AnyRoute> = T extends Route<any, any, any, any, infer TQueryParams> ? TQueryParams : never;
|
|
303
310
|
|
|
304
311
|
/**
|
|
305
312
|
* Class for creating path based route.
|
|
306
313
|
*
|
|
307
314
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)
|
|
308
315
|
*/
|
|
309
|
-
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> {
|
|
310
|
-
protected config: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>;
|
|
316
|
+
declare class Route<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<any, any, any, any, any> | null = null, TQueryParams extends Record<string, any> = AnyObject> {
|
|
317
|
+
protected config: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>;
|
|
311
318
|
private isDestroyed?;
|
|
312
319
|
private disposer?;
|
|
313
320
|
protected history: History;
|
|
@@ -317,7 +324,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
317
324
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)
|
|
318
325
|
*/
|
|
319
326
|
parent: TParentRoute;
|
|
320
|
-
query: IQueryParams
|
|
327
|
+
query: IQueryParams<TQueryParams>;
|
|
321
328
|
private _tokenData;
|
|
322
329
|
private _matcher?;
|
|
323
330
|
private _compiler?;
|
|
@@ -350,7 +357,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
350
357
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)
|
|
351
358
|
*/
|
|
352
359
|
children: AnyRoute[];
|
|
353
|
-
constructor(pathDeclaration: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>);
|
|
360
|
+
constructor(pathDeclaration: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>);
|
|
354
361
|
protected get baseUrl(): string | undefined;
|
|
355
362
|
/**
|
|
356
363
|
* Checks whether current route matches provided path.
|
|
@@ -397,7 +404,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
397
404
|
*
|
|
398
405
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)
|
|
399
406
|
*/
|
|
400
|
-
extend<TExtendedPath extends string, TExtendedInputParams extends InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>, TExtendedOutputParams extends AnyObject = TInputParams & ParsedPathParams<`${TPath}${TExtendedPath}
|
|
407
|
+
extend<TExtendedPath extends string, TExtendedInputParams extends InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>, TExtendedOutputParams extends AnyObject = TInputParams & ParsedPathParams<`${TPath}${TExtendedPath}`>, TExtendedQueryParams extends Record<string, any> = TQueryParams>(pathDeclaration: TExtendedPath, config?: Omit<RouteConfiguration<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, any, TExtendedQueryParams>, 'parent'>): Route<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, this, TExtendedQueryParams>;
|
|
401
408
|
/**
|
|
402
409
|
* Manually add child routes.
|
|
403
410
|
*
|
|
@@ -422,11 +429,11 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
422
429
|
*/
|
|
423
430
|
createUrl(...args: IsPartial<TInputParams> extends true ? [
|
|
424
431
|
params?: Maybe<TInputParams>,
|
|
425
|
-
query?: Maybe<
|
|
432
|
+
query?: Maybe<Partial<TQueryParams>>,
|
|
426
433
|
mergeQueryOrParams?: boolean | CreatedUrlOutputParams
|
|
427
434
|
] : [
|
|
428
435
|
params: TInputParams,
|
|
429
|
-
query?: Maybe<
|
|
436
|
+
query?: Maybe<Partial<TQueryParams>>,
|
|
430
437
|
mergeQueryOrParams?: boolean | CreatedUrlOutputParams
|
|
431
438
|
]): string;
|
|
432
439
|
/**
|
|
@@ -436,19 +443,22 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
436
443
|
*/
|
|
437
444
|
open(...args: IsPartial<TInputParams> extends true ? [
|
|
438
445
|
params?: TInputParams | null | undefined,
|
|
439
|
-
navigateParams?: RouteNavigateParams
|
|
440
|
-
] : [
|
|
446
|
+
navigateParams?: RouteNavigateParams<TQueryParams>
|
|
447
|
+
] : [
|
|
448
|
+
params: TInputParams,
|
|
449
|
+
navigateParams?: RouteNavigateParams<TQueryParams>
|
|
450
|
+
]): Promise<void>;
|
|
441
451
|
open(...args: IsPartial<TInputParams> extends true ? [
|
|
442
452
|
params?: TInputParams | null | undefined,
|
|
443
|
-
replace?: RouteNavigateParams['replace'],
|
|
444
|
-
query?: RouteNavigateParams['query']
|
|
453
|
+
replace?: RouteNavigateParams<TQueryParams>['replace'],
|
|
454
|
+
query?: RouteNavigateParams<TQueryParams>['query']
|
|
445
455
|
] : [
|
|
446
456
|
params: TInputParams,
|
|
447
|
-
replace?: RouteNavigateParams['replace'],
|
|
448
|
-
query?: RouteNavigateParams['query']
|
|
457
|
+
replace?: RouteNavigateParams<TQueryParams>['replace'],
|
|
458
|
+
query?: RouteNavigateParams<TQueryParams>['query']
|
|
449
459
|
]): Promise<void>;
|
|
450
|
-
open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
451
|
-
open(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
460
|
+
open(url: string, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
461
|
+
open(url: string, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
452
462
|
/**
|
|
453
463
|
* Updates the current route if it is already open.
|
|
454
464
|
* Unlike `open`, this is a no-op if the route is not open,
|
|
@@ -457,23 +467,12 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
457
467
|
*
|
|
458
468
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)
|
|
459
469
|
*/
|
|
460
|
-
update(
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
update(...args: IsPartial<TInputParams> extends true ? [
|
|
465
|
-
params?: TInputParams | null | undefined,
|
|
466
|
-
replace?: RouteNavigateParams['replace'],
|
|
467
|
-
query?: RouteNavigateParams['query']
|
|
468
|
-
] : [
|
|
469
|
-
params: TInputParams,
|
|
470
|
-
replace?: RouteNavigateParams['replace'],
|
|
471
|
-
query?: RouteNavigateParams['query']
|
|
472
|
-
]): Promise<void>;
|
|
473
|
-
update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
474
|
-
update(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
470
|
+
update(params?: TInputParams | null | undefined, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
471
|
+
update(params?: TInputParams | null | undefined, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
472
|
+
update(url: string, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
473
|
+
update(url: string, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
475
474
|
protected get tokenData(): TokenData;
|
|
476
|
-
protected confirmOpening(trx: NavigationTrx<TInputParams>): Promise<true | undefined>;
|
|
475
|
+
protected confirmOpening(trx: NavigationTrx<TInputParams, TQueryParams>): Promise<true | undefined>;
|
|
477
476
|
protected confirmClosing(): boolean;
|
|
478
477
|
private firstPathMatchingRun;
|
|
479
478
|
private checkPathMatch;
|
|
@@ -485,7 +484,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
485
484
|
*/
|
|
486
485
|
destroy(): void;
|
|
487
486
|
}
|
|
488
|
-
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>;
|
|
487
|
+
declare const createRoute: <TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<any, any, any, any, any> | null = null, TQueryParams extends Record<string, any> = AnyObject>(path: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>) => Route<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>;
|
|
489
488
|
|
|
490
489
|
/**
|
|
491
490
|
* Global configuration for routes and router.
|
|
@@ -515,7 +514,7 @@ interface RouterConfiguration<TRoutesStruct extends RoutesCollection> {
|
|
|
515
514
|
history?: History;
|
|
516
515
|
queryParams?: IQueryParams;
|
|
517
516
|
}
|
|
518
|
-
interface RouterNavigateOptions extends RouteNavigateParams {
|
|
517
|
+
interface RouterNavigateOptions<TQueryParams extends Record<string, any> = AnyObject> extends RouteNavigateParams<TQueryParams> {
|
|
519
518
|
}
|
|
520
519
|
type AnyRouter = Router<RoutesCollection>;
|
|
521
520
|
|
|
@@ -537,4 +536,4 @@ declare const createRouter: <TRoutesCollection extends RoutesCollection>(config:
|
|
|
537
536
|
declare const isRouteEntity: (route: any) => route is AnyRouteEntity;
|
|
538
537
|
|
|
539
538
|
export { Route, RouteGroup, Router, VirtualRoute, createRoute, createRouter, createVirtualRoute, groupRoutes, isRouteEntity, routeConfig };
|
|
540
|
-
export type { AbstractRouteGroup, AbstractVirtualRoute, AnyAbstractRoute, AnyAbstractRouteEntity, AnyRoute, AnyRouteEntity, AnyRouteGroup, AnyRouter, AnyVirtualRoute, BeforeOpenFeedback, CreatedUrlOutputParams, InferInputParams, InferParams, InferPath, InputPathParam, InputPathParams, NavigationTrx, ParsedPathData, ParsedPathParam, ParsedPathParams, PathToObject, RouteConfiguration, RouteGlobalConfig, RouteNavigateParams, RouteParams, RouterConfiguration, RouterNavigateOptions, RoutesArrayCollection, RoutesCollection, RoutesObjectCollection, UrlCreateParams, UrlCreateParamsFn, VirtualOpenExtraParams, VirtualRouteConfiguration, VirtualRouteTrx };
|
|
539
|
+
export type { AbstractRouteGroup, AbstractVirtualRoute, AnyAbstractRoute, AnyAbstractRouteEntity, AnyRoute, AnyRouteEntity, AnyRouteGroup, AnyRouter, AnyVirtualRoute, BeforeOpenFeedback, CreatedUrlOutputParams, InferInputParams, InferParams, InferPath, InferQueryParams, InputPathParam, InputPathParams, NavigationTrx, ParsedPathData, ParsedPathParam, ParsedPathParams, PathToObject, RouteConfiguration, RouteGlobalConfig, RouteNavigateParams, RouteParams, RouterConfiguration, RouterNavigateOptions, RoutesArrayCollection, RoutesCollection, RoutesObjectCollection, UrlCreateParams, UrlCreateParamsFn, VirtualOpenExtraParams, VirtualRouteConfiguration, VirtualRouteTrx };
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "mobx-location-history";
|
|
2
|
-
import { R, a, b, V, c, d, e, g, r } from "./virtual-route-
|
|
2
|
+
import { R, a, b, V, c, d, e, g, r } from "./virtual-route-C7NPJx5y.js";
|
|
3
3
|
const isRouteEntity = (route) => route && "isOpened" in route;
|
|
4
4
|
export {
|
|
5
5
|
R as Route,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-route",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.4",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"mobx",
|
|
6
6
|
"react",
|
|
@@ -67,13 +67,13 @@
|
|
|
67
67
|
"require": "./view-model.cjs",
|
|
68
68
|
"default": "./view-model.js"
|
|
69
69
|
},
|
|
70
|
-
"./virtual-route-
|
|
71
|
-
"require": "./virtual-route-
|
|
72
|
-
"default": "./virtual-route-
|
|
70
|
+
"./virtual-route-B_X_wClE": {
|
|
71
|
+
"require": "./virtual-route-B_X_wClE.cjs",
|
|
72
|
+
"default": "./virtual-route-B_X_wClE.cjs"
|
|
73
73
|
},
|
|
74
|
-
"./virtual-route-
|
|
75
|
-
"import": "./virtual-route-
|
|
76
|
-
"default": "./virtual-route-
|
|
74
|
+
"./virtual-route-C7NPJx5y": {
|
|
75
|
+
"import": "./virtual-route-C7NPJx5y.js",
|
|
76
|
+
"default": "./virtual-route-C7NPJx5y.js"
|
|
77
77
|
}
|
|
78
78
|
},
|
|
79
79
|
"files": [
|
package/view-model.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const mobx = require("mobx");
|
|
4
4
|
const mobxViewModel = require("mobx-view-model");
|
|
5
|
-
const virtualRoute = require("./virtual-route-
|
|
5
|
+
const virtualRoute = require("./virtual-route-B_X_wClE.cjs");
|
|
6
6
|
const annotations = [
|
|
7
7
|
[mobx.computed.struct, "pathParams"],
|
|
8
8
|
[mobx.computed, "query"]
|
package/view-model.d.ts
CHANGED
|
@@ -5,16 +5,19 @@ import { AnyObject, EmptyObject, IsPartial, Maybe, MaybePromise, Class } from 'y
|
|
|
5
5
|
import { RawQueryParamsData, History, IQueryParams } from 'mobx-location-history';
|
|
6
6
|
import { ParseOptions, MatchOptions, ParamData, TokenData } from 'path-to-regexp';
|
|
7
7
|
|
|
8
|
-
interface VirtualOpenExtraParams extends Omit<RouteNavigateParams
|
|
8
|
+
interface VirtualOpenExtraParams<TQueryParams extends Record<string, any> = AnyObject> extends Omit<RouteNavigateParams<TQueryParams>, 'state' | 'mergeQuery'> {
|
|
9
9
|
}
|
|
10
|
-
interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
10
|
+
interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject, TQueryParams extends Record<string, any> = AnyObject> {
|
|
11
11
|
isOpened: boolean;
|
|
12
12
|
isOpening: boolean;
|
|
13
13
|
params: TParams | null;
|
|
14
14
|
/**
|
|
15
15
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
16
16
|
*/
|
|
17
|
-
open(...args: IsPartial<TParams> extends true ? [
|
|
17
|
+
open(...args: IsPartial<TParams> extends true ? [
|
|
18
|
+
params?: Maybe<TParams>,
|
|
19
|
+
extraParams?: VirtualOpenExtraParams<TQueryParams>
|
|
20
|
+
] : [params: TParams, extraParams?: VirtualOpenExtraParams<TQueryParams>]): Promise<void>;
|
|
18
21
|
}
|
|
19
22
|
|
|
20
23
|
interface AbstractRouteGroup<TRoutesCollection extends RoutesCollection = RoutesCollection> {
|
|
@@ -27,7 +30,7 @@ type RoutesArrayCollection = AnyAbstractRouteEntity[];
|
|
|
27
30
|
type RoutesObjectCollection = Record<string, AnyAbstractRouteEntity>;
|
|
28
31
|
type RoutesCollection = RoutesArrayCollection | RoutesObjectCollection;
|
|
29
32
|
|
|
30
|
-
type NavigationTrx<TParams extends AnyObject = AnyObject> = {
|
|
33
|
+
type NavigationTrx<TParams extends AnyObject = AnyObject, TQueryParams extends Record<string, any> = AnyObject> = {
|
|
31
34
|
state?: any;
|
|
32
35
|
/**
|
|
33
36
|
* path parameters
|
|
@@ -37,19 +40,19 @@ type NavigationTrx<TParams extends AnyObject = AnyObject> = {
|
|
|
37
40
|
params?: TParams;
|
|
38
41
|
url: string;
|
|
39
42
|
replace?: boolean;
|
|
40
|
-
query?:
|
|
43
|
+
query?: Partial<TQueryParams>;
|
|
41
44
|
preferSkipHistoryUpdate?: boolean;
|
|
42
45
|
};
|
|
43
46
|
/**
|
|
44
47
|
* Returning `false` means ignore navigation
|
|
45
48
|
*/
|
|
46
49
|
type BeforeOpenFeedback = void | boolean | Pick<NavigationTrx, 'url' | 'state' | 'replace'>;
|
|
47
|
-
interface UrlCreateParams<TInputParams> {
|
|
50
|
+
interface UrlCreateParams<TInputParams, TQueryParams extends Record<string, any> = AnyObject> {
|
|
48
51
|
baseUrl?: string | undefined;
|
|
49
52
|
params: TInputParams;
|
|
50
|
-
query:
|
|
53
|
+
query: Partial<TQueryParams>;
|
|
51
54
|
}
|
|
52
|
-
type UrlCreateParamsFn<TInputParams = any> = (params: UrlCreateParams<TInputParams>, currentQueryData: RawQueryParamsData) => Maybe<UrlCreateParams<TInputParams>>;
|
|
55
|
+
type UrlCreateParamsFn<TInputParams = any, TQueryParams extends Record<string, any> = AnyObject> = (params: UrlCreateParams<TInputParams, TQueryParams>, currentQueryData: RawQueryParamsData) => Maybe<UrlCreateParams<TInputParams, TQueryParams>>;
|
|
53
56
|
/**
|
|
54
57
|
* Output options for `createUrl()` (third argument).
|
|
55
58
|
* @see [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)
|
|
@@ -60,7 +63,7 @@ interface CreatedUrlOutputParams {
|
|
|
60
63
|
/** @see [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl) */
|
|
61
64
|
omitQuery?: boolean;
|
|
62
65
|
}
|
|
63
|
-
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'> {
|
|
66
|
+
interface RouteConfiguration<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<string, any, any, any, any> | null = null, TQueryParams extends Record<string, any> = AnyObject> extends Omit<Partial<RouteGlobalConfig>, 'createUrl'> {
|
|
64
67
|
/**
|
|
65
68
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#abortsignal)
|
|
66
69
|
*/
|
|
@@ -91,7 +94,7 @@ interface RouteConfiguration<TPath extends string, TInputParams extends InputPat
|
|
|
91
94
|
/**
|
|
92
95
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#beforeopen)
|
|
93
96
|
*/
|
|
94
|
-
beforeOpen?: (navigationTransaction: NavigationTrx<NoInfer<TInputParams>>) => MaybePromise<BeforeOpenFeedback>;
|
|
97
|
+
beforeOpen?: (navigationTransaction: NavigationTrx<NoInfer<TInputParams>, NoInfer<TQueryParams>>) => MaybePromise<BeforeOpenFeedback>;
|
|
95
98
|
/**
|
|
96
99
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afterclose)
|
|
97
100
|
*/
|
|
@@ -99,17 +102,17 @@ interface RouteConfiguration<TPath extends string, TInputParams extends InputPat
|
|
|
99
102
|
/**
|
|
100
103
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afteropen)
|
|
101
104
|
*/
|
|
102
|
-
afterOpen?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>>) => void;
|
|
105
|
+
afterOpen?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>, NoInfer<TQueryParams>>) => void;
|
|
103
106
|
/**
|
|
104
107
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#afterupdate)
|
|
105
108
|
*/
|
|
106
|
-
afterUpdate?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>>) => void;
|
|
109
|
+
afterUpdate?: (data: ParsedPathData<NoInfer<TPath>>, route: Route<NoInfer<TPath>, NoInfer<TInputParams>, NoInfer<TOutputParams>, NoInfer<TParentRoute>, NoInfer<TQueryParams>>) => void;
|
|
107
110
|
/**
|
|
108
111
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)
|
|
109
112
|
*/
|
|
110
|
-
createUrl?: UrlCreateParamsFn<TInputParams>;
|
|
113
|
+
createUrl?: UrlCreateParamsFn<TInputParams, TQueryParams>;
|
|
111
114
|
}
|
|
112
|
-
type AnyRoute = Route<any, any, any, any>;
|
|
115
|
+
type AnyRoute = Route<any, any, any, any, any>;
|
|
113
116
|
type InputPathParam = string | number | boolean | null;
|
|
114
117
|
type ParsedPathParam = string;
|
|
115
118
|
type Simplify<T> = T extends infer U ? {
|
|
@@ -129,10 +132,10 @@ type PathToObject<Path extends string, PropertyValue = string> = Simplify<Path e
|
|
|
129
132
|
} : {}>;
|
|
130
133
|
type ParsedPathParams<Path extends string> = PathToObject<Path, ParsedPathParam>;
|
|
131
134
|
type InputPathParams<Path extends string> = PathToObject<Path, InputPathParam>;
|
|
132
|
-
interface RouteNavigateParams {
|
|
135
|
+
interface RouteNavigateParams<TQueryParams extends Record<string, any> = AnyObject> {
|
|
133
136
|
replace?: boolean;
|
|
134
137
|
state?: any;
|
|
135
|
-
query?:
|
|
138
|
+
query?: Partial<TQueryParams>;
|
|
136
139
|
mergeQuery?: boolean;
|
|
137
140
|
}
|
|
138
141
|
interface ParsedPathData<TPath extends string> {
|
|
@@ -145,8 +148,8 @@ interface ParsedPathData<TPath extends string> {
|
|
|
145
148
|
*
|
|
146
149
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)
|
|
147
150
|
*/
|
|
148
|
-
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> {
|
|
149
|
-
protected config: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>;
|
|
151
|
+
declare class Route<TPath extends string, TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>, TOutputParams extends AnyObject = ParsedPathParams<TPath>, TParentRoute extends Route<any, any, any, any, any> | null = null, TQueryParams extends Record<string, any> = AnyObject> {
|
|
152
|
+
protected config: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>;
|
|
150
153
|
private isDestroyed?;
|
|
151
154
|
private disposer?;
|
|
152
155
|
protected history: History;
|
|
@@ -156,7 +159,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
156
159
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)
|
|
157
160
|
*/
|
|
158
161
|
parent: TParentRoute;
|
|
159
|
-
query: IQueryParams
|
|
162
|
+
query: IQueryParams<TQueryParams>;
|
|
160
163
|
private _tokenData;
|
|
161
164
|
private _matcher?;
|
|
162
165
|
private _compiler?;
|
|
@@ -189,7 +192,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
189
192
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)
|
|
190
193
|
*/
|
|
191
194
|
children: AnyRoute[];
|
|
192
|
-
constructor(pathDeclaration: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>);
|
|
195
|
+
constructor(pathDeclaration: TPath, config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>);
|
|
193
196
|
protected get baseUrl(): string | undefined;
|
|
194
197
|
/**
|
|
195
198
|
* Checks whether current route matches provided path.
|
|
@@ -236,7 +239,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
236
239
|
*
|
|
237
240
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)
|
|
238
241
|
*/
|
|
239
|
-
extend<TExtendedPath extends string, TExtendedInputParams extends InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>, TExtendedOutputParams extends AnyObject = TInputParams & ParsedPathParams<`${TPath}${TExtendedPath}
|
|
242
|
+
extend<TExtendedPath extends string, TExtendedInputParams extends InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>, TExtendedOutputParams extends AnyObject = TInputParams & ParsedPathParams<`${TPath}${TExtendedPath}`>, TExtendedQueryParams extends Record<string, any> = TQueryParams>(pathDeclaration: TExtendedPath, config?: Omit<RouteConfiguration<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, any, TExtendedQueryParams>, 'parent'>): Route<`${TPath}${TExtendedPath}`, TInputParams & TExtendedInputParams, TExtendedOutputParams, this, TExtendedQueryParams>;
|
|
240
243
|
/**
|
|
241
244
|
* Manually add child routes.
|
|
242
245
|
*
|
|
@@ -261,11 +264,11 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
261
264
|
*/
|
|
262
265
|
createUrl(...args: IsPartial<TInputParams> extends true ? [
|
|
263
266
|
params?: Maybe<TInputParams>,
|
|
264
|
-
query?: Maybe<
|
|
267
|
+
query?: Maybe<Partial<TQueryParams>>,
|
|
265
268
|
mergeQueryOrParams?: boolean | CreatedUrlOutputParams
|
|
266
269
|
] : [
|
|
267
270
|
params: TInputParams,
|
|
268
|
-
query?: Maybe<
|
|
271
|
+
query?: Maybe<Partial<TQueryParams>>,
|
|
269
272
|
mergeQueryOrParams?: boolean | CreatedUrlOutputParams
|
|
270
273
|
]): string;
|
|
271
274
|
/**
|
|
@@ -275,19 +278,22 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
275
278
|
*/
|
|
276
279
|
open(...args: IsPartial<TInputParams> extends true ? [
|
|
277
280
|
params?: TInputParams | null | undefined,
|
|
278
|
-
navigateParams?: RouteNavigateParams
|
|
279
|
-
] : [
|
|
281
|
+
navigateParams?: RouteNavigateParams<TQueryParams>
|
|
282
|
+
] : [
|
|
283
|
+
params: TInputParams,
|
|
284
|
+
navigateParams?: RouteNavigateParams<TQueryParams>
|
|
285
|
+
]): Promise<void>;
|
|
280
286
|
open(...args: IsPartial<TInputParams> extends true ? [
|
|
281
287
|
params?: TInputParams | null | undefined,
|
|
282
|
-
replace?: RouteNavigateParams['replace'],
|
|
283
|
-
query?: RouteNavigateParams['query']
|
|
288
|
+
replace?: RouteNavigateParams<TQueryParams>['replace'],
|
|
289
|
+
query?: RouteNavigateParams<TQueryParams>['query']
|
|
284
290
|
] : [
|
|
285
291
|
params: TInputParams,
|
|
286
|
-
replace?: RouteNavigateParams['replace'],
|
|
287
|
-
query?: RouteNavigateParams['query']
|
|
292
|
+
replace?: RouteNavigateParams<TQueryParams>['replace'],
|
|
293
|
+
query?: RouteNavigateParams<TQueryParams>['query']
|
|
288
294
|
]): Promise<void>;
|
|
289
|
-
open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
290
|
-
open(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
295
|
+
open(url: string, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
296
|
+
open(url: string, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
291
297
|
/**
|
|
292
298
|
* Updates the current route if it is already open.
|
|
293
299
|
* Unlike `open`, this is a no-op if the route is not open,
|
|
@@ -296,23 +302,12 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
296
302
|
*
|
|
297
303
|
* [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)
|
|
298
304
|
*/
|
|
299
|
-
update(
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
update(...args: IsPartial<TInputParams> extends true ? [
|
|
304
|
-
params?: TInputParams | null | undefined,
|
|
305
|
-
replace?: RouteNavigateParams['replace'],
|
|
306
|
-
query?: RouteNavigateParams['query']
|
|
307
|
-
] : [
|
|
308
|
-
params: TInputParams,
|
|
309
|
-
replace?: RouteNavigateParams['replace'],
|
|
310
|
-
query?: RouteNavigateParams['query']
|
|
311
|
-
]): Promise<void>;
|
|
312
|
-
update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
313
|
-
update(url: string, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
305
|
+
update(params?: TInputParams | null | undefined, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
306
|
+
update(params?: TInputParams | null | undefined, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
307
|
+
update(url: string, navigateParams?: RouteNavigateParams<TQueryParams>): Promise<void>;
|
|
308
|
+
update(url: string, replace?: RouteNavigateParams<TQueryParams>['replace'], query?: RouteNavigateParams<TQueryParams>['query']): Promise<void>;
|
|
314
309
|
protected get tokenData(): TokenData;
|
|
315
|
-
protected confirmOpening(trx: NavigationTrx<TInputParams>): Promise<true | undefined>;
|
|
310
|
+
protected confirmOpening(trx: NavigationTrx<TInputParams, TQueryParams>): Promise<true | undefined>;
|
|
316
311
|
protected confirmClosing(): boolean;
|
|
317
312
|
private firstPathMatchingRun;
|
|
318
313
|
private checkPathMatch;
|
package/view-model.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed } from "mobx";
|
|
2
2
|
import { ViewModelBase, applyObservable } from "mobx-view-model";
|
|
3
|
-
import { r as routeConfig } from "./virtual-route-
|
|
3
|
+
import { r as routeConfig } from "./virtual-route-C7NPJx5y.js";
|
|
4
4
|
const annotations = [
|
|
5
5
|
[computed.struct, "pathParams"],
|
|
6
6
|
[computed, "query"]
|