Socket
Socket
Sign inDemoInstall

@aurelia/router-lite

Package Overview
Dependencies
Maintainers
1
Versions
263
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aurelia/router-lite - npm Package Compare versions

Comparing version 2.0.1-dev.202206150847 to 2.0.1-dev.202207251145

4

dist/types/index.d.ts

@@ -5,3 +5,3 @@ export { type IViewport, } from './resources/viewport';

export { type RouteableComponent, type NavigationInstruction, IViewportInstruction, type Params, } from './instructions';
export { ILocationManager, IBaseHrefProvider, } from './location-manager';
export { ILocationManager, } from './location-manager';
export { type Routeable, type IRouteConfig, type IChildRouteConfig, RouteConfig, Route, type RouteType, route, } from './route';

@@ -12,3 +12,3 @@ export { IRouteContext, RouteContext, type INavigationModel, type INavigationRoute, } from './route-context';

export { RouteNode, RouteTree, } from './route-tree';
export { AuNavId, type ManagedState, isManagedState, toManagedState, IRouter, Router, type IRouterOptions, type INavigationOptions, RouterOptions, NavigationOptions, Transition, Navigation, type ResolutionMode, type HistoryStrategy, type SameUrlStrategy, } from './router';
export { AuNavId, type ManagedState, isManagedState, toManagedState, IRouter, Router, type IRouterOptions, type INavigationOptions, RouterOptions, NavigationOptions, Transition, Navigation, type ResolutionMode, type HistoryStrategy, type SameUrlStrategy, type LoadOptions, } from './router';
export { IRouterEvents, type RouterEvent, LocationChangeEvent, NavigationStartEvent, NavigationEndEvent, NavigationCancelEvent, NavigationErrorEvent, } from './router-events';

@@ -15,0 +15,0 @@ export { IStateManager, } from './state-manager';

@@ -5,3 +5,3 @@ import { IModule } from '@aurelia/kernel';

import { RouteType } from './route';
import { IRouteContext } from './route-context';
import { $RecognizedRoute, IRouteContext } from './route-context';
import { INavigationOptions, NavigationOptions } from './router';

@@ -57,2 +57,3 @@ export declare type RouteContextLike = IRouteContext | ICustomElementViewModel | ICustomElementController | HTMLElement;

readonly children?: readonly NavigationInstruction[];
readonly recognizedRoute: $RecognizedRoute | null;
}

@@ -64,2 +65,3 @@ export declare class ViewportInstruction<TComponent extends ITypedNavigationInstruction_T = ITypedNavigationInstruction_Component> implements IViewportInstruction {

close: number;
readonly recognizedRoute: $RecognizedRoute | null;
readonly component: TComponent;

@@ -66,0 +68,0 @@ readonly viewport: string | null;

@@ -8,22 +8,3 @@ import { ILogger } from '@aurelia/kernel';

}
export declare const IBaseHrefProvider: import("@aurelia/kernel").InterfaceSymbol<IBaseHrefProvider>;
export interface IBaseHrefProvider extends BrowserBaseHrefProvider {
}
export declare class BaseHref {
readonly path: string;
readonly rootedPath: string;
constructor(path: string, rootedPath: string);
}
/**
* Default browser base href provider.
*
* Retrieves the base href based on the `<base>` element from `window.document.head`
*
* This is internal API for the moment. The shape of this API (as well as in which package it resides) is also likely temporary.
*/
export declare class BrowserBaseHrefProvider {
private readonly window;
constructor(window: IWindow);
getBaseHref(): BaseHref | null;
}
export declare const IBaseHref: import("@aurelia/kernel").InterfaceSymbol<URL>;
export declare const ILocationManager: import("@aurelia/kernel").InterfaceSymbol<ILocationManager>;

