reactive-route 0.0.1-alpha.22 → 0.0.1-alpha.24

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 (44) hide show
  1. package/README.md +1 -0
  2. package/dist/cjs/index.js +23 -28
  3. package/dist/cjs/preact/index.js +7 -9
  4. package/dist/cjs/react/index.js +7 -9
  5. package/dist/cjs/solid/index.js +16 -9
  6. package/dist/core/createRouter.d.ts +7 -2
  7. package/dist/core/createRouter.d.ts.map +1 -1
  8. package/dist/core/createRoutes.d.ts +1 -1
  9. package/dist/core/createRoutes.d.ts.map +1 -1
  10. package/dist/core/index.d.ts +3 -5
  11. package/dist/core/index.d.ts.map +1 -1
  12. package/dist/core/types/TypeAdapters.d.ts +9 -0
  13. package/dist/core/types/TypeAdapters.d.ts.map +1 -0
  14. package/dist/core/types/TypeCurrentRoute.d.ts +1 -1
  15. package/dist/core/types/TypeCurrentRoute.d.ts.map +1 -1
  16. package/dist/core/types/TypePropsRouter.d.ts +2 -2
  17. package/dist/core/types/TypePropsRouter.d.ts.map +1 -1
  18. package/dist/core/types/{TypeRedirectToParams.d.ts → TypeRedirectParams.d.ts} +2 -2
  19. package/dist/core/types/TypeRedirectParams.d.ts.map +1 -0
  20. package/dist/core/types/TypeRoute.d.ts +0 -1
  21. package/dist/core/types/TypeRoute.d.ts.map +1 -1
  22. package/dist/core/types/TypeRouteRaw.d.ts +1 -0
  23. package/dist/core/types/TypeRouteRaw.d.ts.map +1 -1
  24. package/dist/core/types/TypeRouter.d.ts +21 -0
  25. package/dist/core/types/TypeRouter.d.ts.map +1 -0
  26. package/dist/core/utils/getInitialRoute.d.ts +2 -2
  27. package/dist/core/utils/getInitialRoute.d.ts.map +1 -1
  28. package/dist/core/utils/loadComponentToConfig.d.ts.map +1 -1
  29. package/dist/core/utils/replaceDynamicValues.d.ts +1 -2
  30. package/dist/core/utils/replaceDynamicValues.d.ts.map +1 -1
  31. package/dist/esm/index.js +23 -28
  32. package/dist/esm/preact/index.js +8 -10
  33. package/dist/esm/react/index.js +8 -10
  34. package/dist/esm/solid/index.js +17 -10
  35. package/dist/preact/Router.d.ts.map +1 -1
  36. package/dist/react/Router.d.ts.map +1 -1
  37. package/dist/solid/Router.d.ts.map +1 -1
  38. package/dist/tsconfig.types.react.tsbuildinfo +1 -1
  39. package/package.json +4 -2
  40. package/dist/core/types/InterfaceRouterStore.d.ts +0 -28
  41. package/dist/core/types/InterfaceRouterStore.d.ts.map +0 -1
  42. package/dist/core/types/TypeRedirectToParams.d.ts.map +0 -1
  43. package/dist/core/types/TypeRouteWithParams.d.ts +0 -6
  44. package/dist/core/types/TypeRouteWithParams.d.ts.map +0 -1
