mobx-route 0.18.0 → 0.19.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.
Files changed (163) hide show
  1. package/index.cjs +536 -17
  2. package/index.cjs.map +1 -0
  3. package/index.d.ts +420 -2
  4. package/index.js +532 -2
  5. package/index.js.map +1 -0
  6. package/package.json +20 -63
  7. package/react.cjs +170 -0
  8. package/react.cjs.map +1 -0
  9. package/react.d.ts +71 -0
  10. package/react.js +170 -0
  11. package/react.js.map +1 -0
  12. package/view-model.cjs +56 -0
  13. package/view-model.cjs.map +1 -0
  14. package/view-model.d.ts +14 -0
  15. package/view-model.js +56 -0
  16. package/view-model.js.map +1 -0
  17. package/core/config/config.cjs +0 -36
  18. package/core/config/config.d.cts +0 -7
  19. package/core/config/config.d.cts.map +0 -1
  20. package/core/config/config.d.ts +0 -7
  21. package/core/config/config.d.ts.map +0 -1
  22. package/core/config/config.js +0 -33
  23. package/core/config/config.types.cjs +0 -2
  24. package/core/config/config.types.d.cts +0 -11
  25. package/core/config/config.types.d.cts.map +0 -1
  26. package/core/config/config.types.d.ts +0 -11
  27. package/core/config/config.types.d.ts.map +0 -1
  28. package/core/config/config.types.js +0 -1
  29. package/core/config/index.cjs +0 -18
  30. package/core/config/index.d.cts +0 -3
  31. package/core/config/index.d.cts.map +0 -1
  32. package/core/config/index.d.ts +0 -3
  33. package/core/config/index.d.ts.map +0 -1
  34. package/core/config/index.js +0 -2
  35. package/core/index.cjs +0 -21
  36. package/core/index.d.cts +0 -6
  37. package/core/index.d.cts.map +0 -1
  38. package/core/index.d.ts +0 -6
  39. package/core/index.d.ts.map +0 -1
  40. package/core/index.js +0 -5
  41. package/core/route/index.cjs +0 -18
  42. package/core/route/index.d.cts +0 -3
  43. package/core/route/index.d.cts.map +0 -1
  44. package/core/route/index.d.ts +0 -3
  45. package/core/route/index.d.ts.map +0 -1
  46. package/core/route/index.js +0 -2
  47. package/core/route/route.cjs +0 -296
  48. package/core/route/route.d.cts +0 -107
  49. package/core/route/route.d.cts.map +0 -1
  50. package/core/route/route.d.ts +0 -107
  51. package/core/route/route.d.ts.map +0 -1
  52. package/core/route/route.js +0 -291
  53. package/core/route/route.types.cjs +0 -2
  54. package/core/route/route.types.d.cts +0 -142
  55. package/core/route/route.types.d.cts.map +0 -1
  56. package/core/route/route.types.d.ts +0 -142
  57. package/core/route/route.types.d.ts.map +0 -1
  58. package/core/route/route.types.js +0 -1
  59. package/core/route-group/index.cjs +0 -18
  60. package/core/route-group/index.d.cts +0 -3
  61. package/core/route-group/index.d.cts.map +0 -1
  62. package/core/route-group/index.d.ts +0 -3
  63. package/core/route-group/index.d.ts.map +0 -1
  64. package/core/route-group/index.js +0 -2
  65. package/core/route-group/route-group.cjs +0 -67
  66. package/core/route-group/route-group.d.cts +0 -31
  67. package/core/route-group/route-group.d.cts.map +0 -1
  68. package/core/route-group/route-group.d.ts +0 -31
  69. package/core/route-group/route-group.d.ts.map +0 -1
  70. package/core/route-group/route-group.js +0 -62
  71. package/core/route-group/route-group.types.cjs +0 -2
  72. package/core/route-group/route-group.types.d.cts +0 -15
  73. package/core/route-group/route-group.types.d.cts.map +0 -1
  74. package/core/route-group/route-group.types.d.ts +0 -15
  75. package/core/route-group/route-group.types.d.ts.map +0 -1
  76. package/core/route-group/route-group.types.js +0 -1
  77. package/core/router/index.cjs +0 -18
  78. package/core/router/index.d.cts +0 -3
  79. package/core/router/index.d.cts.map +0 -1
  80. package/core/router/index.d.ts +0 -3
  81. package/core/router/index.d.ts.map +0 -1
  82. package/core/router/index.js +0 -2
  83. package/core/router/router.cjs +0 -42
  84. package/core/router/router.d.cts +0 -18
  85. package/core/router/router.d.cts.map +0 -1
  86. package/core/router/router.d.ts +0 -18
  87. package/core/router/router.d.ts.map +0 -1
  88. package/core/router/router.js +0 -37
  89. package/core/router/router.types.cjs +0 -2
  90. package/core/router/router.types.d.cts +0 -13
  91. package/core/router/router.types.d.cts.map +0 -1
  92. package/core/router/router.types.d.ts +0 -13
  93. package/core/router/router.types.d.ts.map +0 -1
  94. package/core/router/router.types.js +0 -1
  95. package/core/utils/is-route-entity.cjs +0 -5
  96. package/core/utils/is-route-entity.d.cts +0 -3
  97. package/core/utils/is-route-entity.d.cts.map +0 -1
  98. package/core/utils/is-route-entity.d.ts +0 -3
  99. package/core/utils/is-route-entity.d.ts.map +0 -1
  100. package/core/utils/is-route-entity.js +0 -1
  101. package/core/virtual-route/index.cjs +0 -18
  102. package/core/virtual-route/index.d.cts +0 -3
  103. package/core/virtual-route/index.d.cts.map +0 -1
  104. package/core/virtual-route/index.d.ts +0 -3
  105. package/core/virtual-route/index.d.ts.map +0 -1
  106. package/core/virtual-route/index.js +0 -2
  107. package/core/virtual-route/virtual-route.cjs +0 -133
  108. package/core/virtual-route/virtual-route.d.cts +0 -39
  109. package/core/virtual-route/virtual-route.d.cts.map +0 -1
  110. package/core/virtual-route/virtual-route.d.ts +0 -39
  111. package/core/virtual-route/virtual-route.d.ts.map +0 -1
  112. package/core/virtual-route/virtual-route.js +0 -128
  113. package/core/virtual-route/virtual-route.types.cjs +0 -2
  114. package/core/virtual-route/virtual-route.types.d.cts +0 -61
  115. package/core/virtual-route/virtual-route.types.d.cts.map +0 -1
  116. package/core/virtual-route/virtual-route.types.d.ts +0 -61
  117. package/core/virtual-route/virtual-route.types.d.ts.map +0 -1
  118. package/core/virtual-route/virtual-route.types.js +0 -1
  119. package/index.d.cts +0 -3
  120. package/index.d.cts.map +0 -1
  121. package/index.d.ts.map +0 -1
  122. package/react/components/index.cjs +0 -21
  123. package/react/components/index.d.cts +0 -4
  124. package/react/components/index.d.cts.map +0 -1
  125. package/react/components/index.d.ts +0 -4
  126. package/react/components/index.d.ts.map +0 -1
  127. package/react/components/index.js +0 -5
  128. package/react/components/link.cjs +0 -79
  129. package/react/components/link.d.cts +0 -23
  130. package/react/components/link.d.cts.map +0 -1
  131. package/react/components/link.d.ts +0 -23
  132. package/react/components/link.d.ts.map +0 -1
  133. package/react/components/link.js +0 -76
  134. package/react/components/route-view-group.cjs +0 -57
  135. package/react/components/route-view-group.d.cts +0 -26
  136. package/react/components/route-view-group.d.cts.map +0 -1
  137. package/react/components/route-view-group.d.ts +0 -26
  138. package/react/components/route-view-group.d.ts.map +0 -1
  139. package/react/components/route-view-group.js +0 -54
  140. package/react/components/route-view.cjs +0 -43
  141. package/react/components/route-view.d.cts +0 -25
  142. package/react/components/route-view.d.cts.map +0 -1
  143. package/react/components/route-view.d.ts +0 -25
  144. package/react/components/route-view.d.ts.map +0 -1
  145. package/react/components/route-view.js +0 -40
  146. package/react/index.cjs +0 -17
  147. package/react/index.d.cts +0 -2
  148. package/react/index.d.cts.map +0 -1
  149. package/react/index.d.ts +0 -2
  150. package/react/index.d.ts.map +0 -1
  151. package/react/index.js +0 -1
  152. package/view-model/index.cjs +0 -17
  153. package/view-model/index.d.cts +0 -2
  154. package/view-model/index.d.cts.map +0 -1
  155. package/view-model/index.d.ts +0 -2
  156. package/view-model/index.d.ts.map +0 -1
  157. package/view-model/index.js +0 -1
  158. package/view-model/route-view-model.cjs +0 -37
  159. package/view-model/route-view-model.d.cts +0 -13
  160. package/view-model/route-view-model.d.cts.map +0 -1
  161. package/view-model/route-view-model.d.ts +0 -13
  162. package/view-model/route-view-model.d.ts.map +0 -1
  163. package/view-model/route-view-model.js +0 -33