@@ -45,6 +26,5 @@ export interface ILocationManager extends BrowserLocationManager {

private readonly window;
private readonly baseHrefProvider;
private readonly baseHref;
private eventId;
constructor(logger: ILogger, events: IRouterEvents, history: IHistory, location: ILocation, window: IWindow, baseHrefProvider: IBaseHrefProvider);
constructor(logger: ILogger, events: IRouterEvents, history: IHistory, location: ILocation, window: IWindow, baseHref: URL);
startListening(): void;

@@ -61,2 +41,6 @@ stopListening(): void;

}
/**
* Strip trailing `/index.html` and trailing `/` from the path, if present.
*/
export declare function normalizePath(path: string): string;
//# sourceMappingURL=location-manager.d.ts.map
import { ICustomAttributeViewModel, IEventDelegator, IEventTarget, INode } from '@aurelia/runtime-html';
import { IRouter } from '../router';
import { IRouteContext } from '../route-context';
import { Params } from '../instructions';
import { IRouterEvents } from '../router-events';

@@ -15,3 +16,3 @@ import { ILocationManager } from '../location-manager';

route: unknown;
params: unknown;
params?: Params;
attribute: string;

@@ -18,0 +19,0 @@ active: boolean;

@@ -29,2 +29,3 @@ import { IContainer, IModule } from '@aurelia/kernel';

readonly parentContainer: IContainer;
private readonly _router;
private readonly childViewportAgents;

@@ -67,3 +68,3 @@ readonly root: IRouteContext;

get navigationModel(): INavigationModel;
constructor(viewportAgent: ViewportAgent | null, parent: IRouteContext | null, component: CustomElementDefinition, definition: RouteDefinition, parentContainer: IContainer, router: IRouter);
constructor(viewportAgent: ViewportAgent | null, parent: IRouteContext | null, component: CustomElementDefinition, definition: RouteDefinition, parentContainer: IContainer, _router: IRouter);
private processDefinition;

@@ -70,0 +71,0 @@ /**

@@ -26,2 +26,7 @@ import { IContainer, ILogger } from '@aurelia/kernel';

export interface IRouterOptions extends Partial<RouterOptions> {
/**
* Set a custom routing root by setting this path.
* When not set, path from the `document.baseURI` is used by default.
*/
basePath?: string | null;
}

@@ -93,2 +98,5 @@ export declare class RouterOptions {

}
export declare type LoadOptions = INavigationOptions & {
params?: Params;
};
export interface INavigationOptions extends Partial<NavigationOptions> {

@@ -213,3 +221,3 @@ }

*/
load(path: string, options?: INavigationOptions): Promise<boolean>;
load(path: string, options?: LoadOptions): Promise<boolean>;
/**

@@ -224,3 +232,3 @@ * Loads the provided paths as siblings.

*/
load(paths: readonly string[], options?: INavigationOptions): Promise<boolean>;
load(paths: readonly string[], options?: LoadOptions): Promise<boolean>;
/**

@@ -236,3 +244,3 @@ * Loads the provided component type. Must be a custom element.

*/
load(componentType: RouteType, options?: INavigationOptions): Promise<boolean>;
load(componentType: RouteType, options?: LoadOptions): Promise<boolean>;
/**

@@ -247,3 +255,3 @@ * Loads the provided component types. Must be custom elements.

*/
load(componentTypes: readonly RouteType[], options?: INavigationOptions): Promise<boolean>;
load(componentTypes: readonly RouteType[], options?: LoadOptions): Promise<boolean>;
/**

@@ -258,3 +266,3 @@ * Loads the provided component definition. May or may not be pre-compiled.

*/
load(componentDefinition: PartialCustomElementDefinition, options?: INavigationOptions): Promise<boolean>;
load(componentDefinition: PartialCustomElementDefinition, options?: LoadOptions): Promise<boolean>;
/**

@@ -272,3 +280,3 @@ * Loads the provided component instance.

*/
load(componentInstance: IRouteViewModel, options?: INavigationOptions): Promise<boolean>;
load(componentInstance: IRouteViewModel, options?: LoadOptions): Promise<boolean>;
/**

@@ -298,4 +306,4 @@ * Loads the provided ViewportInstruction, with component specified in any of the ways as described

*/
load(viewportInstruction: IViewportInstruction, options?: INavigationOptions): boolean | Promise<boolean>;
load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: INavigationOptions): boolean | Promise<boolean>;
load(viewportInstruction: IViewportInstruction, options?: LoadOptions): boolean | Promise<boolean>;
load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: LoadOptions): boolean | Promise<boolean>;
isActive(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], context: RouteContextLike): boolean;

