@aurelia/router-lite
Advanced tools
Comparing version 2.1.0-dev.202402292237 to 2.1.0-dev.202404120945
@@ -15,3 +15,3 @@ export { type IViewport, } from './resources/viewport'; | ||
export { ViewportAgent, } from './viewport-agent'; | ||
export { IUrlParser, pathUrlParser, fragmentUrlParser, } from './url-parser'; | ||
export { type IUrlParser, pathUrlParser, fragmentUrlParser, } from './url-parser'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,4 @@ | ||
import { ICustomAttributeViewModel, ICustomAttributeController } from '@aurelia/runtime-html'; | ||
import { type ICustomAttributeViewModel, type ICustomAttributeController, type CustomAttributeStaticAuDefinition } from '@aurelia/runtime-html'; | ||
export declare class HrefCustomAttribute implements ICustomAttributeViewModel { | ||
static readonly $au: CustomAttributeStaticAuDefinition; | ||
value: unknown; | ||
@@ -4,0 +5,0 @@ readonly $controller: ICustomAttributeController<this>; |
@@ -1,2 +0,2 @@ | ||
import { Constructable, ResourceType, IContainer } from '@aurelia/kernel'; | ||
import { Constructable, ResourceType } from '@aurelia/kernel'; | ||
import type { RouteNode } from './route-tree'; | ||
@@ -19,3 +19,2 @@ import type { FallbackFunction, IChildRouteConfig, IRouteConfig, Routeable, TransitionPlanOrFunc } from './options'; | ||
private constructor(); | ||
register(container: IContainer): void; | ||
} | ||
@@ -22,0 +21,0 @@ export declare const Route: { |
{ | ||
"name": "@aurelia/router-lite", | ||
"version": "2.1.0-dev.202402292237", | ||
"version": "2.1.0-dev.202404120945", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -24,3 +24,4 @@ "module": "dist/esm/index.mjs", | ||
"type": "git", | ||
"url": "https://github.com/aurelia/aurelia" | ||
"url": "https://github.com/aurelia/aurelia.git", | ||
"directory": "packages/router-lite" | ||
}, | ||
@@ -57,12 +58,12 @@ "bugs": { | ||
"dependencies": { | ||
"@aurelia/kernel": "2.1.0-dev.202402292237", | ||
"@aurelia/metadata": "2.1.0-dev.202402292237", | ||
"@aurelia/platform": "2.1.0-dev.202402292237", | ||
"@aurelia/platform-browser": "2.1.0-dev.202402292237", | ||
"@aurelia/route-recognizer": "2.1.0-dev.202402292237", | ||
"@aurelia/runtime": "2.1.0-dev.202402292237", | ||
"@aurelia/runtime-html": "2.1.0-dev.202402292237" | ||
"@aurelia/kernel": "2.1.0-dev.202404120945", | ||
"@aurelia/metadata": "2.1.0-dev.202404120945", | ||
"@aurelia/platform": "2.1.0-dev.202404120945", | ||
"@aurelia/platform-browser": "2.1.0-dev.202404120945", | ||
"@aurelia/route-recognizer": "2.1.0-dev.202404120945", | ||
"@aurelia/runtime": "2.1.0-dev.202404120945", | ||
"@aurelia/runtime-html": "2.1.0-dev.202404120945" | ||
}, | ||
"devDependencies": { | ||
"typescript": "5.2.2" | ||
"typescript": "5.4.2" | ||
}, | ||
@@ -69,0 +70,0 @@ "engines": { |
@@ -115,5 +115,5 @@ export { | ||
export { | ||
IUrlParser, | ||
type IUrlParser, | ||
pathUrlParser, | ||
fragmentUrlParser, | ||
} from './url-parser'; |
import { | ||
customAttribute, | ||
bindable, | ||
ICustomAttributeViewModel, | ||
ICustomAttributeController, | ||
type ICustomAttributeViewModel, | ||
type ICustomAttributeController, | ||
INode, | ||
IWindow, | ||
getRef, CustomAttribute | ||
getRef, | ||
CustomAttribute, | ||
type CustomAttributeStaticAuDefinition | ||
} from '@aurelia/runtime-html'; | ||
@@ -30,4 +30,11 @@ | ||
@customAttribute({ name: 'href', noMultiBindings: true }) | ||
export class HrefCustomAttribute implements ICustomAttributeViewModel { | ||
public static readonly $au: CustomAttributeStaticAuDefinition = { | ||
type: 'custom-attribute', | ||
name: 'href', | ||
noMultiBindings: true, | ||
bindables: { | ||
value: { mode: bmToView } | ||
} | ||
}; | ||
@@ -38,3 +45,2 @@ /** @internal */private readonly _el: INode<HTMLElement> = resolve<INode<HTMLElement>>(INode as unknown as INode<HTMLElement>); | ||
@bindable({ mode: bmToView }) | ||
public value: unknown; | ||
@@ -41,0 +47,0 @@ |
import { | ||
Constructable, | ||
DI, | ||
@@ -11,5 +10,3 @@ type IContainer, | ||
onResolve, | ||
Protocol, | ||
Registration, | ||
ResourceDefinition, | ||
emptyObject, | ||
@@ -204,4 +201,2 @@ emptyArray, | ||
container.register(config); | ||
this._recognizer = new RouteRecognizer(); | ||
@@ -398,3 +393,3 @@ | ||
const container = this.container; | ||
const componentInstance = container.get<IRouteViewModel>(routeNode.component.key); | ||
const componentInstance = container.invoke<IRouteViewModel>(routeNode.component.Type); | ||
// this is the point where we can load the delayed (non-static) child route configuration by calling the getRouteConfig | ||
@@ -496,4 +491,4 @@ const task: Promise<void> | void = this._childRoutesConfigured | ||
if (typeof raw === 'function') { | ||
const def = Protocol.resource.getAll(raw as Constructable).find(isCustomElementDefinition); | ||
if (def !== void 0) return def; | ||
const def = CustomElement.isType(raw) ? CustomElement.getDefinition(raw) : null; | ||
if (def != null) return def; | ||
} | ||
@@ -504,10 +499,13 @@ | ||
for (const item of m.items) { | ||
if (item.isConstructable) { | ||
const def = item.definitions.find(isCustomElementDefinition); | ||
if (def !== void 0) { | ||
if (item.key === 'default') { | ||
defaultExport = def; | ||
} else if (firstNonDefaultExport === void 0) { | ||
firstNonDefaultExport = def; | ||
} | ||
const def = (CustomElement.isType(item.value) | ||
// static resource API may require to change this item.definition | ||
// into CustomElement.getDefinition(item.value) or CustomElement.getOrCreateDefinition(item.value) | ||
? item.definition | ||
: null | ||
) as CustomElementDefinition; | ||
if (def != null) { | ||
if (item.key === 'default') { | ||
defaultExport = def; | ||
} else if (firstNonDefaultExport === void 0) { | ||
firstNonDefaultExport = def; | ||
} | ||
@@ -672,6 +670,2 @@ } | ||
function isCustomElementDefinition(value: ResourceDefinition): value is CustomElementDefinition { | ||
return CustomElement.isType(value.Type); | ||
} | ||
export class $RecognizedRoute { | ||
@@ -678,0 +672,0 @@ public constructor( |
import { Metadata } from '@aurelia/metadata'; | ||
import { Constructable, emptyArray, onResolve, Protocol, ResourceType, Writable, IContainer } from '@aurelia/kernel'; | ||
import { Constructable, emptyArray, onResolve, ResourceType, Writable, getResourceKeyFor } from '@aurelia/kernel'; | ||
@@ -205,17 +205,6 @@ import { validateRouteConfig, expectType, shallowEquals, isPartialRedirectRouteConfig, isPartialChildRouteConfig } from './validation'; | ||
} | ||
public register(container: IContainer): void { | ||
/** | ||
* When an instance of the RouteConfig is created, via the static `_create` and `resolveRouteConfiguration`, the component is always resolved to a custom element. | ||
* This makes the process to registering to registering the custom element to the DI. | ||
* The component can only be null for redirection configurations and that is ignored here. | ||
*/ | ||
const component = this.component; | ||
if (component == null) return; | ||
container.register(component); | ||
} | ||
} | ||
export const Route = { | ||
name: Protocol.resource.keyFor('route-configuration'), | ||
name: /*@__PURE__*/getResourceKeyFor('route-configuration'), | ||
/** | ||
@@ -320,3 +309,3 @@ * Returns `true` if the specified type has any static route configuration (either via static properties or a @route decorator) | ||
const component = context.container.find(CustomElement, instruction.value); | ||
const component = CustomElement.find(context.container, instruction.value); | ||
if (component === null) throw new Error(getMessage(Events.rtNoComponent, instruction.value, context)); | ||
@@ -323,0 +312,0 @@ |
@@ -43,3 +43,3 @@ import { emptyQuery } from './router'; | ||
value, | ||
queryParams != null ? queryParams : emptyQuery, | ||
queryParams ?? emptyQuery, | ||
fragment, | ||
@@ -46,0 +46,0 @@ ); |
Sorry, the diff of this file is too big to display
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
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
2112390
34684
+ Added@aurelia/kernel@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/metadata@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/platform@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/platform-browser@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/route-recognizer@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/runtime@2.1.0-dev.202404120945(transitive)
+ Added@aurelia/runtime-html@2.1.0-dev.202404120945(transitive)
- Removed@aurelia/kernel@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/metadata@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/platform@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/platform-browser@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/route-recognizer@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/runtime@2.1.0-dev.202402292237(transitive)
- Removed@aurelia/runtime-html@2.1.0-dev.202402292237(transitive)