mobx-route 0.0.38 → 0.0.40
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/assets/logo.png +0 -0
- package/assets/new-logo.pxz +0 -0
- package/package.json +6 -3
- package/react/components/route-group-view.d.ts +2 -2
- package/react/components/route-group-view.d.ts.map +1 -1
- package/react/components/route-view.d.ts +9 -9
- package/react/components/route-view.d.ts.map +1 -1
- package/react/components/route-view.js +2 -1
package/assets/logo.png
CHANGED
|
Binary file
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mobx-route",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.40",
|
|
4
4
|
"keywords": [
|
|
5
5
|
"mobx",
|
|
6
6
|
"react",
|
|
@@ -31,7 +31,8 @@
|
|
|
31
31
|
"mobx": "^6.12.4",
|
|
32
32
|
"mobx-react-lite": "^4.0.7",
|
|
33
33
|
"react": "^18.3.1",
|
|
34
|
-
"mobx-view-model": "^6.5.0"
|
|
34
|
+
"mobx-view-model": "^6.5.0",
|
|
35
|
+
"@types/react": "^18.3.20"
|
|
35
36
|
},
|
|
36
37
|
"peerDependenciesMeta": {
|
|
37
38
|
"mobx-view-model": {
|
|
@@ -40,6 +41,9 @@
|
|
|
40
41
|
"react": {
|
|
41
42
|
"optional": true
|
|
42
43
|
},
|
|
44
|
+
"@types/react": {
|
|
45
|
+
"optional": true
|
|
46
|
+
},
|
|
43
47
|
"mobx-react-lite": {
|
|
44
48
|
"optional": true
|
|
45
49
|
}
|
|
@@ -48,7 +52,6 @@
|
|
|
48
52
|
"@testing-library/react": "^16.3.0",
|
|
49
53
|
"@types/lodash-es": "^4.17.12",
|
|
50
54
|
"@types/node": "^20.17.30",
|
|
51
|
-
"@types/react": "^18.3.20",
|
|
52
55
|
"@vitejs/plugin-react-swc": "^3.9.0",
|
|
53
56
|
"@vitest/coverage-istanbul": "^3.1.2",
|
|
54
57
|
"eslint": "^8.57.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AnyRouteGroup } from '../../core/index.js';
|
|
2
|
-
import {
|
|
2
|
+
import { RouteViewConfigProps } from './route-view.js';
|
|
3
3
|
export type RouteViewCollectionProps<TRouteGroup extends AnyRouteGroup> = {
|
|
4
|
-
[K in keyof TRouteGroup['routes']]: Omit<
|
|
4
|
+
[K in keyof TRouteGroup['routes']]: Omit<RouteViewConfigProps<TRouteGroup['routes'][K]>, 'route'> | Exclude<RouteViewConfigProps<TRouteGroup['routes'][K]>['view'], undefined>;
|
|
5
5
|
};
|
|
6
6
|
export interface RouteGroupViewProps<TRouteGroup extends AnyRouteGroup> {
|
|
7
7
|
group: TRouteGroup;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-group-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-group-view.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAa,
|
|
1
|
+
{"version":3,"file":"route-group-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-group-view.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EAAa,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAElE,MAAM,MAAM,wBAAwB,CAAC,WAAW,SAAS,aAAa,IAAI;KACvE,CAAC,IAAI,MAAM,WAAW,CAAC,QAAQ,CAAC,GAC7B,IAAI,CAAC,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,GAC7D,OAAO,CACL,oBAAoB,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EACtD,SAAS,CACV;CACN,CAAC;AAEF,MAAM,WAAW,mBAAmB,CAAC,WAAW,SAAS,aAAa;IACpE,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,OAAO,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC,CAAC;CACvD;AAED,eAAO,MAAM,cAAc,wCACxB,WAAW,SAAS,aAAa,qBAG/B,mBAAmB,CAAC,WAAW,CAAC,8CAuBpC,CAAC"}
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { ComponentType, ReactNode } from 'react';
|
|
2
|
-
import type { AnyRouteEntity } from '../../core/index.js';
|
|
3
|
-
export interface
|
|
2
|
+
import type { AnyRoute, AnyRouteEntity, AnyVirtualRoute } from '../../core/index.js';
|
|
3
|
+
export interface RouteViewConfigProps<TRouteEntity extends AnyRouteEntity> {
|
|
4
4
|
route: TRouteEntity;
|
|
5
|
-
view?: ComponentType<
|
|
6
|
-
|
|
7
|
-
}>;
|
|
8
|
-
lazyView?: () => Promise<ComponentType<{
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
}>>;
|
|
5
|
+
view?: ComponentType<RouteViewProps<TRouteEntity>>;
|
|
6
|
+
lazyView?: () => Promise<ComponentType<RouteViewProps<TRouteEntity>>>;
|
|
11
7
|
loader?: ComponentType;
|
|
12
8
|
notOpenedContent?: ReactNode;
|
|
13
9
|
children?: ReactNode;
|
|
14
10
|
}
|
|
15
|
-
|
|
11
|
+
export type RouteViewProps<TRouteEntity extends AnyRouteEntity> = {
|
|
12
|
+
children?: ReactNode;
|
|
13
|
+
params: TRouteEntity extends AnyRoute ? Exclude<TRouteEntity['params'], null | undefined> : TRouteEntity extends AnyVirtualRoute ? TRouteEntity['params'] : never;
|
|
14
|
+
};
|
|
15
|
+
declare function RouteViewBase<TRouteEntity extends AnyRouteEntity>(props: RouteViewConfigProps<TRouteEntity>): string | number | boolean | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
|
|
16
16
|
export declare const RouteView: typeof RouteViewBase & {
|
|
17
17
|
displayName: string;
|
|
18
18
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,SAAS,EAAU,MAAM,OAAO,CAAC;AAGzD,OAAO,KAAK,EACV,QAAQ,EACR,cAAc,EACd,eAAe,EAChB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,WAAW,oBAAoB,CAAC,YAAY,SAAS,cAAc;IACvE,KAAK,EAAE,YAAY,CAAC;IACpB,IAAI,CAAC,EAAE,aAAa,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,EAAE,MAAM,OAAO,CAAC,aAAa,CAAC,cAAc,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;IACtE,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,gBAAgB,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,EAAE,SAAS,CAAC;CACtB;AAED,MAAM,MAAM,cAAc,CAAC,YAAY,SAAS,cAAc,IAAI;IAChE,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,YAAY,SAAS,QAAQ,GACjC,OAAO,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,GACjD,YAAY,SAAS,eAAe,GAClC,YAAY,CAAC,QAAQ,CAAC,GACtB,KAAK,CAAC;CACb,CAAC;AAEF,iBAAS,aAAa,CAAC,YAAY,SAAS,cAAc,EACxD,KAAK,EAAE,oBAAoB,CAAC,YAAY,CAAC,gHAsB1C;AAED,eAAO,MAAM,SAAS;;CAA0B,CAAC"}
|
|
@@ -17,6 +17,7 @@ function RouteViewBase(props) {
|
|
|
17
17
|
else {
|
|
18
18
|
Component = props.view;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
const params = 'params' in props.route ? props.route.params : {};
|
|
21
|
+
return Component && _jsx(Component, { params: params, children: props.children });
|
|
21
22
|
}
|
|
22
23
|
export const RouteView = observer(RouteViewBase);
|