reactive-route 0.0.1-alpha.33 → 0.0.1-alpha.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/types/TypeRouter.d.ts +2 -2
- package/core/types/TypeRouter.d.ts.map +1 -1
- package/index.cjs +5 -5
- package/index.mjs +5 -5
- package/package.json +1 -1
|
@@ -7,11 +7,11 @@ export type TypeRouter<TRoutes extends Record<string | 'notFound' | 'internalErr
|
|
|
7
7
|
adapters: TypeAdapters;
|
|
8
8
|
currentRoute: TypeCurrentRoute<TRoutes[keyof TRoutes]>;
|
|
9
9
|
isRedirecting: boolean;
|
|
10
|
-
redirect<TRouteName extends keyof TRoutes>(config: TypeRedirectParams<TRoutes, TRouteName>): Promise<
|
|
10
|
+
redirect<TRouteName extends keyof TRoutes>(config: TypeRedirectParams<TRoutes, TRouteName>): Promise<string>;
|
|
11
11
|
restoreFromURL(params: {
|
|
12
12
|
pathname: string;
|
|
13
13
|
replace?: boolean;
|
|
14
|
-
}): Promise<
|
|
14
|
+
}): Promise<string>;
|
|
15
15
|
restoreFromServer(obj: {
|
|
16
16
|
currentRoute: TypeCurrentRoute<TRoutes[keyof TRoutes]>;
|
|
17
17
|
}): Promise<void>;
|
|
@@ -1 +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,CAA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O,CAAC,IAAI,CAAC,CAAC;IAClG,eAAe,CAAC,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,OAAO,IAAI,IAAI,CAAC;CACjB,CAAC"}
|
package/index.cjs
CHANGED
|
@@ -250,7 +250,7 @@ function createRouter(config) {
|
|
|
250
250
|
nextUrl = `${nextPathname}?${nextSearch}`;
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
|
-
if (currentUrl === nextUrl) return
|
|
253
|
+
if (currentUrl === nextUrl) return nextUrl;
|
|
254
254
|
if (currentPathname === nextPathname) {
|
|
255
255
|
if (currentSearch !== nextSearch) {
|
|
256
256
|
router.adapters.batch(() => {
|
|
@@ -263,7 +263,7 @@ function createRouter(config) {
|
|
|
263
263
|
window.history[replace ? "replaceState" : "pushState"](null, "", nextUrl);
|
|
264
264
|
}
|
|
265
265
|
}
|
|
266
|
-
return
|
|
266
|
+
return nextUrl;
|
|
267
267
|
}
|
|
268
268
|
router.adapters.batch(() => {
|
|
269
269
|
router.isRedirecting = true;
|
|
@@ -309,7 +309,7 @@ function createRouter(config) {
|
|
|
309
309
|
await loadComponentToConfig({ route: router.routes[nextRoute.name] });
|
|
310
310
|
} catch (error) {
|
|
311
311
|
if (error instanceof PreventError) {
|
|
312
|
-
return
|
|
312
|
+
return currentUrl;
|
|
313
313
|
}
|
|
314
314
|
if (error instanceof RedirectError) {
|
|
315
315
|
throw error;
|
|
@@ -327,7 +327,7 @@ function createRouter(config) {
|
|
|
327
327
|
});
|
|
328
328
|
router.isRedirecting = false;
|
|
329
329
|
});
|
|
330
|
-
return
|
|
330
|
+
return nextUrl;
|
|
331
331
|
}
|
|
332
332
|
router.adapters.batch(() => {
|
|
333
333
|
router.adapters.replaceObject(router.currentRoute, {
|
|
@@ -343,7 +343,7 @@ function createRouter(config) {
|
|
|
343
343
|
}
|
|
344
344
|
router.isRedirecting = false;
|
|
345
345
|
});
|
|
346
|
-
return
|
|
346
|
+
return nextUrl;
|
|
347
347
|
};
|
|
348
348
|
function popHandler() {
|
|
349
349
|
const currentUrl = `${location.pathname}${location.search}`;
|
package/index.mjs
CHANGED
|
@@ -219,7 +219,7 @@ function createRouter(config) {
|
|
|
219
219
|
nextUrl = `${nextPathname}?${nextSearch}`;
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
if (currentUrl === nextUrl) return
|
|
222
|
+
if (currentUrl === nextUrl) return nextUrl;
|
|
223
223
|
if (currentPathname === nextPathname) {
|
|
224
224
|
if (currentSearch !== nextSearch) {
|
|
225
225
|
router.adapters.batch(() => {
|
|
@@ -232,7 +232,7 @@ function createRouter(config) {
|
|
|
232
232
|
window.history[replace ? "replaceState" : "pushState"](null, "", nextUrl);
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
|
-
return
|
|
235
|
+
return nextUrl;
|
|
236
236
|
}
|
|
237
237
|
router.adapters.batch(() => {
|
|
238
238
|
router.isRedirecting = true;
|
|
@@ -278,7 +278,7 @@ function createRouter(config) {
|
|
|
278
278
|
await loadComponentToConfig({ route: router.routes[nextRoute.name] });
|
|
279
279
|
} catch (error) {
|
|
280
280
|
if (error instanceof PreventError) {
|
|
281
|
-
return
|
|
281
|
+
return currentUrl;
|
|
282
282
|
}
|
|
283
283
|
if (error instanceof RedirectError) {
|
|
284
284
|
throw error;
|
|
@@ -296,7 +296,7 @@ function createRouter(config) {
|
|
|
296
296
|
});
|
|
297
297
|
router.isRedirecting = false;
|
|
298
298
|
});
|
|
299
|
-
return
|
|
299
|
+
return nextUrl;
|
|
300
300
|
}
|
|
301
301
|
router.adapters.batch(() => {
|
|
302
302
|
router.adapters.replaceObject(router.currentRoute, {
|
|
@@ -312,7 +312,7 @@ function createRouter(config) {
|
|
|
312
312
|
}
|
|
313
313
|
router.isRedirecting = false;
|
|
314
314
|
});
|
|
315
|
-
return
|
|
315
|
+
return nextUrl;
|
|
316
316
|
};
|
|
317
317
|
function popHandler() {
|
|
318
318
|
const currentUrl = `${location.pathname}${location.search}`;
|