mobx-route 1.3.3 → 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 -53
- package/index.js +1 -1
- package/package.json +7 -7
- package/view-model.cjs +1 -1
- package/view-model.d.ts +42 -36
- package/view-model.js +1 -1
- package/{virtual-route-sU8rVTsu.cjs → virtual-route-B_X_wClE.cjs} +9 -3
- package/virtual-route-B_X_wClE.cjs.map +1 -0
- package/{virtual-route-Chv5K9C8.js → virtual-route-C7NPJx5y.js} +9 -3
- package/virtual-route-C7NPJx5y.js.map +1 -0
- package/virtual-route-Chv5K9C8.js.map +0 -1
- package/virtual-route-sU8rVTsu.cjs.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,12 +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(params?: TInputParams | null | undefined, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
461
|
-
update(params?: TInputParams | null | undefined, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
462
|
-
update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
463
|
-
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>;
|
|
464
474
|
protected get tokenData(): TokenData;
|
|
465
|
-
protected confirmOpening(trx: NavigationTrx<TInputParams>): Promise<true | undefined>;
|
|
475
|
+
protected confirmOpening(trx: NavigationTrx<TInputParams, TQueryParams>): Promise<true | undefined>;
|
|
466
476
|
protected confirmClosing(): boolean;
|
|
467
477
|
private firstPathMatchingRun;
|
|
468
478
|
private checkPathMatch;
|
|
@@ -474,7 +484,7 @@ declare class Route<TPath extends string, TInputParams extends InputPathParams<T
|
|
|
474
484
|
*/
|
|
475
485
|
destroy(): void;
|
|
476
486
|
}
|
|
477
|
-
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>;
|
|
478
488
|
|
|
479
489
|
/**
|
|
480
490
|
* Global configuration for routes and router.
|
|
@@ -504,7 +514,7 @@ interface RouterConfiguration<TRoutesStruct extends RoutesCollection> {
|
|
|
504
514
|
history?: History;
|
|
505
515
|
queryParams?: IQueryParams;
|
|
506
516
|
}
|
|
507
|
-
interface RouterNavigateOptions extends RouteNavigateParams {
|
|
517
|
+
interface RouterNavigateOptions<TQueryParams extends Record<string, any> = AnyObject> extends RouteNavigateParams<TQueryParams> {
|
|
508
518
|
}
|
|
509
519
|
type AnyRouter = Router<RoutesCollection>;
|
|
510
520
|
|
|
@@ -526,4 +536,4 @@ declare const createRouter: <TRoutesCollection extends RoutesCollection>(config:
|
|
|
526
536
|
declare const isRouteEntity: (route: any) => route is AnyRouteEntity;
|
|
527
537
|
|
|
528
538
|
export { Route, RouteGroup, Router, VirtualRoute, createRoute, createRouter, createVirtualRoute, groupRoutes, isRouteEntity, routeConfig };
|
|
529
|
-
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
|
-
"
|
|
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
|
-
"
|
|
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,12 +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(params?: TInputParams | null | undefined, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
300
|
-
update(params?: TInputParams | null | undefined, replace?: RouteNavigateParams['replace'], query?: RouteNavigateParams['query']): Promise<void>;
|
|
301
|
-
update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;
|
|
302
|
-
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>;
|
|
303
309
|
protected get tokenData(): TokenData;
|
|
304
|
-
protected confirmOpening(trx: NavigationTrx<TInputParams>): Promise<true | undefined>;
|
|
310
|
+
protected confirmOpening(trx: NavigationTrx<TInputParams, TQueryParams>): Promise<true | undefined>;
|
|
305
311
|
protected confirmClosing(): boolean;
|
|
306
312
|
private firstPathMatchingRun;
|
|
307
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"]
|
|
@@ -333,7 +333,10 @@ class Route {
|
|
|
333
333
|
state: rawState,
|
|
334
334
|
query: rawQuery,
|
|
335
335
|
mergeQuery: rawMergeQuery
|
|
336
|
-
} = typeof args[1] === "boolean" || args.length > 2 ? {
|
|
336
|
+
} = typeof args[1] === "boolean" || args.length > 2 ? {
|
|
337
|
+
replace: args[1],
|
|
338
|
+
query: args[2]
|
|
339
|
+
} : args[1] ?? {};
|
|
337
340
|
const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;
|
|
338
341
|
const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;
|
|
339
342
|
const params = typeof args[0] === "string" ? void 0 : args[0];
|
|
@@ -508,7 +511,10 @@ class Route {
|
|
|
508
511
|
this.updateDisposer = void 0;
|
|
509
512
|
}
|
|
510
513
|
}
|
|
511
|
-
const createRoute = (path, config) => new Route(
|
|
514
|
+
const createRoute = (path, config) => new Route(
|
|
515
|
+
path,
|
|
516
|
+
config
|
|
517
|
+
);
|
|
512
518
|
const annotations$2 = [
|
|
513
519
|
[mobx.computed, "isOpened", "indexRoute", "canNavigate"],
|
|
514
520
|
[mobx.observable.shallow, "routes"]
|
|
@@ -817,4 +823,4 @@ exports.createRouter = createRouter;
|
|
|
817
823
|
exports.createVirtualRoute = createVirtualRoute;
|
|
818
824
|
exports.groupRoutes = groupRoutes;
|
|
819
825
|
exports.routeConfig = routeConfig;
|
|
820
|
-
//# sourceMappingURL=virtual-route-
|
|
826
|
+
//# sourceMappingURL=virtual-route-B_X_wClE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-route-B_X_wClE.cjs","sources":["../src/core/config/config.ts","../src/core/route/route.ts","../src/core/route-group/route-group.ts","../src/core/router/router.ts","../src/core/virtual-route/virtual-route.ts"],"sourcesContent":["import {\n createBrowserHistory,\n createQueryParams,\n type History,\n type IQueryParams,\n isObservableHistory,\n} from 'mobx-location-history';\nimport { createGlobalDynamicConfig } from 'yummies/complex';\n\nimport type { RouteGlobalConfig } from './config.types.js';\n\nexport const routeConfig = createGlobalDynamicConfig<RouteGlobalConfig>(\n (update, current) => {\n let history: History;\n let queryParams: IQueryParams | undefined;\n\n if (update?.history) {\n history = update.history;\n queryParams = update.queryParams;\n\n if (current?.history && isObservableHistory(current.history)) {\n current.history.destroy();\n }\n } else if (current?.history) {\n history = current.history;\n queryParams = update?.queryParams ?? current.queryParams;\n } else {\n history = createBrowserHistory();\n }\n\n queryParams ??= createQueryParams({ history });\n\n return {\n ...update,\n history,\n queryParams,\n };\n },\n Symbol.for('MOBX_ROUTE_CONFIG'),\n);\n","import { comparer, computed, observable, reaction, runInAction } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport {\n compile,\n match,\n type ParamData,\n parse,\n type TokenData,\n} from 'path-to-regexp';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AnyRoute,\n CreatedUrlOutputParams,\n InputPathParams,\n NavigationTrx,\n ParsedPathData,\n ParsedPathParams,\n RouteConfiguration,\n RouteNavigateParams,\n UrlCreateParams,\n} from './route.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<Route<any, any, any, any, any>> =\n [\n [\n computed,\n 'isPathMatched',\n 'isOpened',\n 'isOpening',\n 'path',\n 'absolutePath',\n 'hasOpenedChildren',\n 'isAbleToMergeQuery',\n 'baseUrl',\n ],\n [computed.struct, 'parsedPathData', 'params'],\n [observable, 'children'],\n [observable.ref, 'parent', 'status'],\n ];\n\n/**\n * Class for creating path based route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)\n */\nexport class Route<\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any, any> | null = null,\n TQueryParams extends Record<string, any> = AnyObject,\n> {\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n protected history: History;\n\n /**\n * Parent route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)\n */\n parent: TParentRoute;\n\n query: IQueryParams<TQueryParams>;\n\n private _tokenData: TokenData | undefined;\n private _matcher?: ReturnType<typeof match>;\n private _compiler?: ReturnType<typeof compile>;\n private ignoreOpenByPathMatch = false;\n private isUpdate = false;\n private updateDisposer?: VoidFunction;\n\n protected status:\n | 'opening'\n | 'closed'\n | 'open-rejected'\n | 'open-confirmed'\n | 'unknown';\n\n meta?: AnyObject;\n\n /**\n * Route path pattern declaration.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#pathdeclaration)\n */\n pathDeclaration: TPath;\n\n /**\n * Indicates if this route is an index route. Index routes activate when parent route path matches exactly.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isindex)\n */\n isIndex: boolean;\n\n /**\n * Indicates if this route is an hash route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#ishash)\n */\n isHash: boolean;\n\n /**\n * Array of child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)\n */\n children: AnyRoute[] = [];\n\n constructor(\n pathDeclaration: TPath,\n protected config: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute,\n TQueryParams\n > = {},\n ) {\n this.history = config.history ?? routeConfig.get().history;\n this.query = (config.queryParams ??\n routeConfig.get().queryParams) as IQueryParams<TQueryParams>;\n this.pathDeclaration = pathDeclaration;\n this.isIndex = !!this.config.index;\n this.isHash = !!this.config.hash;\n this.meta = this.config.meta;\n this.status = 'unknown';\n this.parent = config.parent ?? (null as unknown as TParentRoute);\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(() => this.isPathMatched, this.checkPathMatch, {\n fireImmediately: true,\n });\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'open-confirmed') return undefined;\n return [this.parsedPathData, this.query.data] as const;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n if (!this.parsedPathData) return;\n this.config.afterUpdate?.(this.parsedPathData, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n this.config.abortSignal?.addEventListener('abort', () => this.destroy(), {\n once: true,\n });\n }\n }\n\n protected get baseUrl() {\n const baseUrl = this.config.baseUrl ?? routeConfig.get().baseUrl;\n return baseUrl?.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n }\n\n /**\n * Checks whether current route matches provided path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#matchpath)\n */\n matchPath(path?: Maybe<string>): ParsedPathData<TPath> | null {\n let pathnameToCheck: string;\n\n if (path != null) {\n pathnameToCheck = path;\n } else if (this.isHash) {\n pathnameToCheck = this.history.location.hash.slice(1);\n } else {\n pathnameToCheck = this.history.location.pathname;\n }\n\n if (this.baseUrl) {\n if (!pathnameToCheck.startsWith(this.baseUrl)) {\n return null;\n }\n\n pathnameToCheck = pathnameToCheck.replace(this.baseUrl, '');\n }\n\n if (\n (this.pathDeclaration === '' || this.pathDeclaration === '/') &&\n (pathnameToCheck === '/' || pathnameToCheck === '')\n ) {\n return { params: {} as any, path: pathnameToCheck };\n }\n\n this._matcher ??= match(this.tokenData, {\n end: this.config.exact ?? false,\n ...this.config.matchOptions,\n });\n const parsed = this._matcher(pathnameToCheck);\n\n if (parsed === false) {\n return null;\n }\n\n return parsed as ParsedPathData<TPath>;\n }\n\n protected get parsedPathData(): ParsedPathData<TPath> | null {\n return this.matchPath();\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopening)\n *\n * Also true in the short gap after history already matches this route but\n * `confirmOpening` has not started yet (e.g. browser Back) — otherwise every\n * route looks closed for one tick and RouteViewGroup unmounts the page.\n */\n get isOpening() {\n if (this.status === 'opening') {\n return true;\n }\n\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status === 'open-confirmed' ||\n this.status === 'open-rejected'\n ) {\n return false;\n }\n\n return this.status === 'closed' || this.status === 'unknown';\n }\n\n /**\n * Matched path segment for current URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#path)\n */\n get path(): string | null {\n return this.parsedPathData?.path ?? null;\n }\n\n /**\n * Matched path segment for current URL with base URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#absolutepath)\n */\n get absolutePath(): string | null {\n const path = this.path;\n\n if (path === null) {\n return null;\n }\n\n return `${this.baseUrl || ''}${path}`;\n }\n\n /**\n * Current parsed path parameters.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params)\n */\n get params(): TOutputParams | null {\n if (!this.parsedPathData?.params) {\n return null;\n }\n\n if (this.config.params) {\n const result = this.config.params(\n this.parsedPathData.params,\n this.config.meta,\n );\n return result || null;\n }\n\n return (\n (this.parsedPathData?.params as unknown as Maybe<TOutputParams>) ?? null\n );\n }\n\n protected get isPathMatched() {\n return this.parsedPathData !== null;\n }\n\n /**\n * Defines the \"open\" state for this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopened)\n */\n get isOpened() {\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status !== 'open-confirmed'\n ) {\n return false;\n }\n\n return (\n // this.parsedPathData is defined because this.params !== null\n !this.config.checkOpened || this.config.checkOpened(this.parsedPathData!)\n );\n }\n\n /**\n * Allows to create child route based on this route with merging this route path and extending path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)\n */\n extend<\n TExtendedPath extends string,\n TExtendedInputParams extends\n InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedOutputParams extends AnyObject = TInputParams &\n ParsedPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedQueryParams extends Record<string, any> = TQueryParams,\n >(\n pathDeclaration: TExtendedPath,\n config?: Omit<\n RouteConfiguration<\n `${TPath}${TExtendedPath}`,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n any,\n TExtendedQueryParams\n >,\n 'parent'\n >,\n ) {\n type ExtendedRoutePath = `${TPath}${TExtendedPath}`;\n type ParentRoute = this;\n const { index, params, exact, ...configFromCurrentRoute } = this.config;\n\n const extendedChild = new Route<\n ExtendedRoutePath,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n ParentRoute,\n TExtendedQueryParams\n >(`${this.pathDeclaration}${pathDeclaration}`, {\n ...configFromCurrentRoute,\n ...config,\n parent: this,\n } as any);\n\n this.addChildren(extendedChild as any);\n\n return extendedChild;\n }\n\n /**\n * Manually add child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#addchildren)\n */\n addChildren(...routes: AnyRoute[]) {\n this.children.push(...routes);\n }\n\n /**\n * Remove specified routes from children.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#removechildren)\n */\n removeChildren(...routes: AnyRoute[]) {\n this.children = this.children.filter((child) => !routes.includes(child));\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren)\n */\n get hasOpenedChildren(): boolean {\n return this.children.some(\n (child) => child.isOpened || child.hasOpenedChildren,\n );\n }\n\n protected processParams(\n params?: TInputParams | null | undefined,\n ): ParamData | undefined {\n if (params == null) return undefined;\n\n const result: ParamData = {};\n for (const [key, value] of Object.entries(params)) {\n if (value != null) {\n result[key] = Array.isArray(value) ? value.map(String) : String(value);\n }\n }\n return result;\n }\n\n /**\n * Generates full route URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)\n */\n createUrl(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: Maybe<TInputParams>,\n query?: Maybe<Partial<TQueryParams>>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n : [\n params: TInputParams,\n query?: Maybe<Partial<TQueryParams>>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n ) {\n const params = args[0];\n const rawQuery = args[1];\n const mergeQueryOrOutputParams = args[2] ?? this.isAbleToMergeQuery;\n const outputParams: Maybe<CreatedUrlOutputParams> =\n typeof mergeQueryOrOutputParams === 'boolean'\n ? { mergeQuery: mergeQueryOrOutputParams }\n : mergeQueryOrOutputParams;\n\n const query = outputParams?.mergeQuery\n ? { ...this.query.data, ...rawQuery }\n : (rawQuery ?? {});\n\n this._compiler ??= compile(this.tokenData);\n\n const defaultUrlCreateParams: UrlCreateParams<TInputParams, TQueryParams> =\n {\n baseUrl: this.baseUrl,\n params: params as TInputParams,\n query,\n };\n const urlCreateParams: UrlCreateParams<TInputParams, TQueryParams> =\n this.config.createUrl?.(defaultUrlCreateParams, this.query.data) ??\n routeConfig.get().createUrl?.(defaultUrlCreateParams, this.query.data) ??\n defaultUrlCreateParams;\n\n let path: string;\n\n try {\n path = this._compiler(this.processParams(urlCreateParams.params));\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'Error #1: Route path compilation failed\\n' +\n 'The path pattern could not be built into a URL (often missing or invalid params for a `:param` segment). Using fallbackPath or \"/\".\\n' +\n 'See docs: https://js2me.github.io/mobx-route/errors/1',\n e,\n );\n } else {\n console.error('minified error #1;see mobx-route docs', e);\n }\n path = this.config.fallbackPath ?? routeConfig.get().fallbackPath ?? '/';\n }\n\n const url = `${urlCreateParams.baseUrl || ''}${this.isHash ? '#' : ''}${path}`;\n\n if (outputParams?.omitQuery) {\n return url;\n }\n\n return `${url}${buildSearchString(urlCreateParams.query)}`;\n }\n\n /**\n * Navigates to this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open)\n */\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ]\n : [\n params: TInputParams,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ]\n ): Promise<void>;\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ]\n : [\n params: TInputParams,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ]\n ): Promise<void>;\n open(\n url: string,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n open(\n url: string,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n\n async open(...args: any[]) {\n const {\n replace,\n state: rawState,\n query: rawQuery,\n mergeQuery: rawMergeQuery,\n } = typeof args[1] === 'boolean' || args.length > 2\n ? ({\n replace: args[1],\n query: args[2],\n } as RouteNavigateParams<TQueryParams>)\n : ((args[1] ?? {}) as RouteNavigateParams<TQueryParams>);\n\n const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;\n const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;\n\n const params = typeof args[0] === 'string' ? undefined : args[0];\n const url =\n typeof args[0] === 'string' ? args[0] : this.createUrl(args[0], query);\n\n const trx: NavigationTrx<TInputParams, TQueryParams> = {\n url,\n params: params as TInputParams,\n replace,\n state: rawState ?? null,\n query,\n };\n\n this.isUpdate = this.status === 'open-confirmed';\n this.ignoreOpenByPathMatch = true;\n const isConfirmed = await this.confirmOpening(trx);\n\n if (isConfirmed !== true) {\n this.ignoreOpenByPathMatch = false;\n this.isUpdate = false;\n }\n }\n\n /**\n * Updates the current route if it is already open.\n * Unlike `open`, this is a no-op if the route is not open,\n * defaults to `replace: true` instead of push,\n * and defaults to `mergeQuery: true` when no query params are provided.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)\n */\n update(\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n update(\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n update(\n url: string,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n update(\n url: string,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n\n async update(...args: any[]) {\n if (this.status !== 'open-confirmed') {\n return;\n }\n\n // Reuse current path params when omitted\n if (args[0] == null) {\n args[0] = this.parsedPathData?.params;\n }\n\n const secondArg = args[1];\n const isObjectParams = typeof secondArg === 'object' && secondArg !== null;\n\n if (isObjectParams) {\n args[1] = {\n replace: true,\n ...('query' in secondArg ? {} : { mergeQuery: true }),\n ...secondArg,\n };\n } else if (typeof secondArg === 'boolean') {\n if (args[2] === undefined) {\n args[1] = { replace: secondArg, mergeQuery: true };\n args.length = 2;\n }\n } else if (args.length === 1) {\n args[1] = { replace: true, mergeQuery: true };\n }\n\n return (this.open as (...args: any[]) => Promise<void>)(...args);\n }\n\n protected get tokenData() {\n if (!this._tokenData) {\n this._tokenData = parse(this.pathDeclaration, this.config.parseOptions);\n }\n return this._tokenData;\n }\n\n protected async confirmOpening(\n trx: NavigationTrx<TInputParams, TQueryParams>,\n ) {\n if (!this.isUpdate) {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n let skipHistoryUpdate = !!trx.preferSkipHistoryUpdate;\n\n if (skipHistoryUpdate) {\n this.ignoreOpenByPathMatch = false;\n }\n\n if (this.config.beforeOpen) {\n const feedback = await this.config.beforeOpen(trx);\n\n if (feedback === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n });\n\n return;\n }\n\n // Rebuild URL if beforeOpen mutated trx.params\n const newUrl = this.createUrl(\n trx.params as TInputParams,\n trx.query as AnyObject,\n );\n if (newUrl !== trx.url) {\n trx.url = newUrl;\n skipHistoryUpdate = false;\n }\n\n if (typeof feedback === 'object') {\n skipHistoryUpdate = false;\n Object.assign(trx, feedback);\n }\n }\n\n if (this.isDestroyed) {\n return;\n }\n\n if (!skipHistoryUpdate) {\n if (trx.replace) {\n this.history.replace(trx.url, trx.state);\n } else {\n this.history.push(trx.url, trx.state);\n }\n }\n\n if (this.isPathMatched) {\n const wasAlreadyConfirmed = this.status === 'open-confirmed';\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n\n if (this.isUpdate) {\n this.isUpdate = false;\n // afterUpdate handled by updateDisposer reaction\n } else if (!wasAlreadyConfirmed) {\n this.config.afterOpen?.(this.parsedPathData!, this);\n }\n }\n\n return true;\n }\n\n protected confirmClosing() {\n runInAction(() => {\n this.status = 'closed';\n });\n return true;\n }\n\n private firstPathMatchingRun = true;\n\n private checkPathMatch = async (isPathMathched: boolean) => {\n if (this.firstPathMatchingRun) {\n this.firstPathMatchingRun = false;\n // ignore first 'afterClose' callback call\n if (!isPathMathched) {\n return;\n }\n }\n\n if (isPathMathched) {\n // after manual open call\n if (this.ignoreOpenByPathMatch) {\n this.ignoreOpenByPathMatch = false;\n if (this.status === 'opening' && this.parsedPathData) {\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.parsedPathData, this);\n } else {\n this.config.afterOpen?.(this.parsedPathData, this);\n }\n }\n // update() delegates to confirmOpening\n return;\n }\n\n // Set opening sync to avoid isOpened/isOpening flicker\n if (this.status !== 'opening' && this.status !== 'open-confirmed') {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n // already confirmed\n if (this.status === 'open-confirmed') {\n return;\n }\n\n const trx: NavigationTrx<TInputParams, TQueryParams> = {\n url: `${this.parsedPathData!.path}${buildSearchString(this.query.data)}`,\n params: this.parsedPathData!.params as TInputParams,\n state: this.history.location.state,\n query: this.query.data,\n preferSkipHistoryUpdate: true,\n };\n\n await this.confirmOpening(trx);\n } else {\n this.ignoreOpenByPathMatch = false;\n\n const isConfirmed = this.confirmClosing();\n\n if (isConfirmed) {\n this.config.afterClose?.();\n }\n }\n };\n\n private get isAbleToMergeQuery() {\n return this.config.mergeQuery ?? routeConfig.get().mergeQuery;\n }\n\n /**\n * Destroys route subscriptions and reactions.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#destroy)\n */\n destroy() {\n this.isDestroyed = true;\n this.disposer?.();\n this.disposer = undefined;\n this.updateDisposer?.();\n this.updateDisposer = undefined;\n }\n}\n\nexport const createRoute = <\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any, any> | null = null,\n TQueryParams extends Record<string, any> = AnyObject,\n>(\n path: TPath,\n config?: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute,\n TQueryParams\n >,\n) =>\n new Route<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>(\n path,\n config,\n );\n","import { computed, observable } from 'mobx';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type {\n AbstractRouteGroup,\n AnyRouteEntity,\n RoutesCollection,\n} from './route-group.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<RouteGroup<any>> = [\n [computed, 'isOpened', 'indexRoute', 'canNavigate'],\n [observable.shallow, 'routes'],\n];\n\n/**\n * Class for grouping related routes and managing their state.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport class RouteGroup<TRoutesCollection extends RoutesCollection>\n implements AbstractRouteGroup<TRoutesCollection>\n{\n routes: TRoutesCollection;\n\n constructor(\n routes: TRoutesCollection,\n private _indexRoute?: AnyRouteEntity,\n ) {\n this.routes = routes;\n\n applyObservable(this, annotations);\n }\n\n /**\n * Returns true if at least one route in the group is open.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#isopened)\n */\n get isOpened(): boolean {\n const routes = Object.values(this.routes);\n return routes.some(\n (route) =>\n route.isOpened ||\n ('hasOpenedChildren' in route && route.hasOpenedChildren),\n );\n }\n\n /**\n * First found index route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#indexroute)\n */\n get indexRoute(): AnyRouteEntity | undefined {\n return (this._indexRoute ??\n Object.values(this.routes).find(\n (route) => 'isIndex' in route && route.isIndex,\n )) as unknown as AnyRouteEntity;\n }\n\n /**\n * `true` if `open()` has a target to navigate to —\n * either an own index route or a nested `RouteGroup` that itself can navigate.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#cannavigate)\n */\n get canNavigate(): boolean {\n if (this.indexRoute) return true;\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Main navigation method for the group.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#open)\n */\n open(...args: any[]) {\n if (this.indexRoute && 'open' in this.indexRoute) {\n this.indexRoute.open(...args);\n return;\n }\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n route.open(...args);\n return;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Warning #1: RouteGroup.open() cannot navigate\\n' +\n 'This group has no index route (`index: true` or `groupRoutes(routes, indexRoute)`) and no navigable nested RouteGroup, so open() does nothing.\\n' +\n 'See docs: https://js2me.github.io/mobx-route/warnings/1',\n );\n } else {\n console.warn('minified warning #1;see mobx-route docs');\n }\n }\n}\n\n/**\n * Helper for creating route groups.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport const groupRoutes = <TRoutesCollection extends RoutesCollection>(\n routes: TRoutesCollection,\n indexRoute?: AnyRouteEntity,\n) => new RouteGroup<TRoutesCollection>(routes, indexRoute);\n","import { computed } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport { routeConfig } from '../config/index.js';\nimport type { RoutesCollection } from '../route-group/index.js';\nimport type {\n RouterConfiguration,\n RouterNavigateOptions,\n} from './router.types.js';\n\nconst annotations: ObservableAnnotationsArray<Router<any>> = [\n [computed.struct, 'location'],\n];\n\n/**\n * Class for centralized routing management.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)\n */\nexport class Router<TRoutesCollection extends RoutesCollection> {\n routes: TRoutesCollection;\n history: History;\n query: IQueryParams;\n\n constructor(config: RouterConfiguration<TRoutesCollection>) {\n this.routes = config.routes;\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n\n applyObservable(this, annotations);\n }\n\n get location() {\n return this.history.location;\n }\n\n navigate(url: string, options?: RouterNavigateOptions) {\n const query =\n (options?.mergeQuery ?? routeConfig.get().mergeQuery)\n ? { ...this.query.data, ...options?.query }\n : { ...options?.query };\n\n const searchString = buildSearchString(query);\n const navigationUrl = `${url}${searchString}`;\n\n if (options?.replace) {\n this.history.replace(navigationUrl, options?.state);\n } else {\n this.history.push(navigationUrl, options?.state);\n }\n }\n}\n\nexport const createRouter = <TRoutesCollection extends RoutesCollection>(\n config: RouterConfiguration<TRoutesCollection>,\n) => new Router(config);\n","import {\n action,\n comparer,\n computed,\n observable,\n reaction,\n runInAction,\n} from 'mobx';\nimport type { IQueryParams } from 'mobx-location-history';\nimport { callFunction } from 'yummies/common';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AbstractVirtualRoute,\n VirtualOpenExtraParams,\n VirtualRouteConfiguration,\n VirtualRouteTrx,\n} from './virtual-route.types.js';\n\nconst annotations: ObservableAnnotationsArray<VirtualRoute<any>> = [\n [observable, 'params'],\n [observable.ref, 'status', 'trx', 'openChecker', 'isOuterOpened'],\n [computed, 'isOpened', 'isOpening', 'isClosing'],\n [action, 'setOpenChecker', 'open', 'close', 'destroy'],\n];\n\n/**\n * Class for creating routes with custom activation logic\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)\n */\nexport class VirtualRoute<\n TParams extends AnyObject | EmptyObject = EmptyObject,\n TQueryParams extends Record<string, any> = AnyObject,\n> implements AbstractVirtualRoute<TParams, TQueryParams>\n{\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n query: IQueryParams<TQueryParams>;\n params: TParams | null;\n\n protected status:\n | 'opening'\n | 'open-rejected'\n | 'opened'\n | 'closing'\n | 'closed'\n | 'unknown';\n\n private openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>;\n\n private trx: Maybe<VirtualRouteTrx>;\n\n private skipAutoOpenClose: boolean;\n\n private isUpdate = false;\n\n private updateDisposer?: VoidFunction;\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isouteropened)\n */\n isOuterOpened: boolean | undefined;\n\n constructor(\n protected config: VirtualRouteConfiguration<TParams, TQueryParams> = {},\n ) {\n this.query = (config.queryParams ??\n routeConfig.get().queryParams) as IQueryParams<TQueryParams>;\n this.params = callFunction(config.initialParams, this) ?? null;\n this.openChecker = config.checkOpened;\n this.skipAutoOpenClose = false;\n this.isOuterOpened = this.openChecker?.(this);\n this.status = this.isOuterOpened ? 'opened' : 'unknown';\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(\n () => this.openChecker?.(this),\n action((isOuterOpened) => {\n this.isOuterOpened = isOuterOpened;\n\n if (\n this.skipAutoOpenClose ||\n this.status === 'closing' ||\n this.status === 'opening'\n ) {\n return;\n }\n\n if (this.isOuterOpened) {\n if (this.status === 'opened') {\n return;\n }\n void this.confirmOpening({\n params: this.params ?? null,\n ...this.config.getAutoOpenParams?.(this),\n });\n } else {\n if (this.status === 'closed' || this.status === 'unknown') {\n return;\n }\n void this.confirmClosing();\n }\n }),\n { signal: this.config.abortSignal, fireImmediately: true },\n );\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'opened') return undefined;\n return this.query.data;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n this.config.afterUpdate?.(this.params, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n }\n\n if (this.status === 'opened') {\n this.config.afterOpen?.(this.params, this);\n }\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened)\n */\n get isOpened() {\n return (\n !this.isDestroyed &&\n this.status === 'opened' &&\n this.isOuterOpened !== false\n );\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopening)\n */\n get isOpening() {\n return this.status === 'opening';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isclosing)\n */\n get isClosing() {\n return this.status === 'closing';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker)\n */\n setOpenChecker(\n openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>,\n ) {\n this.openChecker = openChecker;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)\n */\n open(\n ...args: IsPartial<TParams> extends true\n ? [\n params?: Maybe<TParams>,\n extraParams?: VirtualOpenExtraParams<TQueryParams>,\n ]\n : [params: TParams, extraParams?: VirtualOpenExtraParams<TQueryParams>]\n ): Promise<void>;\n async open(...args: any[]) {\n const params = (args[0] ?? null) as unknown as TParams;\n const extra: Maybe<VirtualOpenExtraParams> = args[1];\n\n this.isUpdate = this.status === 'opened';\n this.skipAutoOpenClose = true;\n\n this.trx = {\n params,\n extra,\n manual: true,\n };\n\n await this.confirmOpening(this.trx);\n\n this.skipAutoOpenClose = false;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)\n */\n async close() {\n this.skipAutoOpenClose = true;\n const result = await this.confirmClosing();\n this.skipAutoOpenClose = false;\n return result;\n }\n\n private async confirmOpening(trx: VirtualRouteTrx) {\n runInAction(() => {\n this.trx = undefined;\n this.status = 'opening';\n });\n\n if ((await this.config.beforeOpen?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n if ((await this.config.open?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n runInAction(() => {\n if (trx.extra?.query) {\n this.query.update(trx.extra.query, trx.extra.replace);\n }\n\n this.trx = undefined;\n this.params = trx.params;\n this.status = 'opened';\n\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.params!, this);\n } else {\n this.config.afterOpen?.(this.params!, this);\n }\n });\n\n return true;\n }\n\n private async confirmClosing() {\n if (this.status === 'closed') {\n return true;\n }\n\n const lastStatus = this.status;\n\n runInAction(() => {\n this.status = 'closing';\n });\n\n if ((await this.config.beforeClose?.()) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n if (this.config.close?.(this) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n runInAction(() => {\n this.status = 'closed';\n this.params = null;\n });\n\n this.config.afterClose?.();\n\n return true;\n }\n\n destroy() {\n this.isDestroyed = true;\n this.status = 'unknown';\n this.disposer?.();\n this.updateDisposer?.();\n }\n}\n\nexport const createVirtualRoute = <\n TParams extends AnyObject | EmptyObject = EmptyObject,\n TQueryParams extends Record<string, any> = AnyObject,\n>(\n config?: VirtualRouteConfiguration<TParams, TQueryParams>,\n) => new VirtualRoute<TParams, TQueryParams>(config);\n"],"names":["createGlobalDynamicConfig","isObservableHistory","createBrowserHistory","createQueryParams","annotations","computed","observable","applyObservable","reaction","comparer","match","compile","buildSearchString","parse","runInAction","action","callFunction"],"mappings":";;;;;;;AAWO,MAAM,cAAcA,QAAAA;AAAAA,EACzB,CAAC,QAAQ,YAAY;AACnB,QAAI;AACJ,QAAI;AAEJ,QAAI,QAAQ,SAAS;AACnB,gBAAU,OAAO;AACjB,oBAAc,O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EACP;AACF;AAEO,MAAM,qBAAqB,CAIhC,WACG,IAAI,aAAoC,MAAM;;;;;;;;;;"}
|
|
@@ -332,7 +332,10 @@ class Route {
|
|
|
332
332
|
state: rawState,
|
|
333
333
|
query: rawQuery,
|
|
334
334
|
mergeQuery: rawMergeQuery
|
|
335
|
-
} = typeof args[1] === "boolean" || args.length > 2 ? {
|
|
335
|
+
} = typeof args[1] === "boolean" || args.length > 2 ? {
|
|
336
|
+
replace: args[1],
|
|
337
|
+
query: args[2]
|
|
338
|
+
} : args[1] ?? {};
|
|
336
339
|
const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;
|
|
337
340
|
const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;
|
|
338
341
|
const params = typeof args[0] === "string" ? void 0 : args[0];
|
|
@@ -507,7 +510,10 @@ class Route {
|
|
|
507
510
|
this.updateDisposer = void 0;
|
|
508
511
|
}
|
|
509
512
|
}
|
|
510
|
-
const createRoute = (path, config) => new Route(
|
|
513
|
+
const createRoute = (path, config) => new Route(
|
|
514
|
+
path,
|
|
515
|
+
config
|
|
516
|
+
);
|
|
511
517
|
const annotations$2 = [
|
|
512
518
|
[computed, "isOpened", "indexRoute", "canNavigate"],
|
|
513
519
|
[observable.shallow, "routes"]
|
|
@@ -818,4 +824,4 @@ export {
|
|
|
818
824
|
groupRoutes as g,
|
|
819
825
|
routeConfig as r
|
|
820
826
|
};
|
|
821
|
-
//# sourceMappingURL=virtual-route-
|
|
827
|
+
//# sourceMappingURL=virtual-route-C7NPJx5y.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-route-C7NPJx5y.js","sources":["../src/core/config/config.ts","../src/core/route/route.ts","../src/core/route-group/route-group.ts","../src/core/router/router.ts","../src/core/virtual-route/virtual-route.ts"],"sourcesContent":["import {\n createBrowserHistory,\n createQueryParams,\n type History,\n type IQueryParams,\n isObservableHistory,\n} from 'mobx-location-history';\nimport { createGlobalDynamicConfig } from 'yummies/complex';\n\nimport type { RouteGlobalConfig } from './config.types.js';\n\nexport const routeConfig = createGlobalDynamicConfig<RouteGlobalConfig>(\n (update, current) => {\n let history: History;\n let queryParams: IQueryParams | undefined;\n\n if (update?.history) {\n history = update.history;\n queryParams = update.queryParams;\n\n if (current?.history && isObservableHistory(current.history)) {\n current.history.destroy();\n }\n } else if (current?.history) {\n history = current.history;\n queryParams = update?.queryParams ?? current.queryParams;\n } else {\n history = createBrowserHistory();\n }\n\n queryParams ??= createQueryParams({ history });\n\n return {\n ...update,\n history,\n queryParams,\n };\n },\n Symbol.for('MOBX_ROUTE_CONFIG'),\n);\n","import { comparer, computed, observable, reaction, runInAction } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport {\n compile,\n match,\n type ParamData,\n parse,\n type TokenData,\n} from 'path-to-regexp';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AnyRoute,\n CreatedUrlOutputParams,\n InputPathParams,\n NavigationTrx,\n ParsedPathData,\n ParsedPathParams,\n RouteConfiguration,\n RouteNavigateParams,\n UrlCreateParams,\n} from './route.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<Route<any, any, any, any, any>> =\n [\n [\n computed,\n 'isPathMatched',\n 'isOpened',\n 'isOpening',\n 'path',\n 'absolutePath',\n 'hasOpenedChildren',\n 'isAbleToMergeQuery',\n 'baseUrl',\n ],\n [computed.struct, 'parsedPathData', 'params'],\n [observable, 'children'],\n [observable.ref, 'parent', 'status'],\n ];\n\n/**\n * Class for creating path based route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)\n */\nexport class Route<\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any, any> | null = null,\n TQueryParams extends Record<string, any> = AnyObject,\n> {\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n protected history: History;\n\n /**\n * Parent route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)\n */\n parent: TParentRoute;\n\n query: IQueryParams<TQueryParams>;\n\n private _tokenData: TokenData | undefined;\n private _matcher?: ReturnType<typeof match>;\n private _compiler?: ReturnType<typeof compile>;\n private ignoreOpenByPathMatch = false;\n private isUpdate = false;\n private updateDisposer?: VoidFunction;\n\n protected status:\n | 'opening'\n | 'closed'\n | 'open-rejected'\n | 'open-confirmed'\n | 'unknown';\n\n meta?: AnyObject;\n\n /**\n * Route path pattern declaration.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#pathdeclaration)\n */\n pathDeclaration: TPath;\n\n /**\n * Indicates if this route is an index route. Index routes activate when parent route path matches exactly.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isindex)\n */\n isIndex: boolean;\n\n /**\n * Indicates if this route is an hash route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#ishash)\n */\n isHash: boolean;\n\n /**\n * Array of child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)\n */\n children: AnyRoute[] = [];\n\n constructor(\n pathDeclaration: TPath,\n protected config: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute,\n TQueryParams\n > = {},\n ) {\n this.history = config.history ?? routeConfig.get().history;\n this.query = (config.queryParams ??\n routeConfig.get().queryParams) as IQueryParams<TQueryParams>;\n this.pathDeclaration = pathDeclaration;\n this.isIndex = !!this.config.index;\n this.isHash = !!this.config.hash;\n this.meta = this.config.meta;\n this.status = 'unknown';\n this.parent = config.parent ?? (null as unknown as TParentRoute);\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(() => this.isPathMatched, this.checkPathMatch, {\n fireImmediately: true,\n });\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'open-confirmed') return undefined;\n return [this.parsedPathData, this.query.data] as const;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n if (!this.parsedPathData) return;\n this.config.afterUpdate?.(this.parsedPathData, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n this.config.abortSignal?.addEventListener('abort', () => this.destroy(), {\n once: true,\n });\n }\n }\n\n protected get baseUrl() {\n const baseUrl = this.config.baseUrl ?? routeConfig.get().baseUrl;\n return baseUrl?.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n }\n\n /**\n * Checks whether current route matches provided path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#matchpath)\n */\n matchPath(path?: Maybe<string>): ParsedPathData<TPath> | null {\n let pathnameToCheck: string;\n\n if (path != null) {\n pathnameToCheck = path;\n } else if (this.isHash) {\n pathnameToCheck = this.history.location.hash.slice(1);\n } else {\n pathnameToCheck = this.history.location.pathname;\n }\n\n if (this.baseUrl) {\n if (!pathnameToCheck.startsWith(this.baseUrl)) {\n return null;\n }\n\n pathnameToCheck = pathnameToCheck.replace(this.baseUrl, '');\n }\n\n if (\n (this.pathDeclaration === '' || this.pathDeclaration === '/') &&\n (pathnameToCheck === '/' || pathnameToCheck === '')\n ) {\n return { params: {} as any, path: pathnameToCheck };\n }\n\n this._matcher ??= match(this.tokenData, {\n end: this.config.exact ?? false,\n ...this.config.matchOptions,\n });\n const parsed = this._matcher(pathnameToCheck);\n\n if (parsed === false) {\n return null;\n }\n\n return parsed as ParsedPathData<TPath>;\n }\n\n protected get parsedPathData(): ParsedPathData<TPath> | null {\n return this.matchPath();\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopening)\n *\n * Also true in the short gap after history already matches this route but\n * `confirmOpening` has not started yet (e.g. browser Back) — otherwise every\n * route looks closed for one tick and RouteViewGroup unmounts the page.\n */\n get isOpening() {\n if (this.status === 'opening') {\n return true;\n }\n\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status === 'open-confirmed' ||\n this.status === 'open-rejected'\n ) {\n return false;\n }\n\n return this.status === 'closed' || this.status === 'unknown';\n }\n\n /**\n * Matched path segment for current URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#path)\n */\n get path(): string | null {\n return this.parsedPathData?.path ?? null;\n }\n\n /**\n * Matched path segment for current URL with base URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#absolutepath)\n */\n get absolutePath(): string | null {\n const path = this.path;\n\n if (path === null) {\n return null;\n }\n\n return `${this.baseUrl || ''}${path}`;\n }\n\n /**\n * Current parsed path parameters.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params)\n */\n get params(): TOutputParams | null {\n if (!this.parsedPathData?.params) {\n return null;\n }\n\n if (this.config.params) {\n const result = this.config.params(\n this.parsedPathData.params,\n this.config.meta,\n );\n return result || null;\n }\n\n return (\n (this.parsedPathData?.params as unknown as Maybe<TOutputParams>) ?? null\n );\n }\n\n protected get isPathMatched() {\n return this.parsedPathData !== null;\n }\n\n /**\n * Defines the \"open\" state for this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopened)\n */\n get isOpened() {\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status !== 'open-confirmed'\n ) {\n return false;\n }\n\n return (\n // this.parsedPathData is defined because this.params !== null\n !this.config.checkOpened || this.config.checkOpened(this.parsedPathData!)\n );\n }\n\n /**\n * Allows to create child route based on this route with merging this route path and extending path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)\n */\n extend<\n TExtendedPath extends string,\n TExtendedInputParams extends\n InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedOutputParams extends AnyObject = TInputParams &\n ParsedPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedQueryParams extends Record<string, any> = TQueryParams,\n >(\n pathDeclaration: TExtendedPath,\n config?: Omit<\n RouteConfiguration<\n `${TPath}${TExtendedPath}`,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n any,\n TExtendedQueryParams\n >,\n 'parent'\n >,\n ) {\n type ExtendedRoutePath = `${TPath}${TExtendedPath}`;\n type ParentRoute = this;\n const { index, params, exact, ...configFromCurrentRoute } = this.config;\n\n const extendedChild = new Route<\n ExtendedRoutePath,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n ParentRoute,\n TExtendedQueryParams\n >(`${this.pathDeclaration}${pathDeclaration}`, {\n ...configFromCurrentRoute,\n ...config,\n parent: this,\n } as any);\n\n this.addChildren(extendedChild as any);\n\n return extendedChild;\n }\n\n /**\n * Manually add child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#addchildren)\n */\n addChildren(...routes: AnyRoute[]) {\n this.children.push(...routes);\n }\n\n /**\n * Remove specified routes from children.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#removechildren)\n */\n removeChildren(...routes: AnyRoute[]) {\n this.children = this.children.filter((child) => !routes.includes(child));\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren)\n */\n get hasOpenedChildren(): boolean {\n return this.children.some(\n (child) => child.isOpened || child.hasOpenedChildren,\n );\n }\n\n protected processParams(\n params?: TInputParams | null | undefined,\n ): ParamData | undefined {\n if (params == null) return undefined;\n\n const result: ParamData = {};\n for (const [key, value] of Object.entries(params)) {\n if (value != null) {\n result[key] = Array.isArray(value) ? value.map(String) : String(value);\n }\n }\n return result;\n }\n\n /**\n * Generates full route URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)\n */\n createUrl(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: Maybe<TInputParams>,\n query?: Maybe<Partial<TQueryParams>>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n : [\n params: TInputParams,\n query?: Maybe<Partial<TQueryParams>>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n ) {\n const params = args[0];\n const rawQuery = args[1];\n const mergeQueryOrOutputParams = args[2] ?? this.isAbleToMergeQuery;\n const outputParams: Maybe<CreatedUrlOutputParams> =\n typeof mergeQueryOrOutputParams === 'boolean'\n ? { mergeQuery: mergeQueryOrOutputParams }\n : mergeQueryOrOutputParams;\n\n const query = outputParams?.mergeQuery\n ? { ...this.query.data, ...rawQuery }\n : (rawQuery ?? {});\n\n this._compiler ??= compile(this.tokenData);\n\n const defaultUrlCreateParams: UrlCreateParams<TInputParams, TQueryParams> =\n {\n baseUrl: this.baseUrl,\n params: params as TInputParams,\n query,\n };\n const urlCreateParams: UrlCreateParams<TInputParams, TQueryParams> =\n this.config.createUrl?.(defaultUrlCreateParams, this.query.data) ??\n routeConfig.get().createUrl?.(defaultUrlCreateParams, this.query.data) ??\n defaultUrlCreateParams;\n\n let path: string;\n\n try {\n path = this._compiler(this.processParams(urlCreateParams.params));\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'Error #1: Route path compilation failed\\n' +\n 'The path pattern could not be built into a URL (often missing or invalid params for a `:param` segment). Using fallbackPath or \"/\".\\n' +\n 'See docs: https://js2me.github.io/mobx-route/errors/1',\n e,\n );\n } else {\n console.error('minified error #1;see mobx-route docs', e);\n }\n path = this.config.fallbackPath ?? routeConfig.get().fallbackPath ?? '/';\n }\n\n const url = `${urlCreateParams.baseUrl || ''}${this.isHash ? '#' : ''}${path}`;\n\n if (outputParams?.omitQuery) {\n return url;\n }\n\n return `${url}${buildSearchString(urlCreateParams.query)}`;\n }\n\n /**\n * Navigates to this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open)\n */\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ]\n : [\n params: TInputParams,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ]\n ): Promise<void>;\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ]\n : [\n params: TInputParams,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ]\n ): Promise<void>;\n open(\n url: string,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n open(\n url: string,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n\n async open(...args: any[]) {\n const {\n replace,\n state: rawState,\n query: rawQuery,\n mergeQuery: rawMergeQuery,\n } = typeof args[1] === 'boolean' || args.length > 2\n ? ({\n replace: args[1],\n query: args[2],\n } as RouteNavigateParams<TQueryParams>)\n : ((args[1] ?? {}) as RouteNavigateParams<TQueryParams>);\n\n const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;\n const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;\n\n const params = typeof args[0] === 'string' ? undefined : args[0];\n const url =\n typeof args[0] === 'string' ? args[0] : this.createUrl(args[0], query);\n\n const trx: NavigationTrx<TInputParams, TQueryParams> = {\n url,\n params: params as TInputParams,\n replace,\n state: rawState ?? null,\n query,\n };\n\n this.isUpdate = this.status === 'open-confirmed';\n this.ignoreOpenByPathMatch = true;\n const isConfirmed = await this.confirmOpening(trx);\n\n if (isConfirmed !== true) {\n this.ignoreOpenByPathMatch = false;\n this.isUpdate = false;\n }\n }\n\n /**\n * Updates the current route if it is already open.\n * Unlike `open`, this is a no-op if the route is not open,\n * defaults to `replace: true` instead of push,\n * and defaults to `mergeQuery: true` when no query params are provided.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)\n */\n update(\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n update(\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n update(\n url: string,\n navigateParams?: RouteNavigateParams<TQueryParams>,\n ): Promise<void>;\n update(\n url: string,\n replace?: RouteNavigateParams<TQueryParams>['replace'],\n query?: RouteNavigateParams<TQueryParams>['query'],\n ): Promise<void>;\n\n async update(...args: any[]) {\n if (this.status !== 'open-confirmed') {\n return;\n }\n\n // Reuse current path params when omitted\n if (args[0] == null) {\n args[0] = this.parsedPathData?.params;\n }\n\n const secondArg = args[1];\n const isObjectParams = typeof secondArg === 'object' && secondArg !== null;\n\n if (isObjectParams) {\n args[1] = {\n replace: true,\n ...('query' in secondArg ? {} : { mergeQuery: true }),\n ...secondArg,\n };\n } else if (typeof secondArg === 'boolean') {\n if (args[2] === undefined) {\n args[1] = { replace: secondArg, mergeQuery: true };\n args.length = 2;\n }\n } else if (args.length === 1) {\n args[1] = { replace: true, mergeQuery: true };\n }\n\n return (this.open as (...args: any[]) => Promise<void>)(...args);\n }\n\n protected get tokenData() {\n if (!this._tokenData) {\n this._tokenData = parse(this.pathDeclaration, this.config.parseOptions);\n }\n return this._tokenData;\n }\n\n protected async confirmOpening(\n trx: NavigationTrx<TInputParams, TQueryParams>,\n ) {\n if (!this.isUpdate) {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n let skipHistoryUpdate = !!trx.preferSkipHistoryUpdate;\n\n if (skipHistoryUpdate) {\n this.ignoreOpenByPathMatch = false;\n }\n\n if (this.config.beforeOpen) {\n const feedback = await this.config.beforeOpen(trx);\n\n if (feedback === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n });\n\n return;\n }\n\n // Rebuild URL if beforeOpen mutated trx.params\n const newUrl = this.createUrl(\n trx.params as TInputParams,\n trx.query as AnyObject,\n );\n if (newUrl !== trx.url) {\n trx.url = newUrl;\n skipHistoryUpdate = false;\n }\n\n if (typeof feedback === 'object') {\n skipHistoryUpdate = false;\n Object.assign(trx, feedback);\n }\n }\n\n if (this.isDestroyed) {\n return;\n }\n\n if (!skipHistoryUpdate) {\n if (trx.replace) {\n this.history.replace(trx.url, trx.state);\n } else {\n this.history.push(trx.url, trx.state);\n }\n }\n\n if (this.isPathMatched) {\n const wasAlreadyConfirmed = this.status === 'open-confirmed';\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n\n if (this.isUpdate) {\n this.isUpdate = false;\n // afterUpdate handled by updateDisposer reaction\n } else if (!wasAlreadyConfirmed) {\n this.config.afterOpen?.(this.parsedPathData!, this);\n }\n }\n\n return true;\n }\n\n protected confirmClosing() {\n runInAction(() => {\n this.status = 'closed';\n });\n return true;\n }\n\n private firstPathMatchingRun = true;\n\n private checkPathMatch = async (isPathMathched: boolean) => {\n if (this.firstPathMatchingRun) {\n this.firstPathMatchingRun = false;\n // ignore first 'afterClose' callback call\n if (!isPathMathched) {\n return;\n }\n }\n\n if (isPathMathched) {\n // after manual open call\n if (this.ignoreOpenByPathMatch) {\n this.ignoreOpenByPathMatch = false;\n if (this.status === 'opening' && this.parsedPathData) {\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.parsedPathData, this);\n } else {\n this.config.afterOpen?.(this.parsedPathData, this);\n }\n }\n // update() delegates to confirmOpening\n return;\n }\n\n // Set opening sync to avoid isOpened/isOpening flicker\n if (this.status !== 'opening' && this.status !== 'open-confirmed') {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n // already confirmed\n if (this.status === 'open-confirmed') {\n return;\n }\n\n const trx: NavigationTrx<TInputParams, TQueryParams> = {\n url: `${this.parsedPathData!.path}${buildSearchString(this.query.data)}`,\n params: this.parsedPathData!.params as TInputParams,\n state: this.history.location.state,\n query: this.query.data,\n preferSkipHistoryUpdate: true,\n };\n\n await this.confirmOpening(trx);\n } else {\n this.ignoreOpenByPathMatch = false;\n\n const isConfirmed = this.confirmClosing();\n\n if (isConfirmed) {\n this.config.afterClose?.();\n }\n }\n };\n\n private get isAbleToMergeQuery() {\n return this.config.mergeQuery ?? routeConfig.get().mergeQuery;\n }\n\n /**\n * Destroys route subscriptions and reactions.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#destroy)\n */\n destroy() {\n this.isDestroyed = true;\n this.disposer?.();\n this.disposer = undefined;\n this.updateDisposer?.();\n this.updateDisposer = undefined;\n }\n}\n\nexport const createRoute = <\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any, any> | null = null,\n TQueryParams extends Record<string, any> = AnyObject,\n>(\n path: TPath,\n config?: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute,\n TQueryParams\n >,\n) =>\n new Route<TPath, TInputParams, TOutputParams, TParentRoute, TQueryParams>(\n path,\n config,\n );\n","import { computed, observable } from 'mobx';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type {\n AbstractRouteGroup,\n AnyRouteEntity,\n RoutesCollection,\n} from './route-group.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<RouteGroup<any>> = [\n [computed, 'isOpened', 'indexRoute', 'canNavigate'],\n [observable.shallow, 'routes'],\n];\n\n/**\n * Class for grouping related routes and managing their state.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport class RouteGroup<TRoutesCollection extends RoutesCollection>\n implements AbstractRouteGroup<TRoutesCollection>\n{\n routes: TRoutesCollection;\n\n constructor(\n routes: TRoutesCollection,\n private _indexRoute?: AnyRouteEntity,\n ) {\n this.routes = routes;\n\n applyObservable(this, annotations);\n }\n\n /**\n * Returns true if at least one route in the group is open.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#isopened)\n */\n get isOpened(): boolean {\n const routes = Object.values(this.routes);\n return routes.some(\n (route) =>\n route.isOpened ||\n ('hasOpenedChildren' in route && route.hasOpenedChildren),\n );\n }\n\n /**\n * First found index route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#indexroute)\n */\n get indexRoute(): AnyRouteEntity | undefined {\n return (this._indexRoute ??\n Object.values(this.routes).find(\n (route) => 'isIndex' in route && route.isIndex,\n )) as unknown as AnyRouteEntity;\n }\n\n /**\n * `true` if `open()` has a target to navigate to —\n * either an own index route or a nested `RouteGroup` that itself can navigate.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#cannavigate)\n */\n get canNavigate(): boolean {\n if (this.indexRoute) return true;\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Main navigation method for the group.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#open)\n */\n open(...args: any[]) {\n if (this.indexRoute && 'open' in this.indexRoute) {\n this.indexRoute.open(...args);\n return;\n }\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n route.open(...args);\n return;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Warning #1: RouteGroup.open() cannot navigate\\n' +\n 'This group has no index route (`index: true` or `groupRoutes(routes, indexRoute)`) and no navigable nested RouteGroup, so open() does nothing.\\n' +\n 'See docs: https://js2me.github.io/mobx-route/warnings/1',\n );\n } else {\n console.warn('minified warning #1;see mobx-route docs');\n }\n }\n}\n\n/**\n * Helper for creating route groups.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport const groupRoutes = <TRoutesCollection extends RoutesCollection>(\n routes: TRoutesCollection,\n indexRoute?: AnyRouteEntity,\n) => new RouteGroup<TRoutesCollection>(routes, indexRoute);\n","import { computed } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport { routeConfig } from '../config/index.js';\nimport type { RoutesCollection } from '../route-group/index.js';\nimport type {\n RouterConfiguration,\n RouterNavigateOptions,\n} from './router.types.js';\n\nconst annotations: ObservableAnnotationsArray<Router<any>> = [\n [computed.struct, 'location'],\n];\n\n/**\n * Class for centralized routing management.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)\n */\nexport class Router<TRoutesCollection extends RoutesCollection> {\n routes: TRoutesCollection;\n history: History;\n query: IQueryParams;\n\n constructor(config: RouterConfiguration<TRoutesCollection>) {\n this.routes = config.routes;\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n\n applyObservable(this, annotations);\n }\n\n get location() {\n return this.history.location;\n }\n\n navigate(url: string, options?: RouterNavigateOptions) {\n const query =\n (options?.mergeQuery ?? routeConfig.get().mergeQuery)\n ? { ...this.query.data, ...options?.query }\n : { ...options?.query };\n\n const searchString = buildSearchString(query);\n const navigationUrl = `${url}${searchString}`;\n\n if (options?.replace) {\n this.history.replace(navigationUrl, options?.state);\n } else {\n this.history.push(navigationUrl, options?.state);\n }\n }\n}\n\nexport const createRouter = <TRoutesCollection extends RoutesCollection>(\n config: RouterConfiguration<TRoutesCollection>,\n) => new Router(config);\n","import {\n action,\n comparer,\n computed,\n observable,\n reaction,\n runInAction,\n} from 'mobx';\nimport type { IQueryParams } from 'mobx-location-history';\nimport { callFunction } from 'yummies/common';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AbstractVirtualRoute,\n VirtualOpenExtraParams,\n VirtualRouteConfiguration,\n VirtualRouteTrx,\n} from './virtual-route.types.js';\n\nconst annotations: ObservableAnnotationsArray<VirtualRoute<any>> = [\n [observable, 'params'],\n [observable.ref, 'status', 'trx', 'openChecker', 'isOuterOpened'],\n [computed, 'isOpened', 'isOpening', 'isClosing'],\n [action, 'setOpenChecker', 'open', 'close', 'destroy'],\n];\n\n/**\n * Class for creating routes with custom activation logic\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)\n */\nexport class VirtualRoute<\n TParams extends AnyObject | EmptyObject = EmptyObject,\n TQueryParams extends Record<string, any> = AnyObject,\n> implements AbstractVirtualRoute<TParams, TQueryParams>\n{\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n query: IQueryParams<TQueryParams>;\n params: TParams | null;\n\n protected status:\n | 'opening'\n | 'open-rejected'\n | 'opened'\n | 'closing'\n | 'closed'\n | 'unknown';\n\n private openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>;\n\n private trx: Maybe<VirtualRouteTrx>;\n\n private skipAutoOpenClose: boolean;\n\n private isUpdate = false;\n\n private updateDisposer?: VoidFunction;\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isouteropened)\n */\n isOuterOpened: boolean | undefined;\n\n constructor(\n protected config: VirtualRouteConfiguration<TParams, TQueryParams> = {},\n ) {\n this.query = (config.queryParams ??\n routeConfig.get().queryParams) as IQueryParams<TQueryParams>;\n this.params = callFunction(config.initialParams, this) ?? null;\n this.openChecker = config.checkOpened;\n this.skipAutoOpenClose = false;\n this.isOuterOpened = this.openChecker?.(this);\n this.status = this.isOuterOpened ? 'opened' : 'unknown';\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(\n () => this.openChecker?.(this),\n action((isOuterOpened) => {\n this.isOuterOpened = isOuterOpened;\n\n if (\n this.skipAutoOpenClose ||\n this.status === 'closing' ||\n this.status === 'opening'\n ) {\n return;\n }\n\n if (this.isOuterOpened) {\n if (this.status === 'opened') {\n return;\n }\n void this.confirmOpening({\n params: this.params ?? null,\n ...this.config.getAutoOpenParams?.(this),\n });\n } else {\n if (this.status === 'closed' || this.status === 'unknown') {\n return;\n }\n void this.confirmClosing();\n }\n }),\n { signal: this.config.abortSignal, fireImmediately: true },\n );\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'opened') return undefined;\n return this.query.data;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n this.config.afterUpdate?.(this.params, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n }\n\n if (this.status === 'opened') {\n this.config.afterOpen?.(this.params, this);\n }\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened)\n */\n get isOpened() {\n return (\n !this.isDestroyed &&\n this.status === 'opened' &&\n this.isOuterOpened !== false\n );\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopening)\n */\n get isOpening() {\n return this.status === 'opening';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isclosing)\n */\n get isClosing() {\n return this.status === 'closing';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker)\n */\n setOpenChecker(\n openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>,\n ) {\n this.openChecker = openChecker;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)\n */\n open(\n ...args: IsPartial<TParams> extends true\n ? [\n params?: Maybe<TParams>,\n extraParams?: VirtualOpenExtraParams<TQueryParams>,\n ]\n : [params: TParams, extraParams?: VirtualOpenExtraParams<TQueryParams>]\n ): Promise<void>;\n async open(...args: any[]) {\n const params = (args[0] ?? null) as unknown as TParams;\n const extra: Maybe<VirtualOpenExtraParams> = args[1];\n\n this.isUpdate = this.status === 'opened';\n this.skipAutoOpenClose = true;\n\n this.trx = {\n params,\n extra,\n manual: true,\n };\n\n await this.confirmOpening(this.trx);\n\n this.skipAutoOpenClose = false;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)\n */\n async close() {\n this.skipAutoOpenClose = true;\n const result = await this.confirmClosing();\n this.skipAutoOpenClose = false;\n return result;\n }\n\n private async confirmOpening(trx: VirtualRouteTrx) {\n runInAction(() => {\n this.trx = undefined;\n this.status = 'opening';\n });\n\n if ((await this.config.beforeOpen?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n if ((await this.config.open?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n runInAction(() => {\n if (trx.extra?.query) {\n this.query.update(trx.extra.query, trx.extra.replace);\n }\n\n this.trx = undefined;\n this.params = trx.params;\n this.status = 'opened';\n\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.params!, this);\n } else {\n this.config.afterOpen?.(this.params!, this);\n }\n });\n\n return true;\n }\n\n private async confirmClosing() {\n if (this.status === 'closed') {\n return true;\n }\n\n const lastStatus = this.status;\n\n runInAction(() => {\n this.status = 'closing';\n });\n\n if ((await this.config.beforeClose?.()) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n if (this.config.close?.(this) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n runInAction(() => {\n this.status = 'closed';\n this.params = null;\n });\n\n this.config.afterClose?.();\n\n return true;\n }\n\n destroy() {\n this.isDestroyed = true;\n this.status = 'unknown';\n this.disposer?.();\n this.updateDisposer?.();\n }\n}\n\nexport const createVirtualRoute = <\n TParams extends AnyObject | EmptyObject = EmptyObject,\n TQueryParams extends Record<string, any> = AnyObject,\n>(\n config?: VirtualRouteConfiguration<TParams, TQueryParams>,\n) => new VirtualRoute<TParams, TQueryParams>(config);\n"],"names":["annotations"],"mappings":";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AAChB,aAAK,SAAS;AACd,aAAK,MAAM;AAAA,MACb,CAAC;AACD;AAAA,IACF;AAEA,gBAAY,MAAM;AAChB,UAAI,IAAI,OAAO,OAAO;AACpB,aAAK,MAAM,OAAO,IAAI,MAAM,OAAO,IAAI,MAAM,OAAO;AAAA,MACtD;AAEA,WAAK,MAAM;AACX,WAAK,SAAS,IAAI;AAClB,WAAK,SAAS;AAEd,UAAI,KAAK,UAAU;AACjB,aAAK,WAAW;AAChB,aAAK,OAAO,cAAc,KAAK,QAAS,IAAI;AAAA,MAC9C,OAAO;AACL,aAAK,OAAO,YAAY,KAAK,QAAS,IAAI;AAAA,MAC5C;AAAA,IACF,CAAC;AAED,WAAO;AAAA,EACT;AAAA,EAEA,MAAc,iBAAiB;AAC7B,QAAI,KAAK,WAAW,UAAU;AAC5B,aAAO;AAAA,IACT;AAEA,UAAM,aAAa,KAAK;AAExB,gBAAY,MAAM;AAChB,WAAK,SAAS;AAAA,IAChB,CAAC;AAED,QAAK,MAAM,KAAK,OAAO,cAAA,MAAqB,OAAO;AACjD,kBAAY,MAAM;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AACD;AAAA,IACF;AAEA,QAAI,KAAK,OAAO,QAAQ,IAAI,MAAM,OAAO;AACvC,kBAAY,MAAM;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AACD;AAAA,IACF;AAEA,gBAAY,MAAM;AAChB,WAAK,SAAS;AACd,WAAK,SAAS;AAAA,IAChB,CAAC;AAED,SAAK,OAAO,aAAA;AAEZ,WAAO;AAAA,EACT;AAAA,EAEA,UAAU;AACR,SAAK,cAAc;AACnB,SAAK,SAAS;AACd,SAAK,WAAA;AACL,SAAK,iBAAA;AAAA,EACP;AACF;AAEO,MAAM,qBAAqB,CAIhC,WACG,IAAI,aAAoC,MAAM;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-route-Chv5K9C8.js","sources":["../src/core/config/config.ts","../src/core/route/route.ts","../src/core/route-group/route-group.ts","../src/core/router/router.ts","../src/core/virtual-route/virtual-route.ts"],"sourcesContent":["import {\n createBrowserHistory,\n createQueryParams,\n type History,\n type IQueryParams,\n isObservableHistory,\n} from 'mobx-location-history';\nimport { createGlobalDynamicConfig } from 'yummies/complex';\n\nimport type { RouteGlobalConfig } from './config.types.js';\n\nexport const routeConfig = createGlobalDynamicConfig<RouteGlobalConfig>(\n (update, current) => {\n let history: History;\n let queryParams: IQueryParams | undefined;\n\n if (update?.history) {\n history = update.history;\n queryParams = update.queryParams;\n\n if (current?.history && isObservableHistory(current.history)) {\n current.history.destroy();\n }\n } else if (current?.history) {\n history = current.history;\n queryParams = update?.queryParams ?? current.queryParams;\n } else {\n history = createBrowserHistory();\n }\n\n queryParams ??= createQueryParams({ history });\n\n return {\n ...update,\n history,\n queryParams,\n };\n },\n Symbol.for('MOBX_ROUTE_CONFIG'),\n);\n","import { comparer, computed, observable, reaction, runInAction } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport {\n compile,\n match,\n type ParamData,\n parse,\n type TokenData,\n} from 'path-to-regexp';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AnyRoute,\n CreatedUrlOutputParams,\n InputPathParams,\n NavigationTrx,\n ParsedPathData,\n ParsedPathParams,\n RouteConfiguration,\n RouteNavigateParams,\n UrlCreateParams,\n} from './route.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<Route<any, any, any, any>> = [\n [\n computed,\n 'isPathMatched',\n 'isOpened',\n 'isOpening',\n 'path',\n 'absolutePath',\n 'hasOpenedChildren',\n 'isAbleToMergeQuery',\n 'baseUrl',\n ],\n [computed.struct, 'parsedPathData', 'params'],\n [observable, 'children'],\n [observable.ref, 'parent', 'status'],\n];\n\n/**\n * Class for creating path based route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)\n */\nexport class Route<\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any> | null = null,\n> {\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n protected history: History;\n\n /**\n * Parent route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)\n */\n parent: TParentRoute;\n\n query: IQueryParams;\n\n private _tokenData: TokenData | undefined;\n private _matcher?: ReturnType<typeof match>;\n private _compiler?: ReturnType<typeof compile>;\n private ignoreOpenByPathMatch = false;\n private isUpdate = false;\n private updateDisposer?: VoidFunction;\n\n protected status:\n | 'opening'\n | 'closed'\n | 'open-rejected'\n | 'open-confirmed'\n | 'unknown';\n\n meta?: AnyObject;\n\n /**\n * Route path pattern declaration.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#pathdeclaration)\n */\n pathDeclaration: TPath;\n\n /**\n * Indicates if this route is an index route. Index routes activate when parent route path matches exactly.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isindex)\n */\n isIndex: boolean;\n\n /**\n * Indicates if this route is an hash route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#ishash)\n */\n isHash: boolean;\n\n /**\n * Array of child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)\n */\n children: AnyRoute[] = [];\n\n constructor(\n pathDeclaration: TPath,\n protected config: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute\n > = {},\n ) {\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n this.pathDeclaration = pathDeclaration;\n this.isIndex = !!this.config.index;\n this.isHash = !!this.config.hash;\n this.meta = this.config.meta;\n this.status = 'unknown';\n this.parent = config.parent ?? (null as unknown as TParentRoute);\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(() => this.isPathMatched, this.checkPathMatch, {\n fireImmediately: true,\n });\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'open-confirmed') return undefined;\n return [this.parsedPathData, this.query.data] as const;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n if (!this.parsedPathData) return;\n this.config.afterUpdate?.(this.parsedPathData, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n this.config.abortSignal?.addEventListener('abort', () => this.destroy(), {\n once: true,\n });\n }\n }\n\n protected get baseUrl() {\n const baseUrl = this.config.baseUrl ?? routeConfig.get().baseUrl;\n return baseUrl?.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n }\n\n /**\n * Checks whether current route matches provided path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#matchpath)\n */\n matchPath(path?: Maybe<string>): ParsedPathData<TPath> | null {\n let pathnameToCheck: string;\n\n if (path != null) {\n pathnameToCheck = path;\n } else if (this.isHash) {\n pathnameToCheck = this.history.location.hash.slice(1);\n } else {\n pathnameToCheck = this.history.location.pathname;\n }\n\n if (this.baseUrl) {\n if (!pathnameToCheck.startsWith(this.baseUrl)) {\n return null;\n }\n\n pathnameToCheck = pathnameToCheck.replace(this.baseUrl, '');\n }\n\n if (\n (this.pathDeclaration === '' || this.pathDeclaration === '/') &&\n (pathnameToCheck === '/' || pathnameToCheck === '')\n ) {\n return { params: {} as any, path: pathnameToCheck };\n }\n\n this._matcher ??= match(this.tokenData, {\n end: this.config.exact ?? false,\n ...this.config.matchOptions,\n });\n const parsed = this._matcher(pathnameToCheck);\n\n if (parsed === false) {\n return null;\n }\n\n return parsed as ParsedPathData<TPath>;\n }\n\n protected get parsedPathData(): ParsedPathData<TPath> | null {\n return this.matchPath();\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopening)\n *\n * Also true in the short gap after history already matches this route but\n * `confirmOpening` has not started yet (e.g. browser Back) — otherwise every\n * route looks closed for one tick and RouteViewGroup unmounts the page.\n */\n get isOpening() {\n if (this.status === 'opening') {\n return true;\n }\n\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status === 'open-confirmed' ||\n this.status === 'open-rejected'\n ) {\n return false;\n }\n\n return this.status === 'closed' || this.status === 'unknown';\n }\n\n /**\n * Matched path segment for current URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#path)\n */\n get path(): string | null {\n return this.parsedPathData?.path ?? null;\n }\n\n /**\n * Matched path segment for current URL with base URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#absolutepath)\n */\n get absolutePath(): string | null {\n const path = this.path;\n\n if (path === null) {\n return null;\n }\n\n return `${this.baseUrl || ''}${path}`;\n }\n\n /**\n * Current parsed path parameters.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params)\n */\n get params(): TOutputParams | null {\n if (!this.parsedPathData?.params) {\n return null;\n }\n\n if (this.config.params) {\n const result = this.config.params(\n this.parsedPathData.params,\n this.config.meta,\n );\n return result || null;\n }\n\n return (\n (this.parsedPathData?.params as unknown as Maybe<TOutputParams>) ?? null\n );\n }\n\n protected get isPathMatched() {\n return this.parsedPathData !== null;\n }\n\n /**\n * Defines the \"open\" state for this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopened)\n */\n get isOpened() {\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status !== 'open-confirmed'\n ) {\n return false;\n }\n\n return (\n // this.parsedPathData is defined because this.params !== null\n !this.config.checkOpened || this.config.checkOpened(this.parsedPathData!)\n );\n }\n\n /**\n * Allows to create child route based on this route with merging this route path and extending path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)\n */\n extend<\n TExtendedPath extends string,\n TExtendedInputParams extends\n InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedOutputParams extends AnyObject = TInputParams &\n ParsedPathParams<`${TPath}${TExtendedPath}`>,\n >(\n pathDeclaration: TExtendedPath,\n config?: Omit<\n RouteConfiguration<\n `${TPath}${TExtendedPath}`,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n any\n >,\n 'parent'\n >,\n ) {\n type ExtendedRoutePath = `${TPath}${TExtendedPath}`;\n type ParentRoute = this;\n const { index, params, exact, ...configFromCurrentRoute } = this.config;\n\n const extendedChild = new Route<\n ExtendedRoutePath,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n ParentRoute\n >(`${this.pathDeclaration}${pathDeclaration}`, {\n ...configFromCurrentRoute,\n ...config,\n parent: this,\n } as any);\n\n this.addChildren(extendedChild as any);\n\n return extendedChild;\n }\n\n /**\n * Manually add child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#addchildren)\n */\n addChildren(...routes: AnyRoute[]) {\n this.children.push(...routes);\n }\n\n /**\n * Remove specified routes from children.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#removechildren)\n */\n removeChildren(...routes: AnyRoute[]) {\n this.children = this.children.filter((child) => !routes.includes(child));\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren)\n */\n get hasOpenedChildren(): boolean {\n return this.children.some(\n (child) => child.isOpened || child.hasOpenedChildren,\n );\n }\n\n protected processParams(\n params?: TInputParams | null | undefined,\n ): ParamData | undefined {\n if (params == null) return undefined;\n\n const result: ParamData = {};\n for (const [key, value] of Object.entries(params)) {\n if (value != null) {\n result[key] = Array.isArray(value) ? value.map(String) : String(value);\n }\n }\n return result;\n }\n\n /**\n * Generates full route URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)\n */\n createUrl(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: Maybe<TInputParams>,\n query?: Maybe<AnyObject>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n : [\n params: TInputParams,\n query?: Maybe<AnyObject>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n ) {\n const params = args[0];\n const rawQuery = args[1];\n const mergeQueryOrOutputParams = args[2] ?? this.isAbleToMergeQuery;\n const outputParams: Maybe<CreatedUrlOutputParams> =\n typeof mergeQueryOrOutputParams === 'boolean'\n ? { mergeQuery: mergeQueryOrOutputParams }\n : mergeQueryOrOutputParams;\n\n const query = outputParams?.mergeQuery\n ? { ...this.query.data, ...rawQuery }\n : (rawQuery ?? {});\n\n this._compiler ??= compile(this.tokenData);\n\n const defaultUrlCreateParams: UrlCreateParams<TInputParams> = {\n baseUrl: this.baseUrl,\n params: params as TInputParams,\n query,\n };\n const urlCreateParams: UrlCreateParams<TInputParams> =\n this.config.createUrl?.(defaultUrlCreateParams, this.query.data) ??\n routeConfig.get().createUrl?.(defaultUrlCreateParams, this.query.data) ??\n defaultUrlCreateParams;\n\n let path: string;\n\n try {\n path = this._compiler(this.processParams(urlCreateParams.params));\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'Error #1: Route path compilation failed\\n' +\n 'The path pattern could not be built into a URL (often missing or invalid params for a `:param` segment). Using fallbackPath or \"/\".\\n' +\n 'See docs: https://js2me.github.io/mobx-route/errors/1',\n e,\n );\n } else {\n console.error('minified error #1;see mobx-route docs', e);\n }\n path = this.config.fallbackPath ?? routeConfig.get().fallbackPath ?? '/';\n }\n\n const url = `${urlCreateParams.baseUrl || ''}${this.isHash ? '#' : ''}${path}`;\n\n if (outputParams?.omitQuery) {\n return url;\n }\n\n return `${url}${buildSearchString(urlCreateParams.query)}`;\n }\n\n /**\n * Navigates to this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open)\n */\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams,\n ]\n : [params: TInputParams, navigateParams?: RouteNavigateParams]\n ): Promise<void>;\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ]\n : [\n params: TInputParams,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ]\n ): Promise<void>;\n open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;\n open(\n url: string,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n\n async open(...args: any[]) {\n const {\n replace,\n state: rawState,\n query: rawQuery,\n mergeQuery: rawMergeQuery,\n } = typeof args[1] === 'boolean' || args.length > 2\n ? ({ replace: args[1], query: args[2] } as RouteNavigateParams)\n : ((args[1] ?? {}) as RouteNavigateParams);\n\n const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;\n const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;\n\n const params = typeof args[0] === 'string' ? undefined : args[0];\n const url =\n typeof args[0] === 'string' ? args[0] : this.createUrl(args[0], query);\n\n const trx: NavigationTrx<TInputParams> = {\n url,\n params: params as TInputParams,\n replace,\n state: rawState ?? null,\n query,\n };\n\n this.isUpdate = this.status === 'open-confirmed';\n this.ignoreOpenByPathMatch = true;\n const isConfirmed = await this.confirmOpening(trx);\n\n if (isConfirmed !== true) {\n this.ignoreOpenByPathMatch = false;\n this.isUpdate = false;\n }\n }\n\n /**\n * Updates the current route if it is already open.\n * Unlike `open`, this is a no-op if the route is not open,\n * defaults to `replace: true` instead of push,\n * and defaults to `mergeQuery: true` when no query params are provided.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)\n */\n update(\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams,\n ): Promise<void>;\n update(\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;\n update(\n url: string,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n\n async update(...args: any[]) {\n if (this.status !== 'open-confirmed') {\n return;\n }\n\n // Reuse current path params when omitted\n if (args[0] == null) {\n args[0] = this.parsedPathData?.params;\n }\n\n const secondArg = args[1];\n const isObjectParams = typeof secondArg === 'object' && secondArg !== null;\n\n if (isObjectParams) {\n args[1] = {\n replace: true,\n ...('query' in secondArg ? {} : { mergeQuery: true }),\n ...secondArg,\n };\n } else if (typeof secondArg === 'boolean') {\n if (args[2] === undefined) {\n args[1] = { replace: secondArg, mergeQuery: true };\n args.length = 2;\n }\n } else if (args.length === 1) {\n args[1] = { replace: true, mergeQuery: true };\n }\n\n return (this.open as (...args: any[]) => Promise<void>)(...args);\n }\n\n protected get tokenData() {\n if (!this._tokenData) {\n this._tokenData = parse(this.pathDeclaration, this.config.parseOptions);\n }\n return this._tokenData;\n }\n\n protected async confirmOpening(trx: NavigationTrx<TInputParams>) {\n if (!this.isUpdate) {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n let skipHistoryUpdate = !!trx.preferSkipHistoryUpdate;\n\n if (skipHistoryUpdate) {\n this.ignoreOpenByPathMatch = false;\n }\n\n if (this.config.beforeOpen) {\n const feedback = await this.config.beforeOpen(trx);\n\n if (feedback === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n });\n\n return;\n }\n\n // Rebuild URL if beforeOpen mutated trx.params\n const newUrl = this.createUrl(\n trx.params as TInputParams,\n trx.query as AnyObject,\n );\n if (newUrl !== trx.url) {\n trx.url = newUrl;\n skipHistoryUpdate = false;\n }\n\n if (typeof feedback === 'object') {\n skipHistoryUpdate = false;\n Object.assign(trx, feedback);\n }\n }\n\n if (this.isDestroyed) {\n return;\n }\n\n if (!skipHistoryUpdate) {\n if (trx.replace) {\n this.history.replace(trx.url, trx.state);\n } else {\n this.history.push(trx.url, trx.state);\n }\n }\n\n if (this.isPathMatched) {\n const wasAlreadyConfirmed = this.status === 'open-confirmed';\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n\n if (this.isUpdate) {\n this.isUpdate = false;\n // afterUpdate handled by updateDisposer reaction\n } else if (!wasAlreadyConfirmed) {\n this.config.afterOpen?.(this.parsedPathData!, this);\n }\n }\n\n return true;\n }\n\n protected confirmClosing() {\n runInAction(() => {\n this.status = 'closed';\n });\n return true;\n }\n\n private firstPathMatchingRun = true;\n\n private checkPathMatch = async (isPathMathched: boolean) => {\n if (this.firstPathMatchingRun) {\n this.firstPathMatchingRun = false;\n // ignore first 'afterClose' callback call\n if (!isPathMathched) {\n return;\n }\n }\n\n if (isPathMathched) {\n // after manual open call\n if (this.ignoreOpenByPathMatch) {\n this.ignoreOpenByPathMatch = false;\n if (this.status === 'opening' && this.parsedPathData) {\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.parsedPathData, this);\n } else {\n this.config.afterOpen?.(this.parsedPathData, this);\n }\n }\n // update() delegates to confirmOpening\n return;\n }\n\n // Set opening sync to avoid isOpened/isOpening flicker\n if (this.status !== 'opening' && this.status !== 'open-confirmed') {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n // already confirmed\n if (this.status === 'open-confirmed') {\n return;\n }\n\n const trx: NavigationTrx<TInputParams> = {\n url: `${this.parsedPathData!.path}${buildSearchString(this.query.data)}`,\n params: this.parsedPathData!.params as TInputParams,\n state: this.history.location.state,\n query: this.query.data,\n preferSkipHistoryUpdate: true,\n };\n\n await this.confirmOpening(trx);\n } else {\n this.ignoreOpenByPathMatch = false;\n\n const isConfirmed = this.confirmClosing();\n\n if (isConfirmed) {\n this.config.afterClose?.();\n }\n }\n };\n\n private get isAbleToMergeQuery() {\n return this.config.mergeQuery ?? routeConfig.get().mergeQuery;\n }\n\n /**\n * Destroys route subscriptions and reactions.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#destroy)\n */\n destroy() {\n this.isDestroyed = true;\n this.disposer?.();\n this.disposer = undefined;\n this.updateDisposer?.();\n this.updateDisposer = undefined;\n }\n}\n\nexport const createRoute = <\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any> | null = null,\n>(\n path: TPath,\n config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>,\n) => new Route<TPath, TInputParams, TOutputParams, TParentRoute>(path, config);\n","import { computed, observable } from 'mobx';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type {\n AbstractRouteGroup,\n AnyRouteEntity,\n RoutesCollection,\n} from './route-group.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<RouteGroup<any>> = [\n [computed, 'isOpened', 'indexRoute', 'canNavigate'],\n [observable.shallow, 'routes'],\n];\n\n/**\n * Class for grouping related routes and managing their state.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport class RouteGroup<TRoutesCollection extends RoutesCollection>\n implements AbstractRouteGroup<TRoutesCollection>\n{\n routes: TRoutesCollection;\n\n constructor(\n routes: TRoutesCollection,\n private _indexRoute?: AnyRouteEntity,\n ) {\n this.routes = routes;\n\n applyObservable(this, annotations);\n }\n\n /**\n * Returns true if at least one route in the group is open.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#isopened)\n */\n get isOpened(): boolean {\n const routes = Object.values(this.routes);\n return routes.some(\n (route) =>\n route.isOpened ||\n ('hasOpenedChildren' in route && route.hasOpenedChildren),\n );\n }\n\n /**\n * First found index route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#indexroute)\n */\n get indexRoute(): AnyRouteEntity | undefined {\n return (this._indexRoute ??\n Object.values(this.routes).find(\n (route) => 'isIndex' in route && route.isIndex,\n )) as unknown as AnyRouteEntity;\n }\n\n /**\n * `true` if `open()` has a target to navigate to —\n * either an own index route or a nested `RouteGroup` that itself can navigate.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#cannavigate)\n */\n get canNavigate(): boolean {\n if (this.indexRoute) return true;\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Main navigation method for the group.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#open)\n */\n open(...args: any[]) {\n if (this.indexRoute && 'open' in this.indexRoute) {\n this.indexRoute.open(...args);\n return;\n }\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n route.open(...args);\n return;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Warning #1: RouteGroup.open() cannot navigate\\n' +\n 'This group has no index route (`index: true` or `groupRoutes(routes, indexRoute)`) and no navigable nested RouteGroup, so open() does nothing.\\n' +\n 'See docs: https://js2me.github.io/mobx-route/warnings/1',\n );\n } else {\n console.warn('minified warning #1;see mobx-route docs');\n }\n }\n}\n\n/**\n * Helper for creating route groups.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport const groupRoutes = <TRoutesCollection extends RoutesCollection>(\n routes: TRoutesCollection,\n indexRoute?: AnyRouteEntity,\n) => new RouteGroup<TRoutesCollection>(routes, indexRoute);\n","import { computed } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport { routeConfig } from '../config/index.js';\nimport type { RoutesCollection } from '../route-group/index.js';\nimport type {\n RouterConfiguration,\n RouterNavigateOptions,\n} from './router.types.js';\n\nconst annotations: ObservableAnnotationsArray<Router<any>> = [\n [computed.struct, 'location'],\n];\n\n/**\n * Class for centralized routing management.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)\n */\nexport class Router<TRoutesCollection extends RoutesCollection> {\n routes: TRoutesCollection;\n history: History;\n query: IQueryParams;\n\n constructor(config: RouterConfiguration<TRoutesCollection>) {\n this.routes = config.routes;\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n\n applyObservable(this, annotations);\n }\n\n get location() {\n return this.history.location;\n }\n\n navigate(url: string, options?: RouterNavigateOptions) {\n const query =\n (options?.mergeQuery ?? routeConfig.get().mergeQuery)\n ? { ...this.query.data, ...options?.query }\n : { ...options?.query };\n\n const searchString = buildSearchString(query);\n const navigationUrl = `${url}${searchString}`;\n\n if (options?.replace) {\n this.history.replace(navigationUrl, options?.state);\n } else {\n this.history.push(navigationUrl, options?.state);\n }\n }\n}\n\nexport const createRouter = <TRoutesCollection extends RoutesCollection>(\n config: RouterConfiguration<TRoutesCollection>,\n) => new Router(config);\n","import {\n action,\n comparer,\n computed,\n observable,\n reaction,\n runInAction,\n} from 'mobx';\nimport type { IQueryParams } from 'mobx-location-history';\nimport { callFunction } from 'yummies/common';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AbstractVirtualRoute,\n VirtualOpenExtraParams,\n VirtualRouteConfiguration,\n VirtualRouteTrx,\n} from './virtual-route.types.js';\n\nconst annotations: ObservableAnnotationsArray<VirtualRoute<any>> = [\n [observable, 'params'],\n [observable.ref, 'status', 'trx', 'openChecker', 'isOuterOpened'],\n [computed, 'isOpened', 'isOpening', 'isClosing'],\n [action, 'setOpenChecker', 'open', 'close', 'destroy'],\n];\n\n/**\n * Class for creating routes with custom activation logic\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)\n */\nexport class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject>\n implements AbstractVirtualRoute<TParams>\n{\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n query: IQueryParams;\n params: TParams | null;\n\n protected status:\n | 'opening'\n | 'open-rejected'\n | 'opened'\n | 'closing'\n | 'closed'\n | 'unknown';\n\n private openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>;\n\n private trx: Maybe<VirtualRouteTrx>;\n\n private skipAutoOpenClose: boolean;\n\n private isUpdate = false;\n\n private updateDisposer?: VoidFunction;\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isouteropened)\n */\n isOuterOpened: boolean | undefined;\n\n constructor(protected config: VirtualRouteConfiguration<TParams> = {}) {\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n this.params = callFunction(config.initialParams, this) ?? null;\n this.openChecker = config.checkOpened;\n this.skipAutoOpenClose = false;\n this.isOuterOpened = this.openChecker?.(this);\n this.status = this.isOuterOpened ? 'opened' : 'unknown';\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(\n () => this.openChecker?.(this),\n action((isOuterOpened) => {\n this.isOuterOpened = isOuterOpened;\n\n if (\n this.skipAutoOpenClose ||\n this.status === 'closing' ||\n this.status === 'opening'\n ) {\n return;\n }\n\n if (this.isOuterOpened) {\n if (this.status === 'opened') {\n return;\n }\n void this.confirmOpening({\n params: this.params ?? null,\n ...this.config.getAutoOpenParams?.(this),\n });\n } else {\n if (this.status === 'closed' || this.status === 'unknown') {\n return;\n }\n void this.confirmClosing();\n }\n }),\n { signal: this.config.abortSignal, fireImmediately: true },\n );\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'opened') return undefined;\n return this.query.data;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n this.config.afterUpdate?.(this.params, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n }\n\n if (this.status === 'opened') {\n this.config.afterOpen?.(this.params, this);\n }\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened)\n */\n get isOpened() {\n return (\n !this.isDestroyed &&\n this.status === 'opened' &&\n this.isOuterOpened !== false\n );\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopening)\n */\n get isOpening() {\n return this.status === 'opening';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isclosing)\n */\n get isClosing() {\n return this.status === 'closing';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker)\n */\n setOpenChecker(\n openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>,\n ) {\n this.openChecker = openChecker;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)\n */\n open(\n ...args: IsPartial<TParams> extends true\n ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams]\n : [params: TParams, extraParams?: VirtualOpenExtraParams]\n ): Promise<void>;\n async open(...args: any[]) {\n const params = (args[0] ?? null) as unknown as TParams;\n const extra: Maybe<VirtualOpenExtraParams> = args[1];\n\n this.isUpdate = this.status === 'opened';\n this.skipAutoOpenClose = true;\n\n this.trx = {\n params,\n extra,\n manual: true,\n };\n\n await this.confirmOpening(this.trx);\n\n this.skipAutoOpenClose = false;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)\n */\n async close() {\n this.skipAutoOpenClose = true;\n const result = await this.confirmClosing();\n this.skipAutoOpenClose = false;\n return result;\n }\n\n private async confirmOpening(trx: VirtualRouteTrx) {\n runInAction(() => {\n this.trx = undefined;\n this.status = 'opening';\n });\n\n if ((await this.config.beforeOpen?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n if ((await this.config.open?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n runInAction(() => {\n if (trx.extra?.query) {\n this.query.update(trx.extra.query, trx.extra.replace);\n }\n\n this.trx = undefined;\n this.params = trx.params;\n this.status = 'opened';\n\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.params!, this);\n } else {\n this.config.afterOpen?.(this.params!, this);\n }\n });\n\n return true;\n }\n\n private async confirmClosing() {\n if (this.status === 'closed') {\n return true;\n }\n\n const lastStatus = this.status;\n\n runInAction(() => {\n this.status = 'closing';\n });\n\n if ((await this.config.beforeClose?.()) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n if (this.config.close?.(this) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n runInAction(() => {\n this.status = 'closed';\n this.params = null;\n });\n\n this.config.afterClose?.();\n\n return true;\n }\n\n destroy() {\n this.isDestroyed = true;\n this.status = 'unknown';\n this.disposer?.();\n this.updateDisposer?.();\n }\n}\n\nexport const createVirtualRoute = <\n TParams extends AnyObject | EmptyObject = EmptyObject,\n>(\n config?: VirtualRouteConfiguration<TParams>,\n) => new VirtualRoute<TParams>(config);\n"],"names":["annotations"],"mappings":";;;;;;AAWO,MAAM,cAAc;AAAA,EACzB,CAAC,QAAQ,YAAY;AACnB,QAAI;AACJ,QAAI;AAEJ,QAAI,QAAQ,SAAS;AACnB,gBAAU,OAAO;AACjB,oBAAc,OAAO;AAErB,UAAI,SAAS,WAAW,oBAAoB,QAAQ,OAAO,GAAG;AAC5D,gBAAQ,QAAQ,QAAA;AAAA,MAClB;AAAA,IACF,WAAW,SAAS,SAAS;AAC3B,gBAAU,QAAQ;AAClB,oBAAc,QAAQ,eAAe,QAAQ;AAAA,IAC/C,OAAO;AACL,gBAAU,qBAAA;AAAA,IACZ;AAEA,oBAAgB,kBAAkB,EAAE,SAAS;AAE7C,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;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AAU;AAC5B,aAAO;AAAA,IACT;AAEA,UAAM,aAAa,KAAK;AAExB,gBAAY,MAAM;AAChB,WAAK,SAAS;AAAA,IAChB,CAAC;AAED,QAAK,MAAM,KAAK,OAAO,cAAA,MAAqB,OAAO;AACjD,kBAAY,MAAM;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AACD;AAAA,IACF;AAEA,QAAI,KAAK,OAAO,QAAQ,IAAI,MAAM,OAAO;AACvC,kBAAY,MAAM;AAChB,aAAK,SAAS;AAAA,MAChB,CAAC;AACD;AAAA,IACF;AAEA,gBAAY,MAAM;AAChB,WAAK,SAAS;AACd,WAAK,SAAS;AAAA,IAChB,CAAC;AAED,SAAK,OAAO,aAAA;AAEZ,WAAO;AAAA,EACT;AAAA,EAEA,UAAU;AACR,SAAK,cAAc;AACnB,SAAK,SAAS;AACd,SAAK,WAAA;AACL,SAAK,iBAAA;AAAA,EACP;AACF;AAEO,MAAM,qBAAqB,CAGhC,WACG,IAAI,aAAsB,MAAM;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-route-sU8rVTsu.cjs","sources":["../src/core/config/config.ts","../src/core/route/route.ts","../src/core/route-group/route-group.ts","../src/core/router/router.ts","../src/core/virtual-route/virtual-route.ts"],"sourcesContent":["import {\n createBrowserHistory,\n createQueryParams,\n type History,\n type IQueryParams,\n isObservableHistory,\n} from 'mobx-location-history';\nimport { createGlobalDynamicConfig } from 'yummies/complex';\n\nimport type { RouteGlobalConfig } from './config.types.js';\n\nexport const routeConfig = createGlobalDynamicConfig<RouteGlobalConfig>(\n (update, current) => {\n let history: History;\n let queryParams: IQueryParams | undefined;\n\n if (update?.history) {\n history = update.history;\n queryParams = update.queryParams;\n\n if (current?.history && isObservableHistory(current.history)) {\n current.history.destroy();\n }\n } else if (current?.history) {\n history = current.history;\n queryParams = update?.queryParams ?? current.queryParams;\n } else {\n history = createBrowserHistory();\n }\n\n queryParams ??= createQueryParams({ history });\n\n return {\n ...update,\n history,\n queryParams,\n };\n },\n Symbol.for('MOBX_ROUTE_CONFIG'),\n);\n","import { comparer, computed, observable, reaction, runInAction } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport {\n compile,\n match,\n type ParamData,\n parse,\n type TokenData,\n} from 'path-to-regexp';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AnyRoute,\n CreatedUrlOutputParams,\n InputPathParams,\n NavigationTrx,\n ParsedPathData,\n ParsedPathParams,\n RouteConfiguration,\n RouteNavigateParams,\n UrlCreateParams,\n} from './route.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<Route<any, any, any, any>> = [\n [\n computed,\n 'isPathMatched',\n 'isOpened',\n 'isOpening',\n 'path',\n 'absolutePath',\n 'hasOpenedChildren',\n 'isAbleToMergeQuery',\n 'baseUrl',\n ],\n [computed.struct, 'parsedPathData', 'params'],\n [observable, 'children'],\n [observable.ref, 'parent', 'status'],\n];\n\n/**\n * Class for creating path based route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html)\n */\nexport class Route<\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any> | null = null,\n> {\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n protected history: History;\n\n /**\n * Parent route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#parent)\n */\n parent: TParentRoute;\n\n query: IQueryParams;\n\n private _tokenData: TokenData | undefined;\n private _matcher?: ReturnType<typeof match>;\n private _compiler?: ReturnType<typeof compile>;\n private ignoreOpenByPathMatch = false;\n private isUpdate = false;\n private updateDisposer?: VoidFunction;\n\n protected status:\n | 'opening'\n | 'closed'\n | 'open-rejected'\n | 'open-confirmed'\n | 'unknown';\n\n meta?: AnyObject;\n\n /**\n * Route path pattern declaration.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#pathdeclaration)\n */\n pathDeclaration: TPath;\n\n /**\n * Indicates if this route is an index route. Index routes activate when parent route path matches exactly.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isindex)\n */\n isIndex: boolean;\n\n /**\n * Indicates if this route is an hash route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#ishash)\n */\n isHash: boolean;\n\n /**\n * Array of child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#children)\n */\n children: AnyRoute[] = [];\n\n constructor(\n pathDeclaration: TPath,\n protected config: RouteConfiguration<\n TPath,\n TInputParams,\n TOutputParams,\n TParentRoute\n > = {},\n ) {\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n this.pathDeclaration = pathDeclaration;\n this.isIndex = !!this.config.index;\n this.isHash = !!this.config.hash;\n this.meta = this.config.meta;\n this.status = 'unknown';\n this.parent = config.parent ?? (null as unknown as TParentRoute);\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(() => this.isPathMatched, this.checkPathMatch, {\n fireImmediately: true,\n });\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'open-confirmed') return undefined;\n return [this.parsedPathData, this.query.data] as const;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n if (!this.parsedPathData) return;\n this.config.afterUpdate?.(this.parsedPathData, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n this.config.abortSignal?.addEventListener('abort', () => this.destroy(), {\n once: true,\n });\n }\n }\n\n protected get baseUrl() {\n const baseUrl = this.config.baseUrl ?? routeConfig.get().baseUrl;\n return baseUrl?.endsWith('/') ? baseUrl.slice(0, -1) : baseUrl;\n }\n\n /**\n * Checks whether current route matches provided path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#matchpath)\n */\n matchPath(path?: Maybe<string>): ParsedPathData<TPath> | null {\n let pathnameToCheck: string;\n\n if (path != null) {\n pathnameToCheck = path;\n } else if (this.isHash) {\n pathnameToCheck = this.history.location.hash.slice(1);\n } else {\n pathnameToCheck = this.history.location.pathname;\n }\n\n if (this.baseUrl) {\n if (!pathnameToCheck.startsWith(this.baseUrl)) {\n return null;\n }\n\n pathnameToCheck = pathnameToCheck.replace(this.baseUrl, '');\n }\n\n if (\n (this.pathDeclaration === '' || this.pathDeclaration === '/') &&\n (pathnameToCheck === '/' || pathnameToCheck === '')\n ) {\n return { params: {} as any, path: pathnameToCheck };\n }\n\n this._matcher ??= match(this.tokenData, {\n end: this.config.exact ?? false,\n ...this.config.matchOptions,\n });\n const parsed = this._matcher(pathnameToCheck);\n\n if (parsed === false) {\n return null;\n }\n\n return parsed as ParsedPathData<TPath>;\n }\n\n protected get parsedPathData(): ParsedPathData<TPath> | null {\n return this.matchPath();\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopening)\n *\n * Also true in the short gap after history already matches this route but\n * `confirmOpening` has not started yet (e.g. browser Back) — otherwise every\n * route looks closed for one tick and RouteViewGroup unmounts the page.\n */\n get isOpening() {\n if (this.status === 'opening') {\n return true;\n }\n\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status === 'open-confirmed' ||\n this.status === 'open-rejected'\n ) {\n return false;\n }\n\n return this.status === 'closed' || this.status === 'unknown';\n }\n\n /**\n * Matched path segment for current URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#path)\n */\n get path(): string | null {\n return this.parsedPathData?.path ?? null;\n }\n\n /**\n * Matched path segment for current URL with base URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#absolutepath)\n */\n get absolutePath(): string | null {\n const path = this.path;\n\n if (path === null) {\n return null;\n }\n\n return `${this.baseUrl || ''}${path}`;\n }\n\n /**\n * Current parsed path parameters.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#params)\n */\n get params(): TOutputParams | null {\n if (!this.parsedPathData?.params) {\n return null;\n }\n\n if (this.config.params) {\n const result = this.config.params(\n this.parsedPathData.params,\n this.config.meta,\n );\n return result || null;\n }\n\n return (\n (this.parsedPathData?.params as unknown as Maybe<TOutputParams>) ?? null\n );\n }\n\n protected get isPathMatched() {\n return this.parsedPathData !== null;\n }\n\n /**\n * Defines the \"open\" state for this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#isopened)\n */\n get isOpened() {\n if (\n this.isDestroyed ||\n !this.isPathMatched ||\n this.params === null ||\n this.status !== 'open-confirmed'\n ) {\n return false;\n }\n\n return (\n // this.parsedPathData is defined because this.params !== null\n !this.config.checkOpened || this.config.checkOpened(this.parsedPathData!)\n );\n }\n\n /**\n * Allows to create child route based on this route with merging this route path and extending path.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#extend)\n */\n extend<\n TExtendedPath extends string,\n TExtendedInputParams extends\n InputPathParams<`${TPath}${TExtendedPath}`> = InputPathParams<`${TPath}${TExtendedPath}`>,\n TExtendedOutputParams extends AnyObject = TInputParams &\n ParsedPathParams<`${TPath}${TExtendedPath}`>,\n >(\n pathDeclaration: TExtendedPath,\n config?: Omit<\n RouteConfiguration<\n `${TPath}${TExtendedPath}`,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n any\n >,\n 'parent'\n >,\n ) {\n type ExtendedRoutePath = `${TPath}${TExtendedPath}`;\n type ParentRoute = this;\n const { index, params, exact, ...configFromCurrentRoute } = this.config;\n\n const extendedChild = new Route<\n ExtendedRoutePath,\n TInputParams & TExtendedInputParams,\n TExtendedOutputParams,\n ParentRoute\n >(`${this.pathDeclaration}${pathDeclaration}`, {\n ...configFromCurrentRoute,\n ...config,\n parent: this,\n } as any);\n\n this.addChildren(extendedChild as any);\n\n return extendedChild;\n }\n\n /**\n * Manually add child routes.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#addchildren)\n */\n addChildren(...routes: AnyRoute[]) {\n this.children.push(...routes);\n }\n\n /**\n * Remove specified routes from children.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#removechildren)\n */\n removeChildren(...routes: AnyRoute[]) {\n this.children = this.children.filter((child) => !routes.includes(child));\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#hasopenedchildren)\n */\n get hasOpenedChildren(): boolean {\n return this.children.some(\n (child) => child.isOpened || child.hasOpenedChildren,\n );\n }\n\n protected processParams(\n params?: TInputParams | null | undefined,\n ): ParamData | undefined {\n if (params == null) return undefined;\n\n const result: ParamData = {};\n for (const [key, value] of Object.entries(params)) {\n if (value != null) {\n result[key] = Array.isArray(value) ? value.map(String) : String(value);\n }\n }\n return result;\n }\n\n /**\n * Generates full route URL.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#createurl)\n */\n createUrl(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: Maybe<TInputParams>,\n query?: Maybe<AnyObject>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n : [\n params: TInputParams,\n query?: Maybe<AnyObject>,\n mergeQueryOrParams?: boolean | CreatedUrlOutputParams,\n ]\n ) {\n const params = args[0];\n const rawQuery = args[1];\n const mergeQueryOrOutputParams = args[2] ?? this.isAbleToMergeQuery;\n const outputParams: Maybe<CreatedUrlOutputParams> =\n typeof mergeQueryOrOutputParams === 'boolean'\n ? { mergeQuery: mergeQueryOrOutputParams }\n : mergeQueryOrOutputParams;\n\n const query = outputParams?.mergeQuery\n ? { ...this.query.data, ...rawQuery }\n : (rawQuery ?? {});\n\n this._compiler ??= compile(this.tokenData);\n\n const defaultUrlCreateParams: UrlCreateParams<TInputParams> = {\n baseUrl: this.baseUrl,\n params: params as TInputParams,\n query,\n };\n const urlCreateParams: UrlCreateParams<TInputParams> =\n this.config.createUrl?.(defaultUrlCreateParams, this.query.data) ??\n routeConfig.get().createUrl?.(defaultUrlCreateParams, this.query.data) ??\n defaultUrlCreateParams;\n\n let path: string;\n\n try {\n path = this._compiler(this.processParams(urlCreateParams.params));\n } catch (e) {\n if (process.env.NODE_ENV !== 'production') {\n console.error(\n 'Error #1: Route path compilation failed\\n' +\n 'The path pattern could not be built into a URL (often missing or invalid params for a `:param` segment). Using fallbackPath or \"/\".\\n' +\n 'See docs: https://js2me.github.io/mobx-route/errors/1',\n e,\n );\n } else {\n console.error('minified error #1;see mobx-route docs', e);\n }\n path = this.config.fallbackPath ?? routeConfig.get().fallbackPath ?? '/';\n }\n\n const url = `${urlCreateParams.baseUrl || ''}${this.isHash ? '#' : ''}${path}`;\n\n if (outputParams?.omitQuery) {\n return url;\n }\n\n return `${url}${buildSearchString(urlCreateParams.query)}`;\n }\n\n /**\n * Navigates to this route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#open)\n */\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams,\n ]\n : [params: TInputParams, navigateParams?: RouteNavigateParams]\n ): Promise<void>;\n open(\n ...args: IsPartial<TInputParams> extends true\n ? [\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ]\n : [\n params: TInputParams,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ]\n ): Promise<void>;\n open(url: string, navigateParams?: RouteNavigateParams): Promise<void>;\n open(\n url: string,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n\n async open(...args: any[]) {\n const {\n replace,\n state: rawState,\n query: rawQuery,\n mergeQuery: rawMergeQuery,\n } = typeof args[1] === 'boolean' || args.length > 2\n ? ({ replace: args[1], query: args[2] } as RouteNavigateParams)\n : ((args[1] ?? {}) as RouteNavigateParams);\n\n const mergeQuery = rawMergeQuery ?? this.isAbleToMergeQuery;\n const query = mergeQuery ? { ...this.query.data, ...rawQuery } : rawQuery;\n\n const params = typeof args[0] === 'string' ? undefined : args[0];\n const url =\n typeof args[0] === 'string' ? args[0] : this.createUrl(args[0], query);\n\n const trx: NavigationTrx<TInputParams> = {\n url,\n params: params as TInputParams,\n replace,\n state: rawState ?? null,\n query,\n };\n\n this.isUpdate = this.status === 'open-confirmed';\n this.ignoreOpenByPathMatch = true;\n const isConfirmed = await this.confirmOpening(trx);\n\n if (isConfirmed !== true) {\n this.ignoreOpenByPathMatch = false;\n this.isUpdate = false;\n }\n }\n\n /**\n * Updates the current route if it is already open.\n * Unlike `open`, this is a no-op if the route is not open,\n * defaults to `replace: true` instead of push,\n * and defaults to `mergeQuery: true` when no query params are provided.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#update)\n */\n update(\n params?: TInputParams | null | undefined,\n navigateParams?: RouteNavigateParams,\n ): Promise<void>;\n update(\n params?: TInputParams | null | undefined,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n update(url: string, navigateParams?: RouteNavigateParams): Promise<void>;\n update(\n url: string,\n replace?: RouteNavigateParams['replace'],\n query?: RouteNavigateParams['query'],\n ): Promise<void>;\n\n async update(...args: any[]) {\n if (this.status !== 'open-confirmed') {\n return;\n }\n\n // Reuse current path params when omitted\n if (args[0] == null) {\n args[0] = this.parsedPathData?.params;\n }\n\n const secondArg = args[1];\n const isObjectParams = typeof secondArg === 'object' && secondArg !== null;\n\n if (isObjectParams) {\n args[1] = {\n replace: true,\n ...('query' in secondArg ? {} : { mergeQuery: true }),\n ...secondArg,\n };\n } else if (typeof secondArg === 'boolean') {\n if (args[2] === undefined) {\n args[1] = { replace: secondArg, mergeQuery: true };\n args.length = 2;\n }\n } else if (args.length === 1) {\n args[1] = { replace: true, mergeQuery: true };\n }\n\n return (this.open as (...args: any[]) => Promise<void>)(...args);\n }\n\n protected get tokenData() {\n if (!this._tokenData) {\n this._tokenData = parse(this.pathDeclaration, this.config.parseOptions);\n }\n return this._tokenData;\n }\n\n protected async confirmOpening(trx: NavigationTrx<TInputParams>) {\n if (!this.isUpdate) {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n let skipHistoryUpdate = !!trx.preferSkipHistoryUpdate;\n\n if (skipHistoryUpdate) {\n this.ignoreOpenByPathMatch = false;\n }\n\n if (this.config.beforeOpen) {\n const feedback = await this.config.beforeOpen(trx);\n\n if (feedback === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n });\n\n return;\n }\n\n // Rebuild URL if beforeOpen mutated trx.params\n const newUrl = this.createUrl(\n trx.params as TInputParams,\n trx.query as AnyObject,\n );\n if (newUrl !== trx.url) {\n trx.url = newUrl;\n skipHistoryUpdate = false;\n }\n\n if (typeof feedback === 'object') {\n skipHistoryUpdate = false;\n Object.assign(trx, feedback);\n }\n }\n\n if (this.isDestroyed) {\n return;\n }\n\n if (!skipHistoryUpdate) {\n if (trx.replace) {\n this.history.replace(trx.url, trx.state);\n } else {\n this.history.push(trx.url, trx.state);\n }\n }\n\n if (this.isPathMatched) {\n const wasAlreadyConfirmed = this.status === 'open-confirmed';\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n\n if (this.isUpdate) {\n this.isUpdate = false;\n // afterUpdate handled by updateDisposer reaction\n } else if (!wasAlreadyConfirmed) {\n this.config.afterOpen?.(this.parsedPathData!, this);\n }\n }\n\n return true;\n }\n\n protected confirmClosing() {\n runInAction(() => {\n this.status = 'closed';\n });\n return true;\n }\n\n private firstPathMatchingRun = true;\n\n private checkPathMatch = async (isPathMathched: boolean) => {\n if (this.firstPathMatchingRun) {\n this.firstPathMatchingRun = false;\n // ignore first 'afterClose' callback call\n if (!isPathMathched) {\n return;\n }\n }\n\n if (isPathMathched) {\n // after manual open call\n if (this.ignoreOpenByPathMatch) {\n this.ignoreOpenByPathMatch = false;\n if (this.status === 'opening' && this.parsedPathData) {\n runInAction(() => {\n this.status = 'open-confirmed';\n });\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.parsedPathData, this);\n } else {\n this.config.afterOpen?.(this.parsedPathData, this);\n }\n }\n // update() delegates to confirmOpening\n return;\n }\n\n // Set opening sync to avoid isOpened/isOpening flicker\n if (this.status !== 'opening' && this.status !== 'open-confirmed') {\n runInAction(() => {\n this.status = 'opening';\n });\n }\n\n // already confirmed\n if (this.status === 'open-confirmed') {\n return;\n }\n\n const trx: NavigationTrx<TInputParams> = {\n url: `${this.parsedPathData!.path}${buildSearchString(this.query.data)}`,\n params: this.parsedPathData!.params as TInputParams,\n state: this.history.location.state,\n query: this.query.data,\n preferSkipHistoryUpdate: true,\n };\n\n await this.confirmOpening(trx);\n } else {\n this.ignoreOpenByPathMatch = false;\n\n const isConfirmed = this.confirmClosing();\n\n if (isConfirmed) {\n this.config.afterClose?.();\n }\n }\n };\n\n private get isAbleToMergeQuery() {\n return this.config.mergeQuery ?? routeConfig.get().mergeQuery;\n }\n\n /**\n * Destroys route subscriptions and reactions.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Route.html#destroy)\n */\n destroy() {\n this.isDestroyed = true;\n this.disposer?.();\n this.disposer = undefined;\n this.updateDisposer?.();\n this.updateDisposer = undefined;\n }\n}\n\nexport const createRoute = <\n TPath extends string,\n TInputParams extends InputPathParams<TPath> = InputPathParams<TPath>,\n TOutputParams extends AnyObject = ParsedPathParams<TPath>,\n TParentRoute extends Route<any, any, any, any> | null = null,\n>(\n path: TPath,\n config?: RouteConfiguration<TPath, TInputParams, TOutputParams, TParentRoute>,\n) => new Route<TPath, TInputParams, TOutputParams, TParentRoute>(path, config);\n","import { computed, observable } from 'mobx';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type {\n AbstractRouteGroup,\n AnyRouteEntity,\n RoutesCollection,\n} from './route-group.types.js';\n\ndeclare const process: { env: { NODE_ENV?: string } };\n\nconst annotations: ObservableAnnotationsArray<RouteGroup<any>> = [\n [computed, 'isOpened', 'indexRoute', 'canNavigate'],\n [observable.shallow, 'routes'],\n];\n\n/**\n * Class for grouping related routes and managing their state.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport class RouteGroup<TRoutesCollection extends RoutesCollection>\n implements AbstractRouteGroup<TRoutesCollection>\n{\n routes: TRoutesCollection;\n\n constructor(\n routes: TRoutesCollection,\n private _indexRoute?: AnyRouteEntity,\n ) {\n this.routes = routes;\n\n applyObservable(this, annotations);\n }\n\n /**\n * Returns true if at least one route in the group is open.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#isopened)\n */\n get isOpened(): boolean {\n const routes = Object.values(this.routes);\n return routes.some(\n (route) =>\n route.isOpened ||\n ('hasOpenedChildren' in route && route.hasOpenedChildren),\n );\n }\n\n /**\n * First found index route.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#indexroute)\n */\n get indexRoute(): AnyRouteEntity | undefined {\n return (this._indexRoute ??\n Object.values(this.routes).find(\n (route) => 'isIndex' in route && route.isIndex,\n )) as unknown as AnyRouteEntity;\n }\n\n /**\n * `true` if `open()` has a target to navigate to —\n * either an own index route or a nested `RouteGroup` that itself can navigate.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#cannavigate)\n */\n get canNavigate(): boolean {\n if (this.indexRoute) return true;\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n return true;\n }\n }\n\n return false;\n }\n\n /**\n * Main navigation method for the group.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html#open)\n */\n open(...args: any[]) {\n if (this.indexRoute && 'open' in this.indexRoute) {\n this.indexRoute.open(...args);\n return;\n }\n\n for (const routeName in this.routes) {\n const route = this.routes[routeName];\n if (route instanceof RouteGroup && route.canNavigate) {\n route.open(...args);\n return;\n }\n }\n\n if (process.env.NODE_ENV !== 'production') {\n console.warn(\n 'Warning #1: RouteGroup.open() cannot navigate\\n' +\n 'This group has no index route (`index: true` or `groupRoutes(routes, indexRoute)`) and no navigable nested RouteGroup, so open() does nothing.\\n' +\n 'See docs: https://js2me.github.io/mobx-route/warnings/1',\n );\n } else {\n console.warn('minified warning #1;see mobx-route docs');\n }\n }\n}\n\n/**\n * Helper for creating route groups.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/groupRoutes.html)\n */\nexport const groupRoutes = <TRoutesCollection extends RoutesCollection>(\n routes: TRoutesCollection,\n indexRoute?: AnyRouteEntity,\n) => new RouteGroup<TRoutesCollection>(routes, indexRoute);\n","import { computed } from 'mobx';\nimport {\n buildSearchString,\n type History,\n type IQueryParams,\n} from 'mobx-location-history';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport { routeConfig } from '../config/index.js';\nimport type { RoutesCollection } from '../route-group/index.js';\nimport type {\n RouterConfiguration,\n RouterNavigateOptions,\n} from './router.types.js';\n\nconst annotations: ObservableAnnotationsArray<Router<any>> = [\n [computed.struct, 'location'],\n];\n\n/**\n * Class for centralized routing management.\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)\n */\nexport class Router<TRoutesCollection extends RoutesCollection> {\n routes: TRoutesCollection;\n history: History;\n query: IQueryParams;\n\n constructor(config: RouterConfiguration<TRoutesCollection>) {\n this.routes = config.routes;\n this.history = config.history ?? routeConfig.get().history;\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n\n applyObservable(this, annotations);\n }\n\n get location() {\n return this.history.location;\n }\n\n navigate(url: string, options?: RouterNavigateOptions) {\n const query =\n (options?.mergeQuery ?? routeConfig.get().mergeQuery)\n ? { ...this.query.data, ...options?.query }\n : { ...options?.query };\n\n const searchString = buildSearchString(query);\n const navigationUrl = `${url}${searchString}`;\n\n if (options?.replace) {\n this.history.replace(navigationUrl, options?.state);\n } else {\n this.history.push(navigationUrl, options?.state);\n }\n }\n}\n\nexport const createRouter = <TRoutesCollection extends RoutesCollection>(\n config: RouterConfiguration<TRoutesCollection>,\n) => new Router(config);\n","import {\n action,\n comparer,\n computed,\n observable,\n reaction,\n runInAction,\n} from 'mobx';\nimport type { IQueryParams } from 'mobx-location-history';\nimport { callFunction } from 'yummies/common';\nimport { applyObservable, type ObservableAnnotationsArray } from 'yummies/mobx';\nimport type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/types';\nimport { routeConfig } from '../config/index.js';\nimport type {\n AbstractVirtualRoute,\n VirtualOpenExtraParams,\n VirtualRouteConfiguration,\n VirtualRouteTrx,\n} from './virtual-route.types.js';\n\nconst annotations: ObservableAnnotationsArray<VirtualRoute<any>> = [\n [observable, 'params'],\n [observable.ref, 'status', 'trx', 'openChecker', 'isOuterOpened'],\n [computed, 'isOpened', 'isOpening', 'isClosing'],\n [action, 'setOpenChecker', 'open', 'close', 'destroy'],\n];\n\n/**\n * Class for creating routes with custom activation logic\n *\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)\n */\nexport class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject>\n implements AbstractVirtualRoute<TParams>\n{\n private isDestroyed?: boolean;\n private disposer?: VoidFunction;\n\n query: IQueryParams;\n params: TParams | null;\n\n protected status:\n | 'opening'\n | 'open-rejected'\n | 'opened'\n | 'closing'\n | 'closed'\n | 'unknown';\n\n private openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>;\n\n private trx: Maybe<VirtualRouteTrx>;\n\n private skipAutoOpenClose: boolean;\n\n private isUpdate = false;\n\n private updateDisposer?: VoidFunction;\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isouteropened)\n */\n isOuterOpened: boolean | undefined;\n\n constructor(protected config: VirtualRouteConfiguration<TParams> = {}) {\n this.query = config.queryParams ?? routeConfig.get().queryParams;\n this.params = callFunction(config.initialParams, this) ?? null;\n this.openChecker = config.checkOpened;\n this.skipAutoOpenClose = false;\n this.isOuterOpened = this.openChecker?.(this);\n this.status = this.isOuterOpened ? 'opened' : 'unknown';\n\n applyObservable(this, annotations);\n\n if (this.config.abortSignal?.aborted) {\n this.isDestroyed = true;\n } else {\n this.disposer = reaction(\n () => this.openChecker?.(this),\n action((isOuterOpened) => {\n this.isOuterOpened = isOuterOpened;\n\n if (\n this.skipAutoOpenClose ||\n this.status === 'closing' ||\n this.status === 'opening'\n ) {\n return;\n }\n\n if (this.isOuterOpened) {\n if (this.status === 'opened') {\n return;\n }\n void this.confirmOpening({\n params: this.params ?? null,\n ...this.config.getAutoOpenParams?.(this),\n });\n } else {\n if (this.status === 'closed' || this.status === 'unknown') {\n return;\n }\n void this.confirmClosing();\n }\n }),\n { signal: this.config.abortSignal, fireImmediately: true },\n );\n this.updateDisposer = reaction(\n () => {\n if (this.status !== 'opened') return undefined;\n return this.query.data;\n },\n (value, prevValue) => {\n if (prevValue === undefined) return;\n if (value === undefined) return;\n this.config.afterUpdate?.(this.params, this);\n },\n {\n fireImmediately: false,\n signal: this.config.abortSignal,\n equals: comparer.structural,\n },\n );\n }\n\n if (this.status === 'opened') {\n this.config.afterOpen?.(this.params, this);\n }\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened)\n */\n get isOpened() {\n return (\n !this.isDestroyed &&\n this.status === 'opened' &&\n this.isOuterOpened !== false\n );\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopening)\n */\n get isOpening() {\n return this.status === 'opening';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isclosing)\n */\n get isClosing() {\n return this.status === 'closing';\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker)\n */\n setOpenChecker(\n openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>,\n ) {\n this.openChecker = openChecker;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)\n */\n open(\n ...args: IsPartial<TParams> extends true\n ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams]\n : [params: TParams, extraParams?: VirtualOpenExtraParams]\n ): Promise<void>;\n async open(...args: any[]) {\n const params = (args[0] ?? null) as unknown as TParams;\n const extra: Maybe<VirtualOpenExtraParams> = args[1];\n\n this.isUpdate = this.status === 'opened';\n this.skipAutoOpenClose = true;\n\n this.trx = {\n params,\n extra,\n manual: true,\n };\n\n await this.confirmOpening(this.trx);\n\n this.skipAutoOpenClose = false;\n }\n\n /**\n * [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)\n */\n async close() {\n this.skipAutoOpenClose = true;\n const result = await this.confirmClosing();\n this.skipAutoOpenClose = false;\n return result;\n }\n\n private async confirmOpening(trx: VirtualRouteTrx) {\n runInAction(() => {\n this.trx = undefined;\n this.status = 'opening';\n });\n\n if ((await this.config.beforeOpen?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n if ((await this.config.open?.(trx.params, this)) === false) {\n runInAction(() => {\n this.status = 'open-rejected';\n this.trx = undefined;\n });\n return;\n }\n\n runInAction(() => {\n if (trx.extra?.query) {\n this.query.update(trx.extra.query, trx.extra.replace);\n }\n\n this.trx = undefined;\n this.params = trx.params;\n this.status = 'opened';\n\n if (this.isUpdate) {\n this.isUpdate = false;\n this.config.afterUpdate?.(this.params!, this);\n } else {\n this.config.afterOpen?.(this.params!, this);\n }\n });\n\n return true;\n }\n\n private async confirmClosing() {\n if (this.status === 'closed') {\n return true;\n }\n\n const lastStatus = this.status;\n\n runInAction(() => {\n this.status = 'closing';\n });\n\n if ((await this.config.beforeClose?.()) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n if (this.config.close?.(this) === false) {\n runInAction(() => {\n this.status = lastStatus;\n });\n return;\n }\n\n runInAction(() => {\n this.status = 'closed';\n this.params = null;\n });\n\n this.config.afterClose?.();\n\n return true;\n }\n\n destroy() {\n this.isDestroyed = true;\n this.status = 'unknown';\n this.disposer?.();\n this.updateDisposer?.();\n }\n}\n\nexport const createVirtualRoute = <\n TParams extends AnyObject | EmptyObject = EmptyObject,\n>(\n config?: VirtualRouteConfiguration<TParams>,\n) => new VirtualRoute<TParams>(config);\n"],"names":["createGlobalDynamicConfig","isObservableHistory","createBrowserHistory","createQueryParams","annotations","computed","observable","applyObservable","reaction","comparer","match","compile","buildSearchString","parse","runInAction","action","callFunction"],"mappings":";;;;;;;AAWO,MAAM,cAAcA,QAAAA;AAAAA,EACzB,CAAC,QAAQ,YAAY;AACnB,QAAI;AACJ,QAAI;AAEJ,QAAI,QAAQ,SAAS;AACnB,gBAAU,OAAO;AACjB,oBAAc,OAAO;AAErB,UAAI,SAAS,WAAWC,oBAAAA,oBAAoB,QAAQ,OAAO,GAAG;AAC5D,gBAAQ,QAAQ,QAAA;AAAA,MAClB;AAAA,IACF,WAAW,SAAS,SAAS;AAC3B,gBAAU,QAAQ;AAClB,oBAAc,QAAQ,eAAe,QAAQ;AAAA,IAC/C,OAAO;AACL,gBAAUC,oBAAAA,qBAAA;AAAA,IACZ;AAEA,oBAAgBC,oBAAAA,kBAAkB,EAAE,SAAS;AAE7C,WAAO;AAAA,MACL,GAAG;AAAA,MACH;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA,EACA,uBAAO,IAAI,mBAAmB;AAChC;ACTA,MAAMC,gBAAqE;AAAA,EACzE;AAAA,IACEC,KAAAA;AAAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAAA,EAEF,CAACA,cAAS,QAAQ,kBAAkB,QAAQ;AAAA,EAC5C,CAACC,KAAAA,YAAY,UAAU;AAAA,EACvB,CAACA,KAAAA,WAAW,KAAK,UAAU,QAAQ;AACrC;AAOO,MAAM,MAKX;AA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