1
|
/**
|
2
|
* @license
|
3
|
* Copyright Google Inc. All Rights Reserved.
|
4
|
*
|
5
|
* Use of this source code is governed by an MIT-style license that can be
|
6
|
* found in the LICENSE file at https://angular.io/license
|
7
|
*/
|
8
|
import { InjectionToken, SchemaMetadata, ɵConsole as Console } from '@angular/core';
|
9
|
import { CompileDirectiveMetadata, CompileDirectiveSummary, CompilePipeSummary, CompileTypeMetadata } from '../compile_metadata';
|
10
|
import { CompileReflector } from '../compile_reflector';
|
11
|
import { CompilerConfig } from '../config';
|
12
|
import { Parser } from '../expression_parser/parser';
|
13
|
import { I18NHtmlParser } from '../i18n/i18n_html_parser';
|
14
|
import { ParseTreeResult } from '../ml_parser/html_parser';
|
15
|
import { InterpolationConfig } from '../ml_parser/interpolation_config';
|
16
|
import { ParseError, ParseErrorLevel, ParseSourceSpan } from '../parse_util';
|
17
|
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
|
18
|
import { CssSelector } from '../selector';
|
19
|
import { TemplateAst, TemplateAstVisitor } from './template_ast';
|
20
|
/**
|
21
|
* Provides an array of {@link TemplateAstVisitor}s which will be used to transform
|
22
|
* parsed templates before compilation is invoked, allowing custom expression syntax
|
23
|
* and other advanced transformations.
|
24
|
*
|
25
|
* This is currently an internal-only feature and not meant for general use.
|
26
|
*/
|
27
|
export declare const TEMPLATE_TRANSFORMS: InjectionToken<{}>;
|
28
|
export declare class TemplateParseError extends ParseError {
|
29
|
constructor(message: string, span: ParseSourceSpan, level: ParseErrorLevel);
|
30
|
}
|
31
|
export declare class TemplateParseResult {
|
32
|
templateAst: TemplateAst[];
|
33
|
usedPipes: CompilePipeSummary[];
|
34
|
errors: ParseError[];
|
35
|
constructor(templateAst?: TemplateAst[], usedPipes?: CompilePipeSummary[], errors?: ParseError[]);
|
36
|
}
|
37
|
export declare class TemplateParser {
|
38
|
private _config;
|
39
|
private _reflector;
|
40
|
private _exprParser;
|
41
|
private _schemaRegistry;
|
42
|
private _htmlParser;
|
43
|
private _console;
|
44
|
transforms: TemplateAstVisitor[];
|
45
|
constructor(_config: CompilerConfig, _reflector: CompileReflector, _exprParser: Parser, _schemaRegistry: ElementSchemaRegistry, _htmlParser: I18NHtmlParser, _console: Console, transforms: TemplateAstVisitor[]);
|
46
|
parse(component: CompileDirectiveMetadata, template: string, directives: CompileDirectiveSummary[], pipes: CompilePipeSummary[], schemas: SchemaMetadata[], templateUrl: string, preserveWhitespaces: boolean): {
|
47
|
template: TemplateAst[];
|
48
|
pipes: CompilePipeSummary[];
|
49
|
};
|
50
|
tryParse(component: CompileDirectiveMetadata, template: string, directives: CompileDirectiveSummary[], pipes: CompilePipeSummary[], schemas: SchemaMetadata[], templateUrl: string, preserveWhitespaces: boolean): TemplateParseResult;
|
51
|
tryParseHtml(htmlAstWithErrors: ParseTreeResult, component: CompileDirectiveMetadata, directives: CompileDirectiveSummary[], pipes: CompilePipeSummary[], schemas: SchemaMetadata[]): TemplateParseResult;
|
52
|
expandHtml(htmlAstWithErrors: ParseTreeResult, forced?: boolean): ParseTreeResult;
|
53
|
getInterpolationConfig(component: CompileDirectiveMetadata): InterpolationConfig | undefined;
|
54
|
}
|
55
|
export declare function splitClasses(classAttrValue: string): string[];
|
56
|
export declare function createElementCssSelector(elementName: string, attributes: [string, string][]): CssSelector;
|
57
|
export declare function removeSummaryDuplicates<T extends {
|
58
|
type: CompileTypeMetadata;
|
59
|
}>(items: T[]): T[];
|