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 | /**
|
---|
9 | * A segment of text within the template.
|
---|
10 | */
|
---|
11 | export class TextAst {
|
---|
12 | constructor(value, ngContentIndex, sourceSpan) {
|
---|
13 | this.value = value;
|
---|
14 | this.ngContentIndex = ngContentIndex;
|
---|
15 | this.sourceSpan = sourceSpan;
|
---|
16 | }
|
---|
17 | visit(visitor, context) {
|
---|
18 | return visitor.visitText(this, context);
|
---|
19 | }
|
---|
20 | }
|
---|
21 | /**
|
---|
22 | * A bound expression within the text of a template.
|
---|
23 | */
|
---|
24 | export class BoundTextAst {
|
---|
25 | constructor(value, ngContentIndex, sourceSpan) {
|
---|
26 | this.value = value;
|
---|
27 | this.ngContentIndex = ngContentIndex;
|
---|
28 | this.sourceSpan = sourceSpan;
|
---|
29 | }
|
---|
30 | visit(visitor, context) {
|
---|
31 | return visitor.visitBoundText(this, context);
|
---|
32 | }
|
---|
33 | }
|
---|
34 | /**
|
---|
35 | * A plain attribute on an element.
|
---|
36 | */
|
---|
37 | export class AttrAst {
|
---|
38 | constructor(name, value, sourceSpan) {
|
---|
39 | this.name = name;
|
---|
40 | this.value = value;
|
---|
41 | this.sourceSpan = sourceSpan;
|
---|
42 | }
|
---|
43 | visit(visitor, context) {
|
---|
44 | return visitor.visitAttr(this, context);
|
---|
45 | }
|
---|
46 | }
|
---|
47 | const BoundPropertyMapping = {
|
---|
48 | [4 /* Animation */]: 4 /* Animation */,
|
---|
49 | [1 /* Attribute */]: 1 /* Attribute */,
|
---|
50 | [2 /* Class */]: 2 /* Class */,
|
---|
51 | [0 /* Property */]: 0 /* Property */,
|
---|
52 | [3 /* Style */]: 3 /* Style */,
|
---|
53 | };
|
---|
54 | /**
|
---|
55 | * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g.
|
---|
56 | * `[@trigger]="stateExp"`)
|
---|
57 | */
|
---|
58 | export class BoundElementPropertyAst {
|
---|
59 | constructor(name, type, securityContext, value, unit, sourceSpan) {
|
---|
60 | this.name = name;
|
---|
61 | this.type = type;
|
---|
62 | this.securityContext = securityContext;
|
---|
63 | this.value = value;
|
---|
64 | this.unit = unit;
|
---|
65 | this.sourceSpan = sourceSpan;
|
---|
66 | this.isAnimation = this.type === 4 /* Animation */;
|
---|
67 | }
|
---|
68 | static fromBoundProperty(prop) {
|
---|
69 | const type = BoundPropertyMapping[prop.type];
|
---|
70 | return new BoundElementPropertyAst(prop.name, type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan);
|
---|
71 | }
|
---|
72 | visit(visitor, context) {
|
---|
73 | return visitor.visitElementProperty(this, context);
|
---|
74 | }
|
---|
75 | }
|
---|
76 | /**
|
---|
77 | * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g.
|
---|
78 | * `(@trigger.phase)="callback($event)"`).
|
---|
79 | */
|
---|
80 | export class BoundEventAst {
|
---|
81 | constructor(name, target, phase, handler, sourceSpan, handlerSpan) {
|
---|
82 | this.name = name;
|
---|
83 | this.target = target;
|
---|
84 | this.phase = phase;
|
---|
85 | this.handler = handler;
|
---|
86 | this.sourceSpan = sourceSpan;
|
---|
87 | this.handlerSpan = handlerSpan;
|
---|
88 | this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase);
|
---|
89 | this.isAnimation = !!this.phase;
|
---|
90 | }
|
---|
91 | static calcFullName(name, target, phase) {
|
---|
92 | if (target) {
|
---|
93 | return `${target}:${name}`;
|
---|
94 | }
|
---|
95 | if (phase) {
|
---|
96 | return `@${name}.${phase}`;
|
---|
97 | }
|
---|
98 | return name;
|
---|
99 | }
|
---|
100 | static fromParsedEvent(event) {
|
---|
101 | const target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
|
---|
102 | const phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
|
---|
103 | return new BoundEventAst(event.name, target, phase, event.handler, event.sourceSpan, event.handlerSpan);
|
---|
104 | }
|
---|
105 | visit(visitor, context) {
|
---|
106 | return visitor.visitEvent(this, context);
|
---|
107 | }
|
---|
108 | }
|
---|
109 | /**
|
---|
110 | * A reference declaration on an element (e.g. `let someName="expression"`).
|
---|
111 | */
|
---|
112 | export class ReferenceAst {
|
---|
113 | constructor(name, value, originalValue, sourceSpan) {
|
---|
114 | this.name = name;
|
---|
115 | this.value = value;
|
---|
116 | this.originalValue = originalValue;
|
---|
117 | this.sourceSpan = sourceSpan;
|
---|
118 | }
|
---|
119 | visit(visitor, context) {
|
---|
120 | return visitor.visitReference(this, context);
|
---|
121 | }
|
---|
122 | }
|
---|
123 | /**
|
---|
124 | * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`).
|
---|
125 | */
|
---|
126 | export class VariableAst {
|
---|
127 | constructor(name, value, sourceSpan, valueSpan) {
|
---|
128 | this.name = name;
|
---|
129 | this.value = value;
|
---|
130 | this.sourceSpan = sourceSpan;
|
---|
131 | this.valueSpan = valueSpan;
|
---|
132 | }
|
---|
133 | static fromParsedVariable(v) {
|
---|
134 | return new VariableAst(v.name, v.value, v.sourceSpan, v.valueSpan);
|
---|
135 | }
|
---|
136 | visit(visitor, context) {
|
---|
137 | return visitor.visitVariable(this, context);
|
---|
138 | }
|
---|
139 | }
|
---|
140 | /**
|
---|
141 | * An element declaration in a template.
|
---|
142 | */
|
---|
143 | export class ElementAst {
|
---|
144 | constructor(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) {
|
---|
145 | this.name = name;
|
---|
146 | this.attrs = attrs;
|
---|
147 | this.inputs = inputs;
|
---|
148 | this.outputs = outputs;
|
---|
149 | this.references = references;
|
---|
150 | this.directives = directives;
|
---|
151 | this.providers = providers;
|
---|
152 | this.hasViewContainer = hasViewContainer;
|
---|
153 | this.queryMatches = queryMatches;
|
---|
154 | this.children = children;
|
---|
155 | this.ngContentIndex = ngContentIndex;
|
---|
156 | this.sourceSpan = sourceSpan;
|
---|
157 | this.endSourceSpan = endSourceSpan;
|
---|
158 | }
|
---|
159 | visit(visitor, context) {
|
---|
160 | return visitor.visitElement(this, context);
|
---|
161 | }
|
---|
162 | }
|
---|
163 | /**
|
---|
164 | * A `<ng-template>` element included in an Angular template.
|
---|
165 | */
|
---|
166 | export class EmbeddedTemplateAst {
|
---|
167 | constructor(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) {
|
---|
168 | this.attrs = attrs;
|
---|
169 | this.outputs = outputs;
|
---|
170 | this.references = references;
|
---|
171 | this.variables = variables;
|
---|
172 | this.directives = directives;
|
---|
173 | this.providers = providers;
|
---|
174 | this.hasViewContainer = hasViewContainer;
|
---|
175 | this.queryMatches = queryMatches;
|
---|
176 | this.children = children;
|
---|
177 | this.ngContentIndex = ngContentIndex;
|
---|
178 | this.sourceSpan = sourceSpan;
|
---|
179 | }
|
---|
180 | visit(visitor, context) {
|
---|
181 | return visitor.visitEmbeddedTemplate(this, context);
|
---|
182 | }
|
---|
183 | }
|
---|
184 | /**
|
---|
185 | * A directive property with a bound value (e.g. `*ngIf="condition").
|
---|
186 | */
|
---|
187 | export class BoundDirectivePropertyAst {
|
---|
188 | constructor(directiveName, templateName, value, sourceSpan) {
|
---|
189 | this.directiveName = directiveName;
|
---|
190 | this.templateName = templateName;
|
---|
191 | this.value = value;
|
---|
192 | this.sourceSpan = sourceSpan;
|
---|
193 | }
|
---|
194 | visit(visitor, context) {
|
---|
195 | return visitor.visitDirectiveProperty(this, context);
|
---|
196 | }
|
---|
197 | }
|
---|
198 | /**
|
---|
199 | * A directive declared on an element.
|
---|
200 | */
|
---|
201 | export class DirectiveAst {
|
---|
202 | constructor(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) {
|
---|
203 | this.directive = directive;
|
---|
204 | this.inputs = inputs;
|
---|
205 | this.hostProperties = hostProperties;
|
---|
206 | this.hostEvents = hostEvents;
|
---|
207 | this.contentQueryStartId = contentQueryStartId;
|
---|
208 | this.sourceSpan = sourceSpan;
|
---|
209 | }
|
---|
210 | visit(visitor, context) {
|
---|
211 | return visitor.visitDirective(this, context);
|
---|
212 | }
|
---|
213 | }
|
---|
214 | /**
|
---|
215 | * A provider declared on an element
|
---|
216 | */
|
---|
217 | export class ProviderAst {
|
---|
218 | constructor(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan, isModule) {
|
---|
219 | this.token = token;
|
---|
220 | this.multiProvider = multiProvider;
|
---|
221 | this.eager = eager;
|
---|
222 | this.providers = providers;
|
---|
223 | this.providerType = providerType;
|
---|
224 | this.lifecycleHooks = lifecycleHooks;
|
---|
225 | this.sourceSpan = sourceSpan;
|
---|
226 | this.isModule = isModule;
|
---|
227 | }
|
---|
228 | visit(visitor, context) {
|
---|
229 | // No visit method in the visitor for now...
|
---|
230 | return null;
|
---|
231 | }
|
---|
232 | }
|
---|
233 | export var ProviderAstType;
|
---|
234 | (function (ProviderAstType) {
|
---|
235 | ProviderAstType[ProviderAstType["PublicService"] = 0] = "PublicService";
|
---|
236 | ProviderAstType[ProviderAstType["PrivateService"] = 1] = "PrivateService";
|
---|
237 | ProviderAstType[ProviderAstType["Component"] = 2] = "Component";
|
---|
238 | ProviderAstType[ProviderAstType["Directive"] = 3] = "Directive";
|
---|
239 | ProviderAstType[ProviderAstType["Builtin"] = 4] = "Builtin";
|
---|
240 | })(ProviderAstType || (ProviderAstType = {}));
|
---|
241 | /**
|
---|
242 | * Position where content is to be projected (instance of `<ng-content>` in a template).
|
---|
243 | */
|
---|
244 | export class NgContentAst {
|
---|
245 | constructor(index, ngContentIndex, sourceSpan) {
|
---|
246 | this.index = index;
|
---|
247 | this.ngContentIndex = ngContentIndex;
|
---|
248 | this.sourceSpan = sourceSpan;
|
---|
249 | }
|
---|
250 | visit(visitor, context) {
|
---|
251 | return visitor.visitNgContent(this, context);
|
---|
252 | }
|
---|
253 | }
|
---|
254 | /**
|
---|
255 | * A visitor that accepts each node but doesn't do anything. It is intended to be used
|
---|
256 | * as the base class for a visitor that is only interested in a subset of the node types.
|
---|
257 | */
|
---|
258 | export class NullTemplateVisitor {
|
---|
259 | visitNgContent(ast, context) { }
|
---|
260 | visitEmbeddedTemplate(ast, context) { }
|
---|
261 | visitElement(ast, context) { }
|
---|
262 | visitReference(ast, context) { }
|
---|
263 | visitVariable(ast, context) { }
|
---|
264 | visitEvent(ast, context) { }
|
---|
265 | visitElementProperty(ast, context) { }
|
---|
266 | visitAttr(ast, context) { }
|
---|
267 | visitBoundText(ast, context) { }
|
---|
268 | visitText(ast, context) { }
|
---|
269 | visitDirective(ast, context) { }
|
---|
270 | visitDirectiveProperty(ast, context) { }
|
---|
271 | }
|
---|
272 | /**
|
---|
273 | * Base class that can be used to build a visitor that visits each node
|
---|
274 | * in an template ast recursively.
|
---|
275 | */
|
---|
276 | export class RecursiveTemplateAstVisitor extends NullTemplateVisitor {
|
---|
277 | constructor() {
|
---|
278 | super();
|
---|
279 | }
|
---|
280 | // Nodes with children
|
---|
281 | visitEmbeddedTemplate(ast, context) {
|
---|
282 | return this.visitChildren(context, visit => {
|
---|
283 | visit(ast.attrs);
|
---|
284 | visit(ast.references);
|
---|
285 | visit(ast.variables);
|
---|
286 | visit(ast.directives);
|
---|
287 | visit(ast.providers);
|
---|
288 | visit(ast.children);
|
---|
289 | });
|
---|
290 | }
|
---|
291 | visitElement(ast, context) {
|
---|
292 | return this.visitChildren(context, visit => {
|
---|
293 | visit(ast.attrs);
|
---|
294 | visit(ast.inputs);
|
---|
295 | visit(ast.outputs);
|
---|
296 | visit(ast.references);
|
---|
297 | visit(ast.directives);
|
---|
298 | visit(ast.providers);
|
---|
299 | visit(ast.children);
|
---|
300 | });
|
---|
301 | }
|
---|
302 | visitDirective(ast, context) {
|
---|
303 | return this.visitChildren(context, visit => {
|
---|
304 | visit(ast.inputs);
|
---|
305 | visit(ast.hostProperties);
|
---|
306 | visit(ast.hostEvents);
|
---|
307 | });
|
---|
308 | }
|
---|
309 | visitChildren(context, cb) {
|
---|
310 | let results = [];
|
---|
311 | let t = this;
|
---|
312 | function visit(children) {
|
---|
313 | if (children && children.length)
|
---|
314 | results.push(templateVisitAll(t, children, context));
|
---|
315 | }
|
---|
316 | cb(visit);
|
---|
317 | return Array.prototype.concat.apply([], results);
|
---|
318 | }
|
---|
319 | }
|
---|
320 | /**
|
---|
321 | * Visit every node in a list of {@link TemplateAst}s with the given {@link TemplateAstVisitor}.
|
---|
322 | */
|
---|
323 | export function templateVisitAll(visitor, asts, context = null) {
|
---|
324 | const result = [];
|
---|
325 | const visit = visitor.visit ?
|
---|
326 | (ast) => visitor.visit(ast, context) || ast.visit(visitor, context) :
|
---|
327 | (ast) => ast.visit(visitor, context);
|
---|
328 | asts.forEach(ast => {
|
---|
329 | const astResult = visit(ast);
|
---|
330 | if (astResult) {
|
---|
331 | result.push(astResult);
|
---|
332 | }
|
---|
333 | });
|
---|
334 | return result;
|
---|
335 | }
|
---|
336 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVtcGxhdGVfYXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL3RlbXBsYXRlX3BhcnNlci90ZW1wbGF0ZV9hc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HO0FBMEJIOztHQUVHO0FBQ0gsTUFBTSxPQUFPLE9BQU87SUFDbEIsWUFDVyxLQUFhLEVBQVMsY0FBc0IsRUFBUyxVQUEyQjtRQUFoRixVQUFLLEdBQUwsS0FBSyxDQUFRO1FBQVMsbUJBQWMsR0FBZCxjQUFjLENBQVE7UUFBUyxlQUFVLEdBQVYsVUFBVSxDQUFpQjtJQUFHLENBQUM7SUFDL0YsS0FBSyxDQUFDLE9BQTJCLE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