mobx-route 0.18.0 → 0.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/index.cjs +565 -17
- package/index.cjs.map +1 -0
- package/index.d.ts +423 -2
- package/index.js +561 -2
- package/index.js.map +1 -0
- package/package.json +20 -63
- package/react.cjs +170 -0
- package/react.cjs.map +1 -0
- package/react.d.ts +71 -0
- package/react.js +170 -0
- package/react.js.map +1 -0
- package/view-model.cjs +56 -0
- package/view-model.cjs.map +1 -0
- package/view-model.d.ts +14 -0
- package/view-model.js +56 -0
- package/view-model.js.map +1 -0
- package/core/config/config.cjs +0 -36
- package/core/config/config.d.cts +0 -7
- package/core/config/config.d.cts.map +0 -1
- package/core/config/config.d.ts +0 -7
- package/core/config/config.d.ts.map +0 -1
- package/core/config/config.js +0 -33
- package/core/config/config.types.cjs +0 -2
- package/core/config/config.types.d.cts +0 -11
- package/core/config/config.types.d.cts.map +0 -1
- package/core/config/config.types.d.ts +0 -11
- package/core/config/config.types.d.ts.map +0 -1
- package/core/config/config.types.js +0 -1
- package/core/config/index.cjs +0 -18
- package/core/config/index.d.cts +0 -3
- package/core/config/index.d.cts.map +0 -1
- package/core/config/index.d.ts +0 -3
- package/core/config/index.d.ts.map +0 -1
- package/core/config/index.js +0 -2
- package/core/index.cjs +0 -21
- package/core/index.d.cts +0 -6
- package/core/index.d.cts.map +0 -1
- package/core/index.d.ts +0 -6
- package/core/index.d.ts.map +0 -1
- package/core/index.js +0 -5
- package/core/route/index.cjs +0 -18
- package/core/route/index.d.cts +0 -3
- package/core/route/index.d.cts.map +0 -1
- package/core/route/index.d.ts +0 -3
- package/core/route/index.d.ts.map +0 -1
- package/core/route/index.js +0 -2
- package/core/route/route.cjs +0 -296
- package/core/route/route.d.cts +0 -107
- package/core/route/route.d.cts.map +0 -1
- package/core/route/route.d.ts +0 -107
- package/core/route/route.d.ts.map +0 -1
- package/core/route/route.js +0 -291
- package/core/route/route.types.cjs +0 -2
- package/core/route/route.types.d.cts +0 -142
- package/core/route/route.types.d.cts.map +0 -1
- package/core/route/route.types.d.ts +0 -142
- package/core/route/route.types.d.ts.map +0 -1
- package/core/route/route.types.js +0 -1
- package/core/route-group/index.cjs +0 -18
- package/core/route-group/index.d.cts +0 -3
- package/core/route-group/index.d.cts.map +0 -1
- package/core/route-group/index.d.ts +0 -3
- package/core/route-group/index.d.ts.map +0 -1
- package/core/route-group/index.js +0 -2
- package/core/route-group/route-group.cjs +0 -67
- package/core/route-group/route-group.d.cts +0 -31
- package/core/route-group/route-group.d.cts.map +0 -1
- package/core/route-group/route-group.d.ts +0 -31
- package/core/route-group/route-group.d.ts.map +0 -1
- package/core/route-group/route-group.js +0 -62
- package/core/route-group/route-group.types.cjs +0 -2
- package/core/route-group/route-group.types.d.cts +0 -15
- package/core/route-group/route-group.types.d.cts.map +0 -1
- package/core/route-group/route-group.types.d.ts +0 -15
- package/core/route-group/route-group.types.d.ts.map +0 -1
- package/core/route-group/route-group.types.js +0 -1
- package/core/router/index.cjs +0 -18
- package/core/router/index.d.cts +0 -3
- package/core/router/index.d.cts.map +0 -1
- package/core/router/index.d.ts +0 -3
- package/core/router/index.d.ts.map +0 -1
- package/core/router/index.js +0 -2
- package/core/router/router.cjs +0 -42
- package/core/router/router.d.cts +0 -18
- package/core/router/router.d.cts.map +0 -1
- package/core/router/router.d.ts +0 -18
- package/core/router/router.d.ts.map +0 -1
- package/core/router/router.js +0 -37
- package/core/router/router.types.cjs +0 -2
- package/core/router/router.types.d.cts +0 -13
- package/core/router/router.types.d.cts.map +0 -1
- package/core/router/router.types.d.ts +0 -13
- package/core/router/router.types.d.ts.map +0 -1
- package/core/router/router.types.js +0 -1
- package/core/utils/is-route-entity.cjs +0 -5
- package/core/utils/is-route-entity.d.cts +0 -3
- package/core/utils/is-route-entity.d.cts.map +0 -1
- package/core/utils/is-route-entity.d.ts +0 -3
- package/core/utils/is-route-entity.d.ts.map +0 -1
- package/core/utils/is-route-entity.js +0 -1
- package/core/virtual-route/index.cjs +0 -18
- package/core/virtual-route/index.d.cts +0 -3
- package/core/virtual-route/index.d.cts.map +0 -1
- package/core/virtual-route/index.d.ts +0 -3
- package/core/virtual-route/index.d.ts.map +0 -1
- package/core/virtual-route/index.js +0 -2
- package/core/virtual-route/virtual-route.cjs +0 -133
- package/core/virtual-route/virtual-route.d.cts +0 -39
- package/core/virtual-route/virtual-route.d.cts.map +0 -1
- package/core/virtual-route/virtual-route.d.ts +0 -39
- package/core/virtual-route/virtual-route.d.ts.map +0 -1
- package/core/virtual-route/virtual-route.js +0 -128
- package/core/virtual-route/virtual-route.types.cjs +0 -2
- package/core/virtual-route/virtual-route.types.d.cts +0 -61
- package/core/virtual-route/virtual-route.types.d.cts.map +0 -1
- package/core/virtual-route/virtual-route.types.d.ts +0 -61
- package/core/virtual-route/virtual-route.types.d.ts.map +0 -1
- package/core/virtual-route/virtual-route.types.js +0 -1
- package/index.d.cts +0 -3
- package/index.d.cts.map +0 -1
- package/index.d.ts.map +0 -1
- package/react/components/index.cjs +0 -21
- package/react/components/index.d.cts +0 -4
- package/react/components/index.d.cts.map +0 -1
- package/react/components/index.d.ts +0 -4
- package/react/components/index.d.ts.map +0 -1
- package/react/components/index.js +0 -5
- package/react/components/link.cjs +0 -79
- package/react/components/link.d.cts +0 -23
- package/react/components/link.d.cts.map +0 -1
- package/react/components/link.d.ts +0 -23
- package/react/components/link.d.ts.map +0 -1
- package/react/components/link.js +0 -76
- package/react/components/route-view-group.cjs +0 -57
- package/react/components/route-view-group.d.cts +0 -26
- package/react/components/route-view-group.d.cts.map +0 -1
- package/react/components/route-view-group.d.ts +0 -26
- package/react/components/route-view-group.d.ts.map +0 -1
- package/react/components/route-view-group.js +0 -54
- package/react/components/route-view.cjs +0 -43
- package/react/components/route-view.d.cts +0 -25
- package/react/components/route-view.d.cts.map +0 -1
- package/react/components/route-view.d.ts +0 -25
- package/react/components/route-view.d.ts.map +0 -1
- package/react/components/route-view.js +0 -40
- package/react/index.cjs +0 -17
- package/react/index.d.cts +0 -2
- package/react/index.d.cts.map +0 -1
- package/react/index.d.ts +0 -2
- package/react/index.d.ts.map +0 -1
- package/react/index.js +0 -1
- package/view-model/index.cjs +0 -17
- package/view-model/index.d.cts +0 -2
- package/view-model/index.d.cts.map +0 -1
- package/view-model/index.d.ts +0 -2
- package/view-model/index.d.ts.map +0 -1
- package/view-model/index.js +0 -1
- package/view-model/route-view-model.cjs +0 -37
- package/view-model/route-view-model.d.cts +0 -13
- package/view-model/route-view-model.d.cts.map +0 -1
- package/view-model/route-view-model.d.ts +0 -13
- package/view-model/route-view-model.d.ts.map +0 -1
- package/view-model/route-view-model.js +0 -33
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { History, IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { RouteNavigateParams } from "../route/index.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
|
|
@@ -1 +0,0 @@
|
|
|
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,2BAA0B;AAC7D,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,13 +0,0 @@
|
|
|
1
|
-
import type { History, IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { RouteNavigateParams } from "../route/index.js";
|
|
3
|
-
import type { RoutesCollection } from "../route-group/index.js";
|
|
4
|
-
import type { Router } from "./router.js";
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
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,0BAA0B;AAC7D,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"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
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,iCAAgC;AAE9D,eAAO,MAAM,aAAa,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cACtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
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,gCAAgC;AAE9D,eAAO,MAAM,aAAa,GAAI,OAAO,GAAG,KAAG,KAAK,IAAI,cACtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const isRouteEntity = (route) => route && 'isOpened' in route;
|
|
@@ -1,18 +0,0 @@
|
|
|
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);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/index.ts"],"names":[],"mappings":"AAAA,oCAAmC;AACnC,0CAAyC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/index.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,yCAAyC"}
|
|
@@ -1,133 +0,0 @@
|
|
|
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;
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/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
|
|
@@ -1 +0,0 @@
|
|
|
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,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAI9E,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,39 +0,0 @@
|
|
|
1
|
-
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { AnyObject, EmptyObject, IsPartial, Maybe } from 'yummies/types';
|
|
3
|
-
import type { AbstractVirtualRoute, VirtualOpenExtraParams, VirtualRouteConfiguration } from "./virtual-route.types.js";
|
|
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
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-route.d.ts","sourceRoot":"","sources":["../../../src/core/virtual-route/virt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AM,kBAAkB,GAC7B,OAAO,SAAS,SAAS,GAAG,WAAW,GAAG,WAAW,EAErD,SAAS,yBAAyB,CAAC,OAAO,CAAC,0BACP,CAAC"}
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
import { LinkedAbortController } from 'linked-abort-controller';
|
|
2
|
-
import { action, computed, makeObservable, observable, onBecomeObserved, onBecomeUnobserved, reaction, runInAction, } from 'mobx';
|
|
3
|
-
import { callFunction } from 'yummies/common';
|
|
4
|
-
import { routeConfig } from "../config/index.js";
|
|
5
|
-
/**
|
|
6
|
-
* Class for creating routes with custom activation logic
|
|
7
|
-
*
|
|
8
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html)
|
|
9
|
-
*/
|
|
10
|
-
export class VirtualRoute {
|
|
11
|
-
config;
|
|
12
|
-
abortController;
|
|
13
|
-
query;
|
|
14
|
-
params;
|
|
15
|
-
isLocalOpened;
|
|
16
|
-
openChecker;
|
|
17
|
-
reactionDisposer;
|
|
18
|
-
constructor(config = {}) {
|
|
19
|
-
this.config = config;
|
|
20
|
-
this.abortController = new LinkedAbortController(config.abortSignal);
|
|
21
|
-
this.query = config.queryParams ?? routeConfig.get().queryParams;
|
|
22
|
-
this.params = callFunction(config.initialParams, this) ?? null;
|
|
23
|
-
this.openChecker = config.checkOpened;
|
|
24
|
-
this.isLocalOpened = this.openChecker?.(this) ?? false;
|
|
25
|
-
observable(this, 'params');
|
|
26
|
-
observable.ref(this, 'isLocalOpened');
|
|
27
|
-
observable.ref(this, '_isOpened');
|
|
28
|
-
computed.struct(this, 'isOpened');
|
|
29
|
-
action(this, 'setOpenChecker');
|
|
30
|
-
action(this, 'open');
|
|
31
|
-
action(this, 'close');
|
|
32
|
-
makeObservable(this);
|
|
33
|
-
onBecomeObserved(this, 'isOpened', () => {
|
|
34
|
-
if (!config.afterOpen && !config.afterClose) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
this.reactionDisposer = reaction(() => this.isOpened, this.processOpenedState, {
|
|
38
|
-
signal: this.abortController.signal,
|
|
39
|
-
fireImmediately: true,
|
|
40
|
-
});
|
|
41
|
-
});
|
|
42
|
-
onBecomeUnobserved(this, 'isOpened', () => {
|
|
43
|
-
this.reactionDisposer?.();
|
|
44
|
-
this.reactionDisposer = undefined;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#isopened-boolean)
|
|
49
|
-
*/
|
|
50
|
-
get isOpened() {
|
|
51
|
-
const isOuterOpened = this.openChecker == null || this.openChecker(this);
|
|
52
|
-
return this.isLocalOpened && isOuterOpened;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#setopenchecker-openchecker-void)
|
|
56
|
-
*/
|
|
57
|
-
setOpenChecker(openChecker) {
|
|
58
|
-
this.openChecker = openChecker;
|
|
59
|
-
}
|
|
60
|
-
async open(...args) {
|
|
61
|
-
const params = (args[0] ?? {});
|
|
62
|
-
const extraParams = args[1];
|
|
63
|
-
if (this.config.beforeOpen) {
|
|
64
|
-
const beforeOpenResult = await this.config.beforeOpen(params, this);
|
|
65
|
-
if (beforeOpenResult === false) {
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
if (this.config.open == null) {
|
|
70
|
-
runInAction(() => {
|
|
71
|
-
this.isLocalOpened = true;
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
else {
|
|
75
|
-
const result = await this.config.open(params, this);
|
|
76
|
-
// because result can return void so this is truthy for opening state
|
|
77
|
-
runInAction(() => {
|
|
78
|
-
this.isLocalOpened = result !== false;
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
if (!this.isLocalOpened) {
|
|
82
|
-
return;
|
|
83
|
-
}
|
|
84
|
-
if (extraParams?.query) {
|
|
85
|
-
this.query.update(extraParams.query, extraParams.replace);
|
|
86
|
-
}
|
|
87
|
-
runInAction(() => {
|
|
88
|
-
this.params = params;
|
|
89
|
-
});
|
|
90
|
-
if (!this.reactionDisposer && this.isOpened) {
|
|
91
|
-
this.config.afterOpen?.(this.params, this);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close-void)
|
|
96
|
-
*/
|
|
97
|
-
close() {
|
|
98
|
-
if (this.config.close == null) {
|
|
99
|
-
this.isLocalOpened = false;
|
|
100
|
-
}
|
|
101
|
-
else {
|
|
102
|
-
const result = this.config.close(this);
|
|
103
|
-
// because result can return void so this is truthy for opening state
|
|
104
|
-
this.isLocalOpened = result !== false;
|
|
105
|
-
}
|
|
106
|
-
this.params = null;
|
|
107
|
-
}
|
|
108
|
-
firstOpenedStateCheck = true;
|
|
109
|
-
processOpenedState = (isOpened) => {
|
|
110
|
-
if (this.firstOpenedStateCheck) {
|
|
111
|
-
this.firstOpenedStateCheck = false;
|
|
112
|
-
// ignore first 'afterClose' callback call
|
|
113
|
-
if (!isOpened) {
|
|
114
|
-
return;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
if (isOpened) {
|
|
118
|
-
this.config.afterOpen?.(this.params, this);
|
|
119
|
-
}
|
|
120
|
-
else {
|
|
121
|
-
this.config.afterClose?.();
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
destroy() {
|
|
125
|
-
this.abortController.abort();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
export const createVirtualRoute = (config) => new VirtualRoute(config);
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/types';
|
|
3
|
-
import type { RouteNavigateParams } from "../route/index.cjs";
|
|
4
|
-
import type { VirtualRoute } from "./virtual-route.cjs";
|
|
5
|
-
export type AnyVirtualRoute = VirtualRoute<any> | AbstractVirtualRoute<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
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open-params-extraparams-query-replace-promise-void)
|
|
13
|
-
*/
|
|
14
|
-
open(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams] : [params: TParams, extraParams?: VirtualOpenExtraParams]): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
export interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
17
|
-
/**
|
|
18
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#abortsignal)
|
|
19
|
-
*/
|
|
20
|
-
abortSignal?: AbortSignal;
|
|
21
|
-
queryParams?: IQueryParams;
|
|
22
|
-
/**
|
|
23
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#initialparams)
|
|
24
|
-
*/
|
|
25
|
-
initialParams?: MaybeFn<Maybe<TParams>, [
|
|
26
|
-
route: VirtualRoute<NoInfer<TParams>>
|
|
27
|
-
]>;
|
|
28
|
-
/**
|
|
29
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#meta)
|
|
30
|
-
*/
|
|
31
|
-
meta?: AnyObject;
|
|
32
|
-
/**
|
|
33
|
-
* Custom implementation of open behaviour for this route
|
|
34
|
-
*
|
|
35
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
36
|
-
*/
|
|
37
|
-
open?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<boolean | void>;
|
|
38
|
-
/**
|
|
39
|
-
* Custom implementation of close behaviour for this route
|
|
40
|
-
*
|
|
41
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)
|
|
42
|
-
*/
|
|
43
|
-
close?: (route: VirtualRoute<TParams>) => boolean | void;
|
|
44
|
-
/**
|
|
45
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#checkopened)
|
|
46
|
-
*/
|
|
47
|
-
checkOpened?: (route: VirtualRoute<TParams>) => boolean;
|
|
48
|
-
/**
|
|
49
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#beforeopen)
|
|
50
|
-
*/
|
|
51
|
-
beforeOpen?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<void | boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afterclose)
|
|
54
|
-
*/
|
|
55
|
-
afterClose?: () => void;
|
|
56
|
-
/**
|
|
57
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afteropen)
|
|
58
|
-
*/
|
|
59
|
-
afterOpen?: (params: NoInfer<TParams>, route: VirtualRoute<NoInfer<TParams>>) => void;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=virtual-route.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,eAAe,CAAC;AACvB,OAAO,KAA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,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,61 +0,0 @@
|
|
|
1
|
-
import type { IQueryParams } from 'mobx-location-history';
|
|
2
|
-
import type { AnyObject, EmptyObject, IsPartial, Maybe, MaybeFn, MaybePromise } from 'yummies/types';
|
|
3
|
-
import type { RouteNavigateParams } from "../route/index.js";
|
|
4
|
-
import type { VirtualRoute } from "./virtual-route.js";
|
|
5
|
-
export type AnyVirtualRoute = VirtualRoute<any> | AbstractVirtualRoute<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
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open-params-extraparams-query-replace-promise-void)
|
|
13
|
-
*/
|
|
14
|
-
open(...args: IsPartial<TParams> extends true ? [params?: Maybe<TParams>, extraParams?: VirtualOpenExtraParams] : [params: TParams, extraParams?: VirtualOpenExtraParams]): Promise<void>;
|
|
15
|
-
}
|
|
16
|
-
export interface VirtualRouteConfiguration<TParams extends AnyObject | EmptyObject = EmptyObject> {
|
|
17
|
-
/**
|
|
18
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#abortsignal)
|
|
19
|
-
*/
|
|
20
|
-
abortSignal?: AbortSignal;
|
|
21
|
-
queryParams?: IQueryParams;
|
|
22
|
-
/**
|
|
23
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#initialparams)
|
|
24
|
-
*/
|
|
25
|
-
initialParams?: MaybeFn<Maybe<TParams>, [
|
|
26
|
-
route: VirtualRoute<NoInfer<TParams>>
|
|
27
|
-
]>;
|
|
28
|
-
/**
|
|
29
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#meta)
|
|
30
|
-
*/
|
|
31
|
-
meta?: AnyObject;
|
|
32
|
-
/**
|
|
33
|
-
* Custom implementation of open behaviour for this route
|
|
34
|
-
*
|
|
35
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#open)
|
|
36
|
-
*/
|
|
37
|
-
open?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<boolean | void>;
|
|
38
|
-
/**
|
|
39
|
-
* Custom implementation of close behaviour for this route
|
|
40
|
-
*
|
|
41
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#close)
|
|
42
|
-
*/
|
|
43
|
-
close?: (route: VirtualRoute<TParams>) => boolean | void;
|
|
44
|
-
/**
|
|
45
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#checkopened)
|
|
46
|
-
*/
|
|
47
|
-
checkOpened?: (route: VirtualRoute<TParams>) => boolean;
|
|
48
|
-
/**
|
|
49
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#beforeopen)
|
|
50
|
-
*/
|
|
51
|
-
beforeOpen?: (...args: IsPartial<TParams> extends true ? [params: Maybe<TParams>, route: VirtualRoute<TParams>] : [params: TParams, route: VirtualRoute<TParams>]) => MaybePromise<void | boolean>;
|
|
52
|
-
/**
|
|
53
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afterclose)
|
|
54
|
-
*/
|
|
55
|
-
afterClose?: () => void;
|
|
56
|
-
/**
|
|
57
|
-
* [**Documentation**](https://js2me.github.io/mobx-route/core/VirtualRoute.html#afteropen)
|
|
58
|
-
*/
|
|
59
|
-
afterOpen?: (params: NoInfer<TParams>, route: VirtualRoute<NoInfer<TParams>>) => void;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=virtual-route.types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
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,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,mBAAmB,EAAE,0BAA0B;AAC7D,OAAO,KAAK,EAAE,YAAY,EAAE,2BAA2B;AAEvD,MAAM,MAAM,eAAe,GAA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ChD,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 +0,0 @@
|
|
|
1
|
-
export {};
|
package/index.d.cts
DELETED
package/index.d.cts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,iCAAgC"}
|
package/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,gCAAgC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
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("./link.cjs"), exports);
|
|
18
|
-
__exportStar(require("./route-view.cjs"), exports);
|
|
19
|
-
// export * from './route-group-view.js';
|
|
20
|
-
// export * from './route-view-map.js';
|
|
21
|
-
__exportStar(require("./route-view-group.cjs"), exports);
|