## API Report File for "@microsoft/fast-router"

> Do not edit this file. It is a report generated by [API Extractor](https://api-extractor.com/).

```ts

import { ComposableStyles } from '@microsoft/fast-element';
import { Constructable } from '@microsoft/fast-element';
import { ExecutionContext } from '@microsoft/fast-element';
import { FASTElement } from '@microsoft/fast-element';
import { HTMLDirective } from '@microsoft/fast-element';
import { ViewTemplate } from '@microsoft/fast-element';

// Warning: (ae-internal-missing-underscore) The name "childRouteParameter" should be prefixed with an underscore because the declaration is marked as @internal
//
// @internal (undocumented)
export const childRouteParameter = "fast-child-route";

// @alpha (undocumented)
export type CommandFallbackRouteDefinition<TSettings = any> = HasCommand & SupportsSettings<TSettings> & HasTitle;

// @alpha (undocumented)
export type CommandRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & HasCommand & HasTitle;

// @alpha (undocumented)
export class ConfigurableRoute implements Route {
    constructor(path: string, name: string, caseSensitive: boolean);
    // (undocumented)
    readonly caseSensitive: boolean;
    // (undocumented)
    readonly name: string;
    // (undocumented)
    readonly path: string;
}

// @alpha (undocumented)
export type ContributorOptions = {
    lifecycle?: boolean;
    parameters?: boolean;
};

// @alpha (undocumented)
export type ConverterObject = {
    convert: RouteParameterConverter;
};

// @alpha (undocumented)
export class DefaultLinkHandler implements LinkHandler {
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
    }

// @alpha (undocumented)
export class DefaultNavigationProcess<TSettings> {
    // Warning: (ae-forgotten-export) The symbol "NavigationPhaseImpl" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    commit(phase: NavigationPhaseImpl): void;
    // (undocumented)
    run(router: Router, message: NavigationMessage): Promise<void>;
}

// @alpha (undocumented)
export class DefaultNavigationQueue implements NavigationQueue, NavigationHandler {
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
    // (undocumented)
    enqueue(msg: NavigationMessage): void;
    // (undocumented)
    handleEvent(event: PopStateEvent): void;
    // (undocumented)
    receive(): Promise<NavigationMessage>;
    }

// @alpha (undocumented)
export class DefaultRouter implements Router {
    constructor(host: HTMLElement);
    // (undocumented)
    addContributor(contributor: NavigationContributor): void;
    // (undocumented)
    beginRender(route: RecognizedRoute, command: RenderCommand): Promise<{
        commit: any;
        rollback: any;
    }>;
    // (undocumented)
    get config(): RouterConfiguration | null;
    set config(value: RouterConfiguration | null);
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
    // (undocumented)
    readonly host: HTMLElement;
    // (undocumented)
    get level(): number;
    // (undocumented)
    get parent(): Router<any> | null;
    // (undocumented)
    removeContributor(contributor: NavigationContributor): void;
    // (undocumented)
    route: RecognizedRoute | null;
    // (undocumented)
    shouldRender(route: RecognizedRoute): boolean;
    }

// @alpha (undocumented)
export class DefaultRouteRecognizer<TSettings> implements RouteRecognizer<TSettings> {
    // (undocumented)
    add(routeOrRoutes: Route | readonly Route[], settings?: TSettings): void;
    generateFromName(name: string, params: object): string | null;
    generateFromPath(path: string, params: object): string | null;
    // (undocumented)
    recognize(path: string, converters?: Readonly<Record<string, RouteParameterConverter>>): Promise<RecognizedRoute<TSettings> | null>;
    }

// @alpha (undocumented)
export type DefinitionCallback = () => Promise<FallbackRouteDefinition> | FallbackRouteDefinition;

// @alpha (undocumented)
export type ElementFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasElement & SupportsSettings<TSettings> & HasTitle;

// @alpha (undocumented)
export type ElementRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasElement;

// @alpha (undocumented)
export class Endpoint<TSettings = any> {
    constructor(route: ConfigurableRoute, paramNames: readonly string[], paramTypes: readonly string[], settings: TSettings | null);
    // (undocumented)
    readonly paramNames: readonly string[];
    // (undocumented)
    readonly paramTypes: readonly string[];
    // (undocumented)
    get path(): string;
    // (undocumented)
    readonly route: ConfigurableRoute;
    // (undocumented)
    readonly settings: TSettings | null;
}

// @alpha (undocumented)
export type FallbackRouteDefinition<TSettings = any> = ElementFallbackRouteDefinition<TSettings> | TemplateFallbackRouteDefinition<TSettings> | Pick<RedirectRouteDefinition<TSettings>, "redirect"> | CommandFallbackRouteDefinition<TSettings>;

// @alpha (undocumented)
export type FASTElementConstructor = new () => FASTElement;

// @alpha (undocumented)
export class FASTElementLayout implements Layout {
    constructor(template?: ViewTemplate | null, styles?: ComposableStyles | ComposableStyles[] | null, runBeforeCommit?: boolean);
    // (undocumented)
    afterCommit(routerElement: HTMLElement): Promise<void>;
    // (undocumented)
    beforeCommit(routerElement: HTMLElement): Promise<void>;
    }

// Warning: (ae-forgotten-export) The symbol "FASTRouter_base" needs to be exported by the entry point index.d.ts
//
// @alpha (undocumented)
export class FASTRouter extends FASTRouter_base {
}

// @alpha (undocumented)
export type HasCommand = {
    command: NavigationCommand;
};

// @alpha (undocumented)
export type HasElement = {
    element: string | FASTElementConstructor | HTMLElement | (() => Promise<string | FASTElementConstructor | HTMLElement>);
};

// @alpha (undocumented)
export type HasTemplate = {
    template: ViewTemplate | (() => Promise<ViewTemplate>);
};

// @alpha (undocumented)
export type HasTitle = {
    title?: string;
};

// @alpha (undocumented)
export type IgnorableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings>;

// @alpha (undocumented)
export class Ignore implements NavigationCommand {
    // (undocumented)
    createContributor(): Promise<{
        navigate(phase: NavigationPhase): Promise<void>;
    }>;
}

// @alpha (undocumented)
export function isFASTElementHost(host: HTMLElement): host is HTMLElement & FASTElement;

// @alpha (undocumented)
export function isNavigationPhaseContributor<T extends NavigationPhaseName>(object: any, phase: T): object is Record<T, NavigationPhaseHook>;

// @alpha (undocumented)
export interface Layout {
    // (undocumented)
    afterCommit(routerElement: HTMLElement): Promise<void>;
    // (undocumented)
    beforeCommit(routerElement: HTMLElement): Promise<void>;
}

// @alpha (undocumented)
export const Layout: Readonly<{
    default: Readonly<Layout>;
}>;

// @alpha (undocumented)
export type LayoutAndTransitionRouteDefinition = {
    layout?: Layout | ViewTemplate;
    transition?: Transition;
};

// @alpha (undocumented)
export interface LinkHandler {
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
}

// @alpha (undocumented)
export type MappableRouteDefinition<TSettings = any> = RenderableRouteDefinition<TSettings> | RedirectRouteDefinition<TSettings> | CommandRouteDefinition<TSettings> | ParentRouteDefinition<TSettings>;

// @alpha (undocumented)
export type NavigableRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & HasTitle & {
    childRouters?: boolean;
};

// @alpha (undocumented)
export interface NavigationCommand {
    // (undocumented)
    createContributor(router: Router, route: RecognizedRoute): Promise<NavigationContributor>;
}

// @alpha (undocumented)
export interface NavigationCommitPhase<TSettings = any> extends Omit<NavigationPhase<TSettings>, "cancel" | "canceled" | "onCancel"> {
    // (undocumented)
    setTitle(title: string): any;
}

// @alpha (undocumented)
export type NavigationCommitPhaseHook<TSettings = any> = (phase: NavigationCommitPhase<TSettings>) => Promise<any> | any;

// @alpha (undocumented)
export type NavigationContributor<TSettings = any> = Partial<Record<Exclude<NavigationPhaseName, "commit">, NavigationPhaseHook<TSettings>>> & {
    commit?: NavigationCommitPhaseHook<TSettings>;
};

// @alpha (undocumented)
export function navigationContributor(options?: ContributorOptions): HTMLDirective;

// @alpha (undocumented)
export interface NavigationHandler {
    // (undocumented)
    enqueue(msg: NavigationMessage): void;
}

// @alpha (undocumented)
export const NavigationHandler: Readonly<{
    register(handler: NavigationHandler): void;
    unregister(handler: NavigationHandler): void;
}>;

// @alpha (undocumented)
export class NavigationMessage {
    constructor(path: string);
    // (undocumented)
    path: string;
}

// @alpha (undocumented)
export interface NavigationPhase<TSettings = any> {
    // (undocumented)
    cancel(callback?: NavigationPhaseFollowupAction): void;
    // (undocumented)
    readonly canceled: boolean;
    // (undocumented)
    evaluateContributor(contributor: any, route?: RecognizedRoute<TSettings>, router?: Router<TSettings>): Promise<void>;
    // (undocumented)
    readonly name: NavigationPhaseName;
    // (undocumented)
    onCancel(callback: NavigationPhaseFollowupAction): void;
    // (undocumented)
    onCommit(callback: NavigationPhaseFollowupAction): void;
    // (undocumented)
    readonly route: RecognizedRoute<TSettings>;
    // (undocumented)
    readonly router: Router<TSettings>;
}

// @alpha (undocumented)
export type NavigationPhaseFollowupAction = () => Promise<any> | any;

// @alpha (undocumented)
export type NavigationPhaseHook<TSettings = any> = (phase: NavigationPhase<TSettings>) => Promise<any> | any;

// @alpha (undocumented)
export type NavigationPhaseName = "navigate" | "leave" | "construct" | "enter" | "commit";

// @alpha (undocumented)
export interface NavigationProcess {
    // (undocumented)
    run(router: Router, message: NavigationMessage): Promise<void>;
}

// @alpha (undocumented)
export interface NavigationQueue {
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
    // (undocumented)
    receive(): Promise<NavigationMessage>;
}

// @alpha (undocumented)
export type ParameterConverter = RouteParameterConverter | ConverterObject | Constructable<ConverterObject>;

// @alpha (undocumented)
export type ParentRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & LayoutAndTransitionRouteDefinition & {
    children: MappableRouteDefinition<TSettings>[];
};

// @alpha (undocumented)
export type PathedRouteDefinition<TSettings = any> = SupportsSettings<TSettings> & Route;

// @alpha (undocumented)
export const QueryString: Readonly<{
    readonly current: string;
    build(params: Object, traditional?: boolean | undefined): string;
    separate(path: string): Readonly<{
        path: string;
        queryString: string;
    }>;
    parse(queryString: string): Readonly<Record<string, string>>;
}>;

// @alpha (undocumented)
export class RecognizedRoute<TSettings = any> {
    constructor(endpoint: Endpoint<TSettings>, params: Readonly<Record<string, string | undefined>>, typedParams: Readonly<Record<string, any>>, queryParams: Readonly<Record<string, string>>);
    // (undocumented)
    readonly allParams: Readonly<Record<string, string | undefined>>;
    // (undocumented)
    readonly allTypedParams: Readonly<Record<string, any>>;
    // (undocumented)
    readonly endpoint: Endpoint<TSettings>;
    // (undocumented)
    readonly params: Readonly<Record<string, string | undefined>>;
    // (undocumented)
    readonly queryParams: Readonly<Record<string, string>>;
    // (undocumented)
    get settings(): TSettings | null;
    // (undocumented)
    readonly typedParams: Readonly<Record<string, any>>;
}

// @alpha (undocumented)
export class Redirect implements NavigationCommand {
    constructor(redirect: string);
    // (undocumented)
    createContributor(): Promise<{
        navigate(phase: NavigationPhase): Promise<void>;
    }>;
    }

// @alpha (undocumented)
export type RedirectRouteDefinition<TSettings = any> = PathedRouteDefinition<TSettings> & {
    redirect: string;
};

// @alpha (undocumented)
export class Render implements RenderCommand {
    constructor(owner: RouterConfiguration, createView: () => Promise<RouteView>);
    // Warning: (ae-forgotten-export) The symbol "RenderContributor" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    createContributor(router: Router, route: RecognizedRoute): Promise<RenderContributor>;
    // (undocumented)
    createView: () => Promise<RouteView>;
    // (undocumented)
    static fromDefinition(owner: RouterConfiguration, definition: ElementRouteDefinition | TemplateRouteDefinition | ElementFallbackRouteDefinition | TemplateFallbackRouteDefinition): Render;
    // (undocumented)
    get layout(): Layout;
    set layout(value: Layout);
    // (undocumented)
    title: string;
    // (undocumented)
    get transition(): Transition;
    set transition(value: Transition);
    }

// @alpha (undocumented)
export type RenderableRouteDefinition<TSettings = any> = ElementRouteDefinition<TSettings> | TemplateRouteDefinition<TSettings>;

// @alpha (undocumented)
export interface RenderCommand extends NavigationCommand {
    // (undocumented)
    createView(): Promise<RouteView>;
    // (undocumented)
    layout: Layout;
    // (undocumented)
    transition: Transition;
}

// @alpha (undocumented)
export interface RenderOperation {
    // (undocumented)
    commit(): Promise<void>;
    // (undocumented)
    rollback(): Promise<void>;
}

// @alpha (undocumented)
export interface Route {
    // (undocumented)
    readonly caseSensitive?: boolean;
    // (undocumented)
    readonly name?: string;
    // (undocumented)
    readonly path: string;
}

// @alpha (undocumented)
export const Route: Readonly<{
    path: Readonly<{
        readonly current: string;
        generateRoute(relativeTo: HTMLElement | Router, path: string, params?: Object): Promise<string | null>;
        push(path: string, trigger?: boolean): void;
        replace(path: string, trigger?: boolean): void;
        trigger(path: string): void;
    }>;
    name: Readonly<{
        generateRoute(relativeTo: HTMLElement | Router, name: string, params?: Object): Promise<string | null>;
        push(relativeTo: HTMLElement | Router, name: string, params?: Object, trigger?: boolean): Promise<void>;
        replace(relativeTo: HTMLElement | Router, name: string, params?: Object, trigger?: boolean): Promise<void>;
        trigger(relativeTo: HTMLElement | Router, name: string, params?: Object): Promise<void>;
    }>;
}>;

// @alpha (undocumented)
export class RouteCollection<TSettings = any> {
    constructor(owner: RouterConfiguration);
    // (undocumented)
    converter(name: string, converter: ParameterConverter): void;
    // (undocumented)
    fallback(definitionOrCallback: FallbackRouteDefinition<TSettings> | DefinitionCallback): void;
    generateFromName(name: string, params: object): string | null;
    generateFromPath(path: string, params: object): string | null;
    // (undocumented)
    ignore(definitionOrString: IgnorableRouteDefinition<TSettings> | string): void;
    // (undocumented)
    map(...routes: MappableRouteDefinition<TSettings>[]): void;
    // (undocumented)
    recognize(path: string): Promise<RouteMatch<TSettings> | null>;
    }

// @alpha (undocumented)
export type RouteMatch<TSettings = any> = {
    route: RecognizedRoute<TSettings>;
    command: NavigationCommand;
};

// @alpha (undocumented)
export type RouteParameterConverter = (value: string | undefined) => any | Promise<any>;

// @alpha (undocumented)
export interface Router<TSettings = any> {
    // (undocumented)
    addContributor(contributor: NavigationContributor): void;
    // (undocumented)
    beginRender(route: RecognizedRoute<TSettings>, command: RenderCommand): Promise<RenderOperation>;
    // (undocumented)
    config: RouterConfiguration | null;
    // (undocumented)
    connect(): void;
    // (undocumented)
    disconnect(): void;
    // (undocumented)
    readonly level: number;
    // (undocumented)
    readonly parent: Router | null;
    // (undocumented)
    removeContributor(contributor: NavigationContributor): void;
    // (undocumented)
    readonly route: RecognizedRoute | null;
    // (undocumented)
    shouldRender(route: RecognizedRoute<TSettings>): boolean;
}

// @alpha (undocumented)
export const Router: Readonly<{
    getOrCreateFor(element: HTMLElement): Router<any> | DefaultRouter;
    find(element: HTMLElement): Router | null;
    from<TBase extends {
        new (): HTMLElement;
        prototype: HTMLElement;
    }>(BaseType: TBase): new () => InstanceType<TBase> & RouterElement;
}>;

// @alpha (undocumented)
export abstract class RouterConfiguration<TSettings = any> {
    // (undocumented)
    protected cached(ElementType: new () => HTMLElement): () => Promise<HTMLElement>;
    // (undocumented)
    protected abstract configure(): Promise<void> | void;
    // (undocumented)
    construct<T>(Type: Constructable<T>): T;
    // (undocumented)
    readonly contributors: NavigationContributor<TSettings>[];
    // Warning: (ae-forgotten-export) The symbol "RoutingEventSink" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    createEventSink(): RoutingEventSink;
    // (undocumented)
    createLinkHandler(): LinkHandler;
    // (undocumented)
    createNavigationProcess(): NavigationProcess;
    // (undocumented)
    createNavigationQueue(): NavigationQueue;
    // (undocumented)
    createRouteRecognizer(): RouteRecognizer<TSettings>;
    // Warning: (ae-forgotten-export) The symbol "TitleBuilder" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    createTitleBuilder(): TitleBuilder;
    // (undocumented)
    defaultLayout: Layout;
    // (undocumented)
    defaultTransition: Readonly<Transition>;
    // (undocumented)
    findContributors<T extends NavigationPhaseName>(phase: T): Record<T, NavigationPhaseHook<TSettings>>[];
    generateRouteFromName(name: string, params: object): Promise<string | null>;
    generateRouteFromPath(path: string, params: object): Promise<string | null>;
    // (undocumented)
    parent: RouterConfiguration<TSettings> | null;
    // (undocumented)
    recognizeRoute(path: string): Promise<RouteMatch<TSettings> | null>;
    // (undocumented)
    readonly routes: RouteCollection<TSettings>;
    // (undocumented)
    title: string;
}

// @alpha (undocumented)
export interface RouteRecognizer<TSettings> {
    // (undocumented)
    add(routeOrRoutes: Route | readonly Route[], settings?: TSettings): void;
    // (undocumented)
    generateFromName(name: string, params: object): string | null;
    // (undocumented)
    generateFromPath(path: string, params: object): string | null;
    // (undocumented)
    recognize(path: string, converters?: Readonly<Record<string, RouteParameterConverter>>): Promise<RecognizedRoute<TSettings> | null>;
}

// @alpha (undocumented)
export interface RouterElement extends HTMLElement {
    // Warning: (ae-forgotten-export) The symbol "routerProperty" needs to be exported by the entry point index.d.ts
    //
    // (undocumented)
    readonly [routerProperty]: Router;
    // (undocumented)
    config: RouterConfiguration | null;
    // (undocumented)
    connectedCallback(): any;
    // (undocumented)
    disconnectedCallback(): any;
}

// @alpha (undocumented)
export type RouterExecutionContext = ExecutionContext & {
    router: Router;
};

// @alpha (undocumented)
export const RouterExecutionContext: Readonly<{
    create(router: Router): any;
}>;

// @alpha (undocumented)
export interface RouteView {
    // (undocumented)
    appendTo(host: HTMLElement): void;
    // (undocumented)
    bind(allTypedParams: Readonly<Record<string, any>>, context: RouterExecutionContext): void;
    // (undocumented)
    dispose(): void;
}

// @alpha (undocumented)
export type SupportsSettings<TSettings = any> = {
    settings?: TSettings;
};

// @alpha (undocumented)
export type TemplateFallbackRouteDefinition<TSettings = any> = LayoutAndTransitionRouteDefinition & HasTemplate & SupportsSettings<TSettings> & HasTitle;

// @alpha (undocumented)
export type TemplateRouteDefinition<TSettings = any> = NavigableRouteDefinition<TSettings> & HasTemplate;

// @alpha (undocumented)
export interface Transition {
    // (undocumented)
    begin(host: HTMLElement, prev: RouteView | null, next: RouteView): Promise<void>;
    // (undocumented)
    commit(host: HTMLElement, prev: RouteView | null, next: RouteView): Promise<void>;
    // (undocumented)
    rollback(host: HTMLElement, prev: RouteView | null, next: RouteView): Promise<void>;
}

// @alpha (undocumented)
export const Transition: Readonly<{
    default: Readonly<Transition>;
}>;


// (No @packageDocumentation comment for this package)

```
