/** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ (function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { 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); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.verifyHostBindings = exports.parseHostBindings = exports.createDirectiveType = exports.createDirectiveTypeParams = exports.createComponentType = exports.compileComponentFromMetadata = exports.compileDirectiveFromMetadata = void 0; var tslib_1 = require("tslib"); var expression_converter_1 = require("@angular/compiler/src/compiler_util/expression_converter"); var core = require("@angular/compiler/src/core"); var o = require("@angular/compiler/src/output/output_ast"); var parse_util_1 = require("@angular/compiler/src/parse_util"); var selector_1 = require("@angular/compiler/src/selector"); var shadow_css_1 = require("@angular/compiler/src/shadow_css"); var style_compiler_1 = require("@angular/compiler/src/style_compiler"); var util_1 = require("@angular/compiler/src/util"); var r3_ast_1 = require("@angular/compiler/src/render3/r3_ast"); var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers"); var util_2 = require("@angular/compiler/src/render3/util"); var styling_builder_1 = require("@angular/compiler/src/render3/view/styling_builder"); var template_1 = require("@angular/compiler/src/render3/view/template"); var util_3 = require("@angular/compiler/src/render3/view/util"); // This regex matches any binding names that contain the "attr." prefix, e.g. "attr.required" // If there is a match, the first matching group will contain the attribute name to bind. var ATTR_REGEX = /attr\.([^\]]+)/; function baseDirectiveFields(meta, constantPool, bindingParser) { var definitionMap = new util_3.DefinitionMap(); var selectors = core.parseSelectorToR3Selector(meta.selector); // e.g. `type: MyDirective` definitionMap.set('type', meta.internalType); // e.g. `selectors: [['', 'someDir', '']]` if (selectors.length > 0) { definitionMap.set('selectors', util_3.asLiteral(selectors)); } if (meta.queries.length > 0) { // e.g. `contentQueries: (rf, ctx, dirIndex) => { ... } definitionMap.set('contentQueries', createContentQueriesFunction(meta.queries, constantPool, meta.name)); } if (meta.viewQueries.length) { definitionMap.set('viewQuery', createViewQueriesFunction(meta.viewQueries, constantPool, meta.name)); } // e.g. `hostBindings: (rf, ctx) => { ... } definitionMap.set('hostBindings', createHostBindingsFunction(meta.host, meta.typeSourceSpan, bindingParser, constantPool, meta.selector || '', meta.name, definitionMap)); // e.g 'inputs: {a: 'a'}` definitionMap.set('inputs', util_3.conditionallyCreateMapObjectLiteral(meta.inputs, true)); // e.g 'outputs: {a: 'a'}` definitionMap.set('outputs', util_3.conditionallyCreateMapObjectLiteral(meta.outputs)); if (meta.exportAs !== null) { definitionMap.set('exportAs', o.literalArr(meta.exportAs.map(function (e) { return o.literal(e); }))); } return definitionMap; } /** * Add features to the definition map. */ function addFeatures(definitionMap, meta) { // e.g. `features: [NgOnChangesFeature]` var features = []; var providers = meta.providers; var viewProviders = meta.viewProviders; if (providers || viewProviders) { var args = [providers || new o.LiteralArrayExpr([])]; if (viewProviders) { args.push(viewProviders); } features.push(o.importExpr(r3_identifiers_1.Identifiers.ProvidersFeature).callFn(args)); } if (meta.usesInheritance) { features.push(o.importExpr(r3_identifiers_1.Identifiers.InheritDefinitionFeature)); } if (meta.fullInheritance) { features.push(o.importExpr(r3_identifiers_1.Identifiers.CopyDefinitionFeature)); } if (meta.lifecycle.usesOnChanges) { features.push(o.importExpr(r3_identifiers_1.Identifiers.NgOnChangesFeature)); } if (features.length) { definitionMap.set('features', o.literalArr(features)); } } /** * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`. */ function compileDirectiveFromMetadata(meta, constantPool, bindingParser) { var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser); addFeatures(definitionMap, meta); var expression = o.importExpr(r3_identifiers_1.Identifiers.defineDirective).callFn([definitionMap.toLiteralMap()], undefined, true); var type = createDirectiveType(meta); return { expression: expression, type: type, statements: [] }; } exports.compileDirectiveFromMetadata = compileDirectiveFromMetadata; /** * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`. */ function compileComponentFromMetadata(meta, constantPool, bindingParser) { var e_1, _a; var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser); addFeatures(definitionMap, meta); var selector = meta.selector && selector_1.CssSelector.parse(meta.selector); var firstSelector = selector && selector[0]; // e.g. `attr: ["class", ".my.app"]` // This is optional an only included if the first selector of a component specifies attributes. if (firstSelector) { var selectorAttributes = firstSelector.getAttrs(); if (selectorAttributes.length) { definitionMap.set('attrs', constantPool.getConstLiteral(o.literalArr(selectorAttributes.map(function (value) { return value != null ? o.literal(value) : o.literal(undefined); })), /* forceShared */ true)); } } // Generate the CSS matcher that recognize directive var directiveMatcher = null; if (meta.directives.length > 0) { var matcher = new selector_1.SelectorMatcher(); try { for (var _b = tslib_1.__values(meta.directives), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = _c.value, selector_2 = _d.selector, type_1 = _d.type; matcher.addSelectables(selector_1.CssSelector.parse(selector_2), type_1); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } directiveMatcher = matcher; } // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}` var templateTypeName = meta.name; var templateName = templateTypeName ? templateTypeName + "_Template" : null; var directivesUsed = new Set(); var pipesUsed = new Set(); var changeDetection = meta.changeDetection; var template = meta.template; 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); var templateFunctionExpression = templateBuilder.buildTemplateFunction(template.nodes, []); // We need to provide this so that dynamically generated components know what // projected content blocks to pass through to the component when it is instantiated. var ngContentSelectors = templateBuilder.getNgContentSelectors(); if (ngContentSelectors) { definitionMap.set('ngContentSelectors', ngContentSelectors); } // e.g. `decls: 2` definitionMap.set('decls', o.literal(templateBuilder.getConstCount())); // e.g. `vars: 2` definitionMap.set('vars', o.literal(templateBuilder.getVarCount())); // Generate `consts` section of ComponentDef: // - either as an array: // `consts: [['one', 'two'], ['three', 'four']]` // - or as a factory function in case additional statements are present (to support i18n): // `consts: function() { var i18n_0; if (ngI18nClosureMode) {...} else {...} return [i18n_0]; }` var _e = templateBuilder.getConsts(), constExpressions = _e.constExpressions, prepareStatements = _e.prepareStatements; if (constExpressions.length > 0) { var constsExpr = o.literalArr(constExpressions); // Prepare statements are present - turn `consts` into a function. if (prepareStatements.length > 0) { constsExpr = o.fn([], tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(prepareStatements)), [new o.ReturnStatement(constsExpr)])); } definitionMap.set('consts', constsExpr); } definitionMap.set('template', templateFunctionExpression); // e.g. `directives: [MyDirective]` if (directivesUsed.size) { var directivesList = o.literalArr(Array.from(directivesUsed)); var directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode); definitionMap.set('directives', directivesExpr); } // e.g. `pipes: [MyPipe]` if (pipesUsed.size) { var pipesList = o.literalArr(Array.from(pipesUsed)); var pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode); definitionMap.set('pipes', pipesExpr); } if (meta.encapsulation === null) { meta.encapsulation = core.ViewEncapsulation.Emulated; } // e.g. `styles: [str1, str2]` if (meta.styles && meta.styles.length) { var styleValues = meta.encapsulation == core.ViewEncapsulation.Emulated ? compileStyles(meta.styles, style_compiler_1.CONTENT_ATTR, style_compiler_1.HOST_ATTR) : meta.styles; var strings = styleValues.map(function (str) { return constantPool.getConstLiteral(o.literal(str)); }); definitionMap.set('styles', o.literalArr(strings)); } else if (meta.encapsulation === core.ViewEncapsulation.Emulated) { // If there is no style, don't generate css selectors on elements meta.encapsulation = core.ViewEncapsulation.None; } // Only set view encapsulation if it's not the default value if (meta.encapsulation !== core.ViewEncapsulation.Emulated) { definitionMap.set('encapsulation', o.literal(meta.encapsulation)); } // e.g. `animation: [trigger('123', [])]` if (meta.animations !== null) { definitionMap.set('data', o.literalMap([{ key: 'animation', value: meta.animations, quoted: false }])); } // Only set the change detection flag if it's defined and it's not the default. if (changeDetection != null && changeDetection !== core.ChangeDetectionStrategy.Default) { definitionMap.set('changeDetection', o.literal(changeDetection)); } var expression = o.importExpr(r3_identifiers_1.Identifiers.defineComponent).callFn([definitionMap.toLiteralMap()], undefined, true); var type = createComponentType(meta); return { expression: expression, type: type, statements: [] }; } exports.compileComponentFromMetadata = compileComponentFromMetadata; /** * Creates the type specification from the component meta. This type is inserted into .d.ts files * to be consumed by upstream compilations. */ function createComponentType(meta) { var typeParams = createDirectiveTypeParams(meta); typeParams.push(stringArrayAsType(meta.template.ngContentSelectors)); return o.expressionType(o.importExpr(r3_identifiers_1.Identifiers.ComponentDeclaration, typeParams)); } exports.createComponentType = createComponentType; /** * Compiles the array literal of declarations into an expression according to the provided emit * mode. */ function compileDeclarationList(list, mode) { switch (mode) { case 0 /* Direct */: // directives: [MyDir], return list; case 1 /* Closure */: // directives: function () { return [MyDir]; } return o.fn([], [new o.ReturnStatement(list)]); case 2 /* ClosureResolved */: // directives: function () { return [MyDir].map(ng.resolveForwardRef); } var resolvedList = list.callMethod('map', [o.importExpr(r3_identifiers_1.Identifiers.resolveForwardRef)]); return o.fn([], [new o.ReturnStatement(resolvedList)]); } } function prepareQueryParams(query, constantPool) { var parameters = [util_3.getQueryPredicate(query, constantPool), o.literal(toQueryFlags(query))]; if (query.read) { parameters.push(query.read); } return parameters; } /** * Translates query flags into `TQueryFlags` type in packages/core/src/render3/interfaces/query.ts * @param query */ function toQueryFlags(query) { return (query.descendants ? 1 /* descendants */ : 0 /* none */) | (query.static ? 2 /* isStatic */ : 0 /* none */) | (query.emitDistinctChangesOnly ? 4 /* emitDistinctChangesOnly */ : 0 /* none */); } function convertAttributesToExpressions(attributes) { var e_2, _a; var values = []; try { for (var _b = tslib_1.__values(Object.getOwnPropertyNames(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) { var key = _c.value; var value = attributes[key]; values.push(o.literal(key), value); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_2) throw e_2.error; } } return values; } // Define and update any content queries function createContentQueriesFunction(queries, constantPool, name) { var e_3, _a; var createStatements = []; var updateStatements = []; var tempAllocator = util_3.temporaryAllocator(updateStatements, util_3.TEMPORARY_NAME); try { for (var queries_1 = tslib_1.__values(queries), queries_1_1 = queries_1.next(); !queries_1_1.done; queries_1_1 = queries_1.next()) { var query = queries_1_1.value; // creation, e.g. r3.contentQuery(dirIndex, somePredicate, true, null); createStatements.push(o.importExpr(r3_identifiers_1.Identifiers.contentQuery) .callFn(tslib_1.__spreadArray([o.variable('dirIndex')], tslib_1.__read(prepareQueryParams(query, constantPool)))) .toStmt()); // update, e.g. (r3.queryRefresh(tmp = r3.loadQuery()) && (ctx.someDir = tmp)); var temporary = tempAllocator(); var getQueryList = o.importExpr(r3_identifiers_1.Identifiers.loadQuery).callFn([]); var refresh = o.importExpr(r3_identifiers_1.Identifiers.queryRefresh).callFn([temporary.set(getQueryList)]); var updateDirective = o.variable(util_3.CONTEXT_NAME) .prop(query.propertyName) .set(query.first ? temporary.prop('first') : temporary); updateStatements.push(refresh.and(updateDirective).toStmt()); } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (queries_1_1 && !queries_1_1.done && (_a = queries_1.return)) _a.call(queries_1); } finally { if (e_3) throw e_3.error; } } var contentQueriesFnName = name ? name + "_ContentQueries" : null; return o.fn([ new o.FnParam(util_3.RENDER_FLAGS, o.NUMBER_TYPE), new o.FnParam(util_3.CONTEXT_NAME, null), new o.FnParam('dirIndex', null) ], [ template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements), template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements) ], o.INFERRED_TYPE, null, contentQueriesFnName); } function stringAsType(str) { return o.expressionType(o.literal(str)); } function stringMapAsType(map) { var mapValues = Object.keys(map).map(function (key) { var value = Array.isArray(map[key]) ? map[key][0] : map[key]; return { key: key, value: o.literal(value), quoted: true, }; }); return o.expressionType(o.literalMap(mapValues)); } function stringArrayAsType(arr) { return arr.length > 0 ? o.expressionType(o.literalArr(arr.map(function (value) { return o.literal(value); }))) : o.NONE_TYPE; } function createDirectiveTypeParams(meta) { // On the type side, remove newlines from the selector as it will need to fit into a TypeScript // string literal, which must be on one line. var selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null; return [ util_2.typeWithParameters(meta.type.type, meta.typeArgumentCount), selectorForType !== null ? stringAsType(selectorForType) : o.NONE_TYPE, meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : o.NONE_TYPE, stringMapAsType(meta.inputs), stringMapAsType(meta.outputs), stringArrayAsType(meta.queries.map(function (q) { return q.propertyName; })), ]; } exports.createDirectiveTypeParams = createDirectiveTypeParams; /** * Creates the type specification from the directive meta. This type is inserted into .d.ts files * to be consumed by upstream compilations. */ function createDirectiveType(meta) { var typeParams = createDirectiveTypeParams(meta); return o.expressionType(o.importExpr(r3_identifiers_1.Identifiers.DirectiveDeclaration, typeParams)); } exports.createDirectiveType = createDirectiveType; // Define and update any view queries function createViewQueriesFunction(viewQueries, constantPool, name) { var createStatements = []; var updateStatements = []; var tempAllocator = util_3.temporaryAllocator(updateStatements, util_3.TEMPORARY_NAME); viewQueries.forEach(function (query) { // creation, e.g. r3.viewQuery(somePredicate, true); var queryDefinition = o.importExpr(r3_identifiers_1.Identifiers.viewQuery).callFn(prepareQueryParams(query, constantPool)); createStatements.push(queryDefinition.toStmt()); // update, e.g. (r3.queryRefresh(tmp = r3.loadQuery()) && (ctx.someDir = tmp)); var temporary = tempAllocator(); var getQueryList = o.importExpr(r3_identifiers_1.Identifiers.loadQuery).callFn([]); var refresh = o.importExpr(r3_identifiers_1.Identifiers.queryRefresh).callFn([temporary.set(getQueryList)]); var updateDirective = o.variable(util_3.CONTEXT_NAME) .prop(query.propertyName) .set(query.first ? temporary.prop('first') : temporary); updateStatements.push(refresh.and(updateDirective).toStmt()); }); var viewQueryFnName = name ? name + "_Query" : null; return o.fn([new o.FnParam(util_3.RENDER_FLAGS, o.NUMBER_TYPE), new o.FnParam(util_3.CONTEXT_NAME, null)], [ template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements), template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements) ], o.INFERRED_TYPE, null, viewQueryFnName); } // Return a host binding function or null if one is not necessary. function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindingParser, constantPool, selector, name, definitionMap) { var bindingContext = o.variable(util_3.CONTEXT_NAME); var styleBuilder = new styling_builder_1.StylingBuilder(bindingContext); var _a = hostBindingsMetadata.specialAttributes, styleAttr = _a.styleAttr, classAttr = _a.classAttr; if (styleAttr !== undefined) { styleBuilder.registerStyleAttr(styleAttr); } if (classAttr !== undefined) { styleBuilder.registerClassAttr(classAttr); } var createStatements = []; var updateStatements = []; var hostBindingSourceSpan = typeSourceSpan; var directiveSummary = metadataAsSummary(hostBindingsMetadata); // Calculate host event bindings var eventBindings = bindingParser.createDirectiveHostEventAsts(directiveSummary, hostBindingSourceSpan); if (eventBindings && eventBindings.length) { var listeners = createHostListeners(eventBindings, name); createStatements.push.apply(createStatements, tslib_1.__spreadArray([], tslib_1.__read(listeners))); } // Calculate the host property bindings var bindings = bindingParser.createBoundHostProperties(directiveSummary, hostBindingSourceSpan); var allOtherBindings = []; // We need to calculate the total amount of binding slots required by // all the instructions together before any value conversions happen. // Value conversions may require additional slots for interpolation and // bindings with pipes. These calculates happen after this block. var totalHostVarsCount = 0; bindings && bindings.forEach(function (binding) { var stylingInputWasSet = styleBuilder.registerInputBasedOnName(binding.name, binding.expression, hostBindingSourceSpan); if (stylingInputWasSet) { totalHostVarsCount += styling_builder_1.MIN_STYLING_BINDING_SLOTS_REQUIRED; } else { allOtherBindings.push(binding); totalHostVarsCount++; } }); var valueConverter; var getValueConverter = function () { if (!valueConverter) { var hostVarsCountFn = function (numSlots) { var originalVarsCount = totalHostVarsCount; totalHostVarsCount += numSlots; return originalVarsCount; }; valueConverter = new template_1.ValueConverter(constantPool, function () { return util_1.error('Unexpected node'); }, // new nodes are illegal here hostVarsCountFn, function () { return util_1.error('Unexpected pipe'); }); // pipes are illegal here } return valueConverter; }; var propertyBindings = []; var attributeBindings = []; var syntheticHostBindings = []; allOtherBindings.forEach(function (binding) { // resolve literal arrays and literal objects var value = binding.expression.visit(getValueConverter()); var bindingExpr = bindingFn(bindingContext, value); var _a = getBindingNameAndInstruction(binding), bindingName = _a.bindingName, instruction = _a.instruction, isAttribute = _a.isAttribute; var securityContexts = bindingParser.calcPossibleSecurityContexts(selector, bindingName, isAttribute) .filter(function (context) { return context !== core.SecurityContext.NONE; }); var sanitizerFn = null; if (securityContexts.length) { if (securityContexts.length === 2 && securityContexts.indexOf(core.SecurityContext.URL) > -1 && securityContexts.indexOf(core.SecurityContext.RESOURCE_URL) > -1) { // Special case for some URL attributes (such as "src" and "href") that may be a part // of different security contexts. In this case we use special sanitization function and // select the actual sanitizer at runtime based on a tag name that is provided while // invoking sanitization function. sanitizerFn = o.importExpr(r3_identifiers_1.Identifiers.sanitizeUrlOrResourceUrl); } else { sanitizerFn = template_1.resolveSanitizationFn(securityContexts[0], isAttribute); } } var instructionParams = [o.literal(bindingName), bindingExpr.currValExpr]; if (sanitizerFn) { instructionParams.push(sanitizerFn); } updateStatements.push.apply(updateStatements, tslib_1.__spreadArray([], tslib_1.__read(bindingExpr.stmts))); if (instruction === r3_identifiers_1.Identifiers.hostProperty) { propertyBindings.push(instructionParams); } else if (instruction === r3_identifiers_1.Identifiers.attribute) { attributeBindings.push(instructionParams); } else if (instruction === r3_identifiers_1.Identifiers.syntheticHostProperty) { syntheticHostBindings.push(instructionParams); } else { updateStatements.push(o.importExpr(instruction).callFn(instructionParams).toStmt()); } }); if (propertyBindings.length > 0) { updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.hostProperty, propertyBindings).toStmt()); } if (attributeBindings.length > 0) { updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.attribute, attributeBindings).toStmt()); } if (syntheticHostBindings.length > 0) { updateStatements.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.syntheticHostProperty, syntheticHostBindings).toStmt()); } // since we're dealing with directives/components and both have hostBinding // functions, we need to generate a special hostAttrs instruction that deals // with both the assignment of styling as well as static attributes to the host // element. The instruction below will instruct all initial styling (styling // that is inside of a host binding within a directive/component) to be attached // to the host element alongside any of the provided host attributes that were // collected earlier. var hostAttrs = convertAttributesToExpressions(hostBindingsMetadata.attributes); styleBuilder.assignHostAttrs(hostAttrs, definitionMap); if (styleBuilder.hasBindings) { // finally each binding that was registered in the statement above will need to be added to // the update block of a component/directive templateFn/hostBindingsFn so that the bindings // are evaluated and updated for the element. styleBuilder.buildUpdateLevelInstructions(getValueConverter()).forEach(function (instruction) { if (instruction.calls.length > 0) { var calls_1 = []; instruction.calls.forEach(function (call) { // we subtract a value of `1` here because the binding slot was already allocated // at the top of this method when all the input bindings were counted. totalHostVarsCount += Math.max(call.allocateBindingSlots - styling_builder_1.MIN_STYLING_BINDING_SLOTS_REQUIRED, 0); calls_1.push(convertStylingCall(call, bindingContext, bindingFn)); }); updateStatements.push(util_3.chainedInstruction(instruction.reference, calls_1).toStmt()); } }); } if (totalHostVarsCount) { definitionMap.set('hostVars', o.literal(totalHostVarsCount)); } if (createStatements.length > 0 || updateStatements.length > 0) { var hostBindingsFnName = name ? name + "_HostBindings" : null; var statements = []; if (createStatements.length > 0) { statements.push(template_1.renderFlagCheckIfStmt(1 /* Create */, createStatements)); } if (updateStatements.length > 0) { statements.push(template_1.renderFlagCheckIfStmt(2 /* Update */, updateStatements)); } 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); } return null; } function bindingFn(implicit, value) { return expression_converter_1.convertPropertyBinding(null, implicit, value, 'b', expression_converter_1.BindingForm.Expression, function () { return util_1.error('Unexpected interpolation'); }); } function convertStylingCall(call, bindingContext, bindingFn) { return call.params(function (value) { return bindingFn(bindingContext, value).currValExpr; }); } function getBindingNameAndInstruction(binding) { var bindingName = binding.name; var instruction; // Check to see if this is an attr binding or a property binding var attrMatches = bindingName.match(ATTR_REGEX); if (attrMatches) { bindingName = attrMatches[1]; instruction = r3_identifiers_1.Identifiers.attribute; } else { if (binding.isAnimation) { bindingName = util_2.prepareSyntheticPropertyName(bindingName); // host bindings that have a synthetic property (e.g. @foo) should always be rendered // in the context of the component and not the parent. Therefore there is a special // compatibility instruction available for this purpose. instruction = r3_identifiers_1.Identifiers.syntheticHostProperty; } else { instruction = r3_identifiers_1.Identifiers.hostProperty; } } return { bindingName: bindingName, instruction: instruction, isAttribute: !!attrMatches }; } function createHostListeners(eventBindings, name) { var listeners = []; var syntheticListeners = []; var instructions = []; eventBindings.forEach(function (binding) { var bindingName = binding.name && parse_util_1.sanitizeIdentifier(binding.name); var bindingFnName = binding.type === 1 /* Animation */ ? util_2.prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) : bindingName; var handlerName = name && bindingName ? name + "_" + bindingFnName + "_HostBindingHandler" : null; var params = template_1.prepareEventListenerParameters(r3_ast_1.BoundEvent.fromParsedEvent(binding), handlerName); if (binding.type == 1 /* Animation */) { syntheticListeners.push(params); } else { listeners.push(params); } }); if (syntheticListeners.length > 0) { instructions.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.syntheticHostListener, syntheticListeners).toStmt()); } if (listeners.length > 0) { instructions.push(util_3.chainedInstruction(r3_identifiers_1.Identifiers.listener, listeners).toStmt()); } return instructions; } function metadataAsSummary(meta) { // clang-format off return { // This is used by the BindingParser, which only deals with listeners and properties. There's no // need to pass attributes to it. hostAttributes: {}, hostListeners: meta.listeners, hostProperties: meta.properties, }; // clang-format on } var HOST_REG_EXP = /^(?:\[([^\]]+)\])|(?:\(([^\)]+)\))$/; function parseHostBindings(host) { var e_4, _a; var attributes = {}; var listeners = {}; var properties = {}; var specialAttributes = {}; try { for (var _b = tslib_1.__values(Object.keys(host)), _c = _b.next(); !_c.done; _c = _b.next()) { var key = _c.value; var value = host[key]; var matches = key.match(HOST_REG_EXP); if (matches === null) { switch (key) { case 'class': if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Class binding must be string"); } specialAttributes.classAttr = value; break; case 'style': if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Style binding must be string"); } specialAttributes.styleAttr = value; break; default: if (typeof value === 'string') { attributes[key] = o.literal(value); } else { attributes[key] = value; } } } else if (matches[1 /* Binding */] != null) { if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Property binding must be string"); } // synthetic properties (the ones that have a `@` as a prefix) // are still treated the same as regular properties. Therefore // there is no point in storing them in a separate map. properties[matches[1 /* Binding */]] = value; } else if (matches[2 /* Event */] != null) { if (typeof value !== 'string') { // TODO(alxhub): make this a diagnostic. throw new Error("Event binding must be string"); } listeners[matches[2 /* Event */]] = value; } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_4) throw e_4.error; } } return { attributes: attributes, listeners: listeners, properties: properties, specialAttributes: specialAttributes }; } exports.parseHostBindings = parseHostBindings; /** * Verifies host bindings and returns the list of errors (if any). Empty array indicates that a * given set of host bindings has no errors. * * @param bindings set of host bindings to verify. * @param sourceSpan source span where host bindings were defined. * @returns array of errors associated with a given set of host bindings. */ function verifyHostBindings(bindings, sourceSpan) { var summary = metadataAsSummary(bindings); // TODO: abstract out host bindings verification logic and use it instead of // creating events and properties ASTs to detect errors (FW-996) var bindingParser = template_1.makeBindingParser(); bindingParser.createDirectiveHostEventAsts(summary, sourceSpan); bindingParser.createBoundHostProperties(summary, sourceSpan); return bindingParser.errors; } exports.verifyHostBindings = verifyHostBindings; function compileStyles(styles, selector, hostSelector) { var shadowCss = new shadow_css_1.ShadowCss(); return styles.map(function (style) { return shadowCss.shimCssText(style, selector, hostSelector); }); } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci9zcmMvcmVuZGVyMy92aWV3L2NvbXBpbGVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRzs7Ozs7Ozs7Ozs7Ozs7SUFHSCxpR0FBNkY7SUFFN0YsaURBQW1DO0lBRW5DLDJEQUE2QztJQUM3QywrREFBaUY7SUFDakYsMkRBQTREO0lBQzVELCtEQUEyQztJQUMzQyx1RUFBNkQ7SUFFN0QsbURBQWlDO0lBQ2pDLCtEQUFxQztJQUNyQywrRUFBb0Q7SUFDcEQsMkRBQXFJO0lBR3JJLHNGQUE2RztJQUM3Ryx3RUFBb0w7SUFDcEwsZ0VBQTRMO0lBRzVMLDZGQUE2RjtJQUM3Rix5RkFBeUY7SUFDekYsSUFBTSxVQUFVLEdBQUcsZ0JBQWdCLENBQUM7SUFFcEMsU0FBUyxtQkFBbUIsQ0FDeEIsSUFBeUIsRUFBRSxZQUEwQixFQUNyRCxhQUE0QjtRQUM5QixJQUFNLGFBQWEsR0FBRyxJQUFJLG9CQUFhLEVBQUUsQ0FBQztRQUMxQyxJQUFNLFNBQVMsR0FBRyxJQUFJL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