UNPKG

2.94 kBTypeScriptView Raw
1import { InjectionToken } from '@angular/core';
2import { App } from '../components/app/app';
3import { NavigationContainer } from './navigation-container';
4import { DeepLinkConfig, DehydratedSegment, DehydratedSegmentPair, NavGroup, NavLink, NavSegment } from './nav-util';
5/**
6 * @hidden
7 */
8export declare class UrlSerializer {
9 _app: App;
10 links: NavLink[];
11 constructor(_app: App, config: DeepLinkConfig);
12 /**
13 * Parse the URL into a Path, which is made up of multiple NavSegments.
14 * Match which components belong to each segment.
15 */
16 parse(browserUrl: string): NavSegment[];
17 createSegmentFromName(navContainer: NavigationContainer, nameOrComponent: any): NavSegment;
18 getLinkFromName(nameOrComponent: any): NavLink;
19 /**
20 * Serialize a path, which is made up of multiple NavSegments,
21 * into a URL string. Turn each segment into a string and concat them to a URL.
22 */
23 serialize(segments: NavSegment[]): string;
24 /**
25 * Serializes a component and its data into a NavSegment.
26 */
27 serializeComponent(navContainer: NavigationContainer, component: any, data: any): NavSegment;
28 /**
29 * @internal
30 */
31 _createSegment(app: App, navContainer: NavigationContainer, configLink: NavLink, data: any): NavSegment;
32}
33export declare function formatUrlPart(name: string): string;
34export declare const isPartMatch: (urlPart: string, configLinkPart: string) => boolean;
35export declare const createMatchedData: (matchedUrlParts: string[], link: NavLink) => any;
36export declare const findLinkByComponentData: (links: NavLink[], component: any, instanceData: any) => NavLink;
37export declare const normalizeLinks: (links: NavLink[]) => NavLink[];
38/**
39 * @hidden
40 */
41export declare const DeepLinkConfigToken: InjectionToken<any>;
42export declare function setupUrlSerializer(app: App, userDeepLinkConfig: any): UrlSerializer;
43export declare function navGroupStringtoObjects(navGroupStrings: string[]): NavGroup[];
44export declare function urlToNavGroupStrings(url: string): string[];
45export declare function convertUrlToSegments(app: App, url: string, navLinks: NavLink[]): NavSegment[];
46export declare function convertUrlToDehydratedSegments(url: string, navLinks: NavLink[]): DehydratedSegmentPair[];
47export declare function hydrateSegmentsWithNav(app: App, dehydratedSegmentPairs: DehydratedSegmentPair[]): NavSegment[];
48export declare function getNavFromNavGroup(navGroup: NavGroup, app: App): NavigationContainer[];
49export declare function getSegmentsFromNavGroups(navGroups: NavGroup[], navLinks: NavLink[]): DehydratedSegmentPair[];
50export declare function getSegmentsFromUrlPieces(urlSections: string[], navLink: NavLink): DehydratedSegment;
51export declare function hydrateSegment(segment: DehydratedSegment, nav: NavigationContainer): NavSegment;
52export declare function getNonHydratedSegmentIfLinkAndUrlMatch(urlChunks: string[], navLink: NavLink): DehydratedSegment;