1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC 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 { CompileDirectiveSummary, CompilePipeSummary } from '../compile_metadata';
|
---|
9 | import { SecurityContext } from '../core';
|
---|
10 | import { ASTWithSource, BindingPipe, BoundElementProperty, ParsedEvent, ParsedProperty, ParsedVariable, 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 | /**
|
---|
16 | * Parses bindings in templates and in the directive host area.
|
---|
17 | */
|
---|
18 | export declare class BindingParser {
|
---|
19 | private _exprParser;
|
---|
20 | private _interpolationConfig;
|
---|
21 | private _schemaRegistry;
|
---|
22 | errors: ParseError[];
|
---|
23 | pipesByName: Map<string, CompilePipeSummary> | null;
|
---|
24 | private _usedPipes;
|
---|
25 | constructor(_exprParser: Parser, _interpolationConfig: InterpolationConfig, _schemaRegistry: ElementSchemaRegistry, pipes: CompilePipeSummary[] | null, errors: ParseError[]);
|
---|
26 | get interpolationConfig(): InterpolationConfig;
|
---|
27 | getUsedPipes(): CompilePipeSummary[];
|
---|
28 | createBoundHostProperties(dirMeta: CompileDirectiveSummary, sourceSpan: ParseSourceSpan): ParsedProperty[] | null;
|
---|
29 | createDirectiveHostPropertyAsts(dirMeta: CompileDirectiveSummary, elementSelector: string, sourceSpan: ParseSourceSpan): BoundElementProperty[] | null;
|
---|
30 | createDirectiveHostEventAsts(dirMeta: CompileDirectiveSummary, sourceSpan: ParseSourceSpan): ParsedEvent[] | null;
|
---|
31 | parseInterpolation(value: string, sourceSpan: ParseSourceSpan): ASTWithSource;
|
---|
32 | /**
|
---|
33 | * Similar to `parseInterpolation`, but treats the provided string as a single expression
|
---|
34 | * element that would normally appear within the interpolation prefix and suffix (`{{` and `}}`).
|
---|
35 | * This is used for parsing the switch expression in ICUs.
|
---|
36 | */
|
---|
37 | parseInterpolationExpression(expression: string, sourceSpan: ParseSourceSpan): ASTWithSource;
|
---|
38 | /**
|
---|
39 | * Parses the bindings in a microsyntax expression, and converts them to
|
---|
40 | * `ParsedProperty` or `ParsedVariable`.
|
---|
41 | *
|
---|
42 | * @param tplKey template binding name
|
---|
43 | * @param tplValue template binding value
|
---|
44 | * @param sourceSpan span of template binding relative to entire the template
|
---|
45 | * @param absoluteValueOffset start of the tplValue relative to the entire template
|
---|
46 | * @param targetMatchableAttrs potential attributes to match in the template
|
---|
47 | * @param targetProps target property bindings in the template
|
---|
48 | * @param targetVars target variables in the template
|
---|
49 | */
|
---|
50 | parseInlineTemplateBinding(tplKey: string, tplValue: string, sourceSpan: ParseSourceSpan, absoluteValueOffset: number, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], targetVars: ParsedVariable[], isIvyAst: boolean): void;
|
---|
51 | /**
|
---|
52 | * Parses the bindings in a microsyntax expression, e.g.
|
---|
53 | * ```
|
---|
54 | * <tag *tplKey="let value1 = prop; let value2 = localVar">
|
---|
55 | * ```
|
---|
56 | *
|
---|
57 | * @param tplKey template binding name
|
---|
58 | * @param tplValue template binding value
|
---|
59 | * @param sourceSpan span of template binding relative to entire the template
|
---|
60 | * @param absoluteKeyOffset start of the `tplKey`
|
---|
61 | * @param absoluteValueOffset start of the `tplValue`
|
---|
62 | */
|
---|
63 | private _parseTemplateBindings;
|
---|
64 | parseLiteralAttr(name: string, value: string | null, sourceSpan: ParseSourceSpan, absoluteOffset: number, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan?: ParseSourceSpan): void;
|
---|
65 | parsePropertyBinding(name: string, expression: string, isHost: boolean, sourceSpan: ParseSourceSpan, absoluteOffset: number, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan?: ParseSourceSpan): void;
|
---|
66 | parsePropertyInterpolation(name: string, value: string, sourceSpan: ParseSourceSpan, valueSpan: ParseSourceSpan | undefined, targetMatchableAttrs: string[][], targetProps: ParsedProperty[], keySpan?: ParseSourceSpan): boolean;
|
---|
67 | private _parsePropertyAst;
|
---|
68 | private _parseAnimation;
|
---|
69 | private _parseBinding;
|
---|
70 | createBoundElementProperty(elementSelector: string, boundProp: ParsedProperty, skipValidation?: boolean, mapPropertyName?: boolean): BoundElementProperty;
|
---|
71 | parseEvent(name: string, expression: string, sourceSpan: ParseSourceSpan, handlerSpan: ParseSourceSpan, targetMatchableAttrs: string[][], targetEvents: ParsedEvent[], keySpan?: ParseSourceSpan): void;
|
---|
72 | calcPossibleSecurityContexts(selector: string, propName: string, isAttribute: boolean): SecurityContext[];
|
---|
73 | private _parseAnimationEvent;
|
---|
74 | private _parseRegularEvent;
|
---|
75 | private _parseAction;
|
---|
76 | private _reportError;
|
---|
77 | private _reportExpressionParserErrors;
|
---|
78 | private _checkPipes;
|
---|
79 | /**
|
---|
80 | * @param propName the name of the property / attribute
|
---|
81 | * @param sourceSpan
|
---|
82 | * @param isAttr true when binding to an attribute
|
---|
83 | */
|
---|
84 | private _validatePropertyOrAttributeName;
|
---|
85 | }
|
---|
86 | export declare class PipeCollector extends RecursiveAstVisitor {
|
---|
87 | pipes: Map<string, BindingPipe>;
|
---|
88 | visitPipe(ast: BindingPipe, context: any): any;
|
---|
89 | }
|
---|
90 | export declare function calcPossibleSecurityContexts(registry: ElementSchemaRegistry, selector: string, propName: string, isAttribute: boolean): SecurityContext[];
|
---|