@@ -302,0 +310,0 @@ private readonly vpaLookup;

{
"name": "@aurelia/router-lite",
"version": "2.0.1-dev.202206150847",
"version": "2.0.1-dev.202207251145",
"main": "dist/cjs/index.cjs",

@@ -47,9 +47,9 @@ "module": "dist/esm/index.mjs",

"dependencies": {
"@aurelia/kernel": "2.0.1-dev.202206150847",
"@aurelia/metadata": "2.0.1-dev.202206150847",
"@aurelia/platform": "2.0.1-dev.202206150847",
"@aurelia/platform-browser": "2.0.1-dev.202206150847",
"@aurelia/route-recognizer": "2.0.1-dev.202206150847",
"@aurelia/runtime": "2.0.1-dev.202206150847",
"@aurelia/runtime-html": "2.0.1-dev.202206150847"
"@aurelia/kernel": "2.0.1-dev.202207251145",
"@aurelia/metadata": "2.0.1-dev.202207251145",
"@aurelia/platform": "2.0.1-dev.202207251145",
"@aurelia/platform-browser": "2.0.1-dev.202207251145",
"@aurelia/route-recognizer": "2.0.1-dev.202207251145",
"@aurelia/runtime": "2.0.1-dev.202207251145",
"@aurelia/runtime-html": "2.0.1-dev.202207251145"
},

@@ -56,0 +56,0 @@ "devDependencies": {

import { isObject } from '@aurelia/metadata';
import { IContainer, IRegistry } from '@aurelia/kernel';
import { AppTask } from '@aurelia/runtime-html';
import { IContainer, InterfaceSymbol, IRegistry, Registration } from '@aurelia/kernel';
import { AppTask, AppTaskCallback, IWindow } from '@aurelia/runtime-html';

@@ -11,2 +11,3 @@ import { RouteContext } from './route-context';

import { HrefCustomAttribute } from './resources/href';
import { IBaseHref, normalizePath } from './location-manager';

@@ -46,14 +47,23 @@ export const RouterRegistration = IRouter as unknown as IRegistry;

function configure(container: IContainer, config?: RouterConfig): IContainer {
let activation: AppTaskCallback<InterfaceSymbol<IRouter>>;
let basePath: string | null = null;
if (isObject(config)) {
if (typeof config === 'function') {
activation = router => config(router) as void | Promise<void>;
} else {
basePath = (config as IRouterOptions).basePath ?? null;
activation = router => router.start(config, true) as void | Promise<void>;
}
} else {
activation = router => router.start({}, true) as void | Promise<void>;
}
return container.register(
Registration.cachedCallback(IBaseHref, (handler, _, __) => {
const window = handler.get(IWindow);
const url = new URL(window.document.baseURI);
url.pathname = normalizePath(basePath ?? url.pathname);
return url;
}),
AppTask.hydrated(IContainer, RouteContext.setRoot),
AppTask.afterActivate(IRouter, router => {
if (isObject(config)) {
if (typeof config === 'function') {
return config(router) as void | Promise<void>;
} else {
return router.start(config, true) as void | Promise<void>;
}
}
return router.start({}, true) as void | Promise<void>;
}),
AppTask.afterActivate(IRouter, activation),
AppTask.afterDeactivate(IRouter, router => {

@@ -60,0 +70,0 @@ router.stop();

@@ -32,3 +32,2 @@ export {

ILocationManager,
IBaseHrefProvider,
} from './location-manager';

@@ -93,2 +92,3 @@

type SameUrlStrategy,
type LoadOptions,
} from './router';

@@ -95,0 +95,0 @@

@@ -7,3 +7,3 @@ import { isObject } from '@aurelia/metadata';

import { RouteType } from './route';
import { IRouteContext } from './route-context';
import { $RecognizedRoute, IRouteContext } from './route-context';
import { expectType, isPartialCustomElementDefinition, isPartialViewportInstruction, shallowEquals } from './validation';

@@ -65,2 +65,3 @@ import { emptyQuery, INavigationOptions, NavigationOptions } from './router';

readonly children?: readonly NavigationInstruction[];
readonly recognizedRoute: $RecognizedRoute | null;
}

@@ -74,2 +75,3 @@

public close: number,
public readonly recognizedRoute: $RecognizedRoute | null,
public readonly component: TComponent,

@@ -95,2 +97,3 @@ public readonly viewport: string | null,

instruction.close ?? 0,
instruction.recognizedRoute ?? null,
component,

@@ -104,3 +107,3 @@ instruction.viewport ?? null,

const typedInstruction = TypedNavigationInstruction.create(instruction);
return new ViewportInstruction(context ?? null, false, 0, 0, typedInstruction, null, null, []);
return new ViewportInstruction(context ?? null, false, 0, 0, null, typedInstruction, null, null, []);
}

@@ -161,2 +164,3 @@

this.close,
this.recognizedRoute,
this.component.clone(),

@@ -298,3 +302,5 @@ this.viewport,

instructionOrInstructions.map(x => ViewportInstruction.create(x, $options.context)),
emptyQuery,
$options.queryParams !== null
? new URLSearchParams($options.queryParams as Record<string, string>)
: emptyQuery,
null,

@@ -301,0 +307,0 @@ );

@@ -1,2 +0,2 @@

import { ILogger, DI, bound } from '@aurelia/kernel';
import { bound, DI, ILogger } from '@aurelia/kernel';
import { IHistory, ILocation, IWindow } from '@aurelia/runtime-html';

@@ -9,36 +9,3 @@

export const IBaseHrefProvider = DI.createInterface<IBaseHrefProvider>('IBaseHrefProvider', x => x.singleton(BrowserBaseHrefProvider));
export interface IBaseHrefProvider extends BrowserBaseHrefProvider {}
export class BaseHref {
public constructor(
public readonly path: string,
public readonly rootedPath: string,
) {}
}
/**
* Default browser base href provider.
*
* Retrieves the base href based on the `<base>` element from `window.document.head`
*
* This is internal API for the moment. The shape of this API (as well as in which package it resides) is also likely temporary.
*/
export class BrowserBaseHrefProvider {
public constructor(
@IWindow private readonly window: IWindow,
) {}
public getBaseHref(): BaseHref | null {
const base = this.window.document.head.querySelector('base');
if (base === null) {
return null;
}
const rootedPath = normalizePath(base.href);
const path = normalizePath(base.getAttribute('href') ?? '');
return new BaseHref(path, rootedPath);
}
}
export const IBaseHref = DI.createInterface<URL>('IBaseHref');
export const ILocationManager = DI.createInterface<ILocationManager>('ILocationManager', x => x.singleton(BrowserLocationManager));

@@ -55,3 +22,2 @@ export interface ILocationManager extends BrowserLocationManager {}

export class BrowserLocationManager {
private readonly baseHref: BaseHref;
private eventId: number = 0;

@@ -65,15 +31,6 @@

@IWindow private readonly window: IWindow,
@IBaseHrefProvider private readonly baseHrefProvider: IBaseHrefProvider,
@IBaseHref private readonly baseHref: URL,
) {
this.logger = logger.root.scopeTo('LocationManager');
const baseHref = baseHrefProvider.getBaseHref();
if (baseHref === null) {
const origin = location.origin ?? '';
const baseHref = this.baseHref = new BaseHref('', normalizePath(origin));
this.logger.warn(`no baseHref provided, defaulting to origin '${baseHref.rootedPath}' (normalized from '${origin}')`);
} else {
this.baseHref = baseHref;
this.logger.debug(`baseHref set to path: '${baseHref.path}', rootedPath: '${baseHref.rootedPath}'`);
}
logger = this.logger = logger.root.scopeTo('LocationManager');
logger.debug(`baseHref set to path: ${baseHref.href}`);
}

@@ -164,3 +121,3 @@

let base = this.baseHref.rootedPath;
let base = this.baseHref.href;
if (base.endsWith('/')) {

@@ -186,4 +143,5 @@ base = base.slice(0, -1);

const $path = path;
if (path.startsWith(this.baseHref.path)) {
path = path.slice(this.baseHref.path.length);
const basePath = this.baseHref.pathname;
if (path.startsWith(basePath)) {
path = path.slice(basePath.length);
}

@@ -201,3 +159,3 @@ path = normalizePath(path);

*/
function normalizePath(path: string): string {
export function normalizePath(path: string): string {
let start: string;

@@ -204,0 +162,0 @@ let end: string;

@@ -9,3 +9,2 @@ import { IDisposable, IIndexable } from '@aurelia/kernel';

import { IRouterEvents } from '../router-events';
import { RouteDefinition } from '../route-definition';
import { ILocationManager } from '../location-manager';

@@ -19,3 +18,3 @@

@bindable({ mode: BindingMode.toView, callback: 'valueChanged' })
public params: unknown;
public params?: Params;

@@ -76,30 +75,5 @@ @bindable({ mode: BindingMode.toView })

if (this.route !== null && this.route !== void 0 && this.ctx.allResolved === null) {
const def = (this.ctx.childRoutes as RouteDefinition[]).find(x => x.id === this.route);
if (def !== void 0) {
// TODO(fkleuver): massive temporary hack. Will not work for siblings etc. Need to fix.
const parentPath = this.ctx.node.computeAbsolutePath();
// Note: This is very much preliminary just to fill the feature gap of v1's `generate`. It probably misses a few edge cases.
// TODO(fkleuver): move this logic to RouteExpression and expose via public api, add tests etc
let path = def.path[0];
if (typeof this.params === 'object' && this.params !== null) {
const keys = Object.keys(this.params);
for (const key of keys) {
const value = (this.params as Params)[key];
if (value != null && String(value).length > 0) {
path = path.replace(new RegExp(`[*:]${key}[?]?`), value);
}
}
}
// Remove leading and trailing optional param parts
path = path.replace(/\/[*:][^/]+[?]/g, '').replace(/[*:][^/]+[?]\//g, '');
if (parentPath) {
if (path) {
this.href = `${useHash ? '#' : ''}${[parentPath, path].join('/')}`;
} else {
this.href = `${useHash ? '#' : ''}${parentPath}`;
}
} else {
this.href = `${useHash ? '#' : ''}${path}`;
}
this.instructions = this.router.createViewportInstructions(`${useHash ? '#' : ''}${path}`, { context: this.ctx });
const instructions = this.ctx.generateTree(this.route as string, this.params as Params);
if (instructions !== null) {
this.href = (this.instructions = instructions).toUrl(useHash);
} else {

@@ -111,3 +85,3 @@ if (typeof this.params === 'object' && this.params !== null) {

}
this.href = this.instructions.toUrl(this.router.options.useUrlFragmentHash);
this.href = this.instructions.toUrl(useHash);
}

@@ -114,0 +88,0 @@ } else {

import { IContainer, ResourceDefinition, DI, InstanceProvider, Registration, ILogger, IModuleLoader, IModule, onResolve, noop } from '@aurelia/kernel';
import { CustomElementDefinition, CustomElement, ICustomElementController, IController, isCustomElementViewModel, isCustomElementController, IAppRoot, IPlatform } from '@aurelia/runtime-html';
import { RouteRecognizer, RecognizedRoute } from '@aurelia/route-recognizer';
import { RouteRecognizer, RecognizedRoute, ConfigurableRoute, Endpoint } from '@aurelia/route-recognizer';

@@ -14,6 +14,6 @@ import { RouteDefinition } from './route-definition';

import { ensureArrayOfStrings } from './util';
import { Params } from './instructions';
import { IViewportInstruction, Params, ViewportInstructionTree } from './instructions';
import { IRouterEvents } from './router-events';
export interface IRouteContext extends RouteContext {}
export interface IRouteContext extends RouteContext { }
export const IRouteContext = DI.createInterface<IRouteContext>('IRouteContext');

@@ -23,2 +23,4 @@

type PathGenerationResult = { path: string; def: RouteDefinition; consumed: Params; unconsumed: Params | null };
/**

@@ -131,3 +133,3 @@ * Holds the information of a component in the context of a specific container.

public readonly parentContainer: IContainer,
router: IRouter,
private readonly _router: IRouter,
) {

@@ -173,3 +175,3 @@ this._vpa = viewportAgent;

.get(IRouterEvents)
.subscribe('au:router:navigation-end', () => navModel.setIsActive(router, this));
.subscribe('au:router:navigation-end', () => navModel.setIsActive(_router, this));
this.processDefinition(definition);

@@ -313,3 +315,2 @@ }

}
// #endregion

@@ -463,2 +464,66 @@ public resolveViewportAgent(req: ViewportRequest): ViewportAgent {

// this is separate method might be helpful if we need to create a public path generation utility function in future.
/** @internal */
private _generatePathInternal(id: string, params?: Params | null): PathGenerationResult | null {
if (id == null) return null;
const def = (this.childRoutes as RouteDefinition[]).find(x => x.id === id);
if (def === void 0) return null;
let path = def.path[0]; // [Sayan]: we probably should select the "most" matched path
const consumed: Params = Object.create(null);
const unconsumed: Params = Object.create(null);
let hasUnconsumedParams = false;
if (typeof params === 'object' && params !== null) {
const keys = Object.keys(params);
for (const key of keys) {
const value = params[key];
const re = new RegExp(`[*:]${key}[?]?`);
const matches = re.exec(path);
if (matches === null) {
unconsumed[key] = value;
hasUnconsumedParams = true;
continue;
}
if (value != null && String(value).length > 0) {
path = path.replace(matches[0], value);
consumed[key] = value;
}
}
}
// Remove leading and trailing optional param parts
return {
path: path.replace(/\/[*:][^/]+[?]/g, '').replace(/[*:][^/]+[?]\//g, ''),
def,
consumed,
unconsumed: hasUnconsumedParams ? unconsumed : null,
};
}
/** @internal */
public generateTree(id: string, params: Params | null | undefined): ViewportInstructionTree | null {
const val = this._generatePathInternal(id, params);
if(val === null) return null;
const { path, def, consumed, unconsumed } = val;
// TODO(Sayan): Investigate why we need params in so many places; probably it will be less hairy when the URL pattern is used.
// we don't necessarily need to add the # to the path here.
const route = new ConfigurableRoute(path, def.caseSensitive, def);
const endpoint = new Endpoint(route, Object.keys(consumed));
const rr = new RecognizedRoute(endpoint, consumed);
const instruction: Partial<IViewportInstruction> = {
recognizedRoute: new $RecognizedRoute(rr, null),
component: path,
context: this,
};
return this._router.createViewportInstructions(
[instruction],
{
context: this,
queryParams: unconsumed
}
);
}
public toString(): string {

@@ -465,0 +530,0 @@ const vpAgents = this.childViewportAgents;

@@ -526,4 +526,8 @@ import {

const ctx = node.context;
const originalInstruction = vi.clone();
let rr = vi.recognizedRoute;
// early return; we already have a recognized route, don't bother with the rest.
if (rr !== null) return createConfiguredNode(log, node, vi, append, rr, originalInstruction);
let collapse: number = 0;
const originalInstruction = vi.clone();
let path = vi.component.value;

@@ -541,3 +545,3 @@ let cur = vi as ViewportInstruction;

const rr = ctx.recognize(path);
rr = ctx.recognize(path);
log.trace('createNode recognized route: %s', rr);

@@ -628,4 +632,3 @@ const residue = rr?.residue ?? null;

params: {
...node.params,
...rr.route.params
...rr.route.params,
},

@@ -632,0 +635,0 @@ queryParams: rt.queryParams,

@@ -44,3 +44,9 @@ import { isObject } from '@aurelia/metadata';

export interface IRouterOptions extends Partial<RouterOptions> { }
export interface IRouterOptions extends Partial<RouterOptions> {
/**
* Set a custom routing root by setting this path.
* When not set, path from the `document.baseURI` is used by default.
*/
basePath?: string | null;
}
export class RouterOptions {

@@ -129,2 +135,3 @@ public static get DEFAULT(): RouterOptions { return RouterOptions.create({}); }

export type LoadOptions = INavigationOptions & { params?: Params };
export interface INavigationOptions extends Partial<NavigationOptions> { }

@@ -460,3 +467,3 @@ export class NavigationOptions extends RouterOptions {

*/
public load(path: string, options?: INavigationOptions): Promise<boolean>;
public load(path: string, options?: LoadOptions): Promise<boolean>;
/**

@@ -471,3 +478,3 @@ * Loads the provided paths as siblings.

*/
public load(paths: readonly string[], options?: INavigationOptions): Promise<boolean>;
public load(paths: readonly string[], options?: LoadOptions): Promise<boolean>;
/**

@@ -483,3 +490,3 @@ * Loads the provided component type. Must be a custom element.

*/
public load(componentType: RouteType, options?: INavigationOptions): Promise<boolean>;
public load(componentType: RouteType, options?: LoadOptions): Promise<boolean>;
/**

@@ -494,3 +501,3 @@ * Loads the provided component types. Must be custom elements.

*/
public load(componentTypes: readonly RouteType[], options?: INavigationOptions): Promise<boolean>;
public load(componentTypes: readonly RouteType[], options?: LoadOptions): Promise<boolean>;
/**

@@ -505,3 +512,3 @@ * Loads the provided component definition. May or may not be pre-compiled.

*/
public load(componentDefinition: PartialCustomElementDefinition, options?: INavigationOptions): Promise<boolean>;
public load(componentDefinition: PartialCustomElementDefinition, options?: LoadOptions): Promise<boolean>;
/**

@@ -519,3 +526,3 @@ * Loads the provided component instance.

*/
public load(componentInstance: IRouteViewModel, options?: INavigationOptions): Promise<boolean>;
public load(componentInstance: IRouteViewModel, options?: LoadOptions): Promise<boolean>;
/**

@@ -545,6 +552,12 @@ * Loads the provided ViewportInstruction, with component specified in any of the ways as described

*/
public load(viewportInstruction: IViewportInstruction, options?: INavigationOptions): boolean | Promise<boolean>;
public load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: INavigationOptions): boolean | Promise<boolean>;
public load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: INavigationOptions): boolean | Promise<boolean> {
const instructions = this.createViewportInstructions(instructionOrInstructions, options);
public load(viewportInstruction: IViewportInstruction, options?: LoadOptions): boolean | Promise<boolean>;
public load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: LoadOptions): boolean | Promise<boolean>;
public load(instructionOrInstructions: NavigationInstruction | readonly NavigationInstruction[], options?: LoadOptions): boolean | Promise<boolean> {
let instructions: ViewportInstructionTree | null = null;
const params = options?.params;
if(typeof instructionOrInstructions === 'string' && typeof params === 'object' && params !== null) {
const ctx = this.resolveContext(options?.context ?? null);
instructions = ctx.generateTree(instructionOrInstructions, params);
}
instructions ??= this.createViewportInstructions(instructionOrInstructions, options);

@@ -551,0 +564,0 @@ this.logger.trace('load(instructions:%s)', instructions);

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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc