UNPKG

1.41 kBTypeScriptView Raw
1import { ComponentInstruction } from '../instruction';
2import { RouteDefinition } from '../route_config/route_config_impl';
3import { Url } from '../url_parser';
4import { AbstractRule, RouteMatch, RouteRule } from './rules';
5/**
6 * A `RuleSet` is responsible for recognizing routes for a particular component.
7 * It is consumed by `RouteRegistry`, which knows how to recognize an entire hierarchy of
8 * components.
9 */
10export declare class RuleSet {
11 rulesByName: Map<string, RouteRule>;
12 auxRulesByName: Map<string, RouteRule>;
13 auxRulesByPath: Map<string, RouteRule>;
14 rules: AbstractRule[];
15 defaultRule: RouteRule;
16 /**
17 * Configure additional rules in this rule set from a route definition
18 * @returns {boolean} true if the config is terminal
19 */
20 config(config: RouteDefinition): boolean;
21 /**
22 * Given a URL, returns a list of `RouteMatch`es, which are partial recognitions for some route.
23 */
24 recognize(urlParse: Url): Promise<RouteMatch>[];
25 recognizeAuxiliary(urlParse: Url): Promise<RouteMatch>[];
26 hasRoute(name: string): boolean;
27 componentLoaded(name: string): boolean;
28 loadComponent(name: string): Promise<any>;
29 generate(name: string, params: any): ComponentInstruction;
30 generateAuxiliary(name: string, params: any): ComponentInstruction;
31 private _assertNoHashCollision(hash, path);
32 private _getRoutePath(config);
33}