source: trip-planner-front/node_modules/@angular/compiler/src/render3/view/compiler.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 111.2 KB
Line 
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(function (factory) {
9 if (typeof module === "object" && typeof module.exports === "object") {
10 var v = factory(require, exports);
11 if (v !== undefined) module.exports = v;
12 }
13 else if (typeof define === "function" && define.amd) {
14 define("@angular/compiler/src/render3/view/compiler", ["require", "exports", "tslib", "@angular/compiler/src/compiler_util/expression_converter", "@angular/compiler/src/core", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/parse_util", "@angular/compiler/src/selector", "@angular/compiler/src/shadow_css", "@angular/compiler/src/style_compiler", "@angular/compiler/src/util", "@angular/compiler/src/render3/r3_ast", "@angular/compiler/src/render3/r3_identifiers", "@angular/compiler/src/render3/util", "@angular/compiler/src/render3/view/styling_builder", "@angular/compiler/src/render3/view/template", "@angular/compiler/src/render3/view/util"], factory);
15 }
16})(function (require, exports) {
17 "use strict";
18 Object.defineProperty(exports, "__esModule", { value: true });
19 exports.verifyHostBindings = exports.parseHostBindings = exports.createDirectiveType = exports.createDirectiveTypeParams = exports.createComponentType = exports.compileComponentFromMetadata = exports.compileDirectiveFromMetadata = void 0;
20 var tslib_1 = require("tslib");
21 var expression_converter_1 = require("@angular/compiler/src/compiler_util/expression_converter");
22 var core = require("@angular/compiler/src/core");
23 var o = require("@angular/compiler/src/output/output_ast");
24 var parse_util_1 = require("@angular/compiler/src/parse_util");
25 var selector_1 = require("@angular/compiler/src/selector");
26 var shadow_css_1 = require("@angular/compiler/src/shadow_css");
27 var style_compiler_1 = require("@angular/compiler/src/style_compiler");
28 var util_1 = require("@angular/compiler/src/util");
29 var r3_ast_1 = require("@angular/compiler/src/render3/r3_ast");
30 var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers");
31 var util_2 = require("@angular/compiler/src/render3/util");
32 var styling_builder_1 = require("@angular/compiler/src/render3/view/styling_builder");
33 var template_1 = require("@angular/compiler/src/render3/view/template");
34 var util_3 = require("@angular/compiler/src/render3/view/util");
35 // This regex matches any binding names that contain the "attr." prefix, e.g. "attr.required"
36 // If there is a match, the first matching group will contain the attribute name to bind.
37 var ATTR_REGEX = /attr\.([^\]]+)/;
38 function baseDirectiveFields(meta, constantPool, bindingParser) {
39 var definitionMap = new util_3.DefinitionMap();
40 var selectors = core.parseSelectorToR3Selector(meta.selector);
41 // e.g. `type: MyDirective`
42 definitionMap.set('type', meta.internalType);
43 // e.g. `selectors: [['', 'someDir', '']]`
44 if (selectors.length > 0) {
45 definitionMap.set('selectors', util_3.asLiteral(selectors));
46 }
47 if (meta.queries.length > 0) {
48 // e.g. `contentQueries: (rf, ctx, dirIndex) => { ... }
49 definitionMap.set('contentQueries', createContentQueriesFunction(meta.queries, constantPool, meta.name));
50 }
51 if (meta.viewQueries.length) {
52 definitionMap.set('viewQuery', createViewQueriesFunction(meta.viewQueries, constantPool, meta.name));
53 }
54 // e.g. `hostBindings: (rf, ctx) => { ... }
55 definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.selector || '', meta.name, definitionMap));
56 // e.g 'inputs: {a: 'a'}`
57 definitionMap.set('inputs', util_3.conditionallyCreateMapObjectLiteral(meta.inputs, true));
58 // e.g 'outputs: {a: 'a'}`
59 definitionMap.set('outputs', util_3.conditionallyCreateMapObjectLiteral(meta.outputs));
60 if (meta.exportAs !== null) {
61 definitionMap.set('exportAs', o.literalArr(meta.exportAs.map(function (e) { return o.literal(e); })));
62 }
63 return definitionMap;
64 }
65 /**
66 * Add features to the definition map.
67 */
68 function addFeatures(definitionMap, meta) {
69 // e.g. `features: [NgOnChangesFeature]`
70 var features = [];
71 var providers = meta.providers;
72 var viewProviders = meta.viewProviders;
73 if (providers || viewProviders) {
74 var args = [providers || new o.LiteralArrayExpr([])];
75 if (viewProviders) {
76 args.push(viewProviders);
77 }
78 features.push(o.importExpr(r3_identifiers_1.Identifiers.ProvidersFeature).callFn(args));
79 }
80 if (meta.usesInheritance) {
81 features.push(o.importExpr(r3_identifiers_1.Identifiers.InheritDefinitionFeature));
82 }
83 if (meta.fullInheritance) {
84 features.push(o.importExpr(r3_identifiers_1.Identifiers.CopyDefinitionFeature));
85 }
86 if (meta.lifecycle.usesOnChanges) {
87 features.push(o.importExpr(r3_identifiers_1.Identifiers.NgOnChangesFeature));
88 }
89 if (features.length) {
90 definitionMap.set('features', o.literalArr(features));
91 }
92 }
93 /**
94 * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
95 */
96 function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
97 var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
98 addFeatures(definitionMap, meta);
99 var expression = o.importExpr(r3_identifiers_1.Identifiers.defineDirective).callFn([definitionMap.toLiteralMap()], undefined, true);
100 var type = createDirectiveType(meta);
101 return { expression: expression, type: type, statements: [] };
102 }
103 exports.compileDirectiveFromMetadata = compileDirectiveFromMetadata;
104 /**
105 * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
106 */
107 function compileComponentFromMetadata(meta, constantPool, bindingParser) {
108 var e_1, _a;
109 var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
110 addFeatures(definitionMap, meta);
111 var selector = meta.selector && selector_1.CssSelector.parse(meta.selector);
112 var firstSelector = selector && selector[0];
113 // e.g. `attr: ["class", ".my.app"]`
114 // This is optional an only included if the first selector of a component specifies attributes.
115 if (firstSelector) {
116 var selectorAttributes = firstSelector.getAttrs();
117 if (selectorAttributes.length) {
118 definitionMap.set('attrs', constantPool.getConstLiteral(o.literalArr(selectorAttributes.map(function (value) { return value != null ? o.literal(value) : o.literal(undefined); })),
119 /* forceShared */ true));
120 }
121 }
122 // Generate the CSS matcher that recognize directive
123 var directiveMatcher = null;
124 if (meta.directives.length > 0) {
125 var matcher = new selector_1.SelectorMatcher();
126 try {
127 for (var _b = tslib_1.__values(meta.directives), _c = _b.next(); !_c.done; _c = _b.next()) {
128 var _d = _c.value, selector_2 = _d.selector, type_1 = _d.type;
129 matcher.addSelectables(selector_1.CssSelector.parse(selector_2), type_1);
130 }
131 }
132 catch (e_1_1) { e_1 = { error: e_1_1 }; }
133 finally {
134 try {
135 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
136 }
137 finally { if (e_1) throw e_1.error; }
138 }
139 directiveMatcher = matcher;
140 }
141 // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`
142 var templateTypeName = meta.name;
143 var templateName = templateTypeName ? templateTypeName + "_Template" : null;
144 var directivesUsed = new Set();
145 var pipesUsed = new Set();
146 var changeDetection = meta.changeDetection;
147 var template = meta.template;
148 var templateBuilder = new template_1.TemplateDefinitionBuilder(constantPool, template_1.BindingScope.createRootScope(), 0, templateTypeName, null, null, templateName, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, r3_identifiers_1.Identifiers.namespaceHTML, meta.relativeContextFilePath, meta.i18nUseExternalIds);
149 var templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []);
150 // We need to provide this so that dynamically generated components know what
151 // projected content blocks to pass through to the component when it is instantiated.
152 var ngContentSelectors = templateBuilder.getNgContentSelectors();
153 if (ngContentSelectors) {
154 definitionMap.set('ngContentSelectors', ngContentSelectors);
155 }
156 // e.g. `decls: 2`
157 definitionMap.set('decls', o.literal(templateBuilder.getConstCount()));
158 // e.g. `vars: 2`
159 definitionMap.set('vars', o.literal(templateBuilder.getVarCount()));
160 // Generate `consts` section of ComponentDef:
161 // - either as an array:
162 // `consts: [['one', 'two'], ['three', 'four']]`
163 // - or as a factory function in case additional statements are present (to support i18n):
164 // `consts: function() { var i18n_0; if (ngI18nClosureMode) {...} else {...} return [i18n_0]; }`
165 var _e = templateBuilder.getConsts(), constExpressions = _e.constExpressions, prepareStatements = _e.prepareStatements;
166 if (constExpressions.length > 0) {
167 var constsExpr = o.literalArr(constExpressions);
168 // Prepare statements are present - turn `consts` into a function.
169 if (prepareStatements.length > 0) {
170 constsExpr = o.fn([], tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(prepareStatements)), [new o.ReturnStatement(constsExpr)]));
171 }
172 definitionMap.set('consts', constsExpr);
173 }
174 definitionMap.set('template', templateFunctionExpression);
175 // e.g. `directives: [MyDirective]`
176 if (directivesUsed.size) {
177 var directivesList = o.literalArr(Array.from(directivesUsed));
178 var directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
179 definitionMap.set('directives', directivesExpr);
180 }
181 // e.g. `pipes: [MyPipe]`
182 if (pipesUsed.size) {
183 var pipesList = o.literalArr(Array.from(pipesUsed));
184 var pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
185 definitionMap.set('pipes', pipesExpr);
186 }
187 if (meta.encapsulation === null) {
188 meta.encapsulation = core.ViewEncapsulation.Emulated;
189 }
190 // e.g. `styles: [str1, str2]`
191 if (meta.styles && meta.styles.length) {
192 var styleValues = meta.encapsulation == core.ViewEncapsulation.Emulated ?
193 compileStyles(meta.styles, style_compiler_1.CONTENT_ATTR, style_compiler_1.HOST_ATTR) :
194 meta.styles;
195 var strings = styleValues.map(function (str) { return constantPool.getConstLiteral(o.literal(str)); });
196 definitionMap.set('styles', o.literalArr(strings));
197 }
198 else if (meta.encapsulation === core.ViewEncapsulation.Emulated) {
199 // If there is no style, don't generate css selectors on elements
200 meta.encapsulation = core.ViewEncapsulation.None;
201 }
202 // Only set view encapsulation if it's not the default value
203 if (meta.encapsulation !== core.ViewEncapsulation.Emulated) {
204 definitionMap.set('encapsulation', o.literal(meta.encapsulation));
205 }
206 // e.g. `animation: [trigger('123', [])]`
207 if (meta.animations !== null) {
208 definitionMap.set('data', o.literalMap([{ key: 'animation', value: meta.animations, quoted: false }]));
209 }
210 // Only set the change detection flag if it's defined and it's not the default.
211 if (changeDetection != null && changeDetection !== core.ChangeDetectionStrategy.Default) {
212 definitionMap.set('changeDetection', o.literal(changeDetection));
213 }
214 var expression = o.importExpr(r3_identifiers_1.Identifiers.defineComponent).callFn([definitionMap.toLiteralMap()], undefined, true);
215 var type = createComponentType(meta);
216 return { expression: expression, type: type, statements: [] };
217 }
218 exports.compileComponentFromMetadata = compileComponentFromMetadata;
219 /**
220 * Creates the type specification from the component meta. This type is inserted into .d.ts files
221 * to be consumed by upstream compilations.
222 */
223 function createComponentType(meta) {
224 var typeParams = createDirectiveTypeParams(meta);
225 typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
226 return o.expressionType(o.importExpr(r3_identifiers_1.Identifiers.ComponentDeclaration, typeParams));
227 }
228 exports.createComponentType = createComponentType;
229 /**
230 * Compiles the array literal of declarations into an expression according to the provided emit
231 * mode.
232 */
233 function compileDeclarationList(list, mode) {
234 switch (mode) {
235 case 0 /* Direct */:
236 // directives: [MyDir],
237 return list;
238 case 1 /* Closure */:
239 // directives: function () { return [MyDir]; }
240 return o.fn([], [new o.ReturnStatement(list)]);
241 case 2 /* ClosureResolved */:
242 // directives: function () { return [MyDir].map(ng.resolveForwardRef); }
243 var resolvedList = list.callMethod('map', [o.importExpr(r3_identifiers_1.Identifiers.resolveForwardRef)]);
244 return o.fn([], [new o.ReturnStatement(resolvedList)]);
245 }
246 }
247 function prepareQueryParams(query, constantPool) {
248 var parameters = [util_3.getQueryPredicate(query, constantPool), o.literal(toQueryFlags(query))];
249 if (query.read) {
250 parameters.push(query.read);
251 }
252 return parameters;
253 }
254 /**
255 * Translates query flags into `TQueryFlags` type in packages/core/src/render3/interfaces/query.ts
256 * @param query
257 */
258 function toQueryFlags(query) {
259 return (query.descendants ? 1 /* descendants */ : 0 /* none */) |
260 (query.static ? 2 /* isStatic */ : 0 /* none */) |
261 (query.emitDistinctChangesOnly ? 4 /* emitDistinctChangesOnly */ : 0 /* none */);
262 }
263 function convertAttributesToExpressions(attributes) {
264 var e_2, _a;
265 var values = [];
266 try {
267 for (var _b = tslib_1.__values(Object.getOwnPropertyNames(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
268 var key = _c.value;
269 var value = attributes[key];
270 values.push(o.literal(key), value);
271 }
272 }
273 catch (e_2_1) { e_2 = { error: e_2_1 }; }
274 finally {
275 try {
276 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
277 }
278 finally { if (e_2) throw e_2.error; }
279 }
280 return values;
281 }
282 // Define and update any content queries
283 function createContentQueriesFunction(queries, constantPool, name) {
284 var e_3, _a;
285 var createStatements = [];
286 var updateStatements = [];
287 var tempAllocator = util_3.temporaryAllocator(updateStatements, util_3.TEMPORARY_NAME);
288 try {
289 for (var queries_1 = tslib_1.__values(queries), queries_1_1 = queries_1.next(); !queries_1_1.done; queries_1_1 = queries_1.next()) {
290 var query = queries_1_1.value;
291 // creation, e.g. r3.contentQuery(dirIndex, somePredicate, true, null);
292 createStatements.push(o.importExpr(r3_identifiers_1.Identifiers.contentQuery)
293 .callFn(tslib_1.__spreadArray([o.variable('dirIndex')], tslib_1.__read(prepareQueryParams(query, constantPool))))
294 .toStmt());
295 // update, e.g. (r3.queryRefresh(tmp = r3.loadQuery()) && (ctx.someDir = tmp));
296 var temporary = tempAllocator();
297 var getQueryList = o.importExpr(r3_identifiers_1.Identifiers.loadQuery).callFn([]);
298 var refresh = o.importExpr(r3_identifiers_1.Identifiers.queryRefresh).callFn([temporary.set(getQueryList)]);
299 var updateDirective = o.variable(util_3.CONTEXT_NAME)
300 .prop(query.propertyName)
301 .set(query.first ? temporary.prop('first') : temporary);
302 updateStatements.push(refresh.and(updateDirective).toStmt());
303 }
304 }
305 catch (e_3_1) { e_3 = { error: e_3_1 }; }
306 finally {
307 try {
308 if (queries_1_1 && !queries_1_1.done && (_a = queries_1.return)) _a.call(queries_1);
309 }
310 finally { if (e_3) throw e_3.error; }
311 }
312 var contentQueriesFnName = name ? name + "_ContentQueries" : null;
313 return o.fn([
314 new o.FnParam(util_3.RENDER_FLAGS, o.NUMBER_TYPE), new o.FnParam(util_3.CONTEXT_NAME, null),
315 new o.FnParam('dirIndex', null)
316 ], [
317 template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements),
318 template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements)
319 ], o.INFERRED_TYPE, null, contentQueriesFnName);
320 }
321 function stringAsType(str) {
322 return o.expressionType(o.literal(str));
323 }
324 function stringMapAsType(map) {
325 var mapValues = Object.keys(map).map(function (key) {
326 var value = Array.isArray(map[key]) ? map[key][0] : map[key];
327 return {
328 key: key,
329 value: o.literal(value),
330 quoted: true,
331 };
332 });
333 return o.expressionType(o.literalMap(mapValues));
334 }
335 function stringArrayAsType(arr) {
336 return arr.length > 0 ? o.expressionType(o.literalArr(arr.map(function (value) { return o.literal(value); }))) :
337 o.NONE_TYPE;
338 }
339 function createDirectiveTypeParams(meta) {
340 // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
341 // string literal, which must be on one line.
342 var selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
343 return [
344 util_2.typeWithParameters(meta.type.type, meta.typeArgumentCount),
345 selectorForType !== null ? stringAsType(selectorForType) : o.NONE_TYPE,
346 meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : o.NONE_TYPE,
347 stringMapAsType(meta.inputs),
348 stringMapAsType(meta.outputs),
349 stringArrayAsType(meta.queries.map(function (q) { return q.propertyName; })),
350 ];
351 }
352 exports.createDirectiveTypeParams = createDirectiveTypeParams;
353 /**
354 * Creates the type specification from the directive meta. This type is inserted into .d.ts files
355 * to be consumed by upstream compilations.
356 */
357 function createDirectiveType(meta) {
358 var typeParams = createDirectiveTypeParams(meta);
359 return o.expressionType(o.importExpr(r3_identifiers_1.Identifiers.DirectiveDeclaration, typeParams));
360 }
361 exports.createDirectiveType = createDirectiveType;
362 // Define and update any view queries
363 function createViewQueriesFunction(viewQueries, constantPool, name) {
364 var createStatements = [];
365 var updateStatements = [];
366 var tempAllocator = util_3.temporaryAllocator(updateStatements, util_3.TEMPORARY_NAME);
367 viewQueries.forEach(function (query) {
368 // creation, e.g. r3.viewQuery(somePredicate, true);
369 var queryDefinition = o.importExpr(r3_identifiers_1.Identifiers.viewQuery).callFn(prepareQueryParams(query, constantPool));
370 createStatements.push(queryDefinition.toStmt());
371 // update, e.g. (r3.queryRefresh(tmp = r3.loadQuery()) && (ctx.someDir = tmp));
372 var temporary = tempAllocator();
373 var getQueryList = o.importExpr(r3_identifiers_1.Identifiers.loadQuery).callFn([]);
374 var refresh = o.importExpr(r3_identifiers_1.Identifiers.queryRefresh).callFn([temporary.set(getQueryList)]);
375 var updateDirective = o.variable(util_3.CONTEXT_NAME)
376 .prop(query.propertyName)
377 .set(query.first ? temporary.prop('first') : temporary);
378 updateStatements.push(refresh.and(updateDirective).toStmt());
379 });
380 var viewQueryFnName = name ? name + "_Query" : null;
381 return o.fn([new o.FnParam(util_3.RENDER_FLAGS, o.NUMBER_TYPE), new o.FnParam(util_3.CONTEXT_NAME, null)], [
382 template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements),
383 template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements)
384 ], o.INFERRED_TYPE, null, viewQueryFnName);
385 }
386 // Return a host binding function or null if one is not necessary.
387 function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindingParser, constantPool, selector, name, definitionMap) {
388 var bindingContext = o.variable(util_3.CONTEXT_NAME);
389 var styleBuilder = new styling_builder_1.StylingBuilder(bindingContext);
390 var _a = hostBindingsMetadata.specialAttributes, styleAttr = _a.styleAttr, classAttr = _a.classAttr;
391 if (styleAttr !== undefined) {
392 styleBuilder.registerStyleAttr(styleAttr);
393 }
394 if (classAttr !== undefined) {
395 styleBuilder.registerClassAttr(classAttr);
396 }
397 var createStatements = [];
398 var updateStatements = [];
399 var hostBindingSourceSpan = typeSourceSpan;
400 var directiveSummary = metadataAsSummary(hostBindingsMetadata);
401 // Calculate host event bindings
402 var eventBindings = bindingParser.createDirectiveHostEventAsts(directiveSummary, hostBindingSourceSpan);
403 if (eventBindings && eventBindings.length) {
404 var listeners = createHostListeners(eventBindings, name);
405 createStatements.push.apply(createStatements, tslib_1.__spreadArray([], tslib_1.__read(listeners)));
406 }
407 // Calculate the host property bindings
408 var bindings = bindingParser.createBoundHostProperties(directiveSummary, hostBindingSourceSpan);
409 var allOtherBindings = [];
410 // We need to calculate the total amount of binding slots required by
411 // all the instructions together before any value conversions happen.
412 // Value conversions may require additional slots for interpolation and
413 // bindings with pipes. These calculates happen after this block.
414 var totalHostVarsCount = 0;
415 bindings && bindings.forEach(function (binding) {
416 var stylingInputWasSet = styleBuilder.registerInputBasedOnName(binding.name, binding.expression, hostBindingSourceSpan);
417 if (stylingInputWasSet) {
418 totalHostVarsCount += styling_builder_1.MIN_STYLING_BINDING_SLOTS_REQUIRED;
419 }
420 else {
421 allOtherBindings.push(binding);
422 totalHostVarsCount++;
423 }
424 });
425 var valueConverter;
426 var getValueConverter = function () {
427 if (!valueConverter) {
428 var hostVarsCountFn = function (numSlots) {
429 var originalVarsCount = totalHostVarsCount;
430 totalHostVarsCount += numSlots;
431 return originalVarsCount;
432 };
433 valueConverter = new template_1.ValueConverter(constantPool, function () { return util_1.error('Unexpected node'); }, // new nodes are illegal here
434 hostVarsCountFn, function () { return util_1.error('Unexpected pipe'); }); // pipes are illegal here
435 }
436 return valueConverter;
437 };
438 var propertyBindings = [];
439 var attributeBindings = [];
440 var syntheticHostBindings = [];
441 allOtherBindings.forEach(function (binding) {
442 // resolve literal arrays and literal objects
443 var value = binding.expression.visit(getValueConverter());
444 var bindingExpr = bindingFn(bindingContext, value);
445 var _a = getBindingNameAndInstruction(binding), bindingName = _a.bindingName, instruction = _a.instruction, isAttribute = _a.isAttribute;
446 var securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute)
447 .filter(function (context) { return context !== core.SecurityContext.NONE; });
448 var sanitizerFn = null;
449 if (securityContexts.length) {
450 if (securityContexts.length === 2 &&
451 securityContexts.indexOf(core.SecurityContext.URL) > -1 &&
452 securityContexts.indexOf(core.SecurityContext.RESOURCE_URL) > -1) {
453 // Special case for some URL attributes (such as "src" and "href") that may be a part
454 // of different security contexts. In this case we use special sanitization function and
455 // select the actual sanitizer at runtime based on a tag name that is provided while
456 // invoking sanitization function.
457 sanitizerFn = o.importExpr(r3_identifiers_1.Identifiers.sanitizeUrlOrResourceUrl);
458 }
459 else {
460 sanitizerFn = template_1.resolveSanitizationFn(securityContexts[0], isAttribute);
461 }
462 }
463 var instructionParams = [o.literal(bindingName), bindingExpr.currValExpr];
464 if (sanitizerFn) {
465 instructionParams.push(sanitizerFn);
466 }
467 updateStatements.push.apply(updateStatements, tslib_1.__spreadArray([], tslib_1.__read(bindingExpr.stmts)));
468 if (instruction === r3_identifiers_1.Identifiers.hostProperty) {
469 propertyBindings.push(instructionParams);
470 }
471 else if (instruction === r3_identifiers_1.Identifiers.attribute) {
472 attributeBindings.push(instructionParams);
473 }
474 else if (instruction === r3_identifiers_1.Identifiers.syntheticHostProperty) {
475 syntheticHostBindings.push(instructionParams);
476 }
477 else {
478 updateStatements.push(o.importExpr(instruction).callFn(instructionParams).toStmt());
479 }
480 });
481 if (propertyBindings.length > 0) {
482 updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.hostProperty, propertyBindings).toStmt());
483 }
484 if (attributeBindings.length > 0) {
485 updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.attribute, attributeBindings).toStmt());
486 }
487 if (syntheticHostBindings.length > 0) {
488 updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.syntheticHostProperty, syntheticHostBindings).toStmt());
489 }
490 // since we're dealing with directives/components and both have hostBinding
491 // functions, we need to generate a special hostAttrs instruction that deals
492 // with both the assignment of styling as well as static attributes to the host
493 // element. The instruction below will instruct all initial styling (styling
494 // that is inside of a host binding within a directive/component) to be attached
495 // to the host element alongside any of the provided host attributes that were
496 // collected earlier.
497 var hostAttrs = convertAttributesToExpressions(hostBindingsMetadata.attributes);
498 styleBuilder.assignHostAttrs(hostAttrs, definitionMap);
499 if (styleBuilder.hasBindings) {
500 // finally each binding that was registered in the statement above will need to be added to
501 // the update block of a component/directive templateFn/hostBindingsFn so that the bindings
502 // are evaluated and updated for the element.
503 styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(function (instruction) {
504 if (instruction.calls.length > 0) {
505 var calls_1 = [];
506 instruction.calls.forEach(function (call) {
507 // we subtract a value of `1` here because the binding slot was already allocated
508 // at the top of this method when all the input bindings were counted.
509 totalHostVarsCount +=
510 Math.max(call.allocateBindingSlots - styling_builder_1.MIN_STYLING_BINDING_SLOTS_REQUIRED, 0);
511 calls_1.push(convertStylingCall(call, bindingContext, bindingFn));
512 });
513 updateStatements.push(util_3.chainedInstruction(instruction.reference, calls_1).toStmt());
514 }
515 });
516 }
517 if (totalHostVarsCount) {
518 definitionMap.set('hostVars', o.literal(totalHostVarsCount));
519 }
520 if (createStatements.length > 0 || updateStatements.length > 0) {
521 var hostBindingsFnName = name ? name + "_HostBindings" : null;
522 var statements = [];
523 if (createStatements.length > 0) {
524 statements.push(template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements));
525 }
526 if (updateStatements.length > 0) {
527 statements.push(template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements));
528 }
529 return o.fn([new o.FnParam(util_3.RENDER_FLAGS, o.NUMBER_TYPE), new o.FnParam(util_3.CONTEXT_NAME, null)], statements, o.INFERRED_TYPE, null, hostBindingsFnName);
530 }
531 return null;
532 }
533 function bindingFn(implicit, value) {
534 return expression_converter_1.convertPropertyBinding(null, implicit, value, 'b', expression_converter_1.BindingForm.Expression, function () { return util_1.error('Unexpected interpolation'); });
535 }
536 function convertStylingCall(call, bindingContext, bindingFn) {
537 return call.params(function (value) { return bindingFn(bindingContext, value).currValExpr; });
538 }
539 function getBindingNameAndInstruction(binding) {
540 var bindingName = binding.name;
541 var instruction;
542 // Check to see if this is an attr binding or a property binding
543 var attrMatches = bindingName.match(ATTR_REGEX);
544 if (attrMatches) {
545 bindingName = attrMatches[1];
546 instruction = r3_identifiers_1.Identifiers.attribute;
547 }
548 else {
549 if (binding.isAnimation) {
550 bindingName = util_2.prepareSyntheticPropertyName(bindingName);
551 // host bindings that have a synthetic property (e.g. @foo) should always be rendered
552 // in the context of the component and not the parent. Therefore there is a special
553 // compatibility instruction available for this purpose.
554 instruction = r3_identifiers_1.Identifiers.syntheticHostProperty;
555 }
556 else {
557 instruction = r3_identifiers_1.Identifiers.hostProperty;
558 }
559 }
560 return { bindingName: bindingName, instruction: instruction, isAttribute: !!attrMatches };
561 }
562 function createHostListeners(eventBindings, name) {
563 var listeners = [];
564 var syntheticListeners = [];
565 var instructions = [];
566 eventBindings.forEach(function (binding) {
567 var bindingName = binding.name && parse_util_1.sanitizeIdentifier(binding.name);
568 var bindingFnName = binding.type === 1 /* Animation */ ?
569 util_2.prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
570 bindingName;
571 var handlerName = name && bindingName ? name + "_" + bindingFnName + "_HostBindingHandler" : null;
572 var params = template_1.prepareEventListenerParameters(r3_ast_1.BoundEvent.fromParsedEvent(binding), handlerName);
573 if (binding.type == 1 /* Animation */) {
574 syntheticListeners.push(params);
575 }
576 else {
577 listeners.push(params);
578 }
579 });
580 if (syntheticListeners.length > 0) {
581 instructions.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.syntheticHostListener, syntheticListeners).toStmt());
582 }
583 if (listeners.length > 0) {
584 instructions.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.listener, listeners).toStmt());
585 }
586 return instructions;
587 }
588 function metadataAsSummary(meta) {
589 // clang-format off
590 return {
591 // This is used by the BindingParser, which only deals with listeners and properties. There's no
592 // need to pass attributes to it.
593 hostAttributes: {},
594 hostListeners: meta.listeners,
595 hostProperties: meta.properties,
596 };
597 // clang-format on
598 }
599 var HOST_REG_EXP = /^(?:\[([^\]]+)\])|(?:\(([^\)]+)\))$/;
600 function parseHostBindings(host) {
601 var e_4, _a;
602 var attributes = {};
603 var listeners = {};
604 var properties = {};
605 var specialAttributes = {};
606 try {
607 for (var _b = tslib_1.__values(Object.keys(host)), _c = _b.next(); !_c.done; _c = _b.next()) {
608 var key = _c.value;
609 var value = host[key];
610 var matches = key.match(HOST_REG_EXP);
611 if (matches === null) {
612 switch (key) {
613 case 'class':
614 if (typeof value !== 'string') {
615 // TODO(alxhub): make this a diagnostic.
616 throw new Error("Class binding must be string");
617 }
618 specialAttributes.classAttr = value;
619 break;
620 case 'style':
621 if (typeof value !== 'string') {
622 // TODO(alxhub): make this a diagnostic.
623 throw new Error("Style binding must be string");
624 }
625 specialAttributes.styleAttr = value;
626 break;
627 default:
628 if (typeof value === 'string') {
629 attributes[key] = o.literal(value);
630 }
631 else {
632 attributes[key] = value;
633 }
634 }
635 }
636 else if (matches[1 /* Binding */] != null) {
637 if (typeof value !== 'string') {
638 // TODO(alxhub): make this a diagnostic.
639 throw new Error("Property binding must be string");
640 }
641 // synthetic properties (the ones that have a `@` as a prefix)
642 // are still treated the same as regular properties. Therefore
643 // there is no point in storing them in a separate map.
644 properties[matches[1 /* Binding */]] = value;
645 }
646 else if (matches[2 /* Event */] != null) {
647 if (typeof value !== 'string') {
648 // TODO(alxhub): make this a diagnostic.
649 throw new Error("Event binding must be string");
650 }
651 listeners[matches[2 /* Event */]] = value;
652 }
653 }
654 }
655 catch (e_4_1) { e_4 = { error: e_4_1 }; }
656 finally {
657 try {
658 if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
659 }
660 finally { if (e_4) throw e_4.error; }
661 }
662 return { attributes: attributes, listeners: listeners, properties: properties, specialAttributes: specialAttributes };
663 }
664 exports.parseHostBindings = parseHostBindings;
665 /**
666 * Verifies host bindings and returns the list of errors (if any). Empty array indicates that a
667 * given set of host bindings has no errors.
668 *
669 * @param bindings set of host bindings to verify.
670 * @param sourceSpan source span where host bindings were defined.
671 * @returns array of errors associated with a given set of host bindings.
672 */
673 function verifyHostBindings(bindings, sourceSpan) {
674 var summary = metadataAsSummary(bindings);
675 // TODO: abstract out host bindings verification logic and use it instead of
676 // creating events and properties ASTs to detect errors (FW-996)
677 var bindingParser = template_1.makeBindingParser();
678 bindingParser.createDirectiveHostEventAsts(summary, sourceSpan);
679 bindingParser.createBoundHostProperties(summary, sourceSpan);
680 return bindingParser.errors;
681 }
682 exports.verifyHostBindings = verifyHostBindings;
683 function compileStyles(styles, selector, hostSelector) {
684 var shadowCss = new shadow_css_1.ShadowCss();
685 return styles.map(function (style) {
686 return shadowCss.shimCssText(style, selector, hostSelector);
687 });
688 }
689});
690//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvcmVuZGVyMy92aWV3L2NvbXBpbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFHSCxpR0FBNkY7SUFFN0YsaURBQW1DO0lBRW5DLDJEQUE2QztJQUM3QywrREFBaUY7SUFDakYsMkRBQTREO0lBQzVELCtEQUEyQztJQUMzQyx1RUFBNkQ7SUFFN0QsbURBQWlDO0lBQ2pDLCtEQUFxQztJQUNyQywrRUFBb0Q7SUFDcEQsMkRBQXFJO0lBR3JJLHNGQUE2RztJQUM3Ryx3RUFBb0w7SUFDcEwsZ0VBQTRMO0lBRzVMLDZGQUE2RjtJQUM3Rix5RkFBeUY7SUFDekYsSUFBTSxVQUFVLEdBQUcsZ0JBQWdCLENBQUM7SUFFcEMsU0FBUyxtQkFBbUIsQ0FDeEIsSUFBeUIsRUFBRSxZQUEwQixFQUNyRCxhQUE0QjtRQUM5QixJQUFNLGFBQWEsR0FBRyxJQUFJLG9CQUFhLEVBQUUsQ0FBQztRQUMxQyxJQUFNLF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