mobx-route 0.15.0 → 0.16.1
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/README.md +5 -7
- package/core/config/config.cjs +43 -0
- package/core/config/config.d.cts +7 -0
- package/core/config/config.d.cts.map +1 -0
- package/core/config/config.d.ts +1 -1
- package/core/config/config.d.ts.map +1 -1
- package/core/config/config.types.cjs +2 -0
- package/core/config/config.types.d.cts +11 -0
- package/core/config/config.types.d.cts.map +1 -0
- package/core/config/config.types.d.ts +1 -1
- package/core/config/config.types.d.ts.map +1 -1
- package/core/config/index.cjs +18 -0
- package/core/config/index.d.cts +3 -0
- package/core/config/index.d.cts.map +1 -0
- package/core/config/index.d.ts +2 -2
- package/core/config/index.d.ts.map +1 -1
- package/core/config/index.js +2 -2
- package/core/index.cjs +21 -0
- package/core/index.d.cts +6 -0
- package/core/index.d.cts.map +1 -0
- package/core/index.d.ts +5 -5
- package/core/index.d.ts.map +1 -1
- package/core/index.js +5 -5
- package/core/route/index.cjs +18 -0
- package/core/route/index.d.cts +3 -0
- package/core/route/index.d.cts.map +1 -0
- package/core/route/index.d.ts +2 -2
- package/core/route/index.d.ts.map +1 -1
- package/core/route/index.js +2 -2
- package/core/route/route.cjs +296 -0
- package/core/route/route.d.cts +107 -0
- package/core/route/route.d.cts.map +1 -0
- package/core/route/route.d.ts +1 -1
- package/core/route/route.d.ts.map +1 -1
- package/core/route/route.js +1 -1
- package/core/route/route.types.cjs +2 -0
- package/core/route/route.types.d.cts +142 -0
- package/core/route/route.types.d.cts.map +1 -0
- package/core/route/route.types.d.ts +4 -4
- package/core/route/route.types.d.ts.map +1 -1
- package/core/route-group/index.cjs +18 -0
- package/core/route-group/index.d.cts +3 -0
- package/core/route-group/index.d.cts.map +1 -0
- package/core/route-group/index.d.ts +2 -2
- package/core/route-group/index.d.ts.map +1 -1
- package/core/route-group/index.js +2 -2
- package/core/route-group/route-group.cjs +67 -0
- package/core/route-group/route-group.d.cts +31 -0
- package/core/route-group/route-group.d.cts.map +1 -0
- package/core/route-group/route-group.d.ts +1 -1
- package/core/route-group/route-group.d.ts.map +1 -1
- package/core/route-group/route-group.types.cjs +2 -0
- package/core/route-group/route-group.types.d.cts +15 -0
- package/core/route-group/route-group.types.d.cts.map +1 -0
- package/core/route-group/route-group.types.d.ts +3 -3
- package/core/route-group/route-group.types.d.ts.map +1 -1
- package/core/router/index.cjs +18 -0
- package/core/router/index.d.cts +3 -0
- package/core/router/index.d.cts.map +1 -0
- package/core/router/index.d.ts +2 -2
- package/core/router/index.d.ts.map +1 -1
- package/core/router/index.js +2 -2
- package/core/router/router.cjs +42 -0
- package/core/router/router.d.cts +18 -0
- package/core/router/router.d.cts.map +1 -0
- package/core/router/router.d.ts +2 -2
- package/core/router/router.d.ts.map +1 -1
- package/core/router/router.js +1 -1
- package/core/router/router.types.cjs +2 -0
- package/core/router/router.types.d.cts +13 -0
- package/core/router/router.types.d.cts.map +1 -0
- package/core/router/router.types.d.ts +3 -3
- package/core/router/router.types.d.ts.map +1 -1
- package/core/utils/is-route-entity.cjs +5 -0
- package/core/utils/is-route-entity.d.cts +3 -0
- package/core/utils/is-route-entity.d.cts.map +1 -0
- package/core/utils/is-route-entity.d.ts +1 -1
- package/core/utils/is-route-entity.d.ts.map +1 -1
- package/core/virtual-route/index.cjs +18 -0
- package/core/virtual-route/index.d.cts +3 -0
- package/core/virtual-route/index.d.cts.map +1 -0
- package/core/virtual-route/index.d.ts +2 -2
- package/core/virtual-route/index.d.ts.map +1 -1
- package/core/virtual-route/index.js +2 -2
- package/core/virtual-route/virtual-route.cjs +133 -0
- package/core/virtual-route/virtual-route.d.cts +39 -0
- package/core/virtual-route/virtual-route.d.cts.map +1 -0
- package/core/virtual-route/virtual-route.d.ts +1 -1
- package/core/virtual-route/virtual-route.d.ts.map +1 -1
- package/core/virtual-route/virtual-route.js +1 -1
- package/core/virtual-route/virtual-route.types.cjs +2 -0
- package/core/virtual-route/virtual-route.types.d.cts +57 -0
- package/core/virtual-route/virtual-route.types.d.cts.map +1 -0
- package/core/virtual-route/virtual-route.types.d.ts +2 -2
- package/core/virtual-route/virtual-route.types.d.ts.map +1 -1
- package/index.cjs +18 -0
- package/index.d.cts +3 -0
- package/index.d.cts.map +1 -0
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +1 -1
- package/package.json +29 -128
- package/react/components/index.cjs +21 -0
- package/react/components/index.d.cts +4 -0
- package/react/components/index.d.cts.map +1 -0
- package/react/components/index.d.ts +3 -3
- package/react/components/index.d.ts.map +1 -1
- package/react/components/index.js +3 -3
- package/react/components/link.cjs +79 -0
- package/react/components/link.d.cts +23 -0
- package/react/components/link.d.cts.map +1 -0
- package/react/components/link.d.ts +1 -1
- package/react/components/link.d.ts.map +1 -1
- package/react/components/link.js +2 -4
- package/react/components/route-view-group.cjs +57 -0
- package/react/components/route-view-group.d.cts +26 -0
- package/react/components/route-view-group.d.cts.map +1 -0
- package/react/components/route-view-group.d.ts +1 -1
- package/react/components/route-view-group.d.ts.map +1 -1
- package/react/components/route-view-group.js +3 -3
- package/react/components/route-view.cjs +43 -0
- package/react/components/route-view.d.cts +25 -0
- package/react/components/route-view.d.cts.map +1 -0
- package/react/components/route-view.d.ts +1 -1
- package/react/components/route-view.d.ts.map +1 -1
- package/react/index.cjs +17 -0
- package/react/index.d.cts +2 -0
- package/react/index.d.cts.map +1 -0
- package/react/index.d.ts +1 -1
- package/react/index.d.ts.map +1 -1
- package/react/index.js +1 -1
- package/view-model/index.cjs +17 -0
- package/view-model/index.d.cts +2 -0
- package/view-model/index.d.cts.map +1 -0
- package/view-model/index.d.ts +1 -1
- package/view-model/index.d.ts.map +1 -1
- package/view-model/index.js +1 -1
- package/view-model/route-view-model.cjs +37 -0
- package/view-model/route-view-model.d.cts +13 -0
- package/view-model/route-view-model.d.cts.map +1 -0
- package/view-model/route-view-model.d.ts +1 -1
- package/view-model/route-view-model.d.ts.map +1 -1
- package/view-model/route-view-model.js +1 -1
- package/assets/logo.png +0 -0
- package/assets/logo.pxz +0 -0
- package/assets/new-logo.pxz +0 -0
- package/core/route/route.test.d.ts +0 -19
- package/core/route/route.test.d.ts.map +0 -1
- package/core/route/route.test.js +0 -250
- package/core/utils/build-url.d.ts +0 -3
- package/core/utils/build-url.d.ts.map +0 -1
- package/core/utils/build-url.js +0 -12
- package/react/components/route-view-group.test.d.ts +0 -2
- package/react/components/route-view-group.test.d.ts.map +0 -1
- package/react/components/route-view-group.test.js +0 -101
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createRouter = exports.Router = void 0;
|
|
4
|
+
const mobx_1 = require("mobx");
|
|
5
|
+
const mobx_location_history_1 = require("mobx-location-history");
|
|
6
|
+
const config_js_1 = require("../config/config.cjs");
|
|
7
|
+
/**
|
|
8
|
+
* Class for centralized routing management.
|
|
9
|
+
*
|
|
10
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)
|
|
11
|
+
*/
|
|
12
|
+
class Router {
|
|
13
|
+
routes;
|
|
14
|
+
history;
|
|
15
|
+
query;
|
|
16
|
+
constructor(config) {
|
|
17
|
+
this.routes = config.routes;
|
|
18
|
+
this.history = config.history ?? config_js_1.routeConfig.get().history;
|
|
19
|
+
this.query = config.queryParams ?? config_js_1.routeConfig.get().queryParams;
|
|
20
|
+
mobx_1.computed.struct(this, 'location');
|
|
21
|
+
(0, mobx_1.makeObservable)(this);
|
|
22
|
+
}
|
|
23
|
+
get location() {
|
|
24
|
+
return this.history.location;
|
|
25
|
+
}
|
|
26
|
+
navigate(url, options) {
|
|
27
|
+
const query = (options?.mergeQuery ?? config_js_1.routeConfig.get().mergeQuery)
|
|
28
|
+
? { ...this.query.data, ...options?.query }
|
|
29
|
+
: { ...options?.query };
|
|
30
|
+
const searchString = (0, mobx_location_history_1.buildSearchString)(query);
|
|
31
|
+
const navigationUrl = `${url}${searchString}`;
|
|
32
|
+
if (options?.replace) {
|
|
33
|
+
this.history.replace(navigationUrl, options?.state);
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
this.history.push(navigationUrl, options?.state);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.Router = Router;
|
|
41
|
+
const createRouter = (config) => new Router(config);
|
|
42
|
+
exports.createRouter = createRouter;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type History, type IQueryParams } from 'mobx-location-history';
|
|
2
|
+
import type { RoutesCollection } from "../route-group/index.cjs";
|
|
3
|
+
import type { RouterConfiguration, RouterNavigateOptions } from "./router.types.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* Class for centralized routing management.
|
|
6
|
+
*
|
|
7
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/Router.html)
|
|
8
|
+
*/
|
|
9
|
+
export declare class Router<TRoutesCollection extends RoutesCollection> {
|
|
10
|
+
routes: TRoutesCollection;
|
|
11
|
+
history: History;
|
|
12
|
+
query: IQueryParams;
|
|
13
|
+
constructor(config: RouterConfiguration<TRoutesCollection>);
|
|
14
|
+
get location(): import("mobx-location-history").Location;
|
|
15
|
+
navigate(url: string, options?: RouterNavigateOptions): void;
|
|
16
|
+
}
|
|
17
|
+
export declare const createRouter: <TRoutesCollection extends RoutesCollection>(config: RouterConfiguration<TRoutesCollection>) => Router<TRoutesCollection>;
|
|
18
|
+
//# sourceMappingURL=router.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAEhE,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,2BAA0B;AAE3B;;;;GAIG;AACH,qBAAa,MAAM,CAAC,iBAAiB,SAAS,gBAAgB;IAC5D,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;gBAER,MAAM,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;IAU1D,IAAI,QAAQ,6CAEX;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;CAetD;AAED,eAAO,MAAM,YAAY,GAAI,iBAAiB,SAAS,gBAAgB,EACrE,QAAQ,mBAAmB,CAAC,iBAAiB,CAAC,8BACzB,CAAC"}
|
package/core/router/router.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type History, type IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { RoutesCollection } from
|
|
3
|
-
import type { RouterConfiguration, RouterNavigateOptions } from
|
|
2
|
+
import type { RoutesCollection } from "../route-group/index.js";
|
|
3
|
+
import type { RouterConfiguration, RouterNavigateOptions } from "./router.types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Class for centralized routing management.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"router.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,YAAY,EAClB,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAEhE,OAAO,KAAK,EACV,mBAAmB,EACnB,qBAAqB,EACtB,0BAA0B;AAE3B;;;;GAIG;AACH,qBAAa,MAAM,CAAC,iBAAiB,SAAS,gBAAgB;IAC5D,MAAM,EAAE,iBAAiB,CAAC;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;gBAER,MAAM,EAAE,mBAAmB,CAAC,iBAAiB,CAAC;IAU1D,IAAI,QAAQ,6CAEX;IAED,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;CAetD;AAED,eAAO,MAAM,YAAY,GAAI,iBAAiB,SAAS,gBAAgB,EACrE,QAAQ,mBAAmB,CAAC,iBAAiB,CAAC,8BACzB,CAAC"}
|
package/core/router/router.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { computed, makeObservable } from 'mobx';
|
|
2
2
|
import { buildSearchString, } from 'mobx-location-history';
|
|
3
|
-
import { routeConfig } from
|
|
3
|
+
import { routeConfig } from "../config/config.js";
|
|
4
4
|
/**
|
|
5
5
|
* Class for centralized routing management.
|
|
6
6
|
*
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { History, IQueryParams } from 'mobx-location-history';
|
|
2
|
+
import type { RouteNavigateParams } from "../route/route.types.cjs";
|
|
3
|
+
import type { RoutesCollection } from "../route-group/index.cjs";
|
|
4
|
+
import type { Router } from "./router.cjs";
|
|
5
|
+
export interface RouterConfiguration<TRoutesStruct extends RoutesCollection> {
|
|
6
|
+
routes: TRoutesStruct;
|
|
7
|
+
history?: History;
|
|
8
|
+
queryParams?: IQueryParams;
|
|
9
|
+
}
|
|
10
|
+
export interface RouterNavigateOptions extends RouteNavigateParams {
|
|
11
|
+
}
|
|
12
|
+
export type AnyRouter = Router<RoutesCollection>;
|
|
13
|
+
//# sourceMappingURL=router.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"router.types.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,iCAAgC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,iCAAgC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,qBAAoB;AAE1C,MAAM,WAAW,mBAAmB,CAAC,aAAa,SAAS,gBAAgB;IACzE,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;CAAG;AAErE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { History, IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { RouteNavigateParams } from
|
|
3
|
-
import type { RoutesCollection } from
|
|
4
|
-
import type { Router } from
|
|
2
|
+
import type { RouteNavigateParams } from "../route/route.types.js";
|
|
3
|
+
import type { RoutesCollection } from "../route-group/index.js";
|
|
4
|
+
import type { Router } from "./router.js";
|
|
5
5
|
export interface RouterConfiguration<TRoutesStruct extends RoutesCollection> {
|
|
6
6
|
routes: TRoutesStruct;
|
|
7
7
|
history?: History;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"router.types.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"router.types.d.ts","sourceRoot":"","sources":["../../../src/core/router/router.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,gCAAgC;AACnE,OAAO,KAAK,EAAE,gBAAgB,EAAE,gCAAgC;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,oBAAoB;AAE1C,MAAM,WAAW,mBAAmB,CAAC,aAAa,SAAS,gBAAgB;IACzE,MAAM,EAAE,aAAa,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,MAAM,WAAW,qBAAsB,SAAQ,mBAAmB;CAAG;AAErE,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-route-entity.d.ts","sourceRoot":"","sources":["../../../src/core/utils/is-route-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,6CAA4C;AAE1E,eAAO,MAAM,aAAa,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cACtB,CAAC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { AnyRouteEntity } from
|
|
1
|
+
import type { AnyRouteEntity } from "../route-group/route-group.types.js";
|
|
2
2
|
export declare const isRouteEntity: (route: any) => route is AnyRouteEntity;
|
|
3
3
|
//# sourceMappingURL=is-route-entity.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-route-entity.d.ts","sourceRoot":"","sources":["../../../src/core/utils/is-route-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"is-route-entity.d.ts","sourceRoot":"","sources":["../../../src/core/utils/is-route-entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,4CAA4C;AAE1E,eAAO,MAAM,aAAa,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cACtB,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./virtual-route.cjs"), exports);
|
|
18
|
+
__exportStar(require("./virtual-route.types.cjs"), exports);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/index.ts"],"names":[],"mappings":"AAAA,oCAAmC;AACnC,0CAAyC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./virtual-route.js";
|
|
2
|
+
export * from "./virtual-route.types.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,yCAAyC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from
|
|
2
|
-
export * from
|
|
1
|
+
export * from "./virtual-route.js";
|
|
2
|
+
export * from "./virtual-route.types.js";
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createVirtualRoute = exports.VirtualRoute = void 0;
|
|
4
|
+
const linked_abort_controller_1 = require("linked-abort-controller");
|
|
5
|
+
const mobx_1 = require("mobx");
|
|
6
|
+
const common_1 = require("yummies/common");
|
|
7
|
+
const index_js_1 = require("../config/index.cjs");
|
|
8
|
+
/**
|
|
9
|
+
* Class for creating routes with custom activation logic
|
|
10
|
+
*
|
|
11
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)
|
|
12
|
+
*/
|
|
13
|
+
class VirtualRoute {
|
|
14
|
+
config;
|
|
15
|
+
abortController;
|
|
16
|
+
query;
|
|
17
|
+
params;
|
|
18
|
+
isLocalOpened;
|
|
19
|
+
openChecker;
|
|
20
|
+
reactionDisposer;
|
|
21
|
+
constructor(config = {}) {
|
|
22
|
+
this.config = config;
|
|
23
|
+
this.abortController = new linked_abort_controller_1.LinkedAbortController(config.abortSignal);
|
|
24
|
+
this.query = config.queryParams ?? index_js_1.routeConfig.get().queryParams;
|
|
25
|
+
this.params = (0, common_1.callFunction)(config.initialParams, this) ?? null;
|
|
26
|
+
this.openChecker = config.checkOpened;
|
|
27
|
+
this.isLocalOpened = this.openChecker?.(this) ?? false;
|
|
28
|
+
(0, mobx_1.observable)(this, 'params');
|
|
29
|
+
mobx_1.observable.ref(this, 'isLocalOpened');
|
|
30
|
+
mobx_1.observable.ref(this, '_isOpened');
|
|
31
|
+
mobx_1.computed.struct(this, 'isOpened');
|
|
32
|
+
(0, mobx_1.action)(this, 'setOpenChecker');
|
|
33
|
+
(0, mobx_1.action)(this, 'open');
|
|
34
|
+
(0, mobx_1.action)(this, 'close');
|
|
35
|
+
(0, mobx_1.makeObservable)(this);
|
|
36
|
+
(0, mobx_1.onBecomeObserved)(this, 'isOpened', () => {
|
|
37
|
+
if (!config.afterOpen && !config.afterClose) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
this.reactionDisposer = (0, mobx_1.reaction)(() => this.isOpened, this.processOpenedState, {
|
|
41
|
+
signal: this.abortController.signal,
|
|
42
|
+
fireImmediately: true,
|
|
43
|
+
});
|
|
44
|
+
});
|
|
45
|
+
(0, mobx_1.onBecomeUnobserved)(this, 'isOpened', () => {
|
|
46
|
+
this.reactionDisposer?.();
|
|
47
|
+
this.reactionDisposer = undefined;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened-boolean)
|
|
52
|
+
*/
|
|
53
|
+
get isOpened() {
|
|
54
|
+
const isOuterOpened = this.openChecker == null || this.openChecker(this);
|
|
55
|
+
return this.isLocalOpened && isOuterOpened;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker-openchecker-void)
|
|
59
|
+
*/
|
|
60
|
+
setOpenChecker(openChecker) {
|
|
61
|
+
this.openChecker = openChecker;
|
|
62
|
+
}
|
|
63
|
+
async open(...args) {
|
|
64
|
+
const params = (args[0] ?? {});
|
|
65
|
+
const extraParams = args[1];
|
|
66
|
+
if (this.config.beforeOpen) {
|
|
67
|
+
const beforeOpenResult = await this.config.beforeOpen(params, this);
|
|
68
|
+
if (beforeOpenResult === false) {
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (this.config.open == null) {
|
|
73
|
+
(0, mobx_1.runInAction)(() => {
|
|
74
|
+
this.isLocalOpened = true;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
else {
|
|
78
|
+
const result = await this.config.open(params, this);
|
|
79
|
+
// because result can return void so this is truthy for opening state
|
|
80
|
+
(0, mobx_1.runInAction)(() => {
|
|
81
|
+
this.isLocalOpened = result !== false;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
if (!this.isLocalOpened) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (extraParams?.query) {
|
|
88
|
+
this.query.update(extraParams.query, extraParams.replace);
|
|
89
|
+
}
|
|
90
|
+
(0, mobx_1.runInAction)(() => {
|
|
91
|
+
this.params = params;
|
|
92
|
+
});
|
|
93
|
+
if (!this.reactionDisposer && this.isOpened) {
|
|
94
|
+
this.config.afterOpen?.(this.params, this);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close-void)
|
|
99
|
+
*/
|
|
100
|
+
close() {
|
|
101
|
+
if (this.config.close == null) {
|
|
102
|
+
this.isLocalOpened = false;
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
const result = this.config.close(this);
|
|
106
|
+
// because result can return void so this is truthy for opening state
|
|
107
|
+
this.isLocalOpened = result !== false;
|
|
108
|
+
}
|
|
109
|
+
this.params = null;
|
|
110
|
+
}
|
|
111
|
+
firstOpenedStateCheck = true;
|
|
112
|
+
processOpenedState = (isOpened) => {
|
|
113
|
+
if (this.firstOpenedStateCheck) {
|
|
114
|
+
this.firstOpenedStateCheck = false;
|
|
115
|
+
// ignore first 'afterClose' callback call
|
|
116
|
+
if (!isOpened) {
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
if (isOpened) {
|
|
121
|
+
this.config.afterOpen?.(this.params, this);
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
this.config.afterClose?.();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
destroy() {
|
|
128
|
+
this.abortController.abort();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
exports.VirtualRoute = VirtualRoute;
|
|
132
|
+
const createVirtualRoute = (config) => new VirtualRoute(config);
|
|
133
|
+
exports.createVirtualRoute = createVirtualRoute;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
+
import type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
3
|
+
import type { AbstractVirtualRoute, VirtualOpenExtraParams, VirtualRouteConfiguration } from "./virtual-route.types.cjs";
|
|
4
|
+
/**
|
|
5
|
+
* Class for creating routes with custom activation logic
|
|
6
|
+
*
|
|
7
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)
|
|
8
|
+
*/
|
|
9
|
+
export declare class VirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> implements AbstractVirtualRoute<TParams> {
|
|
10
|
+
protected config: VirtualRouteConfiguration<TParams>;
|
|
11
|
+
protected abortController: AbortController;
|
|
12
|
+
query: IQueryParams;
|
|
13
|
+
params: TParams | null;
|
|
14
|
+
private isLocalOpened;
|
|
15
|
+
private openChecker;
|
|
16
|
+
private reactionDisposer;
|
|
17
|
+
constructor(config?: VirtualRouteConfiguration<TParams>);
|
|
18
|
+
/**
|
|
19
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened-boolean)
|
|
20
|
+
*/
|
|
21
|
+
get isOpened(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker-openchecker-void)
|
|
24
|
+
*/
|
|
25
|
+
setOpenChecker(openChecker: Maybe<VirtualRouteConfiguration<TParams>['checkOpened']>): void;
|
|
26
|
+
/**
|
|
27
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open-params-extraparams-query-replace-promise-void)
|
|
28
|
+
*/
|
|
29
|
+
open(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams] : [params: TParams, extraParams?: VirtualOpenExtraParams]): Promise<void>;
|
|
30
|
+
/**
|
|
31
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close-void)
|
|
32
|
+
*/
|
|
33
|
+
close(): void;
|
|
34
|
+
private firstOpenedStateCheck;
|
|
35
|
+
private processOpenedState;
|
|
36
|
+
destroy(): void;
|
|
37
|
+
}
|
|
38
|
+
export declare const createVirtualRoute: <TParams extends AnyObject | EmptyObject = EmptyObject>(config?: VirtualRouteConfiguration<TParams>) => VirtualRoute<TParams>;
|
|
39
|
+
//# sourceMappingURL=virtual-route.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-route.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACN,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EAC1B,kCAAiC;AAElC;;;;GAIG;AACH,qBAAa,YAAY,CAAC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW,CAC7E,YAAW,oBAAoB,CAAC,OAAO,CAAC;IAW5B,SAAS,CAAC,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;IAThE,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvB,OAAO,CAAC,aAAa,CAAU;IAE/B,OAAO,CAAC,WAAW,CAA2D;IAC9E,OAAO,CAAC,gBAAgB,CAAsB;gBAExB,MAAM,GAAE,yBAAyB,CAAC,OAAO,CAAM;IAoCrE;;OAEG;IACH,IAAI,QAAQ,YAGX;IAED;;OAEG;IACH,cAAc,CACZ,WAAW,EAAE,KAAK,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IAKvE;;OAEG;IACH,IAAI,CACF,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,sBAAsB,CAAC,GAC/D,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,sBAAsB,CAAC,GAC1D,OAAO,CAAC,IAAI,CAAC;IAyChB;;OAEG;IACH,KAAK;IAYL,OAAO,CAAC,qBAAqB,CAAQ;IACrC,OAAO,CAAC,kBAAkB,CAcxB;IAEF,OAAO;CAGR;AAED,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW,EAErD,SAAS,yBAAyB,CAAC,OAAO,CAAC,0BACP,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IQueryParams } from 'mobx-location-history';
|
|
2
2
|
import type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/utils/types';
|
|
3
|
-
import type { AbstractVirtualRoute, VirtualOpenExtraParams, VirtualRouteConfiguration } from
|
|
3
|
+
import type { AbstractVirtualRoute, VirtualOpenExtraParams, VirtualRouteConfiguration } from "./virtual-route.types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Class for creating routes with custom activation logic
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-route.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACN,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EAC1B,
|
|
1
|
+
{"version":3,"file":"virtual-route.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACN,MAAM,qBAAqB,CAAC;AAI7B,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,yBAAyB,EAC1B,iCAAiC;AAElC;;;;GAIG;AACH,qBAAa,YAAY,CAAC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW,CAC7E,YAAW,oBAAoB,CAAC,OAAO,CAAC;IAW5B,SAAS,CAAC,MAAM,EAAE,yBAAyB,CAAC,OAAO,CAAC;IAThE,SAAS,CAAC,eAAe,EAAE,eAAe,CAAC;IAC3C,KAAK,EAAE,YAAY,CAAC;IACpB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;IAEvB,OAAO,CAAC,aAAa,CAAU;IAE/B,OAAO,CAAC,WAAW,CAA2D;IAC9E,OAAO,CAAC,gBAAgB,CAAsB;gBAExB,MAAM,GAAE,yBAAyB,CAAC,OAAO,CAAM;IAoCrE;;OAEG;IACH,IAAI,QAAQ,YAGX;IAED;;OAEG;IACH,cAAc,CACZ,WAAW,EAAE,KAAK,CAAC,yBAAyB,CAAC,OAAO,CAAC,CAAC,aAAa,CAAC,CAAC;IAKvE;;OAEG;IACH,IAAI,CACF,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,sBAAsB,CAAC,GAC/D,CAAC,MAAM,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,sBAAsB,CAAC,GAC1D,OAAO,CAAC,IAAI,CAAC;IAyChB;;OAEG;IACH,KAAK;IAYL,OAAO,CAAC,qBAAqB,CAAQ;IACrC,OAAO,CAAC,kBAAkB,CAcxB;IAEF,OAAO;CAGR;AAED,eAAO,MAAM,kBAAkB,GAC7B,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW,EAErD,SAAS,yBAAyB,CAAC,OAAO,CAAC,0BACP,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { LinkedAbortController } from 'linked-abort-controller';
|
|
2
2
|
import { action, computed, makeObservable, observable, onBecomeObserved, onBecomeUnobserved, reaction, runInAction, } from 'mobx';
|
|
3
3
|
import { callFunction } from 'yummies/common';
|
|
4
|
-
import { routeConfig } from
|
|
4
|
+
import { routeConfig } from "../config/index.js";
|
|
5
5
|
/**
|
|
6
6
|
* Class for creating routes with custom activation logic
|
|
7
7
|
*
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
+
import type { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/utils/types';
|
|
3
|
+
import type { RouteNavigateParams } from "../route/route.types.cjs";
|
|
4
|
+
import type { VirtualRoute } from "./virtual-route.cjs";
|
|
5
|
+
export type AnyVirtualRoute = VirtualRoute<any>;
|
|
6
|
+
export interface VirtualOpenExtraParams extends Omit<RouteNavigateParams, 'state' | 'mergeQuery'> {
|
|
7
|
+
}
|
|
8
|
+
export interface AbstractVirtualRoute<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
9
|
+
isOpened: boolean;
|
|
10
|
+
params: TParams | null;
|
|
11
|
+
}
|
|
12
|
+
export interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
13
|
+
/**
|
|
14
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#abortsignal)
|
|
15
|
+
*/
|
|
16
|
+
abortSignal?: AbortSignal;
|
|
17
|
+
queryParams?: IQueryParams;
|
|
18
|
+
/**
|
|
19
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#initialparams)
|
|
20
|
+
*/
|
|
21
|
+
initialParams?: MaybeFn<Maybe<TParams>, [
|
|
22
|
+
route: VirtualRoute<NoInfer<TParams>>
|
|
23
|
+
]>;
|
|
24
|
+
/**
|
|
25
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#meta)
|
|
26
|
+
*/
|
|
27
|
+
meta?: AnyObject;
|
|
28
|
+
/**
|
|
29
|
+
* Custom implementation of open behaviour for this route
|
|
30
|
+
*
|
|
31
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
32
|
+
*/
|
|
33
|
+
open?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<boolean | void>;
|
|
34
|
+
/**
|
|
35
|
+
* Custom implementation of close behaviour for this route
|
|
36
|
+
*
|
|
37
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)
|
|
38
|
+
*/
|
|
39
|
+
close?: (route: VirtualRoute<TParams>) => boolean | void;
|
|
40
|
+
/**
|
|
41
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#checkopened)
|
|
42
|
+
*/
|
|
43
|
+
checkOpened?: (route: VirtualRoute<TParams>) => boolean;
|
|
44
|
+
/**
|
|
45
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#beforeopen)
|
|
46
|
+
*/
|
|
47
|
+
beforeOpen?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<void | boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afterclose)
|
|
50
|
+
*/
|
|
51
|
+
afterClose?: () => void;
|
|
52
|
+
/**
|
|
53
|
+
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afteropen)
|
|
54
|
+
*/
|
|
55
|
+
afterOpen?: (params: NoInfer<TParams>, route: VirtualRoute<NoInfer<TParams>>) => void;
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=virtual-route.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"virtual-route.types.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,iCAAgC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,4BAA2B;AAEvD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,YAAY,CAAC;CAAG;AAE9D,MAAM,WAAW,oBAAoB,CACnC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW;IAErD,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB,CACxC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW;IAErD;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CACrB,KAAK,CAAC,OAAO,CAAC,EACd;QAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KAAC,CACxC,CAAC;IAEF;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,CACL,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GACtD,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,KAChD,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAElC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC;IAExD;;OAEG;IACH,UAAU,CAAC,EAAE,CACX,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GACtD,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,KAChD,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAClC,IAAI,CAAC;CACX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IQueryParams } from 'mobx-location-history';
|
|
2
2
|
import type { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/utils/types';
|
|
3
|
-
import type { RouteNavigateParams } from
|
|
4
|
-
import type { VirtualRoute } from
|
|
3
|
+
import type { RouteNavigateParams } from "../route/route.types.js";
|
|
4
|
+
import type { VirtualRoute } from "./virtual-route.js";
|
|
5
5
|
export type AnyVirtualRoute = VirtualRoute<any>;
|
|
6
6
|
export interface VirtualOpenExtraParams extends Omit<RouteNavigateParams, 'state' | 'mergeQuery'> {
|
|
7
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-route.types.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,
|
|
1
|
+
{"version":3,"file":"virtual-route.types.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virtual-route.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,SAAS,EACT,KAAK,EACL,OAAO,EACP,YAAY,EACb,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,mBAAmB,EAAE,gCAAgC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AAEvD,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC;AAEhD,MAAM,WAAW,sBACf,SAAQ,IAAI,CAAC,mBAAmB,EAAE,OAAO,GAAG,YAAY,CAAC;CAAG;AAE9D,MAAM,WAAW,oBAAoB,CACnC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW;IAErD,QAAQ,EAAE,OAAO,CAAC;IAClB,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,WAAW,yBAAyB,CACxC,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW;IAErD;;OAEG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B,WAAW,CAAC,EAAE,YAAY,CAAC;IAE3B;;OAEG;IACH,aAAa,CAAC,EAAE,OAAO,CACrB,KAAK,CAAC,OAAO,CAAC,EACd;QAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;KAAC,CACxC,CAAC;IAEF;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;OAIG;IACH,IAAI,CAAC,EAAE,CACL,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GACtD,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,KAChD,YAAY,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;IAElC;;;;OAIG;IACH,KAAK,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,GAAG,IAAI,CAAC;IAEzD;;OAEG;IACH,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC;IAExD;;OAEG;IACH,UAAU,CAAC,EAAE,CACX,GAAG,IAAI,EAAE,SAAS,CAAC,OAAO,CAAC,SAAS,IAAI,GACpC,CAAC,MAAM,EAAE,KAAK,CAAC,OAAO,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,GACtD,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,KAChD,YAAY,CAAC,IAAI,GAAG,OAAO,CAAC,CAAC;IAElC;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IAExB;;OAEG;IACH,SAAS,CAAC,EAAE,CACV,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,EACxB,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,KAClC,IAAI,CAAC;CACX"}
|
package/index.cjs
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("mobx-location-history"), exports);
|
|
18
|
+
__exportStar(require("./core/index.cjs"), exports);
|
package/index.d.cts
ADDED
package/index.d.cts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,iCAAgC"}
|
package/index.d.ts
CHANGED
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,gCAAgC"}
|
package/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export * from 'mobx-location-history';
|
|
2
|
-
export * from
|
|
2
|
+
export * from "./core/index.js";
|