@@ -1,4 +0,0 @@
1
- export * from "./link.cjs";
2
- export * from "./route-view.cjs";
3
- export * from "./route-view-group.cjs";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,2BAA0B;AAC1B,iCAAgC;AAGhC,uCAAsC"}
@@ -1,4 +0,0 @@
1
- export * from "./link.js";
2
- export * from "./route-view.js";
3
- export * from "./route-view-group.js";
4
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/react/components/index.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,gCAAgC;AAGhC,sCAAsC"}
@@ -1,5 +0,0 @@
1
- export * from "./link.js";
2
- export * from "./route-view.js";
3
- // export * from './route-group-view.js';
4
- // export * from './route-view-map.js';
5
- export * from "./route-view-group.js";
@@ -1,79 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Link = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const mobx_location_history_1 = require("mobx-location-history");
6
- const mobx_react_lite_1 = require("mobx-react-lite");
7
- const react_1 = require("react");
8
- const data_1 = require("yummies/data");
9
- const index_js_1 = require("../../index.cjs");
10
- exports.Link = (0, mobx_react_lite_1.observer)((0, react_1.forwardRef)(({ to, href: outerHref, mergeQuery, asChild, children, params,
11
- // route navigate params
12
- query, replace, state, ...outerAnchorProps }, ref) => {
13
- const isExternalNavigation = outerAnchorProps.target === '_blank' ||
14
- outerAnchorProps.target === 'blank';
15
- const queryDataRef = (0, react_1.useRef)(query);
16
- if (!(0, data_1.isShallowEqual)(queryDataRef.current, query)) {
17
- queryDataRef.current = query;
18
- }
19
- const { href, navigateParams } = (0, react_1.useMemo)(() => {
20
- const navigateParams = {
21
- mergeQuery,
22
- query,
23
- replace,
24
- state,
25
- };
26
- const cfg = index_js_1.routeConfig.get();
27
- let href;
28
- if (outerHref) {
29
- href = outerHref;
30
- }
31
- else {
32
- if (typeof to === 'string') {
33
- const isNeedToMergeQuery = navigateParams.mergeQuery ?? cfg.mergeQuery;
34
- const [path, ...querySegments] = to.split('?');
35
- const existedQuery = (0, mobx_location_history_1.parseSearchString)(querySegments.join('?'));
36
- const query = {
37
- ...(isNeedToMergeQuery ? cfg.queryParams.data : {}),
38
- ...existedQuery,
39
- ...navigateParams.query,
40
- };
41
- href = `${path}${(0, mobx_location_history_1.buildSearchString)(query)}`;
42
- }
43
- else {
44
- href = to.createUrl(params, navigateParams.query, navigateParams.mergeQuery);
45
- }
46
- }
47
- return {
48
- href: cfg.formatLinkHref?.(href) ?? href,
49
- navigateParams,
50
- };
51
- }, [mergeQuery, replace, state, to, queryDataRef.current]);
52
- const handleClick = (event) => {
53
- if (isExternalNavigation ||
54
- event.ctrlKey ||
55
- event.metaKey ||
56
- event.altKey ||
57
- event.shiftKey ||
58
- event.button !== 0)
59
- return;
60
- outerAnchorProps.onClick?.(event);
61
- if (!event.defaultPrevented) {
62
- event.preventDefault();
63
- if (navigateParams.replace) {
64
- index_js_1.routeConfig.get().history.replace(href, navigateParams.state);
65
- }
66
- else {
67
- index_js_1.routeConfig.get().history.push(href, navigateParams.state);
68
- }
69
- }
70
- };
71
- const anchorProps = {
72
- ...outerAnchorProps,
73
- href,
74
- onClick: handleClick,
75
- rel: outerAnchorProps.rel ??
76
- (isExternalNavigation ? 'noopener noreferrer' : undefined),
77
- };
78
- return asChild && (0, react_1.isValidElement)(children) ? ((0, react_1.cloneElement)(children, anchorProps)) : ((0, jsx_runtime_1.jsx)("a", { ...anchorProps, ref: ref, children: children }));
79
- }));
@@ -1,23 +0,0 @@
1
- import { type AnchorHTMLAttributes } from 'react';
2
- import type { IsPartial } from 'yummies/types';
3
- import { type AnyRoute, type InputPathParams, type RouteNavigateParams } from "../../index.cjs";
4
- interface LinkAnchorProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
5
- asChild?: boolean;
6
- }
7
- type LinkPathRouteProps<TRoute extends AnyRoute> = {
8
- to: TRoute;
9
- } & (IsPartial<InputPathParams<TRoute['path']>> extends true ? {
10
- params?: InputPathParams<TRoute['path']> | null | undefined;
11
- } : {
12
- params: InputPathParams<TRoute['path']>;
13
- });
14
- type LinkSimpleRouteProps = {
15
- to: string;
16
- } | {
17
- href: string;
18
- };
19
- export type LinkProps<TRoute extends AnyRoute> = LinkAnchorProps & RouteNavigateParams & (LinkPathRouteProps<TRoute> | LinkSimpleRouteProps);
20
- type LinkComponentType = <TRoute extends AnyRoute>(props: LinkProps<TRoute>) => React.ReactNode;
21
- export declare const Link: LinkComponentType;
22
- export {};
23
- //# sourceMappingURL=link.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/react/components/link.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,wBAAuB;AAExB,UAAU,eACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,kBAAkB,CAAC,MAAM,SAAS,QAAQ,IAAI;IACjD,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,GACxD;IACE,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7D,GACD;IAAE,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CAAC;AAEjD,KAAK,oBAAoB,GACrB;IACE,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,SAAS,CAAC,MAAM,SAAS,QAAQ,IAAI,eAAe,GAC9D,mBAAmB,GACnB,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,CAAC,MAAM,SAAS,QAAQ,EAC/C,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,KACrB,KAAK,CAAC,SAAS,CAAC;AAErB,eAAO,MAAM,IAAI,EA0HD,iBAAiB,CAAC"}
@@ -1,23 +0,0 @@
1
- import { type AnchorHTMLAttributes } from 'react';
2
- import type { IsPartial } from 'yummies/types';
3
- import { type AnyRoute, type InputPathParams, type RouteNavigateParams } from "../../index.js";
4
- interface LinkAnchorProps extends Omit<AnchorHTMLAttributes<HTMLAnchorElement>, 'href'> {
5
- asChild?: boolean;
6
- }
7
- type LinkPathRouteProps<TRoute extends AnyRoute> = {
8
- to: TRoute;
9
- } & (IsPartial<InputPathParams<TRoute['path']>> extends true ? {
10
- params?: InputPathParams<TRoute['path']> | null | undefined;
11
- } : {
12
- params: InputPathParams<TRoute['path']>;
13
- });
14
- type LinkSimpleRouteProps = {
15
- to: string;
16
- } | {
17
- href: string;
18
- };
19
- export type LinkProps<TRoute extends AnyRoute> = LinkAnchorProps & RouteNavigateParams & (LinkPathRouteProps<TRoute> | LinkSimpleRouteProps);
20
- type LinkComponentType = <TRoute extends AnyRoute>(props: LinkProps<TRoute>) => React.ReactNode;
21
- export declare const Link: LinkComponentType;
22
- export {};
23
- //# sourceMappingURL=link.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"link.d.ts","sourceRoot":"","sources":["../../../src/react/components/link.tsx"],"names":[],"mappings":"AAEA,OAAO,EACL,KAAK,oBAAoB,EAO1B,MAAM,OAAO,CAAC;AAEf,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,mBAAmB,EAEzB,uBAAuB;AAExB,UAAU,eACR,SAAQ,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,KAAK,kBAAkB,CAAC,MAAM,SAAS,QAAQ,IAAI;IACjD,EAAE,EAAE,MAAM,CAAC;CACZ,GAAG,CAAC,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,IAAI,GACxD;IACE,MAAM,CAAC,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC;CAC7D,GACD;IAAE,MAAM,EAAE,eAAe,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAA;CAAE,CAAC,CAAC;AAEjD,KAAK,oBAAoB,GACrB;IACE,EAAE,EAAE,MAAM,CAAC;CACZ,GACD;IACE,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEN,MAAM,MAAM,SAAS,CAAC,MAAM,SAAS,QAAQ,IAAI,eAAe,GAC9D,mBAAmB,GACnB,CAAC,kBAAkB,CAAC,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC;AAEtD,KAAK,iBAAiB,GAAG,CAAC,MAAM,SAAS,QAAQ,EAC/C,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,KACrB,KAAK,CAAC,SAAS,CAAC;AAErB,eAAO,MAAM,IAAI,EA0HD,iBAAiB,CAAC"}
@@ -1,76 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { buildSearchString, parseSearchString } from 'mobx-location-history';
3
- import { observer } from 'mobx-react-lite';
4
- import { cloneElement, forwardRef, isValidElement, useMemo, useRef, } from 'react';
5
- import { isShallowEqual } from 'yummies/data';
6
- import { routeConfig, } from "../../index.js";
7
- export const Link = observer(forwardRef(({ to, href: outerHref, mergeQuery, asChild, children, params,
8
- // route navigate params
9
- query, replace, state, ...outerAnchorProps }, ref) => {
10
- const isExternalNavigation = outerAnchorProps.target === '_blank' ||
11
- outerAnchorProps.target === 'blank';
12
- const queryDataRef = useRef(query);
13
- if (!isShallowEqual(queryDataRef.current, query)) {
14
- queryDataRef.current = query;
15
- }
16
- const { href, navigateParams } = useMemo(() => {
17
- const navigateParams = {
18
- mergeQuery,
19
- query,
20
- replace,
21
- state,
22
- };
23
- const cfg = routeConfig.get();
24
- let href;
25
- if (outerHref) {
26
- href = outerHref;
27
- }
28
- else {
29
- if (typeof to === 'string') {
30
- const isNeedToMergeQuery = navigateParams.mergeQuery ?? cfg.mergeQuery;
31
- const [path, ...querySegments] = to.split('?');
32
- const existedQuery = parseSearchString(querySegments.join('?'));
33
- const query = {
34
- ...(isNeedToMergeQuery ? cfg.queryParams.data : {}),
35
- ...existedQuery,
36
- ...navigateParams.query,
37
- };
38
- href = `${path}${buildSearchString(query)}`;
39
- }
40
- else {
41
- href = to.createUrl(params, navigateParams.query, navigateParams.mergeQuery);
42
- }
43
- }
44
- return {
45
- href: cfg.formatLinkHref?.(href) ?? href,
46
- navigateParams,
47
- };
48
- }, [mergeQuery, replace, state, to, queryDataRef.current]);
49
- const handleClick = (event) => {
50
- if (isExternalNavigation ||
51
- event.ctrlKey ||
52
- event.metaKey ||
53
- event.altKey ||
54
- event.shiftKey ||
55
- event.button !== 0)
56
- return;
57
- outerAnchorProps.onClick?.(event);
58
- if (!event.defaultPrevented) {
59
- event.preventDefault();
60
- if (navigateParams.replace) {
61
- routeConfig.get().history.replace(href, navigateParams.state);
62
- }
63
- else {
64
- routeConfig.get().history.push(href, navigateParams.state);
65
- }
66
- }
67
- };
68
- const anchorProps = {
69
- ...outerAnchorProps,
70
- href,
71
- onClick: handleClick,
72
- rel: outerAnchorProps.rel ??
73
- (isExternalNavigation ? 'noopener noreferrer' : undefined),
74
- };
75
- return asChild && isValidElement(children) ? (cloneElement(children, anchorProps)) : (_jsx("a", { ...anchorProps, ref: ref, children: children }));
76
- }));
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RouteViewGroup = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const mobx_location_history_1 = require("mobx-location-history");
6
- const mobx_react_lite_1 = require("mobx-react-lite");
7
- const react_1 = require("react");
8
- const is_route_entity_js_1 = require("../../core/utils/is-route-entity.cjs");
9
- const index_js_1 = require("../../index.cjs");
10
- exports.RouteViewGroup = (0, mobx_react_lite_1.observer)(({ children, layout: Layout, otherwise: otherwiseNavigation,
11
- // @ts-expect-error
12
- params, ...navigateParams }) => {
13
- let activeChildNode = null;
14
- let lastInactiveChildNode = null;
15
- const childNodes = Array.isArray(children)
16
- ? children
17
- : [children];
18
- for (const childNode of childNodes) {
19
- if ((0, react_1.isValidElement)(childNode) &&
20
- // @ts-expect-error redundand checks better to wrap in this directive
21
- (0, is_route_entity_js_1.isRouteEntity)(childNode.props?.route) &&
22
- // @ts-expect-error redundand checks better to wrap in this directive
23
- childNode.props.route.isOpened) {
24
- activeChildNode = childNode;
25
- break;
26
- }
27
- else {
28
- lastInactiveChildNode = childNode;
29
- }
30
- }
31
- const hasActiveChildNode = !!activeChildNode;
32
- (0, react_1.useEffect)(() => {
33
- if (!hasActiveChildNode && otherwiseNavigation) {
34
- if (typeof otherwiseNavigation === 'string') {
35
- const history = index_js_1.routeConfig.get().history;
36
- const url = `${otherwiseNavigation}${(0, mobx_location_history_1.buildSearchString)(navigateParams.query || {})}`;
37
- if (navigateParams.replace) {
38
- history.replace(url, navigateParams.state);
39
- }
40
- else {
41
- history.push(url, navigateParams.state);
42
- }
43
- }
44
- else if (!otherwiseNavigation.isOpened) {
45
- otherwiseNavigation.open(params, navigateParams);
46
- }
47
- }
48
- }, [hasActiveChildNode, otherwiseNavigation]);
49
- if (otherwiseNavigation && !activeChildNode) {
50
- return null;
51
- }
52
- const resultNodeToRender = activeChildNode ?? lastInactiveChildNode ?? null;
53
- if (Layout) {
54
- return (0, jsx_runtime_1.jsx)(Layout, { children: resultNodeToRender });
55
- }
56
- return resultNodeToRender;
57
- });
@@ -1,26 +0,0 @@
1
- import type { IsPartial, Maybe } from 'yummies/types';
2
- import { type AnyRouteEntity, type RouteNavigateParams, type RouteParams } from "../../index.cjs";
3
- type LayoutComponent = React.ComponentType<{
4
- children?: React.ReactNode;
5
- }> | React.ComponentType<{
6
- children: React.ReactNode;
7
- }>;
8
- interface BaseProps extends RouteNavigateParams {
9
- children: React.ReactNode;
10
- layout?: LayoutComponent;
11
- }
12
- type PropsWithDefaultRoute<TRoute extends AnyRouteEntity> = BaseProps & {
13
- otherwise?: TRoute;
14
- } & (IsPartial<RouteParams<TRoute>> extends true ? {
15
- params?: Maybe<RouteParams<TRoute>>;
16
- } : {
17
- params: RouteParams<TRoute>;
18
- });
19
- type PropsWithDefaultUrl = BaseProps & {
20
- otherwise?: string;
21
- };
22
- export type RouteViewGroupProps<TRoute extends AnyRouteEntity> = PropsWithDefaultRoute<TRoute> | PropsWithDefaultUrl;
23
- type RouteViewGroupComponent = <TRoute extends AnyRouteEntity>(props: RouteViewGroupProps<TRoute>) => React.ReactNode;
24
- export declare const RouteViewGroup: RouteViewGroupComponent;
25
- export {};
26
- //# sourceMappingURL=route-view-group.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-view-group.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view-group.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEjB,wBAAuB;AAExB,KAAK,eAAe,GAChB,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,GACnD,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,CAAC;AAEvD,UAAU,SAAU,SAAQ,mBAAmB;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,KAAK,qBAAqB,CAAC,MAAM,SAAS,cAAc,IAAI,SAAS,GAAG;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,IAAI,GAC1C;IACE,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,GACD;IACE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAAC;AAET,KAAK,mBAAmB,GAAG,SAAS,GAAG;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,cAAc,IACzD,qBAAqB,CAAC,MAAM,CAAC,GAC7B,mBAAmB,CAAC;AAExB,KAAK,uBAAuB,GAAG,CAAC,MAAM,SAAS,cAAc,EAC3D,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAC/B,KAAK,CAAC,SAAS,CAAC;AAErB,eAAO,MAAM,cAAc,EA8DX,uBAAuB,CAAC"}
@@ -1,26 +0,0 @@
1
- import type { IsPartial, Maybe } from 'yummies/types';
2
- import { type AnyRouteEntity, type RouteNavigateParams, type RouteParams } from "../../index.js";
3
- type LayoutComponent = React.ComponentType<{
4
- children?: React.ReactNode;
5
- }> | React.ComponentType<{
6
- children: React.ReactNode;
7
- }>;
8
- interface BaseProps extends RouteNavigateParams {
9
- children: React.ReactNode;
10
- layout?: LayoutComponent;
11
- }
12
- type PropsWithDefaultRoute<TRoute extends AnyRouteEntity> = BaseProps & {
13
- otherwise?: TRoute;
14
- } & (IsPartial<RouteParams<TRoute>> extends true ? {
15
- params?: Maybe<RouteParams<TRoute>>;
16
- } : {
17
- params: RouteParams<TRoute>;
18
- });
19
- type PropsWithDefaultUrl = BaseProps & {
20
- otherwise?: string;
21
- };
22
- export type RouteViewGroupProps<TRoute extends AnyRouteEntity> = PropsWithDefaultRoute<TRoute> | PropsWithDefaultUrl;
23
- type RouteViewGroupComponent = <TRoute extends AnyRouteEntity>(props: RouteViewGroupProps<TRoute>) => React.ReactNode;
24
- export declare const RouteViewGroup: RouteViewGroupComponent;
25
- export {};
26
- //# sourceMappingURL=route-view-group.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-view-group.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view-group.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAEtD,OAAO,EACL,KAAK,cAAc,EACnB,KAAK,mBAAmB,EACxB,KAAK,WAAW,EAEjB,uBAAuB;AAExB,KAAK,eAAe,GAChB,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,GACnD,KAAK,CAAC,aAAa,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,CAAC,CAAC;AAEvD,UAAU,SAAU,SAAQ,mBAAmB;IAC7C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,MAAM,CAAC,EAAE,eAAe,CAAC;CAC1B;AAED,KAAK,qBAAqB,CAAC,MAAM,SAAS,cAAc,IAAI,SAAS,GAAG;IACtE,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,CAAC,SAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,SAAS,IAAI,GAC1C;IACE,MAAM,CAAC,EAAE,KAAK,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC;CACrC,GACD;IACE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAC7B,CAAC,CAAC;AAET,KAAK,mBAAmB,GAAG,SAAS,GAAG;IACrC,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,mBAAmB,CAAC,MAAM,SAAS,cAAc,IACzD,qBAAqB,CAAC,MAAM,CAAC,GAC7B,mBAAmB,CAAC;AAExB,KAAK,uBAAuB,GAAG,CAAC,MAAM,SAAS,cAAc,EAC3D,KAAK,EAAE,mBAAmB,CAAC,MAAM,CAAC,KAC/B,KAAK,CAAC,SAAS,CAAC;AAErB,eAAO,MAAM,cAAc,EA8DX,uBAAuB,CAAC"}
@@ -1,54 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { buildSearchString } from 'mobx-location-history';
3
- import { observer } from 'mobx-react-lite';
4
- import { isValidElement, useEffect } from 'react';
5
- import { isRouteEntity } from "../../core/utils/is-route-entity.js";
6
- import { routeConfig, } from "../../index.js";
7
- export const RouteViewGroup = observer(({ children, layout: Layout, otherwise: otherwiseNavigation,
8
- // @ts-expect-error
9
- params, ...navigateParams }) => {
10
- let activeChildNode = null;
11
- let lastInactiveChildNode = null;
12
- const childNodes = Array.isArray(children)
13
- ? children
14
- : [children];
15
- for (const childNode of childNodes) {
16
- if (isValidElement(childNode) &&
17
- // @ts-expect-error redundand checks better to wrap in this directive
18
- isRouteEntity(childNode.props?.route) &&
19
- // @ts-expect-error redundand checks better to wrap in this directive
20
- childNode.props.route.isOpened) {
21
- activeChildNode = childNode;
22
- break;
23
- }
24
- else {
25
- lastInactiveChildNode = childNode;
26
- }
27
- }
28
- const hasActiveChildNode = !!activeChildNode;
29
- useEffect(() => {
30
- if (!hasActiveChildNode && otherwiseNavigation) {
31
- if (typeof otherwiseNavigation === 'string') {
32
- const history = routeConfig.get().history;
33
- const url = `${otherwiseNavigation}${buildSearchString(navigateParams.query || {})}`;
34
- if (navigateParams.replace) {
35
- history.replace(url, navigateParams.state);
36
- }
37
- else {
38
- history.push(url, navigateParams.state);
39
- }
40
- }
41
- else if (!otherwiseNavigation.isOpened) {
42
- otherwiseNavigation.open(params, navigateParams);
43
- }
44
- }
45
- }, [hasActiveChildNode, otherwiseNavigation]);
46
- if (otherwiseNavigation && !activeChildNode) {
47
- return null;
48
- }
49
- const resultNodeToRender = activeChildNode ?? lastInactiveChildNode ?? null;
50
- if (Layout) {
51
- return _jsx(Layout, { children: resultNodeToRender });
52
- }
53
- return resultNodeToRender;
54
- });
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RouteView = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- const mobx_react_lite_1 = require("mobx-react-lite");
6
- const react_1 = require("react");
7
- const react_simple_loadable_1 = require("react-simple-loadable");
8
- function RouteViewBase(props) {
9
- // @ts-expect-error redundand pass first argument
10
- const lazyViewComponentRef = (0, react_1.useRef)();
11
- let Component;
12
- if (!('route' in props)) {
13
- return typeof props.children === 'function'
14
- ? props.children()
15
- : props.children;
16
- }
17
- if (!props.route.isOpened) {
18
- return props.fallback ?? null;
19
- }
20
- if (props.loadView) {
21
- if (!lazyViewComponentRef.current) {
22
- lazyViewComponentRef.current = (0, react_simple_loadable_1.loadable)({
23
- load: () => props.loadView(props.route),
24
- loading: props.loading,
25
- preload: props.preload,
26
- throwOnError: props.throwOnError,
27
- });
28
- }
29
- Component = lazyViewComponentRef.current;
30
- }
31
- else {
32
- Component = props.view;
33
- }
34
- const params = 'params' in props.route ? props.route.params : {};
35
- if (Component) {
36
- return (0, jsx_runtime_1.jsx)(Component, { params: params, children: props.children });
37
- }
38
- if (typeof props.children === 'function') {
39
- return props.children(params, props.route);
40
- }
41
- return props.children;
42
- }
43
- exports.RouteView = (0, mobx_react_lite_1.observer)(RouteViewBase);
@@ -1,25 +0,0 @@
1
- import { type LoadableConfig } from 'react-simple-loadable';
2
- import type { AnyAbstractRouteEntity, AnyRoute, AnyVirtualRoute } from "../../index.cjs";
3
- export type RouteViewComponent<TRoute extends AnyAbstractRouteEntity> = React.ComponentType<RouteViewProps<TRoute>>;
4
- interface RouteViewConfigWithoutRoute {
5
- children?: React.ReactNode | (() => React.ReactNode);
6
- }
7
- export interface RouteViewConfigWithRoute<TRoute extends AnyAbstractRouteEntity> extends Pick<LoadableConfig, 'loading' | 'preload' | 'throwOnError'> {
8
- route: TRoute;
9
- view?: RouteViewComponent<TRoute>;
10
- loadView?: (route: TRoute) => Promise<RouteViewComponent<TRoute>>;
11
- /**
12
- * Case when route is not opened
13
- */
14
- fallback?: React.ReactNode;
15
- children?: React.ReactNode | ((params: RouteViewProps<TRoute>['params'], route: TRoute) => React.ReactNode);
16
- }
17
- export type RouteViewConfig<TRoute extends AnyAbstractRouteEntity> = RouteViewConfigWithRoute<TRoute> | RouteViewConfigWithoutRoute;
18
- export type RouteViewProps<TRoute extends AnyAbstractRouteEntity> = {
19
- children?: React.ReactNode;
20
- params: TRoute extends AnyRoute ? Exclude<TRoute['params'], null | undefined> : TRoute extends AnyVirtualRoute ? TRoute['params'] : never;
21
- };
22
- type RouteViewBaseComponent = <TRoute extends AnyAbstractRouteEntity>(props: RouteViewConfig<TRoute>) => React.ReactNode;
23
- export declare const RouteView: RouteViewBaseComponent;
24
- export {};
25
- //# sourceMappingURL=route-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,eAAe,EAChB,wBAAuB;AAExB,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,sBAAsB,IAClE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9C,UAAU,2BAA2B;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,sBAAsB,CAC7E,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EACL,KAAK,CAAC,SAAS,GACf,CAAC,CACC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACxC,KAAK,EAAE,MAAM,KACV,KAAK,CAAC,SAAS,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,sBAAsB,IAC7D,wBAAwB,CAAC,MAAM,CAAC,GAChC,2BAA2B,CAAC;AAEhC,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,sBAAsB,IAAI;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,SAAS,QAAQ,GAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,GAC3C,MAAM,SAAS,eAAe,GAC5B,MAAM,CAAC,QAAQ,CAAC,GAChB,KAAK,CAAC;CACb,CAAC;AAEF,KAAK,sBAAsB,GAAG,CAAC,MAAM,SAAS,sBAAsB,EAClE,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,KAC3B,KAAK,CAAC,SAAS,CAAC;AA+CrB,eAAO,MAAM,SAAS,EAA8B,sBAAsB,CAAC"}
@@ -1,25 +0,0 @@
1
- import { type LoadableConfig } from 'react-simple-loadable';
2
- import type { AnyAbstractRouteEntity, AnyRoute, AnyVirtualRoute } from "../../index.js";
3
- export type RouteViewComponent<TRoute extends AnyAbstractRouteEntity> = React.ComponentType<RouteViewProps<TRoute>>;
4
- interface RouteViewConfigWithoutRoute {
5
- children?: React.ReactNode | (() => React.ReactNode);
6
- }
7
- export interface RouteViewConfigWithRoute<TRoute extends AnyAbstractRouteEntity> extends Pick<LoadableConfig, 'loading' | 'preload' | 'throwOnError'> {
8
- route: TRoute;
9
- view?: RouteViewComponent<TRoute>;
10
- loadView?: (route: TRoute) => Promise<RouteViewComponent<TRoute>>;
11
- /**
12
- * Case when route is not opened
13
- */
14
- fallback?: React.ReactNode;
15
- children?: React.ReactNode | ((params: RouteViewProps<TRoute>['params'], route: TRoute) => React.ReactNode);
16
- }
17
- export type RouteViewConfig<TRoute extends AnyAbstractRouteEntity> = RouteViewConfigWithRoute<TRoute> | RouteViewConfigWithoutRoute;
18
- export type RouteViewProps<TRoute extends AnyAbstractRouteEntity> = {
19
- children?: React.ReactNode;
20
- params: TRoute extends AnyRoute ? Exclude<TRoute['params'], null | undefined> : TRoute extends AnyVirtualRoute ? TRoute['params'] : never;
21
- };
22
- type RouteViewBaseComponent = <TRoute extends AnyAbstractRouteEntity>(props: RouteViewConfig<TRoute>) => React.ReactNode;
23
- export declare const RouteView: RouteViewBaseComponent;
24
- export {};
25
- //# sourceMappingURL=route-view.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"route-view.d.ts","sourceRoot":"","sources":["../../../src/react/components/route-view.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAY,MAAM,uBAAuB,CAAC;AAEtE,OAAO,KAAK,EACV,sBAAsB,EACtB,QAAQ,EACR,eAAe,EAChB,uBAAuB;AAExB,MAAM,MAAM,kBAAkB,CAAC,MAAM,SAAS,sBAAsB,IAClE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;AAE9C,UAAU,2BAA2B;IACnC,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,CAAC,MAAM,KAAK,CAAC,SAAS,CAAC,CAAC;CACtD;AAED,MAAM,WAAW,wBAAwB,CAAC,MAAM,SAAS,sBAAsB,CAC7E,SAAQ,IAAI,CAAC,cAAc,EAAE,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;IACpE,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,kBAAkB,CAAC,MAAM,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC,kBAAkB,CAAC,MAAM,CAAC,CAAC,CAAC;IAClE;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,QAAQ,CAAC,EACL,KAAK,CAAC,SAAS,GACf,CAAC,CACC,MAAM,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EACxC,KAAK,EAAE,MAAM,KACV,KAAK,CAAC,SAAS,CAAC,CAAC;CAC3B;AAED,MAAM,MAAM,eAAe,CAAC,MAAM,SAAS,sBAAsB,IAC7D,wBAAwB,CAAC,MAAM,CAAC,GAChC,2BAA2B,CAAC;AAEhC,MAAM,MAAM,cAAc,CAAC,MAAM,SAAS,sBAAsB,IAAI;IAClE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,EAAE,MAAM,SAAS,QAAQ,GAC3B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,IAAI,GAAG,SAAS,CAAC,GAC3C,MAAM,SAAS,eAAe,GAC5B,MAAM,CAAC,QAAQ,CAAC,GAChB,KAAK,CAAC;CACb,CAAC;AAEF,KAAK,sBAAsB,GAAG,CAAC,MAAM,SAAS,sBAAsB,EAClE,KAAK,EAAE,eAAe,CAAC,MAAM,CAAC,KAC3B,KAAK,CAAC,SAAS,CAAC;AA+CrB,eAAO,MAAM,SAAS,EAA8B,sBAAsB,CAAC"}
@@ -1,40 +0,0 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { observer } from 'mobx-react-lite';
3
- import { useRef } from 'react';
4
- import { loadable } from 'react-simple-loadable';
5
- function RouteViewBase(props) {
6
- // @ts-expect-error redundand pass first argument
7
- const lazyViewComponentRef = useRef();
8
- let Component;
9
- if (!('route' in props)) {
10
- return typeof props.children === 'function'
11
- ? props.children()
12
- : props.children;
13
- }
14
- if (!props.route.isOpened) {
15
- return props.fallback ?? null;
16
- }
17
- if (props.loadView) {
18
- if (!lazyViewComponentRef.current) {
19
- lazyViewComponentRef.current = loadable({
20
- load: () => props.loadView(props.route),
21
- loading: props.loading,
22
- preload: props.preload,
23
- throwOnError: props.throwOnError,
24
- });
25
- }
26
- Component = lazyViewComponentRef.current;
27
- }
28
- else {
29
- Component = props.view;
30
- }
31
- const params = 'params' in props.route ? props.route.params : {};
32
- if (Component) {
33
- return _jsx(Component, { params: params, children: props.children });
34
- }
35
- if (typeof props.children === 'function') {
36
- return props.children(params, props.route);
37
- }
38
- return props.children;
39
- }
40
- export const RouteView = observer(RouteViewBase);
package/react/index.cjs DELETED
@@ -1,17 +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("./components/index.cjs"), exports);
package/react/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./components/index.cjs";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,uCAAsC"}
package/react/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from "./components/index.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,sCAAsC"}
package/react/index.js DELETED
@@ -1 +0,0 @@
1
- export * from "./components/index.js";
@@ -1,17 +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("./route-view-model.cjs"), exports);
@@ -1,2 +0,0 @@
1
- export * from "./route-view-model.cjs";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view-model/index.ts"],"names":[],"mappings":"AAAA,uCAAsC"}
@@ -1,2 +0,0 @@
1
- export * from "./route-view-model.js";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/view-model/index.ts"],"names":[],"mappings":"AAAA,sCAAsC"}
@@ -1 +0,0 @@
1
- export * from "./route-view-model.js";