package/README.md CHANGED
@@ -4,6 +4,7 @@
4
4
  [![npm](https://img.shields.io/npm/v/reactive-route)](https://www.npmjs.com/package/reactive-route)
5
5
  ![size-core](https://github.com/dkazakov8/reactive-route/blob/master/assets/core.svg)
6
6
  ![size-react](https://github.com/dkazakov8/reactive-route/blob/master/assets/react.svg)
7
+ ![size-preact](https://github.com/dkazakov8/reactive-route/blob/master/assets/preact.svg)
7
8
  ![size-solid](https://github.com/dkazakov8/reactive-route/blob/master/assets/solid.svg)
8
9
 
9
10
  > [!WARNING]
package/dist/cjs/index.js CHANGED
@@ -23,10 +23,7 @@ __export(core_exports, {
23
23
  RedirectError: () => RedirectError,
24
24
  createRouter: () => createRouter,
25
25
  createRoutes: () => createRoutes,
26
- findRouteByPathname: () => findRouteByPathname,
27
- getInitialRoute: () => getInitialRoute,
28
26
  history: () => history,
29
- isDynamicRoute: () => isDynamicRoute,
30
27
  loadComponentToConfig: () => loadComponentToConfig,
31
28
  replaceDynamicValues: () => replaceDynamicValues
32
29
  });
@@ -46,9 +43,6 @@ function isDynamic(param) {
46
43
  function clearDynamic(param) {
47
44
  return param.replace(new RegExp(`^${constants.dynamicSeparator}`), "");
48
45
  }
49
- function isDynamicRoute(route) {
50
- return "params" in route;
51
- }
52
46
 
53
47
  // packages/core/utils/getDynamicValues.ts
54
48
  function getDynamicValues(params) {
@@ -148,13 +142,11 @@ var history = constants.isClient ? (0, import_history.createBrowserHistory)() :
148
142
  // packages/core/utils/loadComponentToConfig.ts
149
143
  function loadComponentToConfig(params) {
150
144
  const { route } = params;
151
- if (!route.component && route.loader) {
152
- const loadingFn = route.loader;
153
- return loadingFn().then((module2) => {
154
- const { default: component, pageName, ...rest } = module2;
145
+ if (!route.component) {
146
+ return route.loader().then((module2) => {
147
+ const { default: component, ...rest } = module2;
155
148
  route.component = component;
156
149
  route.otherExports = rest;
157
- route.pageName = pageName;
158
150
  });
159
151
  }
160
152
  return Promise.resolve();
@@ -196,23 +188,26 @@ function replaceDynamicValues({
196
188
 
197
189
  // packages/core/createRouter.ts
198
190
  function createRouter({
199
- adapters,
200
191
  routes,
192
+ adapters,
201
193
  lifecycleParams
202
194
  }) {
203
195
  const router = adapters.makeObservable({
204
196
  routesHistory: [],
205
197
  currentRoute: {},
206
198
  isRedirecting: false,
207
- redirectTo: void 0,
199
+ redirect: void 0,
208
200
  restoreFromURL: void 0,
209
201
  restoreFromServer: void 0,
210
202
  get adapters() {
211
203
  return adapters;
204
+ },
205
+ get routes() {
206
+ return routes;
212
207
  }
213
208
  });
214
209
  router.restoreFromServer = function restoreFromServer(obj) {
215
- adapters.batch(() => {
210
+ router.adapters.batch(() => {
216
211
  router.routesHistory.push(...obj.routesHistory || []);
217
212
  Object.assign(router.currentRoute, obj.currentRoute);
218
213
  });
@@ -222,9 +217,9 @@ function createRouter({
222
217
  return loadComponentToConfig({ route: routes[preloadedRouteName] });
223
218
  };
224
219
  router.restoreFromURL = function restoreFromURL(params) {
225
- return router.redirectTo(getInitialRoute({ routes, pathname: params.pathname }));
220
+ return router.redirect(getInitialRoute({ routes, ...params }));
226
221
  };
227
- router.redirectTo = async function redirectTo(config) {
222
+ router.redirect = async function redirect(config) {
228
223
  const { route: routeName, noHistoryPush } = config;
229
224
  let currentRoute;
230
225
  let currentPathname;
@@ -263,8 +258,8 @@ function createRouter({
263
258
  if (currentUrl === nextUrl) return Promise.resolve();
264
259
  if (currentPathname === nextPathname) {
265
260
  if (currentSearch !== nextSearch) {
266
- adapters.batch(() => {
267
- adapters.replaceObject(router.currentRoute, {
261
+ router.adapters.batch(() => {
262
+ router.adapters.replaceObject(router.currentRoute, {
268
263
  ...router.currentRoute,
269
264
  query: nextQuery || {}
270
265
  });
@@ -280,7 +275,7 @@ function createRouter({
280
275
  }
281
276
  return Promise.resolve();
282
277
  }
283
- adapters.batch(() => {
278
+ router.adapters.batch(() => {
284
279
  router.isRedirecting = true;
285
280
  });
286
281
  try {
@@ -320,7 +315,7 @@ function createRouter({
320
315
  };
321
316
  await currentRoute?.beforeLeave?.(config2, ...lifecycleParams || []);
322
317
  const redirectConfig = await nextRoute.beforeEnter?.(config2, ...lifecycleParams || []);
323
- if (redirectConfig) return redirectTo(redirectConfig);
318
+ if (redirectConfig) return redirect(redirectConfig);
324
319
  await loadComponentToConfig({ route: routes[nextRoute.name] });
325
320
  } catch (error) {
326
321
  if (error instanceof PreventError) {
@@ -331,27 +326,27 @@ function createRouter({
331
326
  }
332
327
  console.error(error);
333
328
  await loadComponentToConfig({ route: routes.internalError });
334
- adapters.batch(() => {
335
- adapters.replaceObject(router.currentRoute, {
329
+ router.adapters.batch(() => {
330
+ router.adapters.replaceObject(router.currentRoute, {
336
331
  name: routes.internalError.name,
337
332
  path: routes.internalError.path,
338
333
  props: routes[routes.internalError.name].props,
339
- query: adapters.makeObservable({}),
340
- params: adapters.makeObservable({}),
341
- pageName: routes[routes.internalError.name].pageName
334
+ query: router.adapters.makeObservable({}),
335
+ params: router.adapters.makeObservable({}),
336
+ pageId: routes[routes.internalError.name].pageId
342
337
  });
343
338
  router.isRedirecting = false;
344
339
  });
345
340
  return Promise.resolve();
346
341
  }
347
- adapters.batch(() => {
348
- adapters.replaceObject(router.currentRoute, {
342
+ router.adapters.batch(() => {
343
+ router.adapters.replaceObject(router.currentRoute, {
349
344
  name: nextRoute.name,
350
345
  path: nextRoute.path,
351
346
  props: routes[nextRoute.name].props,
352
347
  query: getQueryValues({ route: nextRoute, pathname: nextUrl }),
353
348
  params: getDynamicValues({ route: nextRoute, pathname: nextUrl }),
354
- pageName: routes[nextRoute.name].pageName
349
+ pageId: routes[nextRoute.name].pageId
355
350
  });
356
351
  const lastUrl = router.routesHistory[router.routesHistory.length - 1];
357
352
  if (lastUrl !== nextUrl) {
@@ -38,12 +38,9 @@ function RouterInner(props) {
38
38
  if (previousRoutePathname === params.location.pathname) {
39
39
  props.router.adapters.batch(() => props.router.routesHistory.pop());
40
40
  }
41
- void props.router.redirectTo({
42
- noHistoryPush: true,
43
- ...(0, import_reactive_route.getInitialRoute)({
44
- routes: props.routes,
45
- pathname: import_reactive_route.history.location.pathname
46
- })
41
+ void props.router.restoreFromURL({
42
+ pathname: import_reactive_route.history.location.pathname,
43
+ noHistoryPush: true
47
44
  });
48
45
  });
49
46
  }, []);
@@ -62,7 +59,7 @@ function RouterInner(props) {
62
59
  if (isRedirecting) preventRedirect = true;
63
60
  else if (loadedComponentName === currentRoute.name) preventRedirect = true;
64
61
  else if (loadedComponentPage != null && currentRoute.name != null) {
65
- if (loadedComponentPage === currentRoute.pageName) {
62
+ if (loadedComponentPage === currentRoute.pageId) {
66
63
  props.router.adapters.batch(() => {
67
64
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
68
65
  });
@@ -75,7 +72,7 @@ function RouterInner(props) {
75
72
  props.beforeSetPageComponent?.(componentConfig);
76
73
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
77
74
  config.loadedComponentName = currentRoute.name;
78
- config.loadedComponentPage = componentConfig.pageName;
75
+ config.loadedComponentPage = componentConfig.pageId;
79
76
  });
80
77
  }, []);
81
78
  (0, import_hooks.useState)(() => {
@@ -93,7 +90,8 @@ function RouterInner(props) {
93
90
  }, []);
94
91
  if (!config.loadedComponentName) return null;
95
92
  const LoadedComponent = props.routes[config.loadedComponentName]?.component || null;
96
- if (LoadedComponent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadedComponent, { ...config.currentProps });
93
+ if (LoadedComponent)
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadedComponent, { ...config.currentProps, router: props.router });
97
95
  return null;
98
96
  }
99
97
  function Router(props) {
@@ -38,12 +38,9 @@ function RouterInner(props) {
38
38
  if (previousRoutePathname === params.location.pathname) {
39
39
  props.router.adapters.batch(() => props.router.routesHistory.pop());
40
40
  }
41
- void props.router.redirectTo({
42
- noHistoryPush: true,
43
- ...(0, import_reactive_route.getInitialRoute)({
44
- routes: props.routes,
45
- pathname: import_reactive_route.history.location.pathname
46
- })
41
+ void props.router.restoreFromURL({
42
+ pathname: import_reactive_route.history.location.pathname,
43
+ noHistoryPush: true
47
44
  });
48
45
  });
49
46
  }, []);
@@ -62,7 +59,7 @@ function RouterInner(props) {
62
59
  if (isRedirecting) preventRedirect = true;
63
60
  else if (loadedComponentName === currentRoute.name) preventRedirect = true;
64
61
  else if (loadedComponentPage != null && currentRoute.name != null) {
65
- if (loadedComponentPage === currentRoute.pageName) {
62
+ if (loadedComponentPage === currentRoute.pageId) {
66
63
  props.router.adapters.batch(() => {
67
64
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
68
65
  });
@@ -75,7 +72,7 @@ function RouterInner(props) {
75
72
  props.beforeSetPageComponent?.(componentConfig);
76
73
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
77
74
  config.loadedComponentName = currentRoute.name;
78
- config.loadedComponentPage = componentConfig.pageName;
75
+ config.loadedComponentPage = componentConfig.pageId;
79
76
  });
80
77
  }, []);
81
78
  (0, import_react.useState)(() => {
@@ -93,7 +90,8 @@ function RouterInner(props) {
93
90
  }, []);
94
91
  if (!config.loadedComponentName) return null;
95
92
  const LoadedComponent = props.routes[config.loadedComponentName]?.component || null;
96
- if (LoadedComponent) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadedComponent, { ...config.currentProps });
93
+ if (LoadedComponent)
94
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(LoadedComponent, { ...config.currentProps, router: props.router });
97
95
  return null;
98
96
  }
99
97
  function RouterWrapper(props) {
@@ -36,6 +36,7 @@ function Router(props) {
36
36
  loadedComponentPage: void 0,
37
37
  currentProps: {}
38
38
  });
39
+ let currentProps = {};
39
40
  function redirectOnHistoryPop() {
40
41
  if (!import_reactive_route.history) return;
41
42
  import_reactive_route.history.listen((params) => {
@@ -44,18 +45,15 @@ function Router(props) {
44
45
  if (previousRoutePathname === params.location.pathname) {
45
46
  props.router.routesHistory.pop();
46
47
  }
47
- void props.router.redirectTo({
48
- noHistoryPush: true,
49
- ...(0, import_reactive_route.getInitialRoute)({
50
- routes: props.routes,
51
- pathname: import_reactive_route.history.location.pathname
52
- })
48
+ void props.router.restoreFromURL({
49
+ pathname: import_reactive_route.history.location.pathname,
50
+ noHistoryPush: true
53
51
  });
54
52
  });
55
53
  }
56
54
  function setLoadedComponent() {
57
55
  const currentRouteName = props.router.currentRoute.name;
58
- const currentRoutePage = props.router.currentRoute.pageName;
56
+ const currentRoutePage = props.router.currentRoute.pageId;
59
57
  const componentConfig = props.routes[currentRouteName];
60
58
  let preventRedirect = false;
61
59
  if (props.router.isRedirecting) preventRedirect = true;
@@ -64,6 +62,7 @@ function Router(props) {
64
62
  } else if (config.loadedComponentPage != null && currentRouteName != null) {
65
63
  if (config.loadedComponentPage === currentRoutePage) {
66
64
  props.router.adapters.replaceObject(config.currentProps, "props" in componentConfig ? componentConfig.props : {});
65
+ currentProps = "props" in componentConfig ? componentConfig.props : {};
67
66
  preventRedirect = true;
68
67
  }
69
68
  }
@@ -75,8 +74,9 @@ function Router(props) {
75
74
  props.beforeSetPageComponent?.(componentConfig);
76
75
  props.router.adapters.batch(() => {
77
76
  props.router.adapters.replaceObject(config.currentProps, "props" in componentConfig ? componentConfig.props : {});
77
+ currentProps = "props" in componentConfig ? componentConfig.props : {};
78
78
  config.loadedComponentName = currentRouteName;
79
- config.loadedComponentPage = componentConfig.pageName;
79
+ config.loadedComponentPage = componentConfig.pageId;
80
80
  });
81
81
  });
82
82
  }
@@ -99,7 +99,14 @@ function Router(props) {
99
99
  get component() {
100
100
  return props.routes[config.loadedComponentName]?.component || void 0;
101
101
  }
102
- }, () => config.currentProps));
102
+ }, () => Object.keys(config.currentProps).reduce((acc, key) => {
103
+ acc[key] = currentProps[key];
104
+ return acc;
105
+ }, {}), {
106
+ get router() {
107
+ return props.router;
108
+ }
109
+ }));
103
110
  }
104
111
  })
105
112
  );
@@ -1,4 +1,9 @@
1
- import { InterfaceRouterStore, TypeCreateRouterStore } from './types/InterfaceRouterStore';
1
+ import { TypeAdapters } from './types/TypeAdapters';
2
2
  import { TypeRoute } from './types/TypeRoute';
3
- export declare function createRouter<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>>({ adapters, routes, lifecycleParams, }: TypeCreateRouterStore<TRoutes>): InterfaceRouterStore<TRoutes>;
3
+ import { TypeRouter } from './types/TypeRouter';
4
+ export declare function createRouter<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>>({ routes, adapters, lifecycleParams, }: {
5
+ routes: TRoutes;
6
+ adapters: TypeAdapters;
7
+ lifecycleParams?: Array<any>;
8
+ }): TypeRouter<TRoutes>;
4
9
  //# sourceMappingURL=createRouter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createRouter.d.ts","sourceRoot":"","sources":["../../packages/core/createRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AAG3F,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAY9C,wBAAgB,YAAY,CAC1B,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,EACxE,EACA,QAAQ,EACR,MAAM,EACN,eAAe,GAChB,EAAE,qBAAqB,CAAC,OAAO,CAAC,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAiPhE"}
1
+ {"version":3,"file":"createRouter.d.ts","sourceRoot":"","sources":["../../packages/core/createRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAYhD,wBAAgB,YAAY,CAC1B,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,EACxE,EACA,MAAM,EACN,QAAQ,EACR,eAAe,GAChB,EAAE;IACD,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IACvB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;CAC9B,GAAG,UAAU,CAAC,OAAO,CAAC,CAoPtB"}
@@ -4,7 +4,7 @@ export declare function createRoutes<TConfig extends {
4
4
  }>(config: TConfig): {
5
5
  [Key in keyof TConfig]: TConfig[Key] & {
6
6
  name: Key;
7
- pageName?: string;
7
+ pageId?: string;
8
8
  component?: any;
9
9
  otherExports?: Record<string, any>;
10
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../packages/core/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,YAAY,CAC1B,OAAO,SAAS;KAAG,GAAG,IAAI,MAAM,OAAO,GAAG,UAAU,GAAG,eAAe,GAAG,YAAY;CAAE,EAEvF,MAAM,EAAE,OAAO,GACd;KACA,GAAG,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG;QACrC,IAAI,EAAE,GAAG,CAAC;QACV,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,SAAS,CAAC,EAAE,GAAG,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACpC;CACF,CAEA"}
1
+ {"version":3,"file":"createRoutes.d.ts","sourceRoot":"","sources":["../../packages/core/createRoutes.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAGpD,wBAAgB,YAAY,CAC1B,OAAO,SAAS;KAAG,GAAG,IAAI,MAAM,OAAO,GAAG,UAAU,GAAG,eAAe,GAAG,YAAY;CAAE,EAEvF,MAAM,EAAE,OAAO,GACd;KACA,GAAG,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG;QACrC,IAAI,EAAE,GAAG,CAAC;QACV,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,GAAG,CAAC;QAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;KACpC;CACF,CAEA"}
@@ -1,13 +1,11 @@
1
1
  export { createRouter } from './createRouter';
2
2
  export { createRoutes } from './createRoutes';
3
- export type { InterfaceRouterStore, TypeAdapters } from './types/InterfaceRouterStore';
3
+ export type { TypeAdapters } from './types/TypeAdapters';
4
4
  export type { TypeCurrentRoute } from './types/TypeCurrentRoute';
5
5
  export type { TypePropsRouter } from './types/TypePropsRouter';
6
- export type { TypeRedirectToParams } from './types/TypeRedirectToParams';
6
+ export type { TypeRedirectParams } from './types/TypeRedirectParams';
7
7
  export type { TypeRoute } from './types/TypeRoute';
8
- export { isDynamicRoute } from './utils/dynamic';
9
- export { findRouteByPathname } from './utils/findRouteByPathname';
10
- export { getInitialRoute } from './utils/getInitialRoute';
8
+ export type { TypeRouter } from './types/TypeRouter';
11
9
  export { history } from './utils/history';
12
10
  export { loadComponentToConfig } from './utils/loadComponentToConfig';
13
11
  export { RedirectError } from './utils/RedirectError';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../packages/core/index.ts"],"names":[],"m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rD,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC"}
@@ -0,0 +1,9 @@
1
+ export type TypeAdapters = {
2
+ batch: (cb: () => void) => void;
3
+ autorun: (cb: () => void) => any;
4
+ replaceObject: <TObj extends Record<string, any>>(obj: TObj, newObj: TObj) => void;
5
+ makeObservable: <TObj extends Record<string, any>>(obj: TObj) => TObj;
6
+ observer?: (comp: any) => any;
7
+ immediateSetComponent?: boolean;
8
+ };
9
+ //# sourceMappingURL=TypeAdapters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeAdapters.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeAdapters.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,GAAG,CAAC;IACjC,aAAa,EAAE,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC;IACnF,cAAc,EAAE,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACtE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC"}
@@ -5,6 +5,6 @@ export type TypeCurrentRoute<TRoute extends TypeRoute> = {
5
5
  props: TRoute['props'];
6
6
  query: Partial<Record<keyof TRoute['query'], string>>;
7
7
  params: Record<keyof TRoute['params'], string>;
8
- pageName: TRoute['pageName'];
8
+ pageId: TRoute['pageId'];
9
9
  };
10
10
  //# sourceMappingURL=TypeCurrentRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"TypeCurrentRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeCurrentRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,SAAS,IAAI;IACvD,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,QAAQ,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC;CAC9B,CAAC"}
1
+ {"version":3,"file":"TypeCurrentRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeCurrentRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,gBAAgB,CAAC,MAAM,SAAS,SAAS,IAAI;IACvD,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,MAAM,CAAC,MAAM,MAAM,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IAC/C,MAAM,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;CAC1B,CAAC"}
@@ -1,8 +1,8 @@
1
- import { InterfaceRouterStore } from './InterfaceRouterStore';
2
1
  import { TypeRoute } from './TypeRoute';
2
+ import { TypeRouter } from './TypeRouter';
3
3
  export type TypePropsRouter<TRoutes extends Record<string, TypeRoute>> = {
4
4
  routes: TRoutes;
5
- router: InterfaceRouterStore<TRoutes>;
5
+ router: TypeRouter<TRoutes>;
6
6
  beforeMount?: () => void;
7
7
  beforeSetPageComponent?: (componentConfig: TRoutes[keyof TRoutes]) => void;
8
8
  beforeUpdatePageComponent?: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"TypePropsRouter.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypePropsRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,sBAAsB,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3E,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;CACxC,CAAC"}
1
+ {"version":3,"file":"TypePropsRouter.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypePropsRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,MAAM,MAAM,eAAe,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI;IACvE,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC,OAAO,CAAC,CAAC;IAC5B,WAAW,CAAC,EAAE,MAAM,IAAI,CAAC;IACzB,sBAAsB,CAAC,EAAE,CAAC,eAAe,EAAE,OAAO,CAAC,MAAM,OAAO,CAAC,KAAK,IAAI,CAAC;IAC3E,yBAAyB,CAAC,EAAE,MAAM,IAAI,CAAC;CACxC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { TypeRoute } from './TypeRoute';
2
2
  import { TypeValidator } from './TypeValidator';
3
- export type TypeRedirectToParams<TRoutes extends Record<string, TypeRoute>, TRouteName extends keyof TRoutes> = TRoutes[TRouteName]['params'] extends Record<string, TypeValidator> ? TRoutes[TRouteName]['query'] extends Record<string, TypeValidator> ? {
3
+ export type TypeRedirectParams<TRoutes extends Record<string, TypeRoute>, TRouteName extends keyof TRoutes> = TRoutes[TRouteName]['params'] extends Record<string, TypeValidator> ? TRoutes[TRouteName]['query'] extends Record<string, TypeValidator> ? {
4
4
  route: TRouteName;
5
5
  params: Record<keyof TRoutes[TRouteName]['params'], string>;
6
6
  query?: Partial<Record<keyof TRoutes[TRouteName]['query'], string>>;
@@ -17,4 +17,4 @@ export type TypeRedirectToParams<TRoutes extends Record<string, TypeRoute>, TRou
17
17
  route: TRouteName;
18
18
  noHistoryPush?: boolean;
19
19
  };
20
- //# sourceMappingURL=TypeRedirectToParams.d.ts.map
20
+ //# sourceMappingURL=TypeRedirectParams.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeRedirectParams.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRedirectParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,kBAAkB,CAC5B,OAAO,SAAS,MAAM,CA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
5
  otherExports?: Record<string, any>;
7
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"TypeRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC,CAAC"}
1
+ {"version":3,"file":"TypeRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,MAAM,MAAM,SAAS,GAAG,YAAY,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,GAAG,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CACpC,CAAC"}
@@ -5,6 +5,7 @@ export type TypeRouteRaw = {
5
5
  loader: () => Promise<{
6
6
  default: any;
7
7
  }>;
8
+ pageId?: string;
8
9
  props?: Record<string, any>;
9
10
  query?: Record<string, TypeValidator>;
10
11
  params?: Record<string, TypeValidator>;
@@ -1 +1 @@
1
- {"version":3,"file":"TypeRouteRaw.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRouteRaw.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhD,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,OAAO,CAAC;QAAE,OAAO,EAAE,GAAG,CAA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F,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,mBAAmB,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC;CACzF,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { TypeAdapters } from './TypeAdapters';
2
+ import { TypeCurrentRoute } from './TypeCurrentRoute';
3
+ import { TypeRedirectParams } from './TypeRedirectParams';
4
+ import { TypeRoute } from './TypeRoute';
5
+ export type TypeRouter<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>> = {
6
+ routes: TRoutes;
7
+ adapters: TypeAdapters;
8
+ currentRoute: TypeCurrentRoute<TRoutes[keyof TRoutes]>;
9
+ routesHistory: Array<string>;
10
+ isRedirecting: boolean;
11
+ redirect<TRouteName extends keyof TRoutes>(config: TypeRedirectParams<TRoutes, TRouteName>): Promise<void>;
12
+ restoreFromURL(params: {
13
+ pathname: string;
14
+ noHistoryPush?: boolean;
15
+ }): Promise<void>;
16
+ restoreFromServer(obj: {
17
+ routesHistory: Array<string>;
18
+ currentRoute: TypeCurrentRoute<TRoutes[keyof TRoutes]>;
19
+ }): Promise<void>;
20
+ };
21
+ //# sourceMappingURL=TypeRouter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TypeRouter.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRouter.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,UAAU,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,IAAI;IACjG,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,YAAY,CAAC;IACvB,YAAY,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;IACvD,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,UAAU,SAAS,MAAM,OAAO,EACvC,MAAM,EAAE,kBAAkB,CAAC,OAAO,EAAE,UAAU,CAAC,GAC9C,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,cAAc,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrF,iBAAiB,CAAC,GAAG,EAAE;QACrB,aAAa,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC7B,YAAY,EAAE,gBAAgB,CAAC,OAAO,CAAC,MAAM,OAAO,CAAC,CAAC,CAAC;KACxD,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACnB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { TypeRedirectToParams } from '../types/TypeRedirectToParams';
1
+ import { TypeRedirectParams } from '../types/TypeRedirectParams';
2
2
  import { TypeRoute } from '../types/TypeRoute';
3
3
  export declare function getInitialRoute<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>>(params: {
4
4
  routes: TRoutes;
5
5
  pathname: string;
6
- }): TypeRedirectToParams<TRoutes, keyof TRoutes>;
6
+ }): TypeRedirectParams<TRoutes, keyof TRoutes>;
7
7
  //# sourceMappingURL=getInitialRoute.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getInitialRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/getInitialRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAK/C,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,EACxE,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,oBAAoB,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,CAU7F"}
1
+ {"version":3,"file":"getInitialRoute.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/getInitialRoute.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAK/C,wBAAgB,eAAe,CAC7B,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,EACxE,MAAM,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,kBAAkB,CAAC,OAAO,EAAE,MAAM,OAAO,CAAC,CAU3F"}
@@ -1 +1 @@
1
- {"version":3,"file":"loadComponentToConfig.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/loadComponentToConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAgBjF"}
1
+ {"version":3,"file":"loadComponentToConfig.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/loadComponentToConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE/C,wBAAgB,qBAAqB,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,SAAS,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAajF"}
@@ -1,7 +1,6 @@
1
1
  import { TypeCurrentRoute } from '../types/TypeCurrentRoute';
2
2
  import { TypeRoute } from '../types/TypeRoute';
3
- import { TypeRouteWithParams } from '../types/TypeRouteWithParams';
4
- export declare function replaceDynamicValues<TRouteItem extends TypeRoute | TypeRouteWithParams | TypeCurrentRoute<TypeRoute>>({ route, params, }: {
3
+ export declare function replaceDynamicValues<TRouteItem extends TypeRoute | TypeCurrentRoute<TypeRoute>>({ route, params, }: {
5
4
  route: TRouteItem;
6
5
  params?: Record<keyof TRouteItem['params'], string>;
7
6
  }): string;
@@ -1 +1 @@
1
- {"version":3,"file":"replaceDynamicValues.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/replaceDynamicValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAC;AAMnE,wBAAgB,oBAAoB,CAClC,UAAU,SAAS,SAAS,GAAG,mBAAmB,GAAG,gBAAgB,CAAC,SAAS,CAAC,EAChF,EACA,KAAK,EACL,MAAkB,GACnB,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;CACrD,GAAG,MAAM,CAcT"}
1
+ {"version":3,"file":"replaceDynamicValues.d.ts","sourceRoot":"","sources":["../../../packages/core/utils/replaceDynamicValues.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAM/C,wBAAgB,oBAAoB,CAAC,UAAU,SAAS,SAAS,GAAG,gBAAgB,CAAC,SAAS,CAAC,EAAE,EAC/F,KAAK,EACL,MAAkB,GACnB,EAAE;IACD,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;CACrD,GAAG,MAAM,CAcT"}
package/dist/esm/index.js CHANGED
@@ -12,9 +12,6 @@ function isDynamic(param) {
12
12
  function clearDynamic(param) {
13
13
  return param.replace(new RegExp(`^${constants.dynamicSeparator}`), "");
14
14
  }
15
- function isDynamicRoute(route) {
16
- return "params" in route;
17
- }
18
15
 
19
16
  // packages/core/utils/getDynamicValues.ts
20
17
  function getDynamicValues(params) {
@@ -114,13 +111,11 @@ var history = constants.isClient ? createBrowserHistory() : null;
114
111
  // packages/core/utils/loadComponentToConfig.ts
115
112
  function loadComponentToConfig(params) {
116
113
  const { route } = params;
117
- if (!route.component && route.loader) {
118
- const loadingFn = route.loader;
119
- return loadingFn().then((module) => {
120
- const { default: component, pageName, ...rest } = module;
114
+ if (!route.component) {
115
+ return route.loader().then((module) => {
116
+ const { default: component, ...rest } = module;
121
117
  route.component = component;
122
118
  route.otherExports = rest;
123
- route.pageName = pageName;
124
119
  });
125
120
  }
126
121
  return Promise.resolve();
@@ -162,23 +157,26 @@ function replaceDynamicValues({
162
157
 
163
158
  // packages/core/createRouter.ts
164
159
  function createRouter({
165
- adapters,
166
160
  routes,
161
+ adapters,
167
162
  lifecycleParams
168
163
  }) {
169
164
  const router = adapters.makeObservable({
170
165
  routesHistory: [],
171
166
  currentRoute: {},
172
167
  isRedirecting: false,
173
- redirectTo: void 0,
168
+ redirect: void 0,
174
169
  restoreFromURL: void 0,
175
170
  restoreFromServer: void 0,
176
171
  get adapters() {
177
172
  return adapters;
173
+ },
174
+ get routes() {
175
+ return routes;
178
176
  }
179
177
  });
180
178
  router.restoreFromServer = function restoreFromServer(obj) {
181
- adapters.batch(() => {
179
+ router.adapters.batch(() => {
182
180
  router.routesHistory.push(...obj.routesHistory || []);
183
181
  Object.assign(router.currentRoute, obj.currentRoute);
184
182
  });
@@ -188,9 +186,9 @@ function createRouter({
188
186
  return loadComponentToConfig({ route: routes[preloadedRouteName] });
189
187
  };
190
188
  router.restoreFromURL = function restoreFromURL(params) {
191
- return router.redirectTo(getInitialRoute({ routes, pathname: params.pathname }));
189
+ return router.redirect(getInitialRoute({ routes, ...params }));
192
190
  };
193
- router.redirectTo = async function redirectTo(config) {
191
+ router.redirect = async function redirect(config) {
194
192
  const { route: routeName, noHistoryPush } = config;
195
193
  let currentRoute;
196
194
  let currentPathname;
@@ -229,8 +227,8 @@ function createRouter({
229
227
  if (currentUrl === nextUrl) return Promise.resolve();
230
228
  if (currentPathname === nextPathname) {
231
229
  if (currentSearch !== nextSearch) {
232
- adapters.batch(() => {
233
- adapters.replaceObject(router.currentRoute, {
230
+ router.adapters.batch(() => {
231
+ router.adapters.replaceObject(router.currentRoute, {
234
232
  ...router.currentRoute,
235
233
  query: nextQuery || {}
236
234
  });
@@ -246,7 +244,7 @@ function createRouter({
246
244
  }
247
245
  return Promise.resolve();
248
246
  }
249
- adapters.batch(() => {
247
+ router.adapters.batch(() => {
250
248
  router.isRedirecting = true;
251
249
  });
252
250
  try {
@@ -286,7 +284,7 @@ function createRouter({
286
284
  };
287
285
  await currentRoute?.beforeLeave?.(config2, ...lifecycleParams || []);
288
286
  const redirectConfig = await nextRoute.beforeEnter?.(config2, ...lifecycleParams || []);
289
- if (redirectConfig) return redirectTo(redirectConfig);
287
+ if (redirectConfig) return redirect(redirectConfig);
290
288
  await loadComponentToConfig({ route: routes[nextRoute.name] });
291
289
  } catch (error) {
292
290
  if (error instanceof PreventError) {
@@ -297,27 +295,27 @@ function createRouter({
297
295
  }
298
296
  console.error(error);
299
297
  await loadComponentToConfig({ route: routes.internalError });
300
- adapters.batch(() => {
301
- adapters.replaceObject(router.currentRoute, {
298
+ router.adapters.batch(() => {
299
+ router.adapters.replaceObject(router.currentRoute, {
302
300
  name: routes.internalError.name,
303
301
  path: routes.internalError.path,
304
302
  props: routes[routes.internalError.name].props,
305
- query: adapters.makeObservable({}),
306
- params: adapters.makeObservable({}),
307
- pageName: routes[routes.internalError.name].pageName
303
+ query: router.adapters.makeObservable({}),
304
+ params: router.adapters.makeObservable({}),
305
+ pageId: routes[routes.internalError.name].pageId
308
306
  });
309
307
  router.isRedirecting = false;
310
308
  });
311
309
  return Promise.resolve();
312
310
  }
313
- adapters.batch(() => {
314
- adapters.replaceObject(router.currentRoute, {
311
+ router.adapters.batch(() => {
312
+ router.adapters.replaceObject(router.currentRoute, {
315
313
  name: nextRoute.name,
316
314
  path: nextRoute.path,
317
315
  props: routes[nextRoute.name].props,
318
316
  query: getQueryValues({ route: nextRoute, pathname: nextUrl }),
319
317
  params: getDynamicValues({ route: nextRoute, pathname: nextUrl }),
320
- pageName: routes[nextRoute.name].pageName
318
+ pageId: routes[nextRoute.name].pageId
321
319
  });
322
320
  const lastUrl = router.routesHistory[router.routesHistory.length - 1];
323
321
  if (lastUrl !== nextUrl) {
@@ -353,10 +351,7 @@ export {
353
351
  RedirectError,
354
352
  createRouter,
355
353
  createRoutes,
356
- findRouteByPathname,
357
- getInitialRoute,
358
354
  history,
359
- isDynamicRoute,
360
355
  loadComponentToConfig,
361
356
  replaceDynamicValues
362
357
  };
@@ -1,6 +1,6 @@
1
1
  // packages/preact/Router.tsx
2
2
  import { useCallback, useEffect, useRef, useState } from "preact/hooks";
3
- import { getInitialRoute, history } from "reactive-route";
3
+ import { history } from "reactive-route";
4
4
  import { jsx } from "preact/jsx-runtime";
5
5
  function RouterInner(props) {
6
6
  const disposerRef = useRef(null);
@@ -12,12 +12,9 @@ function RouterInner(props) {
12
12
  if (previousRoutePathname === params.location.pathname) {
13
13
  props.router.adapters.batch(() => props.router.routesHistory.pop());
14
14
  }
15
- void props.router.redirectTo({
16
- noHistoryPush: true,
17
- ...getInitialRoute({
18
- routes: props.routes,
19
- pathname: history.location.pathname
20
- })
15
+ void props.router.restoreFromURL({
16
+ pathname: history.location.pathname,
17
+ noHistoryPush: true
21
18
  });
22
19
  });
23
20
  }, []);
@@ -36,7 +33,7 @@ function RouterInner(props) {
36
33
  if (isRedirecting) preventRedirect = true;
37
34
  else if (loadedComponentName === currentRoute.name) preventRedirect = true;
38
35
  else if (loadedComponentPage != null && currentRoute.name != null) {
39
- if (loadedComponentPage === currentRoute.pageName) {
36
+ if (loadedComponentPage === currentRoute.pageId) {
40
37
  props.router.adapters.batch(() => {
41
38
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
42
39
  });
@@ -49,7 +46,7 @@ function RouterInner(props) {
49
46
  props.beforeSetPageComponent?.(componentConfig);
50
47
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
51
48
  config.loadedComponentName = currentRoute.name;
52
- config.loadedComponentPage = componentConfig.pageName;
49
+ config.loadedComponentPage = componentConfig.pageId;
53
50
  });
54
51
  }, []);
55
52
  useState(() => {
@@ -67,7 +64,8 @@ function RouterInner(props) {
67
64
  }, []);
68
65
  if (!config.loadedComponentName) return null;
69
66
  const LoadedComponent = props.routes[config.loadedComponentName]?.component || null;
70
- if (LoadedComponent) return /* @__PURE__ */ jsx(LoadedComponent, { ...config.currentProps });
67
+ if (LoadedComponent)
68
+ return /* @__PURE__ */ jsx(LoadedComponent, { ...config.currentProps, router: props.router });
71
69
  return null;
72
70
  }
73
71
  function Router(props) {
@@ -1,6 +1,6 @@
1
1
  // packages/react/Router.tsx
2
2
  import { memo, useCallback, useEffect, useRef, useState } from "react";
3
- import { getInitialRoute, history } from "reactive-route";
3
+ import { history } from "reactive-route";
4
4
  import { jsx } from "react/jsx-runtime";
5
5
  function RouterInner(props) {
6
6
  const disposerRef = useRef(null);
@@ -12,12 +12,9 @@ function RouterInner(props) {
12
12
  if (previousRoutePathname === params.location.pathname) {
13
13
  props.router.adapters.batch(() => props.router.routesHistory.pop());
14
14
  }
15
- void props.router.redirectTo({
16
- noHistoryPush: true,
17
- ...getInitialRoute({
18
- routes: props.routes,
19
- pathname: history.location.pathname
20
- })
15
+ void props.router.restoreFromURL({
16
+ pathname: history.location.pathname,
17
+ noHistoryPush: true
21
18
  });
22
19
  });
23
20
  }, []);
@@ -36,7 +33,7 @@ function RouterInner(props) {
36
33
  if (isRedirecting) preventRedirect = true;
37
34
  else if (loadedComponentName === currentRoute.name) preventRedirect = true;
38
35
  else if (loadedComponentPage != null && currentRoute.name != null) {
39
- if (loadedComponentPage === currentRoute.pageName) {
36
+ if (loadedComponentPage === currentRoute.pageId) {
40
37
  props.router.adapters.batch(() => {
41
38
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
42
39
  });
@@ -49,7 +46,7 @@ function RouterInner(props) {
49
46
  props.beforeSetPageComponent?.(componentConfig);
50
47
  config.currentProps = "props" in componentConfig ? componentConfig.props || {} : {};
51
48
  config.loadedComponentName = currentRoute.name;
52
- config.loadedComponentPage = componentConfig.pageName;
49
+ config.loadedComponentPage = componentConfig.pageId;
53
50
  });
54
51
  }, []);
55
52
  useState(() => {
@@ -67,7 +64,8 @@ function RouterInner(props) {
67
64
  }, []);
68
65
  if (!config.loadedComponentName) return null;
69
66
  const LoadedComponent = props.routes[config.loadedComponentName]?.component || null;
70
- if (LoadedComponent) return /* @__PURE__ */ jsx(LoadedComponent, { ...config.currentProps });
67
+ if (LoadedComponent)
68
+ return /* @__PURE__ */ jsx(LoadedComponent, { ...config.currentProps, router: props.router });
71
69
  return null;
72
70
  }
73
71
  function RouterWrapper(props) {
@@ -1,7 +1,7 @@
1
1
  // packages/solid/Router.tsx
2
2
  import { createComponent as _$createComponent } from "solid-js/web";
3
3
  import { mergeProps as _$mergeProps } from "solid-js/web";
4
- import { getInitialRoute, history } from "reactive-route";
4
+ import { history } from "reactive-route";
5
5
  import { Show } from "solid-js";
6
6
  import { Dynamic } from "solid-js/web";
7
7
  function Router(props) {
@@ -10,6 +10,7 @@ function Router(props) {
10
10
  loadedComponentPage: void 0,
11
11
  currentProps: {}
12
12
  });
13
+ let currentProps = {};
13
14
  function redirectOnHistoryPop() {
14
15
  if (!history) return;
15
16
  history.listen((params) => {
@@ -18,18 +19,15 @@ function Router(props) {
18
19
  if (previousRoutePathname === params.location.pathname) {
19
20
  props.router.routesHistory.pop();
20
21
  }
21
- void props.router.redirectTo({
22
- noHistoryPush: true,
23
- ...getInitialRoute({
24
- routes: props.routes,
25
- pathname: history.location.pathname
26
- })
22
+ void props.router.restoreFromURL({
23
+ pathname: history.location.pathname,
24
+ noHistoryPush: true
27
25
  });
28
26
  });
29
27
  }
30
28
  function setLoadedComponent() {
31
29
  const currentRouteName = props.router.currentRoute.name;
32
- const currentRoutePage = props.router.currentRoute.pageName;
30
+ const currentRoutePage = props.router.currentRoute.pageId;
33
31
  const componentConfig = props.routes[currentRouteName];
34
32
  let preventRedirect = false;
35
33
  if (props.router.isRedirecting) preventRedirect = true;
@@ -38,6 +36,7 @@ function Router(props) {
38
36
  } else if (config.loadedComponentPage != null && currentRouteName != null) {
39
37
  if (config.loadedComponentPage === currentRoutePage) {
40
38
  props.router.adapters.replaceObject(config.currentProps, "props" in componentConfig ? componentConfig.props : {});
39
+ currentProps = "props" in componentConfig ? componentConfig.props : {};
41
40
  preventRedirect = true;
42
41
  }
43
42
  }
@@ -49,8 +48,9 @@ function Router(props) {
49
48
  props.beforeSetPageComponent?.(componentConfig);
50
49
  props.router.adapters.batch(() => {
51
50
  props.router.adapters.replaceObject(config.currentProps, "props" in componentConfig ? componentConfig.props : {});
51
+ currentProps = "props" in componentConfig ? componentConfig.props : {};
52
52
  config.loadedComponentName = currentRouteName;
53
- config.loadedComponentPage = componentConfig.pageName;
53
+ config.loadedComponentPage = componentConfig.pageId;
54
54
  });
55
55
  });
56
56
  }
@@ -73,7 +73,14 @@ function Router(props) {
73
73
  get component() {
74
74
  return props.routes[config.loadedComponentName]?.component || void 0;
75
75
  }
76
- }, () => config.currentProps));
76
+ }, () => Object.keys(config.currentProps).reduce((acc, key) => {
77
+ acc[key] = currentProps[key];
78
+ return acc;
79
+ }, {}), {
80
+ get router() {
81
+ return props.router;
82
+ }
83
+ }));
77
84
  }
78
85
  })
79
86
  );
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/preact/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAA4B,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAkGtF,wBAAgB,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAK1D,GAAG,CACzC"}
1
+ {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/preact/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgGrE,wBAAgB,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAK1D,GAAG,CACzC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/react/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAA4B,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAuGtF,iBAAS,aAAa,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAK1D,GAAG,CACzC;AAED,eAAO,MAAM,MAAM,EAA0B,OAAO,aAAa,CAAC"}
1
+ {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/react/Router.tsx"],"names":[],"mappings":"AACA,OAAO,EAAW,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgGrE,iBAAS,aAAa,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,GAK1D,GAAG,CACzC;AAED,eAAO,MAAM,MAAM,EAA0B,OAAO,aAAa,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/solid/Router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAA4B,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAItF,wBAAgB,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,kCAgGhG"}
1
+ {"version":3,"file":"Router.d.ts","sourceRoot":"","sources":["../../packages/solid/Router.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAIrE,wBAAgB,MAAM,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,eAAe,CAAC,OAAO,CAAC,kCAsGhG"}
@@ -1 +1 @@
1
- {"root":["../packages/adapters/kr-observable-preact.ts","../packages/adapters/kr-observable-react.ts","../packages/adapters/kr-observable-solid.ts","../packages/adapters/mobx-preact.ts","../packages/adapters/mobx-react.ts","../packages/adapters/mobx-solid.ts","../packages/adapters/solid.ts","../packages/core/createRouter.ts","../packages/core/createRoutes.ts","../packages/core/index.ts","../packages/core/types/InterfaceRouterStore.ts","../packages/core/types/TypeCurrentRoute.ts","../packages/core/types/TypeLifecycleConfig.ts","../packages/core/types/TypePropsRouter.ts","../packages/core/types/TypeRedirectToParams.ts","../packages/core/types/TypeRoute.ts","../packages/core/types/TypeRouteRaw.ts","../packages/core/types/TypeRouteWithParams.ts","../packages/core/types/TypeValidator.ts","../packages/core/utils/PreventError.ts","../packages/core/utils/RedirectError.ts","../packages/core/utils/addNames.ts","../packages/core/utils/constants.ts","../packages/core/utils/dynamic.ts","../packages/core/utils/findRouteByPathname.ts","../packages/core/utils/getDynamicValues.ts","../packages/core/utils/getInitialRoute.ts","../packages/core/utils/getQueryValues.ts","../packages/core/utils/getTypedEntries.ts","../packages/core/utils/history.ts","../packages/core/utils/loadComponentToConfig.ts","../packages/core/utils/queryString.ts","../packages/core/utils/replaceDynamicValues.ts","../packages/preact/Router.tsx","../packages/preact/index.ts","../packages/react/Router.tsx","../packages/react/index.ts"],"version":"5.9.2"}
1
+ {"root":["../packages/adapters/kr-observable-preact.ts","../packages/adapters/kr-observable-react.ts","../packages/adapters/kr-observable-solid.ts","../packages/adapters/mobx-preact.ts","../packages/adapters/mobx-react.ts","../packages/adapters/mobx-solid.ts","../packages/adapters/solid.ts","../packages/core/createRouter.ts","../packages/core/createRoutes.ts","../packages/core/index.ts","../packages/core/types/TypeAdapters.ts","../packages/core/types/TypeCurrentRoute.ts","../packages/core/types/TypeLifecycleConfig.ts","../packages/core/types/TypePropsRouter.ts","../packages/core/types/TypeRedirectParams.ts","../packages/core/types/TypeRoute.ts","../packages/core/types/TypeRouteRaw.ts","../packages/core/types/TypeRouter.ts","../packages/core/types/TypeValidator.ts","../packages/core/utils/PreventError.ts","../packages/core/utils/RedirectError.ts","../packages/core/utils/addNames.ts","../packages/core/utils/constants.ts","../packages/core/utils/dynamic.ts","../packages/core/utils/findRouteByPathname.ts","../packages/core/utils/getDynamicValues.ts","../packages/core/utils/getInitialRoute.ts","../packages/core/utils/getQueryValues.ts","../packages/core/utils/getTypedEntries.ts","../packages/core/utils/history.ts","../packages/core/utils/loadComponentToConfig.ts","../packages/core/utils/queryString.ts","../packages/core/utils/replaceDynamicValues.ts","../packages/preact/Router.tsx","../packages/preact/index.ts","../packages/react/Router.tsx","../packages/react/index.ts"],"version":"5.9.2"}
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "reactive-route",
3
3
  "author": "Dmitry Kazakov",
4
4
  "license": "MIT",
5
- "version": "0.0.1-alpha.22",
5
+ "version": "0.0.1-alpha.24",
6
6
  "description": "Reactive Router for different frameworks",
7
7
  "repository": {
8
8
  "type": "git",
@@ -40,12 +40,14 @@
40
40
  "vite-plugin-babel": "1.3.2",
41
41
  "@biomejs/biome": "2.2.2",
42
42
  "@espcom/esbuild-plugin-replace": "1.3.1",
43
+ "@espcom/esbuild-plugin-compress": "1.2.0",
43
44
  "@solidjs/testing-library": "0.8.10",
44
45
  "@testing-library/react": "16.3.0",
45
46
  "@testing-library/preact": "3.2.4",
46
47
  "@types/lodash": "4.17.16",
47
48
  "@types/node": "22.14.1",
48
49
  "@vitest/coverage-istanbul": "3.2.4",
50
+ "vite-tsconfig-paths": "5.1.4",
49
51
  "@preact/preset-vite": "2.10.2",
50
52
  "badge-maker": "5.0.2",
51
53
  "esbuild": "0.25.10",
@@ -62,7 +64,7 @@
62
64
  "solid-js": "1.9.9",
63
65
  "tsx": "4.20.5",
64
66
  "typescript": "5.9.2",
65
- "vitepress": "1.6.4",
67
+ "vitepress": "2.0.0-alpha.12",
66
68
  "vitepress-plugin-group-icons": "1.6.3",
67
69
  "vitest": "3.2.4",
68
70
  "xml-splitter": "1.2.1"
@@ -1,28 +0,0 @@
1
- import { TypeCurrentRoute } from './TypeCurrentRoute';
2
- import { TypeRedirectToParams } from './TypeRedirectToParams';
3
- import { TypeRoute } from './TypeRoute';
4
- export type TypeAdapters = {
5
- batch: (cb: () => void) => void;
6
- autorun: (cb: () => void) => any;
7
- replaceObject: <TObj extends Record<string, any>>(obj: TObj, newObj: TObj) => void;
8
- makeObservable: <TObj extends Record<string, any>>(obj: TObj) => TObj;
9
- observer?: (comp: any) => any;
10
- immediateSetComponent?: boolean;
11
- };
12
- export type TypeCreateRouterStore<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>> = {
13
- routes: TRoutes;
14
- lifecycleParams?: Array<any>;
15
- adapters: TypeAdapters;
16
- };
17
- export type InterfaceRouterStore<TRoutes extends Record<string | 'notFound' | 'internalError', TypeRoute>> = {
18
- adapters: TypeAdapters;
19
- currentRoute: TypeCurrentRoute<TRoutes[keyof TRoutes]>;
20
- routesHistory: Array<string>;
21
- isRedirecting: boolean;
22
- redirectTo<TRouteName extends keyof TRoutes>(config: TypeRedirectToParams<TRoutes, TRouteName>): Promise<void>;
23
- restoreFromURL(params: {
24
- pathname: string;
25
- }): Promise<void>;
26
- restoreFromServer(obj: InterfaceRouterStore<TRoutes>): Promise<void>;
27
- };
28
- //# sourceMappingURL=InterfaceRouterStore.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InterfaceRouterStore.d.ts","sourceRoot":"","sources":["../../../packages/core/types/InterfaceRouterStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,IAAI,CAAC;IAChC,OAAO,EAAE,CAAC,EAAE,EAAE,MAAM,IAAI,KAAK,GAAG,CAAC;IACjC,aAAa,EAAE,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,KAAK,IAAI,CAAC;IACnF,cAAc,EAAE,CAAC,IAAI,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,GAAG,EAAE,IAAI,KAAK,IAAI,CAAC;IACtE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,GAAG,CAAC;IAC9B,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC,CAAC;AAEF,MAAM,MAAM,qBAAqB,CAC/B,OAAO,SAAS,MAAM,CAAC,MAAM,GAAG,UAAU,GAAG,eAAe,EAAE,SAAS,CAAC,IACtE;IACF,MAAM,EAAE,OAAO,CAAC;IAChB,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,QAAQ,EAAE,YAAY,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,oBAAoB,CAC9B,O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AE,MAAM,CAAC,CAAC;IAC5D,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACD;IACE,KAAK,EAAE,UAAU,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;IAC5D,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACH,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,GAChE;IACE,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,MAAM,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IACpE,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,GACD;IACE,KAAK,EAAE,UAAU,CAAC;IAClB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
@@ -1,6 +0,0 @@
1
- import { TypeRoute } from './TypeRoute';
2
- export type TypeRouteWithParams = Omit<TypeRoute, 'params'> & {
3
- params: Record<string, string>;
4
- query: Record<string, string>;
5
- };
6
- //# sourceMappingURL=TypeRouteWithParams.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"TypeRouteWithParams.d.ts","sourceRoot":"","sources":["../../../packages/core/types/TypeRouteWithParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,MAAM,MAAM,mBAAmB,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG;IAC5D,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/B,CAAC"}