@tanstack/router-core 1.115.3 → 1.117.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.
@@ -434,7 +434,13 @@ export interface ServerSrr {
434
434
  export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
435
435
  export type AnyRouter = RouterCore<any, any, any, any, any>;
436
436
  export interface ViewTransitionOptions {
437
- types: Array<string>;
437
+ types: Array<string> | ((locationChangeInfo: {
438
+ fromLocation?: ParsedLocation;
439
+ toLocation: ParsedLocation;
440
+ pathChanged: boolean;
441
+ hrefChanged: boolean;
442
+ hashChanged: boolean;
443
+ }) => Array<string>);
438
444
  }
439
445
  export declare function defaultSerializeError(err: unknown): {
440
446
  name: string;
@@ -434,7 +434,13 @@ export interface ServerSrr {
434
434
  export type AnyRouterWithContext<TContext> = RouterCore<AnyRouteWithContext<TContext>, any, any, any, any>;
435
435
  export type AnyRouter = RouterCore<any, any, any, any, any>;
436
436
  export interface ViewTransitionOptions {
437
- types: Array<string>;
437
+ types: Array<string> | ((locationChangeInfo: {
438
+ fromLocation?: ParsedLocation;
439
+ toLocation: ParsedLocation;
440
+ pathChanged: boolean;
441
+ hrefChanged: boolean;
442
+ hashChanged: boolean;
443
+ }) => Array<string>);
438
444
  }
439
445
  export declare function defaultSerializeError(err: unknown): {
440
446
  name: string;
@@ -772,9 +772,17 @@ class RouterCore {
772
772
  if (shouldViewTransition && typeof document !== "undefined" && "startViewTransition" in document && typeof document.startViewTransition === "function") {
773
773
  let startViewTransitionParams;
774
774
  if (typeof shouldViewTransition === "object" && this.isViewTransitionTypesSupported) {
775
+ const next = this.latestLocation;
776
+ const prevLocation = this.state.resolvedLocation;
777
+ const resolvedViewTransitionTypes = typeof shouldViewTransition.types === "function" ? shouldViewTransition.types(
778
+ getLocationChangeInfo({
779
+ resolvedLocation: prevLocation,
780
+ location: next
781
+ })
782
+ ) : shouldViewTransition.types;
775
783
  startViewTransitionParams = {
776
784
  update: fn,
777
- types: shouldViewTransition.types
785
+ types: resolvedViewTransitionTypes
778
786
  };
779
787
  } else {
780
788
  startViewTransitionParams = fn;