@aurelia/router-lite
Advanced tools
Comparing version 2.0.1-dev.202307240932 to 2.0.1-dev.202310060506
@@ -22,8 +22,2 @@ import { type ILogger } from '@aurelia/kernel'; | ||
} | ||
export interface RouteNodeMatchOptions { | ||
/** Endpoints will be matched instead of instruction */ | ||
matchEndpoint: boolean; | ||
/** Original instruction will be matched */ | ||
matchOriginalInstruction: boolean; | ||
} | ||
export declare class RouteNode implements IRouteNode { | ||
@@ -70,3 +64,3 @@ /** | ||
}): RouteNode; | ||
contains(instructions: ViewportInstructionTree, options: Partial<RouteNodeMatchOptions>): boolean; | ||
contains(instructions: ViewportInstructionTree, matchEndpoint?: boolean): boolean; | ||
getTitle(separator: string): string | null; | ||
@@ -82,3 +76,3 @@ computeAbsolutePath(): string; | ||
constructor(options: NavigationOptions, queryParams: Readonly<URLSearchParams>, fragment: string | null, root: RouteNode); | ||
contains(instructions: ViewportInstructionTree, options: Partial<RouteNodeMatchOptions>): boolean; | ||
contains(instructions: ViewportInstructionTree, matchEndpoint?: boolean): boolean; | ||
toString(): string; | ||
@@ -85,0 +79,0 @@ } |
{ | ||
"name": "@aurelia/router-lite", | ||
"version": "2.0.1-dev.202307240932", | ||
"version": "2.0.1-dev.202310060506", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -53,9 +53,9 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202307240932", | ||
"@aurelia/metadata": "2.0.1-dev.202307240932", | ||
"@aurelia/platform": "2.0.1-dev.202307240932", | ||
"@aurelia/platform-browser": "2.0.1-dev.202307240932", | ||
"@aurelia/route-recognizer": "2.0.1-dev.202307240932", | ||
"@aurelia/runtime": "2.0.1-dev.202307240932", | ||
"@aurelia/runtime-html": "2.0.1-dev.202307240932" | ||
"@aurelia/kernel": "2.0.1-dev.202310060506", | ||
"@aurelia/metadata": "2.0.1-dev.202310060506", | ||
"@aurelia/platform": "2.0.1-dev.202310060506", | ||
"@aurelia/platform-browser": "2.0.1-dev.202310060506", | ||
"@aurelia/route-recognizer": "2.0.1-dev.202310060506", | ||
"@aurelia/runtime": "2.0.1-dev.202310060506", | ||
"@aurelia/runtime-html": "2.0.1-dev.202310060506" | ||
}, | ||
@@ -62,0 +62,0 @@ "devDependencies": { |
@@ -715,3 +715,3 @@ import { | ||
if (!(route instanceof Promise)) { | ||
if (route.nav ?? false) { | ||
if ((route.nav ?? false) && route.redirectTo === null) { | ||
routes.push(NavigationRoute._create(route)); | ||
@@ -726,3 +726,3 @@ } | ||
onResolve(route, rdConfig => { | ||
if (rdConfig.nav) { | ||
if (rdConfig.nav && rdConfig.redirectTo === null) { | ||
routes[index] = NavigationRoute._create(rdConfig); | ||
@@ -754,3 +754,2 @@ } else { | ||
public readonly path: string[], | ||
public readonly redirectTo: string | null, | ||
public readonly title: string | ((node: RouteNode) => string | null) | null, | ||
@@ -765,3 +764,2 @@ public readonly data: Record<string, unknown>, | ||
ensureArrayOfStrings(rdConfig.path ?? emptyArray), | ||
rdConfig.redirectTo, | ||
rdConfig.title, | ||
@@ -798,4 +796,4 @@ rdConfig.data, | ||
} | ||
this._isActive = trees.some(vit => router.routeTree.contains(vit, { matchEndpoint: true, matchOriginalInstruction: this.redirectTo !== null })); | ||
this._isActive = trees.some(vit => router.routeTree.contains(vit, true)); | ||
} | ||
} |
@@ -70,9 +70,2 @@ import { | ||
export interface RouteNodeMatchOptions { | ||
/** Endpoints will be matched instead of instruction */ | ||
matchEndpoint: boolean; | ||
/** Original instruction will be matched */ | ||
matchOriginalInstruction: boolean; | ||
} | ||
export class RouteNode implements IRouteNode { | ||
@@ -165,6 +158,4 @@ /** @internal */ public _tree!: RouteTree; | ||
public contains(instructions: ViewportInstructionTree, options: Partial<RouteNodeMatchOptions>): boolean { | ||
public contains(instructions: ViewportInstructionTree, matchEndpoint: boolean = false): boolean { | ||
if (this.context === instructions.options.context) { | ||
const matchEndpoint = options.matchEndpoint ?? false; | ||
const matchOriginalInstruction = options.matchOriginalInstruction ?? false; | ||
const nodeChildren = this.children; | ||
@@ -178,3 +169,3 @@ const instructionChildren = instructions.children; | ||
const instruction = nodeChild !== null | ||
? !matchOriginalInstruction && nodeChild.isInstructionsFinalized ? nodeChild.instruction : nodeChild._originalInstruction | ||
? nodeChild.isInstructionsFinalized ? nodeChild.instruction : nodeChild._originalInstruction | ||
: null; | ||
@@ -199,3 +190,3 @@ const childEndpoint = instruction?.recognizedRoute?.route.endpoint; | ||
return this.children.some(function (x) { | ||
return x.contains(instructions, options); | ||
return x.contains(instructions, matchEndpoint); | ||
}); | ||
@@ -321,4 +312,4 @@ } | ||
public contains(instructions: ViewportInstructionTree, options: Partial<RouteNodeMatchOptions>): boolean { | ||
return this.root.contains(instructions, options); | ||
public contains(instructions: ViewportInstructionTree, matchEndpoint: boolean = false): boolean { | ||
return this.root.contains(instructions, matchEndpoint); | ||
} | ||
@@ -325,0 +316,0 @@ |
@@ -337,3 +337,3 @@ import { isObject } from '@aurelia/metadata'; | ||
return this.routeTree.contains(instructions, { matchEndpoint: false }); | ||
return this.routeTree.contains(instructions, false); | ||
} | ||
@@ -340,0 +340,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1623436
29650
+ Added@aurelia/kernel@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/platform@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/platform-browser@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/route-recognizer@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/runtime@2.0.1-dev.202310060506(transitive)
+ Added@aurelia/runtime-html@2.0.1-dev.202310060506(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/platform@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/platform-browser@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/route-recognizer@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/runtime@2.0.1-dev.202307240932(transitive)
- Removed@aurelia/runtime-html@2.0.1-dev.202307240932(transitive)