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 { AstPath } from '../ast_path';
|
---|
9 | import { I18nMeta } from '../i18n/i18n_ast';
|
---|
10 | import { ParseSourceSpan } from '../parse_util';
|
---|
11 | import { InterpolatedAttributeToken, InterpolatedTextToken } from './tokens';
|
---|
12 | interface BaseNode {
|
---|
13 | sourceSpan: ParseSourceSpan;
|
---|
14 | visit(visitor: Visitor, context: any): any;
|
---|
15 | }
|
---|
16 | export declare type Node = Attribute | Comment | Element | Expansion | ExpansionCase | Text;
|
---|
17 | export declare abstract class NodeWithI18n implements BaseNode {
|
---|
18 | sourceSpan: ParseSourceSpan;
|
---|
19 | i18n?: I18nMeta | undefined;
|
---|
20 | constructor(sourceSpan: ParseSourceSpan, i18n?: I18nMeta | undefined);
|
---|
21 | abstract visit(visitor: Visitor, context: any): any;
|
---|
22 | }
|
---|
23 | export declare class Text extends NodeWithI18n {
|
---|
24 | value: string;
|
---|
25 | tokens: InterpolatedTextToken[];
|
---|
26 | constructor(value: string, sourceSpan: ParseSourceSpan, tokens: InterpolatedTextToken[], i18n?: I18nMeta);
|
---|
27 | visit(visitor: Visitor, context: any): any;
|
---|
28 | }
|
---|
29 | export declare class Expansion extends NodeWithI18n {
|
---|
30 | switchValue: string;
|
---|
31 | type: string;
|
---|
32 | cases: ExpansionCase[];
|
---|
33 | switchValueSourceSpan: ParseSourceSpan;
|
---|
34 | constructor(switchValue: string, type: string, cases: ExpansionCase[], sourceSpan: ParseSourceSpan, switchValueSourceSpan: ParseSourceSpan, i18n?: I18nMeta);
|
---|
35 | visit(visitor: Visitor, context: any): any;
|
---|
36 | }
|
---|
37 | export declare class ExpansionCase implements BaseNode {
|
---|
38 | value: string;
|
---|
39 | expression: Node[];
|
---|
40 | sourceSpan: ParseSourceSpan;
|
---|
41 | valueSourceSpan: ParseSourceSpan;
|
---|
42 | expSourceSpan: ParseSourceSpan;
|
---|
43 | constructor(value: string, expression: Node[], sourceSpan: ParseSourceSpan, valueSourceSpan: ParseSourceSpan, expSourceSpan: ParseSourceSpan);
|
---|
44 | visit(visitor: Visitor, context: any): any;
|
---|
45 | }
|
---|
46 | export declare class Attribute extends NodeWithI18n {
|
---|
47 | name: string;
|
---|
48 | value: string;
|
---|
49 | readonly keySpan: ParseSourceSpan | undefined;
|
---|
50 | valueSpan: ParseSourceSpan | undefined;
|
---|
51 | valueTokens: InterpolatedAttributeToken[] | undefined;
|
---|
52 | constructor(name: string, value: string, sourceSpan: ParseSourceSpan, keySpan: ParseSourceSpan | undefined, valueSpan: ParseSourceSpan | undefined, valueTokens: InterpolatedAttributeToken[] | undefined, i18n: I18nMeta | undefined);
|
---|
53 | visit(visitor: Visitor, context: any): any;
|
---|
54 | }
|
---|
55 | export declare class Element extends NodeWithI18n {
|
---|
56 | name: string;
|
---|
57 | attrs: Attribute[];
|
---|
58 | children: Node[];
|
---|
59 | startSourceSpan: ParseSourceSpan;
|
---|
60 | endSourceSpan: ParseSourceSpan | null;
|
---|
61 | constructor(name: string, attrs: Attribute[], children: Node[], sourceSpan: ParseSourceSpan, startSourceSpan: ParseSourceSpan, endSourceSpan?: ParseSourceSpan | null, i18n?: I18nMeta);
|
---|
62 | visit(visitor: Visitor, context: any): any;
|
---|
63 | }
|
---|
64 | export declare class Comment implements BaseNode {
|
---|
65 | value: string | null;
|
---|
66 | sourceSpan: ParseSourceSpan;
|
---|
67 | constructor(value: string | null, sourceSpan: ParseSourceSpan);
|
---|
68 | visit(visitor: Visitor, context: any): any;
|
---|
69 | }
|
---|
70 | export interface Visitor {
|
---|
71 | visit?(node: Node, context: any): any;
|
---|
72 | visitElement(element: Element, context: any): any;
|
---|
73 | visitAttribute(attribute: Attribute, context: any): any;
|
---|
74 | visitText(text: Text, context: any): any;
|
---|
75 | visitComment(comment: Comment, context: any): any;
|
---|
76 | visitExpansion(expansion: Expansion, context: any): any;
|
---|
77 | visitExpansionCase(expansionCase: ExpansionCase, context: any): any;
|
---|
78 | }
|
---|
79 | export declare function visitAll(visitor: Visitor, nodes: Node[], context?: any): any[];
|
---|
80 | export declare class RecursiveVisitor implements Visitor {
|
---|
81 | constructor();
|
---|
82 | visitElement(ast: Element, context: any): any;
|
---|
83 | visitAttribute(ast: Attribute, context: any): any;
|
---|
84 | visitText(ast: Text, context: any): any;
|
---|
85 | visitComment(ast: Comment, context: any): any;
|
---|
86 | visitExpansion(ast: Expansion, context: any): any;
|
---|
87 | visitExpansionCase(ast: ExpansionCase, context: any): any;
|
---|
88 | private visitChildren;
|
---|
89 | }
|
---|
90 | export declare type HtmlAstPath = AstPath<Node>;
|
---|
91 | export declare function findNode(nodes: Node[], position: number): HtmlAstPath;
|
---|
92 | export {};
|
---|