1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 | import * as babel from '@babel/types';
|
15 | import * as parse5 from 'parse5';
|
16 | import { ParsedHtmlDocument } from '../html/html-document';
|
17 | import { JavaScriptDocument } from '../javascript/javascript-document';
|
18 | import { SourceRange, Warning } from '../model/model';
|
19 | import { ParsedDocument } from '../parser/document';
|
20 | export interface Template extends parse5.ASTNode {
|
21 | content: parse5.ASTNode;
|
22 | }
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 | export declare function getAllDataBindingTemplates(node: parse5.ASTNode): IterableIterator<Template>;
|
33 | export declare type HtmlDatabindingExpression = TextNodeDatabindingExpression | AttributeDatabindingExpression;
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 | export declare type ExpressionLimitation = 'full' | 'identifierOnly' | 'callExpression';
|
40 | export declare abstract class DatabindingExpression {
|
41 | readonly sourceRange: SourceRange;
|
42 | readonly warnings: Warning[];
|
43 | readonly expressionText: string;
|
44 | private readonly _expressionAst;
|
45 | private readonly locationOffset;
|
46 | private readonly _document;
|
47 | |
48 |
|
49 |
|
50 |
|
51 |
|
52 |
|
53 | properties: Array<{
|
54 | name: string;
|
55 | sourceRange: SourceRange;
|
56 | }>;
|
57 | constructor(sourceRange: SourceRange, expressionText: string, ast: babel.Program, limitation: ExpressionLimitation, document: ParsedDocument);
|
58 | /**
|
59 | * Given an estree node in this databinding expression, give its source range.
|
60 | */
|
61 | sourceRangeForNode(node: babel.Node): SourceRange | undefined;
|
62 | private _extractPropertiesAndValidate;
|
63 | private _validateLimitation;
|
64 | private _extractAndValidateSubExpression;
|
65 | private _validationWarning;
|
66 | }
|
67 | export declare class AttributeDatabindingExpression extends DatabindingExpression {
|
68 | |
69 |
|
70 |
|
71 | readonly astNode: parse5.ASTNode;
|
72 | readonly databindingInto = "attribute";
|
73 | |
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 |
|
84 | readonly isCompleteBinding: boolean;
|
85 |
|
86 | readonly direction: '{' | '[';
|
87 | |
88 |
|
89 |
|
90 |
|
91 | readonly eventName: string | undefined;
|
92 |
|
93 | readonly attribute: parse5.ASTAttribute;
|
94 | constructor(astNode: parse5.ASTNode, isCompleteBinding: boolean, direction: '{' | '[', eventName: string | undefined, attribute: parse5.ASTAttribute, sourceRange: SourceRange, expressionText: string, ast: babel.Program, document: ParsedHtmlDocument);
|
95 | }
|
96 | export declare class TextNodeDatabindingExpression extends DatabindingExpression {
|
97 |
|
98 | readonly direction: '{' | '[';
|
99 | |
100 |
|
101 |
|
102 | readonly astNode: parse5.ASTNode;
|
103 | readonly databindingInto = "text-node";
|
104 | constructor(direction: '{' | '[', astNode: parse5.ASTNode, sourceRange: SourceRange, expressionText: string, ast: babel.Program, document: ParsedHtmlDocument);
|
105 | }
|
106 | export declare class JavascriptDatabindingExpression extends DatabindingExpression {
|
107 | readonly astNode: babel.Node;
|
108 | readonly databindingInto = "javascript";
|
109 | constructor(astNode: babel.Node, sourceRange: SourceRange, expressionText: string, ast: babel.Program, kind: ExpressionLimitation, document: JavaScriptDocument);
|
110 | }
|
111 | /**
|
112 | * Find and parse Polymer databinding expressions in HTML.
|
113 | */
|
114 | export declare function scanDocumentForExpressions(document: ParsedHtmlDocument): {
|
115 | expressions: HtmlDatabindingExpression[];
|
116 | warnings: Warning[];
|
117 | };
|
118 | export declare function scanDatabindingTemplateForExpressions(document: ParsedHtmlDocument, template: Template): {
|
119 | expressions: HtmlDatabindingExpression[];
|
120 | warnings: Warning[];
|
121 | };
|
122 | export declare function parseExpressionInJsStringLiteral(document: JavaScriptDocument, stringLiteral: babel.Node, kind: 'identifierOnly' | 'callExpression' | 'full'): {
|
123 | databinding: JavascriptDatabindingExpression | undefined;
|
124 | warnings: Warning[];
|
125 | };
|