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 { SecurityContext } from '@angular/core';
|
9
|
import { CompileDirectiveSummary, CompilePipeSummary } from '../compile_metadata';
|
10
|
import { ASTWithSource, BindingPipe, RecursiveAstVisitor } from '../expression_parser/ast';
|
11
|
import { Parser } from '../expression_parser/parser';
|
12
|
import { InterpolationConfig } from '../ml_parser/interpolation_config';
|
13
|
import { ParseError, ParseSourceSpan } from '../parse_util';
|
14
|
import { ElementSchemaRegistry } from '../schema/element_schema_registry';
|
15
|
import { BoundElementPropertyAst, BoundEventAst, VariableAst } from './template_ast';
|
16
|
export declare enum BoundPropertyType {
|
17
|
DEFAULT = 0,
|
18
|
LITERAL_ATTR = 1,
|
19
|
ANIMATION = 2,
|
20
|
}
|
21
|
/**
|
22
|
* Represents a parsed property.
|
23
|
*/
|
24
|
export declare class BoundProperty {
|
25
|
name: string;
|
26
|
expression: ASTWithSource;
|
27
|
type: BoundPropertyType;
|
28
|
sourceSpan: ParseSourceSpan;
|
29
|
constructor(name: string, expression: ASTWithSource, type: BoundPropertyType, sourceSpan: ParseSourceSpan);
|
30
|
readonly isLiteral: boolean;
|
31
|
readonly isAnimation: boolean;
|
32
|
}
|
33
|
/**
|
34
|
* Parses bindings in templates and in the directive host area.
|
35
|
*/
|
36
|
export declare class BindingParser {
|
37
|
private _exprParser;
|
38
|
private _interpolationConfig;
|
39
|
private _schemaRegistry;
|
40
|
private _targetErrors;
|
41
|
pipesByName: Map<string, CompilePipeSummary>;
|
42
|
private _usedPipes;
|
43
|
constructor(_exprParser: Parser, _interpolationConfig: InterpolationConfig, _schemaRegistry: ElementSchemaRegistry, pipes: CompilePipeSummary[], _targetErrors: ParseError[]);
|
44
|
getUsedPipes(): CompilePipeSummary[];
|
45
|
createDirectiveHostPropertyAsts(dirMeta: CompileDirectiveSummary, elementSelector: string, sourceSpan: ParseSourceSpan): BoundElementPropertyAst[] | null;
|
46
|
createDirectiveHostEventAsts(dirMeta: CompileDirectiveSummary, sourceSpan: ParseSourceSpan): BoundEventAst[] | null;
|
47
|
parseInterpolation(value: string, sourceSpan: ParseSourceSpan): ASTWithSource;
|
48
|
parseInlineTemplateBinding(prefixToken: string, value: string, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[], targetVars: VariableAst[]): void;
|
49
|
private _parseTemplateBindings(prefixToken, value, sourceSpan);
|
50
|
parseLiteralAttr(name: string, value: string | null, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[]): void;
|
51
|
parsePropertyBinding(name: string, expression: string, isHost: boolean, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[]): void;
|
52
|
parsePropertyInterpolation(name: string, value: string, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetProps: BoundProperty[]): boolean;
|
53
|
private _parsePropertyAst(name, ast, sourceSpan, targetMatchableAttrs, targetProps);
|
54
|
private _parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps);
|
55
|
private _parseBinding(value, isHostBinding, sourceSpan);
|
56
|
createElementPropertyAst(elementSelector: string, boundProp: BoundProperty): BoundElementPropertyAst;
|
57
|
parseEvent(name: string, expression: string, sourceSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetEvents: BoundEventAst[]): void;
|
58
|
private _parseAnimationEvent(name, expression, sourceSpan, targetEvents);
|
59
|
private _parseEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
|
60
|
private _parseAction(value, sourceSpan);
|
61
|
private _reportError(message, sourceSpan, level?);
|
62
|
private _reportExpressionParserErrors(errors, sourceSpan);
|
63
|
private _checkPipes(ast, sourceSpan);
|
64
|
/**
|
65
|
* @param propName the name of the property / attribute
|
66
|
* @param sourceSpan
|
67
|
* @param isAttr true when binding to an attribute
|
68
|
* @private
|
69
|
*/
|
70
|
private _validatePropertyOrAttributeName(propName, sourceSpan, isAttr);
|
71
|
}
|
72
|
export declare class PipeCollector extends RecursiveAstVisitor {
|
73
|
pipes: Map<string, BindingPipe>;
|
74
|
visitPipe(ast: BindingPipe, context: any): any;
|
75
|
}
|
76
|
export declare function calcPossibleSecurityContexts(registry: ElementSchemaRegistry, selector: string, propName: string, isAttribute: boolean): SecurityContext[];
|